A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
acoustic-modem-energy-model.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2010 Andrea Sacco
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: Andrea Sacco <andrea.sacco85@gmail.com>
19
*/
20
21
#ifndef ACOUSTIC_MODEM_ENERGY_MODEL_H
22
#define ACOUSTIC_MODEM_ENERGY_MODEL_H
23
24
#include "ns3/device-energy-model.h"
25
#include "ns3/nstime.h"
26
#include "ns3/event-id.h"
27
#include "ns3/traced-value.h"
28
29
namespace
ns3 {
30
52
class
AcousticModemEnergyModel
:
public
DeviceEnergyModel
53
{
54
public
:
58
typedef
Callback<void>
AcousticModemEnergyDepletionCallback
;
59
60
public
:
61
static
TypeId
GetTypeId
(
void
);
62
AcousticModemEnergyModel
();
63
virtual
~AcousticModemEnergyModel
();
64
72
virtual
void
SetNode
(
Ptr<Node>
node);
73
81
virtual
Ptr<Node>
GetNode
(
void
)
const
;
82
90
virtual
void
SetEnergySource
(
Ptr<EnergySource>
source);
91
97
virtual
double
GetTotalEnergyConsumption
(
void
)
const
;
98
103
double
GetTxPowerW
(
void
)
const
;
104
110
void
SetTxPowerW
(
double
txPowerW);
111
116
double
GetRxPowerW
(
void
)
const
;
117
123
void
SetRxPowerW
(
double
rxPowerW);
124
129
double
GetIdlePowerW
(
void
)
const
;
130
136
void
SetIdlePowerW
(
double
idlePowerW);
137
142
double
GetSleepPowerW
(
void
)
const
;
143
149
void
SetSleepPowerW
(
double
sleepPowerW);
150
154
int
GetCurrentState
(
void
)
const
;
155
161
void
SetEnergyDepletionCallback
(
AcousticModemEnergyDepletionCallback
callback);
162
170
virtual
void
ChangeState
(
int
newState);
171
177
virtual
void
HandleEnergyDepletion
(
void
);
178
179
180
private
:
181
void
DoDispose
(
void
);
182
188
virtual
double
DoGetCurrentA
(
void
)
const
;
189
196
bool
IsStateTransitionValid
(
const
int
destState);
197
204
void
SetMicroModemState
(
const
int
state);
205
206
private
:
207
Ptr<Node>
m_node
;
208
Ptr<EnergySource>
m_source
;
209
210
// Member variables for power consumption in different modem states.
211
double
m_txPowerW
;
212
double
m_rxPowerW
;
213
double
m_idlePowerW
;
214
double
m_sleepPowerW
;
215
216
// This variable keeps track of the total energy consumed by this model.
217
TracedValue<double>
m_totalEnergyConsumption
;
218
219
// State variables.
220
int
m_currentState
;
// current state the modem is in
221
Time
m_lastUpdateTime
;
// time stamp of previous energy update
222
223
// energy depletion callback
224
AcousticModemEnergyDepletionCallback
m_energyDepletionCallback
;
225
};
226
227
}
// namespace ns3
228
229
#endif
/* ACOUSTIC_MODEM_ENERGY_MODEL_H */
src
uan
model
acoustic-modem-energy-model.h
Generated on Tue Nov 13 2012 10:32:23 for ns-3 by
1.8.1.2