|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
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 ();
Iterator End(void) const
Get an iterator which refers to the last DeviceEnergyModel pointer in the container.
a unique identifier for an interface.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
std::vector< Ptr< EnergyHarvester > > m_harvesters
Vector of EnergyHarvester pointer connected to the same energy source.
#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,...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Iterator Begin(void) const
Get an iterator which refers to the first DeviceEnergyModel pointer in the container.
void NotifyEnergyChanged(void)
This function notifies all DeviceEnergyModel of energy changed event.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Ptr< Node > GetNode(void) const
void NotifyEnergyDrained(void)
This function notifies all DeviceEnergyModel of energy depletion event.
double CalculateTotalCurrent(void)
A base class which provides memory management and object aggregation.
void InitializeDeviceModels(void)
Calls Start () method of the device energy models.
void SetNode(Ptr< Node > node)
Sets pointer to node containing this EnergySource.
std::vector< Ptr< DeviceEnergyModel > >::const_iterator Iterator
Holds a vector of ns3::DeviceEnergyModel pointers.
void BreakDeviceEnergyModelRefCycle(void)
This function is called to break reference cycle between EnergySource and DeviceEnergyModel.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
void DisposeDeviceModels(void)
Calls Dispose () method of the device energy models.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
virtual double GetSupplyVoltage(void) const =0
Ptr< Node > m_node
Pointer to node containing this EnergySource.
void Clear(void)
Removes all elements in the container.
void NotifyEnergyRecharged(void)
This function notifies all DeviceEnergyModel of energy recharged event.
virtual void DoDispose(void)
All child's implementation must call BreakDeviceEnergyModelRefCycle to ensure reference cycles to Dev...
static TypeId GetTypeId(void)
DeviceEnergyModelContainer FindDeviceEnergyModels(TypeId tid)
void Add(DeviceEnergyModelContainer container)
DeviceEnergyModelContainer m_models
List of device energy models installed on the same node.
void AppendDeviceEnergyModel(Ptr< DeviceEnergyModel > deviceEnergyModelPtr)
void ConnectEnergyHarvester(Ptr< EnergyHarvester > energyHarvesterPtr)