A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
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
namespace
energy
37
{
38
39
/**
40
* \ingroup energy
41
* BasicEnergyHarvester increases remaining energy stored in an associated
42
* Energy Source. The BasicEnergyHarvester implements a simple model in which
43
* the amount of power provided by the harvester varies over time according
44
* to a customizable generic random variable and time update intervals.
45
*
46
* Unit of power is chosen as Watt since energy models typically calculate
47
* energy as (time in seconds * power in Watt).
48
*
49
*/
50
class
BasicEnergyHarvester
:
public
EnergyHarvester
51
{
52
public
:
53
/**
54
* \brief Get the type ID.
55
* \return The object TypeId.
56
*/
57
static
TypeId
GetTypeId
();
58
59
BasicEnergyHarvester
();
60
61
/**
62
* \param updateInterval Energy harvesting update interval.
63
*
64
* BasicEnergyHarvester constructor function that sets the interval
65
* between each update of the value of the power harvested by this
66
* energy harvester.
67
*/
68
BasicEnergyHarvester
(
Time
updateInterval);
69
70
~BasicEnergyHarvester
()
override
;
71
72
/**
73
* \param updateInterval Energy harvesting update interval.
74
*
75
* This function sets the interval between each update of the value of the
76
* power harvested by this energy harvester.
77
*/
78
void
SetHarvestedPowerUpdateInterval
(
Time
updateInterval);
79
80
/**
81
* \returns The interval between each update of the harvested power.
82
*
83
* This function returns the interval between each update of the value of the
84
* power harvested by this energy harvester.
85
*/
86
Time
GetHarvestedPowerUpdateInterval
()
const
;
87
88
/**
89
* \param stream Random variable stream number.
90
* \returns The number of stream indices assigned by this model.
91
*
92
* This function sets the stream number to be used by the random variable that
93
* determines the amount of power that can be harvested by this energy harvester.
94
*/
95
int64_t
AssignStreams
(int64_t stream);
96
97
private
:
98
/// Defined in ns3::Object
99
void
DoInitialize
()
override
;
100
101
/// Defined in ns3::Object
102
void
DoDispose
()
override
;
103
104
/**
105
* Calculates harvested Power.
106
*/
107
void
CalculateHarvestedPower
();
108
109
/**
110
* \returns m_harvestedPower The power currently provided by the Basic Energy Harvester.
111
* Implements DoGetPower defined in EnergyHarvester.
112
*/
113
double
DoGetPower
()
const override
;
114
115
/**
116
* This function is called every m_energyHarvestingUpdateInterval in order to
117
* update the amount of power that will be provided by the harvester in the
118
* next interval.
119
*/
120
void
UpdateHarvestedPower
();
121
122
private
:
123
Ptr<RandomVariableStream>
m_harvestablePower
;
//!< Random variable for the harvestable power
124
125
TracedValue<double>
m_harvestedPower
;
//!< current harvested power, in Watt
126
TracedValue<double>
m_totalEnergyHarvestedJ
;
//!< total harvested energy, in Joule
127
128
EventId
m_energyHarvestingUpdateEvent
;
//!< energy harvesting event
129
Time
m_lastHarvestingUpdateTime
;
//!< last harvesting time
130
Time
m_harvestedPowerUpdateInterval
;
//!< harvestable energy update interval
131
};
132
133
}
// namespace energy
134
}
// namespace ns3
135
136
#endif
/* defined(BASIC_ENERGY_HARVESTER) */
ns3::EventId
An identifier for simulation events.
Definition:
event-id.h:56
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:77
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition:
nstime.h:105
ns3::TracedValue
Trace classes with value semantics.
Definition:
traced-value.h:116
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
ns3::energy::BasicEnergyHarvester
BasicEnergyHarvester increases remaining energy stored in an associated Energy Source.
Definition:
basic-energy-harvester.h:51
ns3::energy::BasicEnergyHarvester::m_harvestedPowerUpdateInterval
Time m_harvestedPowerUpdateInterval
harvestable energy update interval
Definition:
basic-energy-harvester.h:130
ns3::energy::BasicEnergyHarvester::DoGetPower
double DoGetPower() const override
Definition:
basic-energy-harvester.cc:181
ns3::energy::BasicEnergyHarvester::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition:
basic-energy-harvester.cc:39
ns3::energy::BasicEnergyHarvester::m_totalEnergyHarvestedJ
TracedValue< double > m_totalEnergyHarvestedJ
total harvested energy, in Joule
Definition:
basic-energy-harvester.h:126
ns3::energy::BasicEnergyHarvester::m_harvestablePower
Ptr< RandomVariableStream > m_harvestablePower
Random variable for the harvestable power.
Definition:
basic-energy-harvester.h:123
ns3::energy::BasicEnergyHarvester::CalculateHarvestedPower
void CalculateHarvestedPower()
Calculates harvested Power.
Definition:
basic-energy-harvester.cc:170
ns3::energy::BasicEnergyHarvester::DoInitialize
void DoInitialize() override
Defined in ns3::Object.
Definition:
basic-energy-harvester.cc:154
ns3::energy::BasicEnergyHarvester::UpdateHarvestedPower
void UpdateHarvestedPower()
This function is called every m_energyHarvestingUpdateInterval in order to update the amount of power...
Definition:
basic-energy-harvester.cc:114
ns3::energy::BasicEnergyHarvester::BasicEnergyHarvester
BasicEnergyHarvester()
Definition:
basic-energy-harvester.cc:71
ns3::energy::BasicEnergyHarvester::~BasicEnergyHarvester
~BasicEnergyHarvester() override
Definition:
basic-energy-harvester.cc:82
ns3::energy::BasicEnergyHarvester::GetHarvestedPowerUpdateInterval
Time GetHarvestedPowerUpdateInterval() const
Definition:
basic-energy-harvester.cc:103
ns3::energy::BasicEnergyHarvester::m_lastHarvestingUpdateTime
Time m_lastHarvestingUpdateTime
last harvesting time
Definition:
basic-energy-harvester.h:129
ns3::energy::BasicEnergyHarvester::DoDispose
void DoDispose() override
Defined in ns3::Object.
Definition:
basic-energy-harvester.cc:164
ns3::energy::BasicEnergyHarvester::m_harvestedPower
TracedValue< double > m_harvestedPower
current harvested power, in Watt
Definition:
basic-energy-harvester.h:125
ns3::energy::BasicEnergyHarvester::AssignStreams
int64_t AssignStreams(int64_t stream)
Definition:
basic-energy-harvester.cc:88
ns3::energy::BasicEnergyHarvester::SetHarvestedPowerUpdateInterval
void SetHarvestedPowerUpdateInterval(Time updateInterval)
Definition:
basic-energy-harvester.cc:96
ns3::energy::BasicEnergyHarvester::m_energyHarvestingUpdateEvent
EventId m_energyHarvestingUpdateEvent
energy harvesting event
Definition:
basic-energy-harvester.h:128
ns3::energy::EnergyHarvester
Energy harvester base class.
Definition:
energy-harvester.h:47
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 Tue May 28 2024 23:35:17 for ns-3 by
1.9.6