A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
energy-harvester.cc
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
#include "
energy-harvester.h
"
22
23
#include "ns3/log.h"
24
25
namespace
ns3
26
{
27
28
NS_LOG_COMPONENT_DEFINE
(
"EnergyHarvester"
);
29
30
NS_OBJECT_ENSURE_REGISTERED
(EnergyHarvester);
31
32
TypeId
33
EnergyHarvester::GetTypeId
()
34
{
35
static
TypeId
tid =
TypeId
(
"ns3::EnergyHarvester"
).
SetParent
<
Object
>().SetGroupName(
"Energy"
);
36
return
tid;
37
}
38
39
EnergyHarvester::EnergyHarvester
()
40
{
41
NS_LOG_FUNCTION
(
this
);
42
}
43
44
EnergyHarvester::~EnergyHarvester
()
45
{
46
NS_LOG_FUNCTION
(
this
);
47
}
48
49
void
50
EnergyHarvester::SetNode
(
Ptr<Node>
node)
51
{
52
NS_LOG_FUNCTION
(
this
);
53
NS_ASSERT
(node);
54
m_node
= node;
55
}
56
57
Ptr<Node>
58
EnergyHarvester::GetNode
()
const
59
{
60
NS_LOG_FUNCTION
(
this
);
61
return
m_node
;
62
}
63
64
void
65
EnergyHarvester::SetEnergySource
(
Ptr<EnergySource>
source)
66
{
67
NS_LOG_FUNCTION
(
this
);
68
NS_ASSERT
(source);
69
m_energySource
= source;
70
}
71
72
Ptr<EnergySource>
73
EnergyHarvester::GetEnergySource
()
const
74
{
75
NS_LOG_FUNCTION
(
this
);
76
return
m_energySource
;
77
}
78
79
double
80
EnergyHarvester::GetPower
()
const
81
{
82
NS_LOG_FUNCTION
(
this
);
83
return
DoGetPower
();
84
}
85
86
/*
87
* Private function starts here.
88
*/
89
90
void
91
EnergyHarvester::DoDispose
()
92
{
93
NS_LOG_FUNCTION
(
this
);
94
}
95
96
double
97
EnergyHarvester::DoGetPower
()
const
98
{
99
NS_LOG_FUNCTION
(
this
);
100
return
0.0;
101
}
102
103
}
// namespace ns3
ns3::EnergyHarvester::GetEnergySource
Ptr< EnergySource > GetEnergySource() const
Definition:
energy-harvester.cc:73
ns3::EnergyHarvester::GetNode
Ptr< Node > GetNode() const
Definition:
energy-harvester.cc:58
ns3::EnergyHarvester::m_energySource
Ptr< EnergySource > m_energySource
Pointer to the Energy Source to which this EnergyHarvester is connected.
Definition:
energy-harvester.h:128
ns3::EnergyHarvester::GetPower
double GetPower() const
Definition:
energy-harvester.cc:80
ns3::EnergyHarvester::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition:
energy-harvester.cc:33
ns3::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:97
ns3::EnergyHarvester::m_node
Ptr< Node > m_node
Pointer to node containing this EnergyHarvester.
Definition:
energy-harvester.h:121
ns3::EnergyHarvester::~EnergyHarvester
~EnergyHarvester() override
Definition:
energy-harvester.cc:44
ns3::EnergyHarvester::DoDispose
void DoDispose() override
Defined in ns3::Object.
Definition:
energy-harvester.cc:91
ns3::EnergyHarvester::EnergyHarvester
EnergyHarvester()
Definition:
energy-harvester.cc:39
ns3::EnergyHarvester::SetNode
void SetNode(Ptr< Node > node)
Sets pointer to node containing this EnergyHarvester.
Definition:
energy-harvester.cc:50
ns3::EnergyHarvester::SetEnergySource
void SetEnergySource(Ptr< EnergySource > source)
Definition:
energy-harvester.cc:65
ns3::Object
A base class which provides memory management and object aggregation.
Definition:
object.h:89
ns3::Ptr< Node >
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition:
type-id.cc:931
energy-harvester.h
NS_ASSERT
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition:
assert.h:66
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:202
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition:
log-macros-enabled.h:240
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition:
object-base.h:46
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
energy
model
energy-harvester.cc
Generated on Sun Mar 3 2024 17:10:57 for ns-3 by
1.9.1