A Discrete-Event Network Simulator
API
li-ion-energy-source.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2010 Andrea Sacco
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Andrea Sacco <andrea.sacco85@gmail.com>
19  */
20 
21 #ifndef LI_ION_ENERGY_SOURCE_H
22 #define LI_ION_ENERGY_SOURCE_H
23 
24 #include "ns3/traced-value.h"
25 #include "ns3/energy-source.h"
26 #include "ns3/nstime.h"
27 #include "ns3/event-id.h"
28 
29 namespace ns3 {
30 
73 {
74 public:
79  static TypeId GetTypeId (void);
81  virtual ~LiIonEnergySource ();
82 
88  virtual double GetInitialEnergy (void) const;
89 
96  void SetInitialEnergy (double initialEnergyJ);
97 
103  virtual double GetSupplyVoltage (void) const;
104 
111  void SetInitialSupplyVoltage (double supplyVoltageV);
112 
118  virtual double GetRemainingEnergy (void);
119 
125  virtual double GetEnergyFraction (void);
126 
132  virtual void DecreaseRemainingEnergy (double energyJ);
133 
139  virtual void IncreaseRemainingEnergy (double energyJ);
140 
144  virtual void UpdateEnergySource (void);
145 
151  void SetEnergyUpdateInterval (Time interval);
152 
156  Time GetEnergyUpdateInterval (void) const;
157 private:
158  void DoInitialize (void);
159  void DoDispose (void);
160 
166  void HandleEnergyDrainedEvent (void);
167 
176  void CalculateRemainingEnergy (void);
177 
186  double GetVoltage (double current) const;
187 
188 private:
193  double m_lowBatteryTh;
197  double m_eFull;
198  double m_eNom;
199  double m_eExp;
201  double m_qRated;
202  double m_qNom;
203  double m_qExp;
204  double m_typCurrent;
205  double m_minVoltTh;
206 };
207 
208 } // namespace ns3
209 
210 #endif /* LI_ION_ENERGY_SOURCE_H */
Introspection did not find any typical Config paths.
Definition: energy-source.h:87
An identifier for simulation events.
Definition: event-id.h:54
Model a generic Lithium Ion Battery basing on [1][2].
double m_drainedCapacity
capacity drained from the cell, in Ah
virtual void UpdateEnergySource(void)
Implements UpdateEnergySource.
void SetInitialEnergy(double initialEnergyJ)
virtual double GetInitialEnergy(void) const
void DoDispose(void)
All child's implementation must call BreakDeviceEnergyModelRefCycle to ensure reference cycles to Dev...
double m_minVoltTh
minimum threshold voltage to consider the battery depleted
virtual void IncreaseRemainingEnergy(double energyJ)
Time GetEnergyUpdateInterval(void) const
virtual double GetRemainingEnergy(void)
double m_supplyVoltageV
actual voltage of the cell
TracedValue< double > m_remainingEnergyJ
remaining energy, in Joules
double m_initialEnergyJ
initial energy, in Joules
double m_eFull
initial voltage of the cell, in Volts
void SetEnergyUpdateInterval(Time interval)
double m_internalResistance
internal resistance of the cell, in Ohms
void CalculateRemainingEnergy(void)
Calculates remaining energy.
Time m_energyUpdateInterval
energy update interval
virtual double GetSupplyVoltage(void) const
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
void HandleEnergyDrainedEvent(void)
Handles the remaining energy going to zero event.
double m_eExp
cell voltage at the end of the exponential zone, in Volts
virtual double GetEnergyFraction(void)
EventId m_energyUpdateEvent
energy update event
void DoInitialize(void)
Initialize() implementation.
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
double m_qRated
rated capacity of the cell, in Ah
static TypeId GetTypeId(void)
Get the type ID.
virtual void DecreaseRemainingEnergy(double energyJ)
double m_typCurrent
typical discharge current used to fit the curves
Time m_lastUpdateTime
last update time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.