A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
energy-model-helper.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2010 Network Security Lab, University of Washington, Seattle.
3
*
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation;
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
*
17
* Authors: Sidharth Nabar <snabar@uw.edu>, He Wu <mdzz@u.washington.edu>
18
*/
19
20
#ifndef ENERGY_MODEL_HELPER_H
21
#define ENERGY_MODEL_HELPER_H
22
23
#include "
energy-source-container.h
"
24
25
#include "ns3/attribute.h"
26
#include "ns3/device-energy-model-container.h"
27
#include "ns3/device-energy-model.h"
28
#include "ns3/energy-source.h"
29
#include "ns3/net-device-container.h"
30
#include "ns3/net-device.h"
31
#include "ns3/node-container.h"
32
#include "ns3/object-factory.h"
33
#include "ns3/ptr.h"
34
35
namespace
ns3
36
{
37
38
/**
39
* \ingroup energy
40
* \brief Creates EnergySource objects.
41
*
42
* This class creates and installs an energy source onto network nodes.
43
* Multiple sources can exist on a network node.
44
*
45
*/
46
class
EnergySourceHelper
47
{
48
public
:
49
virtual
~EnergySourceHelper
();
50
51
/**
52
* \param name Name of attribute to set.
53
* \param v Value of the attribute.
54
*
55
* Sets one of the attributes of underlying EnergySource.
56
*/
57
virtual
void
Set
(std::string name,
const
AttributeValue
& v) = 0;
58
59
/**
60
* \param node Pointer to the node where EnergySource will be installed.
61
* \returns An EnergySourceContainer which contains all the EnergySources.
62
*
63
* This function installs an EnergySource onto a node.
64
*/
65
energy::EnergySourceContainer
Install
(
Ptr<Node>
node)
const
;
66
67
/**
68
* \param c List of nodes where EnergySource will be installed.
69
* \returns An EnergySourceContainer which contains all the EnergySources.
70
*
71
* This function installs an EnergySource onto a list of nodes.
72
*/
73
energy::EnergySourceContainer
Install
(
NodeContainer
c)
const
;
74
75
/**
76
* \param nodeName Name of node where EnergySource will be installed.
77
* \returns An EnergySourceContainer which contains all the EnergySources.
78
*
79
* This function installs an EnergySource onto a node.
80
*/
81
energy::EnergySourceContainer
Install
(std::string nodeName)
const
;
82
83
/**
84
* \brief This function installs an EnergySource on all nodes in simulation.
85
*
86
* \returns An EnergySourceContainer which contains all the EnergySources.
87
*/
88
energy::EnergySourceContainer
InstallAll
()
const
;
89
90
private
:
91
/**
92
* \param node Pointer to node where the energy source is to be installed.
93
* \returns Pointer to the created EnergySource.
94
*
95
* Child classes of EnergySourceHelper only have to implement this function,
96
* to create and aggregate an EnergySource object onto a single node. Rest of
97
* the installation process (eg. installing EnergySource on set of nodes) is
98
* implemented in the EnergySourceHelper base class.
99
*/
100
virtual
Ptr<energy::EnergySource>
DoInstall
(
Ptr<Node>
node)
const
= 0;
101
};
102
103
/**
104
* \ingroup energy
105
* \brief Creates DeviceEnergyModel objects.
106
*
107
* This class helps to create and install DeviceEnergyModel onto NetDevice. A
108
* DeviceEnergyModel is connected to a NetDevice (or PHY object) by callbacks.
109
* Note that DeviceEnergyModel objects are *not* aggregated onto the node. They
110
* can be accessed through the EnergySource object, which *is* aggregated onto
111
* the node.
112
*
113
*/
114
class
DeviceEnergyModelHelper
115
{
116
public
:
117
virtual
~DeviceEnergyModelHelper
();
118
119
/**
120
* \param name Name of attribute to set.
121
* \param v Value of the attribute.
122
*
123
* Sets one of the attributes of underlying DeviceEnergyModel.
124
*/
125
virtual
void
Set
(std::string name,
const
AttributeValue
& v) = 0;
126
127
/**
128
* \param device Pointer to the NetDevice to install DeviceEnergyModel.
129
* \param source The EnergySource the DeviceEnergyModel will be using.
130
* \returns An DeviceEnergyModelContainer contains all the DeviceEnergyModels.
131
*
132
* Installs an DeviceEnergyModel with a specified EnergySource onto a
133
* xNetDevice.
134
*/
135
energy::DeviceEnergyModelContainer
Install
(
Ptr<NetDevice>
device,
136
Ptr<energy::EnergySource>
source)
const
;
137
138
/**
139
* \param deviceContainer List of NetDevices to be install DeviceEnergyModel
140
* objects.
141
* \param sourceContainer List of EnergySource the DeviceEnergyModel will be
142
* using.
143
* \returns An DeviceEnergyModelContainer contains all the DeviceEnergyModels.
144
*
145
* Installs DeviceEnergyModels with specified EnergySources onto a list of
146
* NetDevices.
147
*/
148
energy::DeviceEnergyModelContainer
Install
(
NetDeviceContainer
deviceContainer,
149
energy::EnergySourceContainer
sourceContainer)
const
;
150
151
private
:
152
/**
153
* \param device The net device corresponding to DeviceEnergyModel object.
154
* \param source The EnergySource the DeviceEnergyModel will be using.
155
* \returns Pointer to the created DeviceEnergyModel.
156
*
157
* Child classes of DeviceEnergyModelHelper only have to implement this
158
* function, to create and aggregate an DeviceEnergyModel object onto a single
159
* node. The rest of the installation process (eg. installing EnergySource on
160
* set of nodes) is implemented in the DeviceEnergyModelHelper base class.
161
*/
162
virtual
Ptr<energy::DeviceEnergyModel>
DoInstall
(
Ptr<NetDevice>
device,
163
Ptr<energy::EnergySource>
source)
const
= 0;
164
};
165
166
}
// namespace ns3
167
168
#endif
/* ENERGY_MODEL_HELPER_H */
ns3::AttributeValue
Hold a value for an Attribute.
Definition:
attribute.h:70
ns3::DeviceEnergyModelHelper
Creates DeviceEnergyModel objects.
Definition:
energy-model-helper.h:115
ns3::DeviceEnergyModelHelper::Install
energy::DeviceEnergyModelContainer Install(Ptr< NetDevice > device, Ptr< energy::EnergySource > source) const
Definition:
energy-model-helper.cc:92
ns3::DeviceEnergyModelHelper::DoInstall
virtual Ptr< energy::DeviceEnergyModel > DoInstall(Ptr< NetDevice > device, Ptr< energy::EnergySource > source) const =0
ns3::DeviceEnergyModelHelper::~DeviceEnergyModelHelper
virtual ~DeviceEnergyModelHelper()
Definition:
energy-model-helper.cc:87
ns3::DeviceEnergyModelHelper::Set
virtual void Set(std::string name, const AttributeValue &v)=0
ns3::EnergySourceHelper
Creates EnergySource objects.
Definition:
energy-model-helper.h:47
ns3::EnergySourceHelper::~EnergySourceHelper
virtual ~EnergySourceHelper()
Definition:
energy-model-helper.cc:31
ns3::EnergySourceHelper::InstallAll
energy::EnergySourceContainer InstallAll() const
This function installs an EnergySource on all nodes in simulation.
Definition:
energy-model-helper.cc:79
ns3::EnergySourceHelper::Install
energy::EnergySourceContainer Install(Ptr< Node > node) const
Definition:
energy-model-helper.cc:36
ns3::EnergySourceHelper::DoInstall
virtual Ptr< energy::EnergySource > DoInstall(Ptr< Node > node) const =0
ns3::EnergySourceHelper::Set
virtual void Set(std::string name, const AttributeValue &v)=0
ns3::NetDeviceContainer
holds a vector of ns3::NetDevice pointers
Definition:
net-device-container.h:43
ns3::NodeContainer
keep track of a set of node pointers.
Definition:
node-container.h:40
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:77
ns3::energy::DeviceEnergyModelContainer
Holds a vector of ns3::DeviceEnergyModel pointers.
Definition:
device-energy-model-container.h:47
ns3::energy::EnergySourceContainer
Holds a vector of ns3::EnergySource pointers.
Definition:
energy-source-container.h:48
energy-source-container.h
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
energy
helper
energy-model-helper.h
Generated on Tue May 28 2024 23:35:16 for ns-3 by
1.9.6