23 #ifndef GENERIC_BATTERY_MODEL_H
24 #define GENERIC_BATTERY_MODEL_H
28 #include <ns3/event-id.h>
29 #include <ns3/nstime.h>
30 #include <ns3/traced-value.h>
90 "Panasonic HHR650D | NiMH | 1.2V 6.5Ah | Size: D",
101 "CSB GP1272 | Lead Acid | 12V 7.2Ah",
112 "Panasonic CGR18650DA | Li-Ion | 3.6V 2.45Ah | Size: A",
123 "Rs PRO LGP12100 | Lead Acid | 12V 100Ah",
134 "PANASONIC N-700AAC | NiCd | 1.2V 700mAh | Size: AA",
An identifier for simulation events.
A generic battery model for Li-Ion, NiCd, NiMh and Lead acid batteries.
double m_entn
The previous value of the exponential zone in NiMh,NiCd and LeadAcid.
double m_expZone
Voltage value of the exponential zone.
void BatteryChargedEvent()
Handles the battery reaching its full voltage.
double GetEnergyFraction() override
Implements GetEnergyFraction.
Time m_lastUpdateTime
Last update time.
double m_lowBatteryTh
Low battery threshold, as a fraction of the initial energy.
double m_typicalCurrent
Typical discharge current used to fit the curves.
double GetStateOfCharge() const
Calculates an estimate of the State of Charge (SoC).
double GetDrainedCapacity() const
Obtain the amount of drained capacity from the battery based on the integral of the current over time...
Time m_energyUpdateInterval
Energy update interval.
void UpdateEnergySource() override
Implements UpdateEnergySource.
double m_currentFiltered
The step response (a.k.a.
double m_qMax
The maximum capacity of the battery, in Ah.
void CalculateRemainingEnergy()
Calculates remaining energy.
double GetVoltage(double current)
Get the battery voltage in function of the discharge current.
void DoInitialize() override
Initialize() implementation.
double m_vExp
Battery voltage at the end of the exponential zone, in Volts.
TracedValue< double > m_remainingEnergyJ
Remaining energy, in Joules.
~GenericBatteryModel() override
double GetSupplyVoltage() const override
Implements GetSupplyVoltage.
Time GetEnergyUpdateInterval() const
double m_vNom
Nominal voltage of the battery, in Volts.
EventId m_energyUpdateEvent
Energy update event.
double GetChargeVoltage(double current)
Obtain the battery voltage as a result of a charge current.
double GetRemainingEnergy() override
Implements GetRemainingEnergy.
double m_internalResistance
Internal resistance of the battery, in Ohms.
void SetEnergyUpdateInterval(Time interval)
This function sets the interval between each energy update.
void DoDispose() override
All child's implementation must call BreakDeviceEnergyModelRefCycle to ensure reference cycles to Dev...
GenericBatteryType m_batteryType
Indicates the battery type used by the model.
double m_qNom
Battery capacity at the end of the nominal zone, in Ah.
static TypeId GetTypeId()
Get the type ID.
double m_vFull
Initial voltage of the battery, in Volts.
double m_drainedCapacity
Capacity drained from the battery, in Ah.
Time m_energyUpdateLapseTime
The lapse of time between the last battery energy update and the current time.
double m_cutoffVoltage
The threshold voltage where the battery is considered depleted.
void SetDrainedCapacity(double drainedCapacity)
This function is used to change the initial capacity in the battery.
double m_qExp
Capacity value at the end of the exponential zone, in Ah.
void BatteryDepletedEvent()
Handles the battery reaching its cutoff voltage.
double GetInitialEnergy() const override
Implements GetInitialEnergy.
double m_supplyVoltageV
Actual voltage of the battery.
Simulation virtual time values and global simulation resolution.
a unique identifier for an interface.
GenericBatteryType
Battery types.
static BatteryPresets g_batteryPreset[]
Contains the values that form the battery presents available in this module.
BatteryModel
Battery models that described the parameters of the the battery presets.
@ NIMH_NICD
Nickel-metal hydride and Nickel cadmium batteries.
@ LION_LIPO
Lithium-ion and Lithium-polymer batteries.
@ LEADACID
Lead Acid Batteries.
@ PANASONIC_CGR18650DA_LION
Panasonic CGR18650DA Li-Ion battery.
@ CSB_GP1272_LEADACID
CSB GP1272 Lead acid battery.
@ PANASONIC_HHR650D_NIMH
Panasonic HHR650D NiMh battery.
@ RSPRO_LGP12100_LEADACID
RS Pro LGP12100 Lead acid battery.
@ PANASONIC_N700AAC_NICD
Panasonic N700AAC NiCd battery.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
The structure containing the the parameter values that describe a battery preset.
std::string description
Additional information about the battery.
double cuttoffVoltage
The threshold voltage where the battery is considered depleted.
double qExp
Capacity value at the end of the exponential zone, in Ah.
double vExp
Battery voltage at the end of the exponential zone, in Volts.
GenericBatteryType batteryType
The type of battery used in the preset.
double internalResistance
Internal resistance of the battery, in Ohms.
double vFull
Initial voltage of the battery, in Volts.
double qNom
Battery capacity at the end of the nominal zone, in Ah.
double typicalCurrent
Typical discharge current used to fit the curves.
double vNom
Nominal voltage of the battery, in Volts.
double qMax
The maximum capacity of the battery, in Ah.