A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
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
* Copyright (c) 2014 Wireless Communications and Networking Group (WCNG),
21
* University of Rochester, Rochester, NY, USA.
22
*
23
* Modifications made by: Cristiano Tapparello <cristiano.tapparello@rochester.edu>
24
*/
25
26
27
#ifndef ENERGY_SOURCE_H
28
#define ENERGY_SOURCE_H
29
30
#include "ns3/object.h"
31
#include "ns3/ptr.h"
32
#include "ns3/type-id.h"
33
#include "ns3/node.h"
34
#include "
device-energy-model-container.h
"
// #include "device-energy-model.h"
35
#include "ns3/energy-harvester.h"
36
37
namespace
ns3
{
38
79
class
EnergyHarvester;
80
81
class
EnergySource
:
public
Object
82
{
83
public
:
84
static
TypeId
GetTypeId
(
void
);
85
EnergySource
();
86
virtual
~EnergySource
();
87
94
virtual
double
GetSupplyVoltage
(
void
)
const
= 0;
95
102
virtual
double
GetInitialEnergy
(
void
)
const
= 0;
103
107
virtual
double
GetRemainingEnergy
(
void
) = 0;
108
114
virtual
double
GetEnergyFraction
(
void
) = 0;
115
121
virtual
void
UpdateEnergySource
(
void
) = 0;
122
128
void
SetNode
(
Ptr<Node>
node);
129
136
Ptr<Node>
GetNode
(
void
)
const
;
137
144
void
AppendDeviceEnergyModel
(
Ptr<DeviceEnergyModel>
deviceEnergyModelPtr);
145
150
DeviceEnergyModelContainer
FindDeviceEnergyModels
(
TypeId
tid);
151
156
DeviceEnergyModelContainer
FindDeviceEnergyModels
(std::string name);
157
163
void
InitializeDeviceModels
(
void
);
164
170
void
DisposeDeviceModels
(
void
);
171
181
void
ConnectEnergyHarvester
(
Ptr<EnergyHarvester>
energyHarvesterPtr);
182
183
184
private
:
191
virtual
void
DoDispose
(
void
);
192
193
private
:
197
DeviceEnergyModelContainer
m_models
;
198
203
Ptr<Node>
m_node
;
204
210
std::vector< Ptr<EnergyHarvester> >
m_harvesters
;
211
212
213
protected
:
217
double
CalculateTotalCurrent
(
void
);
218
223
void
NotifyEnergyDrained
(
void
);
224
229
void
NotifyEnergyRecharged
(
void
);
230
235
void
NotifyEnergyChanged
(
void
);
236
246
void
BreakDeviceEnergyModelRefCycle
(
void
);
247
248
};
249
250
}
// namespace ns3
251
252
#endif
/* ENERGY_SOURCE_H */
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
ns3::EnergySource::m_harvesters
std::vector< Ptr< EnergyHarvester > > m_harvesters
Vector of EnergyHarvester pointer connected to the same energy source.
Definition:
energy-source.h:210
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::EnergySource::NotifyEnergyChanged
void NotifyEnergyChanged(void)
This function notifies all DeviceEnergyModel of energy changed event.
Definition:
energy-source.cc:216
ns3::EnergySource::GetNode
Ptr< Node > GetNode(void) const
Definition:
energy-source.cc:64
ns3::EnergySource::NotifyEnergyDrained
void NotifyEnergyDrained(void)
This function notifies all DeviceEnergyModel of energy depletion event.
Definition:
energy-source.cc:192
ns3::Ptr< Node >
ns3::EnergySource::CalculateTotalCurrent
double CalculateTotalCurrent(void)
Definition:
energy-source.cc:163
ns3::Object
A base class which provides memory management and object aggregation.
Definition:
object.h:88
ns3::EnergySource::~EnergySource
virtual ~EnergySource()
Definition:
energy-source.cc:50
ns3::EnergySource::InitializeDeviceModels
void InitializeDeviceModels(void)
Calls Start () method of the device energy models.
Definition:
energy-source.cc:110
ns3::EnergySource
Introspection did not find any typical Config paths.
Definition:
energy-source.h:82
ns3::EnergySource::SetNode
void SetNode(Ptr< Node > node)
Sets pointer to node containing this EnergySource.
Definition:
energy-source.cc:56
ns3::DeviceEnergyModelContainer
Holds a vector of ns3::DeviceEnergyModel pointers.
Definition:
device-energy-model-container.h:44
ns3::EnergySource::GetEnergyFraction
virtual double GetEnergyFraction(void)=0
device-energy-model-container.h
ns3::EnergySource::BreakDeviceEnergyModelRefCycle
void BreakDeviceEnergyModelRefCycle(void)
This function is called to break reference cycle between EnergySource and DeviceEnergyModel.
Definition:
energy-source.cc:228
ns3::EnergySource::GetRemainingEnergy
virtual double GetRemainingEnergy(void)=0
ns3::EnergySource::DisposeDeviceModels
void DisposeDeviceModels(void)
Calls Dispose () method of the device energy models.
Definition:
energy-source.cc:125
ns3::EnergySource::GetSupplyVoltage
virtual double GetSupplyVoltage(void) const =0
ns3::EnergySource::m_node
Ptr< Node > m_node
Pointer to node containing this EnergySource.
Definition:
energy-source.h:203
ns3::EnergySource::NotifyEnergyRecharged
void NotifyEnergyRecharged(void)
This function notifies all DeviceEnergyModel of energy recharged event.
Definition:
energy-source.cc:204
ns3::EnergySource::EnergySource
EnergySource()
Definition:
energy-source.cc:45
ns3::EnergySource::DoDispose
virtual void DoDispose(void)
All child's implementation must call BreakDeviceEnergyModelRefCycle to ensure reference cycles to Dev...
Definition:
energy-source.cc:152
ns3::EnergySource::GetTypeId
static TypeId GetTypeId(void)
Definition:
energy-source.cc:36
ns3::EnergySource::FindDeviceEnergyModels
DeviceEnergyModelContainer FindDeviceEnergyModels(TypeId tid)
Definition:
energy-source.cc:78
ns3::EnergySource::GetInitialEnergy
virtual double GetInitialEnergy(void) const =0
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::m_models
DeviceEnergyModelContainer m_models
List of device energy models installed on the same node.
Definition:
energy-source.h:197
ns3::EnergySource::AppendDeviceEnergyModel
void AppendDeviceEnergyModel(Ptr< DeviceEnergyModel > deviceEnergyModelPtr)
Definition:
energy-source.cc:70
ns3::EnergySource::ConnectEnergyHarvester
void ConnectEnergyHarvester(Ptr< EnergyHarvester > energyHarvesterPtr)
Definition:
energy-source.cc:140
src
energy
model
energy-source.h
Generated on Fri Oct 1 2021 17:03:03 for ns-3 by
1.8.20