40 .SetGroupName (
"Energy")
85 if ((*i)->GetInstanceTypeId () == tid)
101 if ((*i)->GetInstanceTypeId ().GetName ().compare (name) == 0)
166 double totalCurrentA = 0.0;
170 totalCurrentA += (*i)->GetCurrentA ();
173 double totalHarvestedPower = 0.0;
175 std::vector< Ptr<EnergyHarvester> >::const_iterator harvester;
178 totalHarvestedPower += (*harvester)->GetPower ();
181 NS_LOG_DEBUG (
"EnergySource("<<
GetNode ()->GetId () <<
"): Total harvested power = " << totalHarvestedPower);
184 NS_LOG_DEBUG (
"EnergySource("<<
GetNode ()->GetId () <<
"): Current from harvesters = " << currentHarvestersA);
186 totalCurrentA -= currentHarvestersA;
188 return totalCurrentA;
199 (*i)->HandleEnergyDepletion ();
211 (*i)->HandleEnergyRecharged ();
223 (*i)->HandleEnergyChanged ();
Holds a vector of ns3::DeviceEnergyModel pointers.
Iterator End(void) const
Get an iterator which refers to the last DeviceEnergyModel pointer in the container.
void Add(DeviceEnergyModelContainer container)
Iterator Begin(void) const
Get an iterator which refers to the first DeviceEnergyModel pointer in the container.
std::vector< Ptr< DeviceEnergyModel > >::const_iterator Iterator
Const iterator of DeviceEnergyModel container.
void Clear(void)
Removes all elements in the container.
void AppendDeviceEnergyModel(Ptr< DeviceEnergyModel > deviceEnergyModelPtr)
void ConnectEnergyHarvester(Ptr< EnergyHarvester > energyHarvesterPtr)
void NotifyEnergyRecharged(void)
This function notifies all DeviceEnergyModel of energy recharged event.
void DisposeDeviceModels(void)
Calls Dispose () method of the device energy models.
void NotifyEnergyChanged(void)
This function notifies all DeviceEnergyModel of energy changed event.
std::vector< Ptr< EnergyHarvester > > m_harvesters
Vector of EnergyHarvester pointer connected to the same energy source.
Ptr< Node > GetNode(void) const
void BreakDeviceEnergyModelRefCycle(void)
This function is called to break reference cycle between EnergySource and DeviceEnergyModel.
DeviceEnergyModelContainer m_models
List of device energy models installed on the same node.
virtual double GetSupplyVoltage(void) const =0
Ptr< Node > m_node
Pointer to node containing this EnergySource.
void InitializeDeviceModels(void)
Calls Start () method of the device energy models.
double CalculateTotalCurrent(void)
DeviceEnergyModelContainer FindDeviceEnergyModels(TypeId tid)
virtual void DoDispose(void)
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.
void NotifyEnergyDrained(void)
This function notifies all DeviceEnergyModel of energy depletion event.
static TypeId GetTypeId(void)
Get the type ID.
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.