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-harvester.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2014 Wireless Communications and Networking Group (WCNG),
3
* University of Rochester, Rochester, NY, USA.
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
* Author: Cristiano Tapparello <cristiano.tapparello@rochester.edu>
19
*/
20
21
#ifndef ENERGY_HARVESTER_H
22
#define ENERGY_HARVESTER_H
23
24
#include <iostream>
25
26
// include from ns-3
27
#include "ns3/energy-source-container.h"
28
#include "ns3/node.h"
29
#include "ns3/object.h"
30
#include "ns3/ptr.h"
31
#include "ns3/type-id.h"
32
33
namespace
ns3
34
{
35
namespace
energy
36
{
37
38
class
EnergySource
;
39
40
/**
41
* \ingroup energy
42
*
43
* \brief Energy harvester base class.
44
*/
45
46
class
EnergyHarvester
:
public
Object
47
{
48
public
:
49
/**
50
* \brief Get the type ID.
51
* \return The object TypeId.
52
*/
53
static
TypeId
GetTypeId
();
54
55
EnergyHarvester
();
56
57
~EnergyHarvester
()
override
;
58
59
/**
60
* \brief Sets pointer to node containing this EnergyHarvester.
61
*
62
* \param node Pointer to node containing this EnergyHarvester.
63
*/
64
void
SetNode
(
Ptr<Node>
node);
65
66
/**
67
* \returns Pointer to node containing this EnergyHarvester.
68
*
69
* When a subclass needs to get access to the underlying node base class to
70
* print the nodeId for example, it can invoke this method.
71
*/
72
Ptr<Node>
GetNode
()
const
;
73
74
/**
75
* \param source Pointer to energy source to which this EnergyHarvester is
76
* installed.
77
*
78
* This function sets the pointer to the energy source connected to the energy
79
* harvester.
80
*/
81
void
SetEnergySource
(
Ptr<EnergySource>
source);
82
83
/**
84
* \returns Pointer to energy source connected to the harvester.
85
*
86
* When a subclass needs to get access to the connected energy source,
87
* it can invoke this method.
88
*/
89
Ptr<EnergySource>
GetEnergySource
()
const
;
90
91
/**
92
* \returns Amount of power currently provided by the harvester.
93
*
94
* This method is called by the energy source connected to the harvester in order
95
* to determine the amount of energy that the harvester provided since last update.
96
*/
97
double
GetPower
()
const
;
98
99
private
:
100
/**
101
*
102
* Defined in ns3::Object
103
*/
104
void
DoDispose
()
override
;
105
106
/**
107
* This method is called by the GetPower method and it needs to be implemented by the
108
* subclasses of the energy harvester. It returns the actual amount of power that is
109
* currently provided by the energy harvester.
110
*
111
* This method should be used to connect the logic behind the particular implementation
112
* of the energy harvester with the energy source.
113
*
114
* \returns Amount of power currently provided by the harvester.
115
*/
116
virtual
double
DoGetPower
()
const
;
117
118
private
:
119
/**
120
* Pointer to node containing this EnergyHarvester. Used by helper class to make
121
* sure energy harvesters are installed onto the corresponding node.
122
*/
123
Ptr<Node>
m_node
;
124
125
/**
126
* Pointer to the Energy Source to which this EnergyHarvester is connected. Used
127
* by helper class to make sure energy harvesters are installed onto the
128
* corresponding energy source.
129
*/
130
Ptr<EnergySource>
m_energySource
;
131
132
protected
:
133
};
134
135
}
// namespace energy
136
}
// namespace ns3
137
138
#endif
/* defined(ENERGY_HARVESTER_H) */
EnergySource
Introspection did not find any typical Config paths.
ns3::Object
A base class which provides memory management and object aggregation.
Definition:
object.h:89
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:77
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
ns3::energy::EnergyHarvester
Energy harvester base class.
Definition:
energy-harvester.h:47
ns3::energy::EnergyHarvester::DoDispose
void DoDispose() override
Defined in ns3::Object.
Definition:
energy-harvester.cc:92
ns3::energy::EnergyHarvester::m_node
Ptr< Node > m_node
Pointer to node containing this EnergyHarvester.
Definition:
energy-harvester.h:123
ns3::energy::EnergyHarvester::DoGetPower
virtual double DoGetPower() const
This method is called by the GetPower method and it needs to be implemented by the subclasses of the ...
Definition:
energy-harvester.cc:98
ns3::energy::EnergyHarvester::SetEnergySource
void SetEnergySource(Ptr< EnergySource > source)
Definition:
energy-harvester.cc:66
ns3::energy::EnergyHarvester::~EnergyHarvester
~EnergyHarvester() override
Definition:
energy-harvester.cc:45
ns3::energy::EnergyHarvester::GetEnergySource
Ptr< EnergySource > GetEnergySource() const
Definition:
energy-harvester.cc:74
ns3::energy::EnergyHarvester::GetPower
double GetPower() const
Definition:
energy-harvester.cc:81
ns3::energy::EnergyHarvester::m_energySource
Ptr< EnergySource > m_energySource
Pointer to the Energy Source to which this EnergyHarvester is connected.
Definition:
energy-harvester.h:130
ns3::energy::EnergyHarvester::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition:
energy-harvester.cc:34
ns3::energy::EnergyHarvester::EnergyHarvester
EnergyHarvester()
Definition:
energy-harvester.cc:40
ns3::energy::EnergyHarvester::GetNode
Ptr< Node > GetNode() const
Definition:
energy-harvester.cc:59
ns3::energy::EnergyHarvester::SetNode
void SetNode(Ptr< Node > node)
Sets pointer to node containing this EnergyHarvester.
Definition:
energy-harvester.cc:51
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
energy
model
energy-harvester.h
Generated on Tue May 28 2024 23:35:18 for ns-3 by
1.9.6