A Discrete-Event Network Simulator
API
li-ion-energy-source.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010 Andrea Sacco
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Andrea Sacco <andrea.sacco85@gmail.com>
18  */
19 
20 #ifndef LI_ION_ENERGY_SOURCE_H
21 #define LI_ION_ENERGY_SOURCE_H
22 
23 #include "energy-source.h"
24 
25 #include "ns3/deprecated.h"
26 #include "ns3/event-id.h"
27 #include "ns3/nstime.h"
28 #include "ns3/traced-value.h"
29 
30 namespace ns3
31 {
32 
80 {
81  public:
86  static TypeId GetTypeId();
88  ~LiIonEnergySource() override;
89 
95  double GetInitialEnergy() const override;
96 
103  void SetInitialEnergy(double initialEnergyJ);
104 
110  double GetSupplyVoltage() const override;
111 
118  void SetInitialSupplyVoltage(double supplyVoltageV);
119 
125  double GetRemainingEnergy() override;
126 
132  double GetEnergyFraction() override;
133 
139  NS_DEPRECATED_3_40("Use GenericBatteryModel instead")
140  virtual void DecreaseRemainingEnergy(double energyJ);
141 
147  NS_DEPRECATED_3_40("Use GenericBatteryModel instead")
148  virtual void IncreaseRemainingEnergy(double energyJ);
149 
153  void UpdateEnergySource() override;
154 
160  void SetEnergyUpdateInterval(Time interval);
161 
166 
167  private:
168  void DoInitialize() override;
169  void DoDispose() override;
170 
177 
187 
196  double GetVoltage(double current) const;
197 
198  private:
203  double m_lowBatteryTh;
207  double m_eFull;
208  double m_eNom;
209  double m_eExp;
211  double m_qRated;
212  double m_qNom;
213  double m_qExp;
214  double m_typCurrent;
215  double m_minVoltTh;
216 };
217 
218 } // namespace ns3
219 
220 #endif /* LI_ION_ENERGY_SOURCE_H */
An identifier for simulation events.
Definition: event-id.h:55
Model a generic Lithium Ion Battery basing on [1][2].
void DoDispose() override
All child's implementation must call BreakDeviceEnergyModelRefCycle to ensure reference cycles to Dev...
void UpdateEnergySource() override
Implements UpdateEnergySource.
double m_drainedCapacity
capacity drained from the cell, in Ah
void SetInitialEnergy(double initialEnergyJ)
double m_minVoltTh
minimum threshold voltage to consider the battery depleted
virtual void IncreaseRemainingEnergy(double energyJ)
void DoInitialize() override
Initialize() implementation.
double m_supplyVoltageV
actual voltage of the cell
TracedValue< double > m_remainingEnergyJ
remaining energy, in Joules
double m_initialEnergyJ
initial energy, in Joules
double GetRemainingEnergy() override
double m_eFull
initial voltage of the cell, in Volts
void SetEnergyUpdateInterval(Time interval)
double m_internalResistance
internal resistance of the cell, in Ohms
Time m_energyUpdateInterval
energy update interval
void SetInitialSupplyVoltage(double supplyVoltageV)
double m_eNom
nominal voltage of the cell, in Volts
double m_lowBatteryTh
low battery threshold, as a fraction of the initial energy
double m_eExp
cell voltage at the end of the exponential zone, in Volts
EventId m_energyUpdateEvent
energy update event
double GetEnergyFraction() override
void CalculateRemainingEnergy()
Calculates remaining energy.
double GetInitialEnergy() const override
static TypeId GetTypeId()
Get the type ID.
double m_qNom
cell capacity at the end of the nominal zone, in Ah
double m_qExp
capacity value at the end of the exponential zone, in Ah
double GetVoltage(double current) const
Get the cell voltage in function of the discharge current.
double m_qRated
rated capacity of the cell, in Ah
double GetSupplyVoltage() const override
virtual void DecreaseRemainingEnergy(double energyJ)
double m_typCurrent
typical discharge current used to fit the curves
void HandleEnergyDrainedEvent()
Handles the remaining energy going to zero event.
Time m_lastUpdateTime
last update time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:59
#define NS_DEPRECATED_3_40(msg)
Tag for things deprecated in version ns-3.40.
Definition: deprecated.h:89
Every class exported by the ns3 library is enclosed in the ns3 namespace.