A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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  */
20 
21 #include "wifi-phy.h"
22 #include "wifi-mode.h"
23 #include "wifi-channel.h"
24 #include "wifi-preamble.h"
25 #include "ns3/simulator.h"
26 #include "ns3/packet.h"
27 #include "ns3/assert.h"
28 #include "ns3/log.h"
29 #include "ns3/double.h"
30 #include "ns3/uinteger.h"
31 #include "ns3/enum.h"
32 #include "ns3/trace-source-accessor.h"
33 #include <cmath>
34 
35 NS_LOG_COMPONENT_DEFINE ("WifiPhy");
36 
37 namespace ns3 {
38 
39 /****************************************************************
40  * This destructor is needed.
41  ****************************************************************/
42 
44 {
45 }
46 
47 /****************************************************************
48  * The actual WifiPhy class
49  ****************************************************************/
50 
52 
53 TypeId
55 {
56  static TypeId tid = TypeId ("ns3::WifiPhy")
57  .SetParent<Object> ()
58  .AddTraceSource ("PhyTxBegin",
59  "Trace source indicating a packet has begun transmitting over the channel medium",
61  .AddTraceSource ("PhyTxEnd",
62  "Trace source indicating a packet has been completely transmitted over the channel. NOTE: the only official WifiPhy implementation available to this date (YansWifiPhy) never fires this trace source.",
64  .AddTraceSource ("PhyTxDrop",
65  "Trace source indicating a packet has been dropped by the device during transmission",
67  .AddTraceSource ("PhyRxBegin",
68  "Trace source indicating a packet has begun being received from the channel medium by the device",
70  .AddTraceSource ("PhyRxEnd",
71  "Trace source indicating a packet has been completely received from the channel medium by the device",
73  .AddTraceSource ("PhyRxDrop",
74  "Trace source indicating a packet has been dropped by the device during reception",
76  .AddTraceSource ("MonitorSnifferRx",
77  "Trace source simulating a wifi device in monitor mode sniffing all received frames",
79  .AddTraceSource ("MonitorSnifferTx",
80  "Trace source simulating the capability of a wifi device in monitor mode to sniff all frames being transmitted",
82  ;
83  return tid;
84 }
85 
87 {
88  NS_LOG_FUNCTION (this);
89 }
90 
92 {
93  NS_LOG_FUNCTION (this);
94 }
95 
96 //Added by Ghada to support 11n
97 
98 //return the L-SIG
101 {
102  switch (payloadMode.GetBandwidth ())
103  {
104  case 20000000:
106  case 40000000:
108  default:
110  }
111 }
112 uint32_t
114 {
115  switch (preamble)
116  {
117  case WIFI_PREAMBLE_HT_MF:
118  return 4+ (4* txvector.GetNss());
119  case WIFI_PREAMBLE_HT_GF:
120  return (4*txvector.GetNss())+(4*txvector.GetNess());
121  default:
122  // no training for non HT
123  return 0;
124  }
125 }
126 
127 //return L-SIG
128 uint32_t
130 {
131  switch (preamble)
132  {
133  case WIFI_PREAMBLE_HT_MF:
134  // HT-SIG
135  return 8;
136  case WIFI_PREAMBLE_HT_GF:
137  //HT-SIG
138  return 8;
139  default:
140  // no HT-SIG for non HT
141  return 0;
142  }
143 
144 }
145 //end added by Ghada
146 
147 WifiMode
149 {
150  switch (payloadMode.GetModulationClass ())
151  {
152  case WIFI_MOD_CLASS_OFDM:
153  {
154  switch (payloadMode.GetBandwidth ())
155  {
156  case 5000000:
158  case 10000000:
160  default:
161  // IEEE Std 802.11-2007, 17.3.2
162  // actually this is only the first part of the PlcpHeader,
163  // because the last 16 bits of the PlcpHeader are using the
164  // same mode of the payload
165  return WifiPhy::GetOfdmRate6Mbps ();
166  }
167  }
168  //Added by Ghada to support 11n
169  case WIFI_MOD_CLASS_HT:
170  { //return the HT-SIG
171  // IEEE Std 802.11n, 20.3.23
172  switch (preamble)
173  {
174  case WIFI_PREAMBLE_HT_MF:
175  switch (payloadMode.GetBandwidth ())
176  {
177  case 20000000:
179  case 40000000:
181  default:
183  }
184  case WIFI_PREAMBLE_HT_GF:
185  switch (payloadMode.GetBandwidth ())
186  {
187  case 20000000:
189  case 40000000:
191  default:
193  }
194  default:
195  return WifiPhy::GetOfdmRate6Mbps ();
196  }
197  }
200 
201  case WIFI_MOD_CLASS_DSSS:
202  if (preamble == WIFI_PREAMBLE_LONG)
203  {
204  // IEEE Std 802.11-2007, sections 15.2.3 and 18.2.2.1
205  return WifiPhy::GetDsssRate1Mbps ();
206  }
207  else // WIFI_PREAMBLE_SHORT
208  {
209  // IEEE Std 802.11-2007, section 18.2.2.2
210  return WifiPhy::GetDsssRate2Mbps ();
211  }
212 
213  default:
214  NS_FATAL_ERROR ("unsupported modulation class");
215  return WifiMode ();
216  }
217 }
218 
219 
220 uint32_t
222 {
223  switch (payloadMode.GetModulationClass ())
224  {
225  case WIFI_MOD_CLASS_OFDM:
226  {
227  switch (payloadMode.GetBandwidth ())
228  {
229  case 20000000:
230  default:
231  // IEEE Std 802.11-2007, section 17.3.3 and figure 17-4
232  // also section 17.3.2.3, table 17-4
233  // We return the duration of the SIGNAL field only, since the
234  // SERVICE field (which strictly speaking belongs to the PLCP
235  // header, see section 17.3.2 and figure 17-1) is sent using the
236  // payload mode.
237  return 4;
238  case 10000000:
239  // IEEE Std 802.11-2007, section 17.3.2.3, table 17-4
240  return 8;
241  case 5000000:
242  // IEEE Std 802.11-2007, section 17.3.2.3, table 17-4
243  return 16;
244  }
245  }
246  //Added by Ghada to support 11n
247  case WIFI_MOD_CLASS_HT:
248  { //IEEE 802.11n Figure 20.1
249  switch (preamble)
250  {
251  case WIFI_PREAMBLE_HT_MF:
252  // L-SIG
253  return 4;
254  case WIFI_PREAMBLE_HT_GF:
255  //L-SIG
256  return 0;
257  default:
258  // L-SIG
259  return 4;
260  }
261  }
263  return 16;
264 
265  case WIFI_MOD_CLASS_DSSS:
266  if (preamble == WIFI_PREAMBLE_SHORT)
267  {
268  // IEEE Std 802.11-2007, section 18.2.2.2 and figure 18-2
269  return 24;
270  }
271  else // WIFI_PREAMBLE_LONG
272  {
273  // IEEE Std 802.11-2007, sections 18.2.2.1 and figure 18-1
274  return 48;
275  }
276 
277  default:
278  NS_FATAL_ERROR ("unsupported modulation class");
279  return 0;
280  }
281 }
282 
283 uint32_t
285 {
286  switch (payloadMode.GetModulationClass ())
287  {
288  case WIFI_MOD_CLASS_OFDM:
289  {
290  switch (payloadMode.GetBandwidth ())
291  {
292  case 20000000:
293  default:
294  // IEEE Std 802.11-2007, section 17.3.3, figure 17-4
295  // also section 17.3.2.3, table 17-4
296  return 16;
297  case 10000000:
298  // IEEE Std 802.11-2007, section 17.3.3, table 17-4
299  // also section 17.3.2.3, table 17-4
300  return 32;
301  case 5000000:
302  // IEEE Std 802.11-2007, section 17.3.3
303  // also section 17.3.2.3, table 17-4
304  return 64;
305  }
306  }
307  case WIFI_MOD_CLASS_HT:
308  { //IEEE 802.11n Figure 20.1 the training symbols before L_SIG or HT_SIG
309  return 16;
310  }
312  return 4;
313 
314  case WIFI_MOD_CLASS_DSSS:
315  if (preamble == WIFI_PREAMBLE_SHORT)
316  {
317  // IEEE Std 802.11-2007, section 18.2.2.2 and figure 18-2
318  return 72;
319  }
320  else // WIFI_PREAMBLE_LONG
321  {
322  // IEEE Std 802.11-2007, sections 18.2.2.1 and figure 18-1
323  return 144;
324  }
325  default:
326  NS_FATAL_ERROR ("unsupported modulation class");
327  return 0;
328  }
329 }
330 
331 double
333 {
334  WifiMode payloadMode=txvector.GetMode();
335 
336  NS_LOG_FUNCTION (size << payloadMode);
337 
338  switch (payloadMode.GetModulationClass ())
339  {
340  case WIFI_MOD_CLASS_OFDM:
342  {
343  // IEEE Std 802.11-2007, section 17.3.2.3, table 17-4
344  // corresponds to T_{SYM} in the table
345  uint32_t symbolDurationUs;
346 
347  switch (payloadMode.GetBandwidth ())
348  {
349  case 20000000:
350  default:
351  symbolDurationUs = 4;
352  break;
353  case 10000000:
354  symbolDurationUs = 8;
355  break;
356  case 5000000:
357  symbolDurationUs = 16;
358  break;
359  }
360 
361  // IEEE Std 802.11-2007, section 17.3.2.2, table 17-3
362  // corresponds to N_{DBPS} in the table
363  double numDataBitsPerSymbol = payloadMode.GetDataRate () * symbolDurationUs / 1e6;
364 
365  // IEEE Std 802.11-2007, section 17.3.5.3, equation (17-11)
366  uint32_t numSymbols = lrint (ceil ((16 + size * 8.0 + 6.0) / numDataBitsPerSymbol));
367 
368  // Add signal extension for ERP PHY
369  if (payloadMode.GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM)
370  {
371  return numSymbols * symbolDurationUs + 6;
372  }
373  else
374  {
375  return numSymbols * symbolDurationUs;
376  }
377  }
378  case WIFI_MOD_CLASS_HT:
379  {
380  double symbolDurationUs;
381  double m_Stbc;
382  //if short GI data rate is used then symbol duration is 3.6us else symbol duration is 4us
383  //In the future has to create a stationmanager that only uses these data rates if sender and reciever support GI
384  if (payloadMode.GetUniqueName() == "OfdmRate135MbpsBW40MHzShGi" || payloadMode.GetUniqueName() == "OfdmRate65MbpsBW20MHzShGi" )
385  {
386  symbolDurationUs=3.6;
387  }
388  else
389  {
390  switch (payloadMode.GetDataRate ()/ (txvector.GetNss()))
391  { //shortGi
392  case 7200000:
393  case 14400000:
394  case 21700000:
395  case 28900000:
396  case 43300000:
397  case 57800000:
398  case 72200000:
399  case 15000000:
400  case 30000000:
401  case 45000000:
402  case 60000000:
403  case 90000000:
404  case 120000000:
405  case 150000000:
406  symbolDurationUs=3.6;
407  break;
408  default:
409  symbolDurationUs=4;
410  }
411  }
412  if (txvector.IsStbc())
413  m_Stbc=2;
414  else
415  m_Stbc=1;
416  double numDataBitsPerSymbol = payloadMode.GetDataRate () *txvector.GetNss() * symbolDurationUs / 1e6;
417  //check tables 20-35 and 20-36 in the standard to get cases when nes =2
418  double Nes=1;
419  // IEEE Std 802.11n, section 20.3.11, equation (20-32)
420  uint32_t numSymbols = lrint (m_Stbc*ceil ((16 + size * 8.0 + 6.0*Nes) / (m_Stbc* numDataBitsPerSymbol)));
421 
422  return numSymbols * symbolDurationUs;
423 
424  }
425  case WIFI_MOD_CLASS_DSSS:
426  // IEEE Std 802.11-2007, section 18.2.3.5
427  NS_LOG_LOGIC (" size=" << size
428  << " mode=" << payloadMode
429  << " rate=" << payloadMode.GetDataRate () );
430  return lrint (ceil ((size * 8.0) / (payloadMode.GetDataRate () / 1.0e6)));
431 
432  default:
433  NS_FATAL_ERROR ("unsupported modulation class");
434  return 0;
435  }
436 }
437 
438 Time
439 WifiPhy::CalculateTxDuration (uint32_t size, WifiTxVector txvector, WifiPreamble preamble)
440 {
441  WifiMode payloadMode=txvector.GetMode();
442  double duration = GetPlcpPreambleDurationMicroSeconds (payloadMode, preamble)
443  + GetPlcpHeaderDurationMicroSeconds (payloadMode, preamble)
444  + GetPlcpHtSigHeaderDurationMicroSeconds (payloadMode, preamble)
445  + GetPlcpHtTrainingSymbolDurationMicroSeconds (payloadMode, preamble,txvector)
446  + GetPayloadDurationMicroSeconds (size, txvector);
447  return MicroSeconds (duration);
448 }
449 
450 
451 
452 void
454 {
455  m_phyTxBeginTrace (packet);
456 }
457 
458 void
460 {
461  m_phyTxEndTrace (packet);
462 }
463 
464 void
466 {
467  m_phyTxDropTrace (packet);
468 }
469 
470 void
472 {
473  m_phyRxBeginTrace (packet);
474 }
475 
476 void
478 {
479  m_phyRxEndTrace (packet);
480 }
481 
482 void
484 {
485  m_phyRxDropTrace (packet);
486 }
487 
488 void
489 WifiPhy::NotifyMonitorSniffRx (Ptr<const Packet> packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble, double signalDbm, double noiseDbm)
490 {
491  m_phyMonitorSniffRxTrace (packet, channelFreqMhz, channelNumber, rate, isShortPreamble, signalDbm, noiseDbm);
492 }
493 
494 void
495 WifiPhy::NotifyMonitorSniffTx (Ptr<const Packet> packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble, uint8_t txPower)
496 {
497  m_phyMonitorSniffTxTrace (packet, channelFreqMhz, channelNumber, rate, isShortPreamble, txPower);
498 }
499 
500 
505 WifiMode
507 {
508  static WifiMode mode =
509  WifiModeFactory::CreateWifiMode ("DsssRate1Mbps",
511  true,
512  22000000, 1000000,
514  2);
515  return mode;
516 }
517 
518 WifiMode
520 {
521  static WifiMode mode =
522  WifiModeFactory::CreateWifiMode ("DsssRate2Mbps",
524  true,
525  22000000, 2000000,
527  4);
528  return mode;
529 }
530 
531 
535 WifiMode
537 {
538  static WifiMode mode =
539  WifiModeFactory::CreateWifiMode ("DsssRate5_5Mbps",
541  true,
542  22000000, 5500000,
544  4);
545  return mode;
546 }
547 
548 WifiMode
550 {
551  static WifiMode mode =
552  WifiModeFactory::CreateWifiMode ("DsssRate11Mbps",
554  true,
555  22000000, 11000000,
557  4);
558  return mode;
559 }
560 
561 
565 WifiMode
567 {
568  static WifiMode mode =
569  WifiModeFactory::CreateWifiMode ("ErpOfdmRate6Mbps",
571  true,
572  20000000, 6000000,
574  2);
575  return mode;
576 }
577 
578 WifiMode
580 {
581  static WifiMode mode =
582  WifiModeFactory::CreateWifiMode ("ErpOfdmRate9Mbps",
584  false,
585  20000000, 9000000,
587  2);
588  return mode;
589 }
590 
591 WifiMode
593 {
594  static WifiMode mode =
595  WifiModeFactory::CreateWifiMode ("ErpOfdmRate12Mbps",
597  true,
598  20000000, 12000000,
600  4);
601  return mode;
602 }
603 
604 WifiMode
606 {
607  static WifiMode mode =
608  WifiModeFactory::CreateWifiMode ("ErpOfdmRate18Mbps",
610  false,
611  20000000, 18000000,
613  4);
614  return mode;
615 }
616 
617 WifiMode
619 {
620  static WifiMode mode =
621  WifiModeFactory::CreateWifiMode ("ErpOfdmRate24Mbps",
623  true,
624  20000000, 24000000,
626  16);
627  return mode;
628 }
629 
630 WifiMode
632 {
633  static WifiMode mode =
634  WifiModeFactory::CreateWifiMode ("ErpOfdmRate36Mbps",
636  false,
637  20000000, 36000000,
639  16);
640  return mode;
641 }
642 
643 WifiMode
645 {
646  static WifiMode mode =
647  WifiModeFactory::CreateWifiMode ("ErpOfdmRate48Mbps",
649  false,
650  20000000, 48000000,
652  64);
653  return mode;
654 }
655 
656 WifiMode
658 {
659  static WifiMode mode =
660  WifiModeFactory::CreateWifiMode ("ErpOfdmRate54Mbps",
662  false,
663  20000000, 54000000,
665  64);
666  return mode;
667 }
668 
669 
673 WifiMode
675 {
676  static WifiMode mode =
677  WifiModeFactory::CreateWifiMode ("OfdmRate6Mbps",
679  true,
680  20000000, 6000000,
682  2);
683  return mode;
684 }
685 
686 WifiMode
688 {
689  static WifiMode mode =
690  WifiModeFactory::CreateWifiMode ("OfdmRate9Mbps",
692  false,
693  20000000, 9000000,
695  2);
696  return mode;
697 }
698 
699 WifiMode
701 {
702  static WifiMode mode =
703  WifiModeFactory::CreateWifiMode ("OfdmRate12Mbps",
705  true,
706  20000000, 12000000,
708  4);
709  return mode;
710 }
711 
712 WifiMode
714 {
715  static WifiMode mode =
716  WifiModeFactory::CreateWifiMode ("OfdmRate18Mbps",
718  false,
719  20000000, 18000000,
721  4);
722  return mode;
723 }
724 
725 WifiMode
727 {
728  static WifiMode mode =
729  WifiModeFactory::CreateWifiMode ("OfdmRate24Mbps",
731  true,
732  20000000, 24000000,
734  16);
735  return mode;
736 }
737 
738 WifiMode
740 {
741  static WifiMode mode =
742  WifiModeFactory::CreateWifiMode ("OfdmRate36Mbps",
744  false,
745  20000000, 36000000,
747  16);
748  return mode;
749 }
750 
751 WifiMode
753 {
754  static WifiMode mode =
755  WifiModeFactory::CreateWifiMode ("OfdmRate48Mbps",
757  false,
758  20000000, 48000000,
760  64);
761  return mode;
762 }
763 
764 WifiMode
766 {
767  static WifiMode mode =
768  WifiModeFactory::CreateWifiMode ("OfdmRate54Mbps",
770  false,
771  20000000, 54000000,
773  64);
774  return mode;
775 }
776 
777 /* 10 MHz channel rates */
778 WifiMode
780 {
781  static WifiMode mode =
782  WifiModeFactory::CreateWifiMode ("OfdmRate3MbpsBW10MHz",
784  true,
785  10000000, 3000000,
787  2);
788  return mode;
789 }
790 
791 WifiMode
793 {
794  static WifiMode mode =
795  WifiModeFactory::CreateWifiMode ("OfdmRate4_5MbpsBW10MHz",
797  false,
798  10000000, 4500000,
800  2);
801  return mode;
802 }
803 
804 WifiMode
806 {
807  static WifiMode mode =
808  WifiModeFactory::CreateWifiMode ("OfdmRate6MbpsBW10MHz",
810  true,
811  10000000, 6000000,
813  4);
814  return mode;
815 }
816 
817 WifiMode
819 {
820  static WifiMode mode =
821  WifiModeFactory::CreateWifiMode ("OfdmRate9MbpsBW10MHz",
823  false,
824  10000000, 9000000,
826  4);
827  return mode;
828 }
829 
830 WifiMode
832 {
833  static WifiMode mode =
834  WifiModeFactory::CreateWifiMode ("OfdmRate12MbpsBW10MHz",
836  true,
837  10000000, 12000000,
839  16);
840  return mode;
841 }
842 
843 WifiMode
845 {
846  static WifiMode mode =
847  WifiModeFactory::CreateWifiMode ("OfdmRate18MbpsBW10MHz",
849  false,
850  10000000, 18000000,
852  16);
853  return mode;
854 }
855 
856 WifiMode
858 {
859  static WifiMode mode =
860  WifiModeFactory::CreateWifiMode ("OfdmRate24MbpsBW10MHz",
862  false,
863  10000000, 24000000,
865  64);
866  return mode;
867 }
868 
869 WifiMode
871 {
872  static WifiMode mode =
873  WifiModeFactory::CreateWifiMode ("OfdmRate27MbpsBW10MHz",
875  false,
876  10000000, 27000000,
878  64);
879  return mode;
880 }
881 
882 /* 5 MHz channel rates */
883 WifiMode
885 {
886  static WifiMode mode =
887  WifiModeFactory::CreateWifiMode ("OfdmRate1_5MbpsBW5MHz",
889  true,
890  5000000, 1500000,
892  2);
893  return mode;
894 }
895 
896 WifiMode
898 {
899  static WifiMode mode =
900  WifiModeFactory::CreateWifiMode ("OfdmRate2_25MbpsBW5MHz",
902  false,
903  5000000, 2250000,
905  2);
906  return mode;
907 }
908 
909 WifiMode
911 {
912  static WifiMode mode =
913  WifiModeFactory::CreateWifiMode ("OfdmRate3MbpsBW5MHz",
915  true,
916  5000000, 3000000,
918  4);
919  return mode;
920 }
921 
922 WifiMode
924 {
925  static WifiMode mode =
926  WifiModeFactory::CreateWifiMode ("OfdmRate4_5MbpsBW5MHz",
928  false,
929  5000000, 4500000,
931  4);
932  return mode;
933 }
934 
935 WifiMode
937 {
938  static WifiMode mode =
939  WifiModeFactory::CreateWifiMode ("OfdmRate6MbpsBW5MHz",
941  true,
942  5000000, 6000000,
944  16);
945  return mode;
946 }
947 
948 WifiMode
950 {
951  static WifiMode mode =
952  WifiModeFactory::CreateWifiMode ("OfdmRate9MbpsBW5MHz",
954  false,
955  5000000, 9000000,
957  16);
958  return mode;
959 }
960 
961 WifiMode
963 {
964  static WifiMode mode =
965  WifiModeFactory::CreateWifiMode ("OfdmRate12MbpsBW5MHz",
967  false,
968  5000000, 12000000,
970  64);
971  return mode;
972 }
973 
974 WifiMode
976 {
977  static WifiMode mode =
978  WifiModeFactory::CreateWifiMode ("OfdmRate13_5MbpsBW5MHz",
980  false,
981  5000000, 13500000,
983  64);
984  return mode;
985 }
986 
987 /*Clause 20*/
988 
989 WifiMode
991 {
992  static WifiMode mode =
993  WifiModeFactory::CreateWifiMode ("OfdmRate6_5MbpsBW20MHz",
995  true,
996  20000000, 6500000,
998  2);
999  return mode;
1000 }
1001 WifiMode
1003 {
1004  static WifiMode mode =
1005  WifiModeFactory::CreateWifiMode ("OfdmRate7_2MbpsBW20MHz",
1007  false,
1008  20000000, 7200000,
1010  2);
1011  return mode;
1012 }
1013 
1014 WifiMode
1016 {
1017  static WifiMode mode =
1018  WifiModeFactory::CreateWifiMode ("OfdmRate13MbpsBW20MHz",
1020  true,
1021  20000000, 13000000,
1023  4);
1024  return mode;
1025 }
1026 
1027 WifiMode
1029 {
1030  static WifiMode mode =
1031  WifiModeFactory::CreateWifiMode ("OfdmRate14_4MbpsBW20MHz",
1033  false,
1034  20000000, 14400000,
1036  4);
1037  return mode;
1038 }
1039 WifiMode
1041 {
1042  static WifiMode mode =
1043  WifiModeFactory::CreateWifiMode ("OfdmRate19_5MbpsBW20MHz",
1045  true,
1046  20000000, 19500000,
1048  4);
1049  return mode;
1050 }
1051 
1052 WifiMode
1054 {
1055  static WifiMode mode =
1056  WifiModeFactory::CreateWifiMode ("OfdmRate21_7MbpsBW20MHz",
1058  false,
1059  20000000, 21700000,
1061  4);
1062  return mode;
1063 }
1064 
1065 
1066 WifiMode
1068 {
1069  static WifiMode mode =
1070  WifiModeFactory::CreateWifiMode ("OfdmRate26MbpsBW20MHz",
1072  true,
1073  20000000, 26000000,
1075  16);
1076  return mode;
1077 }
1078 
1079 WifiMode
1081 {
1082  static WifiMode mode =
1083  WifiModeFactory::CreateWifiMode ("OfdmRate28_9MbpsBW20MHz",
1085  false,
1086  20000000, 28900000,
1088  16);
1089  return mode;
1090 }
1091 
1092 WifiMode
1094 {
1095  static WifiMode mode =
1096  WifiModeFactory::CreateWifiMode ("OfdmRate39MbpsBW20MHz",
1098  true,
1099  20000000, 39000000,
1101  16);
1102  return mode;
1103 }
1104 
1105 WifiMode
1107 {
1108  static WifiMode mode =
1109  WifiModeFactory::CreateWifiMode ("OfdmRate43_3MbpsBW20MHz",
1111  false,
1112  20000000, 43300000,
1114  16);
1115  return mode;
1116 }
1117 
1118 WifiMode
1120 {
1121  static WifiMode mode =
1122  WifiModeFactory::CreateWifiMode ("OfdmRate52MbpsBW20MHz",
1124  true,
1125  20000000, 52000000,
1127  64);
1128  return mode;
1129 }
1130 
1131 WifiMode
1133 {
1134  static WifiMode mode =
1135  WifiModeFactory::CreateWifiMode ("OfdmRate57_8MbpsBW20MHz",
1137  false,
1138  20000000, 57800000,
1140  64);
1141  return mode;
1142 }
1143 
1144 
1145 WifiMode
1147 {
1148  static WifiMode mode =
1149  WifiModeFactory::CreateWifiMode ("OfdmRate58_5MbpsBW20MHz",
1151  true,
1152  20000000, 58500000,
1154  64);
1155  return mode;
1156 }
1157 
1158 WifiMode
1160 {
1161  static WifiMode mode =
1162  WifiModeFactory::CreateWifiMode ("OfdmRate65MbpsBW20MHzShGi",
1164  false,
1165  20000000, 65000000,
1167  64);
1168  return mode;
1169 }
1170 
1171 WifiMode
1173 {
1174  static WifiMode mode =
1175  WifiModeFactory::CreateWifiMode ("OfdmRate65MbpsBW20MHz",
1177  true,
1178  20000000, 65000000,
1180  64);
1181  return mode;
1182 }
1183 
1184 WifiMode
1186 {
1187  static WifiMode mode =
1188  WifiModeFactory::CreateWifiMode ("OfdmRate72_2MbpsBW20MHz",
1190  false,
1191  20000000, 72200000,
1193  64);
1194  return mode;
1195 }
1196 
1197 WifiMode
1199 {
1200  static WifiMode mode =
1201  WifiModeFactory::CreateWifiMode ("OfdmRate13_5MbpsBW40MHz",
1203  false,
1204  40000000, 13500000,
1206  2);
1207  return mode;
1208 }
1209 
1210 WifiMode
1212 {
1213  static WifiMode mode =
1214  WifiModeFactory::CreateWifiMode ("OfdmRate15MbpsBW40MHz",
1216  false,
1217  40000000, 15000000,
1219  2);
1220  return mode;
1221 }
1222 
1223 WifiMode
1225 {
1226  static WifiMode mode =
1227  WifiModeFactory::CreateWifiMode ("OfdmRate27MbpsBW40MHz",
1229  false,
1230  40000000, 27000000,
1232  4);
1233  return mode;
1234 }
1235 WifiMode
1237 {
1238  static WifiMode mode =
1239  WifiModeFactory::CreateWifiMode ("OfdmRate30MbpsBW40MHz",
1241  false,
1242  40000000, 30000000,
1244  4);
1245  return mode;
1246 }
1247 
1248 WifiMode
1250 {
1251  static WifiMode mode =
1252  WifiModeFactory::CreateWifiMode ("OfdmRate40_5MbpsBW40MHz",
1254  false,
1255  40000000, 40500000,
1257  4);
1258  return mode;
1259 }
1260 WifiMode
1262 {
1263  static WifiMode mode =
1264  WifiModeFactory::CreateWifiMode ("OfdmRate45MbpsBW40MHz",
1266  false,
1267  40000000, 45000000,
1269  4);
1270  return mode;
1271 }
1272 
1273 WifiMode
1275 {
1276  static WifiMode mode =
1277  WifiModeFactory::CreateWifiMode ("OfdmRate54MbpsBW40MHz",
1279  false,
1280  40000000, 54000000,
1282  16);
1283  return mode;
1284 }
1285 
1286 WifiMode
1288 {
1289  static WifiMode mode =
1290  WifiModeFactory::CreateWifiMode ("OfdmRate60MbpsBW40MHz",
1292  false,
1293  40000000, 60000000,
1295  16);
1296  return mode;
1297 }
1298 
1299 WifiMode
1301 {
1302  static WifiMode mode =
1303  WifiModeFactory::CreateWifiMode ("OfdmRate81MbpsBW40MHz",
1305  false,
1306  40000000, 81000000,
1308  16);
1309  return mode;
1310 }
1311 WifiMode
1313 {
1314  static WifiMode mode =
1315  WifiModeFactory::CreateWifiMode ("OfdmRate90MbpsBW40MHz",
1317  false,
1318  40000000, 90000000,
1320  16);
1321  return mode;
1322 }
1323 
1324 WifiMode
1326 {
1327  static WifiMode mode =
1328  WifiModeFactory::CreateWifiMode ("OfdmRate108MbpsBW40MHz",
1330  false,
1331  40000000, 108000000,
1333  64);
1334  return mode;
1335 }
1336 WifiMode
1338 {
1339  static WifiMode mode =
1340  WifiModeFactory::CreateWifiMode ("OfdmRate120MbpsBW40MHz",
1342  false,
1343  40000000, 120000000,
1345  64);
1346  return mode;
1347 }
1348 WifiMode
1350 {
1351  static WifiMode mode =
1352  WifiModeFactory::CreateWifiMode ("OfdmRate121_5MbpsBW40MHz",
1354  false,
1355  40000000, 121500000,
1357  64);
1358  return mode;
1359 }
1360 WifiMode
1362 {
1363  static WifiMode mode =
1364  WifiModeFactory::CreateWifiMode ("OfdmRate135MbpsBW40MHzShGi",
1366  false,
1367  40000000, 135000000,
1369  64);
1370  return mode;
1371 }
1372 WifiMode
1374 {
1375  static WifiMode mode =
1376  WifiModeFactory::CreateWifiMode ("OfdmRate135MbpsBW40MHz",
1378  false,
1379  40000000, 135000000,
1381  64);
1382  return mode;
1383 }
1384 
1385 WifiMode
1387 {
1388  static WifiMode mode =
1389  WifiModeFactory::CreateWifiMode ("OfdmRate150MbpsBW40MHz",
1391  false,
1392  40000000, 150000000,
1394  64);
1395  return mode;
1396 }
1397 
1398 
1399 
1400 std::ostream& operator<< (std::ostream& os, enum WifiPhy::State state)
1401 {
1402  switch (state)
1403  {
1404  case WifiPhy::IDLE:
1405  return (os << "IDLE");
1406  case WifiPhy::CCA_BUSY:
1407  return (os << "CCA_BUSY");
1408  case WifiPhy::TX:
1409  return (os << "TX");
1410  case WifiPhy::RX:
1411  return (os << "RX");
1412  case WifiPhy::SWITCHING:
1413  return (os << "SWITCHING");
1414  default:
1415  NS_FATAL_ERROR ("Invalid WifiPhy state");
1416  return (os << "INVALID");
1417  }
1418 }
1419 
1420 
1421 
1422 } // namespace ns3
1423 
1424 namespace {
1425 
1426 static class Constructor
1427 {
1428 public:
1430  {
1491 
1492  }
1493 } g_constructor;
1494 }
static class anonymous_namespace{wifi-phy.cc}::Constructor g_constructor
static WifiMode GetOfdmRate9MbpsBW5MHz()
Definition: wifi-phy.cc:949
TracedCallback< Ptr< const Packet > > m_phyRxBeginTrace
Definition: wifi-phy.h:664
static WifiMode GetErpOfdmRate24Mbps()
Definition: wifi-phy.cc:618
static WifiMode GetDsssRate11Mbps()
Definition: wifi-phy.cc:549
static uint32_t GetPlcpHeaderDurationMicroSeconds(WifiMode payloadMode, WifiPreamble preamble)
Definition: wifi-phy.cc:221
keep track of time values and allow control of global simulation resolution
Definition: nstime.h:81
static WifiMode GetErpOfdmRate36Mbps()
Definition: wifi-phy.cc:631
#define NS_LOG_FUNCTION(parameters)
Definition: log.h:311
static WifiMode GetOfdmRate26MbpsBW20MHz()
Definition: wifi-phy.cc:1067
static WifiMode GetOfdmRate9Mbps()
Definition: wifi-phy.cc:687
static WifiMode GetOfdmRate7_2MbpsBW20MHz()
Definition: wifi-phy.cc:1002
static WifiMode GetOfdmRate18MbpsBW10MHz()
Definition: wifi-phy.cc:844
static WifiMode GetOfdmRate27MbpsBW10MHz()
Definition: wifi-phy.cc:870
static WifiMode GetOfdmRate3MbpsBW5MHz()
Definition: wifi-phy.cc:910
virtual ~WifiPhy()
Definition: wifi-phy.cc:91
static WifiMode GetDsssRate1Mbps()
Definition: wifi-phy.cc:506
void NotifyMonitorSniffTx(Ptr< const Packet > packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble, uint8_t txPower)
Definition: wifi-phy.cc:495
static WifiMode GetOfdmRate81MbpsBW40MHz()
Definition: wifi-phy.cc:1300
802.11 PHY layer model
Definition: wifi-phy.h:117
static WifiMode GetErpOfdmRate18Mbps()
Definition: wifi-phy.cc:605
NS_LOG_COMPONENT_DEFINE("WifiPhy")
static WifiMode GetOfdmRate12Mbps()
Definition: wifi-phy.cc:700
TracedCallback< Ptr< const Packet > > m_phyRxEndTrace
Definition: wifi-phy.h:672
enum WifiModulationClass GetModulationClass() const
Definition: wifi-mode.cc:93
static WifiMode GetOfdmRate43_3MbpsBW20MHz()
Definition: wifi-phy.cc:1106
static WifiMode GetOfdmRate60MbpsBW40MHz()
Definition: wifi-phy.cc:1287
static WifiMode GetOfdmRate1_5MbpsBW5MHz()
Definition: wifi-phy.cc:884
static WifiMode GetOfdmRate4_5MbpsBW10MHz()
Definition: wifi-phy.cc:792
static WifiMode GetMFPlcpHeaderMode(WifiMode payloadMode, WifiPreamble preamble)
Definition: wifi-phy.cc:100
static WifiMode GetOfdmRate54Mbps()
Definition: wifi-phy.cc:765
void NotifyTxDrop(Ptr< const Packet > packet)
Definition: wifi-phy.cc:465
static WifiMode GetOfdmRate108MbpsBW40MHz()
Definition: wifi-phy.cc:1325
static WifiMode GetOfdmRate21_7MbpsBW20MHz()
Definition: wifi-phy.cc:1053
void NotifyTxBegin(Ptr< const Packet > packet)
Definition: wifi-phy.cc:453
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:91
static WifiMode GetOfdmRate135MbpsBW40MHz()
Definition: wifi-phy.cc:1373
static WifiMode GetOfdmRate36Mbps()
Definition: wifi-phy.cc:739
static WifiMode GetOfdmRate6MbpsBW5MHz()
Definition: wifi-phy.cc:936
#define NS_FATAL_ERROR(msg)
fatal error handling
Definition: fatal-error.h:72
static WifiMode GetErpOfdmRate54Mbps()
Definition: wifi-phy.cc:657
void NotifyRxDrop(Ptr< const Packet > packet)
Definition: wifi-phy.cc:483
WifiPreamble
Definition: wifi-preamble.h:29
static WifiMode GetOfdmRate6_5MbpsBW20MHz()
Definition: wifi-phy.cc:990
static double GetPayloadDurationMicroSeconds(uint32_t size, WifiTxVector txvector)
Definition: wifi-phy.cc:332
static WifiMode GetOfdmRate135MbpsBW40MHzShGi()
Definition: wifi-phy.cc:1361
TracedCallback< Ptr< const Packet >, uint16_t, uint16_t, uint32_t, bool, uint8_t > m_phyMonitorSniffTxTrace
Definition: wifi-phy.h:703
TracedCallback< Ptr< const Packet > > m_phyTxDropTrace
Definition: wifi-phy.h:656
static WifiMode GetErpOfdmRate48Mbps()
Definition: wifi-phy.cc:644
NS_OBJECT_ENSURE_REGISTERED(AntennaModel)
static WifiMode GetPlcpHeaderMode(WifiMode payloadMode, WifiPreamble preamble)
Definition: wifi-phy.cc:148
uint8_t GetNess(void) const
static WifiMode GetOfdmRate12MbpsBW10MHz()
Definition: wifi-phy.cc:831
std::string GetUniqueName(void) const
Definition: wifi-mode.cc:75
TracedCallback< Ptr< const Packet > > m_phyRxDropTrace
Definition: wifi-phy.h:679
virtual ~WifiPhyListener()
Definition: wifi-phy.cc:43
static WifiMode CreateWifiMode(std::string uniqueName, enum WifiModulationClass modClass, bool isMandatory, uint32_t bandwidth, uint32_t dataRate, enum WifiCodeRate codingRate, uint8_t constellationSize)
Definition: wifi-mode.cc:119
void NotifyRxBegin(Ptr< const Packet > packet)
Definition: wifi-phy.cc:471
static WifiMode GetOfdmRate19_5MbpsBW20MHz()
Definition: wifi-phy.cc:1040
static WifiMode GetOfdmRate18Mbps()
Definition: wifi-phy.cc:713
static WifiMode GetOfdmRate9MbpsBW10MHz()
Definition: wifi-phy.cc:818
TracedCallback< Ptr< const Packet >, uint16_t, uint16_t, uint32_t, bool, double, double > m_phyMonitorSniffRxTrace
Definition: wifi-phy.h:691
bool IsStbc(void) const
static WifiMode GetOfdmRate12MbpsBW5MHz()
Definition: wifi-phy.cc:962
static WifiMode GetOfdmRate52MbpsBW20MHz()
Definition: wifi-phy.cc:1119
#define NS_LOG_LOGIC(msg)
Definition: log.h:334
static WifiMode GetOfdmRate40_5MbpsBW40MHz()
Definition: wifi-phy.cc:1249
uint32_t GetBandwidth(void) const
Definition: wifi-mode.cc:45
TracedCallback< Ptr< const Packet > > m_phyTxBeginTrace
Definition: wifi-phy.h:640
static WifiMode GetOfdmRate72_2MbpsBW20MHz()
Definition: wifi-phy.cc:1185
static WifiMode GetOfdmRate65MbpsBW20MHzShGi()
Definition: wifi-phy.cc:1159
static WifiMode GetOfdmRate48Mbps()
Definition: wifi-phy.cc:752
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:43
void NotifyMonitorSniffRx(Ptr< const Packet > packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble, double signalDbm, double noiseDbm)
Definition: wifi-phy.cc:489
static TypeId GetTypeId(void)
Definition: wifi-phy.cc:54
static WifiMode GetOfdmRate57_8MbpsBW20MHz()
Definition: wifi-phy.cc:1132
static WifiMode GetOfdmRate24Mbps()
Definition: wifi-phy.cc:726
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
static WifiMode GetOfdmRate13MbpsBW20MHz()
Definition: wifi-phy.cc:1015
static WifiMode GetOfdmRate65MbpsBW20MHz()
Definition: wifi-phy.cc:1172
static uint32_t GetPlcpHtTrainingSymbolDurationMicroSeconds(WifiMode payloadMode, WifiPreamble preamble, WifiTxVector txvector)
Definition: wifi-phy.cc:113
static WifiMode GetOfdmRate58_5MbpsBW20MHz()
Definition: wifi-phy.cc:1146
static WifiMode GetDsssRate5_5Mbps()
Definition: wifi-phy.cc:536
static WifiMode GetOfdmRate2_25MbpsBW5MHz()
Definition: wifi-phy.cc:897
static WifiMode GetErpOfdmRate9Mbps()
Definition: wifi-phy.cc:579
void NotifyTxEnd(Ptr< const Packet > packet)
Definition: wifi-phy.cc:459
static WifiMode GetOfdmRate15MbpsBW40MHz()
Definition: wifi-phy.cc:1211
static WifiMode GetOfdmRate121_5MbpsBW40MHz()
Definition: wifi-phy.cc:1349
static WifiMode GetOfdmRate28_9MbpsBW20MHz()
Definition: wifi-phy.cc:1080
static WifiMode GetErpOfdmRate6Mbps()
Definition: wifi-phy.cc:566
static Time CalculateTxDuration(uint32_t size, WifiTxVector txvector, enum WifiPreamble preamble)
Definition: wifi-phy.cc:439
uint8_t GetNss(void) const
static WifiMode GetErpOfdmRate12Mbps()
Definition: wifi-phy.cc:592
void NotifyRxEnd(Ptr< const Packet > packet)
Definition: wifi-phy.cc:477
static WifiMode GetOfdmRate13_5MbpsBW40MHz()
Definition: wifi-phy.cc:1198
static WifiMode GetOfdmRate30MbpsBW40MHz()
Definition: wifi-phy.cc:1236
static WifiMode GetOfdmRate54MbpsBW40MHz()
Definition: wifi-phy.cc:1274
static WifiMode GetOfdmRate90MbpsBW40MHz()
Definition: wifi-phy.cc:1312
static WifiMode GetOfdmRate45MbpsBW40MHz()
Definition: wifi-phy.cc:1261
static WifiMode GetOfdmRate120MbpsBW40MHz()
Definition: wifi-phy.cc:1337
static WifiMode GetOfdmRate39MbpsBW20MHz()
Definition: wifi-phy.cc:1093
a base class which provides memory management and object aggregation
Definition: object.h:63
static WifiMode GetDsssRate2Mbps()
Definition: wifi-phy.cc:519
static WifiMode GetOfdmRate6MbpsBW10MHz()
Definition: wifi-phy.cc:805
WifiMode GetMode(void) const
static WifiMode GetOfdmRate24MbpsBW10MHz()
Definition: wifi-phy.cc:857
static WifiMode GetOfdmRate13_5MbpsBW5MHz()
Definition: wifi-phy.cc:975
a unique identifier for an interface.
Definition: type-id.h:49
static uint32_t GetPlcpPreambleDurationMicroSeconds(WifiMode payloadMode, WifiPreamble preamble)
Definition: wifi-phy.cc:284
uint64_t GetDataRate(void) const
Definition: wifi-mode.cc:57
TypeId SetParent(TypeId tid)
Definition: type-id.cc:610
static WifiMode GetOfdmRate6Mbps()
Definition: wifi-phy.cc:674
static WifiMode GetOfdmRate27MbpsBW40MHz()
Definition: wifi-phy.cc:1224
static WifiMode GetOfdmRate4_5MbpsBW5MHz()
Definition: wifi-phy.cc:923
static WifiMode GetOfdmRate14_4MbpsBW20MHz()
Definition: wifi-phy.cc:1028
static uint32_t GetPlcpHtSigHeaderDurationMicroSeconds(WifiMode payloadMode, WifiPreamble preamble)
Definition: wifi-phy.cc:129
static WifiMode GetOfdmRate3MbpsBW10MHz()
Definition: wifi-phy.cc:779
TracedCallback< Ptr< const Packet > > m_phyTxEndTrace
Definition: wifi-phy.h:648
static WifiMode GetOfdmRate150MbpsBW40MHz()
Definition: wifi-phy.cc:1386