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
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
namespace
ns3
{
30
31
NS_LOG_COMPONENT_DEFINE
(
"WifiTxCurrentModel"
);
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
.SetGroupName (
"Energy"
)
43
;
44
return
tid;
45
}
46
47
WifiTxCurrentModel::WifiTxCurrentModel
()
48
{
49
}
50
51
WifiTxCurrentModel::~WifiTxCurrentModel
()
52
{
53
}
54
55
double
56
WifiTxCurrentModel::DbmToW
(
double
dbm)
57
{
58
double
mW = std::pow (10.0, dbm / 10.0);
59
return
mW / 1000.0;
60
}
61
62
// ------------------------------------------------------------------------- //
63
64
NS_OBJECT_ENSURE_REGISTERED
(
LinearWifiTxCurrentModel
);
65
66
TypeId
67
LinearWifiTxCurrentModel::GetTypeId
(
void
)
68
{
69
static
TypeId
tid =
TypeId
(
"ns3::LinearWifiTxCurrentModel"
)
70
.
SetParent
<
WifiTxCurrentModel
> ()
71
.AddConstructor<LinearWifiTxCurrentModel> ()
72
.AddAttribute (
"Eta"
,
"The efficiency of the power amplifier."
,
73
DoubleValue
(0.10),
74
MakeDoubleAccessor
(&
LinearWifiTxCurrentModel::SetEta
,
75
&
LinearWifiTxCurrentModel::GetEta
),
76
MakeDoubleChecker<double> ())
77
.AddAttribute (
"Voltage"
,
"The supply voltage (in Volts)."
,
78
DoubleValue
(3.0),
79
MakeDoubleAccessor
(&
LinearWifiTxCurrentModel::SetVoltage
,
80
&
LinearWifiTxCurrentModel::GetVoltage
),
81
MakeDoubleChecker<double> ())
82
.AddAttribute (
"IdleCurrent"
,
"The current in the IDLE state (in Watts)."
,
83
DoubleValue
(0.273333),
84
MakeDoubleAccessor
(&
LinearWifiTxCurrentModel::SetIdleCurrent
,
85
&
LinearWifiTxCurrentModel::GetIdleCurrent
),
86
MakeDoubleChecker<double> ())
87
;
88
return
tid;
89
}
90
91
LinearWifiTxCurrentModel::LinearWifiTxCurrentModel
()
92
{
93
}
94
95
LinearWifiTxCurrentModel::~LinearWifiTxCurrentModel
()
96
{
97
}
98
99
void
100
LinearWifiTxCurrentModel::SetEta
(
double
eta)
101
{
102
m_eta
= eta;
103
}
104
105
void
106
LinearWifiTxCurrentModel::SetVoltage
(
double
voltage)
107
{
108
m_voltage
= voltage;
109
}
110
111
void
112
LinearWifiTxCurrentModel::SetIdleCurrent
(
double
idleCurrent)
113
{
114
m_idleCurrent
= idleCurrent;
115
}
116
117
double
118
LinearWifiTxCurrentModel::GetEta
(
void
)
const
119
{
120
return
m_eta
;
121
}
122
123
double
124
LinearWifiTxCurrentModel::GetVoltage
(
void
)
const
125
{
126
return
m_voltage
;
127
}
128
129
double
130
LinearWifiTxCurrentModel::GetIdleCurrent
(
void
)
const
131
{
132
return
m_idleCurrent
;
133
}
134
135
double
136
LinearWifiTxCurrentModel::CalcTxCurrent
(
double
txPowerDbm)
const
137
{
138
return
DbmToW
(txPowerDbm) / (
m_voltage
*
m_eta
) +
m_idleCurrent
;
139
}
140
141
// ------------------------------------------------------------------------- //
142
143
}
// namespace ns3
wifi-tx-current-model.h
ns3::LinearWifiTxCurrentModel::GetIdleCurrent
double GetIdleCurrent(void) const
Definition:
wifi-tx-current-model.cc:130
ns3::LinearWifiTxCurrentModel::GetVoltage
double GetVoltage(void) const
Definition:
wifi-tx-current-model.cc:124
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition:
object-base.h:44
ns3::WifiTxCurrentModel::~WifiTxCurrentModel
virtual ~WifiTxCurrentModel()
Definition:
wifi-tx-current-model.cc:51
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:67
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:201
ns3::LinearWifiTxCurrentModel::SetVoltage
void SetVoltage(double voltage)
Definition:
wifi-tx-current-model.cc:106
ns3::LinearWifiTxCurrentModel::LinearWifiTxCurrentModel
LinearWifiTxCurrentModel()
Definition:
wifi-tx-current-model.cc:91
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:95
ns3::LinearWifiTxCurrentModel::CalcTxCurrent
double CalcTxCurrent(double txPowerDbm) const
Definition:
wifi-tx-current-model.cc:136
ns3::LinearWifiTxCurrentModel::SetEta
void SetEta(double eta)
Definition:
wifi-tx-current-model.cc:100
ns3::LinearWifiTxCurrentModel
a linear model of the Wifi transmit current
Definition:
wifi-tx-current-model.h:88
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::LinearWifiTxCurrentModel::GetEta
double GetEta(void) const
Definition:
wifi-tx-current-model.cc:118
ns3::MakeDoubleAccessor
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition:
double.h:42
ns3::WifiTxCurrentModel::WifiTxCurrentModel
WifiTxCurrentModel()
Definition:
wifi-tx-current-model.cc:47
ns3::LinearWifiTxCurrentModel::SetIdleCurrent
void SetIdleCurrent(double idleCurrent)
Definition:
wifi-tx-current-model.cc:112
ns3::Object
A base class which provides memory management and object aggregation.
Definition:
object.h:87
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
This class can be used to hold variables of floating point type such as 'double' or 'float'...
Definition:
double.h:41
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:58
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition:
type-id.cc:826
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:56
src
wifi
model
wifi-tx-current-model.cc
Generated on Wed Sep 30 2015 15:55:54 for ns-3 by
1.8.9.1