A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
basic-energy-harvester.h
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
#ifndef BASIC_ENERGY_HARVESTER
22
#define BASIC_ENERGY_HARVESTER
23
24
#include "
device-energy-model.h
"
25
#include "
energy-harvester.h
"
26
27
#include "ns3/event-id.h"
28
#include "ns3/nstime.h"
29
#include "ns3/random-variable-stream.h"
30
#include "ns3/traced-value.h"
31
32
#include <iostream>
33
34
namespace
ns3
35
{
36
48
class
BasicEnergyHarvester
:
public
EnergyHarvester
49
{
50
public
:
55
static
TypeId
GetTypeId
();
56
57
BasicEnergyHarvester
();
58
66
BasicEnergyHarvester
(
Time
updateInterval);
67
68
~BasicEnergyHarvester
()
override
;
69
76
void
SetHarvestedPowerUpdateInterval
(
Time
updateInterval);
77
84
Time
GetHarvestedPowerUpdateInterval
()
const
;
85
93
int64_t
AssignStreams
(int64_t stream);
94
95
private
:
97
void
DoInitialize
()
override
;
98
100
void
DoDispose
()
override
;
101
105
void
CalculateHarvestedPower
();
106
111
double
DoGetPower
()
const override
;
112
118
void
UpdateHarvestedPower
();
119
120
private
:
121
Ptr<RandomVariableStream>
m_harvestablePower
;
122
123
TracedValue<double>
m_harvestedPower
;
124
TracedValue<double>
m_totalEnergyHarvestedJ
;
125
126
EventId
m_energyHarvestingUpdateEvent
;
127
Time
m_lastHarvestingUpdateTime
;
128
Time
m_harvestedPowerUpdateInterval
;
129
};
130
131
}
// namespace ns3
132
133
#endif
/* defined(BASIC_ENERGY_HARVESTER) */
ns3::BasicEnergyHarvester
BasicEnergyHarvester increases remaining energy stored in an associated Energy Source.
Definition:
basic-energy-harvester.h:49
ns3::BasicEnergyHarvester::m_lastHarvestingUpdateTime
Time m_lastHarvestingUpdateTime
last harvesting time
Definition:
basic-energy-harvester.h:127
ns3::BasicEnergyHarvester::UpdateHarvestedPower
void UpdateHarvestedPower()
This function is called every m_energyHarvestingUpdateInterval in order to update the amount of power...
Definition:
basic-energy-harvester.cc:113
ns3::BasicEnergyHarvester::m_harvestedPower
TracedValue< double > m_harvestedPower
current harvested power, in Watt
Definition:
basic-energy-harvester.h:123
ns3::BasicEnergyHarvester::m_harvestablePower
Ptr< RandomVariableStream > m_harvestablePower
Random variable for the harvestable power.
Definition:
basic-energy-harvester.h:121
ns3::BasicEnergyHarvester::DoGetPower
double DoGetPower() const override
Definition:
basic-energy-harvester.cc:180
ns3::BasicEnergyHarvester::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition:
basic-energy-harvester.cc:38
ns3::BasicEnergyHarvester::DoInitialize
void DoInitialize() override
Defined in ns3::Object.
Definition:
basic-energy-harvester.cc:153
ns3::BasicEnergyHarvester::SetHarvestedPowerUpdateInterval
void SetHarvestedPowerUpdateInterval(Time updateInterval)
Definition:
basic-energy-harvester.cc:95
ns3::BasicEnergyHarvester::m_totalEnergyHarvestedJ
TracedValue< double > m_totalEnergyHarvestedJ
total harvested energy, in Joule
Definition:
basic-energy-harvester.h:124
ns3::BasicEnergyHarvester::DoDispose
void DoDispose() override
Defined in ns3::Object.
Definition:
basic-energy-harvester.cc:163
ns3::BasicEnergyHarvester::AssignStreams
int64_t AssignStreams(int64_t stream)
Definition:
basic-energy-harvester.cc:87
ns3::BasicEnergyHarvester::GetHarvestedPowerUpdateInterval
Time GetHarvestedPowerUpdateInterval() const
Definition:
basic-energy-harvester.cc:102
ns3::BasicEnergyHarvester::BasicEnergyHarvester
BasicEnergyHarvester()
Definition:
basic-energy-harvester.cc:70
ns3::BasicEnergyHarvester::CalculateHarvestedPower
void CalculateHarvestedPower()
Calculates harvested Power.
Definition:
basic-energy-harvester.cc:169
ns3::BasicEnergyHarvester::m_energyHarvestingUpdateEvent
EventId m_energyHarvestingUpdateEvent
energy harvesting event
Definition:
basic-energy-harvester.h:126
ns3::BasicEnergyHarvester::~BasicEnergyHarvester
~BasicEnergyHarvester() override
Definition:
basic-energy-harvester.cc:81
ns3::BasicEnergyHarvester::m_harvestedPowerUpdateInterval
Time m_harvestedPowerUpdateInterval
harvestable energy update interval
Definition:
basic-energy-harvester.h:128
ns3::EnergyHarvester
Energy harvester base class.
Definition:
energy-harvester.h:45
ns3::EventId
An identifier for simulation events.
Definition:
event-id.h:55
ns3::Ptr< RandomVariableStream >
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition:
nstime.h:105
ns3::TracedValue< double >
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
device-energy-model.h
energy-harvester.h
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
energy
model
basic-energy-harvester.h
Generated on Sun Mar 3 2024 17:10:57 for ns-3 by
1.9.1