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 ();
std::vector< Ptr< DeviceEnergyModel > >::const_iterator Iterator
#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.
#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.
void Add(DeviceEnergyModelContainer container)
Holds a vector of ns3::DeviceEnergyModel pointers.
void BreakDeviceEnergyModelRefCycle(void)
This function is called to break reference cycle between EnergySource and DeviceEnergyModel.
void NotifyEnergyRecharged(void)
This function notifies all DeviceEnergyModel of energy recharged event.
void NotifyEnergyChanged(void)
This function notifies all DeviceEnergyModel of energy changed event.
virtual void DoDispose(void)
All child's implementation must call BreakDeviceEnergyModelRefCycle to ensure reference cycles to Dev...
static TypeId GetTypeId(void)
double CalculateTotalCurrent(void)
void ConnectEnergyHarvester(Ptr< EnergyHarvester > energyHarvesterPtr)
void InitializeDeviceModels(void)
Calls Start () method of the device energy models.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void AppendDeviceEnergyModel(Ptr< DeviceEnergyModel > deviceEnergyModelPtr)
Ptr< Node > m_node
Pointer to node containing this EnergySource.
void NotifyEnergyDrained(void)
This function notifies all DeviceEnergyModel of energy depletion event.
Iterator End(void) const
Get an iterator which refers to the last DeviceEnergyModel pointer in the container.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Iterator Begin(void) const
Get an iterator which refers to the first DeviceEnergyModel pointer in the container.
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.
void DisposeDeviceModels(void)
Calls Dispose () method of the device energy models.
DeviceEnergyModelContainer FindDeviceEnergyModels(TypeId tid)
A base class which provides memory management and object aggregation.
void SetNode(Ptr< Node > node)
Sets pointer to node containing this EnergySource.
a unique identifier for an interface.
Ptr< Node > GetNode(void) const
TypeId SetParent(TypeId tid)
Set the parent TypeId.
void Clear(void)
Removes all elements in the container.
virtual double GetSupplyVoltage(void) const =0