BasicEnergySource decreases/increases remaining energy stored in itself in linearly. More...
#include <basic-energy-source.h>
Public Member Functions | |
BasicEnergySource () | |
virtual | ~BasicEnergySource () |
virtual double | GetEnergyFraction (void) |
Time | GetEnergyUpdateInterval (void) const |
virtual double | GetInitialEnergy (void) const |
virtual double | GetRemainingEnergy (void) |
virtual double | GetSupplyVoltage (void) const |
void | SetEnergyUpdateInterval (Time interval) |
void | SetInitialEnergy (double initialEnergyJ) |
void | SetSupplyVoltage (double supplyVoltageV) |
virtual void | UpdateEnergySource (void) |
Implements UpdateEnergySource. More... | |
![]() | |
EnergySource () | |
virtual | ~EnergySource () |
void | AppendDeviceEnergyModel (Ptr< DeviceEnergyModel > deviceEnergyModelPtr) |
void | ConnectEnergyHarvester (Ptr< EnergyHarvester > energyHarvesterPtr) |
void | DisposeDeviceModels (void) |
Calls Dispose () method of the device energy models. More... | |
DeviceEnergyModelContainer | FindDeviceEnergyModels (TypeId tid) |
DeviceEnergyModelContainer | FindDeviceEnergyModels (std::string name) |
Ptr< Node > | GetNode (void) const |
void | InitializeDeviceModels (void) |
Calls Start () method of the device energy models. More... | |
void | SetNode (Ptr< Node > node) |
Sets pointer to node containing this EnergySource. More... | |
![]() | |
Object () | |
virtual | ~Object () |
void | AggregateObject (Ptr< Object > other) |
void | Dispose (void) |
Run the DoDispose methods of this object and all the objects aggregated to it. More... | |
AggregateIterator | GetAggregateIterator (void) const |
virtual TypeId | GetInstanceTypeId (void) const |
template<typename T > | |
Ptr< T > | GetObject (void) const |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
void | Initialize (void) |
This method calls the virtual DoInitialize method on all the objects aggregated to this object. More... | |
![]() | |
SimpleRefCount () | |
Constructor. More... | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. More... | |
uint32_t | GetReferenceCount (void) const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment. More... | |
void | Ref (void) const |
Increment the reference count. More... | |
void | Unref (void) const |
Decrement the reference count. More... | |
![]() | |
virtual | ~ObjectBase () |
Virtual destructor. More... | |
void | GetAttribute (std::string name, AttributeValue &value) const |
bool | GetAttributeFailSafe (std::string name, AttributeValue &attribute) const |
void | SetAttribute (std::string name, const AttributeValue &value) |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
![]() | |
static TypeId | GetTypeId (void) |
![]() | |
static TypeId | GetTypeId (void) |
Register this type. More... | |
![]() | |
static void | Cleanup (void) |
Noop. More... | |
![]() | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Private Member Functions | |
void | CalculateRemainingEnergy (void) |
Calculates remaining energy. More... | |
void | DoDispose (void) |
Defined in ns3::Object. More... | |
void | DoInitialize (void) |
Defined in ns3::Object. More... | |
void | HandleEnergyDrainedEvent (void) |
Handles the remaining energy going to zero event. More... | |
void | HandleEnergyRechargedEvent (void) |
Handles the remaining energy exceeding the high threshold after it went below the low threshold. More... | |
Private Attributes | |
bool | m_depleted |
EventId | m_energyUpdateEvent |
Time | m_energyUpdateInterval |
double | m_highBatteryTh |
double | m_initialEnergyJ |
Time | m_lastUpdateTime |
double | m_lowBatteryTh |
TracedValue< double > | m_remainingEnergyJ |
double | m_supplyVoltageV |
Additional Inherited Members | |
![]() | |
void | BreakDeviceEnergyModelRefCycle (void) |
This function is called to break reference cycle between EnergySource and DeviceEnergyModel. More... | |
double | CalculateTotalCurrent (void) |
void | NotifyEnergyDrained (void) |
This function notifies all DeviceEnergyModel of energy depletion event. More... | |
void | NotifyEnergyRecharged (void) |
This function notifies all DeviceEnergyModel of energy recharged event. More... | |
![]() | |
Object (const Object &o) | |
virtual void | NotifyNewAggregate (void) |
This method is invoked whenever two sets of objects are aggregated together. More... | |
![]() | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
virtual void | NotifyConstructionCompleted (void) |
This method is invoked once all member attributes have been initialized. More... | |
BasicEnergySource decreases/increases remaining energy stored in itself in linearly.
Doxygen introspection did not find any typical Config paths.
Definition at line 37 of file basic-energy-source.h.
ns3::BasicEnergySource::BasicEnergySource | ( | ) |
Definition at line 75 of file basic-energy-source.cc.
References m_depleted, m_lastUpdateTime, NS_LOG_FUNCTION, and ns3::Seconds().
|
virtual |
Definition at line 82 of file basic-energy-source.cc.
References NS_LOG_FUNCTION.
|
private |
Calculates remaining energy.
This function uses the total current from all device models to calculate the amount of energy to decrease. The energy to decrease is given by: energy to decrease = total current * supply voltage * time duration This function subtracts the calculated energy to decrease from remaining energy.
Definition at line 223 of file basic-energy-source.cc.
References ns3::EnergySource::CalculateTotalCurrent(), ns3::Time::GetSeconds(), m_lastUpdateTime, m_remainingEnergyJ, m_supplyVoltageV, ns3::Simulator::Now(), NS_ASSERT, NS_LOG_DEBUG, and NS_LOG_FUNCTION.
Referenced by UpdateEnergySource().
|
privatevirtual |
Defined in ns3::Object.
Reimplemented from ns3::EnergySource.
Definition at line 196 of file basic-energy-source.cc.
References ns3::EnergySource::BreakDeviceEnergyModelRefCycle(), and NS_LOG_FUNCTION.
|
privatevirtual |
Defined in ns3::Object.
Reimplemented from ns3::Object.
Definition at line 189 of file basic-energy-source.cc.
References NS_LOG_FUNCTION, and UpdateEnergySource().
|
virtual |
Implements GetEnergyFraction.
Implements ns3::EnergySource.
Definition at line 141 of file basic-energy-source.cc.
References m_initialEnergyJ, m_remainingEnergyJ, NS_LOG_FUNCTION, and UpdateEnergySource().
Time ns3::BasicEnergySource::GetEnergyUpdateInterval | ( | void | ) | const |
Definition at line 111 of file basic-energy-source.cc.
References m_energyUpdateInterval, and NS_LOG_FUNCTION.
Referenced by GetTypeId().
|
virtual |
Implements GetInitialEnergy.
Implements ns3::EnergySource.
Definition at line 125 of file basic-energy-source.cc.
References m_initialEnergyJ, and NS_LOG_FUNCTION.
Referenced by GetTypeId().
|
virtual |
Implements GetRemainingEnergy.
Implements ns3::EnergySource.
Definition at line 132 of file basic-energy-source.cc.
References m_remainingEnergyJ, NS_LOG_FUNCTION, and UpdateEnergySource().
Referenced by AnimationRemainingEnergyTestCase::CheckLogic().
|
virtual |
Implements GetSupplyVoltage.
Implements ns3::EnergySource.
Definition at line 118 of file basic-energy-source.cc.
References m_supplyVoltageV, and NS_LOG_FUNCTION.
Referenced by GetTypeId().
|
static |
Definition at line 35 of file basic-energy-source.cc.
References GetEnergyUpdateInterval(), GetInitialEnergy(), GetSupplyVoltage(), m_highBatteryTh, m_lowBatteryTh, m_remainingEnergyJ, ns3::MakeTimeChecker(), ns3::MakeTraceSourceAccessor(), ns3::Seconds(), SetEnergyUpdateInterval(), SetInitialEnergy(), ns3::TypeId::SetParent(), and SetSupplyVoltage().
|
private |
Handles the remaining energy going to zero event.
This function notifies all the energy models aggregated to the node about the energy being depleted. Each energy model is then responsible for its own handler.
Definition at line 203 of file basic-energy-source.cc.
References m_remainingEnergyJ, ns3::EnergySource::NotifyEnergyDrained(), NS_LOG_DEBUG, and NS_LOG_FUNCTION.
Referenced by UpdateEnergySource().
|
private |
Handles the remaining energy exceeding the high threshold after it went below the low threshold.
This function notifies all the energy models aggregated to the node about the energy being recharged. Each energy model is then responsible for its own handler.
Definition at line 215 of file basic-energy-source.cc.
References ns3::EnergySource::NotifyEnergyRecharged(), NS_LOG_DEBUG, and NS_LOG_FUNCTION.
Referenced by UpdateEnergySource().
void ns3::BasicEnergySource::SetEnergyUpdateInterval | ( | Time | interval | ) |
interval | Energy update interval. |
This function sets the interval between each energy update.
Definition at line 104 of file basic-energy-source.cc.
References m_energyUpdateInterval, and NS_LOG_FUNCTION.
Referenced by GetTypeId().
void ns3::BasicEnergySource::SetInitialEnergy | ( | double | initialEnergyJ | ) |
initialEnergyJ | Initial energy, in Joules |
Sets initial energy stored in the energy source. Note that initial energy is assumed to be set before simulation starts and is set only once per simulation.
Definition at line 88 of file basic-energy-source.cc.
References m_initialEnergyJ, m_remainingEnergyJ, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by GetTypeId(), and AnimationRemainingEnergyTestCase::PrepareNetwork().
void ns3::BasicEnergySource::SetSupplyVoltage | ( | double | supplyVoltageV | ) |
supplyVoltageV | Supply voltage at the energy source, in Volts. |
Sets supply voltage of the energy source.
Definition at line 97 of file basic-energy-source.cc.
References m_supplyVoltageV, and NS_LOG_FUNCTION.
Referenced by GetTypeId().
|
virtual |
Implements UpdateEnergySource.
Implements ns3::EnergySource.
Definition at line 150 of file basic-energy-source.cc.
References CalculateRemainingEnergy(), ns3::EventId::Cancel(), HandleEnergyDrainedEvent(), HandleEnergyRechargedEvent(), ns3::Simulator::IsFinished(), m_depleted, m_energyUpdateEvent, m_energyUpdateInterval, m_highBatteryTh, m_initialEnergyJ, m_lastUpdateTime, m_lowBatteryTh, m_remainingEnergyJ, ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, and ns3::Simulator::Schedule().
Referenced by DoInitialize(), GetEnergyFraction(), and GetRemainingEnergy().
|
private |
Definition at line 143 of file basic-energy-source.h.
Referenced by BasicEnergySource(), and UpdateEnergySource().
|
private |
Definition at line 146 of file basic-energy-source.h.
Referenced by UpdateEnergySource().
|
private |
Definition at line 148 of file basic-energy-source.h.
Referenced by GetEnergyUpdateInterval(), SetEnergyUpdateInterval(), and UpdateEnergySource().
|
private |
Definition at line 142 of file basic-energy-source.h.
Referenced by GetTypeId(), and UpdateEnergySource().
|
private |
Definition at line 139 of file basic-energy-source.h.
Referenced by GetEnergyFraction(), GetInitialEnergy(), SetInitialEnergy(), and UpdateEnergySource().
|
private |
Definition at line 147 of file basic-energy-source.h.
Referenced by BasicEnergySource(), CalculateRemainingEnergy(), and UpdateEnergySource().
|
private |
Definition at line 141 of file basic-energy-source.h.
Referenced by GetTypeId(), and UpdateEnergySource().
|
private |
Definition at line 145 of file basic-energy-source.h.
Referenced by CalculateRemainingEnergy(), GetEnergyFraction(), GetRemainingEnergy(), GetTypeId(), HandleEnergyDrainedEvent(), SetInitialEnergy(), and UpdateEnergySource().
|
private |
Definition at line 140 of file basic-energy-source.h.
Referenced by CalculateRemainingEnergy(), GetSupplyVoltage(), and SetSupplyVoltage().