Rakhmatov Vrudhula non-linear battery model. More...
#include <rv-battery-model.h>
Public Member Functions | |
RvBatteryModel () | |
virtual | ~RvBatteryModel () |
double | GetAlpha (void) const |
double | GetBatteryLevel (void) |
double | GetBeta (void) const |
double | GetCutoffVoltage (void) const |
virtual double | GetEnergyFraction (void) |
virtual double | GetInitialEnergy (void) const |
Time | GetLifetime (void) const |
int | GetNumOfTerms (void) const |
double | GetOpenCircuitVoltage (void) const |
virtual double | GetRemainingEnergy (void) |
Time | GetSamplingInterval (void) const |
virtual double | GetSupplyVoltage (void) const |
void | SetAlpha (double alpha) |
Sets the alpha value for the battery model. | |
void | SetBeta (double beta) |
Sets the beta value for the battery model. | |
void | SetCutoffVoltage (double voltage) |
Sets cutoff voltage of battery. | |
void | SetNumOfTerms (int num) |
Sets the number of terms of the infinite sum for estimating battery level. | |
void | SetOpenCircuitVoltage (double voltage) |
Sets open circuit voltage of battery. | |
void | SetSamplingInterval (Time interval) |
virtual void | UpdateEnergySource (void) |
![]() | |
EnergySource () | |
virtual | ~EnergySource () |
void | AppendDeviceEnergyModel (Ptr< DeviceEnergyModel > deviceEnergyModelPtr) |
void | DisposeDeviceModels (void) |
DeviceEnergyModelContainer | FindDeviceEnergyModels (TypeId tid) |
DeviceEnergyModelContainer | FindDeviceEnergyModels (std::string name) |
Ptr< Node > | GetNode (void) const |
void | SetNode (Ptr< Node > node) |
Sets pointer to node containing this EnergySource. | |
void | StartDeviceModels (void) |
![]() | |
Object () | |
virtual | ~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 | Start (void) |
![]() | |
SimpleRefCount () | |
SimpleRefCount (const SimpleRefCount &o) | |
uint32_t | GetReferenceCount (void) const |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
void | Ref (void) const |
void | Unref (void) const |
![]() | |
virtual | ~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) |
This method returns the TypeId associated to ns3::RvBatteryModel. |
Private Member Functions | |
double | Discharge (double load, Time t) |
Discharges the battery. | |
virtual void | DoDispose (void) |
Defined in ns3::Object. | |
virtual void | DoStart (void) |
Defined in ns3::Object. | |
void | HandleEnergyDrainedEvent (void) |
double | RvModelAFunction (Time t, Time sk, Time sk_1, double beta) |
RV model A function. |
Private Attributes | |
double | m_alpha |
TracedValue< double > | m_batteryLevel |
double | m_beta |
uint64_t | m_counter |
EventId | m_currentSampleEvent |
double | m_cutoffVoltage |
Time | m_lastSampleTime |
TracedValue< Time > | m_lifetime |
std::vector< double > | m_load |
int | m_numOfTerms |
double | m_openCircuitVoltage |
double | m_previousLoad |
Time | m_samplingInterval |
std::vector< Time > | m_timeStamps |
Additional Inherited Members | |
![]() | |
void | BreakDeviceEnergyModelRefCycle (void) |
double | CalculateTotalCurrent (void) |
void | NotifyEnergyDrained (void) |
Rakhmatov Vrudhula non-linear battery model.
This (energy source) model implements an analytical non-linear battery model. It is capable of capturing load capacity and recovery effects of batteries. Batteries are characterized by 2 parameters, alpha and beta, which can both be obtained from the discharge curve of the batteries.
The model is developed by Daler Rakhmatov & Sarma Vrudhula in: "Battery Lifetime Prediction for Energy-Aware Computing" and "An Analytical High-Level Battery Model for Use in Energy Management of Portable Electronic Systems".
The real-time algorithm is developed by Matthias Handy & Dirk Timmermann in: "Simulation of Mobile Wireless Networks with Accurate Modeling of non-linear battery effects". The real-time algorithm is modified by the authors of this code for improved accuracy and reduced computation (sampling) overhead.
Definition at line 50 of file rv-battery-model.h.
ns3::RvBatteryModel::RvBatteryModel | ( | ) |
Definition at line 87 of file rv-battery-model.cc.
References m_batteryLevel, m_lastSampleTime, m_lifetime, m_previousLoad, and ns3::Seconds().
|
virtual |
Definition at line 95 of file rv-battery-model.cc.
|
private |
Discharges the battery.
load | Load value (total current form devices, in mA). |
t | Time stamp of the load value. |
Discharge function calculates a value which is then compared to the alpha value to determine if the battery is dead. It will also update the battery level.
Note that the load value passed to Discharge has to be in mA.
Definition at line 299 of file rv-battery-model.cc.
References m_beta, m_lastSampleTime, m_load, m_previousLoad, m_timeStamps, NS_ASSERT, NS_LOG_FUNCTION, RvModelAFunction(), and ns3::Seconds().
Referenced by UpdateEnergySource().
|
privatevirtual |
Defined in ns3::Object.
Definition at line 285 of file rv-battery-model.cc.
References ns3::EnergySource::BreakDeviceEnergyModelRefCycle().
|
privatevirtual |
Defined in ns3::Object.
Definition at line 278 of file rv-battery-model.cc.
References NS_LOG_DEBUG, and UpdateEnergySource().
double ns3::RvBatteryModel::GetAlpha | ( | void | ) | const |
Definition at line 227 of file rv-battery-model.cc.
References m_alpha.
Referenced by GetTypeId().
double ns3::RvBatteryModel::GetBatteryLevel | ( | void | ) |
Definition at line 247 of file rv-battery-model.cc.
References m_batteryLevel, NS_LOG_FUNCTION, and UpdateEnergySource().
Referenced by GetEnergyFraction().
double ns3::RvBatteryModel::GetBeta | ( | void | ) | const |
Definition at line 241 of file rv-battery-model.cc.
References m_beta.
Referenced by GetTypeId().
double ns3::RvBatteryModel::GetCutoffVoltage | ( | void | ) | const |
Definition at line 213 of file rv-battery-model.cc.
References m_cutoffVoltage.
Referenced by GetTypeId().
|
virtual |
Implements GetEnergyFraction. For the RV battery model, energy fraction is equivalent to battery level.
Implements ns3::EnergySource.
Definition at line 121 of file rv-battery-model.cc.
References GetBatteryLevel().
|
virtual |
Implements GetInitialEnergy.
Implements ns3::EnergySource.
Definition at line 100 of file rv-battery-model.cc.
References GetSupplyVoltage(), and m_alpha.
Time ns3::RvBatteryModel::GetLifetime | ( | void | ) | const |
Definition at line 255 of file rv-battery-model.cc.
References m_lifetime.
Referenced by BatteryLifetimeTest::ConstantLoadTest(), and BatteryLifetimeTest::VariableLoadTest().
int ns3::RvBatteryModel::GetNumOfTerms | ( | void | ) | const |
Definition at line 268 of file rv-battery-model.cc.
References m_numOfTerms.
Referenced by GetTypeId().
double ns3::RvBatteryModel::GetOpenCircuitVoltage | ( | void | ) | const |
Definition at line 199 of file rv-battery-model.cc.
References m_openCircuitVoltage.
Referenced by GetTypeId().
|
virtual |
Implements GetRemainingEnergy.
Implements ns3::EnergySource.
Definition at line 113 of file rv-battery-model.cc.
References GetSupplyVoltage(), m_alpha, m_batteryLevel, NS_LOG_FUNCTION, and UpdateEnergySource().
Time ns3::RvBatteryModel::GetSamplingInterval | ( | void | ) | const |
Definition at line 185 of file rv-battery-model.cc.
References m_samplingInterval.
Referenced by GetTypeId().
|
virtual |
Implements GetSupplyVoltage.
Implements ns3::EnergySource.
Definition at line 106 of file rv-battery-model.cc.
References m_cutoffVoltage, and m_openCircuitVoltage.
Referenced by GetInitialEnergy(), and GetRemainingEnergy().
|
static |
This method returns the TypeId associated to ns3::RvBatteryModel.
Attributes defined for this type:
TraceSources defined for this type:
Reimplemented from ns3::EnergySource.
Definition at line 36 of file rv-battery-model.cc.
References GetAlpha(), GetBeta(), GetCutoffVoltage(), GetNumOfTerms(), GetOpenCircuitVoltage(), GetSamplingInterval(), m_batteryLevel, m_lifetime, ns3::MakeTraceSourceAccessor(), ns3::Seconds(), SetAlpha(), SetBeta(), SetCutoffVoltage(), SetNumOfTerms(), SetOpenCircuitVoltage(), ns3::TypeId::SetParent(), and SetSamplingInterval().
|
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 291 of file rv-battery-model.cc.
References ns3::EnergySource::NotifyEnergyDrained(), NS_LOG_DEBUG, and NS_LOG_FUNCTION.
Referenced by UpdateEnergySource().
RV model A function.
t | Current time. |
sk | Time stamp in array position k |
sk_1 | Time stamp in array position k-1 |
beta | Beta value used by the battery model. |
This function computes alpha value using the recorded load profile.
Definition at line 349 of file rv-battery-model.cc.
References ns3::Time::GetSeconds(), m_numOfTerms, and NS_LOG_FUNCTION.
Referenced by Discharge().
void ns3::RvBatteryModel::SetAlpha | ( | double | alpha | ) |
Sets the alpha value for the battery model.
alpha | Alpha. |
Definition at line 219 of file rv-battery-model.cc.
References m_alpha, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by GetTypeId().
void ns3::RvBatteryModel::SetBeta | ( | double | beta | ) |
Sets the beta value for the battery model.
beta | Beta. |
Definition at line 233 of file rv-battery-model.cc.
References m_beta, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by GetTypeId().
void ns3::RvBatteryModel::SetCutoffVoltage | ( | double | voltage | ) |
Sets cutoff voltage of battery.
voltage | Cutoff voltage. |
Definition at line 205 of file rv-battery-model.cc.
References m_cutoffVoltage, m_openCircuitVoltage, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by GetTypeId().
void ns3::RvBatteryModel::SetNumOfTerms | ( | int | num | ) |
Sets the number of terms of the infinite sum for estimating battery level.
num | Number of terms. |
Definition at line 261 of file rv-battery-model.cc.
References m_numOfTerms, and NS_LOG_FUNCTION.
Referenced by GetTypeId().
void ns3::RvBatteryModel::SetOpenCircuitVoltage | ( | double | voltage | ) |
Sets open circuit voltage of battery.
voltage | Open circuit voltage. |
Definition at line 191 of file rv-battery-model.cc.
References m_openCircuitVoltage, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by GetTypeId().
void ns3::RvBatteryModel::SetSamplingInterval | ( | Time | interval | ) |
interval | Energy update interval. |
This function sets the interval between each energy update.
Definition at line 178 of file rv-battery-model.cc.
References m_samplingInterval, and NS_LOG_FUNCTION.
Referenced by GetTypeId().
|
virtual |
Implements UpdateEnergySource. This function samples the total load (total current) from all devices to discharge the battery.
Implements ns3::EnergySource.
Definition at line 127 of file rv-battery-model.cc.
References ns3::EnergySource::CalculateTotalCurrent(), ns3::EventId::Cancel(), Discharge(), HandleEnergyDrainedEvent(), ns3::Simulator::IsFinished(), m_alpha, m_batteryLevel, m_currentSampleEvent, m_lastSampleTime, m_lifetime, m_previousLoad, m_samplingInterval, ns3::Now(), ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, and ns3::Simulator::Schedule().
Referenced by DoStart(), GetBatteryLevel(), and GetRemainingEnergy().
|
private |
Definition at line 221 of file rv-battery-model.h.
Referenced by GetAlpha(), GetInitialEnergy(), GetRemainingEnergy(), SetAlpha(), and UpdateEnergySource().
|
private |
Battery level is defined as: output of Discharge function / alpha value
The output of Discharge function is an estimated charge consumption of the battery.
The alpha value is the amount of charges stored in the battery, or battery capacity (in Coulomb).
When the battery is fully charged (no charge is consumed from the battery) the battery level is 1. When the battery is fully discharged, the battery level is 0.
NOTE Note that the definition in Timmermann's paper is the inverse of this definition. In the paper, battery level = 1 when the battery is drained.
Definition at line 248 of file rv-battery-model.h.
Referenced by GetBatteryLevel(), GetRemainingEnergy(), GetTypeId(), RvBatteryModel(), and UpdateEnergySource().
|
private |
Definition at line 222 of file rv-battery-model.h.
Referenced by Discharge(), GetBeta(), and SetBeta().
|
private |
Definition at line 228 of file rv-battery-model.h.
|
private |
Definition at line 254 of file rv-battery-model.h.
Referenced by UpdateEnergySource().
|
private |
Definition at line 220 of file rv-battery-model.h.
Referenced by GetCutoffVoltage(), GetSupplyVoltage(), and SetCutoffVoltage().
|
private |
Definition at line 227 of file rv-battery-model.h.
Referenced by Discharge(), RvBatteryModel(), and UpdateEnergySource().
|
private |
Definition at line 256 of file rv-battery-model.h.
Referenced by GetLifetime(), GetTypeId(), RvBatteryModel(), and UpdateEnergySource().
|
private |
Definition at line 225 of file rv-battery-model.h.
Referenced by Discharge().
|
private |
Definition at line 230 of file rv-battery-model.h.
Referenced by GetNumOfTerms(), RvModelAFunction(), and SetNumOfTerms().
|
private |
Definition at line 219 of file rv-battery-model.h.
Referenced by GetOpenCircuitVoltage(), GetSupplyVoltage(), SetCutoffVoltage(), and SetOpenCircuitVoltage().
|
private |
Definition at line 224 of file rv-battery-model.h.
Referenced by Discharge(), RvBatteryModel(), and UpdateEnergySource().
|
private |
(1 / sampling interval) = sampling frequency
Definition at line 253 of file rv-battery-model.h.
Referenced by GetSamplingInterval(), SetSamplingInterval(), and UpdateEnergySource().
|
private |
Definition at line 226 of file rv-battery-model.h.
Referenced by Discharge().