#include <basic-energy-source.h>
Public Member Functions | |
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) |
Public Member Functions inherited from ns3::EnergySource | |
void | AppendDeviceEnergyModel (Ptr< DeviceEnergyModel > deviceEnergyModelPtr) |
void | DisposeDeviceModels (void) |
DeviceEnergyModelContainer | FindDeviceEnergyModels (TypeId tid) |
DeviceEnergyModelContainer | FindDeviceEnergyModels (std::string name) |
Ptr< Node > | GetNode (void) const |
void | InitializeDeviceModels (void) |
void | SetNode (Ptr< Node > node) |
Sets pointer to node containing this EnergySource. More... | |
Public Member Functions inherited from ns3::Object | |
void | AggregateObject (Ptr< Object > other) |
void | Dispose (void) |
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) |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount (const SimpleRefCount &o) | |
uint32_t | GetReferenceCount (void) const |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
void | Ref (void) const |
void | Unref (void) const |
Public Member Functions inherited from ns3::ObjectBase | |
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 Public Member Functions inherited from ns3::EnergySource | |
static TypeId | GetTypeId (void) |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId (void) |
Static Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
static void | Cleanup (void) |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId (void) |
Private Member Functions | |
void | CalculateRemainingEnergy (void) |
void | DoDispose (void) |
Defined in ns3::Object. | |
void | DoInitialize (void) |
Defined in ns3::Object. | |
void | HandleEnergyDrainedEvent (void) |
Private Attributes | |
EventId | m_energyUpdateEvent |
Time | m_energyUpdateInterval |
double | m_initialEnergyJ |
Time | m_lastUpdateTime |
TracedValue< double > | m_remainingEnergyJ |
double | m_supplyVoltageV |
Additional Inherited Members | |
Protected Member Functions inherited from ns3::EnergySource | |
void | BreakDeviceEnergyModelRefCycle (void) |
double | CalculateTotalCurrent (void) |
void | NotifyEnergyDrained (void) |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
virtual void | NotifyNewAggregate (void) |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
virtual void | NotifyConstructionCompleted (void) |
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.
|
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 195 of file basic-energy-source.cc.
References ns3::EnergySource::CalculateTotalCurrent(), ns3::Time::GetSeconds(), ns3::Simulator::Now(), NS_ASSERT, NS_LOG_DEBUG, and NS_LOG_FUNCTION.
Referenced by UpdateEnergySource().
|
virtual |
Implements GetEnergyFraction.
Implements ns3::EnergySource.
Definition at line 130 of file basic-energy-source.cc.
References NS_LOG_FUNCTION, and UpdateEnergySource().
Time ns3::BasicEnergySource::GetEnergyUpdateInterval | ( | void | ) | const |
Definition at line 100 of file basic-energy-source.cc.
References NS_LOG_FUNCTION.
|
virtual |
Implements GetInitialEnergy.
Implements ns3::EnergySource.
Definition at line 114 of file basic-energy-source.cc.
References NS_LOG_FUNCTION.
|
virtual |
Implements GetRemainingEnergy.
Implements ns3::EnergySource.
Definition at line 121 of file basic-energy-source.cc.
References NS_LOG_FUNCTION, and UpdateEnergySource().
|
virtual |
Implements GetSupplyVoltage.
Implements ns3::EnergySource.
Definition at line 107 of file basic-energy-source.cc.
References NS_LOG_FUNCTION.
|
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 186 of file basic-energy-source.cc.
References ns3::EnergySource::NotifyEnergyDrained(), 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 93 of file basic-energy-source.cc.
References NS_LOG_FUNCTION.
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 77 of file basic-energy-source.cc.
References NS_ASSERT, and NS_LOG_FUNCTION.
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 86 of file basic-energy-source.cc.
References NS_LOG_FUNCTION.
|
virtual |
Implements UpdateEnergySource.
Implements ns3::EnergySource.
Definition at line 139 of file basic-energy-source.cc.
References CalculateRemainingEnergy(), ns3::EventId::Cancel(), HandleEnergyDrainedEvent(), ns3::Simulator::IsFinished(), ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, and ns3::Simulator::Schedule().
Referenced by DoInitialize(), GetEnergyFraction(), and GetRemainingEnergy().