A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
rv-battery-model.h
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
29
namespace
ns3 {
30
50
class
RvBatteryModel
:
public
EnergySource
51
{
52
public
:
53
static
TypeId
GetTypeId (
void
);
54
RvBatteryModel
();
55
virtual
~
RvBatteryModel
();
56
62
virtual
double
GetInitialEnergy
(
void
)
const
;
63
69
virtual
double
GetSupplyVoltage
(
void
)
const
;
70
76
virtual
double
GetRemainingEnergy
(
void
);
77
84
virtual
double
GetEnergyFraction
(
void
);
85
90
virtual
void
UpdateEnergySource
(
void
);
91
97
void
SetSamplingInterval
(
Time
interval);
98
102
Time
GetSamplingInterval
(
void
)
const
;
103
109
void
SetOpenCircuitVoltage
(
double
voltage);
110
114
double
GetOpenCircuitVoltage
(
void
)
const
;
115
121
void
SetCutoffVoltage
(
double
voltage);
122
126
double
GetCutoffVoltage
(
void
)
const
;
127
133
void
SetAlpha
(
double
alpha);
134
138
double
GetAlpha
(
void
)
const
;
139
145
void
SetBeta
(
double
beta);
146
150
double
GetBeta
(
void
)
const
;
151
155
double
GetBatteryLevel
(
void
);
156
160
Time
GetLifetime
(
void
)
const
;
161
168
void
SetNumOfTerms
(
int
num);
169
174
int
GetNumOfTerms
(
void
)
const
;
175
176
private
:
178
virtual
void
DoInitialize
(
void
);
179
181
virtual
void
DoDispose
(
void
);
182
188
void
HandleEnergyDrainedEvent
(
void
);
189
203
double
Discharge
(
double
load,
Time
t);
204
216
double
RvModelAFunction
(
Time
t,
Time
sk,
Time
sk_1,
double
beta);
217
218
private
:
219
double
m_openCircuitVoltage;
220
double
m_cutoffVoltage;
221
double
m_alpha;
// alpha value of RV model, in Coulomb
222
double
m_beta;
// beta value of RV model, in second^-1
223
224
double
m_previousLoad;
// load value (total current) of previous sampling
225
std::vector<double> m_load;
// load profile
226
std::vector<Time> m_timeStamps;
// time stamps of load profile
227
Time
m_lastSampleTime;
228
uint64_t m_counter;
229
230
int
m_numOfTerms;
// # of terms for infinite sum in battery level estimation
231
248
TracedValue<double>
m_batteryLevel
;
249
253
Time
m_samplingInterval
;
254
EventId
m_currentSampleEvent;
255
256
TracedValue<Time>
m_lifetime;
// time of death of the battery
257
};
258
259
}
// namespace ns3
260
261
#endif
/* RV_BATTERY_MODEL_H */
ns3::RvBatteryModel::Discharge
double Discharge(double load, Time t)
Discharges the battery.
Definition:
rv-battery-model.cc:313
ns3::Time
keep track of time unit.
Definition:
nstime.h:149
ns3::RvBatteryModel::SetOpenCircuitVoltage
void SetOpenCircuitVoltage(double voltage)
Sets open circuit voltage of battery.
Definition:
rv-battery-model.cc:197
ns3::RvBatteryModel::m_samplingInterval
Time m_samplingInterval
Definition:
rv-battery-model.h:253
ns3::RvBatteryModel::GetSamplingInterval
Time GetSamplingInterval(void) const
Definition:
rv-battery-model.cc:190
ns3::RvBatteryModel::GetSupplyVoltage
virtual double GetSupplyVoltage(void) const
Definition:
rv-battery-model.cc:109
ns3::EnergySource
Energy source base class.
Definition:
energy-source.h:71
ns3::RvBatteryModel::GetBeta
double GetBeta(void) const
Definition:
rv-battery-model.cc:250
ns3::RvBatteryModel::SetBeta
void SetBeta(double beta)
Sets the beta value for the battery model.
Definition:
rv-battery-model.cc:242
ns3::RvBatteryModel::GetInitialEnergy
virtual double GetInitialEnergy(void) const
Definition:
rv-battery-model.cc:102
ns3::RvBatteryModel::HandleEnergyDrainedEvent
void HandleEnergyDrainedEvent(void)
Definition:
rv-battery-model.cc:305
ns3::TracedValue< double >
ns3::RvBatteryModel::SetNumOfTerms
void SetNumOfTerms(int num)
Sets the number of terms of the infinite sum for estimating battery level.
Definition:
rv-battery-model.cc:272
ns3::RvBatteryModel::SetCutoffVoltage
void SetCutoffVoltage(double voltage)
Sets cutoff voltage of battery.
Definition:
rv-battery-model.cc:212
ns3::RvBatteryModel::GetAlpha
double GetAlpha(void) const
Definition:
rv-battery-model.cc:235
ns3::RvBatteryModel::DoInitialize
virtual void DoInitialize(void)
Defined in ns3::Object.
Definition:
rv-battery-model.cc:290
ns3::RvBatteryModel::GetLifetime
Time GetLifetime(void) const
Definition:
rv-battery-model.cc:265
ns3::RvBatteryModel::SetSamplingInterval
void SetSamplingInterval(Time interval)
Definition:
rv-battery-model.cc:183
ns3::RvBatteryModel::DoDispose
virtual void DoDispose(void)
Defined in ns3::Object.
Definition:
rv-battery-model.cc:298
ns3::RvBatteryModel::RvModelAFunction
double RvModelAFunction(Time t, Time sk, Time sk_1, double beta)
RV model A function.
Definition:
rv-battery-model.cc:363
ns3::EventId
an identifier for simulation events.
Definition:
event-id.h:46
ns3::RvBatteryModel::m_batteryLevel
TracedValue< double > m_batteryLevel
Definition:
rv-battery-model.h:248
ns3::RvBatteryModel::GetRemainingEnergy
virtual double GetRemainingEnergy(void)
Definition:
rv-battery-model.cc:117
ns3::RvBatteryModel::UpdateEnergySource
virtual void UpdateEnergySource(void)
Definition:
rv-battery-model.cc:132
ns3::RvBatteryModel::GetOpenCircuitVoltage
double GetOpenCircuitVoltage(void) const
Definition:
rv-battery-model.cc:205
ns3::RvBatteryModel
Rakhmatov Vrudhula non-linear battery model.
Definition:
rv-battery-model.h:50
ns3::RvBatteryModel::GetNumOfTerms
int GetNumOfTerms(void) const
Definition:
rv-battery-model.cc:279
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:44
ns3::RvBatteryModel::GetCutoffVoltage
double GetCutoffVoltage(void) const
Definition:
rv-battery-model.cc:220
ns3::RvBatteryModel::SetAlpha
void SetAlpha(double alpha)
Sets the alpha value for the battery model.
Definition:
rv-battery-model.cc:227
ns3::RvBatteryModel::GetEnergyFraction
virtual double GetEnergyFraction(void)
Definition:
rv-battery-model.cc:125
ns3::RvBatteryModel::GetBatteryLevel
double GetBatteryLevel(void)
Definition:
rv-battery-model.cc:257
src
energy
model
rv-battery-model.h
Generated on Sun Mar 16 2014 11:25:03 for ns-3 by
1.8.6