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.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
* SPDX-License-Identifier: GPL-2.0-only
6
*
7
* Author: Cristiano Tapparello <cristiano.tapparello@rochester.edu>
8
*/
9
10
#include "
energy-harvester.h
"
11
12
#include "ns3/log.h"
13
14
namespace
ns3
15
{
16
namespace
energy
17
{
18
19
NS_LOG_COMPONENT_DEFINE
(
"EnergyHarvester"
);
20
NS_OBJECT_ENSURE_REGISTERED
(EnergyHarvester);
21
22
TypeId
23
EnergyHarvester::GetTypeId
()
24
{
25
static
TypeId
tid =
TypeId
(
"ns3::energy::EnergyHarvester"
)
26
.
AddDeprecatedName
(
"ns3::EnergyHarvester"
)
27
.
SetParent
<
Object
>()
28
.SetGroupName(
"Energy"
);
29
return
tid;
30
}
31
32
EnergyHarvester::EnergyHarvester
()
33
{
34
NS_LOG_FUNCTION
(
this
);
35
}
36
37
EnergyHarvester::~EnergyHarvester
()
38
{
39
NS_LOG_FUNCTION
(
this
);
40
}
41
42
void
43
EnergyHarvester::SetNode
(
Ptr<Node>
node)
44
{
45
NS_LOG_FUNCTION
(
this
);
46
NS_ASSERT
(node);
47
m_node
= node;
48
}
49
50
Ptr<Node>
51
EnergyHarvester::GetNode
()
const
52
{
53
NS_LOG_FUNCTION
(
this
);
54
return
m_node
;
55
}
56
57
void
58
EnergyHarvester::SetEnergySource
(
Ptr<EnergySource>
source)
59
{
60
NS_LOG_FUNCTION
(
this
);
61
NS_ASSERT
(source);
62
m_energySource
= source;
63
}
64
65
Ptr<EnergySource>
66
EnergyHarvester::GetEnergySource
()
const
67
{
68
NS_LOG_FUNCTION
(
this
);
69
return
m_energySource
;
70
}
71
72
double
73
EnergyHarvester::GetPower
()
const
74
{
75
NS_LOG_FUNCTION
(
this
);
76
return
DoGetPower
();
77
}
78
79
/*
80
* Private function starts here.
81
*/
82
83
void
84
EnergyHarvester::DoDispose
()
85
{
86
NS_LOG_FUNCTION
(
this
);
87
}
88
89
double
90
EnergyHarvester::DoGetPower
()
const
91
{
92
NS_LOG_FUNCTION
(
this
);
93
return
0.0;
94
}
95
96
}
// namespace energy
97
}
// namespace ns3
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::TypeId::AddDeprecatedName
TypeId AddDeprecatedName(const std::string &name)
Add an deprecated name for a TypeId.
Definition
type-id.cc:862
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition
type-id.cc:1001
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
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:55
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition
log.h:191
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:229
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition
object-base.h:35
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
energy
model
energy-harvester.cc
Generated on Fri Nov 8 2024 13:59:00 for ns-3 by
1.11.0