83 if ((*i)->GetInstanceTypeId() == tid)
99 if ((*i)->GetInstanceTypeId().GetName() == name)
164 double totalCurrentA = 0.0;
168 totalCurrentA += (*i)->GetCurrentA();
173 double totalHarvestedPower = 0.0;
177 totalHarvestedPower += (*harvester)->GetPower();
182 if (supplyVoltage != 0)
184 double currentHarvestersA = totalHarvestedPower / supplyVoltage;
185 NS_LOG_DEBUG(
" Total harvested power: " << totalHarvestedPower
186 <<
"| Current from harvesters: "
187 << currentHarvestersA);
188 totalCurrentA -= currentHarvestersA;
192 return totalCurrentA;
203 (*i)->HandleEnergyDepletion();
215 (*i)->HandleEnergyRecharged();
227 (*i)->HandleEnergyChanged();
Holds a vector of ns3::DeviceEnergyModel pointers.
void Clear()
Removes all elements in the container.
void Add(DeviceEnergyModelContainer container)
std::vector< Ptr< DeviceEnergyModel > >::const_iterator Iterator
Const iterator of DeviceEnergyModel container.
Iterator Begin() const
Get an iterator which refers to the first DeviceEnergyModel pointer in the container.
Iterator End() const
Get an iterator which refers to the last DeviceEnergyModel pointer in the container.
void AppendDeviceEnergyModel(Ptr< DeviceEnergyModel > deviceEnergyModelPtr)
void ConnectEnergyHarvester(Ptr< EnergyHarvester > energyHarvesterPtr)
void DisposeDeviceModels()
Calls Dispose () method of the device energy models.
double CalculateTotalCurrent()
void NotifyEnergyRecharged()
This function notifies all DeviceEnergyModel of energy recharged event.
void InitializeDeviceModels()
Calls Start () method of the device energy models.
DeviceEnergyModelContainer m_models
List of device energy models installed on the same node.
Ptr< Node > m_node
Pointer to node containing this EnergySource.
void NotifyEnergyChanged()
This function notifies all DeviceEnergyModel of energy changed event.
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.
std::vector< Ptr< EnergyHarvester > > m_harvesters
Vector of EnergyHarvester pointer connected to the same energy source.
Ptr< Node > GetNode() const
static TypeId GetTypeId()
Get the type ID.
DeviceEnergyModelContainer FindDeviceEnergyModels(TypeId tid)
void DoDispose() override
All child's implementation must call BreakDeviceEnergyModelRefCycle to ensure reference cycles to Dev...
void SetNode(Ptr< Node > node)
Sets pointer to node containing this EnergySource.
virtual double GetSupplyVoltage() const =0
A base class which provides memory management and object aggregation.
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_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.