14#include "ns3/simulator.h"
15#include "ns3/trace-source-accessor.h"
28 static TypeId tid =
TypeId(
"ns3::energy::SimpleDeviceEnergyModel")
31 .SetGroupName(
"Energy")
33 .AddTraceSource(
"TotalEnergyConsumption",
34 "Total energy consumption of the radio device.",
37 "ns3::TracedValueCallback::Double");
83 double energyToDecrease = 0.0;
84 double supplyVoltage =
m_source->GetSupplyVoltage();
98 double energyToDecrease = 0.0;
99 double supplyVoltage =
m_source->GetSupplyVoltage();
Smart pointer class similar to boost::intrusive_ptr.
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 AddDeprecatedName(const std::string &name)
Add an deprecated name for a TypeId.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Base class for device energy models.
A simple device energy model where current drain can be set by the user.
virtual Ptr< Node > GetNode() const
Gets pointer to node.
double m_actualCurrentA
actual curred (in Ampere)
void SetCurrentA(double current)
~SimpleDeviceEnergyModel() override
double DoGetCurrentA() const override
void SetEnergySource(Ptr< EnergySource > source) override
Sets pointer to EnergySource installed on node.
double GetTotalEnergyConsumption() const override
void DoDispose() override
Destructor implementation.
static TypeId GetTypeId()
Get the type ID.
virtual void SetNode(Ptr< Node > node)
Sets pointer to node.
Ptr< EnergySource > m_source
Energy source.
SimpleDeviceEnergyModel()
Time m_lastUpdateTime
Last update time.
TracedValue< double > m_totalEnergyConsumption
Total energy consumption trace.
#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.