A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  * Author: Ghada Badawy <gbadawy@gmail.com>
20  */
21 
22 #include "yans-wifi-phy.h"
23 #include "yans-wifi-channel.h"
24 #include "wifi-mode.h"
25 #include "wifi-preamble.h"
26 #include "wifi-phy-state-helper.h"
27 #include "error-rate-model.h"
28 #include "ns3/simulator.h"
29 #include "ns3/packet.h"
30 #include "ns3/assert.h"
31 #include "ns3/log.h"
32 #include "ns3/double.h"
33 #include "ns3/uinteger.h"
34 #include "ns3/enum.h"
35 #include "ns3/pointer.h"
36 #include "ns3/net-device.h"
37 #include "ns3/trace-source-accessor.h"
38 #include "ns3/boolean.h"
39 #include <cmath>
40 
41 NS_LOG_COMPONENT_DEFINE ("YansWifiPhy");
42 
43 namespace ns3 {
44 
45 NS_OBJECT_ENSURE_REGISTERED (YansWifiPhy)
46  ;
47 
48 TypeId
50 {
51  static TypeId tid = TypeId ("ns3::YansWifiPhy")
52  .SetParent<WifiPhy> ()
53  .AddConstructor<YansWifiPhy> ()
54  .AddAttribute ("EnergyDetectionThreshold",
55  "The energy of a received signal should be higher than "
56  "this threshold (dbm) to allow the PHY layer to detect the signal.",
57  DoubleValue (-96.0),
58  MakeDoubleAccessor (&YansWifiPhy::SetEdThreshold,
60  MakeDoubleChecker<double> ())
61  .AddAttribute ("CcaMode1Threshold",
62  "The energy of a received signal should be higher than "
63  "this threshold (dbm) to allow the PHY layer to declare CCA BUSY state",
64  DoubleValue (-99.0),
65  MakeDoubleAccessor (&YansWifiPhy::SetCcaMode1Threshold,
67  MakeDoubleChecker<double> ())
68  .AddAttribute ("TxGain",
69  "Transmission gain (dB).",
70  DoubleValue (1.0),
71  MakeDoubleAccessor (&YansWifiPhy::SetTxGain,
73  MakeDoubleChecker<double> ())
74  .AddAttribute ("RxGain",
75  "Reception gain (dB).",
76  DoubleValue (1.0),
77  MakeDoubleAccessor (&YansWifiPhy::SetRxGain,
79  MakeDoubleChecker<double> ())
80  .AddAttribute ("TxPowerLevels",
81  "Number of transmission power levels available between "
82  "TxPowerStart and TxPowerEnd included.",
83  UintegerValue (1),
84  MakeUintegerAccessor (&YansWifiPhy::m_nTxPower),
85  MakeUintegerChecker<uint32_t> ())
86  .AddAttribute ("TxPowerEnd",
87  "Maximum available transmission level (dbm).",
88  DoubleValue (16.0206),
89  MakeDoubleAccessor (&YansWifiPhy::SetTxPowerEnd,
91  MakeDoubleChecker<double> ())
92  .AddAttribute ("TxPowerStart",
93  "Minimum available transmission level (dbm).",
94  DoubleValue (16.0206),
95  MakeDoubleAccessor (&YansWifiPhy::SetTxPowerStart,
97  MakeDoubleChecker<double> ())
98  .AddAttribute ("RxNoiseFigure",
99  "Loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in the receiver."
100  " According to Wikipedia (http://en.wikipedia.org/wiki/Noise_figure), this is "
101  "\"the difference in decibels (dB) between"
102  " the noise output of the actual receiver to the noise output of an "
103  " ideal receiver with the same overall gain and bandwidth when the receivers "
104  " are connected to sources at the standard noise temperature T0 (usually 290 K)\"."
105  " For",
106  DoubleValue (7),
107  MakeDoubleAccessor (&YansWifiPhy::SetRxNoiseFigure,
109  MakeDoubleChecker<double> ())
110  .AddAttribute ("State", "The state of the PHY layer",
111  PointerValue (),
112  MakePointerAccessor (&YansWifiPhy::m_state),
113  MakePointerChecker<WifiPhyStateHelper> ())
114  .AddAttribute ("ChannelSwitchDelay",
115  "Delay between two short frames transmitted on different frequencies.",
116  TimeValue (MicroSeconds (250)),
117  MakeTimeAccessor (&YansWifiPhy::m_channelSwitchDelay),
118  MakeTimeChecker ())
119  .AddAttribute ("ChannelNumber",
120  "Channel center frequency = Channel starting frequency + 5 MHz * nch",
121  UintegerValue (1),
122  MakeUintegerAccessor (&YansWifiPhy::SetChannelNumber,
124  MakeUintegerChecker<uint16_t> ())
125  .AddAttribute ("Frequency", "The operating frequency.",
126  UintegerValue (2407),
127  MakeUintegerAccessor (&YansWifiPhy::GetFrequency,
129  MakeUintegerChecker<uint32_t> ())
130  .AddAttribute ("Transmitters", "The number of transmitters.",
131  UintegerValue (1),
132  MakeUintegerAccessor (&YansWifiPhy::GetNumberOfTransmitAntennas,
134  MakeUintegerChecker<uint32_t> ())
135  .AddAttribute ("Recievers", "The number of recievers.",
136  UintegerValue (1),
137  MakeUintegerAccessor (&YansWifiPhy::GetNumberOfReceiveAntennas,
139  MakeUintegerChecker<uint32_t> ())
140  .AddAttribute ("ShortGuardEnabled", "Whether or not short guard interval is enabled.",
141  BooleanValue (false),
142  MakeBooleanAccessor (&YansWifiPhy::GetGuardInterval,
144  MakeBooleanChecker ())
145  .AddAttribute ("LdpcEnabled", "Whether or not LDPC is enabled.",
146  BooleanValue (false),
147  MakeBooleanAccessor (&YansWifiPhy::GetLdpc,
149  MakeBooleanChecker ())
150  .AddAttribute ("STBCEnabled", "Whether or not STBC is enabled.",
151  BooleanValue (false),
152  MakeBooleanAccessor (&YansWifiPhy::GetStbc,
154  MakeBooleanChecker ())
155  .AddAttribute ("GreenfieldEnabled", "Whether or not STBC is enabled.",
156  BooleanValue (false),
157  MakeBooleanAccessor (&YansWifiPhy::GetGreenfield,
159  MakeBooleanChecker ())
160  .AddAttribute ("ChannelBonding", "Whether 20MHz or 40MHz.",
161  BooleanValue (false),
162  MakeBooleanAccessor (&YansWifiPhy::GetChannelBonding,
164  MakeBooleanChecker ())
165 
166 
167  ;
168  return tid;
169 }
170 
172  : m_channelNumber (1),
173  m_endRxEvent (),
174  m_channelStartingFrequency (0)
175 {
176  NS_LOG_FUNCTION (this);
177  m_random = CreateObject<UniformRandomVariable> ();
178  m_state = CreateObject<WifiPhyStateHelper> ();
179 }
180 
182 {
183  NS_LOG_FUNCTION (this);
184 }
185 
186 void
188 {
189  NS_LOG_FUNCTION (this);
190  m_channel = 0;
191  m_deviceRateSet.clear ();
192  m_deviceMcsSet.clear();
193  m_device = 0;
194  m_mobility = 0;
195  m_state = 0;
196 }
197 
198 void
200 {
201  NS_LOG_FUNCTION (this << standard);
202  switch (standard)
203  {
205  Configure80211a ();
206  break;
208  Configure80211b ();
209  break;
211  Configure80211g ();
212  break;
215  break;
218  break;
220  ConfigureHolland ();
221  break;
224  Configure80211n ();
225  break;
228  Configure80211n ();
229  break;
230 
231  default:
232  NS_ASSERT (false);
233  break;
234  }
235 }
236 
237 
238 void
239 YansWifiPhy::SetRxNoiseFigure (double noiseFigureDb)
240 {
241  NS_LOG_FUNCTION (this << noiseFigureDb);
242  m_interference.SetNoiseFigure (DbToRatio (noiseFigureDb));
243 }
244 void
246 {
247  NS_LOG_FUNCTION (this << start);
249 }
250 void
252 {
253  NS_LOG_FUNCTION (this << end);
254  m_txPowerEndDbm = end;
255 }
256 void
258 {
259  NS_LOG_FUNCTION (this << n);
260  m_nTxPower = n;
261 }
262 void
264 {
265  NS_LOG_FUNCTION (this << gain);
266  m_txGainDb = gain;
267 }
268 void
270 {
271  NS_LOG_FUNCTION (this << gain);
272  m_rxGainDb = gain;
273 }
274 void
275 YansWifiPhy::SetEdThreshold (double threshold)
276 {
277  NS_LOG_FUNCTION (this << threshold);
278  m_edThresholdW = DbmToW (threshold);
279 }
280 void
282 {
283  NS_LOG_FUNCTION (this << threshold);
284  m_ccaMode1ThresholdW = DbmToW (threshold);
285 }
286 void
288 {
290 }
291 void
293 {
294  m_device = device;
295 }
296 void
298 {
299  m_mobility = mobility;
300 }
301 
302 double
304 {
306 }
307 double
309 {
310  return m_txPowerBaseDbm;
311 }
312 double
314 {
315  return m_txPowerEndDbm;
316 }
317 double
319 {
320  return m_txGainDb;
321 }
322 double
324 {
325  return m_rxGainDb;
326 }
327 
328 double
330 {
331  return WToDbm (m_edThresholdW);
332 }
333 
334 double
336 {
337  return WToDbm (m_ccaMode1ThresholdW);
338 }
339 
342 {
344 }
347 {
348  return m_device;
349 }
352 {
353  return m_mobility;
354 }
355 
356 double
357 YansWifiPhy::CalculateSnr (WifiMode txMode, double ber) const
358 {
359  return m_interference.GetErrorRateModel ()->CalculateSnr (txMode, ber);
360 }
361 
364 {
365  return m_channel;
366 }
367 void
369 {
370  m_channel = channel;
371  m_channel->Add (this);
372 }
373 
374 void
376 {
377  if (Simulator::Now () == Seconds (0))
378  {
379  // this is not channel switch, this is initialization
380  NS_LOG_DEBUG ("start at channel " << nch);
381  m_channelNumber = nch;
382  return;
383  }
384 
386  switch (m_state->GetState ())
387  {
388  case YansWifiPhy::RX:
389  NS_LOG_DEBUG ("drop packet because of channel switching while reception");
390  m_endRxEvent.Cancel ();
391  goto switchChannel;
392  break;
393  case YansWifiPhy::TX:
394  NS_LOG_DEBUG ("channel switching postponed until end of current transmission");
396  break;
398  case YansWifiPhy::IDLE:
399  goto switchChannel;
400  break;
401  default:
402  NS_ASSERT (false);
403  break;
404  }
405 
406  return;
407 
408 switchChannel:
409 
410  NS_LOG_DEBUG ("switching channel " << m_channelNumber << " -> " << nch);
411  m_state->SwitchToChannelSwitching (m_channelSwitchDelay);
413  /*
414  * Needed here to be able to correctly sensed the medium for the first
415  * time after the switching. The actual switching is not performed until
416  * after m_channelSwitchDelay. Packets received during the switching
417  * state are added to the event list and are employed later to figure
418  * out the state of the medium after the switching.
419  */
420  m_channelNumber = nch;
421 }
422 
423 uint16_t
425 {
426  return m_channelNumber;
427 }
428 
429 double
431 {
433 }
434 
435 void
437 {
438  m_state->SetReceiveOkCallback (callback);
439 }
440 void
442 {
443  m_state->SetReceiveErrorCallback (callback);
444 }
445 void
447  double rxPowerDbm,
448  WifiTxVector txVector,
449  enum WifiPreamble preamble)
450 {
451  NS_LOG_FUNCTION (this << packet << rxPowerDbm << txVector.GetMode()<< preamble);
452  rxPowerDbm += m_rxGainDb;
453  double rxPowerW = DbmToW (rxPowerDbm);
454  Time rxDuration = CalculateTxDuration (packet->GetSize (), txVector, preamble);
455 WifiMode txMode=txVector.GetMode();
456  Time endRx = Simulator::Now () + rxDuration;
457 
459  event = m_interference.Add (packet->GetSize (),
460  txMode,
461  preamble,
462  rxDuration,
463  rxPowerW,
464  txVector); // we need it to calculate duration of HT training symbols
465 
466  switch (m_state->GetState ())
467  {
469  NS_LOG_DEBUG ("drop packet because of channel switching");
470  NotifyRxDrop (packet);
471  /*
472  * Packets received on the upcoming channel are added to the event list
473  * during the switching state. This way the medium can be correctly sensed
474  * when the device listens to the channel for the first time after the
475  * switching e.g. after channel switching, the channel may be sensed as
476  * busy due to other devices' tramissions started before the end of
477  * the switching.
478  */
479  if (endRx > Simulator::Now () + m_state->GetDelayUntilIdle ())
480  {
481  // that packet will be noise _after_ the completion of the
482  // channel switching.
483  goto maybeCcaBusy;
484  }
485  break;
486  case YansWifiPhy::RX:
487  NS_LOG_DEBUG ("drop packet because already in Rx (power=" <<
488  rxPowerW << "W)");
489  NotifyRxDrop (packet);
490  if (endRx > Simulator::Now () + m_state->GetDelayUntilIdle ())
491  {
492  // that packet will be noise _after_ the reception of the
493  // currently-received packet.
494  goto maybeCcaBusy;
495  }
496  break;
497  case YansWifiPhy::TX:
498  NS_LOG_DEBUG ("drop packet because already in Tx (power=" <<
499  rxPowerW << "W)");
500  NotifyRxDrop (packet);
501  if (endRx > Simulator::Now () + m_state->GetDelayUntilIdle ())
502  {
503  // that packet will be noise _after_ the transmission of the
504  // currently-transmitted packet.
505  goto maybeCcaBusy;
506  }
507  break;
509  case YansWifiPhy::IDLE:
510  if (rxPowerW > m_edThresholdW)
511  {
512  NS_LOG_DEBUG ("sync to signal (power=" << rxPowerW << "W)");
513  // sync to signal
514  m_state->SwitchToRx (rxDuration);
516  NotifyRxBegin (packet);
519  packet,
520  event);
521  }
522  else
523  {
524  NS_LOG_DEBUG ("drop packet because signal power too Small (" <<
525  rxPowerW << "<" << m_edThresholdW << ")");
526  NotifyRxDrop (packet);
527  goto maybeCcaBusy;
528  }
529  break;
530  }
531 
532  return;
533 
534 maybeCcaBusy:
535  // We are here because we have received the first bit of a packet and we are
536  // not going to be able to synchronize on it
537  // In this model, CCA becomes busy when the aggregation of all signals as
538  // tracked by the InterferenceHelper class is higher than the CcaBusyThreshold
539 
541  if (!delayUntilCcaEnd.IsZero ())
542  {
543  m_state->SwitchMaybeToCcaBusy (delayUntilCcaEnd);
544  }
545 }
546 
547 void
549 {
550  NS_LOG_FUNCTION (this << packet << txMode << preamble << (uint32_t)txVector.GetTxPowerLevel());
551  /* Transmission can happen if:
552  * - we are syncing on a packet. It is the responsability of the
553  * MAC layer to avoid doing this but the PHY does nothing to
554  * prevent it.
555  * - we are idle
556  */
557  NS_ASSERT (!m_state->IsStateTx () && !m_state->IsStateSwitching ());
558 
559  Time txDuration = CalculateTxDuration (packet->GetSize (), txVector, preamble);
560  if (m_state->IsStateRx ())
561  {
562  m_endRxEvent.Cancel ();
564  }
565  NotifyTxBegin (packet);
566  uint32_t dataRate500KbpsUnits = txVector.GetMode().GetDataRate () * txVector.GetNss() / 500000;
567  bool isShortPreamble = (WIFI_PREAMBLE_SHORT == preamble);
568  NotifyMonitorSniffTx (packet, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, txVector.GetTxPowerLevel());
569  m_state->SwitchToTx (txDuration, packet, txVector.GetMode(), preamble, txVector.GetTxPowerLevel());
570  m_channel->Send (this, packet, GetPowerDbm ( txVector.GetTxPowerLevel()) + m_txGainDb, txVector, preamble);
571 }
572 
573 uint32_t
575 {
576  return m_deviceRateSet.size ();
577 }
578 WifiMode
579 YansWifiPhy::GetMode (uint32_t mode) const
580 {
581  return m_deviceRateSet[mode];
582 }
583 uint32_t
585 {
586  return m_nTxPower;
587 }
588 
589 void
591 {
592  NS_LOG_FUNCTION (this);
593  m_channelStartingFrequency = 5e3; // 5.000 GHz
594 
603 }
604 
605 
606 void
608 {
609  NS_LOG_FUNCTION (this);
610  m_channelStartingFrequency = 2407; // 2.407 GHz
611 
616 }
617 
618 void
620 {
621  NS_LOG_FUNCTION (this);
622  m_channelStartingFrequency = 2407; // 2.407 GHz
623 
636 }
637 
638 void
640 {
641  NS_LOG_FUNCTION (this);
642  m_channelStartingFrequency = 5e3; // 5.000 GHz, suppose 802.11a
643 
652 }
653 
654 void
656 {
657  NS_LOG_FUNCTION (this);
658  m_channelStartingFrequency = 5e3; // 5.000 GHz, suppose 802.11a
659 
668 }
669 
670 void
672 {
673  NS_LOG_FUNCTION (this);
674  m_channelStartingFrequency = 5e3; // 5.000 GHz
680 }
681 
682 void
684 {
685  m_state->RegisterListener (listener);
686 }
687 
688 bool
690 {
691  return m_state->IsStateCcaBusy ();
692 }
693 
694 bool
696 {
697  return m_state->IsStateIdle ();
698 }
699 bool
701 {
702  return m_state->IsStateBusy ();
703 }
704 bool
706 {
707  return m_state->IsStateRx ();
708 }
709 bool
711 {
712  return m_state->IsStateTx ();
713 }
714 bool
716 {
717  return m_state->IsStateSwitching ();
718 }
719 
720 Time
722 {
723  return m_state->GetStateDuration ();
724 }
725 Time
727 {
728  return m_state->GetDelayUntilIdle ();
729 }
730 
731 Time
733 {
734  return m_state->GetLastRxStartTime ();
735 }
736 
737 double
738 YansWifiPhy::DbToRatio (double dB) const
739 {
740  double ratio = std::pow (10.0, dB / 10.0);
741  return ratio;
742 }
743 
744 double
745 YansWifiPhy::DbmToW (double dBm) const
746 {
747  double mW = std::pow (10.0, dBm / 10.0);
748  return mW / 1000.0;
749 }
750 
751 double
752 YansWifiPhy::WToDbm (double w) const
753 {
754  return 10.0 * std::log10 (w * 1000.0);
755 }
756 
757 double
758 YansWifiPhy::RatioToDb (double ratio) const
759 {
760  return 10.0 * std::log10 (ratio);
761 }
762 
763 double
765 {
766  return m_edThresholdW;
767 }
768 
769 double
770 YansWifiPhy::GetPowerDbm (uint8_t power) const
771 {
773  NS_ASSERT (m_nTxPower > 0);
774  double dbm;
775  if (m_nTxPower > 1)
776  {
777  dbm = m_txPowerBaseDbm + power * (m_txPowerEndDbm - m_txPowerBaseDbm) / (m_nTxPower - 1);
778  }
779  else
780  {
781  NS_ASSERT_MSG (m_txPowerBaseDbm == m_txPowerEndDbm, "cannot have TxPowerEnd != TxPowerStart with TxPowerLevels == 1");
782  dbm = m_txPowerBaseDbm;
783  }
784  return dbm;
785 }
786 
787 void
789 {
790  NS_LOG_FUNCTION (this << packet << event);
791  NS_ASSERT (IsStateRx ());
792  NS_ASSERT (event->GetEndTime () == Simulator::Now ());
793 
794  struct InterferenceHelper::SnrPer snrPer;
795  snrPer = m_interference.CalculateSnrPer (event);
797 
798  NS_LOG_DEBUG ("mode=" << (event->GetPayloadMode ().GetDataRate ()) <<
799  ", snr=" << snrPer.snr << ", per=" << snrPer.per << ", size=" << packet->GetSize ());
800  if (m_random->GetValue () > snrPer.per)
801  {
802  NotifyRxEnd (packet);
803  uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () * event->GetTxVector().GetNss()/ 500000;
804  bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());
805  double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;
806  double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;
807  NotifyMonitorSniffRx (packet, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);
808  m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetPayloadMode (), event->GetPreambleType ());
809  }
810  else
811  {
812  /* failure. */
813  NotifyRxDrop (packet);
814  m_state->SwitchFromRxEndError (packet, snrPer.snr);
815  }
816 }
817 
818 int64_t
820 {
821  NS_LOG_FUNCTION (this << stream);
822  m_random->SetStream (stream);
823  return 1;
824 }
825 
826 void
828 {
830 }
831 
832 void
834 {
836 }
837 void
839 {
840  m_numberOfReceivers = rx;
841 }
842 
843 void
845 {
846  m_ldpc = Ldpc;
847 }
848 
849 void
851 {
852  m_stbc = stbc;
853 }
854 
855 void
856 YansWifiPhy::SetGreenfield (bool greenfield)
857 {
858  m_greenfield = greenfield;
859 }
860 bool
862 {
863  return m_guardInterval;
864 }
865 void
866 YansWifiPhy::SetGuardInterval (bool guardInterval)
867 {
868  m_guardInterval = guardInterval;
869 }
870 
871 uint32_t
873 {
875 }
876 
877 uint32_t
879 {
880  return m_numberOfTransmitters;
881 }
882 uint32_t
884 {
885  return m_numberOfReceivers;
886 }
887 
888 bool
890 {
891  return m_ldpc;
892 }
893 bool
895 {
896  return m_stbc;
897 }
898 
899 bool
901 {
902  return m_greenfield;
903 }
904 
905 bool
907 {
908  return m_channelBonding;
909 }
910 
911 void
912 YansWifiPhy::SetChannelBonding(bool channelbonding)
913 {
914  m_channelBonding= channelbonding;
915 }
916 
917 void
919 {
920  NS_LOG_FUNCTION (this);
929  for (uint8_t i=0; i <8; i++)
930  {
931  m_deviceMcsSet.push_back(i);
932  }
933 
934 }
935 uint32_t
937 {
938  return m_bssMembershipSelectorSet.size ();
939 }
940 uint32_t
941 YansWifiPhy::GetBssMembershipSelector (uint32_t selector) const
942 {
943  return m_bssMembershipSelectorSet[selector];
944 }
947 {
948  uint32_t id=GetBssMembershipSelector(selector);
949  WifiModeList supportedmodes;
950  if (id == HT_PHY)
951  {
952  //mandatory MCS 0 to 7
953  supportedmodes.push_back (WifiPhy::GetOfdmRate6_5MbpsBW20MHz ());
954  supportedmodes.push_back (WifiPhy::GetOfdmRate13MbpsBW20MHz ());
955  supportedmodes.push_back (WifiPhy::GetOfdmRate19_5MbpsBW20MHz ());
956  supportedmodes.push_back (WifiPhy::GetOfdmRate26MbpsBW20MHz ());
957  supportedmodes.push_back (WifiPhy::GetOfdmRate39MbpsBW20MHz ());
958  supportedmodes.push_back (WifiPhy::GetOfdmRate52MbpsBW20MHz ());
959  supportedmodes.push_back (WifiPhy::GetOfdmRate58_5MbpsBW20MHz ());
960  supportedmodes.push_back (WifiPhy::GetOfdmRate65MbpsBW20MHz ());
961  }
962  return supportedmodes;
963 }
964 uint8_t
966 {
967  return m_deviceMcsSet.size ();
968 }
969 uint8_t
970 YansWifiPhy::GetMcs (uint8_t mcs) const
971 {
972  return m_deviceMcsSet[mcs];
973 }
974 uint32_t
976 {
977  uint32_t mcs = 0;
978  if (mode.GetUniqueName() == "OfdmRate135MbpsBW40MHzShGi" || mode.GetUniqueName() == "OfdmRate65MbpsBW20MHzShGi" )
979  {
980  mcs=6;
981  }
982  else
983  {
984  switch (mode.GetDataRate())
985  {
986  case 6500000:
987  case 7200000:
988  case 13500000:
989  case 15000000:
990  mcs=0;
991  break;
992  case 13000000:
993  case 14400000:
994  case 27000000:
995  case 30000000:
996  mcs=1;
997  break;
998  case 19500000:
999  case 21700000:
1000  case 40500000:
1001  case 45000000:
1002  mcs=2;
1003  break;
1004  case 26000000:
1005  case 28900000:
1006  case 54000000:
1007  case 60000000:
1008  mcs=3;
1009  break;
1010  case 39000000:
1011  case 43300000:
1012  case 81000000:
1013  case 90000000:
1014  mcs=4;
1015  break;
1016  case 52000000:
1017  case 57800000:
1018  case 108000000:
1019  case 120000000:
1020  mcs=5;
1021  break;
1022  case 58500000:
1023  case 121500000:
1024  mcs=6;
1025  break;
1026  case 65000000:
1027  case 72200000:
1028  case 135000000:
1029  case 150000000:
1030  mcs=7;
1031  break;
1032  }
1033  }
1034  return mcs;
1035 }
1036 WifiMode
1038 {
1039  WifiMode mode;
1040  switch (mcs)
1041  {
1042  case 7:
1043  if (!GetGuardInterval() && !GetChannelBonding())
1044  {
1046  }
1047  else if(GetGuardInterval() && !GetChannelBonding())
1048  {
1050  }
1051  else if (!GetGuardInterval() && GetChannelBonding())
1052  {
1054  }
1055  else
1056  {
1058  }
1059  break;
1060  case 6:
1061  if (!GetGuardInterval() && !GetChannelBonding())
1062  {
1064 
1065  }
1066  else if(GetGuardInterval() && !GetChannelBonding())
1067  {
1069 
1070  }
1071  else if (!GetGuardInterval() && GetChannelBonding())
1072  {
1074 
1075  }
1076  else
1077  {
1079 
1080  }
1081  break;
1082  case 5:
1083  if (!GetGuardInterval() && !GetChannelBonding())
1084  {
1086 
1087  }
1088  else if(GetGuardInterval() && !GetChannelBonding())
1089  {
1091  }
1092  else if (!GetGuardInterval() && GetChannelBonding())
1093  {
1095 
1096  }
1097  else
1098  {
1100 
1101  }
1102  break;
1103  case 4:
1104  if (!GetGuardInterval() && !GetChannelBonding())
1105  {
1107  }
1108  else if(GetGuardInterval() && !GetChannelBonding())
1109  {
1111  }
1112  else if (!GetGuardInterval() && GetChannelBonding())
1113  {
1115 
1116  }
1117  else
1118  {
1120 
1121  }
1122  break;
1123  case 3:
1124  if (!GetGuardInterval() && !GetChannelBonding())
1125  {
1127 
1128  }
1129  else if(GetGuardInterval() && !GetChannelBonding())
1130  {
1132 
1133  }
1134  else if (!GetGuardInterval() && GetChannelBonding())
1135  {
1137 
1138  }
1139  else
1140  {
1142  }
1143  break;
1144  case 2:
1145  if (!GetGuardInterval() && !GetChannelBonding())
1146  {
1148 
1149  }
1150  else if(GetGuardInterval() && !GetChannelBonding())
1151  {
1153 
1154  }
1155  else if (!GetGuardInterval() && GetChannelBonding())
1156  {
1158 
1159  }
1160  else
1161  {
1163 
1164  }
1165  break;
1166  case 1:
1167  if (!GetGuardInterval() && !GetChannelBonding())
1168  {
1170 
1171  }
1172  else if(GetGuardInterval() && !GetChannelBonding())
1173  {
1175  }
1176  else if (!GetGuardInterval() && GetChannelBonding())
1177  {
1179 
1180  }
1181  else
1182  {
1184  }
1185  break;
1186  case 0:
1187  default:
1188  if (!GetGuardInterval() && !GetChannelBonding())
1189  {
1191 
1192  }
1193  else if(GetGuardInterval() && !GetChannelBonding())
1194  {
1196  }
1197  else if (!GetGuardInterval() && GetChannelBonding())
1198  {
1200 
1201  }
1202  else
1203  {
1205  }
1206  break;
1207  }
1208  return mode;
1209 }
1210 } // namespace ns3
ERP-OFDM PHY (Clause 19, Section 19.5)
uint16_t m_channelNumber
Operating channel number.
bool m_channelBonding
Flag if channel conding is used.
static WifiMode GetOfdmRate9MbpsBW5MHz()
Return a WifiMode for ODFM at 9Mbps with 5MHz channel spacing.
Definition: wifi-phy.cc:947
static WifiMode GetErpOfdmRate24Mbps()
Return a WifiMode for ERP-ODFM at 24Mbps.
Definition: wifi-phy.cc:615
static WifiMode GetDsssRate11Mbps()
Return a WifiMode for DSSS at 11Mbps.
Definition: wifi-phy.cc:547
Ptr< Object > m_mobility
Pointer to the mobility model.
virtual bool IsStateBusy(void)
keep track of time values and allow control of global simulation resolution
Definition: nstime.h:81
static WifiMode GetErpOfdmRate36Mbps()
Return a WifiMode for ERP-ODFM at 36Mbps.
Definition: wifi-phy.cc:628
A struct for both SNR and PER.
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:59
#define NS_LOG_FUNCTION(parameters)
Definition: log.h:345
OFDM PHY for the 5 GHz band (Clause 17 with 5 MHz channel bandwidth)
void Configure80211b(void)
Configure YansWifiPhy with appropriate channel frequency and supported rates for 802.11b standard.
void SetStream(int64_t stream)
Specifies the stream number for this RNG stream.
virtual uint32_t GetFrequency(void) const
static WifiMode GetOfdmRate26MbpsBW20MHz()
Return a WifiMode for ODFM at 26Mbps with 20MHz channel spacing.
Definition: wifi-phy.cc:1065
Hold a bool native type.
Definition: boolean.h:38
virtual WifiModeList GetMembershipSelectorModes(uint32_t selector)
The WifiPhy::GetMembershipSelectorModes() method is used (e.g., by a WifiRemoteStationManager) to det...
Ptr< ErrorRateModel > GetErrorRateModel(void) const
Return the error rate model.
double DbmToW(double dbm) const
Convert from dBm to Watts.
static WifiMode GetOfdmRate9Mbps()
Return a WifiMode for ODFM at 9Mbps.
Definition: wifi-phy.cc:683
double DbToRatio(double db) const
Convert from dB to ratio.
static WifiMode GetOfdmRate7_2MbpsBW20MHz()
Return a WifiMode for ODFM at 7.2Mbps with 20MHz channel spacing.
Definition: wifi-phy.cc:1000
static WifiMode GetOfdmRate18MbpsBW10MHz()
Return a WifiMode for ODFM at 18Mbps with 10MHz channel spacing.
Definition: wifi-phy.cc:841
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
static WifiMode GetOfdmRate27MbpsBW10MHz()
Return a WifiMode for ODFM at 27Mbps with 10MHz channel spacing.
Definition: wifi-phy.cc:867
void SetErrorRateModel(Ptr< ErrorRateModel > rate)
Sets the error rate model.
virtual bool IsStateSwitching(void)
virtual bool IsStateTx(void)
static WifiMode GetOfdmRate3MbpsBW5MHz()
Return a WifiMode for ODFM at 3Mbps with 5MHz channel spacing.
Definition: wifi-phy.cc:908
static WifiMode GetDsssRate1Mbps()
Return a WifiMode for DSSS at 1Mbps.
Definition: wifi-phy.cc:505
void NotifyMonitorSniffTx(Ptr< const Packet > packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble, uint8_t txPower)
Public method used to fire a MonitorSniffer trace for a wifi packet being transmitted.
Definition: wifi-phy.cc:496
void Configure80211n(void)
Configure YansWifiPhy with appropriate channel frequency and supported rates for 802.11n standard.
Ptr< YansWifiChannel > m_channel
YansWifiChannel that this YansWifiPhy is connected to.
static WifiMode GetOfdmRate81MbpsBW40MHz()
Return a WifiMode for ODFM at 81Mbps with 40MHz channel spacing.
Definition: wifi-phy.cc:1298
void SetTxGain(double gain)
Sets the transmission gain (dB).
802.11 PHY layer model
Definition: wifi-phy.h:117
static WifiMode GetErpOfdmRate18Mbps()
Return a WifiMode for ERP-ODFM at 18Mbps.
Definition: wifi-phy.cc:602
bool IsZero(void) const
Definition: nstime.h:230
virtual void SetGuardInterval(bool guardInterval)
Enable or disable short/long guard interval.
static WifiMode GetOfdmRate12Mbps()
Return a WifiMode for ODFM at 12Mbps.
Definition: wifi-phy.cc:696
virtual void SetLdpc(bool ldpc)
Enable or disable LDPC.
#define NS_ASSERT(condition)
Definition: assert.h:64
static WifiMode GetOfdmRate43_3MbpsBW20MHz()
Return a WifiMode for ODFM at 43.3Mbps with 20MHz channel spacing.
Definition: wifi-phy.cc:1104
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
Time GetEnergyDuration(double energyW)
virtual void RegisterListener(WifiPhyListener *listener)
static WifiMode GetOfdmRate60MbpsBW40MHz()
Return a WifiMode for ODFM at 60Mbps with 40MHz channel spacing.
Definition: wifi-phy.cc:1285
static WifiMode GetOfdmRate1_5MbpsBW5MHz()
Return a WifiMode for ODFM at 1.5Mbps with 5MHz channel spacing.
Definition: wifi-phy.cc:882
uint32_t GetSize(void) const
Definition: packet.h:650
OFDM PHY for the 5 GHz band (Clause 17 with 10 MHz channel bandwidth)
double m_txPowerBaseDbm
Minimum transmission power (dBm)
static WifiMode GetOfdmRate4_5MbpsBW10MHz()
Return a WifiMode for ODFM at 4.5Mbps with 10MHz channel spacing.
Definition: wifi-phy.cc:789
static WifiMode GetOfdmRate54Mbps()
Return a WifiMode for ODFM at 54Mbps.
Definition: wifi-phy.cc:761
uint16_t GetChannelNumber() const
Return the current channel number.
void SetChannelNumber(uint16_t id)
Set the current channel number.
virtual void SendPacket(Ptr< const Packet > packet, WifiMode mode, enum WifiPreamble preamble, WifiTxVector txvector)
static WifiMode GetOfdmRate108MbpsBW40MHz()
Return a WifiMode for ODFM at 108Mbps with 40MHz channel spacing.
Definition: wifi-phy.cc:1323
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Schedule an event to expire at the relative time "time" is reached.
Definition: simulator.h:824
static WifiMode GetOfdmRate21_7MbpsBW20MHz()
Return a WifiMode for ODFM at 21.7Mbps with 20MHz channel spacing.
Definition: wifi-phy.cc:1051
void NotifyTxBegin(Ptr< const Packet > packet)
Public method used to fire a PhyTxBegin trace.
Definition: wifi-phy.cc:454
Ptr< Object > GetDevice(void) const
Return the device this PHY is associated with.
double m_edThresholdW
Energy detection threshold in watts.
void Configure80211_5Mhz()
Configure YansWifiPhy with appropriate channel frequency and supported rates for 802.11a standard with 5MHz channel spacing.
virtual Time GetDelayUntilIdle(void)
void Configure80211a(void)
Configure YansWifiPhy with appropriate channel frequency and supported rates for 802.11a standard.
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:91
void Configure80211g(void)
Configure YansWifiPhy with appropriate channel frequency and supported rates for 802.11g standard.
static WifiMode GetOfdmRate135MbpsBW40MHz()
Return a WifiMode for ODFM at 135Mbps with 40MHz channel spacing.
Definition: wifi-phy.cc:1371
static WifiMode GetOfdmRate36Mbps()
Return a WifiMode for ODFM at 36Mbps.
Definition: wifi-phy.cc:735
static WifiMode GetOfdmRate6MbpsBW5MHz()
Return a WifiMode for ODFM at 6Mbps with 5MHz channel spacing.
Definition: wifi-phy.cc:934
virtual Time GetStateDuration(void)
virtual uint32_t GetNBssMembershipSelectors(void) const
The WifiPhy::NBssMembershipSelectors() method is used (e.g., by a WifiRemoteStationManager) to determ...
double m_rxGainDb
Reception gain (dB)
uint8_t GetTxPowerLevel(void) const
double GetTxGain(void) const
Return the transmission gain (dB).
virtual bool GetChannelBonding(void) const
Return whether channel bonding is supported.
std::vector< uint32_t > m_bssMembershipSelectorSet
The PHY layer is switching to other channel.
Definition: wifi-phy.h:144
static WifiMode GetErpOfdmRate54Mbps()
Return a WifiMode for ERP-ODFM at 54Mbps.
Definition: wifi-phy.cc:654
virtual void SetReceiveErrorCallback(WifiPhy::RxErrorCallback callback)
void NotifyRxDrop(Ptr< const Packet > packet)
Public method used to fire a PhyRxDrop trace.
Definition: wifi-phy.cc:484
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
Definition: wifi-preamble.h:29
void SetErrorRateModel(Ptr< ErrorRateModel > rate)
Set the error rate model for this interference helper.
virtual uint32_t GetNModes(void) const
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
static WifiMode GetOfdmRate6_5MbpsBW20MHz()
Return a WifiMode for ODFM at 6.5Mbps with 20MHz channel spacing.
Definition: wifi-phy.cc:988
virtual bool IsStateRx(void)
virtual uint8_t GetNMcs(void) const
virtual double GetTxPowerStart(void) const
Return the minimum available transmission power level (dBm).
WifiPhyStandard
Identifies the PHY specification that a Wifi device is configured to use.
virtual WifiMode GetMode(uint32_t mode) const
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
double m_channelStartingFrequency
Standard-dependent center frequency of 0-th channel in MHz.
void SetEdThreshold(double threshold)
Sets the energy detection threshold (dBm).
static WifiMode GetOfdmRate135MbpsBW40MHzShGi()
Return a WifiMode for ODFM at 135Mbps with 40MHz channel spacing.
Definition: wifi-phy.cc:1359
bool m_ldpc
Flag if LDPC is used.
virtual uint8_t GetMcs(uint8_t mcs) const
The WifiPhy::GetMcs() method is used (e.g., by a WifiRemoteStationManager) to determine the set of tr...
hold objects of type ns3::Time
Definition: nstime.h:961
receive notifications about phy events.
Definition: wifi-phy.h:44
virtual bool GetStbc(void) const
Return whether STBC is supported.
bool m_stbc
Flag if STBC is used.
Hold an unsigned integer type.
Definition: uinteger.h:46
Ptr< Object > m_device
Pointer to the device.
WifiModeList m_deviceRateSet
This vector holds the set of transmission modes that this WifiPhy(-derived class) can support...
static WifiMode GetErpOfdmRate48Mbps()
Return a WifiMode for ERP-ODFM at 48Mbps.
Definition: wifi-phy.cc:641
double m_ccaMode1ThresholdW
Clear channel assessment (CCA) threshold in watts.
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
virtual void SetStbc(bool stbc)
Enable or disable STBC.
#define HT_PHY
Definition: yans-wifi-phy.h:43
static WifiMode GetOfdmRate12MbpsBW10MHz()
Return a WifiMode for ODFM at 12Mbps with 10MHz channel spacing.
Definition: wifi-phy.cc:828
virtual uint32_t GetBssMembershipSelector(uint32_t selector) const
The WifiPhy::BssMembershipSelector() method is used (e.g., by a WifiRemoteStationManager) to determin...
std::string GetUniqueName(void) const
Definition: wifi-mode.cc:97
double GetRxGain(void) const
Return the reception gain (dB).
Ptr< InterferenceHelper::Event > Add(uint32_t size, WifiMode payloadMode, enum WifiPreamble preamble, Time duration, double rxPower, WifiTxVector txvector)
Add the packet-related signal to interference helper.
void NotifyRxBegin(Ptr< const Packet > packet)
Public method used to fire a PhyRxBegin trace.
Definition: wifi-phy.cc:472
static WifiMode GetOfdmRate19_5MbpsBW20MHz()
Return a WifiMode for ODFM at 19.5Mbps with 20MHz channel spacing.
Definition: wifi-phy.cc:1038
static WifiMode GetOfdmRate18Mbps()
Return a WifiMode for ODFM at 18Mbps.
Definition: wifi-phy.cc:709
double GetChannelFrequencyMhz() const
Return current center channel frequency in MHz.
static WifiMode GetOfdmRate9MbpsBW10MHz()
Return a WifiMode for ODFM at 9Mbps with 10MHz channel spacing.
Definition: wifi-phy.cc:815
static WifiMode GetOfdmRate12MbpsBW5MHz()
Return a WifiMode for ODFM at 12Mbps with 5MHz channel spacing.
Definition: wifi-phy.cc:960
static WifiMode GetOfdmRate52MbpsBW20MHz()
Return a WifiMode for ODFM at 52Mbps with 20MHz channel spacing.
Definition: wifi-phy.cc:1117
double WToDbm(double w) const
Convert from Watts to dBm.
static WifiMode GetOfdmRate40_5MbpsBW40MHz()
Return a WifiMode for ODFM at 40.5Mbps with 40MHz channel spacing.
Definition: wifi-phy.cc:1247
void SetChannel(Ptr< YansWifiChannel > channel)
Set the YansWifiChannel this YansWifiPhy is to be connected to.
void SetNTxPower(uint32_t n)
Sets the number of transmission power levels available between the minimum level and the maximum leve...
virtual bool IsStateCcaBusy(void)
static WifiMode GetOfdmRate72_2MbpsBW20MHz()
Return a WifiMode for ODFM at 72.2Mbps with 20MHz channel spacing.
Definition: wifi-phy.cc:1183
static WifiMode GetOfdmRate65MbpsBW20MHzShGi()
Return a WifiMode for ODFM at 65Mbps with 20MHz channel spacing.
Definition: wifi-phy.cc:1157
virtual ~YansWifiPhy()
void SetDevice(Ptr< Object > device)
Sets the device this PHY is associated with.
struct InterferenceHelper::SnrPer CalculateSnrPer(Ptr< InterferenceHelper::Event > event)
Calculate the SNIR at the start of the packet and accumulate all SNIR changes in the snir vector...
This is intended to be the configuration used in this paper: Gavin Holland, Nitin Vaidya and Paramvir...
static WifiMode GetOfdmRate48Mbps()
Return a WifiMode for ODFM at 48Mbps.
Definition: wifi-phy.cc:748
void NotifyMonitorSniffRx(Ptr< const Packet > packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble, double signalDbm, double noiseDbm)
Public method used to fire a MonitorSniffer trace for a wifi packet being received.
Definition: wifi-phy.cc:490
double m_txPowerEndDbm
Maximum transmission power (dBm)
virtual void SetReceiveOkCallback(WifiPhy::RxOkCallback callback)
The PHY layer is IDLE.
Definition: wifi-phy.h:128
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
double GetCcaMode1Threshold(void) const
Return the CCA threshold (dBm).
OFDM PHY for the 5 GHz band (Clause 17)
void NotifyRxStart()
Notify that RX has started.
hold objects of type Ptr
Definition: pointer.h:33
static WifiMode GetOfdmRate57_8MbpsBW20MHz()
Return a WifiMode for ODFM at 57.8Mbps with 20MHz channel spacing.
Definition: wifi-phy.cc:1130
void EraseEvents(void)
Erase all events.
static WifiMode GetOfdmRate24Mbps()
Return a WifiMode for ODFM at 24Mbps.
Definition: wifi-phy.cc:722
double GetEdThreshold(void) const
Return the energy detection threshold (dBm).
static TypeId GetTypeId(void)
static WifiMode GetOfdmRate13MbpsBW20MHz()
Return a WifiMode for ODFM at 13Mbps with 20MHz channel spacing.
Definition: wifi-phy.cc:1013
DSSS PHY (Clause 15) and HR/DSSS PHY (Clause 18)
virtual uint32_t GetNumberOfTransmitAntennas(void) const
virtual uint32_t WifiModeToMcs(WifiMode mode)
For a given WifiMode finds the corresponding MCS value and returns it as defined in the IEEE 802...
static WifiMode GetOfdmRate65MbpsBW20MHz()
Return a WifiMode for ODFM at 65Mbps with 20MHz channel spacing.
Definition: wifi-phy.cc:1170
double GetValue(double min, double max)
Returns a random double from the uniform distribution with the specified range.
virtual uint32_t GetNumberOfReceiveAntennas(void) const
static WifiMode GetOfdmRate58_5MbpsBW20MHz()
Return a WifiMode for ODFM at 58.5Mbps with 20MHz channel spacing.
Definition: wifi-phy.cc:1144
uint32_t m_nTxPower
Number of available transmission power levels.
void SetRxGain(double gain)
Sets the reception gain (dB).
static WifiMode GetDsssRate5_5Mbps()
Return a WifiMode for DSSS at 5.5Mbps.
Definition: wifi-phy.cc:534
static WifiMode GetOfdmRate2_25MbpsBW5MHz()
Return a WifiMode for ODFM at 2.25Mbps with 5MHz channel spacing.
Definition: wifi-phy.cc:895
std::vector< WifiMode > WifiModeList
In various parts of the code, folk are interested in maintaining a list of transmission modes...
Definition: wifi-mode.h:188
static Time Now(void)
Return the "current simulation time".
Definition: simulator.cc:180
static WifiMode GetErpOfdmRate9Mbps()
Return a WifiMode for ERP-ODFM at 9Mbps.
Definition: wifi-phy.cc:576
virtual WifiMode McsToWifiMode(uint8_t mcs)
For a given MCS finds the corresponding WifiMode and returns it as defined in the IEEE 802...
void SetTxPowerStart(double start)
Sets the minimum available transmission power level (dBm).
double RatioToDb(double ratio) const
Convert from ratio to dB.
virtual void SetNumberOfTransmitAntennas(uint32_t tx)
static WifiMode GetOfdmRate15MbpsBW40MHz()
Return a WifiMode for ODFM at 15Mbps with 40MHz channel spacing.
Definition: wifi-phy.cc:1209
static WifiMode GetOfdmRate121_5MbpsBW40MHz()
Return a WifiMode for ODFM at 121.5Mbps with 40MHz channel spacing.
Definition: wifi-phy.cc:1347
#define NS_ASSERT_MSG(condition, message)
Definition: assert.h:86
static WifiMode GetOfdmRate28_9MbpsBW20MHz()
Return a WifiMode for ODFM at 28.9Mbps with 20MHz channel spacing.
Definition: wifi-phy.cc:1078
virtual bool IsStateIdle(void)
void StartReceivePacket(Ptr< Packet > packet, double rxPowerDbm, WifiTxVector txVector, WifiPreamble preamble)
Starting receiving the packet (i.e.
virtual Time GetLastRxStartTime(void) const
Return the start time of the last received packet.
virtual double CalculateSnr(WifiMode txMode, double ber) const
virtual bool GetGreenfield(void) const
Return whether Greenfield is supported.
static WifiMode GetErpOfdmRate6Mbps()
Return a WifiMode for ERP-ODFM at 6Mbps.
Definition: wifi-phy.cc:563
Ptr< UniformRandomVariable > m_random
Provides uniform random variables.
static Time CalculateTxDuration(uint32_t size, WifiTxVector txvector, enum WifiPreamble preamble)
Definition: wifi-phy.cc:440
uint8_t GetNss(void) const
InterferenceHelper m_interference
Pointer to InterferenceHelper.
static WifiMode GetErpOfdmRate12Mbps()
Return a WifiMode for ERP-ODFM at 12Mbps.
Definition: wifi-phy.cc:589
virtual bool GetGuardInterval(void) const
Return whether guard interval is being used.
void NotifyRxEnd(Ptr< const Packet > packet)
Public method used to fire a PhyRxEnd trace.
Definition: wifi-phy.cc:478
void SetMobility(Ptr< Object > mobility)
Sets the mobility model.
void NotifyRxEnd()
Notify that RX has ended.
void SetNoiseFigure(double value)
Set the noise figure.
Time m_channelSwitchDelay
Time required to switch between channel.
virtual void ConfigureStandard(enum WifiPhyStandard standard)
Configure the PHY-level parameters for different Wi-Fi standard.
static WifiMode GetOfdmRate13_5MbpsBW40MHz()
Return a WifiMode for ODFM at 13.5Mbps with 40MHz channel spacing.
Definition: wifi-phy.cc:1196
static WifiMode GetOfdmRate30MbpsBW40MHz()
Return a WifiMode for ODFM at 30Mbps with 40MHz channel spacing.
Definition: wifi-phy.cc:1234
#define NS_LOG_DEBUG(msg)
Definition: log.h:289
static WifiMode GetOfdmRate54MbpsBW40MHz()
Return a WifiMode for ODFM at 54Mbps with 40MHz channel spacing.
Definition: wifi-phy.cc:1272
virtual bool GetLdpc(void) const
Return if LDPC is supported.
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::cancel method.
Definition: event-id.cc:47
std::vector< uint8_t > m_deviceMcsSet
double m_txGainDb
Transmission gain (dB)
bool m_greenfield
Flag if GreenField format is supported.
double GetPowerDbm(uint8_t power) const
Get the power of the given power level in dBm.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Definition: time.cc:452
bool m_guardInterval
Flag if short guard interval is used.
void EndReceive(Ptr< Packet > packet, Ptr< InterferenceHelper::Event > event)
The last bit of the packet has arrived.
static WifiMode GetOfdmRate90MbpsBW40MHz()
Return a WifiMode for ODFM at 90Mbps with 40MHz channel spacing.
Definition: wifi-phy.cc:1310
virtual void SetNumberOfReceiveAntennas(uint32_t rx)
static WifiMode GetOfdmRate45MbpsBW40MHz()
Return a WifiMode for ODFM at 45Mbps with 40MHz channel spacing.
Definition: wifi-phy.cc:1259
uint32_t m_numberOfTransmitters
Number of transmitters.
static WifiMode GetOfdmRate120MbpsBW40MHz()
Return a WifiMode for ODFM at 120Mbps with 40MHz channel spacing.
Definition: wifi-phy.cc:1335
double GetEdThresholdW(void) const
Return the energy detection threshold.
static WifiMode GetOfdmRate39MbpsBW20MHz()
Return a WifiMode for ODFM at 39Mbps with 20MHz channel spacing.
Definition: wifi-phy.cc:1091
virtual Ptr< WifiChannel > GetChannel(void) const
Return the WifiChannel this WifiPhy is connected to.
static WifiMode GetDsssRate2Mbps()
Return a WifiMode for DSSS at 2Mbps.
Definition: wifi-phy.cc:518
void SetCcaMode1Threshold(double threshold)
Sets the CCA threshold (dBm).
static WifiMode GetOfdmRate6MbpsBW10MHz()
Return a WifiMode for ODFM at 6Mbps with 10MHz channel spacing.
Definition: wifi-phy.cc:802
WifiMode GetMode(void) const
The PHY layer is receiving a packet.
Definition: wifi-phy.h:140
void ConfigureHolland(void)
double GetNoiseFigure(void) const
Return the noise figure.
void SetTxPowerEnd(double end)
Sets the maximum available transmission power level (dBm).
Hold a floating point type.
Definition: double.h:41
double GetRxNoiseFigure(void) const
Return the RX noise figure (dBm).
static WifiMode GetOfdmRate24MbpsBW10MHz()
Return a WifiMode for ODFM at 24Mbps with 10MHz channel spacing.
Definition: wifi-phy.cc:854
The PHY layer has sense the medium busy through the CCA mechanism.
Definition: wifi-phy.h:132
static WifiMode GetOfdmRate13_5MbpsBW5MHz()
Return a WifiMode for ODFM at 13.5Mbps with 5MHz channel spacing.
Definition: wifi-phy.cc:973
virtual double GetTxPowerEnd(void) const
Return the maximum available transmission power level (dBm).
bool IsExpired(void) const
This method is syntactic sugar for the ns3::Simulator::isExpired method.
Definition: event-id.cc:53
a unique identifier for an interface.
Definition: type-id.h:49
uint32_t m_numberOfReceivers
Number of receivers.
The PHY layer is sending a packet.
Definition: wifi-phy.h:136
uint64_t GetDataRate(void) const
Definition: wifi-mode.cc:79
virtual void SetChannelBonding(bool channelbonding)
Enable or disable channel bonding support.
TypeId SetParent(TypeId tid)
Definition: type-id.cc:611
static WifiMode GetOfdmRate6Mbps()
Return a WifiMode for ODFM at 6Mbps.
Definition: wifi-phy.cc:670
static WifiMode GetOfdmRate27MbpsBW40MHz()
Return a WifiMode for ODFM at 27Mbps with 40MHz channel spacing.
Definition: wifi-phy.cc:1222
virtual void SetFrequency(uint32_t freq)
static WifiMode GetOfdmRate4_5MbpsBW5MHz()
Return a WifiMode for ODFM at 4.5Mbps with 5MHz channel spacing.
Definition: wifi-phy.cc:921
static WifiMode GetOfdmRate14_4MbpsBW20MHz()
Return a WifiMode for ODFM at 14.4Mbps with 20MHz channel spacing.
Definition: wifi-phy.cc:1026
void Configure80211_10Mhz(void)
Configure YansWifiPhy with appropriate channel frequency and supported rates for 802.11a standard with 10MHz channel spacing.
virtual uint32_t GetNTxPower(void) const
Return the number of available transmission power levels.
void SetRxNoiseFigure(double noiseFigureDb)
Sets the RX loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in the receiver.
static WifiMode GetOfdmRate3MbpsBW10MHz()
Return a WifiMode for ODFM at 3Mbps with 10MHz channel spacing.
Definition: wifi-phy.cc:776
Ptr< ErrorRateModel > GetErrorRateModel(void) const
Return the error rate model this PHY is using.
Ptr< Object > GetMobility(void)
Return the mobility model this PHY is associated with.
Ptr< WifiPhyStateHelper > m_state
Pointer to WifiPhyStateHelper.
NS_LOG_COMPONENT_DEFINE("YansWifiPhy")
static WifiMode GetOfdmRate150MbpsBW40MHz()
Return a WifiMode for ODFM at 150Mbps with 40MHz channel spacing.
Definition: wifi-phy.cc:1384
virtual void SetGreenfield(bool greenfield)
Enable or disable Greenfield support.