A Discrete-Event Network Simulator
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 <iostream>
25
26// include from ns-3
27#include "energy-harvester.h"
28
29#include "ns3/device-energy-model.h"
30#include "ns3/event-id.h"
31#include "ns3/nstime.h"
32#include "ns3/random-variable-stream.h"
33#include "ns3/traced-value.h"
34
35namespace ns3
36{
37
50{
51 public:
56 static TypeId GetTypeId();
57
59
67 BasicEnergyHarvester(Time updateInterval);
68
69 ~BasicEnergyHarvester() override;
70
77 void SetHarvestedPowerUpdateInterval(Time updateInterval);
78
86
94 int64_t AssignStreams(int64_t stream);
95
96 private:
98 void DoInitialize() override;
99
101 void DoDispose() override;
102
107
112 double DoGetPower() const override;
113
120
121 private:
123
126
130};
131
132} // namespace ns3
133
134#endif /* defined(BASIC_ENERGY_HARVESTER) */
BasicEnergyHarvester increases remaining energy stored in an associated Energy Source.
Time m_lastHarvestingUpdateTime
last harvesting time
void UpdateHarvestedPower()
This function is called every m_energyHarvestingUpdateInterval in order to update the amount of power...
TracedValue< double > m_harvestedPower
current harvested power, in Watt
Ptr< RandomVariableStream > m_harvestablePower
Random variable for the harvestable power.
double DoGetPower() const override
static TypeId GetTypeId()
Get the type ID.
void DoInitialize() override
Defined in ns3::Object.
void SetHarvestedPowerUpdateInterval(Time updateInterval)
TracedValue< double > m_totalEnergyHarvestedJ
total harvested energy, in Joule
void DoDispose() override
Defined in ns3::Object.
int64_t AssignStreams(int64_t stream)
void CalculateHarvestedPower()
Calculates harvested Power.
EventId m_energyHarvestingUpdateEvent
energy harvesting event
Time m_harvestedPowerUpdateInterval
harvestable energy update interval
Energy harvester base class.
An identifier for simulation events.
Definition: event-id.h:55
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.