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
wifi-tx-current-model.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2014 Universita' degli Studi di Napoli "Federico II"
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: Stefano Avallone <stefano.avallone@unina.it>
19
*/
20
21
#include "
wifi-tx-current-model.h
"
22
#include "ns3/log.h"
23
#include "ns3/boolean.h"
24
#include "ns3/double.h"
25
#include "ns3/string.h"
26
#include "ns3/pointer.h"
27
#include <cmath>
28
29
NS_LOG_COMPONENT_DEFINE
(
"WifiTxCurrentModel"
);
30
31
namespace
ns3 {
32
33
// ------------------------------------------------------------------------- //
34
35
NS_OBJECT_ENSURE_REGISTERED
(WifiTxCurrentModel);
36
37
TypeId
38
WifiTxCurrentModel::GetTypeId
(
void
)
39
{
40
static
TypeId
tid =
TypeId
(
"ns3::WifiTxCurrentModel"
)
41
.
SetParent
<
Object
> ()
42
;
43
return
tid;
44
}
45
46
WifiTxCurrentModel::WifiTxCurrentModel
()
47
{
48
}
49
50
WifiTxCurrentModel::~WifiTxCurrentModel
()
51
{
52
}
53
54
double
55
WifiTxCurrentModel::DbmToW
(
double
dbm)
56
{
57
double
mW = std::pow (10.0, dbm / 10.0);
58
return
mW / 1000.0;
59
}
60
61
// ------------------------------------------------------------------------- //
62
63
NS_OBJECT_ENSURE_REGISTERED
(
LinearWifiTxCurrentModel
);
64
65
TypeId
66
LinearWifiTxCurrentModel::GetTypeId
(
void
)
67
{
68
static
TypeId
tid =
TypeId
(
"ns3::LinearWifiTxCurrentModel"
)
69
.
SetParent
<
WifiTxCurrentModel
> ()
70
.AddConstructor<LinearWifiTxCurrentModel> ()
71
.AddAttribute (
"Eta"
,
"The efficiency of the power amplifier."
,
72
DoubleValue
(0.10),
73
MakeDoubleAccessor (&
LinearWifiTxCurrentModel::SetEta
,
74
&
LinearWifiTxCurrentModel::GetEta
),
75
MakeDoubleChecker<double> ())
76
.AddAttribute (
"Voltage"
,
"The supply voltage (in Volts)."
,
77
DoubleValue
(3.0),
78
MakeDoubleAccessor (&
LinearWifiTxCurrentModel::SetVoltage
,
79
&
LinearWifiTxCurrentModel::GetVoltage
),
80
MakeDoubleChecker<double> ())
81
.AddAttribute (
"IdleCurrent"
,
"The current in the IDLE state (in Watts)."
,
82
DoubleValue
(0.273333),
83
MakeDoubleAccessor (&
LinearWifiTxCurrentModel::SetIdleCurrent
,
84
&
LinearWifiTxCurrentModel::GetIdleCurrent
),
85
MakeDoubleChecker<double> ())
86
;
87
return
tid;
88
}
89
90
LinearWifiTxCurrentModel::LinearWifiTxCurrentModel
()
91
{
92
}
93
94
LinearWifiTxCurrentModel::~LinearWifiTxCurrentModel
()
95
{
96
}
97
98
void
99
LinearWifiTxCurrentModel::SetEta
(
double
eta)
100
{
101
m_eta
= eta;
102
}
103
104
void
105
LinearWifiTxCurrentModel::SetVoltage
(
double
voltage)
106
{
107
m_voltage
= voltage;
108
}
109
110
void
111
LinearWifiTxCurrentModel::SetIdleCurrent
(
double
idleCurrent)
112
{
113
m_idleCurrent
= idleCurrent;
114
}
115
116
double
117
LinearWifiTxCurrentModel::GetEta
(
void
)
const
118
{
119
return
m_eta
;
120
}
121
122
double
123
LinearWifiTxCurrentModel::GetVoltage
(
void
)
const
124
{
125
return
m_voltage
;
126
}
127
128
double
129
LinearWifiTxCurrentModel::GetIdleCurrent
(
void
)
const
130
{
131
return
m_idleCurrent
;
132
}
133
134
double
135
LinearWifiTxCurrentModel::CalcTxCurrent
(
double
txPowerDbm)
const
136
{
137
return
DbmToW
(txPowerDbm) / (
m_voltage
*
m_eta
) +
m_idleCurrent
;
138
}
139
140
// ------------------------------------------------------------------------- //
141
142
}
// namespace ns3
wifi-tx-current-model.h
ns3::LinearWifiTxCurrentModel::GetIdleCurrent
double GetIdleCurrent(void) const
Definition:
wifi-tx-current-model.cc:129
ns3::LinearWifiTxCurrentModel::GetVoltage
double GetVoltage(void) const
Definition:
wifi-tx-current-model.cc:123
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register the class in the ns-3 factory.
Definition:
object-base.h:38
ns3::WifiTxCurrentModel::~WifiTxCurrentModel
virtual ~WifiTxCurrentModel()
Definition:
wifi-tx-current-model.cc:50
ns3::LinearWifiTxCurrentModel::m_eta
double m_eta
Definition:
wifi-tx-current-model.h:135
ns3::LinearWifiTxCurrentModel::GetTypeId
static TypeId GetTypeId(void)
Definition:
wifi-tx-current-model.cc:66
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:170
ns3::LinearWifiTxCurrentModel::SetVoltage
void SetVoltage(double voltage)
Definition:
wifi-tx-current-model.cc:105
ns3::LinearWifiTxCurrentModel::LinearWifiTxCurrentModel
LinearWifiTxCurrentModel()
Definition:
wifi-tx-current-model.cc:90
ns3::WifiTxCurrentModel::GetTypeId
static TypeId GetTypeId(void)
Definition:
wifi-tx-current-model.cc:38
ns3::LinearWifiTxCurrentModel::~LinearWifiTxCurrentModel
virtual ~LinearWifiTxCurrentModel()
Definition:
wifi-tx-current-model.cc:94
ns3::LinearWifiTxCurrentModel::CalcTxCurrent
double CalcTxCurrent(double txPowerDbm) const
Definition:
wifi-tx-current-model.cc:135
ns3::LinearWifiTxCurrentModel::SetEta
void SetEta(double eta)
Definition:
wifi-tx-current-model.cc:99
ns3::LinearWifiTxCurrentModel
a linear model of the Wifi transmit current
Definition:
wifi-tx-current-model.h:88
ns3::LinearWifiTxCurrentModel::GetEta
double GetEta(void) const
Definition:
wifi-tx-current-model.cc:117
ns3::WifiTxCurrentModel::WifiTxCurrentModel
WifiTxCurrentModel()
Definition:
wifi-tx-current-model.cc:46
ns3::LinearWifiTxCurrentModel::SetIdleCurrent
void SetIdleCurrent(double idleCurrent)
Definition:
wifi-tx-current-model.cc:111
ns3::Object
a base class which provides memory management and object aggregation
Definition:
object.h:64
ns3::WifiTxCurrentModel
Modelize the transmit current as a function of the transmit power and mode.
Definition:
wifi-tx-current-model.h:34
ns3::LinearWifiTxCurrentModel::m_voltage
double m_voltage
Definition:
wifi-tx-current-model.h:136
ns3::DoubleValue
Hold a floating point type.
Definition:
double.h:41
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:49
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Definition:
type-id.cc:610
ns3::LinearWifiTxCurrentModel::m_idleCurrent
double m_idleCurrent
Definition:
wifi-tx-current-model.h:137
ns3::WifiTxCurrentModel::DbmToW
static double DbmToW(double dbm)
Convert from dBm to Watts.
Definition:
wifi-tx-current-model.cc:55
src
energy
model
wifi-tx-current-model.cc
Generated on Wed Sep 17 2014 23:33:25 for ns-3 by
1.8.6