A Discrete-Event Network Simulator
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
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
24namespace 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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
152 Ptr<energy::EnergySource> source) const = 0;
153};
154
155} // namespace ns3
156
157#endif /* ENERGY_MODEL_HELPER_H */
Hold a value for an Attribute.
Definition attribute.h:59
Creates DeviceEnergyModel objects.
energy::DeviceEnergyModelContainer Install(Ptr< NetDevice > device, Ptr< energy::EnergySource > source) const
virtual Ptr< energy::DeviceEnergyModel > DoInstall(Ptr< NetDevice > device, Ptr< energy::EnergySource > source) const =0
virtual void Set(std::string name, const AttributeValue &v)=0
Creates EnergySource objects.
energy::EnergySourceContainer InstallAll() const
This function installs an EnergySource on all nodes in simulation.
energy::EnergySourceContainer Install(Ptr< Node > node) const
virtual Ptr< energy::EnergySource > DoInstall(Ptr< Node > node) const =0
virtual void Set(std::string name, const AttributeValue &v)=0
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
Smart pointer class similar to boost::intrusive_ptr.
Holds a vector of ns3::DeviceEnergyModel pointers.
Holds a vector of ns3::EnergySource pointers.
Every class exported by the ns3 library is enclosed in the ns3 namespace.