A Discrete-Event Network Simulator
API
rv-battery-model.h
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2010 Network Security Lab, University of Washington, Seattle.
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 * Authors: Sidharth Nabar <snabar@uw.edu>, He Wu <mdzz@u.washington.edu>
19 */
20
21#ifndef RV_BATTERY_MODEL_H
22#define RV_BATTERY_MODEL_H
23
24#include "ns3/traced-value.h"
25#include "ns3/nstime.h"
26#include "ns3/event-id.h"
27#include "energy-source.h"
28
29namespace ns3 {
30
51{
52public:
57 static TypeId GetTypeId (void);
59 virtual ~RvBatteryModel ();
60
66 virtual double GetInitialEnergy (void) const;
67
73 virtual double GetSupplyVoltage (void) const;
74
80 virtual double GetRemainingEnergy (void);
81
88 virtual double GetEnergyFraction (void);
89
94 virtual void UpdateEnergySource (void);
95
101 void SetSamplingInterval (Time interval);
102
106 Time GetSamplingInterval (void) const;
107
113 void SetOpenCircuitVoltage (double voltage);
114
118 double GetOpenCircuitVoltage (void) const;
119
125 void SetCutoffVoltage (double voltage);
126
130 double GetCutoffVoltage (void) const;
131
137 void SetAlpha (double alpha);
138
142 double GetAlpha (void) const;
143
149 void SetBeta (double beta);
150
154 double GetBeta (void) const;
155
159 double GetBatteryLevel (void);
160
164 Time GetLifetime (void) const;
165
172 void SetNumOfTerms (int num);
173
178 int GetNumOfTerms (void) const;
179
180private:
182 virtual void DoInitialize (void);
183
185 virtual void DoDispose (void);
186
192 void HandleEnergyDrainedEvent (void);
193
207 double Discharge (double load, Time t);
208
220 double RvModelAFunction (Time t, Time sk, Time sk_1, double beta);
221
222private:
225 double m_alpha;
226 double m_beta;
227
229 std::vector<double> m_load;
230 std::vector<Time> m_timeStamps;
232
234
252
254
261
263};
264
265} // namespace ns3
266
267#endif /* RV_BATTERY_MODEL_H */
Introspection did not find any typical Config paths.
Definition: energy-source.h:87
An identifier for simulation events.
Definition: event-id.h:54
Rakhmatov Vrudhula non-linear battery model.
double m_lowBatteryTh
low battery threshold, as a fraction of the initial energy
int GetNumOfTerms(void) const
double m_openCircuitVoltage
Open circuit voltage (in Volts)
virtual double GetSupplyVoltage(void) const
void SetNumOfTerms(int num)
Sets the number of terms of the infinite sum for estimating battery level.
virtual void DoInitialize(void)
Defined in ns3::Object.
double m_cutoffVoltage
Cutoff voltage (in Volts)
virtual double GetEnergyFraction(void)
Time GetSamplingInterval(void) const
EventId m_currentSampleEvent
Current sample event.
static TypeId GetTypeId(void)
Get the type ID.
double GetAlpha(void) const
void SetSamplingInterval(Time interval)
Time m_lastSampleTime
Last sample time.
virtual double GetInitialEnergy(void) const
double m_previousLoad
load value (total current) of previous sampling
std::vector< Time > m_timeStamps
time stamps of load profile
int m_numOfTerms
Number# of terms for infinite sum in battery level estimation.
double GetCutoffVoltage(void) const
double Discharge(double load, Time t)
Discharges the battery.
void SetCutoffVoltage(double voltage)
Sets cutoff voltage of battery.
virtual double GetRemainingEnergy(void)
void SetBeta(double beta)
Sets the beta value for the battery model.
Time GetLifetime(void) const
virtual void DoDispose(void)
Defined in ns3::Object.
std::vector< double > m_load
load profile
TracedValue< Time > m_lifetime
time of death of the battery
Time m_samplingInterval
Sampling interval.
void SetOpenCircuitVoltage(double voltage)
Sets open circuit voltage of battery.
double RvModelAFunction(Time t, Time sk, Time sk_1, double beta)
RV model A function.
void SetAlpha(double alpha)
Sets the alpha value for the battery model.
double GetOpenCircuitVoltage(void) const
virtual void UpdateEnergySource(void)
Implements UpdateEnergySource.
void HandleEnergyDrainedEvent(void)
Handles the remaining energy going to zero event.
double GetBeta(void) const
double m_alpha
alpha value of RV model, in Coulomb
double GetBatteryLevel(void)
TracedValue< double > m_batteryLevel
Battery level is defined as: output of Discharge function / alpha value.
double m_beta
beta value of RV model, in second^-1
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.
float alpha
Plot alpha value (transparency)