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
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 ENERGY_SOURCE_H
22
#define ENERGY_SOURCE_H
23
24
#include "ns3/object.h"
25
#include "ns3/ptr.h"
26
#include "ns3/type-id.h"
27
#include "ns3/node.h"
28
#include "
device-energy-model-container.h
"
// #include "device-energy-model.h"
29
30
namespace
ns3 {
31
71
class
EnergySource
:
public
Object
72
{
73
public
:
74
static
TypeId
GetTypeId
(
void
);
75
EnergySource
();
76
virtual
~EnergySource
();
77
84
virtual
double
GetSupplyVoltage
(
void
)
const
= 0;
85
92
virtual
double
GetInitialEnergy
(
void
)
const
= 0;
93
97
virtual
double
GetRemainingEnergy
(
void
) = 0;
98
104
virtual
double
GetEnergyFraction
(
void
) = 0;
105
111
virtual
void
UpdateEnergySource
(
void
) = 0;
112
118
void
SetNode
(
Ptr<Node>
node);
119
126
Ptr<Node>
GetNode
(
void
)
const
;
127
134
void
AppendDeviceEnergyModel
(
Ptr<DeviceEnergyModel>
deviceEnergyModelPtr);
135
140
DeviceEnergyModelContainer
FindDeviceEnergyModels
(
TypeId
tid);
141
146
DeviceEnergyModelContainer
FindDeviceEnergyModels
(std::string name);
147
153
void
InitializeDeviceModels
(
void
);
154
160
void
DisposeDeviceModels
(
void
);
161
162
163
private
:
170
virtual
void
DoDispose
(
void
);
171
172
private
:
176
DeviceEnergyModelContainer
m_models
;
177
182
Ptr<Node>
m_node
;
183
184
185
protected
:
189
double
CalculateTotalCurrent
(
void
);
190
195
void
NotifyEnergyDrained
(
void
);
196
206
void
BreakDeviceEnergyModelRefCycle
(
void
);
207
208
};
209
210
}
// namespace ns3
211
212
#endif
/* ENERGY_SOURCE_H */
ns3::EnergySource::EnergySource
EnergySource()
Definition:
energy-source.cc:40
ns3::Ptr< Node >
ns3::EnergySource
Energy source base class.
Definition:
energy-source.h:71
ns3::EnergySource::GetNode
Ptr< Node > GetNode(void) const
Definition:
energy-source.cc:59
ns3::DeviceEnergyModelContainer
Holds a vector of ns3::DeviceEnergyModel pointers.
Definition:
device-energy-model-container.h:43
ns3::EnergySource::UpdateEnergySource
virtual void UpdateEnergySource(void)=0
This function goes through the list of DeviceEnergyModels to obtain total current draw at the energy ...
ns3::EnergySource::GetInitialEnergy
virtual double GetInitialEnergy(void) const =0
ns3::EnergySource::BreakDeviceEnergyModelRefCycle
void BreakDeviceEnergyModelRefCycle(void)
This function is called to break reference cycle between EnergySource and DeviceEnergyModel.
Definition:
energy-source.cc:176
ns3::EnergySource::DoDispose
virtual void DoDispose(void)
All child's implementation must call BreakDeviceEnergyModelRefCycle to ensure reference cycles to Dev...
Definition:
energy-source.cc:140
ns3::EnergySource::GetTypeId
static TypeId GetTypeId(void)
Definition:
energy-source.cc:32
ns3::EnergySource::CalculateTotalCurrent
double CalculateTotalCurrent(void)
Definition:
energy-source.cc:151
ns3::EnergySource::InitializeDeviceModels
void InitializeDeviceModels(void)
Calls Start () method of the device energy models.
Definition:
energy-source.cc:106
ns3::EnergySource::AppendDeviceEnergyModel
void AppendDeviceEnergyModel(Ptr< DeviceEnergyModel > deviceEnergyModelPtr)
Definition:
energy-source.cc:66
ns3::EnergySource::~EnergySource
virtual ~EnergySource()
Definition:
energy-source.cc:45
ns3::EnergySource::m_node
Ptr< Node > m_node
Pointer to node containing this EnergySource.
Definition:
energy-source.h:182
ns3::EnergySource::GetRemainingEnergy
virtual double GetRemainingEnergy(void)=0
ns3::EnergySource::NotifyEnergyDrained
void NotifyEnergyDrained(void)
This function notifies all DeviceEnergyModel of energy depletion event.
Definition:
energy-source.cc:164
ns3::EnergySource::GetEnergyFraction
virtual double GetEnergyFraction(void)=0
device-energy-model-container.h
ns3::EnergySource::m_models
DeviceEnergyModelContainer m_models
List of device energy models installed on the same node.
Definition:
energy-source.h:176
ns3::EnergySource::DisposeDeviceModels
void DisposeDeviceModels(void)
Calls Dispose () method of the device energy models.
Definition:
energy-source.cc:121
ns3::EnergySource::FindDeviceEnergyModels
DeviceEnergyModelContainer FindDeviceEnergyModels(TypeId tid)
Definition:
energy-source.cc:74
ns3::Object
a base class which provides memory management and object aggregation
Definition:
object.h:63
ns3::EnergySource::SetNode
void SetNode(Ptr< Node > node)
Sets pointer to node containing this EnergySource.
Definition:
energy-source.cc:51
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:49
ns3::EnergySource::GetSupplyVoltage
virtual double GetSupplyVoltage(void) const =0
src
energy
model
energy-source.h
Generated on Sat Apr 19 2014 14:06:54 for ns-3 by
1.8.6