32 .SetGroupName(
"Energy");
75 if ((*i)->GetInstanceTypeId() == tid)
90 if ((*i)->GetInstanceTypeId().GetName() == name)
153 double totalCurrentA = 0.0;
156 totalCurrentA += (*i)->GetCurrentA();
161 double totalHarvestedPower = 0.0;
165 totalHarvestedPower += (*harvester)->GetPower();
170 if (supplyVoltage != 0)
172 double currentHarvestersA = totalHarvestedPower / supplyVoltage;
173 NS_LOG_DEBUG(
" Total harvested power: " << totalHarvestedPower
174 <<
"| Current from harvesters: "
175 << currentHarvestersA);
176 totalCurrentA -= currentHarvestersA;
180 return totalCurrentA;
190 (*i)->HandleEnergyDepletion();
201 (*i)->HandleEnergyRecharged();
212 (*i)->HandleEnergyChanged();
Object()
Caller graph was not generated because of its size.
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.
Energy source base class.
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.