A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
basic-energy-source.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2010 Network Security Lab, University of Washington, Seattle.
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
* Authors: Sidharth Nabar <snabar@uw.edu>, He Wu <mdzz@u.washington.edu>
19
*/
20
21
#ifndef BASIC_ENERGY_SOURCE_H
22
#define BASIC_ENERGY_SOURCE_H
23
24
#include "ns3/traced-value.h"
25
#include "ns3/nstime.h"
26
#include "ns3/event-id.h"
27
#include "
energy-source.h
"
28
29
namespace
ns3
{
30
37
class
BasicEnergySource
:
public
EnergySource
38
{
39
public
:
44
static
TypeId
GetTypeId
(
void
);
45
BasicEnergySource
();
46
virtual
~BasicEnergySource
();
47
53
virtual
double
GetInitialEnergy
(
void
)
const
;
54
60
virtual
double
GetSupplyVoltage
(
void
)
const
;
61
67
virtual
double
GetRemainingEnergy
(
void
);
68
74
virtual
double
GetEnergyFraction
(
void
);
75
79
virtual
void
UpdateEnergySource
(
void
);
80
88
void
SetInitialEnergy
(
double
initialEnergyJ);
89
95
void
SetSupplyVoltage
(
double
supplyVoltageV);
96
102
void
SetEnergyUpdateInterval
(
Time
interval);
103
107
Time
GetEnergyUpdateInterval
(
void
)
const
;
108
109
110
private
:
112
void
DoInitialize
(
void
);
113
115
void
DoDispose
(
void
);
116
122
void
HandleEnergyDrainedEvent
(
void
);
123
130
void
HandleEnergyRechargedEvent
(
void
);
131
140
void
CalculateRemainingEnergy
(
void
);
141
142
private
:
143
double
m_initialEnergyJ
;
144
double
m_supplyVoltageV
;
145
double
m_lowBatteryTh
;
146
double
m_highBatteryTh
;
151
bool
m_depleted
;
152
TracedValue<double>
m_remainingEnergyJ
;
153
EventId
m_energyUpdateEvent
;
154
Time
m_lastUpdateTime
;
155
Time
m_energyUpdateInterval
;
156
157
};
158
159
}
// namespace ns3
160
161
#endif
/* BASIC_ENERGY_SOURCE_H */
ns3::BasicEnergySource
BasicEnergySource decreases/increases remaining energy stored in itself in linearly.
Definition:
basic-energy-source.h:38
ns3::BasicEnergySource::SetEnergyUpdateInterval
void SetEnergyUpdateInterval(Time interval)
Definition:
basic-energy-source.cc:106
ns3::BasicEnergySource::UpdateEnergySource
virtual void UpdateEnergySource(void)
Implements UpdateEnergySource.
Definition:
basic-energy-source.cc:152
ns3::BasicEnergySource::BasicEnergySource
BasicEnergySource()
Definition:
basic-energy-source.cc:77
ns3::BasicEnergySource::GetRemainingEnergy
virtual double GetRemainingEnergy(void)
Definition:
basic-energy-source.cc:134
ns3::BasicEnergySource::HandleEnergyDrainedEvent
void HandleEnergyDrainedEvent(void)
Handles the remaining energy going to zero event.
Definition:
basic-energy-source.cc:204
ns3::BasicEnergySource::m_energyUpdateInterval
Time m_energyUpdateInterval
energy update interval
Definition:
basic-energy-source.h:155
ns3::BasicEnergySource::m_initialEnergyJ
double m_initialEnergyJ
initial energy, in Joules
Definition:
basic-energy-source.h:143
ns3::BasicEnergySource::m_lowBatteryTh
double m_lowBatteryTh
low battery threshold, as a fraction of the initial energy
Definition:
basic-energy-source.h:145
ns3::BasicEnergySource::m_lastUpdateTime
Time m_lastUpdateTime
last update time
Definition:
basic-energy-source.h:154
ns3::BasicEnergySource::~BasicEnergySource
virtual ~BasicEnergySource()
Definition:
basic-energy-source.cc:84
ns3::BasicEnergySource::SetSupplyVoltage
void SetSupplyVoltage(double supplyVoltageV)
Definition:
basic-energy-source.cc:99
ns3::BasicEnergySource::m_energyUpdateEvent
EventId m_energyUpdateEvent
energy update event
Definition:
basic-energy-source.h:153
ns3::BasicEnergySource::HandleEnergyRechargedEvent
void HandleEnergyRechargedEvent(void)
Handles the remaining energy exceeding the high threshold after it went below the low threshold.
Definition:
basic-energy-source.cc:212
ns3::BasicEnergySource::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition:
basic-energy-source.cc:35
ns3::BasicEnergySource::GetEnergyFraction
virtual double GetEnergyFraction(void)
Definition:
basic-energy-source.cc:143
ns3::BasicEnergySource::GetInitialEnergy
virtual double GetInitialEnergy(void) const
Definition:
basic-energy-source.cc:127
ns3::BasicEnergySource::GetEnergyUpdateInterval
Time GetEnergyUpdateInterval(void) const
Definition:
basic-energy-source.cc:113
ns3::BasicEnergySource::m_remainingEnergyJ
TracedValue< double > m_remainingEnergyJ
remaining energy, in Joules
Definition:
basic-energy-source.h:152
ns3::BasicEnergySource::m_depleted
bool m_depleted
set to true when the remaining energy goes below the low threshold, set to false again when the remai...
Definition:
basic-energy-source.h:151
ns3::BasicEnergySource::m_highBatteryTh
double m_highBatteryTh
high battery threshold, as a fraction of the initial energy
Definition:
basic-energy-source.h:146
ns3::BasicEnergySource::CalculateRemainingEnergy
void CalculateRemainingEnergy(void)
Calculates remaining energy.
Definition:
basic-energy-source.cc:220
ns3::BasicEnergySource::GetSupplyVoltage
virtual double GetSupplyVoltage(void) const
Definition:
basic-energy-source.cc:120
ns3::BasicEnergySource::DoDispose
void DoDispose(void)
Defined in ns3::Object.
Definition:
basic-energy-source.cc:197
ns3::BasicEnergySource::SetInitialEnergy
void SetInitialEnergy(double initialEnergyJ)
Definition:
basic-energy-source.cc:90
ns3::BasicEnergySource::m_supplyVoltageV
double m_supplyVoltageV
supply voltage, in Volts
Definition:
basic-energy-source.h:144
ns3::BasicEnergySource::DoInitialize
void DoInitialize(void)
Defined in ns3::Object.
Definition:
basic-energy-source.cc:190
ns3::EnergySource
Introspection did not find any typical Config paths.
Definition:
energy-source.h:87
ns3::EventId
An identifier for simulation events.
Definition:
event-id.h:54
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition:
nstime.h:103
ns3::TracedValue< double >
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
energy-source.h
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
energy
model
basic-energy-source.h
Generated on Tue Feb 6 2024 19:21:18 for ns-3 by
1.9.1