A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
simple-device-energy-model.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2010 Andrea Sacco
3
*
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation;
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
*
17
* Author: Andrea Sacco <andrea.sacco85@gmail.com>
18
*/
19
20
#ifndef SIMPLE_DEVICE_ENERGY_MODEL_H
21
#define SIMPLE_DEVICE_ENERGY_MODEL_H
22
23
#include "
device-energy-model.h
"
24
25
#include "ns3/nstime.h"
26
#include "ns3/traced-value.h"
27
28
namespace
ns3
29
{
30
39
class
SimpleDeviceEnergyModel
:
public
DeviceEnergyModel
40
{
41
public
:
46
static
TypeId
GetTypeId
();
47
SimpleDeviceEnergyModel
();
48
~SimpleDeviceEnergyModel
()
override
;
49
57
virtual
void
SetNode
(
Ptr<Node>
node);
58
66
virtual
Ptr<Node>
GetNode
()
const
;
67
75
void
SetEnergySource
(
Ptr<EnergySource>
source)
override
;
76
82
double
GetTotalEnergyConsumption
()
const override
;
83
89
void
ChangeState
(
int
newState)
override
90
{
91
}
92
98
void
HandleEnergyDepletion
()
override
99
{
100
}
101
107
void
HandleEnergyRecharged
()
override
108
{
109
}
110
116
void
HandleEnergyChanged
()
override
117
{
118
}
119
125
void
SetCurrentA
(
double
current);
126
127
private
:
128
void
DoDispose
()
override
;
129
135
double
DoGetCurrentA
()
const override
;
136
137
Time
m_lastUpdateTime
;
138
double
m_actualCurrentA
;
139
Ptr<EnergySource>
m_source
;
140
Ptr<Node>
m_node
;
141
TracedValue<double>
m_totalEnergyConsumption
;
142
};
143
144
}
// namespace ns3
145
146
#endif
/* SIMPLE_DEVICE_ENERGY_MODEL_H */
ns3::DeviceEnergyModel
Base class for device energy models.
Definition:
device-energy-model.h:44
ns3::Ptr< Node >
ns3::SimpleDeviceEnergyModel
A simple device energy model where current drain can be set by the user.
Definition:
simple-device-energy-model.h:40
ns3::SimpleDeviceEnergyModel::ChangeState
void ChangeState(int newState) override
Definition:
simple-device-energy-model.h:89
ns3::SimpleDeviceEnergyModel::m_node
Ptr< Node > m_node
Node.
Definition:
simple-device-energy-model.h:140
ns3::SimpleDeviceEnergyModel::HandleEnergyChanged
void HandleEnergyChanged() override
Handles energy changed.
Definition:
simple-device-energy-model.h:116
ns3::SimpleDeviceEnergyModel::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition:
simple-device-energy-model.cc:36
ns3::SimpleDeviceEnergyModel::GetNode
virtual Ptr< Node > GetNode() const
Gets pointer to node.
Definition:
simple-device-energy-model.cc:80
ns3::SimpleDeviceEnergyModel::~SimpleDeviceEnergyModel
~SimpleDeviceEnergyModel() override
Definition:
simple-device-energy-model.cc:58
ns3::SimpleDeviceEnergyModel::SetCurrentA
void SetCurrentA(double current)
Definition:
simple-device-energy-model.cc:102
ns3::SimpleDeviceEnergyModel::m_totalEnergyConsumption
TracedValue< double > m_totalEnergyConsumption
Total energy consumption trace.
Definition:
simple-device-energy-model.h:141
ns3::SimpleDeviceEnergyModel::SimpleDeviceEnergyModel
SimpleDeviceEnergyModel()
Definition:
simple-device-energy-model.cc:50
ns3::SimpleDeviceEnergyModel::GetTotalEnergyConsumption
double GetTotalEnergyConsumption() const override
Definition:
simple-device-energy-model.cc:87
ns3::SimpleDeviceEnergyModel::DoDispose
void DoDispose() override
Destructor implementation.
Definition:
simple-device-energy-model.cc:122
ns3::SimpleDeviceEnergyModel::m_lastUpdateTime
Time m_lastUpdateTime
Last update time.
Definition:
simple-device-energy-model.h:137
ns3::SimpleDeviceEnergyModel::SetNode
virtual void SetNode(Ptr< Node > node)
Sets pointer to node.
Definition:
simple-device-energy-model.cc:72
ns3::SimpleDeviceEnergyModel::HandleEnergyDepletion
void HandleEnergyDepletion() override
Handles energy depletion.
Definition:
simple-device-energy-model.h:98
ns3::SimpleDeviceEnergyModel::DoGetCurrentA
double DoGetCurrentA() const override
Definition:
simple-device-energy-model.cc:129
ns3::SimpleDeviceEnergyModel::m_actualCurrentA
double m_actualCurrentA
actual curred (in Ampere)
Definition:
simple-device-energy-model.h:138
ns3::SimpleDeviceEnergyModel::SetEnergySource
void SetEnergySource(Ptr< EnergySource > source) override
Sets pointer to EnergySource installed on node.
Definition:
simple-device-energy-model.cc:64
ns3::SimpleDeviceEnergyModel::m_source
Ptr< EnergySource > m_source
Energy source.
Definition:
simple-device-energy-model.h:139
ns3::SimpleDeviceEnergyModel::HandleEnergyRecharged
void HandleEnergyRecharged() override
Handles energy recharged.
Definition:
simple-device-energy-model.h:107
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
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
energy
model
simple-device-energy-model.h
Generated on Sun Mar 3 2024 17:10:57 for ns-3 by
1.9.1