A Discrete-Event Network Simulator
API
wifi-phy.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2005,2006 INRIA
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  * Sébastien Deronne <sebastien.deronne@gmail.com>
20  */
21 
22 #include "wifi-phy.h"
23 #include "wifi-mode.h"
24 #include "wifi-channel.h"
25 #include "wifi-preamble.h"
26 #include "ns3/simulator.h"
27 #include "ns3/packet.h"
28 #include "ns3/assert.h"
29 #include "ns3/log.h"
30 #include "ns3/double.h"
31 #include "ns3/uinteger.h"
32 #include "ns3/enum.h"
33 #include "ns3/trace-source-accessor.h"
34 #include <cmath>
35 
36 namespace ns3 {
37 
38 NS_LOG_COMPONENT_DEFINE ("WifiPhy");
39 
40 /****************************************************************
41  * This destructor is needed.
42  ****************************************************************/
43 
45 {
46 }
47 
48 /****************************************************************
49  * The actual WifiPhy class
50  ****************************************************************/
51 
53 
54 TypeId
56 {
57  static TypeId tid = TypeId ("ns3::WifiPhy")
58  .SetParent<Object> ()
59  .SetGroupName ("Wifi")
60  .AddTraceSource ("PhyTxBegin",
61  "Trace source indicating a packet "
62  "has begun transmitting over the channel medium",
64  "ns3::Packet::TracedCallback")
65  .AddTraceSource ("PhyTxEnd",
66  "Trace source indicating a packet "
67  "has been completely transmitted over the channel. "
68  "NOTE: the only official WifiPhy implementation "
69  "available to this date (YansWifiPhy) never fires "
70  "this trace source.",
72  "ns3::Packet::TracedCallback")
73  .AddTraceSource ("PhyTxDrop",
74  "Trace source indicating a packet "
75  "has been dropped by the device during transmission",
77  "ns3::Packet::TracedCallback")
78  .AddTraceSource ("PhyRxBegin",
79  "Trace source indicating a packet "
80  "has begun being received from the channel medium "
81  "by the device",
83  "ns3::Packet::TracedCallback")
84  .AddTraceSource ("PhyRxEnd",
85  "Trace source indicating a packet "
86  "has been completely received from the channel medium "
87  "by the device",
89  "ns3::Packet::TracedCallback")
90  .AddTraceSource ("PhyRxDrop",
91  "Trace source indicating a packet "
92  "has been dropped by the device during reception",
94  "ns3::Packet::TracedCallback")
95  .AddTraceSource ("MonitorSnifferRx",
96  "Trace source simulating a wifi device in monitor mode "
97  "sniffing all received frames",
99  "ns3::WifiPhy::MonitorSnifferRxTracedCallback")
100  .AddTraceSource ("MonitorSnifferTx",
101  "Trace source simulating the capability of a wifi device "
102  "in monitor mode to sniff all frames being transmitted",
104  "ns3::WifiPhy::MonitorSnifferTxTracedCallback")
105  ;
106  return tid;
107 }
108 
110 {
111  NS_LOG_FUNCTION (this);
112  m_totalAmpduSize = 0;
114 }
115 
117 {
118  NS_LOG_FUNCTION (this);
119 }
120 
121 WifiMode
123 {
124  return WifiPhy::GetHtMcs0 ();
125 }
126 
127 WifiMode
129 {
130  return WifiPhy::GetVhtMcs0 ();
131 }
132 
133 Time
135 {
136  uint8_t Ndltf, Neltf;
137  //We suppose here that STBC = 0.
138  //If STBC > 0, we need a different mapping between Nss and Nltf (IEEE 802.11n-2012 standard, page 1682).
139  if (txVector.GetNss () < 3)
140  {
141  Ndltf = txVector.GetNss ();
142  }
143  else if (txVector.GetNss () < 5)
144  {
145  Ndltf = 4;
146  }
147  else if (txVector.GetNss () < 7)
148  {
149  Ndltf = 6;
150  }
151  else
152  {
153  Ndltf = 8;
154  }
155 
156  if (txVector.GetNess () < 3)
157  {
158  Neltf = txVector.GetNess ();
159  }
160  else
161  {
162  Neltf = 4;
163  }
164 
165  switch (preamble)
166  {
167  case WIFI_PREAMBLE_HT_MF:
168  return MicroSeconds (4 + (4 * Ndltf) + (4 * Neltf));
169  case WIFI_PREAMBLE_HT_GF:
170  return MicroSeconds ((4 * Ndltf) + (4 * Neltf));
171  case WIFI_PREAMBLE_VHT:
172  return MicroSeconds (4 + (4 * Ndltf));
173  default:
174  //no training for non HT
175  return MicroSeconds (0);
176  }
177 }
178 
179 Time
181 {
182  switch (preamble)
183  {
184  case WIFI_PREAMBLE_HT_MF:
185  case WIFI_PREAMBLE_HT_GF:
186  //HT-SIG
187  return MicroSeconds (8);
188  default:
189  //no HT-SIG for non HT
190  return MicroSeconds (0);
191  }
192 }
193 
194 Time
196 {
197  switch (preamble)
198  {
199  case WIFI_PREAMBLE_VHT:
200  //VHT-SIG-A1
201  return MicroSeconds (4);
202  default:
203  // no VHT-SIG-A1 for non VHT
204  return MicroSeconds (0);
205  }
206 }
207 
208 Time
210 {
211  switch (preamble)
212  {
213  case WIFI_PREAMBLE_VHT:
214  //VHT-SIG-A2
215  return MicroSeconds (4);
216  default:
217  // no VHT-SIG-A2 for non VHT
218  return MicroSeconds (0);
219  }
220 }
221 
222 Time
224 {
225  switch (preamble)
226  {
227  case WIFI_PREAMBLE_VHT:
228  //VHT-SIG-B
229  return MicroSeconds (4);
230  default:
231  // no VHT-SIG-B for non VHT
232  return MicroSeconds (0);
233  }
234 }
235 
236 WifiMode
238 {
239  switch (payloadMode.GetModulationClass ())
240  {
241  case WIFI_MOD_CLASS_OFDM:
242  case WIFI_MOD_CLASS_HT:
243  case WIFI_MOD_CLASS_VHT:
244  switch (txVector.GetChannelWidth ())
245  {
246  case 5:
248  case 10:
250  case 20:
251  case 40:
252  case 80:
253  case 160:
254  default:
255  //(Section 18.3.2 "PLCP frame format"; IEEE Std 802.11-2012)
256  //actually this is only the first part of the PlcpHeader,
257  //because the last 16 bits of the PlcpHeader are using the
258  //same mode of the payload
259  return WifiPhy::GetOfdmRate6Mbps ();
260  }
263  case WIFI_MOD_CLASS_DSSS:
265  if (preamble == WIFI_PREAMBLE_LONG || payloadMode == WifiPhy::GetDsssRate1Mbps ())
266  {
267  //(Section 16.2.3 "PLCP field definitions" and Section 17.2.2.2 "Long PPDU format"; IEEE Std 802.11-2012)
268  return WifiPhy::GetDsssRate1Mbps ();
269  }
270  else //WIFI_PREAMBLE_SHORT
271  {
272  //(Section 17.2.2.3 "Short PPDU format"; IEEE Std 802.11-2012)
273  return WifiPhy::GetDsssRate2Mbps ();
274  }
275  default:
276  NS_FATAL_ERROR ("unsupported modulation class");
277  return WifiMode ();
278  }
279 }
280 
281 Time
283 {
284  if (preamble == WIFI_PREAMBLE_NONE)
285  {
286  return MicroSeconds (0);
287  }
288  switch (txVector.GetMode ().GetModulationClass ())
289  {
290  case WIFI_MOD_CLASS_OFDM:
291  {
292  switch (txVector.GetChannelWidth ())
293  {
294  case 20:
295  default:
296  //(Section 18.3.3 "PLCP preamble (SYNC))" and Figure 18-4 "OFDM training structure"; IEEE Std 802.11-2012)
297  //also (Section 18.3.2.4 "Timing related parameters" Table 18-5 "Timing-related parameters"; IEEE Std 802.11-2012)
298  //We return the duration of the SIGNAL field only, since the
299  //SERVICE field (which strictly speaking belongs to the PLCP
300  //header, see Section 18.3.2 and Figure 18-1) is sent using the
301  //payload mode.
302  return MicroSeconds (4);
303  case 10:
304  //(Section 18.3.2.4 "Timing related parameters" Table 18-5 "Timing-related parameters"; IEEE Std 802.11-2012)
305  return MicroSeconds (8);
306  case 5:
307  //(Section 18.3.2.4 "Timing related parameters" Table 18-5 "Timing-related parameters"; IEEE Std 802.11-2012)
308  return MicroSeconds (16);
309  }
310  }
311  case WIFI_MOD_CLASS_HT:
312  {
313  //L-SIG
314  //IEEE 802.11n Figure 20.1
315  switch (preamble)
316  {
317  case WIFI_PREAMBLE_HT_MF:
318  default:
319  return MicroSeconds (4);
320  case WIFI_PREAMBLE_HT_GF:
321  return MicroSeconds (0);
322  }
323  }
324  case WIFI_MOD_CLASS_VHT:
326  return MicroSeconds (4);
327  case WIFI_MOD_CLASS_DSSS:
329  if ((preamble == WIFI_PREAMBLE_SHORT) && (txVector.GetMode ().GetDataRate (22, 0, 1) > 1000000))
330  {
331  //(Section 17.2.2.3 "Short PPDU format" and Figure 17-2 "Short PPDU format"; IEEE Std 802.11-2012)
332  return MicroSeconds (24);
333  }
334  else //WIFI_PREAMBLE_LONG
335  {
336  //(Section 17.2.2.2 "Long PPDU format" and Figure 17-1 "Short PPDU format"; IEEE Std 802.11-2012)
337  return MicroSeconds (48);
338  }
339  default:
340  NS_FATAL_ERROR ("unsupported modulation class");
341  return MicroSeconds (0);
342  }
343 }
344 
345 Time
347 {
348  if (preamble == WIFI_PREAMBLE_NONE)
349  {
350  return MicroSeconds (0);
351  }
352  switch (txVector.GetMode ().GetModulationClass ())
353  {
354  case WIFI_MOD_CLASS_OFDM:
355  {
356  switch (txVector.GetChannelWidth ())
357  {
358  case 20:
359  default:
360  //(Section 18.3.3 "PLCP preamble (SYNC))" Figure 18-4 "OFDM training structure"
361  //also Section 18.3.2.3 "Modulation-dependent parameters" Table 18-4 "Modulation-dependent parameters"; IEEE Std 802.11-2012)
362  return MicroSeconds (16);
363  case 10:
364  //(Section 18.3.3 "PLCP preamble (SYNC))" Figure 18-4 "OFDM training structure"
365  //also Section 18.3.2.3 "Modulation-dependent parameters" Table 18-4 "Modulation-dependent parameters"; IEEE Std 802.11-2012)
366  return MicroSeconds (32);
367  case 5:
368  //(Section 18.3.3 "PLCP preamble (SYNC))" Figure 18-4 "OFDM training structure"
369  //also Section 18.3.2.3 "Modulation-dependent parameters" Table 18-4 "Modulation-dependent parameters"; IEEE Std 802.11-2012)
370  return MicroSeconds (64);
371  }
372  }
373  case WIFI_MOD_CLASS_VHT:
374  case WIFI_MOD_CLASS_HT:
375  //IEEE 802.11n Figure 20.1 the training symbols before L_SIG or HT_SIG
376  return MicroSeconds (16);
378  return MicroSeconds (16);
379  case WIFI_MOD_CLASS_DSSS:
381  if ((preamble == WIFI_PREAMBLE_SHORT) && (txVector.GetMode ().GetDataRate (22, 0, 1) > 1000000))
382  {
383  //(Section 17.2.2.3 "Short PPDU format)" Figure 17-2 "Short PPDU format"; IEEE Std 802.11-2012)
384  return MicroSeconds (72);
385  }
386  else //WIFI_PREAMBLE_LONG
387  {
388  //(Section 17.2.2.2 "Long PPDU format)" Figure 17-1 "Long PPDU format"; IEEE Std 802.11-2012)
389  return MicroSeconds (144);
390  }
391  default:
392  NS_FATAL_ERROR ("unsupported modulation class");
393  return MicroSeconds (0);
394  }
395 }
396 
397 Time
398 WifiPhy::GetPayloadDuration (uint32_t size, WifiTxVector txVector, WifiPreamble preamble, double frequency)
399 {
400  return GetPayloadDuration (size, txVector, preamble, frequency, NORMAL_MPDU, 0);
401 }
402 
403 Time
404 WifiPhy::GetPayloadDuration (uint32_t size, WifiTxVector txVector, WifiPreamble preamble, double frequency, enum mpduType mpdutype, uint8_t incFlag)
405 {
406  WifiMode payloadMode = txVector.GetMode ();
407  NS_LOG_FUNCTION (size << payloadMode);
408 
409  switch (payloadMode.GetModulationClass ())
410  {
411  case WIFI_MOD_CLASS_OFDM:
413  {
414  //(Section 18.3.2.4 "Timing related parameters" Table 18-5 "Timing-related parameters"; IEEE Std 802.11-2012
415  //corresponds to T_{SYM} in the table)
416  Time symbolDuration;
417 
418  switch (txVector.GetChannelWidth ())
419  {
420  case 20:
421  default:
422  symbolDuration = MicroSeconds (4);
423  break;
424  case 10:
425  symbolDuration = MicroSeconds (8);
426  break;
427  case 5:
428  symbolDuration = MicroSeconds (16);
429  break;
430  }
431 
432  //(Section 18.3.2.3 "Modulation-dependent parameters" Table 18-4 "Modulation-dependent parameters"; IEEE Std 802.11-2012)
433  //corresponds to N_{DBPS} in the table
434  double numDataBitsPerSymbol = payloadMode.GetDataRate (txVector.GetChannelWidth (), 0, 1) * symbolDuration.GetNanoSeconds () / 1e9;
435  double numSymbols;
436 
437  if (mpdutype == MPDU_IN_AGGREGATE && preamble != WIFI_PREAMBLE_NONE)
438  {
439  //First packet in an A-MPDU
440  numSymbols = ((16 + size * 8.0 + 6) / numDataBitsPerSymbol);
441  if (incFlag == 1)
442  {
443  m_totalAmpduSize += size;
444  m_totalAmpduNumSymbols += numSymbols;
445  }
446  }
447  else if (mpdutype == MPDU_IN_AGGREGATE && preamble == WIFI_PREAMBLE_NONE)
448  {
449  //consecutive packets in an A-MPDU
450  numSymbols = ((size * 8.0) / numDataBitsPerSymbol);
451  if (incFlag == 1)
452  {
453  m_totalAmpduSize += size;
454  m_totalAmpduNumSymbols += numSymbols;
455  }
456  }
457  else if (mpdutype == LAST_MPDU_IN_AGGREGATE && preamble == WIFI_PREAMBLE_NONE)
458  {
459  //last packet in an A-MPDU
460  uint32_t totalAmpduSize = m_totalAmpduSize + size;
461  numSymbols = lrint (ceil ((16 + totalAmpduSize * 8.0 + 6) / numDataBitsPerSymbol));
462  NS_ASSERT (m_totalAmpduNumSymbols <= numSymbols);
463  numSymbols -= m_totalAmpduNumSymbols;
464  if (incFlag == 1)
465  {
466  m_totalAmpduSize = 0;
468  }
469  }
470  else if (mpdutype == NORMAL_MPDU && preamble != WIFI_PREAMBLE_NONE)
471  {
472  //Not an A-MPDU
473  numSymbols = lrint (ceil ((16 + size * 8.0 + 6.0) / numDataBitsPerSymbol));
474  }
475  else
476  {
477  NS_FATAL_ERROR ("Wrong combination of preamble and packet type");
478  }
479 
480  //Add signal extension for ERP PHY
481  if (payloadMode.GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM)
482  {
483  return NanoSeconds (numSymbols * symbolDuration.GetNanoSeconds ()) + MicroSeconds (6);
484  }
485  else
486  {
487  return NanoSeconds (numSymbols * symbolDuration.GetNanoSeconds ());
488  }
489  }
490  case WIFI_MOD_CLASS_HT:
491  case WIFI_MOD_CLASS_VHT:
492  {
493  Time symbolDuration;
494  double m_Stbc;
495  //if short GI data rate is used then symbol duration is 3.6us else symbol duration is 4us
496  //In the future has to create a stationmanager that only uses these data rates if sender and reciever support GI
497  if (txVector.IsShortGuardInterval ())
498  {
499  symbolDuration = NanoSeconds (3600);
500  }
501  else
502  {
503  symbolDuration = MicroSeconds (4);
504  }
505 
506  if (txVector.IsStbc ())
507  {
508  m_Stbc = 2;
509  }
510  else
511  {
512  m_Stbc = 1;
513  }
514 
515  //check tables 20-35 and 20-36 in the .11n standard to get cases when nes = 2
516  double Nes = 1;
517  if (payloadMode.GetUniqueName () == "HtMcs21"
518  || payloadMode.GetUniqueName () == "HtMcs22"
519  || payloadMode.GetUniqueName () == "HtMcs23"
520  || payloadMode.GetUniqueName () == "HtMcs28"
521  || payloadMode.GetUniqueName () == "HtMcs29"
522  || payloadMode.GetUniqueName () == "HtMcs30"
523  || payloadMode.GetUniqueName () == "HtMcs31")
524  {
525  Nes = 2;
526  }
527  //check tables 22-30 to 22-61 in the .11ac standard to get cases when nes > 1
528  //todo: improve logic to reduce the number of if cases
529  //todo: extend to NSS > 4 for VHT rates
530  if (txVector.GetChannelWidth () == 40
531  && txVector.GetNss () == 3
532  && payloadMode.GetMcsValue () >= 8)
533  {
534  Nes = 2;
535  }
536  if (txVector.GetChannelWidth () == 80
537  && txVector.GetNss () == 2
538  && payloadMode.GetMcsValue () >= 7)
539  {
540  Nes = 2;
541  }
542  if (txVector.GetChannelWidth () == 80
543  && txVector.GetNss () == 3
544  && payloadMode.GetMcsValue () >= 7)
545  {
546  Nes = 2;
547  }
548  if (txVector.GetChannelWidth () == 80
549  && txVector.GetNss () == 3
550  && payloadMode.GetMcsValue () == 9)
551  {
552  Nes = 3;
553  }
554  if (txVector.GetChannelWidth () == 80
555  && txVector.GetNss () == 4
556  && payloadMode.GetMcsValue () >= 4)
557  {
558  Nes = 2;
559  }
560  if (txVector.GetChannelWidth () == 80
561  && txVector.GetNss () == 4
562  && payloadMode.GetMcsValue () >= 7)
563  {
564  Nes = 3;
565  }
566  if (txVector.GetChannelWidth () == 160
567  && payloadMode.GetMcsValue () >= 7)
568  {
569  Nes = 2;
570  }
571  if (txVector.GetChannelWidth () == 160
572  && txVector.GetNss () == 2
573  && payloadMode.GetMcsValue () >= 4)
574  {
575  Nes = 2;
576  }
577  if (txVector.GetChannelWidth () == 160
578  && txVector.GetNss () == 2
579  && payloadMode.GetMcsValue () >= 7)
580  {
581  Nes = 3;
582  }
583  if (txVector.GetChannelWidth () == 160
584  && txVector.GetNss () == 3
585  && payloadMode.GetMcsValue () >= 3)
586  {
587  Nes = 2;
588  }
589  if (txVector.GetChannelWidth () == 160
590  && txVector.GetNss () == 3
591  && payloadMode.GetMcsValue () >= 5)
592  {
593  Nes = 3;
594  }
595  if (txVector.GetChannelWidth () == 160
596  && txVector.GetNss () == 3
597  && payloadMode.GetMcsValue () >= 7)
598  {
599  Nes = 4;
600  }
601  if (txVector.GetChannelWidth () == 160
602  && txVector.GetNss () == 4
603  && payloadMode.GetMcsValue () >= 2)
604  {
605  Nes = 2;
606  }
607  if (txVector.GetChannelWidth () == 160
608  && txVector.GetNss () == 4
609  && payloadMode.GetMcsValue () >= 4)
610  {
611  Nes = 3;
612  }
613  if (txVector.GetChannelWidth () == 160
614  && txVector.GetNss () == 4
615  && payloadMode.GetMcsValue () >= 5)
616  {
617  Nes = 4;
618  }
619  if (txVector.GetChannelWidth () == 160
620  && txVector.GetNss () == 4
621  && payloadMode.GetMcsValue () >= 7)
622  {
623  Nes = 6;
624  }
625 
626  //IEEE Std 802.11n, section 20.3.11, equation (20-32)
627  double numDataBitsPerSymbol = payloadMode.GetDataRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), txVector.GetNss ()) * symbolDuration.GetNanoSeconds () / 1e9;
628  double numSymbols;
629 
630  if (mpdutype == MPDU_IN_AGGREGATE && preamble != WIFI_PREAMBLE_NONE)
631  {
632  //First packet in an A-MPDU
633  numSymbols = (m_Stbc * (16 + size * 8.0 + 6 * Nes) / (m_Stbc * numDataBitsPerSymbol));
634  if (incFlag == 1)
635  {
636  m_totalAmpduSize += size;
637  m_totalAmpduNumSymbols += numSymbols;
638  }
639  }
640  else if (mpdutype == MPDU_IN_AGGREGATE && preamble == WIFI_PREAMBLE_NONE)
641  {
642  //consecutive packets in an A-MPDU
643  numSymbols = (m_Stbc * size * 8.0) / (m_Stbc * numDataBitsPerSymbol);
644  if (incFlag == 1)
645  {
646  m_totalAmpduSize += size;
647  m_totalAmpduNumSymbols += numSymbols;
648  }
649  }
650  else if (mpdutype == LAST_MPDU_IN_AGGREGATE && preamble == WIFI_PREAMBLE_NONE)
651  {
652  //last packet in an A-MPDU
653  uint32_t totalAmpduSize = m_totalAmpduSize + size;
654  numSymbols = lrint (m_Stbc * ceil ((16 + totalAmpduSize * 8.0 + 6 * Nes) / (m_Stbc * numDataBitsPerSymbol)));
655  NS_ASSERT (m_totalAmpduNumSymbols <= numSymbols);
656  numSymbols -= m_totalAmpduNumSymbols;
657  if (incFlag == 1)
658  {
659  m_totalAmpduSize = 0;
661  }
662  }
663  else if (mpdutype == NORMAL_MPDU && preamble != WIFI_PREAMBLE_NONE)
664  {
665  //Not an A-MPDU
666  numSymbols = lrint (m_Stbc * ceil ((16 + size * 8.0 + 6.0 * Nes) / (m_Stbc * numDataBitsPerSymbol)));
667  }
668  else
669  {
670  NS_FATAL_ERROR ("Wrong combination of preamble and packet type");
671  }
672 
673  if (payloadMode.GetModulationClass () == WIFI_MOD_CLASS_HT && frequency >= 2400 && frequency <= 2500 && ((mpdutype == NORMAL_MPDU && preamble != WIFI_PREAMBLE_NONE) || (mpdutype == LAST_MPDU_IN_AGGREGATE && preamble == WIFI_PREAMBLE_NONE))) //at 2.4 GHz
674  {
675  return NanoSeconds (numSymbols * symbolDuration.GetNanoSeconds ()) + MicroSeconds (6);
676  }
677  else //at 5 GHz
678  {
679  return NanoSeconds (numSymbols * symbolDuration.GetNanoSeconds ());
680  }
681  }
682  case WIFI_MOD_CLASS_DSSS:
684  //(Section 17.2.3.6 "Long PLCP LENGTH field"; IEEE Std 802.11-2012)
685  NS_LOG_LOGIC (" size=" << size
686  << " mode=" << payloadMode
687  << " rate=" << payloadMode.GetDataRate (22, 0, 1));
688  return MicroSeconds (lrint (ceil ((size * 8.0) / (payloadMode.GetDataRate (22, 0, 1) / 1.0e6))));
689  default:
690  NS_FATAL_ERROR ("unsupported modulation class");
691  return MicroSeconds (0);
692  }
693 }
694 
695 Time
697 {
698  Time duration = GetPlcpPreambleDuration (txVector, preamble)
699  + GetPlcpHeaderDuration (txVector, preamble)
700  + GetPlcpHtSigHeaderDuration (preamble)
701  + GetPlcpVhtSigA1Duration (preamble)
702  + GetPlcpVhtSigA2Duration (preamble)
703  + GetPlcpHtTrainingSymbolDuration (preamble, txVector)
704  + GetPlcpVhtSigBDuration (preamble);
705  return duration;
706 }
707 
708 Time
709 WifiPhy::CalculateTxDuration (uint32_t size, WifiTxVector txVector, WifiPreamble preamble, double frequency, enum mpduType mpdutype, uint8_t incFlag)
710 {
711  Time duration = CalculatePlcpPreambleAndHeaderDuration (txVector, preamble)
712  + GetPayloadDuration (size, txVector, preamble, frequency, mpdutype, incFlag);
713  return duration;
714 }
715 
716 Time
717 WifiPhy::CalculateTxDuration (uint32_t size, WifiTxVector txVector, WifiPreamble preamble, double frequency)
718 {
719  return CalculateTxDuration (size, txVector, preamble, frequency, NORMAL_MPDU, 0);
720 }
721 
722 void
724 {
725  m_phyTxBeginTrace (packet);
726 }
727 
728 void
730 {
731  m_phyTxEndTrace (packet);
732 }
733 
734 void
736 {
737  m_phyTxDropTrace (packet);
738 }
739 
740 void
742 {
743  m_phyRxBeginTrace (packet);
744 }
745 
746 void
748 {
749  m_phyRxEndTrace (packet);
750 }
751 
752 void
754 {
755  m_phyRxDropTrace (packet);
756 }
757 
758 void
759 WifiPhy::NotifyMonitorSniffRx (Ptr<const Packet> packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, WifiPreamble preamble, WifiTxVector txVector, struct mpduInfo aMpdu, struct signalNoiseDbm signalNoise)
760 {
761  m_phyMonitorSniffRxTrace (packet, channelFreqMhz, channelNumber, rate, preamble, txVector, aMpdu, signalNoise);
762 }
763 
764 void
765 WifiPhy::NotifyMonitorSniffTx (Ptr<const Packet> packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, WifiPreamble preamble, WifiTxVector txVector, struct mpduInfo aMpdu)
766 {
767  m_phyMonitorSniffTxTrace (packet, channelFreqMhz, channelNumber, rate, preamble, txVector, aMpdu);
768 }
769 
770 
771 // Clause 15 rates (DSSS)
772 
773 WifiMode
775 {
776  static WifiMode mode =
777  WifiModeFactory::CreateWifiMode ("DsssRate1Mbps",
779  true,
781  2);
782  return mode;
783 }
784 
785 WifiMode
787 {
788  static WifiMode mode =
789  WifiModeFactory::CreateWifiMode ("DsssRate2Mbps",
791  true,
793  4);
794  return mode;
795 }
796 
797 
798 // Clause 18 rates (HR/DSSS)
799 
800 WifiMode
802 {
803  static WifiMode mode =
804  WifiModeFactory::CreateWifiMode ("DsssRate5_5Mbps",
806  true,
808  16);
809  return mode;
810 }
811 
812 WifiMode
814 {
815  static WifiMode mode =
816  WifiModeFactory::CreateWifiMode ("DsssRate11Mbps",
818  true,
820  256);
821  return mode;
822 }
823 
824 
825 // Clause 19.5 rates (ERP-OFDM)
826 
827 WifiMode
829 {
830  static WifiMode mode =
831  WifiModeFactory::CreateWifiMode ("ErpOfdmRate6Mbps",
833  true,
835  2);
836  return mode;
837 }
838 
839 WifiMode
841 {
842  static WifiMode mode =
843  WifiModeFactory::CreateWifiMode ("ErpOfdmRate9Mbps",
845  false,
847  2);
848  return mode;
849 }
850 
851 WifiMode
853 {
854  static WifiMode mode =
855  WifiModeFactory::CreateWifiMode ("ErpOfdmRate12Mbps",
857  true,
859  4);
860  return mode;
861 }
862 
863 WifiMode
865 {
866  static WifiMode mode =
867  WifiModeFactory::CreateWifiMode ("ErpOfdmRate18Mbps",
869  false,
871  4);
872  return mode;
873 }
874 
875 WifiMode
877 {
878  static WifiMode mode =
879  WifiModeFactory::CreateWifiMode ("ErpOfdmRate24Mbps",
881  true,
883  16);
884  return mode;
885 }
886 
887 WifiMode
889 {
890  static WifiMode mode =
891  WifiModeFactory::CreateWifiMode ("ErpOfdmRate36Mbps",
893  false,
895  16);
896  return mode;
897 }
898 
899 WifiMode
901 {
902  static WifiMode mode =
903  WifiModeFactory::CreateWifiMode ("ErpOfdmRate48Mbps",
905  false,
907  64);
908  return mode;
909 }
910 
911 WifiMode
913 {
914  static WifiMode mode =
915  WifiModeFactory::CreateWifiMode ("ErpOfdmRate54Mbps",
917  false,
919  64);
920  return mode;
921 }
922 
923 
924 // Clause 17 rates (OFDM)
925 
926 WifiMode
928 {
929  static WifiMode mode =
930  WifiModeFactory::CreateWifiMode ("OfdmRate6Mbps",
932  true,
934  2);
935  return mode;
936 }
937 
938 WifiMode
940 {
941  static WifiMode mode =
942  WifiModeFactory::CreateWifiMode ("OfdmRate9Mbps",
944  false,
946  2);
947  return mode;
948 }
949 
950 WifiMode
952 {
953  static WifiMode mode =
954  WifiModeFactory::CreateWifiMode ("OfdmRate12Mbps",
956  true,
958  4);
959  return mode;
960 }
961 
962 WifiMode
964 {
965  static WifiMode mode =
966  WifiModeFactory::CreateWifiMode ("OfdmRate18Mbps",
968  false,
970  4);
971  return mode;
972 }
973 
974 WifiMode
976 {
977  static WifiMode mode =
978  WifiModeFactory::CreateWifiMode ("OfdmRate24Mbps",
980  true,
982  16);
983  return mode;
984 }
985 
986 WifiMode
988 {
989  static WifiMode mode =
990  WifiModeFactory::CreateWifiMode ("OfdmRate36Mbps",
992  false,
994  16);
995  return mode;
996 }
997 
998 WifiMode
1000 {
1001  static WifiMode mode =
1002  WifiModeFactory::CreateWifiMode ("OfdmRate48Mbps",
1004  false,
1006  64);
1007  return mode;
1008 }
1009 
1010 WifiMode
1012 {
1013  static WifiMode mode =
1014  WifiModeFactory::CreateWifiMode ("OfdmRate54Mbps",
1016  false,
1018  64);
1019  return mode;
1020 }
1021 
1022 
1023 // 10 MHz channel rates
1024 
1025 WifiMode
1027 {
1028  static WifiMode mode =
1029  WifiModeFactory::CreateWifiMode ("OfdmRate3MbpsBW10MHz",
1031  true,
1033  2);
1034  return mode;
1035 }
1036 
1037 WifiMode
1039 {
1040  static WifiMode mode =
1041  WifiModeFactory::CreateWifiMode ("OfdmRate4_5MbpsBW10MHz",
1043  false,
1045  2);
1046  return mode;
1047 }
1048 
1049 WifiMode
1051 {
1052  static WifiMode mode =
1053  WifiModeFactory::CreateWifiMode ("OfdmRate6MbpsBW10MHz",
1055  true,
1057  4);
1058  return mode;
1059 }
1060 
1061 WifiMode
1063 {
1064  static WifiMode mode =
1065  WifiModeFactory::CreateWifiMode ("OfdmRate9MbpsBW10MHz",
1067  false,
1069  4);
1070  return mode;
1071 }
1072 
1073 WifiMode
1075 {
1076  static WifiMode mode =
1077  WifiModeFactory::CreateWifiMode ("OfdmRate12MbpsBW10MHz",
1079  true,
1081  16);
1082  return mode;
1083 }
1084 
1085 WifiMode
1087 {
1088  static WifiMode mode =
1089  WifiModeFactory::CreateWifiMode ("OfdmRate18MbpsBW10MHz",
1091  false,
1093  16);
1094  return mode;
1095 }
1096 
1097 WifiMode
1099 {
1100  static WifiMode mode =
1101  WifiModeFactory::CreateWifiMode ("OfdmRate24MbpsBW10MHz",
1103  false,
1105  64);
1106  return mode;
1107 }
1108 
1109 WifiMode
1111 {
1112  static WifiMode mode =
1113  WifiModeFactory::CreateWifiMode ("OfdmRate27MbpsBW10MHz",
1115  false,
1117  64);
1118  return mode;
1119 }
1120 
1121 
1122 // 5 MHz channel rates
1123 
1124 WifiMode
1126 {
1127  static WifiMode mode =
1128  WifiModeFactory::CreateWifiMode ("OfdmRate1_5MbpsBW5MHz",
1130  true,
1132  2);
1133  return mode;
1134 }
1135 
1136 WifiMode
1138 {
1139  static WifiMode mode =
1140  WifiModeFactory::CreateWifiMode ("OfdmRate2_25MbpsBW5MHz",
1142  false,
1144  2);
1145  return mode;
1146 }
1147 
1148 WifiMode
1150 {
1151  static WifiMode mode =
1152  WifiModeFactory::CreateWifiMode ("OfdmRate3MbpsBW5MHz",
1154  true,
1156  4);
1157  return mode;
1158 }
1159 
1160 WifiMode
1162 {
1163  static WifiMode mode =
1164  WifiModeFactory::CreateWifiMode ("OfdmRate4_5MbpsBW5MHz",
1166  false,
1168  4);
1169  return mode;
1170 }
1171 
1172 WifiMode
1174 {
1175  static WifiMode mode =
1176  WifiModeFactory::CreateWifiMode ("OfdmRate6MbpsBW5MHz",
1178  true,
1180  16);
1181  return mode;
1182 }
1183 
1184 WifiMode
1186 {
1187  static WifiMode mode =
1188  WifiModeFactory::CreateWifiMode ("OfdmRate9MbpsBW5MHz",
1190  false,
1192  16);
1193  return mode;
1194 }
1195 
1196 WifiMode
1198 {
1199  static WifiMode mode =
1200  WifiModeFactory::CreateWifiMode ("OfdmRate12MbpsBW5MHz",
1202  false,
1204  64);
1205  return mode;
1206 }
1207 
1208 WifiMode
1210 {
1211  static WifiMode mode =
1212  WifiModeFactory::CreateWifiMode ("OfdmRate13_5MbpsBW5MHz",
1214  false,
1216  64);
1217  return mode;
1218 }
1219 
1220 
1221 // Clause 20
1222 
1223 WifiMode
1225 {
1226  static WifiMode mcs =
1228  return mcs;
1229 }
1230 
1231 WifiMode
1233 {
1234  static WifiMode mcs =
1236  return mcs;
1237 }
1238 
1239 WifiMode
1241 {
1242  static WifiMode mcs =
1244  return mcs;
1245 }
1246 
1247 WifiMode
1249 {
1250  static WifiMode mcs =
1252  return mcs;
1253 }
1254 
1255 WifiMode
1257 {
1258  static WifiMode mcs =
1260  return mcs;
1261 }
1262 
1263 WifiMode
1265 {
1266  static WifiMode mcs =
1268  return mcs;
1269 }
1270 
1271 WifiMode
1273 {
1274  static WifiMode mcs =
1276  return mcs;
1277 }
1278 
1279 WifiMode
1281 {
1282  static WifiMode mcs =
1284  return mcs;
1285 }
1286 
1287 WifiMode
1289 {
1290  static WifiMode mcs =
1292  return mcs;
1293 }
1294 
1295 WifiMode
1297 {
1298  static WifiMode mcs =
1300  return mcs;
1301 }
1302 
1303 WifiMode
1305 {
1306  static WifiMode mcs =
1308  return mcs;
1309 }
1310 
1311 WifiMode
1313 {
1314  static WifiMode mcs =
1316  return mcs;
1317 }
1318 
1319 WifiMode
1321 {
1322  static WifiMode mcs =
1324  return mcs;
1325 }
1326 
1327 WifiMode
1329 {
1330  static WifiMode mcs =
1332  return mcs;
1333 }
1334 
1335 WifiMode
1337 {
1338  static WifiMode mcs =
1340  return mcs;
1341 }
1342 
1343 WifiMode
1345 {
1346  static WifiMode mcs =
1348  return mcs;
1349 }
1350 
1351 WifiMode
1353 {
1354  static WifiMode mcs =
1356  return mcs;
1357 }
1358 
1359 WifiMode
1361 {
1362  static WifiMode mcs =
1364  return mcs;
1365 }
1366 
1367 WifiMode
1369 {
1370  static WifiMode mcs =
1372  return mcs;
1373 }
1374 
1375 WifiMode
1377 {
1378  static WifiMode mcs =
1380  return mcs;
1381 }
1382 
1383 WifiMode
1385 {
1386  static WifiMode mcs =
1388  return mcs;
1389 }
1390 
1391 WifiMode
1393 {
1394  static WifiMode mcs =
1396  return mcs;
1397 }
1398 
1399 WifiMode
1401 {
1402  static WifiMode mcs =
1404  return mcs;
1405 }
1406 
1407 WifiMode
1409 {
1410  static WifiMode mcs =
1412  return mcs;
1413 }
1414 
1415 WifiMode
1417 {
1418  static WifiMode mcs =
1420  return mcs;
1421 }
1422 
1423 WifiMode
1425 {
1426  static WifiMode mcs =
1428  return mcs;
1429 }
1430 
1431 WifiMode
1433 {
1434  static WifiMode mcs =
1436  return mcs;
1437 }
1438 
1439 WifiMode
1441 {
1442  static WifiMode mcs =
1444  return mcs;
1445 }
1446 
1447 WifiMode
1449 {
1450  static WifiMode mcs =
1452  return mcs;
1453 }
1454 
1455 WifiMode
1457 {
1458  static WifiMode mcs =
1460  return mcs;
1461 }
1462 
1463 WifiMode
1465 {
1466  static WifiMode mcs =
1468  return mcs;
1469 }
1470 
1471 WifiMode
1473 {
1474  static WifiMode mcs =
1476  return mcs;
1477 }
1478 
1479 
1480 // Clause 22
1481 
1482 WifiMode
1484 {
1485  static WifiMode mcs =
1487  return mcs;
1488 }
1489 
1490 WifiMode
1492 {
1493  static WifiMode mcs =
1495  return mcs;
1496 }
1497 
1498 WifiMode
1500 {
1501  static WifiMode mcs =
1503  return mcs;
1504 }
1505 
1506 WifiMode
1508 {
1509  static WifiMode mcs =
1511  return mcs;
1512 }
1513 
1514 WifiMode
1516 {
1517  static WifiMode mcs =
1519  return mcs;
1520 }
1521 
1522 WifiMode
1524 {
1525  static WifiMode mcs =
1527  return mcs;
1528 }
1529 
1530 WifiMode
1532 {
1533  static WifiMode mcs =
1535  return mcs;
1536 }
1537 
1538 WifiMode
1540 {
1541  static WifiMode mcs =
1543  return mcs;
1544 }
1545 
1546 WifiMode
1548 {
1549  static WifiMode mcs =
1551  return mcs;
1552 }
1553 
1554 WifiMode
1556 {
1557  static WifiMode mcs =
1559  return mcs;
1560 }
1561 
1562 bool
1564 {
1565  uint32_t chWidth = txVector.GetChannelWidth();
1566  uint8_t nss = txVector.GetNss();
1567  std::string modeName = txVector.GetMode().GetUniqueName();
1568 
1569  if (chWidth == 20)
1570  {
1571  if (nss != 3 && nss != 6)
1572  {
1573  return (modeName != "VhtMcs9");
1574  }
1575  }
1576  else if (chWidth == 80)
1577  {
1578  if (nss == 3 || nss == 7)
1579  {
1580  return (modeName != "VhtMcs6");
1581  }
1582  else if (nss == 6)
1583  {
1584  return (modeName != "VhtMcs9");
1585  }
1586  }
1587  else if (chWidth == 160)
1588  {
1589  if (nss == 3)
1590  {
1591  return (modeName != "VhtMcs9");
1592  }
1593  }
1594 
1595  return true;
1596 }
1597 
1598 std::ostream& operator<< (std::ostream& os, enum WifiPhy::State state)
1599 {
1600  switch (state)
1601  {
1602  case WifiPhy::IDLE:
1603  return (os << "IDLE");
1604  case WifiPhy::CCA_BUSY:
1605  return (os << "CCA_BUSY");
1606  case WifiPhy::TX:
1607  return (os << "TX");
1608  case WifiPhy::RX:
1609  return (os << "RX");
1610  case WifiPhy::SWITCHING:
1611  return (os << "SWITCHING");
1612  case WifiPhy::SLEEP:
1613  return (os << "SLEEP");
1614  default:
1615  NS_FATAL_ERROR ("Invalid WifiPhy state");
1616  return (os << "INVALID");
1617  }
1618 }
1619 
1620 } //namespace ns3
1621 
1622 namespace {
1623 
1624 static class Constructor
1625 {
1626 public:
1628  {
1707  }
1708 } g_constructor;
1709 
1710 }
static class anonymous_namespace{wifi-phy.cc}::Constructor g_constructor
static WifiMode GetVhtMcs6()
Return MCS 6 from VHT MCS values.
Definition: wifi-phy.cc:1531
static WifiMode GetOfdmRate9MbpsBW5MHz()
Return a WifiMode for OFDM at 9Mbps with 5MHz channel spacing.
Definition: wifi-phy.cc:1185
TracedCallback< Ptr< const Packet > > m_phyRxBeginTrace
The trace source fired when a packet begins the reception process from the medium.
Definition: wifi-phy.h:1333
static WifiMode GetErpOfdmRate24Mbps()
Return a WifiMode for ERP-OFDM at 24Mbps.
Definition: wifi-phy.cc:876
static WifiMode GetDsssRate11Mbps()
Return a WifiMode for DSSS at 11Mbps.
Definition: wifi-phy.cc:813
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
static WifiMode GetErpOfdmRate36Mbps()
Return a WifiMode for ERP-OFDM at 36Mbps.
Definition: wifi-phy.cc:888
void NotifyMonitorSniffTx(Ptr< const Packet > packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, WifiPreamble preamble, WifiTxVector txVector, struct mpduInfo aMpdu)
Public method used to fire a MonitorSniffer trace for a wifi packet being transmitted.
Definition: wifi-phy.cc:765
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
static WifiMode GetVhtMcs8()
Return MCS 8 from VHT MCS values.
Definition: wifi-phy.cc:1547
ERP-OFDM PHY (19.5)
Definition: wifi-mode.h:58
static WifiMode GetOfdmRate9Mbps()
Return a WifiMode for OFDM at 9Mbps.
Definition: wifi-phy.cc:939
static WifiMode GetOfdmRate18MbpsBW10MHz()
Return a WifiMode for OFDM at 18Mbps with 10MHz channel spacing.
Definition: wifi-phy.cc:1086
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 OFDM at 27Mbps with 10MHz channel spacing.
Definition: wifi-phy.cc:1110
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:44
static WifiMode GetOfdmRate3MbpsBW5MHz()
Return a WifiMode for OFDM at 3Mbps with 5MHz channel spacing.
Definition: wifi-phy.cc:1149
static WifiMode GetVhtMcs0()
Return MCS 0 from VHT MCS values.
Definition: wifi-phy.cc:1483
virtual ~WifiPhy()
Definition: wifi-phy.cc:116
static WifiMode GetDsssRate1Mbps()
Return a WifiMode for DSSS at 1Mbps.
Definition: wifi-phy.cc:774
802.11 PHY layer model
Definition: wifi-phy.h:151
static WifiMode GetErpOfdmRate18Mbps()
Return a WifiMode for ERP-OFDM at 18Mbps.
Definition: wifi-phy.cc:864
The PHY layer has sense the medium busy through the CCA mechanism.
Definition: wifi-phy.h:166
static WifiMode GetHtMcs7()
Return MCS 7 from HT MCS values.
Definition: wifi-phy.cc:1280
static WifiMode GetHtPlcpHeaderMode(WifiMode payloadMode)
Definition: wifi-phy.cc:122
static Time GetPlcpHtSigHeaderDuration(WifiPreamble preamble)
Definition: wifi-phy.cc:180
static WifiMode GetVhtMcs5()
Return MCS 5 from VHT MCS values.
Definition: wifi-phy.cc:1523
static WifiMode GetHtMcs22()
Return MCS 22 from HT MCS values.
Definition: wifi-phy.cc:1400
static WifiMode GetHtMcs14()
Return MCS 14 from HT MCS values.
Definition: wifi-phy.cc:1336
static WifiMode GetOfdmRate12Mbps()
Return a WifiMode for OFDM at 12Mbps.
Definition: wifi-phy.cc:951
TracedCallback< Ptr< const Packet > > m_phyRxEndTrace
The trace source fired when a packet ends the reception process from the medium.
Definition: wifi-phy.h:1341
enum WifiModulationClass GetModulationClass() const
Definition: wifi-mode.cc:386
static WifiMode GetHtMcs31()
Return MCS 31 from HT MCS values.
Definition: wifi-phy.cc:1472
static WifiMode GetHtMcs21()
Return MCS 21 from HT MCS values.
Definition: wifi-phy.cc:1392
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Definition: assert.h:67
static WifiMode GetHtMcs30()
Return MCS 30 from HT MCS values.
Definition: wifi-phy.cc:1464
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:201
static WifiMode GetHtMcs10()
Return MCS 10 from HT MCS values.
Definition: wifi-phy.cc:1304
static WifiMode GetHtMcs26()
Return MCS 26 from HT MCS values.
Definition: wifi-phy.cc:1432
bool IsShortGuardInterval(void) const
static WifiMode GetOfdmRate1_5MbpsBW5MHz()
Return a WifiMode for OFDM at 1.5Mbps with 5MHz channel spacing.
Definition: wifi-phy.cc:1125
The PHY layer is sleeping.
Definition: wifi-phy.h:182
static WifiMode GetHtMcs17()
Return MCS 17 from HT MCS values.
Definition: wifi-phy.cc:1360
static WifiMode GetHtMcs24()
Return MCS 24 from HT MCS values.
Definition: wifi-phy.cc:1416
static WifiMode GetOfdmRate4_5MbpsBW10MHz()
Return a WifiMode for OFDM at 4.5Mbps with 10MHz channel spacing.
Definition: wifi-phy.cc:1038
static WifiMode GetOfdmRate54Mbps()
Return a WifiMode for OFDM at 54Mbps.
Definition: wifi-phy.cc:1011
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:145
void NotifyTxDrop(Ptr< const Packet > packet)
Public method used to fire a PhyTxDrop trace.
Definition: wifi-phy.cc:735
VHT PHY (Clause 22)
Definition: wifi-mode.h:64
HR/DSSS PHY (Clause 18)
Definition: wifi-mode.h:52
static WifiMode GetHtMcs8()
Return MCS 8 from HT MCS values.
Definition: wifi-phy.cc:1288
static WifiMode GetHtMcs18()
Return MCS 18 from HT MCS values.
Definition: wifi-phy.cc:1368
void NotifyTxBegin(Ptr< const Packet > packet)
Public method used to fire a PhyTxBegin trace.
Definition: wifi-phy.cc:723
static WifiMode GetVhtMcs4()
Return MCS 4 from VHT MCS values.
Definition: wifi-phy.cc:1515
static WifiMode GetHtMcs27()
Return MCS 27 from HT MCS values.
Definition: wifi-phy.cc:1440
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:99
static WifiMode GetOfdmRate36Mbps()
Return a WifiMode for OFDM at 36Mbps.
Definition: wifi-phy.cc:987
Time GetPayloadDuration(uint32_t size, WifiTxVector txVector, WifiPreamble preamble, double frequency)
Definition: wifi-phy.cc:398
static WifiMode CreateWifiMcs(std::string uniqueName, uint8_t mcsValue, enum WifiModulationClass modClass)
Definition: wifi-mode.cc:588
static WifiMode GetVhtMcs7()
Return MCS 7 from VHT MCS values.
Definition: wifi-phy.cc:1539
static WifiMode GetOfdmRate6MbpsBW5MHz()
Return a WifiMode for OFDM at 6Mbps with 5MHz channel spacing.
Definition: wifi-phy.cc:1173
static WifiMode GetVhtMcs3()
Return MCS 3 from VHT MCS values.
Definition: wifi-phy.cc:1507
void NotifyMonitorSniffRx(Ptr< const Packet > packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, WifiPreamble preamble, WifiTxVector txVector, struct mpduInfo aMpdu, struct signalNoiseDbm signalNoise)
Public method used to fire a MonitorSniffer trace for a wifi packet being received.
Definition: wifi-phy.cc:759
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
static WifiMode GetVhtPlcpHeaderMode(WifiMode payloadMode)
Definition: wifi-phy.cc:128
static WifiMode GetHtMcs16()
Return MCS 16 from HT MCS values.
Definition: wifi-phy.cc:1352
static WifiMode GetErpOfdmRate54Mbps()
Return a WifiMode for ERP-OFDM at 54Mbps.
Definition: wifi-phy.cc:912
static WifiMode GetHtMcs29()
Return MCS 29 from HT MCS values.
Definition: wifi-phy.cc:1456
static WifiMode GetHtMcs11()
Return MCS 11 from HT MCS values.
Definition: wifi-phy.cc:1312
void NotifyRxDrop(Ptr< const Packet > packet)
Public method used to fire a PhyRxDrop trace.
Definition: wifi-phy.cc:753
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
Definition: wifi-preamble.h:30
TracedCallback< Ptr< const Packet >, uint16_t, uint16_t, uint32_t, WifiPreamble, WifiTxVector, struct mpduInfo, struct signalNoiseDbm > m_phyMonitorSniffRxTrace
A trace source that emulates a wifi device in monitor mode sniffing a packet being received...
Definition: wifi-phy.h:1363
The MPDU is not part of an A-MPDU.
Definition: wifi-phy.h:48
static WifiMode GetHtMcs2()
Return MCS 2 from HT MCS values.
Definition: wifi-phy.cc:1240
Time CalculatePlcpPreambleAndHeaderDuration(WifiTxVector txVector, enum WifiPreamble preamble)
Definition: wifi-phy.cc:696
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:919
TracedCallback< Ptr< const Packet > > m_phyTxDropTrace
The trace source fired when the phy layer drops a packet as it tries to transmit it.
Definition: wifi-phy.h:1325
static WifiMode GetPlcpHeaderMode(WifiMode payloadMode, WifiPreamble preamble, WifiTxVector txVector)
Definition: wifi-phy.cc:237
The PHY layer is IDLE.
Definition: wifi-phy.h:162
static WifiMode GetHtMcs12()
Return MCS 12 from HT MCS values.
Definition: wifi-phy.cc:1320
static WifiMode GetErpOfdmRate48Mbps()
Return a WifiMode for ERP-OFDM at 48Mbps.
Definition: wifi-phy.cc:900
uint8_t GetNess(void) const
static WifiMode GetOfdmRate12MbpsBW10MHz()
Return a WifiMode for OFDM at 12Mbps with 10MHz channel spacing.
Definition: wifi-phy.cc:1074
uint32_t GetChannelWidth(void) const
HT PHY (Clause 20)
Definition: wifi-mode.h:62
uint8_t GetMcsValue(void) const
Definition: wifi-mode.cc:364
std::string GetUniqueName(void) const
Definition: wifi-mode.cc:349
Time CalculateTxDuration(uint32_t size, WifiTxVector txVector, enum WifiPreamble preamble, double frequency)
Definition: wifi-phy.cc:717
The PHY layer is receiving a packet.
Definition: wifi-phy.h:174
TracedCallback< Ptr< const Packet > > m_phyRxDropTrace
The trace source fired when the phy layer drops a packet it has received.
Definition: wifi-phy.h:1348
virtual ~WifiPhyListener()
Definition: wifi-phy.cc:44
void NotifyRxBegin(Ptr< const Packet > packet)
Public method used to fire a PhyRxBegin trace.
Definition: wifi-phy.cc:741
The PHY layer is sending a packet.
Definition: wifi-phy.h:170
static WifiMode GetOfdmRate18Mbps()
Return a WifiMode for OFDM at 18Mbps.
Definition: wifi-phy.cc:963
static WifiMode GetOfdmRate9MbpsBW10MHz()
Return a WifiMode for OFDM at 9Mbps with 10MHz channel spacing.
Definition: wifi-phy.cc:1062
bool IsStbc(void) const
Check if STBC is used or not.
static WifiMode GetOfdmRate12MbpsBW5MHz()
Return a WifiMode for OFDM at 12Mbps with 5MHz channel spacing.
Definition: wifi-phy.cc:1197
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:252
The PHY layer is switching to other channel.
Definition: wifi-phy.h:178
TracedCallback< Ptr< const Packet > > m_phyTxBeginTrace
The trace source fired when a packet begins the transmission process on the medium.
Definition: wifi-phy.h:1309
The MPDU is part of an A-MPDU, but is not the last aggregate.
Definition: wifi-phy.h:50
static WifiMode GetVhtMcs1()
Return MCS 1 from VHT MCS values.
Definition: wifi-phy.cc:1491
static WifiMode GetOfdmRate48Mbps()
Return a WifiMode for OFDM at 48Mbps.
Definition: wifi-phy.cc:999
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
Definition: angles.cc:42
static WifiMode GetHtMcs0()
Return MCS 0 from HT MCS values.
Definition: wifi-phy.cc:1224
static TypeId GetTypeId(void)
Definition: wifi-phy.cc:55
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static bool IsValidTxVector(WifiTxVector txVector)
The standard disallows certain combinations of WifiMode, number of spatial streams, and channel widths.
Definition: wifi-phy.cc:1563
TracedCallback< Ptr< const Packet >, uint16_t, uint16_t, uint32_t, WifiPreamble, WifiTxVector, struct mpduInfo > m_phyMonitorSniffTxTrace
A trace source that emulates a wifi device in monitor mode sniffing a packet being transmitted...
Definition: wifi-phy.h:1378
static WifiMode GetOfdmRate24Mbps()
Return a WifiMode for OFDM at 24Mbps.
Definition: wifi-phy.cc:975
static WifiMode GetHtMcs13()
Return MCS 13 from HT MCS values.
Definition: wifi-phy.cc:1328
static WifiMode GetHtMcs20()
Return MCS 20 from HT MCS values.
Definition: wifi-phy.cc:1384
static WifiMode GetHtMcs5()
Return MCS 5 from HT MCS values.
Definition: wifi-phy.cc:1264
uint64_t GetDataRate(uint32_t channelWidth, bool isShortGuardInterval, uint8_t nss) const
Definition: wifi-mode.cc:109
static WifiMode GetVhtMcs2()
Return MCS 2 from VHT MCS values.
Definition: wifi-phy.cc:1499
static WifiMode GetDsssRate5_5Mbps()
Return a WifiMode for DSSS at 5.5Mbps.
Definition: wifi-phy.cc:801
static WifiMode GetOfdmRate2_25MbpsBW5MHz()
Return a WifiMode for OFDM at 2.25Mbps with 5MHz channel spacing.
Definition: wifi-phy.cc:1137
static Time GetPlcpVhtSigA1Duration(WifiPreamble preamble)
Definition: wifi-phy.cc:195
static WifiMode GetErpOfdmRate9Mbps()
Return a WifiMode for ERP-OFDM at 9Mbps.
Definition: wifi-phy.cc:840
void NotifyTxEnd(Ptr< const Packet > packet)
Public method used to fire a PhyTxEnd trace.
Definition: wifi-phy.cc:729
static WifiMode CreateWifiMode(std::string uniqueName, enum WifiModulationClass modClass, bool isMandatory, enum WifiCodeRate codingRate, uint16_t constellationSize)
Definition: wifi-mode.cc:550
int64_t GetNanoSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:353
No explicit coding (e.g., DSSS rates)
Definition: wifi-mode.h:77
static WifiMode GetErpOfdmRate6Mbps()
Return a WifiMode for ERP-OFDM at 6Mbps.
Definition: wifi-phy.cc:828
uint8_t GetNss(void) const
static WifiMode GetErpOfdmRate12Mbps()
Return a WifiMode for ERP-OFDM at 12Mbps.
Definition: wifi-phy.cc:852
void NotifyRxEnd(Ptr< const Packet > packet)
Public method used to fire a PhyRxEnd trace.
Definition: wifi-phy.cc:747
static WifiMode GetHtMcs19()
Return MCS 19 from HT MCS values.
Definition: wifi-phy.cc:1376
static WifiMode GetHtMcs6()
Return MCS 6 from HT MCS values.
Definition: wifi-phy.cc:1272
OFDM PHY (Clause 17)
Definition: wifi-mode.h:60
double m_totalAmpduNumSymbols
Number of symbols previously transmitted for the MPDUs in an A-MPDU, used for the computation of the ...
Definition: wifi-phy.h:1380
static WifiMode GetHtMcs28()
Return MCS 28 from HT MCS values.
Definition: wifi-phy.cc:1448
static WifiMode GetHtMcs9()
Return MCS 9 from HT MCS values.
Definition: wifi-phy.cc:1296
static Time GetPlcpHeaderDuration(WifiTxVector txVector, WifiPreamble preamble)
Definition: wifi-phy.cc:282
static WifiMode GetHtMcs4()
Return MCS 4 from HT MCS values.
Definition: wifi-phy.cc:1256
static WifiMode GetHtMcs25()
Return MCS 25 from HT MCS values.
Definition: wifi-phy.cc:1424
uint32_t m_totalAmpduSize
Total size of the previously transmitted MPDUs in an A-MPDU, used for the computation of the number o...
Definition: wifi-phy.h:1381
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:911
static WifiMode GetHtMcs1()
Return MCS 1 from HT MCS values.
Definition: wifi-phy.cc:1232
static WifiMode GetHtMcs23()
Return MCS 23 from HT MCS values.
Definition: wifi-phy.cc:1408
A base class which provides memory management and object aggregation.
Definition: object.h:87
static WifiMode GetDsssRate2Mbps()
Return a WifiMode for DSSS at 2Mbps.
Definition: wifi-phy.cc:786
static WifiMode GetVhtMcs9()
Return MCS 9 from VHT MCS values.
Definition: wifi-phy.cc:1555
static WifiMode GetOfdmRate6MbpsBW10MHz()
Return a WifiMode for OFDM at 6Mbps with 10MHz channel spacing.
Definition: wifi-phy.cc:1050
WifiMode GetMode(void) const
State
The state of the PHY layer.
Definition: wifi-phy.h:157
static Time GetPlcpHtTrainingSymbolDuration(WifiPreamble preamble, WifiTxVector txVector)
Definition: wifi-phy.cc:134
static WifiMode GetOfdmRate24MbpsBW10MHz()
Return a WifiMode for OFDM at 24Mbps with 10MHz channel spacing.
Definition: wifi-phy.cc:1098
static Time GetPlcpVhtSigBDuration(WifiPreamble preamble)
Definition: wifi-phy.cc:223
static WifiMode GetOfdmRate13_5MbpsBW5MHz()
Return a WifiMode for OFDM at 13.5Mbps with 5MHz channel spacing.
Definition: wifi-phy.cc:1209
a unique identifier for an interface.
Definition: type-id.h:58
static WifiMode GetHtMcs15()
Return MCS 15 from HT MCS values.
Definition: wifi-phy.cc:1344
static Time GetPlcpPreambleDuration(WifiTxVector txVector, WifiPreamble preamble)
Definition: wifi-phy.cc:346
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:826
static WifiMode GetHtMcs3()
Return MCS 3 from HT MCS values.
Definition: wifi-phy.cc:1248
static WifiMode GetOfdmRate6Mbps()
Return a WifiMode for OFDM at 6Mbps.
Definition: wifi-phy.cc:927
DSSS PHY (Clause 15)
Definition: wifi-mode.h:50
static Time GetPlcpVhtSigA2Duration(WifiPreamble preamble)
Definition: wifi-phy.cc:209
static WifiMode GetOfdmRate4_5MbpsBW5MHz()
Return a WifiMode for OFDM at 4.5Mbps with 5MHz channel spacing.
Definition: wifi-phy.cc:1161
mpduType
This enumeration defines the type of an MPDU.
Definition: wifi-phy.h:45
static WifiMode GetOfdmRate3MbpsBW10MHz()
Return a WifiMode for OFDM at 3Mbps with 10MHz channel spacing.
Definition: wifi-phy.cc:1026
TracedCallback< Ptr< const Packet > > m_phyTxEndTrace
The trace source fired when a packet ends the transmission process on the medium. ...
Definition: wifi-phy.h:1317
The MPDU is the last aggregate in an A-MPDU.
Definition: wifi-phy.h:52