25 #include "ns3/simulator.h"
26 #include "ns3/trace-source-accessor.h"
38 static TypeId tid =
TypeId(
"ns3::SimpleDeviceEnergyModel")
40 .SetGroupName(
"Energy")
42 .AddTraceSource(
"TotalEnergyConsumption",
43 "Total energy consumption of the radio device.",
46 "ns3::TracedValueCallback::Double");
92 double energyToDecrease = 0.0;
93 double supplyVoltage =
m_source->GetSupplyVoltage();
107 double energyToDecrease = 0.0;
108 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.
static TypeId GetTypeId()
Get the type ID.
virtual Ptr< Node > GetNode() const
Gets pointer to node.
~SimpleDeviceEnergyModel() override
void SetCurrentA(double current)
TracedValue< double > m_totalEnergyConsumption
Total energy consumption trace.
SimpleDeviceEnergyModel()
double GetTotalEnergyConsumption() const override
void DoDispose() override
Destructor implementation.
Time m_lastUpdateTime
Last update time.
virtual void SetNode(Ptr< Node > node)
Sets pointer to node.
double DoGetCurrentA() const override
double m_actualCurrentA
actual curred (in Ampere)
void SetEnergySource(Ptr< EnergySource > source) override
Sets pointer to EnergySource installed on node.
Ptr< EnergySource > m_source
Energy source.
static Time Now()
Return the current simulation virtual time.
Simulation virtual time values and global simulation resolution.
double GetSeconds() 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.