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 #include "interference-helper.h"
27 
28 namespace ns3 {
29 
30 NS_LOG_COMPONENT_DEFINE ("YansWifiPhy");
31 
32 NS_OBJECT_ENSURE_REGISTERED (YansWifiPhy);
33 
34 TypeId
36 {
37  static TypeId tid = TypeId ("ns3::YansWifiPhy")
38  .SetParent<WifiPhy> ()
39  .SetGroupName ("Wifi")
40  .AddConstructor<YansWifiPhy> ()
41  ;
42  return tid;
43 }
44 
46 {
47  NS_LOG_FUNCTION (this);
48 }
49 
50 void
52 {
54  //add dummy band for Yans
55  WifiSpectrumBand band;
56  band.first = 0;
57  band.second = 0;
58  m_interference->AddBand (band);
59 }
60 
62 {
63  NS_LOG_FUNCTION (this);
64 }
65 
66 void
68 {
69  NS_LOG_FUNCTION (this);
70  m_channel = 0;
72 }
73 
76 {
77  return m_channel;
78 }
79 
80 void
82 {
83  NS_LOG_FUNCTION (this << channel);
85  m_channel->Add (this);
86 }
87 
88 void
90 {
91  NS_LOG_FUNCTION (this << ppdu);
92  NS_LOG_DEBUG ("Start transmission: signal power before antenna gain=" << GetPowerDbm (ppdu->GetTxVector ().GetTxPowerLevel ()) << "dBm");
93  m_channel->Send (this, ppdu, GetTxPowerForTransmission (ppdu) + GetTxGain ());
94 }
95 
96 uint16_t
97 YansWifiPhy::GetGuardBandwidth (uint16_t currentChannelWidth) const
98 {
99  NS_ABORT_MSG ("Guard bandwidth not relevant for Yans");
100  return 0;
101 }
102 
103 std::tuple<double, double, double>
105 {
106  NS_ABORT_MSG ("Tx mask rejection params not relevant for Yans");
107  return std::make_tuple (0.0, 0.0, 0.0);
108 }
109 
110 } //namespace ns3
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:922
802.11 PHY layer model
Definition: wifi-phy.h:50
virtual void SetInterferenceHelper(const Ptr< InterferenceHelper > helper)
Sets the interference helper.
Definition: wifi-phy.cc:566
virtual void DoDispose(void)
Destructor implementation.
Definition: wifi-phy.cc:339
double GetPowerDbm(uint8_t power) const
Get the power of the given power level in dBm.
Definition: wifi-phy.cc:606
double GetTxGain(void) const
Return the transmission gain (dB).
Definition: wifi-phy.cc:503
Ptr< InterferenceHelper > m_interference
Pointer to a helper responsible for interference computations.
Definition: wifi-phy.h:1142
double GetTxPowerForTransmission(Ptr< const WifiPpdu > ppdu) const
Compute the transmit power for the next transmission.
Definition: wifi-phy.cc:1940
802.11 PHY layer model
Definition: yans-wifi-phy.h:48
Ptr< YansWifiChannel > m_channel
YansWifiChannel that this YansWifiPhy is connected to.
Definition: yans-wifi-phy.h:77
void StartTx(Ptr< WifiPpdu > ppdu) override
std::tuple< double, double, double > GetTxMaskRejectionParams(void) const override
uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const override
void SetChannel(const Ptr< YansWifiChannel > channel)
Set the YansWifiChannel this YansWifiPhy is to be connected to.
static TypeId GetTypeId(void)
Get the type ID.
virtual ~YansWifiPhy()
void SetInterferenceHelper(const Ptr< InterferenceHelper > helper) override
Sets the interference helper.
Ptr< Channel > GetChannel(void) const override
Return the Channel this WifiPhy is connected to.
void DoDispose(void) override
Destructor implementation.
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Definition: abort.h:50
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
#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:45
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::pair< uint32_t, uint32_t > WifiSpectrumBand
typedef for a pair of start and stop sub-band indexes
channel
Definition: third.py:92