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 ();
Base class for device energy models.
Smart pointer class similar to boost::intrusive_ptr.
A simple device energy model where current drain can be set by the user.
virtual double DoGetCurrentA(void) const
virtual Ptr< Node > GetNode(void) const
Gets pointer to node.
void SetCurrentA(double current)
TracedValue< double > m_totalEnergyConsumption
Total energy consumption trace.
virtual ~SimpleDeviceEnergyModel()
static TypeId GetTypeId(void)
Get the type ID.
virtual double GetTotalEnergyConsumption(void) const
SimpleDeviceEnergyModel()
void DoDispose(void)
Destructor implementation.
Time m_lastUpdateTime
Last update time.
virtual void SetNode(Ptr< Node > node)
Sets pointer to node.
virtual void SetEnergySource(Ptr< EnergySource > source)
Sets pointer to EnergySouce installed on node.
double m_actualCurrentA
actual curred (in Ampere)
Ptr< EnergySource > m_source
Energy source.
static Time Now(void)
Return the current simulation virtual time.
Simulation virtual time values and global simulation resolution.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
#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.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Time Seconds(double value)
Construct a Time in the indicated unit.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Every class exported by the ns3 library is enclosed in the ns3 namespace.