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 "ns3/log.h"
13
14namespace ns3
15{
16namespace energy
17{
18
19NS_LOG_COMPONENT_DEFINE("EnergyHarvester");
20NS_OBJECT_ENSURE_REGISTERED(EnergyHarvester);
21
22TypeId
24{
25 static TypeId tid = TypeId("ns3::energy::EnergyHarvester")
26 .AddDeprecatedName("ns3::EnergyHarvester")
28 .SetGroupName("Energy");
29 return tid;
30}
31
36
41
42void
44{
45 NS_LOG_FUNCTION(this);
46 NS_ASSERT(node);
47 m_node = node;
48}
49
52{
53 NS_LOG_FUNCTION(this);
54 return m_node;
55}
56
57void
64
71
72double
74{
75 NS_LOG_FUNCTION(this);
76 return DoGetPower();
77}
78
79/*
80 * Private function starts here.
81 */
82
83void
88
89double
91{
92 NS_LOG_FUNCTION(this);
93 return 0.0;
94}
95
96} // namespace energy
97} // namespace ns3
A base class which provides memory management and object aggregation.
Definition object.h:78
Smart pointer class similar to boost::intrusive_ptr.
a unique identifier for an interface.
Definition type-id.h:48
TypeId AddDeprecatedName(const std::string &name)
Add an deprecated name for a TypeId.
Definition type-id.cc:862
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
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:191
#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.