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
simple-device-energy-model.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2010 Andrea Sacco
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Andrea Sacco <andrea.sacco85@gmail.com>
7
*/
8
9
#ifndef SIMPLE_DEVICE_ENERGY_MODEL_H
10
#define SIMPLE_DEVICE_ENERGY_MODEL_H
11
12
#include "
device-energy-model.h
"
13
14
#include "ns3/nstime.h"
15
#include "ns3/traced-value.h"
16
17
namespace
ns3
18
{
19
namespace
energy
20
{
21
22
/**
23
* \ingroup energy
24
*
25
* A simple device energy model where current drain can be set by the user.
26
*
27
* It is supposed to be used as a testing model for energy sources.
28
*
29
*/
30
class
SimpleDeviceEnergyModel
:
public
DeviceEnergyModel
31
{
32
public
:
33
/**
34
* \brief Get the type ID.
35
* \return The object TypeId.
36
*/
37
static
TypeId
GetTypeId
();
38
SimpleDeviceEnergyModel
();
39
~SimpleDeviceEnergyModel
()
override
;
40
41
/**
42
* \brief Sets pointer to node.
43
*
44
* \param node Pointer to node.
45
*
46
* Implements DeviceEnergyModel::SetNode.
47
*/
48
virtual
void
SetNode
(
Ptr<Node>
node);
49
50
/**
51
* \brief Gets pointer to node.
52
*
53
* \returns Pointer to node.
54
*
55
* Implements DeviceEnergyModel::GetNode.
56
*/
57
virtual
Ptr<Node>
GetNode
()
const
;
58
59
/**
60
* \brief Sets pointer to EnergySource installed on node.
61
*
62
* \param source Pointer to EnergySource installed on node.
63
*
64
* Implements DeviceEnergyModel::SetEnergySource.
65
*/
66
void
SetEnergySource
(
Ptr<EnergySource>
source)
override
;
67
68
/**
69
* \returns Total energy consumption of the vehicle.
70
*
71
* Implements DeviceEnergyModel::GetTotalEnergyConsumption.
72
*/
73
double
GetTotalEnergyConsumption
()
const override
;
74
75
/**
76
* \param newState New state the device is in.
77
*
78
* Not implemented
79
*/
80
void
ChangeState
(
int
newState)
override
81
{
82
}
83
84
/**
85
* \brief Handles energy depletion.
86
*
87
* Not implemented
88
*/
89
void
HandleEnergyDepletion
()
override
90
{
91
}
92
93
/**
94
* \brief Handles energy recharged.
95
*
96
* Not implemented
97
*/
98
void
HandleEnergyRecharged
()
override
99
{
100
}
101
102
/**
103
* \brief Handles energy changed.
104
*
105
* Not implemented
106
*/
107
void
HandleEnergyChanged
()
override
108
{
109
}
110
111
/**
112
* \param current the current draw of device.
113
*
114
* Set the actual current draw of the device.
115
*/
116
void
SetCurrentA
(
double
current);
117
118
private
:
119
void
DoDispose
()
override
;
120
121
/**
122
* \returns Current draw of device, at current state.
123
*
124
* Implements DeviceEnergyModel::GetCurrentA.
125
*/
126
double
DoGetCurrentA
()
const override
;
127
128
Time
m_lastUpdateTime
;
//!< Last update time
129
double
m_actualCurrentA
;
//!< actual curred (in Ampere)
130
Ptr<EnergySource>
m_source
;
//!< Energy source
131
Ptr<Node>
m_node
;
//!< Node
132
TracedValue<double>
m_totalEnergyConsumption
;
//!< Total energy consumption trace
133
};
134
135
}
// namespace energy
136
}
// namespace ns3
137
138
#endif
/* SIMPLE_DEVICE_ENERGY_MODEL_H */
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition
nstime.h:94
ns3::TracedValue
Trace classes with value semantics.
Definition
traced-value.h:105
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
ns3::energy::DeviceEnergyModel
Base class for device energy models.
Definition
device-energy-model.h:35
ns3::energy::SimpleDeviceEnergyModel
A simple device energy model where current drain can be set by the user.
Definition
simple-device-energy-model.h:31
ns3::energy::SimpleDeviceEnergyModel::GetNode
virtual Ptr< Node > GetNode() const
Gets pointer to node.
Definition
simple-device-energy-model.cc:71
ns3::energy::SimpleDeviceEnergyModel::m_node
Ptr< Node > m_node
Node.
Definition
simple-device-energy-model.h:131
ns3::energy::SimpleDeviceEnergyModel::m_actualCurrentA
double m_actualCurrentA
actual curred (in Ampere)
Definition
simple-device-energy-model.h:129
ns3::energy::SimpleDeviceEnergyModel::ChangeState
void ChangeState(int newState) override
Definition
simple-device-energy-model.h:80
ns3::energy::SimpleDeviceEnergyModel::HandleEnergyRecharged
void HandleEnergyRecharged() override
Handles energy recharged.
Definition
simple-device-energy-model.h:98
ns3::energy::SimpleDeviceEnergyModel::SetCurrentA
void SetCurrentA(double current)
Definition
simple-device-energy-model.cc:93
ns3::energy::SimpleDeviceEnergyModel::HandleEnergyDepletion
void HandleEnergyDepletion() override
Handles energy depletion.
Definition
simple-device-energy-model.h:89
ns3::energy::SimpleDeviceEnergyModel::~SimpleDeviceEnergyModel
~SimpleDeviceEnergyModel() override
Definition
simple-device-energy-model.cc:49
ns3::energy::SimpleDeviceEnergyModel::DoGetCurrentA
double DoGetCurrentA() const override
Definition
simple-device-energy-model.cc:120
ns3::energy::SimpleDeviceEnergyModel::SetEnergySource
void SetEnergySource(Ptr< EnergySource > source) override
Sets pointer to EnergySource installed on node.
Definition
simple-device-energy-model.cc:55
ns3::energy::SimpleDeviceEnergyModel::GetTotalEnergyConsumption
double GetTotalEnergyConsumption() const override
Definition
simple-device-energy-model.cc:78
ns3::energy::SimpleDeviceEnergyModel::DoDispose
void DoDispose() override
Destructor implementation.
Definition
simple-device-energy-model.cc:113
ns3::energy::SimpleDeviceEnergyModel::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
simple-device-energy-model.cc:26
ns3::energy::SimpleDeviceEnergyModel::SetNode
virtual void SetNode(Ptr< Node > node)
Sets pointer to node.
Definition
simple-device-energy-model.cc:63
ns3::energy::SimpleDeviceEnergyModel::m_source
Ptr< EnergySource > m_source
Energy source.
Definition
simple-device-energy-model.h:130
ns3::energy::SimpleDeviceEnergyModel::HandleEnergyChanged
void HandleEnergyChanged() override
Handles energy changed.
Definition
simple-device-energy-model.h:107
ns3::energy::SimpleDeviceEnergyModel::SimpleDeviceEnergyModel
SimpleDeviceEnergyModel()
Definition
simple-device-energy-model.cc:41
ns3::energy::SimpleDeviceEnergyModel::m_lastUpdateTime
Time m_lastUpdateTime
Last update time.
Definition
simple-device-energy-model.h:128
ns3::energy::SimpleDeviceEnergyModel::m_totalEnergyConsumption
TracedValue< double > m_totalEnergyConsumption
Total energy consumption trace.
Definition
simple-device-energy-model.h:132
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 Fri Nov 8 2024 13:59:00 for ns-3 by
1.11.0