A Discrete-Event Network Simulator
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 * 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
25namespace ns3
26{
27
28NS_LOG_COMPONENT_DEFINE("EnergyHarvester");
29
30NS_OBJECT_ENSURE_REGISTERED(EnergyHarvester);
31
32TypeId
34{
35 static TypeId tid = TypeId("ns3::EnergyHarvester").SetParent<Object>().SetGroupName("Energy");
36 return tid;
37}
38
40{
41 NS_LOG_FUNCTION(this);
42}
43
45{
46 NS_LOG_FUNCTION(this);
47}
48
49void
51{
52 NS_LOG_FUNCTION(this);
53 NS_ASSERT(node);
54 m_node = node;
55}
56
59{
60 NS_LOG_FUNCTION(this);
61 return m_node;
62}
63
64void
66{
67 NS_LOG_FUNCTION(this);
68 NS_ASSERT(source);
69 m_energySource = source;
70}
71
74{
75 NS_LOG_FUNCTION(this);
76 return m_energySource;
77}
78
79double
81{
82 NS_LOG_FUNCTION(this);
83 return DoGetPower();
84}
85
86/*
87 * Private function starts here.
88 */
89
90void
92{
93 NS_LOG_FUNCTION(this);
94}
95
96double
98{
99 NS_LOG_FUNCTION(this);
100 return 0.0;
101}
102
103} // namespace ns3
Ptr< EnergySource > GetEnergySource() const
Ptr< Node > GetNode() const
Ptr< EnergySource > m_energySource
Pointer to the Energy Source to which this EnergyHarvester is connected.
double GetPower() const
static TypeId GetTypeId()
Get the type ID.
virtual double DoGetPower() const
This method is called by the GetPower method and it needs to be implemented by the subclasses of the ...
Ptr< Node > m_node
Pointer to node containing this EnergyHarvester.
void DoDispose() override
Defined in ns3::Object.
void SetNode(Ptr< Node > node)
Sets pointer to node containing this EnergyHarvester.
void SetEnergySource(Ptr< EnergySource > source)
A base class which provides memory management and object aggregation.
Definition: object.h:89
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:932
#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
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:46
Every class exported by the ns3 library is enclosed in the ns3 namespace.