21 #include "ns3/simulator.h" 22 #include "ns3/trace-source-accessor.h" 23 #include "ns3/energy-source.h" 36 static TypeId tid =
TypeId (
"ns3::SimpleDeviceEnergyModel")
38 .SetGroupName (
"Energy")
40 .AddTraceSource (
"TotalEnergyConsumption",
41 "Total energy consumption of the radio device.",
43 "ns3::TracedValueCallback::Double")
90 double energyToDecrease = 0.0;
91 double supplyVoltage =
m_source->GetSupplyVoltage ();
105 double energyToDecrease = 0.0;
106 double supplyVoltage =
m_source->GetSupplyVoltage ();
107 energyToDecrease = duration.
GetSeconds () * current * supplyVoltage;
Simulation virtual time values and global simulation resolution.
Smart pointer class similar to boost::intrusive_ptr.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
Ptr< EnergySource > m_source
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Base class for device energy models.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
virtual void SetEnergySource(Ptr< EnergySource > source)
Sets pointer to EnergySouce installed on node.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
void SetCurrentA(double current)
virtual ~SimpleDeviceEnergyModel()
A simple device energy model where current drain can be set by the user.
virtual Ptr< Node > GetNode(void) const
Gets pointer to node.
static TypeId GetTypeId(void)
SimpleDeviceEnergyModel()
TracedValue< double > m_totalEnergyConsumption
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual double GetTotalEnergyConsumption(void) const
void DoDispose(void)
Destructor implementation.
static Time Now(void)
Return the current simulation virtual time.
Time Seconds(double value)
Construct a Time in the indicated unit.
virtual double DoGetCurrentA(void) const
virtual void SetNode(Ptr< Node > node)
Sets pointer to node.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.