A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
src
energy
model
basic-energy-harvester.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2014 Wireless Communications and Networking Group (WCNG),
4
* University of Rochester, Rochester, NY, USA.
5
*
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License version 2 as
8
* published by the Free Software Foundation;
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
*
19
* Author: Cristiano Tapparello <cristiano.tapparello@rochester.edu>
20
*/
21
22
#ifndef BASIC_ENERGY_HARVESTER
23
#define BASIC_ENERGY_HARVESTER
24
25
#include <iostream>
26
27
// include from ns-3
28
#include "ns3/traced-value.h"
29
#include "ns3/nstime.h"
30
#include "ns3/event-id.h"
31
#include "
energy-harvester.h
"
32
#include "ns3/random-variable-stream.h"
33
#include "ns3/device-energy-model.h"
34
35
namespace
ns3
{
36
48
class
BasicEnergyHarvester
:
public
EnergyHarvester
49
{
50
public
:
51
static
TypeId
GetTypeId
(
void
);
52
53
BasicEnergyHarvester
();
54
62
BasicEnergyHarvester
(
Time
updateInterval);
63
64
virtual
~BasicEnergyHarvester
();
65
72
void
SetHarvestedPowerUpdateInterval
(
Time
updateInterval);
73
80
Time
GetHarvestedPowerUpdateInterval
(
void
)
const
;
81
89
int64_t
AssignStreams
(int64_t stream);
90
91
private
:
93
void
DoInitialize
(
void
);
94
96
void
DoDispose
(
void
);
97
101
void
CalculateHarvestedPower
(
void
);
102
107
virtual
double
DoGetPower
(
void
)
const
;
108
114
void
UpdateHarvestedPower
(
void
);
115
116
private
:
117
118
Ptr<RandomVariableStream>
m_harvestablePower
;
// Random variable for the harvestable power
119
120
TracedValue<double>
m_harvestedPower
;
// current harvested power, in Watt
121
TracedValue<double>
m_totalEnergyHarvestedJ
;
// total harvested energy, in Joule
122
123
EventId
m_energyHarvestingUpdateEvent
;
// energy harvesting event
124
Time
m_lastHarvestingUpdateTime
;
// last harvesting time
125
Time
m_harvestedPowerUpdateInterval
;
// harvestable energy update interval
126
127
};
128
129
}
// namespace ns3
130
131
#endif
/* defined(BASIC_ENERGY_HARVESTER) */
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition:
nstime.h:102
ns3::Ptr< RandomVariableStream >
ns3::BasicEnergyHarvester::SetHarvestedPowerUpdateInterval
void SetHarvestedPowerUpdateInterval(Time updateInterval)
Definition:
basic-energy-harvester.cc:92
ns3::BasicEnergyHarvester::m_harvestedPower
TracedValue< double > m_harvestedPower
Definition:
basic-energy-harvester.h:120
ns3::BasicEnergyHarvester::DoGetPower
virtual double DoGetPower(void) const
Definition:
basic-energy-harvester.cc:177
ns3::TracedValue< double >
ns3::BasicEnergyHarvester::DoInitialize
void DoInitialize(void)
Defined in ns3::Object.
Definition:
basic-energy-harvester.cc:150
ns3::BasicEnergyHarvester::m_energyHarvestingUpdateEvent
EventId m_energyHarvestingUpdateEvent
Definition:
basic-energy-harvester.h:123
ns3::BasicEnergyHarvester::m_totalEnergyHarvestedJ
TracedValue< double > m_totalEnergyHarvestedJ
Definition:
basic-energy-harvester.h:121
ns3::BasicEnergyHarvester::m_harvestedPowerUpdateInterval
Time m_harvestedPowerUpdateInterval
Definition:
basic-energy-harvester.h:125
ns3::BasicEnergyHarvester::m_lastHarvestingUpdateTime
Time m_lastHarvestingUpdateTime
Definition:
basic-energy-harvester.h:124
ns3::BasicEnergyHarvester::CalculateHarvestedPower
void CalculateHarvestedPower(void)
Calculates harvested Power.
Definition:
basic-energy-harvester.cc:166
ns3::BasicEnergyHarvester::UpdateHarvestedPower
void UpdateHarvestedPower(void)
This function is called every m_energyHarvestingUpdateInterval in order to update the amount of power...
Definition:
basic-energy-harvester.cc:110
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::BasicEnergyHarvester::BasicEnergyHarvester
BasicEnergyHarvester()
Definition:
basic-energy-harvester.cc:67
energy-harvester.h
ns3::BasicEnergyHarvester::GetHarvestedPowerUpdateInterval
Time GetHarvestedPowerUpdateInterval(void) const
Definition:
basic-energy-harvester.cc:99
ns3::EnergyHarvester
Energy harvester base class.
Definition:
energy-harvester.h:51
ns3::BasicEnergyHarvester::GetTypeId
static TypeId GetTypeId(void)
Definition:
basic-energy-harvester.cc:38
ns3::EventId
An identifier for simulation events.
Definition:
event-id.h:53
ns3::BasicEnergyHarvester::m_harvestablePower
Ptr< RandomVariableStream > m_harvestablePower
Definition:
basic-energy-harvester.h:118
ns3::BasicEnergyHarvester::DoDispose
void DoDispose(void)
Defined in ns3::Object.
Definition:
basic-energy-harvester.cc:160
ns3::BasicEnergyHarvester::AssignStreams
int64_t AssignStreams(int64_t stream)
Definition:
basic-energy-harvester.cc:84
ns3::BasicEnergyHarvester::~BasicEnergyHarvester
virtual ~BasicEnergyHarvester()
Definition:
basic-energy-harvester.cc:78
ns3::BasicEnergyHarvester
BasicEnergyHarvester increases remaining energy stored in an associated Energy Source.
Definition:
basic-energy-harvester.h:48
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:58
Generated on Wed Nov 7 2018 10:01:52 for ns-3 by
1.8.14