32 .SetGroupName(
"Energy");
76 if ((*i)->GetInstanceTypeId() == tid)
92 if ((*i)->GetInstanceTypeId().GetName() == name)
157 double totalCurrentA = 0.0;
161 totalCurrentA += (*i)->GetCurrentA();
166 double totalHarvestedPower = 0.0;
170 totalHarvestedPower += (*harvester)->GetPower();
175 if (supplyVoltage != 0)
177 double currentHarvestersA = totalHarvestedPower / supplyVoltage;
178 NS_LOG_DEBUG(
" Total harvested power: " << totalHarvestedPower
179 <<
"| Current from harvesters: "
180 << currentHarvestersA);
181 totalCurrentA -= currentHarvestersA;
185 return totalCurrentA;
196 (*i)->HandleEnergyDepletion();
208 (*i)->HandleEnergyRecharged();
220 (*i)->HandleEnergyChanged();
A base class which provides memory management and object aggregation.
Smart pointer class similar to boost::intrusive_ptr.
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.
Holds a vector of ns3::DeviceEnergyModel pointers.
void Add(DeviceEnergyModelContainer container)
std::vector< Ptr< DeviceEnergyModel > >::const_iterator Iterator
Const iterator of DeviceEnergyModel container.
Iterator End() const
Get an iterator which refers to the last DeviceEnergyModel pointer in the container.
Iterator Begin() const
Get an iterator which refers to the first DeviceEnergyModel pointer in the container.
void Clear()
Removes all elements in the container.
void BreakDeviceEnergyModelRefCycle()
This function is called to break reference cycle between EnergySource and DeviceEnergyModel.
void NotifyEnergyDrained()
This function notifies all DeviceEnergyModel of energy depletion event.
DeviceEnergyModelContainer FindDeviceEnergyModels(TypeId tid)
double CalculateTotalCurrent()
void ConnectEnergyHarvester(Ptr< EnergyHarvester > energyHarvesterPtr)
void InitializeDeviceModels()
Calls Start () method of the device energy models.
void NotifyEnergyRecharged()
This function notifies all DeviceEnergyModel of energy recharged event.
std::vector< Ptr< EnergyHarvester > > m_harvesters
Vector of EnergyHarvester pointer connected to the same energy source.
DeviceEnergyModelContainer m_models
List of device energy models installed on the same node.
static TypeId GetTypeId()
Get the type ID.
void DoDispose() override
All child's implementation must call BreakDeviceEnergyModelRefCycle to ensure reference cycles to Dev...
Ptr< Node > m_node
Pointer to node containing this EnergySource.
void SetNode(Ptr< Node > node)
Sets pointer to node containing this EnergySource.
void NotifyEnergyChanged()
This function notifies all DeviceEnergyModel of energy changed event.
void AppendDeviceEnergyModel(Ptr< DeviceEnergyModel > deviceEnergyModelPtr)
virtual double GetSupplyVoltage() const =0
void DisposeDeviceModels()
Calls Dispose () method of the device energy models.
Ptr< Node > GetNode() const
#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_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#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.
Every class exported by the ns3 library is enclosed in the ns3 namespace.