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
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
basic-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 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 BASIC_ENERGY_SOURCE_H
22
#define BASIC_ENERGY_SOURCE_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
37
class
BasicEnergySource
:
public
EnergySource
38
{
39
public
:
40
static
TypeId
GetTypeId
(
void
);
41
BasicEnergySource
();
42
virtual
~BasicEnergySource
();
43
49
virtual
double
GetInitialEnergy
(
void
)
const
;
50
56
virtual
double
GetSupplyVoltage
(
void
)
const
;
57
63
virtual
double
GetRemainingEnergy
(
void
);
64
70
virtual
double
GetEnergyFraction
(
void
);
71
75
virtual
void
UpdateEnergySource
(
void
);
76
84
void
SetInitialEnergy
(
double
initialEnergyJ);
85
91
void
SetSupplyVoltage
(
double
supplyVoltageV);
92
98
void
SetEnergyUpdateInterval
(
Time
interval);
99
103
Time
GetEnergyUpdateInterval
(
void
)
const
;
104
105
106
private
:
108
void
DoInitialize
(
void
);
109
111
void
DoDispose
(
void
);
112
118
void
HandleEnergyDrainedEvent
(
void
);
119
128
void
CalculateRemainingEnergy
(
void
);
129
130
private
:
131
double
m_initialEnergyJ
;
// initial energy, in Joules
132
double
m_supplyVoltageV
;
// supply voltage, in Volts
133
TracedValue<double>
m_remainingEnergyJ
;
// remaining energy, in Joules
134
EventId
m_energyUpdateEvent
;
// energy update event
135
Time
m_lastUpdateTime
;
// last update time
136
Time
m_energyUpdateInterval
;
// energy update interval
137
138
};
139
140
}
// namespace ns3
141
142
#endif
/* BASIC_ENERGY_SOURCE_H */
ns3::BasicEnergySource::CalculateRemainingEnergy
void CalculateRemainingEnergy(void)
Calculates remaining energy.
Definition:
basic-energy-source.cc:196
ns3::Time
keep track of time values and allow control of global simulation resolution
Definition:
nstime.h:81
ns3::BasicEnergySource::GetEnergyUpdateInterval
Time GetEnergyUpdateInterval(void) const
Definition:
basic-energy-source.cc:101
ns3::BasicEnergySource::GetSupplyVoltage
virtual double GetSupplyVoltage(void) const
Definition:
basic-energy-source.cc:108
ns3::EnergySource
Energy source base class.
Definition:
energy-source.h:71
ns3::BasicEnergySource::GetRemainingEnergy
virtual double GetRemainingEnergy(void)
Definition:
basic-energy-source.cc:122
ns3::BasicEnergySource
BasicEnergySource decreases/increases remaining energy stored in itself in linearly.
Definition:
basic-energy-source.h:37
ns3::BasicEnergySource::UpdateEnergySource
virtual void UpdateEnergySource(void)
Implements UpdateEnergySource.
Definition:
basic-energy-source.cc:140
energy-source.h
ns3::TracedValue< double >
ns3::BasicEnergySource::m_supplyVoltageV
double m_supplyVoltageV
Definition:
basic-energy-source.h:132
ns3::BasicEnergySource::HandleEnergyDrainedEvent
void HandleEnergyDrainedEvent(void)
Handles the remaining energy going to zero event.
Definition:
basic-energy-source.cc:187
ns3::BasicEnergySource::m_energyUpdateInterval
Time m_energyUpdateInterval
Definition:
basic-energy-source.h:136
ns3::BasicEnergySource::GetInitialEnergy
virtual double GetInitialEnergy(void) const
Definition:
basic-energy-source.cc:115
ns3::BasicEnergySource::DoDispose
void DoDispose(void)
Defined in ns3::Object.
Definition:
basic-energy-source.cc:180
ns3::BasicEnergySource::m_lastUpdateTime
Time m_lastUpdateTime
Definition:
basic-energy-source.h:135
ns3::BasicEnergySource::m_remainingEnergyJ
TracedValue< double > m_remainingEnergyJ
Definition:
basic-energy-source.h:133
ns3::BasicEnergySource::GetTypeId
static TypeId GetTypeId(void)
Definition:
basic-energy-source.cc:36
ns3::BasicEnergySource::DoInitialize
void DoInitialize(void)
Defined in ns3::Object.
Definition:
basic-energy-source.cc:173
ns3::BasicEnergySource::m_energyUpdateEvent
EventId m_energyUpdateEvent
Definition:
basic-energy-source.h:134
ns3::BasicEnergySource::m_initialEnergyJ
double m_initialEnergyJ
Definition:
basic-energy-source.h:131
ns3::BasicEnergySource::SetSupplyVoltage
void SetSupplyVoltage(double supplyVoltageV)
Definition:
basic-energy-source.cc:87
ns3::EventId
an identifier for simulation events.
Definition:
event-id.h:46
ns3::BasicEnergySource::SetEnergyUpdateInterval
void SetEnergyUpdateInterval(Time interval)
Definition:
basic-energy-source.cc:94
ns3::BasicEnergySource::~BasicEnergySource
virtual ~BasicEnergySource()
Definition:
basic-energy-source.cc:72
ns3::BasicEnergySource::SetInitialEnergy
void SetInitialEnergy(double initialEnergyJ)
Definition:
basic-energy-source.cc:78
ns3::BasicEnergySource::BasicEnergySource
BasicEnergySource()
Definition:
basic-energy-source.cc:66
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:49
ns3::BasicEnergySource::GetEnergyFraction
virtual double GetEnergyFraction(void)
Definition:
basic-energy-source.cc:131
src
energy
model
basic-energy-source.h
Generated on Sat Apr 19 2014 14:06:54 for ns-3 by
1.8.6