A Discrete-Event Network Simulator
QKDNetSim v2.0 (NS-3 v3.41) @ (+)
API
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
wifi-tx-current-model.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 Universita' degli Studi di Napoli "Federico II"
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: Stefano Avallone <stefano.avallone@unina.it>
18  */
19 
20 #include "wifi-tx-current-model.h"
21 
22 #include "wifi-utils.h"
23 
24 #include "ns3/double.h"
25 #include "ns3/log.h"
26 
27 namespace ns3
28 {
29 
30 NS_LOG_COMPONENT_DEFINE("WifiTxCurrentModel");
31 
32 NS_OBJECT_ENSURE_REGISTERED(WifiTxCurrentModel);
33 
34 TypeId
36 {
37  static TypeId tid = TypeId("ns3::WifiTxCurrentModel").SetParent<Object>().SetGroupName("Wifi");
38  return tid;
39 }
40 
42 {
43 }
44 
46 {
47 }
48 
50 
51 TypeId
53 {
54  static TypeId tid =
55  TypeId("ns3::LinearWifiTxCurrentModel")
57  .SetGroupName("Wifi")
58  .AddConstructor<LinearWifiTxCurrentModel>()
59  .AddAttribute("Eta",
60  "The efficiency of the power amplifier.",
61  DoubleValue(0.10),
63  MakeDoubleChecker<double>())
64  .AddAttribute("Voltage",
65  "The supply voltage (in Volts).",
66  DoubleValue(3.0),
68  MakeDoubleChecker<double>())
69  .AddAttribute("IdleCurrent",
70  "The current in the IDLE state (in Ampere).",
71  DoubleValue(0.273333),
73  MakeDoubleChecker<double>());
74  return tid;
75 }
76 
78 {
79  NS_LOG_FUNCTION(this);
80 }
81 
83 {
84  NS_LOG_FUNCTION(this);
85 }
86 
87 double
89 {
90  NS_LOG_FUNCTION(this << txPowerDbm);
91  return DbmToW(txPowerDbm) / (m_voltage * m_eta) + m_idleCurrent;
92 }
93 
94 } // namespace ns3
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:42
a linear model of the Wifi transmit current
double CalcTxCurrent(double txPowerDbm) const override
static TypeId GetTypeId()
Get the type ID.
double m_idleCurrent
idle current in Amperes
A base class which provides memory management and object aggregation.
Definition: object.h:89
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:931
Model the transmit current as a function of the transmit power and mode.
static TypeId GetTypeId()
Get the type ID.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:46
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double DbmToW(double dBm)
Convert from dBm to Watts.
Definition: wifi-utils.cc:40
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Definition: double.h:43