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