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 * 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 "energy-source.h"
13
14#include "ns3/log.h"
15#include "ns3/node.h"
16
17namespace ns3
18{
19namespace energy
20{
21
22NS_LOG_COMPONENT_DEFINE("EnergyHarvester");
24
25TypeId
27{
28 static TypeId tid = TypeId("ns3::energy::EnergyHarvester")
29 .AddDeprecatedName("ns3::EnergyHarvester")
31 .SetGroupName("Energy");
32 return tid;
33}
34
39
44
45void
47{
48 NS_LOG_FUNCTION(this);
49 NS_ASSERT(node);
50 m_node = node;
51}
52
55{
56 NS_LOG_FUNCTION(this);
57 return m_node;
58}
59
60void
67
74
75double
77{
78 NS_LOG_FUNCTION(this);
79 return DoGetPower();
80}
81
82/*
83 * Private function starts here.
84 */
85
86void
91
92double
94{
95 NS_LOG_FUNCTION(this);
96 return 0.0;
97}
98
99} // namespace energy
100} // namespace ns3
Object()
Caller graph was not generated because of its size.
Definition object.cc:93
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:70
a unique identifier for an interface.
Definition type-id.h:49
TypeId AddDeprecatedName(const std::string &name)
Add an deprecated name for a TypeId.
Definition type-id.cc:860
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:999
Energy harvester base class.
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:55
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:194
#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:35
Every class exported by the ns3 library is enclosed in the ns3 namespace.