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
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Authors: Sidharth Nabar <snabar@uw.edu>, He Wu <mdzz@u.washington.edu>
7
*/
8
9
#ifndef ENERGY_MODEL_HELPER_H
10
#define ENERGY_MODEL_HELPER_H
11
12
#include "
energy-source-container.h
"
13
14
#include "ns3/attribute.h"
15
#include "ns3/device-energy-model-container.h"
16
#include "ns3/device-energy-model.h"
17
#include "ns3/energy-source.h"
18
#include "ns3/net-device-container.h"
19
#include "ns3/net-device.h"
20
#include "ns3/node-container.h"
21
#include "ns3/object-factory.h"
22
#include "ns3/ptr.h"
23
24
namespace
ns3
25
{
26
27
/**
28
* \ingroup energy
29
* \brief Creates EnergySource objects.
30
*
31
* This class creates and installs an energy source onto network nodes.
32
* Multiple sources can exist on a network node.
33
*
34
*/
35
class
EnergySourceHelper
36
{
37
public
:
38
virtual
~EnergySourceHelper
();
39
40
/**
41
* \param name Name of attribute to set.
42
* \param v Value of the attribute.
43
*
44
* Sets one of the attributes of underlying EnergySource.
45
*/
46
virtual
void
Set
(std::string name,
const
AttributeValue
& v) = 0;
47
48
/**
49
* \param node Pointer to the node where EnergySource will be installed.
50
* \returns An EnergySourceContainer which contains all the EnergySources.
51
*
52
* This function installs an EnergySource onto a node.
53
*/
54
energy::EnergySourceContainer
Install
(
Ptr<Node>
node)
const
;
55
56
/**
57
* \param c List of nodes where EnergySource will be installed.
58
* \returns An EnergySourceContainer which contains all the EnergySources.
59
*
60
* This function installs an EnergySource onto a list of nodes.
61
*/
62
energy::EnergySourceContainer
Install
(
NodeContainer
c)
const
;
63
64
/**
65
* \param nodeName Name of node where EnergySource will be installed.
66
* \returns An EnergySourceContainer which contains all the EnergySources.
67
*
68
* This function installs an EnergySource onto a node.
69
*/
70
energy::EnergySourceContainer
Install
(std::string nodeName)
const
;
71
72
/**
73
* \brief This function installs an EnergySource on all nodes in simulation.
74
*
75
* \returns An EnergySourceContainer which contains all the EnergySources.
76
*/
77
energy::EnergySourceContainer
InstallAll
()
const
;
78
79
private
:
80
/**
81
* \param node Pointer to node where the energy source is to be installed.
82
* \returns Pointer to the created EnergySource.
83
*
84
* Child classes of EnergySourceHelper only have to implement this function,
85
* to create and aggregate an EnergySource object onto a single node. Rest of
86
* the installation process (eg. installing EnergySource on set of nodes) is
87
* implemented in the EnergySourceHelper base class.
88
*/
89
virtual
Ptr<energy::EnergySource>
DoInstall
(
Ptr<Node>
node)
const
= 0;
90
};
91
92
/**
93
* \ingroup energy
94
* \brief Creates DeviceEnergyModel objects.
95
*
96
* This class helps to create and install DeviceEnergyModel onto NetDevice. A
97
* DeviceEnergyModel is connected to a NetDevice (or PHY object) by callbacks.
98
* Note that DeviceEnergyModel objects are *not* aggregated onto the node. They
99
* can be accessed through the EnergySource object, which *is* aggregated onto
100
* the node.
101
*
102
*/
103
class
DeviceEnergyModelHelper
104
{
105
public
:
106
virtual
~DeviceEnergyModelHelper
();
107
108
/**
109
* \param name Name of attribute to set.
110
* \param v Value of the attribute.
111
*
112
* Sets one of the attributes of underlying DeviceEnergyModel.
113
*/
114
virtual
void
Set
(std::string name,
const
AttributeValue
& v) = 0;
115
116
/**
117
* \param device Pointer to the NetDevice to install DeviceEnergyModel.
118
* \param source The EnergySource the DeviceEnergyModel will be using.
119
* \returns An DeviceEnergyModelContainer contains all the DeviceEnergyModels.
120
*
121
* Installs an DeviceEnergyModel with a specified EnergySource onto a
122
* xNetDevice.
123
*/
124
energy::DeviceEnergyModelContainer
Install
(
Ptr<NetDevice>
device,
125
Ptr<energy::EnergySource>
source)
const
;
126
127
/**
128
* \param deviceContainer List of NetDevices to be install DeviceEnergyModel
129
* objects.
130
* \param sourceContainer List of EnergySource the DeviceEnergyModel will be
131
* using.
132
* \returns An DeviceEnergyModelContainer contains all the DeviceEnergyModels.
133
*
134
* Installs DeviceEnergyModels with specified EnergySources onto a list of
135
* NetDevices.
136
*/
137
energy::DeviceEnergyModelContainer
Install
(
NetDeviceContainer
deviceContainer,
138
energy::EnergySourceContainer
sourceContainer)
const
;
139
140
private
:
141
/**
142
* \param device The net device corresponding to DeviceEnergyModel object.
143
* \param source The EnergySource the DeviceEnergyModel will be using.
144
* \returns Pointer to the created DeviceEnergyModel.
145
*
146
* Child classes of DeviceEnergyModelHelper only have to implement this
147
* function, to create and aggregate an DeviceEnergyModel object onto a single
148
* node. The rest of the installation process (eg. installing EnergySource on
149
* set of nodes) is implemented in the DeviceEnergyModelHelper base class.
150
*/
151
virtual
Ptr<energy::DeviceEnergyModel>
DoInstall
(
Ptr<NetDevice>
device,
152
Ptr<energy::EnergySource>
source)
const
= 0;
153
};
154
155
}
// namespace ns3
156
157
#endif
/* ENERGY_MODEL_HELPER_H */
ns3::AttributeValue
Hold a value for an Attribute.
Definition
attribute.h:59
ns3::DeviceEnergyModelHelper
Creates DeviceEnergyModel objects.
Definition
energy-model-helper.h:104
ns3::DeviceEnergyModelHelper::Install
energy::DeviceEnergyModelContainer Install(Ptr< NetDevice > device, Ptr< energy::EnergySource > source) const
Definition
energy-model-helper.cc:81
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:76
ns3::DeviceEnergyModelHelper::Set
virtual void Set(std::string name, const AttributeValue &v)=0
ns3::EnergySourceHelper
Creates EnergySource objects.
Definition
energy-model-helper.h:36
ns3::EnergySourceHelper::~EnergySourceHelper
virtual ~EnergySourceHelper()
Definition
energy-model-helper.cc:20
ns3::EnergySourceHelper::InstallAll
energy::EnergySourceContainer InstallAll() const
This function installs an EnergySource on all nodes in simulation.
Definition
energy-model-helper.cc:68
ns3::EnergySourceHelper::Install
energy::EnergySourceContainer Install(Ptr< Node > node) const
Definition
energy-model-helper.cc:25
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:32
ns3::NodeContainer
keep track of a set of node pointers.
Definition
node-container.h:29
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::energy::DeviceEnergyModelContainer
Holds a vector of ns3::DeviceEnergyModel pointers.
Definition
device-energy-model-container.h:36
ns3::energy::EnergySourceContainer
Holds a vector of ns3::EnergySource pointers.
Definition
energy-source-container.h:37
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 Fri Nov 8 2024 13:59:00 for ns-3 by
1.11.0