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{
27namespace energy
28{
29
30NS_LOG_COMPONENT_DEFINE("EnergyHarvester");
32
33TypeId
35{
36 static TypeId tid = TypeId("ns3::EnergyHarvester").SetParent<Object>().SetGroupName("Energy");
37 return tid;
38}
39
41{
42 NS_LOG_FUNCTION(this);
43}
44
46{
47 NS_LOG_FUNCTION(this);
48}
49
50void
52{
53 NS_LOG_FUNCTION(this);
54 NS_ASSERT(node);
55 m_node = node;
56}
57
60{
61 NS_LOG_FUNCTION(this);
62 return m_node;
63}
64
65void
67{
68 NS_LOG_FUNCTION(this);
69 NS_ASSERT(source);
70 m_energySource = source;
71}
72
75{
76 NS_LOG_FUNCTION(this);
77 return m_energySource;
78}
79
80double
82{
83 NS_LOG_FUNCTION(this);
84 return DoGetPower();
85}
86
87/*
88 * Private function starts here.
89 */
90
91void
93{
94 NS_LOG_FUNCTION(this);
95}
96
97double
99{
100 NS_LOG_FUNCTION(this);
101 return 0.0;
102}
103
104} // namespace energy
105} // namespace ns3
Introspection did not find any typical Config paths.
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
void DoDispose() override
Defined in ns3::Object.
Ptr< Node > m_node
Pointer to node containing this EnergyHarvester.
virtual double DoGetPower() const
This method is called by the GetPower method and it needs to be implemented by the subclasses of the ...
void SetEnergySource(Ptr< EnergySource > source)
Ptr< EnergySource > GetEnergySource() const
Ptr< EnergySource > m_energySource
Pointer to the Energy Source to which this EnergyHarvester is connected.
static TypeId GetTypeId()
Get the type ID.
void SetNode(Ptr< Node > node)
Sets pointer to node containing this EnergyHarvester.
#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.