A Discrete-Event Network Simulator
API
yans-wifi-phy.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2005,2006 INRIA
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  * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  * Ghada Badawy <gbadawy@gmail.com>
20  * S├ębastien Deronne <sebastien.deronne@gmail.com>
21  */
22 
23 #include "ns3/log.h"
24 #include "yans-wifi-phy.h"
25 #include "yans-wifi-channel.h"
26 
27 namespace ns3 {
28 
29 NS_LOG_COMPONENT_DEFINE ("YansWifiPhy");
30 
31 NS_OBJECT_ENSURE_REGISTERED (YansWifiPhy);
32 
33 TypeId
35 {
36  static TypeId tid = TypeId ("ns3::YansWifiPhy")
37  .SetParent<WifiPhy> ()
38  .SetGroupName ("Wifi")
39  .AddConstructor<YansWifiPhy> ()
40  ;
41  return tid;
42 }
43 
45 {
46  NS_LOG_FUNCTION (this);
47  //add dummy band for Yans
48  WifiSpectrumBand band;
49  band.first = 0;
50  band.second = 0;
51  m_interference.AddBand (band);
52 }
53 
55 {
56  NS_LOG_FUNCTION (this);
57 }
58 
59 void
61 {
62  NS_LOG_FUNCTION (this);
63  m_channel = 0;
65 }
66 
69 {
70  return m_channel;
71 }
72 
73 void
75 {
76  NS_LOG_FUNCTION (this << channel);
78  m_channel->Add (this);
79 }
80 
81 void
83 {
84  NS_LOG_FUNCTION (this << ppdu);
85  NS_LOG_DEBUG ("Start transmission: signal power before antenna gain=" << GetPowerDbm (ppdu->GetTxVector ().GetTxPowerLevel ()) << "dBm");
86  m_channel->Send (this, ppdu, GetTxPowerForTransmission (ppdu) + GetTxGain ());
87 }
88 
89 uint16_t
90 YansWifiPhy::GetGuardBandwidth (uint16_t currentChannelWidth) const
91 {
92  NS_ABORT_MSG ("Guard bandwidth not relevant for Yans");
93  return 0;
94 }
95 
96 std::tuple<double, double, double>
98 {
99  NS_ABORT_MSG ("Tx mask rejection params not relevant for Yans");
100  return std::make_tuple (0.0, 0.0, 0.0);
101 }
102 
103 } //namespace ns3
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
ns3::YansWifiPhy::SetChannel
void SetChannel(const Ptr< YansWifiChannel > channel)
Set the YansWifiChannel this YansWifiPhy is to be connected to.
Definition: yans-wifi-phy.cc:74
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
ns3::WifiSpectrumBand
std::pair< uint32_t, uint32_t > WifiSpectrumBand
typedef for a pair of start and stop sub-band indexes
Definition: wifi-spectrum-value-helper.h:34
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
third.channel
channel
Definition: third.py:92
ns3::WifiPhy::GetTxGain
double GetTxGain(void) const
Return the transmission gain (dB).
Definition: wifi-phy.cc:745
ns3::YansWifiPhy::StartTx
void StartTx(Ptr< WifiPpdu > ppdu) override
Definition: yans-wifi-phy.cc:82
yans-wifi-channel.h
ns3::YansWifiPhy::YansWifiPhy
YansWifiPhy()
Definition: yans-wifi-phy.cc:44
ns3::WifiPhy
802.11 PHY layer model
Definition: wifi-phy.h:49
ns3::WifiPhy::GetPowerDbm
double GetPowerDbm(uint8_t power) const
Get the power of the given power level in dBm.
Definition: wifi-phy.cc:840
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:923
ns3::WifiPhy::m_interference
InterferenceHelper m_interference
the class handling interference computations
Definition: wifi-phy.h:1178
ns3::Ptr< Channel >
ns3::YansWifiPhy::GetGuardBandwidth
uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const override
Definition: yans-wifi-phy.cc:90
ns3::YansWifiPhy::DoDispose
void DoDispose(void) override
Destructor implementation.
Definition: yans-wifi-phy.cc:60
ns3::WifiPhy::GetTxPowerForTransmission
double GetTxPowerForTransmission(Ptr< const WifiPpdu > ppdu) const
Compute the transmit power for the next transmission.
Definition: wifi-phy.cc:2237
ns3::YansWifiPhy::~YansWifiPhy
virtual ~YansWifiPhy()
Definition: yans-wifi-phy.cc:54
ns3::YansWifiPhy::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition: yans-wifi-phy.cc:34
NS_LOG_DEBUG
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
ns3::InterferenceHelper::AddBand
void AddBand(WifiSpectrumBand band)
Add a frequency band.
Definition: interference-helper.cc:223
ns3::YansWifiPhy::GetTxMaskRejectionParams
std::tuple< double, double, double > GetTxMaskRejectionParams(void) const override
Definition: yans-wifi-phy.cc:97
ns3::YansWifiPhy::GetChannel
Ptr< Channel > GetChannel(void) const override
Return the Channel this WifiPhy is connected to.
Definition: yans-wifi-phy.cc:68
ns3::WifiPhy::DoDispose
virtual void DoDispose(void)
Destructor implementation.
Definition: wifi-phy.cc:596
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition: log-macros-enabled.h:244
ns3::YansWifiPhy
802.11 PHY layer model
Definition: yans-wifi-phy.h:48
yans-wifi-phy.h
NS_ABORT_MSG
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Definition: abort.h:50
ns3::YansWifiPhy::m_channel
Ptr< YansWifiChannel > m_channel
YansWifiChannel that this YansWifiPhy is connected to.
Definition: yans-wifi-phy.h:77