A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
energy-harvester.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2014 Wireless Communications and Networking Group (WCNG),
4
* University of Rochester, Rochester, NY, USA.
5
*
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License version 2 as
8
* published by the Free Software Foundation;
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
*
19
* Author: Cristiano Tapparello <cristiano.tapparello@rochester.edu>
20
*/
21
22
#include "
energy-harvester.h
"
23
#include "ns3/log.h"
24
25
namespace
ns3
{
26
27
NS_LOG_COMPONENT_DEFINE
(
"EnergyHarvester"
);
28
29
NS_OBJECT_ENSURE_REGISTERED
(EnergyHarvester);
30
31
TypeId
32
EnergyHarvester::GetTypeId
(
void
)
33
{
34
static
TypeId
tid =
TypeId
(
"ns3::EnergyHarvester"
)
35
.
SetParent
<
Object
> ()
36
.SetGroupName (
"Energy"
)
37
;
38
return
tid;
39
}
40
41
EnergyHarvester::EnergyHarvester
()
42
{
43
NS_LOG_FUNCTION
(
this
);
44
}
45
46
EnergyHarvester::~EnergyHarvester
()
47
{
48
NS_LOG_FUNCTION
(
this
);
49
}
50
51
void
52
EnergyHarvester::SetNode
(
Ptr<Node>
node)
53
{
54
NS_LOG_FUNCTION
(
this
);
55
NS_ASSERT
(node != 0);
56
m_node
= node;
57
}
58
59
Ptr<Node>
60
EnergyHarvester::GetNode
(
void
)
const
61
{
62
NS_LOG_FUNCTION
(
this
);
63
return
m_node
;
64
}
65
66
void
67
EnergyHarvester::SetEnergySource
(
Ptr<EnergySource>
source)
68
{
69
NS_LOG_FUNCTION
(
this
);
70
NS_ASSERT
(source != 0);
71
m_energySource
= source;
72
}
73
74
Ptr<EnergySource>
75
EnergyHarvester::GetEnergySource
(
void
)
const
76
{
77
NS_LOG_FUNCTION
(
this
);
78
return
m_energySource
;
79
}
80
81
82
double
83
EnergyHarvester::GetPower
(
void
)
const
84
{
85
NS_LOG_FUNCTION
(
this
);
86
return
DoGetPower
();
87
}
88
89
/*
90
* Private function starts here.
91
*/
92
93
void
94
EnergyHarvester::DoDispose
(
void
)
95
{
96
NS_LOG_FUNCTION
(
this
);
97
}
98
99
double
100
EnergyHarvester::DoGetPower
(
void
)
const
101
{
102
NS_LOG_FUNCTION
(
this
);
103
return
0.0;
104
}
105
106
}
ns3::EnergyHarvester::GetNode
Ptr< Node > GetNode(void) const
Definition:
energy-harvester.cc:60
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::DoDispose
virtual void DoDispose(void)
Defined in ns3::Object.
Definition:
energy-harvester.cc:94
ns3::EnergyHarvester::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition:
energy-harvester.cc:32
ns3::EnergyHarvester::~EnergyHarvester
virtual ~EnergyHarvester()
Definition:
energy-harvester.cc:46
ns3::EnergyHarvester::m_node
Ptr< Node > m_node
Pointer to node containing this EnergyHarvester.
Definition:
energy-harvester.h:121
ns3::EnergyHarvester::DoGetPower
virtual double DoGetPower(void) const
This method is called by the GetPower method and it needs to be implemented by the subclasses of the ...
Definition:
energy-harvester.cc:100
ns3::EnergyHarvester::EnergyHarvester
EnergyHarvester()
Definition:
energy-harvester.cc:41
ns3::EnergyHarvester::SetNode
void SetNode(Ptr< Node > node)
Sets pointer to node containing this EnergyHarvester.
Definition:
energy-harvester.cc:52
ns3::EnergyHarvester::SetEnergySource
void SetEnergySource(Ptr< EnergySource > source)
Definition:
energy-harvester.cc:67
ns3::EnergyHarvester::GetPower
double GetPower(void) const
Definition:
energy-harvester.cc:83
ns3::EnergyHarvester::GetEnergySource
Ptr< EnergySource > GetEnergySource(void) const
Definition:
energy-harvester.cc:75
ns3::Object
A base class which provides memory management and object aggregation.
Definition:
object.h:88
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:922
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:67
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:205
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:244
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition:
object-base.h:45
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
energy
model
energy-harvester.cc
Generated on Tue Feb 6 2024 19:21:18 for ns-3 by
1.9.1