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 TypeId
49 {
50  static TypeId tid = TypeId ("ns3::YansWifiPhy")
51  .SetParent<WifiPhy> ()
52  .AddConstructor<YansWifiPhy> ()
53  .AddAttribute ("EnergyDetectionThreshold",
54  "The energy of a received signal should be higher than "
55  "this threshold (dbm) to allow the PHY layer to detect the signal.",
56  DoubleValue (-96.0),
57  MakeDoubleAccessor (&YansWifiPhy::SetEdThreshold,
59  MakeDoubleChecker<double> ())
60  .AddAttribute ("CcaMode1Threshold",
61  "The energy of a received signal should be higher than "
62  "this threshold (dbm) to allow the PHY layer to declare CCA BUSY state",
63  DoubleValue (-99.0),
64  MakeDoubleAccessor (&YansWifiPhy::SetCcaMode1Threshold,
66  MakeDoubleChecker<double> ())
67  .AddAttribute ("TxGain",
68  "Transmission gain (dB).",
69  DoubleValue (1.0),
70  MakeDoubleAccessor (&YansWifiPhy::SetTxGain,
72  MakeDoubleChecker<double> ())
73  .AddAttribute ("RxGain",
74  "Reception gain (dB).",
75  DoubleValue (1.0),
76  MakeDoubleAccessor (&YansWifiPhy::SetRxGain,
78  MakeDoubleChecker<double> ())
79  .AddAttribute ("TxPowerLevels",
80  "Number of transmission power levels available between "
81  "TxPowerStart and TxPowerEnd included.",
82  UintegerValue (1),
83  MakeUintegerAccessor (&YansWifiPhy::m_nTxPower),
84  MakeUintegerChecker<uint32_t> ())
85  .AddAttribute ("TxPowerEnd",
86  "Maximum available transmission level (dbm).",
87  DoubleValue (16.0206),
88  MakeDoubleAccessor (&YansWifiPhy::SetTxPowerEnd,
90  MakeDoubleChecker<double> ())
91  .AddAttribute ("TxPowerStart",
92  "Minimum available transmission level (dbm).",
93  DoubleValue (16.0206),
94  MakeDoubleAccessor (&YansWifiPhy::SetTxPowerStart,
96  MakeDoubleChecker<double> ())
97  .AddAttribute ("RxNoiseFigure",
98  "Loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in the receiver."
99  " According to Wikipedia (http://en.wikipedia.org/wiki/Noise_figure), this is "
100  "\"the difference in decibels (dB) between"
101  " the noise output of the actual receiver to the noise output of an "
102  " ideal receiver with the same overall gain and bandwidth when the receivers "
103  " are connected to sources at the standard noise temperature T0 (usually 290 K)\"."
104  " For",
105  DoubleValue (7),
106  MakeDoubleAccessor (&YansWifiPhy::SetRxNoiseFigure,
108  MakeDoubleChecker<double> ())
109  .AddAttribute ("State", "The state of the PHY layer",
110  PointerValue (),
111  MakePointerAccessor (&YansWifiPhy::m_state),
112  MakePointerChecker<WifiPhyStateHelper> ())
113  .AddAttribute ("ChannelSwitchDelay",
114  "Delay between two short frames transmitted on different frequencies.",
115  TimeValue (MicroSeconds (250)),
116  MakeTimeAccessor (&YansWifiPhy::m_channelSwitchDelay),
117  MakeTimeChecker ())
118  .AddAttribute ("ChannelNumber",
119  "Channel center frequency = Channel starting frequency + 5 MHz * nch",
120  UintegerValue (1),
121  MakeUintegerAccessor (&YansWifiPhy::SetChannelNumber,
123  MakeUintegerChecker<uint16_t> ())
124  .AddAttribute ("Frequency", "The operating frequency.",
125  UintegerValue (2407),
126  MakeUintegerAccessor (&YansWifiPhy::GetFrequency,
128  MakeUintegerChecker<uint32_t> ())
129  .AddAttribute ("Transmitters", "The number of transmitters.",
130  UintegerValue (1),
131  MakeUintegerAccessor (&YansWifiPhy::GetNumberOfTransmitAntennas,
133  MakeUintegerChecker<uint32_t> ())
134  .AddAttribute ("Recievers", "The number of recievers.",
135  UintegerValue (1),
136  MakeUintegerAccessor (&YansWifiPhy::GetNumberOfReceiveAntennas,
138  MakeUintegerChecker<uint32_t> ())
139  .AddAttribute ("ShortGuardEnabled", "Whether or not short guard interval is enabled.",
140  BooleanValue (false),
141  MakeBooleanAccessor (&YansWifiPhy::GetGuardInterval,
143  MakeBooleanChecker ())
144  .AddAttribute ("LdpcEnabled", "Whether or not LDPC is enabled.",
145  BooleanValue (false),
146  MakeBooleanAccessor (&YansWifiPhy::GetLdpc,
148  MakeBooleanChecker ())
149  .AddAttribute ("STBCEnabled", "Whether or not STBC is enabled.",
150  BooleanValue (false),
151  MakeBooleanAccessor (&YansWifiPhy::GetStbc,
153  MakeBooleanChecker ())
154  .AddAttribute ("GreenfieldEnabled", "Whether or not STBC is enabled.",
155  BooleanValue (false),
156  MakeBooleanAccessor (&YansWifiPhy::GetGreenfield,
158  MakeBooleanChecker ())
159  .AddAttribute ("ChannelBonding", "Whether 20MHz or 40MHz.",
160  BooleanValue (false),
161  MakeBooleanAccessor (&YansWifiPhy::GetChannelBonding,
163  MakeBooleanChecker ())
164 
165 
166  ;
167  return tid;
168 }
169 
171  : m_channelNumber (1),
172  m_endRxEvent (),
173  m_channelStartingFrequency (0)
174 {
175  NS_LOG_FUNCTION (this);
176  m_random = CreateObject<UniformRandomVariable> ();
177  m_state = CreateObject<WifiPhyStateHelper> ();
178 }
179 
181 {
182  NS_LOG_FUNCTION (this);
183 }
184 
185 void
187 {
188  NS_LOG_FUNCTION (this);
189  m_channel = 0;
190  m_deviceRateSet.clear ();
191  m_deviceMcsSet.clear();
192  m_device = 0;
193  m_mobility = 0;
194  m_state = 0;
195 }
196 
197 void
199 {
200  NS_LOG_FUNCTION (this << standard);
201  switch (standard)
202  {
204  Configure80211a ();
205  break;
207  Configure80211b ();
208  break;
210  Configure80211g ();
211  break;
214  break;
217  break;
219  ConfigureHolland ();
220  break;
223  Configure80211n ();
224  break;
227  Configure80211n ();
228  break;
229 
230  default:
231  NS_ASSERT (false);
232  break;
233  }
234 }
235 
236 
237 void
238 YansWifiPhy::SetRxNoiseFigure (double noiseFigureDb)
239 {
240  NS_LOG_FUNCTION (this << noiseFigureDb);
241  m_interference.SetNoiseFigure (DbToRatio (noiseFigureDb));
242 }
243 void
245 {
246  NS_LOG_FUNCTION (this << start);
248 }
249 void
251 {
252  NS_LOG_FUNCTION (this << end);
253  m_txPowerEndDbm = end;
254 }
255 void
257 {
258  NS_LOG_FUNCTION (this << n);
259  m_nTxPower = n;
260 }
261 void
263 {
264  NS_LOG_FUNCTION (this << gain);
265  m_txGainDb = gain;
266 }
267 void
269 {
270  NS_LOG_FUNCTION (this << gain);
271  m_rxGainDb = gain;
272 }
273 void
274 YansWifiPhy::SetEdThreshold (double threshold)
275 {
276  NS_LOG_FUNCTION (this << threshold);
277  m_edThresholdW = DbmToW (threshold);
278 }
279 void
281 {
282  NS_LOG_FUNCTION (this << threshold);
283  m_ccaMode1ThresholdW = DbmToW (threshold);
284 }
285 void
287 {
289 }
290 void
292 {
293  m_device = device;
294 }
295 void
297 {
298  m_mobility = mobility;
299 }
300 
301 double
303 {
305 }
306 double
308 {
309  return m_txPowerBaseDbm;
310 }
311 double
313 {
314  return m_txPowerEndDbm;
315 }
316 double
318 {
319  return m_txGainDb;
320 }
321 double
323 {
324  return m_rxGainDb;
325 }
326 
327 double
329 {
330  return WToDbm (m_edThresholdW);
331 }
332 
333 double
335 {
336  return WToDbm (m_ccaMode1ThresholdW);
337 }
338 
341 {
343 }
346 {
347  return m_device;
348 }
351 {
352  return m_mobility;
353 }
354 
355 double
356 YansWifiPhy::CalculateSnr (WifiMode txMode, double ber) const
357 {
358  return m_interference.GetErrorRateModel ()->CalculateSnr (txMode, ber);
359 }
360 
363 {
364  return m_channel;
365 }
366 void
368 {
369  m_channel = channel;
370  m_channel->Add (this);
371 }
372 
373 void
375 {
376  if (Simulator::Now () == Seconds (0))
377  {
378  // this is not channel switch, this is initialization
379  NS_LOG_DEBUG ("start at channel " << nch);
380  m_channelNumber = nch;
381  return;
382  }
383 
385  switch (m_state->GetState ())
386  {
387  case YansWifiPhy::RX:
388  NS_LOG_DEBUG ("drop packet because of channel switching while reception");
389  m_endRxEvent.Cancel ();
390  goto switchChannel;
391  break;
392  case YansWifiPhy::TX:
393  NS_LOG_DEBUG ("channel switching postponed until end of current transmission");
395  break;
397  case YansWifiPhy::IDLE:
398  goto switchChannel;
399  break;
400  default:
401  NS_ASSERT (false);
402  break;
403  }
404 
405  return;
406 
407 switchChannel:
408 
409  NS_LOG_DEBUG ("switching channel " << m_channelNumber << " -> " << nch);
410  m_state->SwitchToChannelSwitching (m_channelSwitchDelay);
412  /*
413  * Needed here to be able to correctly sensed the medium for the first
414  * time after the switching. The actual switching is not performed until
415  * after m_channelSwitchDelay. Packets received during the switching
416  * state are added to the event list and are employed later to figure
417  * out the state of the medium after the switching.
418  */
419  m_channelNumber = nch;
420 }
421 
422 uint16_t
424 {
425  return m_channelNumber;
426 }
427 
428 double
430 {
432 }
433 
434 void
436 {
437  m_state->SetReceiveOkCallback (callback);
438 }
439 void
441 {
442  m_state->SetReceiveErrorCallback (callback);
443 }
444 void
446  double rxPowerDbm,
447  WifiTxVector txVector,
448  enum WifiPreamble preamble)
449 {
450  NS_LOG_FUNCTION (this << packet << rxPowerDbm << txVector.GetMode()<< preamble);
451  rxPowerDbm += m_rxGainDb;
452  double rxPowerW = DbmToW (rxPowerDbm);
453  Time rxDuration = CalculateTxDuration (packet->GetSize (), txVector, preamble);
454  WifiMode txMode = txVector.GetMode();
455  Time endRx = Simulator::Now () + rxDuration;
456 
458  event = m_interference.Add (packet->GetSize (),
459  txMode,
460  preamble,
461  rxDuration,
462  rxPowerW,
463  txVector); // we need it to calculate duration of HT training symbols
464 
465  switch (m_state->GetState ())
466  {
468  NS_LOG_DEBUG ("drop packet because of channel switching");
469  NotifyRxDrop (packet);
470  /*
471  * Packets received on the upcoming channel are added to the event list
472  * during the switching state. This way the medium can be correctly sensed
473  * when the device listens to the channel for the first time after the
474  * switching e.g. after channel switching, the channel may be sensed as
475  * busy due to other devices' tramissions started before the end of
476  * the switching.
477  */
478  if (endRx > Simulator::Now () + m_state->GetDelayUntilIdle ())
479  {
480  // that packet will be noise _after_ the completion of the
481  // channel switching.
482  goto maybeCcaBusy;
483  }
484  break;
485  case YansWifiPhy::RX:
486  NS_LOG_DEBUG ("drop packet because already in Rx (power=" <<
487  rxPowerW << "W)");
488  NotifyRxDrop (packet);
489  if (endRx > Simulator::Now () + m_state->GetDelayUntilIdle ())
490  {
491  // that packet will be noise _after_ the reception of the
492  // currently-received packet.
493  goto maybeCcaBusy;
494  }
495  break;
496  case YansWifiPhy::TX:
497  NS_LOG_DEBUG ("drop packet because already in Tx (power=" <<
498  rxPowerW << "W)");
499  NotifyRxDrop (packet);
500  if (endRx > Simulator::Now () + m_state->GetDelayUntilIdle ())
501  {
502  // that packet will be noise _after_ the transmission of the
503  // currently-transmitted packet.
504  goto maybeCcaBusy;
505  }
506  break;
508  case YansWifiPhy::IDLE:
509  if (rxPowerW > m_edThresholdW)
510  {
511  if (IsModeSupported (txMode) || IsMcsSupported(txMode))
512  {
513  NS_LOG_DEBUG ("sync to signal (power=" << rxPowerW << "W)");
514  // sync to signal
515  m_state->SwitchToRx (rxDuration);
517  NotifyRxBegin (packet);
520  packet,
521  event);
522  }
523  else
524  {
525  NS_LOG_DEBUG ("drop packet because it was sent using an unsupported mode (" << txMode << ")");
526  NotifyRxDrop (packet);
527  goto maybeCcaBusy;
528  }
529  }
530  else
531  {
532  NS_LOG_DEBUG ("drop packet because signal power too Small (" <<
533  rxPowerW << "<" << m_edThresholdW << ")");
534  NotifyRxDrop (packet);
535  goto maybeCcaBusy;
536  }
537  break;
538  }
539 
540  return;
541 
542 maybeCcaBusy:
543  // We are here because we have received the first bit of a packet and we are
544  // not going to be able to synchronize on it
545  // In this model, CCA becomes busy when the aggregation of all signals as
546  // tracked by the InterferenceHelper class is higher than the CcaBusyThreshold
547 
549  if (!delayUntilCcaEnd.IsZero ())
550  {
551  m_state->SwitchMaybeToCcaBusy (delayUntilCcaEnd);
552  }
553 }
554 
555 void
557 {
558  NS_LOG_FUNCTION (this << packet << txMode << preamble << (uint32_t)txVector.GetTxPowerLevel());
559  /* Transmission can happen if:
560  * - we are syncing on a packet. It is the responsability of the
561  * MAC layer to avoid doing this but the PHY does nothing to
562  * prevent it.
563  * - we are idle
564  */
565  NS_ASSERT (!m_state->IsStateTx () && !m_state->IsStateSwitching ());
566 
567  Time txDuration = CalculateTxDuration (packet->GetSize (), txVector, preamble);
568  if (m_state->IsStateRx ())
569  {
570  m_endRxEvent.Cancel ();
572  }
573  NotifyTxBegin (packet);
574  uint32_t dataRate500KbpsUnits = txVector.GetMode().GetDataRate () * txVector.GetNss() / 500000;
575  bool isShortPreamble = (WIFI_PREAMBLE_SHORT == preamble);
576  NotifyMonitorSniffTx (packet, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, txVector.GetTxPowerLevel());
577  m_state->SwitchToTx (txDuration, packet, txVector.GetMode(), preamble, txVector.GetTxPowerLevel());
578  m_channel->Send (this, packet, GetPowerDbm ( txVector.GetTxPowerLevel()) + m_txGainDb, txVector, preamble);
579 }
580 
581 uint32_t
583 {
584  return m_deviceRateSet.size ();
585 }
586 WifiMode
587 YansWifiPhy::GetMode (uint32_t mode) const
588 {
589  return m_deviceRateSet[mode];
590 }
591 bool
593 {
594  for (uint32_t i = 0; i < GetNModes (); i++)
595  {
596  if (mode == GetMode (i))
597  {
598  return true;
599  }
600  }
601  return false;
602 }
603 bool
605 {
606  for (uint32_t i = 0; i < GetNMcs (); i++)
607  {
608  if (mode == McsToWifiMode(GetMcs (i)))
609  {
610  return true;
611  }
612  }
613  return false;
614 }
615 uint32_t
617 {
618  return m_nTxPower;
619 }
620 
621 void
623 {
624  NS_LOG_FUNCTION (this);
625  m_channelStartingFrequency = 5e3; // 5.000 GHz
626 
635 }
636 
637 
638 void
640 {
641  NS_LOG_FUNCTION (this);
642  m_channelStartingFrequency = 2407; // 2.407 GHz
643 
648 }
649 
650 void
652 {
653  NS_LOG_FUNCTION (this);
654  m_channelStartingFrequency = 2407; // 2.407 GHz
655 
668 }
669 
670 void
672 {
673  NS_LOG_FUNCTION (this);
674  m_channelStartingFrequency = 5e3; // 5.000 GHz, suppose 802.11a
675 
684 }
685 
686 void
688 {
689  NS_LOG_FUNCTION (this);
690  m_channelStartingFrequency = 5e3; // 5.000 GHz, suppose 802.11a
691 
700 }
701 
702 void
704 {
705  NS_LOG_FUNCTION (this);
706  m_channelStartingFrequency = 5e3; // 5.000 GHz
712 }
713 
714 void
716 {
717  m_state->RegisterListener (listener);
718 }
719 
720 bool
722 {
723  return m_state->IsStateCcaBusy ();
724 }
725 
726 bool
728 {
729  return m_state->IsStateIdle ();
730 }
731 bool
733 {
734  return m_state->IsStateBusy ();
735 }
736 bool
738 {
739  return m_state->IsStateRx ();
740 }
741 bool
743 {
744  return m_state->IsStateTx ();
745 }
746 bool
748 {
749  return m_state->IsStateSwitching ();
750 }
751 
752 Time
754 {
755  return m_state->GetStateDuration ();
756 }
757 Time
759 {
760  return m_state->GetDelayUntilIdle ();
761 }
762 
763 Time
765 {
766  return m_state->GetLastRxStartTime ();
767 }
768 
769 double
770 YansWifiPhy::DbToRatio (double dB) const
771 {
772  double ratio = std::pow (10.0, dB / 10.0);
773  return ratio;
774 }
775 
776 double
777 YansWifiPhy::DbmToW (double dBm) const
778 {
779  double mW = std::pow (10.0, dBm / 10.0);
780  return mW / 1000.0;
781 }
782 
783 double
784 YansWifiPhy::WToDbm (double w) const
785 {
786  return 10.0 * std::log10 (w * 1000.0);
787 }
788 
789 double
790 YansWifiPhy::RatioToDb (double ratio) const
791 {
792  return 10.0 * std::log10 (ratio);
793 }
794 
795 double
797 {
798  return m_edThresholdW;
799 }
800 
801 double
802 YansWifiPhy::GetPowerDbm (uint8_t power) const
803 {
805  NS_ASSERT (m_nTxPower > 0);
806  double dbm;
807  if (m_nTxPower > 1)
808  {
809  dbm = m_txPowerBaseDbm + power * (m_txPowerEndDbm - m_txPowerBaseDbm) / (m_nTxPower - 1);
810  }
811  else
812  {
813  NS_ASSERT_MSG (m_txPowerBaseDbm == m_txPowerEndDbm, "cannot have TxPowerEnd != TxPowerStart with TxPowerLevels == 1");
814  dbm = m_txPowerBaseDbm;
815  }
816  return dbm;
817 }
818 
819 void
821 {
822  NS_LOG_FUNCTION (this << packet << event);
823  NS_ASSERT (IsStateRx ());
824  NS_ASSERT (event->GetEndTime () == Simulator::Now ());
825 
826  struct InterferenceHelper::SnrPer snrPer;
827  snrPer = m_interference.CalculateSnrPer (event);
829 
830  NS_LOG_DEBUG ("mode=" << (event->GetPayloadMode ().GetDataRate ()) <<
831  ", snr=" << snrPer.snr << ", per=" << snrPer.per << ", size=" << packet->GetSize ());
832  if (m_random->GetValue () > snrPer.per)
833  {
834  NotifyRxEnd (packet);
835  uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () * event->GetTxVector().GetNss()/ 500000;
836  bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());
837  double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;
838  double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;
839  NotifyMonitorSniffRx (packet, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);
840  m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetPayloadMode (), event->GetPreambleType ());
841  }
842  else
843  {
844  /* failure. */
845  NotifyRxDrop (packet);
846  m_state->SwitchFromRxEndError (packet, snrPer.snr);
847  }
848 }
849 
850 int64_t
852 {
853  NS_LOG_FUNCTION (this << stream);
854  m_random->SetStream (stream);
855  return 1;
856 }
857 
858 void
860 {
862 }
863 
864 void
866 {
868 }
869 void
871 {
872  m_numberOfReceivers = rx;
873 }
874 
875 void
877 {
878  m_ldpc = Ldpc;
879 }
880 
881 void
883 {
884  m_stbc = stbc;
885 }
886 
887 void
888 YansWifiPhy::SetGreenfield (bool greenfield)
889 {
890  m_greenfield = greenfield;
891 }
892 bool
894 {
895  return m_guardInterval;
896 }
897 void
898 YansWifiPhy::SetGuardInterval (bool guardInterval)
899 {
900  m_guardInterval = guardInterval;
901 }
902 
903 uint32_t
905 {
907 }
908 
909 uint32_t
911 {
912  return m_numberOfTransmitters;
913 }
914 uint32_t
916 {
917  return m_numberOfReceivers;
918 }
919 
920 bool
922 {
923  return m_ldpc;
924 }
925 bool
927 {
928  return m_stbc;
929 }
930 
931 bool
933 {
934  return m_greenfield;
935 }
936 
937 bool
939 {
940  return m_channelBonding;
941 }
942 
943 void
944 YansWifiPhy::SetChannelBonding(bool channelbonding)
945 {
946  m_channelBonding= channelbonding;
947 }
948 
949 void
951 {
952  NS_LOG_FUNCTION (this);
961  for (uint8_t i=0; i <8; i++)
962  {
963  m_deviceMcsSet.push_back(i);
964  }
965 
966 }
967 uint32_t
969 {
970  return m_bssMembershipSelectorSet.size ();
971 }
972 uint32_t
973 YansWifiPhy::GetBssMembershipSelector (uint32_t selector) const
974 {
975  return m_bssMembershipSelectorSet[selector];
976 }
979 {
980  uint32_t id=GetBssMembershipSelector(selector);
981  WifiModeList supportedmodes;
982  if (id == HT_PHY)
983  {
984  //mandatory MCS 0 to 7
985  supportedmodes.push_back (WifiPhy::GetOfdmRate6_5MbpsBW20MHz ());
986  supportedmodes.push_back (WifiPhy::GetOfdmRate13MbpsBW20MHz ());
987  supportedmodes.push_back (WifiPhy::GetOfdmRate19_5MbpsBW20MHz ());
988  supportedmodes.push_back (WifiPhy::GetOfdmRate26MbpsBW20MHz ());
989  supportedmodes.push_back (WifiPhy::GetOfdmRate39MbpsBW20MHz ());
990  supportedmodes.push_back (WifiPhy::GetOfdmRate52MbpsBW20MHz ());
991  supportedmodes.push_back (WifiPhy::GetOfdmRate58_5MbpsBW20MHz ());
992  supportedmodes.push_back (WifiPhy::GetOfdmRate65MbpsBW20MHz ());
993  }
994  return supportedmodes;
995 }
996 uint8_t
998 {
999  return m_deviceMcsSet.size ();
1000 }
1001 uint8_t
1002 YansWifiPhy::GetMcs (uint8_t mcs) const
1003 {
1004  return m_deviceMcsSet[mcs];
1005 }
1006 uint32_t
1008 {
1009  uint32_t mcs = 0;
1010  if (mode.GetUniqueName() == "OfdmRate135MbpsBW40MHzShGi" || mode.GetUniqueName() == "OfdmRate65MbpsBW20MHzShGi" )
1011  {
1012  mcs=6;
1013  }
1014  else
1015  {
1016  switch (mode.GetDataRate())
1017  {
1018  case 6500000:
1019  case 7200000:
1020  case 13500000:
1021  case 15000000:
1022  mcs=0;
1023  break;
1024  case 13000000:
1025  case 14400000:
1026  case 27000000:
1027  case 30000000:
1028  mcs=1;
1029  break;
1030  case 19500000:
1031  case 21700000:
1032  case 40500000:
1033  case 45000000:
1034  mcs=2;
1035  break;
1036  case 26000000:
1037  case 28900000:
1038  case 54000000:
1039  case 60000000:
1040  mcs=3;
1041  break;
1042  case 39000000:
1043  case 43300000:
1044  case 81000000:
1045  case 90000000:
1046  mcs=4;
1047  break;
1048  case 52000000:
1049  case 57800000:
1050  case 108000000:
1051  case 120000000:
1052  mcs=5;
1053  break;
1054  case 58500000:
1055  case 121500000:
1056  mcs=6;
1057  break;
1058  case 65000000:
1059  case 72200000:
1060  case 135000000:
1061  case 150000000:
1062  mcs=7;
1063  break;
1064  }
1065  }
1066  return mcs;
1067 }
1068 WifiMode
1070 {
1071  WifiMode mode;
1072  switch (mcs)
1073  {
1074  case 7:
1075  if (!GetGuardInterval() && !GetChannelBonding())
1076  {
1078  }
1079  else if(GetGuardInterval() && !GetChannelBonding())
1080  {
1082  }
1083  else if (!GetGuardInterval() && GetChannelBonding())
1084  {
1086  }
1087  else
1088  {
1090  }
1091  break;
1092  case 6:
1093  if (!GetGuardInterval() && !GetChannelBonding())
1094  {
1096 
1097  }
1098  else if(GetGuardInterval() && !GetChannelBonding())
1099  {
1101 
1102  }
1103  else if (!GetGuardInterval() && GetChannelBonding())
1104  {
1106 
1107  }
1108  else
1109  {
1111 
1112  }
1113  break;
1114  case 5:
1115  if (!GetGuardInterval() && !GetChannelBonding())
1116  {
1118 
1119  }
1120  else if(GetGuardInterval() && !GetChannelBonding())
1121  {
1123  }
1124  else if (!GetGuardInterval() && GetChannelBonding())
1125  {
1127 
1128  }
1129  else
1130  {
1132 
1133  }
1134  break;
1135  case 4:
1136  if (!GetGuardInterval() && !GetChannelBonding())
1137  {
1139  }
1140  else if(GetGuardInterval() && !GetChannelBonding())
1141  {
1143  }
1144  else if (!GetGuardInterval() && GetChannelBonding())
1145  {
1147 
1148  }
1149  else
1150  {
1152 
1153  }
1154  break;
1155  case 3:
1156  if (!GetGuardInterval() && !GetChannelBonding())
1157  {
1159 
1160  }
1161  else if(GetGuardInterval() && !GetChannelBonding())
1162  {
1164 
1165  }
1166  else if (!GetGuardInterval() && GetChannelBonding())
1167  {
1169 
1170  }
1171  else
1172  {
1174  }
1175  break;
1176  case 2:
1177  if (!GetGuardInterval() && !GetChannelBonding())
1178  {
1180 
1181  }
1182  else if(GetGuardInterval() && !GetChannelBonding())
1183  {
1185 
1186  }
1187  else if (!GetGuardInterval() && GetChannelBonding())
1188  {
1190 
1191  }
1192  else
1193  {
1195 
1196  }
1197  break;
1198  case 1:
1199  if (!GetGuardInterval() && !GetChannelBonding())
1200  {
1202 
1203  }
1204  else if(GetGuardInterval() && !GetChannelBonding())
1205  {
1207  }
1208  else if (!GetGuardInterval() && GetChannelBonding())
1209  {
1211 
1212  }
1213  else
1214  {
1216  }
1217  break;
1218  case 0:
1219  default:
1220  if (!GetGuardInterval() && !GetChannelBonding())
1221  {
1223 
1224  }
1225  else if(GetGuardInterval() && !GetChannelBonding())
1226  {
1228  }
1229  else if (!GetGuardInterval() && GetChannelBonding())
1230  {
1232 
1233  }
1234  else
1235  {
1237  }
1238  break;
1239  }
1240  return mode;
1241 }
1242 } // 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:946
static WifiMode GetErpOfdmRate24Mbps()
Return a WifiMode for ERP-ODFM at 24Mbps.
Definition: wifi-phy.cc:614
static WifiMode GetDsssRate11Mbps()
Return a WifiMode for DSSS at 11Mbps.
Definition: wifi-phy.cc:546
Ptr< Object > m_mobility
Pointer to the mobility model.
virtual bool IsStateBusy(void)
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:79
static WifiMode GetErpOfdmRate36Mbps()
Return a WifiMode for ERP-ODFM at 36Mbps.
Definition: wifi-phy.cc:627
A struct for both SNR and PER.
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:60
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
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
virtual bool IsModeSupported(WifiMode mode) const
Check if the given WifiMode is supported by the PHY.
static WifiMode GetOfdmRate26MbpsBW20MHz()
Return a WifiMode for ODFM at 26Mbps with 20MHz channel spacing.
Definition: wifi-phy.cc:1064
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:682
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:999
static WifiMode GetOfdmRate18MbpsBW10MHz()
Return a WifiMode for ODFM at 18Mbps with 10MHz channel spacing.
Definition: wifi-phy.cc:840
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:866
void SetErrorRateModel(Ptr< ErrorRateModel > rate)
Sets the error rate model.
virtual bool IsStateSwitching(void)
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register the class in the ns-3 factory.
Definition: object-base.h:38
virtual bool IsStateTx(void)
static WifiMode GetOfdmRate3MbpsBW5MHz()
Return a WifiMode for ODFM at 3Mbps with 5MHz channel spacing.
Definition: wifi-phy.cc:907
static WifiMode GetDsssRate1Mbps()
Return a WifiMode for DSSS at 1Mbps.
Definition: wifi-phy.cc:504
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:495
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:1297
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:601
bool IsZero(void) const
Definition: nstime.h:228
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:695
virtual void SetLdpc(bool ldpc)
Enable or disable LDPC.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Definition: assert.h:61
static WifiMode GetOfdmRate43_3MbpsBW20MHz()
Return a WifiMode for ODFM at 43.3Mbps with 20MHz channel spacing.
Definition: wifi-phy.cc:1103
Time GetEnergyDuration(double energyW)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:170
virtual void RegisterListener(WifiPhyListener *listener)
static WifiMode GetOfdmRate60MbpsBW40MHz()
Return a WifiMode for ODFM at 60Mbps with 40MHz channel spacing.
Definition: wifi-phy.cc:1284
static WifiMode GetOfdmRate1_5MbpsBW5MHz()
Return a WifiMode for ODFM at 1.5Mbps with 5MHz channel spacing.
Definition: wifi-phy.cc:881
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:744
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:788
static WifiMode GetOfdmRate54Mbps()
Return a WifiMode for ODFM at 54Mbps.
Definition: wifi-phy.cc:760
virtual bool IsMcsSupported(WifiMode mode)
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:1322
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:825
static WifiMode GetOfdmRate21_7MbpsBW20MHz()
Return a WifiMode for ODFM at 21.7Mbps with 20MHz channel spacing.
Definition: wifi-phy.cc:1050
void NotifyTxBegin(Ptr< const Packet > packet)
Public method used to fire a PhyTxBegin trace.
Definition: wifi-phy.cc:453
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:1370
static WifiMode GetOfdmRate36Mbps()
Return a WifiMode for ODFM at 36Mbps.
Definition: wifi-phy.cc:734
static WifiMode GetOfdmRate6MbpsBW5MHz()
Return a WifiMode for ODFM at 6Mbps with 5MHz channel spacing.
Definition: wifi-phy.cc:933
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:653
virtual void SetReceiveErrorCallback(WifiPhy::RxErrorCallback callback)
void NotifyRxDrop(Ptr< const Packet > packet)
Public method used to fire a PhyRxDrop trace.
Definition: wifi-phy.cc:483
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:987
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:1358
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:1008
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:640
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:827
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:471
static WifiMode GetOfdmRate19_5MbpsBW20MHz()
Return a WifiMode for ODFM at 19.5Mbps with 20MHz channel spacing.
Definition: wifi-phy.cc:1037
static WifiMode GetOfdmRate18Mbps()
Return a WifiMode for ODFM at 18Mbps.
Definition: wifi-phy.cc:708
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:814
static WifiMode GetOfdmRate12MbpsBW5MHz()
Return a WifiMode for ODFM at 12Mbps with 5MHz channel spacing.
Definition: wifi-phy.cc:959
static WifiMode GetOfdmRate52MbpsBW20MHz()
Return a WifiMode for ODFM at 52Mbps with 20MHz channel spacing.
Definition: wifi-phy.cc:1116
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:1246
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:1182
static WifiMode GetOfdmRate65MbpsBW20MHzShGi()
Return a WifiMode for ODFM at 65Mbps with 20MHz channel spacing.
Definition: wifi-phy.cc:1156
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:747
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:489
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:1129
void EraseEvents(void)
Erase all events.
static WifiMode GetOfdmRate24Mbps()
Return a WifiMode for ODFM at 24Mbps.
Definition: wifi-phy.cc:721
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:1012
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:1169
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:1143
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:533
static WifiMode GetOfdmRate2_25MbpsBW5MHz()
Return a WifiMode for ODFM at 2.25Mbps with 5MHz channel spacing.
Definition: wifi-phy.cc:894
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:575
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:1208
static WifiMode GetOfdmRate121_5MbpsBW40MHz()
Return a WifiMode for ODFM at 121.5Mbps with 40MHz channel spacing.
Definition: wifi-phy.cc:1346
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:84
static WifiMode GetOfdmRate28_9MbpsBW20MHz()
Return a WifiMode for ODFM at 28.9Mbps with 20MHz channel spacing.
Definition: wifi-phy.cc:1077
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:562
Ptr< UniformRandomVariable > m_random
Provides uniform random variables.
static Time CalculateTxDuration(uint32_t size, WifiTxVector txvector, enum WifiPreamble preamble)
Definition: wifi-phy.cc:439
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:588
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:477
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:1195
static WifiMode GetOfdmRate30MbpsBW40MHz()
Return a WifiMode for ODFM at 30Mbps with 40MHz channel spacing.
Definition: wifi-phy.cc:1233
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:213
static WifiMode GetOfdmRate54MbpsBW40MHz()
Return a WifiMode for ODFM at 54Mbps with 40MHz channel spacing.
Definition: wifi-phy.cc:1271
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:441
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:1309
virtual void SetNumberOfReceiveAntennas(uint32_t rx)
static WifiMode GetOfdmRate45MbpsBW40MHz()
Return a WifiMode for ODFM at 45Mbps with 40MHz channel spacing.
Definition: wifi-phy.cc:1258
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:1334
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:1090
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:517
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:801
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:853
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:972
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:610
static WifiMode GetOfdmRate6Mbps()
Return a WifiMode for ODFM at 6Mbps.
Definition: wifi-phy.cc:669
static WifiMode GetOfdmRate27MbpsBW40MHz()
Return a WifiMode for ODFM at 27Mbps with 40MHz channel spacing.
Definition: wifi-phy.cc:1221
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:920
static WifiMode GetOfdmRate14_4MbpsBW20MHz()
Return a WifiMode for ODFM at 14.4Mbps with 20MHz channel spacing.
Definition: wifi-phy.cc:1025
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:775
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.
static WifiMode GetOfdmRate150MbpsBW40MHz()
Return a WifiMode for ODFM at 150Mbps with 40MHz channel spacing.
Definition: wifi-phy.cc:1383
virtual void SetGreenfield(bool greenfield)
Enable or disable Greenfield support.