src/wifi/model/wifi-phy.cc
changeset 10139 17a71cd49da3
parent 9063 32755d0516f4
child 10402 b4e0285d2f22
equal deleted inserted replaced
10138:2f8e35b43d11 10139:17a71cd49da3
    91 WifiPhy::~WifiPhy ()
    91 WifiPhy::~WifiPhy ()
    92 {
    92 {
    93   NS_LOG_FUNCTION (this);
    93   NS_LOG_FUNCTION (this);
    94 }
    94 }
    95 
    95 
       
    96 //Added by Ghada to support 11n
       
    97 
       
    98 //return the L-SIG
       
    99 WifiMode
       
   100 WifiPhy::GetMFPlcpHeaderMode (WifiMode payloadMode, WifiPreamble preamble)
       
   101 {
       
   102     switch (payloadMode.GetBandwidth ())
       
   103        {
       
   104        case 20000000:
       
   105           return WifiPhy::GetOfdmRate6_5MbpsBW20MHz ();
       
   106         case 40000000:
       
   107            return WifiPhy::GetOfdmRate13_5MbpsBW40MHz ();
       
   108         default:
       
   109             return WifiPhy::GetOfdmRate6_5MbpsBW20MHz ();
       
   110       }
       
   111 }
       
   112 uint32_t
       
   113 WifiPhy::GetPlcpHtTrainingSymbolDurationMicroSeconds (WifiMode payloadMode, WifiPreamble preamble, WifiTxVector txvector)
       
   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
       
   129 WifiPhy::GetPlcpHtSigHeaderDurationMicroSeconds (WifiMode payloadMode, WifiPreamble preamble)
       
   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
    96 
   146 
    97 WifiMode
   147 WifiMode
    98 WifiPhy::GetPlcpHeaderMode (WifiMode payloadMode, WifiPreamble preamble)
   148 WifiPhy::GetPlcpHeaderMode (WifiMode payloadMode, WifiPreamble preamble)
    99 {
   149 {
   100   switch (payloadMode.GetModulationClass ())
   150   switch (payloadMode.GetModulationClass ())
   113             // because the last 16 bits of the PlcpHeader are using the
   163             // because the last 16 bits of the PlcpHeader are using the
   114             // same mode of the payload
   164             // same mode of the payload
   115             return WifiPhy::GetOfdmRate6Mbps ();
   165             return WifiPhy::GetOfdmRate6Mbps ();
   116           }
   166           }
   117       }
   167       }
   118 
   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:
       
   178                       return WifiPhy::GetOfdmRate13MbpsBW20MHz ();
       
   179                    case 40000000:
       
   180                       return WifiPhy::GetOfdmRate27MbpsBW40MHz ();
       
   181                    default:
       
   182                       return WifiPhy::GetOfdmRate13MbpsBW20MHz ();
       
   183                   }
       
   184             case WIFI_PREAMBLE_HT_GF:
       
   185                   switch (payloadMode.GetBandwidth ())
       
   186                   {
       
   187                    case 20000000:
       
   188                       return WifiPhy::GetOfdmRate13MbpsBW20MHz ();
       
   189                    case 40000000:
       
   190                       return WifiPhy::GetOfdmRate27MbpsBW40MHz ();
       
   191                    default:
       
   192                       return WifiPhy::GetOfdmRate13MbpsBW20MHz ();
       
   193                   }
       
   194              default:
       
   195                 return WifiPhy::GetOfdmRate6Mbps ();
       
   196           }
       
   197       }
   119     case WIFI_MOD_CLASS_ERP_OFDM:
   198     case WIFI_MOD_CLASS_ERP_OFDM:
   120       return WifiPhy::GetErpOfdmRate6Mbps ();
   199       return WifiPhy::GetErpOfdmRate6Mbps ();
   121 
   200 
   122     case WIFI_MOD_CLASS_DSSS:
   201     case WIFI_MOD_CLASS_DSSS:
   123       if (preamble == WIFI_PREAMBLE_LONG)
   202       if (preamble == WIFI_PREAMBLE_LONG)
   134     default:
   213     default:
   135       NS_FATAL_ERROR ("unsupported modulation class");
   214       NS_FATAL_ERROR ("unsupported modulation class");
   136       return WifiMode ();
   215       return WifiMode ();
   137     }
   216     }
   138 }
   217 }
       
   218 
   139 
   219 
   140 uint32_t
   220 uint32_t
   141 WifiPhy::GetPlcpHeaderDurationMicroSeconds (WifiMode payloadMode, WifiPreamble preamble)
   221 WifiPhy::GetPlcpHeaderDurationMicroSeconds (WifiMode payloadMode, WifiPreamble preamble)
   142 {
   222 {
   143   switch (payloadMode.GetModulationClass ())
   223   switch (payloadMode.GetModulationClass ())
   161           case 5000000:
   241           case 5000000:
   162             // IEEE Std 802.11-2007, section 17.3.2.3, table 17-4
   242             // IEEE Std 802.11-2007, section 17.3.2.3, table 17-4
   163             return 16;
   243             return 16;
   164           }
   244           }
   165       }
   245       }
   166 
   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       }
   167     case WIFI_MOD_CLASS_ERP_OFDM:
   262     case WIFI_MOD_CLASS_ERP_OFDM:
   168       return 16;
   263       return 16;
   169 
   264 
   170     case WIFI_MOD_CLASS_DSSS:
   265     case WIFI_MOD_CLASS_DSSS:
   171       if (preamble == WIFI_PREAMBLE_SHORT)
   266       if (preamble == WIFI_PREAMBLE_SHORT)
   207             // IEEE Std 802.11-2007, section 17.3.3
   302             // IEEE Std 802.11-2007, section 17.3.3
   208             // also section 17.3.2.3, table 17-4
   303             // also section 17.3.2.3, table 17-4
   209             return 64;
   304             return 64;
   210           }
   305           }
   211       }
   306       }
   212 
   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       }
   213     case WIFI_MOD_CLASS_ERP_OFDM:
   311     case WIFI_MOD_CLASS_ERP_OFDM:
   214       return 4;
   312       return 4;
   215 
   313 
   216     case WIFI_MOD_CLASS_DSSS:
   314     case WIFI_MOD_CLASS_DSSS:
   217       if (preamble == WIFI_PREAMBLE_SHORT)
   315       if (preamble == WIFI_PREAMBLE_SHORT)
   222       else // WIFI_PREAMBLE_LONG
   320       else // WIFI_PREAMBLE_LONG
   223         {
   321         {
   224           // IEEE Std 802.11-2007, sections 18.2.2.1 and figure 18-1
   322           // IEEE Std 802.11-2007, sections 18.2.2.1 and figure 18-1
   225           return 144;
   323           return 144;
   226         }
   324         }
   227 
       
   228     default:
   325     default:
   229       NS_FATAL_ERROR ("unsupported modulation class");
   326       NS_FATAL_ERROR ("unsupported modulation class");
   230       return 0;
   327       return 0;
   231     }
   328     }
   232 }
   329 }
   233 
   330 
   234 uint32_t
   331 double
   235 WifiPhy::GetPayloadDurationMicroSeconds (uint32_t size, WifiMode payloadMode)
   332 WifiPhy::GetPayloadDurationMicroSeconds (uint32_t size, WifiTxVector txvector)
   236 {
   333 {
       
   334   WifiMode payloadMode=txvector.GetMode();
       
   335 
   237   NS_LOG_FUNCTION (size << payloadMode);
   336   NS_LOG_FUNCTION (size << payloadMode);
   238 
   337  
   239   switch (payloadMode.GetModulationClass ())
   338   switch (payloadMode.GetModulationClass ())
   240     {
   339     {
   241     case WIFI_MOD_CLASS_OFDM:
   340     case WIFI_MOD_CLASS_OFDM:
   242     case WIFI_MOD_CLASS_ERP_OFDM:
   341     case WIFI_MOD_CLASS_ERP_OFDM:
   243       {
   342       {
   259             break;
   358             break;
   260           }
   359           }
   261 
   360 
   262         // IEEE Std 802.11-2007, section 17.3.2.2, table 17-3
   361         // IEEE Std 802.11-2007, section 17.3.2.2, table 17-3
   263         // corresponds to N_{DBPS} in the table
   362         // corresponds to N_{DBPS} in the table
   264         double numDataBitsPerSymbol = payloadMode.GetDataRate ()  * symbolDurationUs / 1e6;
   363         double numDataBitsPerSymbol = payloadMode.GetDataRate () * symbolDurationUs / 1e6;
   265 
   364 
   266         // IEEE Std 802.11-2007, section 17.3.5.3, equation (17-11)
   365         // IEEE Std 802.11-2007, section 17.3.5.3, equation (17-11)
   267         uint32_t numSymbols = lrint (std::ceil ((16 + size * 8.0 + 6.0) / numDataBitsPerSymbol));
   366         uint32_t numSymbols = lrint (ceil ((16 + size * 8.0 + 6.0) / numDataBitsPerSymbol));
   268 
   367 
   269         // Add signal extension for ERP PHY
   368         // Add signal extension for ERP PHY
   270         if (payloadMode.GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM)
   369         if (payloadMode.GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM)
   271           {
   370           {
   272             return numSymbols * symbolDurationUs + 6;
   371             return numSymbols * symbolDurationUs + 6;
   274         else
   373         else
   275           {
   374           {
   276             return numSymbols * symbolDurationUs;
   375             return numSymbols * symbolDurationUs;
   277           }
   376           }
   278       }
   377       }
   279 
   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       }
   280     case WIFI_MOD_CLASS_DSSS:
   425     case WIFI_MOD_CLASS_DSSS:
   281       // IEEE Std 802.11-2007, section 18.2.3.5
   426       // IEEE Std 802.11-2007, section 18.2.3.5
   282       NS_LOG_LOGIC (" size=" << size
   427       NS_LOG_LOGIC (" size=" << size
   283                              << " mode=" << payloadMode
   428                              << " mode=" << payloadMode
   284                              << " rate=" << payloadMode.GetDataRate () );
   429                              << " rate=" << payloadMode.GetDataRate () );
   285       return lrint (std::ceil ((size * 8.0) / (payloadMode.GetDataRate () / 1.0e6)));
   430       return lrint (ceil ((size * 8.0) / (payloadMode.GetDataRate () / 1.0e6)));
   286 
   431 
   287     default:
   432     default:
   288       NS_FATAL_ERROR ("unsupported modulation class");
   433       NS_FATAL_ERROR ("unsupported modulation class");
   289       return 0;
   434       return 0;
   290     }
   435     }
   291 }
   436 }
   292 
   437 
   293 Time
   438 Time
   294 WifiPhy::CalculateTxDuration (uint32_t size, WifiMode payloadMode, WifiPreamble preamble)
   439 WifiPhy::CalculateTxDuration (uint32_t size, WifiTxVector txvector, WifiPreamble preamble)
   295 {
   440 {
   296   uint32_t duration = GetPlcpPreambleDurationMicroSeconds (payloadMode, preamble)
   441   WifiMode payloadMode=txvector.GetMode();
       
   442   double duration = GetPlcpPreambleDurationMicroSeconds (payloadMode, preamble)
   297     + GetPlcpHeaderDurationMicroSeconds (payloadMode, preamble)
   443     + GetPlcpHeaderDurationMicroSeconds (payloadMode, preamble)
   298     + GetPayloadDurationMicroSeconds (size, payloadMode);
   444     + GetPlcpHtSigHeaderDurationMicroSeconds (payloadMode, preamble)
       
   445     + GetPlcpHtTrainingSymbolDurationMicroSeconds (payloadMode, preamble,txvector)
       
   446     + GetPayloadDurationMicroSeconds (size, txvector);
   299   return MicroSeconds (duration);
   447   return MicroSeconds (duration);
   300 }
   448 }
       
   449 
   301 
   450 
   302 
   451 
   303 void
   452 void
   304 WifiPhy::NotifyTxBegin (Ptr<const Packet> packet)
   453 WifiPhy::NotifyTxBegin (Ptr<const Packet> packet)
   305 {
   454 {
   341 {
   490 {
   342   m_phyMonitorSniffRxTrace (packet, channelFreqMhz, channelNumber, rate, isShortPreamble, signalDbm, noiseDbm);
   491   m_phyMonitorSniffRxTrace (packet, channelFreqMhz, channelNumber, rate, isShortPreamble, signalDbm, noiseDbm);
   343 }
   492 }
   344 
   493 
   345 void
   494 void
   346 WifiPhy::NotifyMonitorSniffTx (Ptr<const Packet> packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble)
   495 WifiPhy::NotifyMonitorSniffTx (Ptr<const Packet> packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble, uint8_t txPower)
   347 {
   496 {
   348   m_phyMonitorSniffTxTrace (packet, channelFreqMhz, channelNumber, rate, isShortPreamble);
   497   m_phyMonitorSniffTxTrace (packet, channelFreqMhz, channelNumber, rate, isShortPreamble, txPower);
   349 }
   498 }
   350 
   499 
   351 
   500 
   352 /**
   501 /**
   353  * Clause 15 rates (DSSS)
   502  * Clause 15 rates (DSSS)
   832                                      5000000, 13500000,
   981                                      5000000, 13500000,
   833                                      WIFI_CODE_RATE_3_4,
   982                                      WIFI_CODE_RATE_3_4,
   834                                      64);
   983                                      64);
   835   return mode;
   984   return mode;
   836 }
   985 }
       
   986 
       
   987 /*Clause 20*/
       
   988 
       
   989 WifiMode
       
   990 WifiPhy::GetOfdmRate6_5MbpsBW20MHz ()
       
   991 {
       
   992   static WifiMode mode =
       
   993   WifiModeFactory::CreateWifiMode ("OfdmRate6_5MbpsBW20MHz",
       
   994                                     WIFI_MOD_CLASS_HT,
       
   995                                     true,
       
   996                                     20000000, 6500000,
       
   997                                     WIFI_CODE_RATE_1_2,
       
   998                                     2);
       
   999   return mode;
       
  1000 }
       
  1001 WifiMode
       
  1002 WifiPhy::GetOfdmRate7_2MbpsBW20MHz ()
       
  1003 {
       
  1004   static WifiMode mode =
       
  1005   WifiModeFactory::CreateWifiMode ("OfdmRate7_2MbpsBW20MHz",
       
  1006                                     WIFI_MOD_CLASS_HT,
       
  1007                                     false,
       
  1008                                     20000000, 7200000,
       
  1009                                     WIFI_CODE_RATE_1_2,
       
  1010                                     2);
       
  1011   return mode;
       
  1012 }
       
  1013 
       
  1014 WifiMode
       
  1015 WifiPhy::GetOfdmRate13MbpsBW20MHz ()
       
  1016 {
       
  1017   static WifiMode mode =
       
  1018     WifiModeFactory::CreateWifiMode ("OfdmRate13MbpsBW20MHz",
       
  1019                                      WIFI_MOD_CLASS_HT,
       
  1020                                      true,
       
  1021                                      20000000, 13000000,
       
  1022                                      WIFI_CODE_RATE_1_2,
       
  1023                                      4);
       
  1024   return mode;
       
  1025 }
       
  1026 
       
  1027 WifiMode
       
  1028 WifiPhy::GetOfdmRate14_4MbpsBW20MHz ()
       
  1029 {
       
  1030   static WifiMode mode =
       
  1031     WifiModeFactory::CreateWifiMode ("OfdmRate14_4MbpsBW20MHz",
       
  1032                                      WIFI_MOD_CLASS_HT,
       
  1033                                      false,
       
  1034                                      20000000, 14400000,
       
  1035                                      WIFI_CODE_RATE_1_2,
       
  1036                                      4);
       
  1037   return mode;
       
  1038 }
       
  1039 WifiMode
       
  1040 WifiPhy::GetOfdmRate19_5MbpsBW20MHz ()
       
  1041 {
       
  1042   static WifiMode mode =
       
  1043     WifiModeFactory::CreateWifiMode ("OfdmRate19_5MbpsBW20MHz",
       
  1044                                      WIFI_MOD_CLASS_HT,
       
  1045                                      true,
       
  1046                                      20000000, 19500000,
       
  1047                                      WIFI_CODE_RATE_3_4,
       
  1048                                      4);
       
  1049   return mode;
       
  1050 }
       
  1051 
       
  1052 WifiMode
       
  1053 WifiPhy::GetOfdmRate21_7MbpsBW20MHz ()
       
  1054 {
       
  1055   static WifiMode mode =
       
  1056     WifiModeFactory::CreateWifiMode ("OfdmRate21_7MbpsBW20MHz",
       
  1057                                      WIFI_MOD_CLASS_HT,
       
  1058                                      false,
       
  1059                                      20000000, 21700000,
       
  1060                                      WIFI_CODE_RATE_3_4,
       
  1061                                      4);
       
  1062   return mode;
       
  1063 }
       
  1064 
       
  1065 
       
  1066 WifiMode
       
  1067 WifiPhy::GetOfdmRate26MbpsBW20MHz ()
       
  1068 {
       
  1069   static WifiMode mode =
       
  1070     WifiModeFactory::CreateWifiMode ("OfdmRate26MbpsBW20MHz",
       
  1071                                      WIFI_MOD_CLASS_HT,
       
  1072                                      true,
       
  1073                                      20000000, 26000000,
       
  1074                                      WIFI_CODE_RATE_1_2,
       
  1075                                      16);
       
  1076   return mode;
       
  1077 }
       
  1078 
       
  1079 WifiMode
       
  1080 WifiPhy::GetOfdmRate28_9MbpsBW20MHz ()
       
  1081 {
       
  1082   static WifiMode mode =
       
  1083     WifiModeFactory::CreateWifiMode ("OfdmRate28_9MbpsBW20MHz",
       
  1084                                      WIFI_MOD_CLASS_HT,
       
  1085                                      false,
       
  1086                                      20000000, 28900000,
       
  1087                                      WIFI_CODE_RATE_1_2,
       
  1088                                      16);
       
  1089   return mode;
       
  1090 }
       
  1091 
       
  1092 WifiMode
       
  1093 WifiPhy::GetOfdmRate39MbpsBW20MHz ()
       
  1094 {
       
  1095   static WifiMode mode =
       
  1096     WifiModeFactory::CreateWifiMode ("OfdmRate39MbpsBW20MHz",
       
  1097                                      WIFI_MOD_CLASS_HT,
       
  1098                                      true,
       
  1099                                      20000000, 39000000,
       
  1100                                      WIFI_CODE_RATE_3_4,
       
  1101                                      16);
       
  1102   return mode;
       
  1103 }
       
  1104 
       
  1105 WifiMode
       
  1106 WifiPhy::GetOfdmRate43_3MbpsBW20MHz ()
       
  1107 {
       
  1108   static WifiMode mode =
       
  1109     WifiModeFactory::CreateWifiMode ("OfdmRate43_3MbpsBW20MHz",
       
  1110                                      WIFI_MOD_CLASS_HT,
       
  1111                                      false,
       
  1112                                      20000000, 43300000,
       
  1113                                      WIFI_CODE_RATE_3_4,
       
  1114                                      16);
       
  1115   return mode;
       
  1116 }
       
  1117 
       
  1118 WifiMode
       
  1119 WifiPhy::GetOfdmRate52MbpsBW20MHz ()
       
  1120 {
       
  1121   static WifiMode mode =
       
  1122     WifiModeFactory::CreateWifiMode ("OfdmRate52MbpsBW20MHz",
       
  1123                                      WIFI_MOD_CLASS_HT,
       
  1124                                      true,
       
  1125                                      20000000, 52000000,
       
  1126                                      WIFI_CODE_RATE_2_3,
       
  1127                                      64);
       
  1128   return mode;
       
  1129 }
       
  1130 
       
  1131 WifiMode
       
  1132 WifiPhy::GetOfdmRate57_8MbpsBW20MHz ()
       
  1133 {
       
  1134   static WifiMode mode =
       
  1135     WifiModeFactory::CreateWifiMode ("OfdmRate57_8MbpsBW20MHz",
       
  1136                                      WIFI_MOD_CLASS_HT,
       
  1137                                      false,
       
  1138                                      20000000, 57800000,
       
  1139                                      WIFI_CODE_RATE_2_3,
       
  1140                                      64);
       
  1141   return mode;
       
  1142 }
       
  1143 
       
  1144 
       
  1145 WifiMode
       
  1146 WifiPhy::GetOfdmRate58_5MbpsBW20MHz ()
       
  1147 {
       
  1148   static WifiMode mode =
       
  1149     WifiModeFactory::CreateWifiMode ("OfdmRate58_5MbpsBW20MHz",
       
  1150                                      WIFI_MOD_CLASS_HT,
       
  1151                                      true,
       
  1152                                      20000000, 58500000,
       
  1153                                      WIFI_CODE_RATE_3_4,
       
  1154                                      64);
       
  1155   return mode;
       
  1156 }
       
  1157 
       
  1158 WifiMode
       
  1159 WifiPhy::GetOfdmRate65MbpsBW20MHzShGi ()
       
  1160 {
       
  1161   static WifiMode mode =
       
  1162     WifiModeFactory::CreateWifiMode ("OfdmRate65MbpsBW20MHzShGi",
       
  1163                                      WIFI_MOD_CLASS_HT,
       
  1164                                      false,
       
  1165                                      20000000, 65000000,
       
  1166                                      WIFI_CODE_RATE_3_4,
       
  1167                                      64);
       
  1168   return mode;
       
  1169 }
       
  1170 
       
  1171 WifiMode
       
  1172 WifiPhy::GetOfdmRate65MbpsBW20MHz ()
       
  1173 {
       
  1174   static WifiMode mode =
       
  1175     WifiModeFactory::CreateWifiMode ("OfdmRate65MbpsBW20MHz",
       
  1176                                      WIFI_MOD_CLASS_HT,
       
  1177                                      true,
       
  1178                                      20000000, 65000000,
       
  1179                                      WIFI_CODE_RATE_5_6,
       
  1180                                      64);
       
  1181   return mode;
       
  1182 }
       
  1183 
       
  1184 WifiMode
       
  1185 WifiPhy::GetOfdmRate72_2MbpsBW20MHz ()
       
  1186 {
       
  1187   static WifiMode mode =
       
  1188     WifiModeFactory::CreateWifiMode ("OfdmRate72_2MbpsBW20MHz",
       
  1189                                      WIFI_MOD_CLASS_HT,
       
  1190                                      false,
       
  1191                                      20000000, 72200000,
       
  1192                                      WIFI_CODE_RATE_5_6,
       
  1193                                      64);
       
  1194   return mode;
       
  1195 }
       
  1196 
       
  1197 WifiMode
       
  1198 WifiPhy::GetOfdmRate13_5MbpsBW40MHz ()
       
  1199 {
       
  1200   static WifiMode mode =
       
  1201     WifiModeFactory::CreateWifiMode ("OfdmRate13_5MbpsBW40MHz",
       
  1202                                      WIFI_MOD_CLASS_HT,
       
  1203                                      false,
       
  1204                                      40000000, 13500000,
       
  1205                                      WIFI_CODE_RATE_1_2,
       
  1206                                      2);
       
  1207   return mode;
       
  1208 }
       
  1209 
       
  1210 WifiMode
       
  1211 WifiPhy::GetOfdmRate15MbpsBW40MHz ()
       
  1212 {
       
  1213   static WifiMode mode =
       
  1214     WifiModeFactory::CreateWifiMode ("OfdmRate15MbpsBW40MHz",
       
  1215                                      WIFI_MOD_CLASS_HT,
       
  1216                                      false,
       
  1217                                      40000000, 15000000,
       
  1218                                      WIFI_CODE_RATE_1_2,
       
  1219                                      2);
       
  1220   return mode;
       
  1221 }
       
  1222 
       
  1223 WifiMode
       
  1224 WifiPhy::GetOfdmRate27MbpsBW40MHz ()
       
  1225 {
       
  1226   static WifiMode mode =
       
  1227     WifiModeFactory::CreateWifiMode ("OfdmRate27MbpsBW40MHz",
       
  1228                                      WIFI_MOD_CLASS_HT,
       
  1229                                      false,
       
  1230                                      40000000, 27000000,
       
  1231                                      WIFI_CODE_RATE_1_2,
       
  1232                                      4);
       
  1233   return mode;
       
  1234 }
       
  1235 WifiMode
       
  1236 WifiPhy::GetOfdmRate30MbpsBW40MHz ()
       
  1237 {
       
  1238   static WifiMode mode =
       
  1239     WifiModeFactory::CreateWifiMode ("OfdmRate30MbpsBW40MHz",
       
  1240                                      WIFI_MOD_CLASS_HT,
       
  1241                                      false,
       
  1242                                      40000000, 30000000,
       
  1243                                      WIFI_CODE_RATE_1_2,
       
  1244                                      4);
       
  1245   return mode;
       
  1246 }
       
  1247 
       
  1248 WifiMode
       
  1249 WifiPhy::GetOfdmRate40_5MbpsBW40MHz ()
       
  1250 {
       
  1251   static WifiMode mode =
       
  1252     WifiModeFactory::CreateWifiMode ("OfdmRate40_5MbpsBW40MHz",
       
  1253                                      WIFI_MOD_CLASS_HT,
       
  1254                                      false,
       
  1255                                      40000000, 40500000,
       
  1256                                      WIFI_CODE_RATE_3_4,
       
  1257                                      4);
       
  1258   return mode;
       
  1259 }
       
  1260 WifiMode
       
  1261 WifiPhy::GetOfdmRate45MbpsBW40MHz ()
       
  1262 {
       
  1263   static WifiMode mode =
       
  1264     WifiModeFactory::CreateWifiMode ("OfdmRate45MbpsBW40MHz",
       
  1265                                      WIFI_MOD_CLASS_HT,
       
  1266                                      false,
       
  1267                                      40000000, 45000000,
       
  1268                                      WIFI_CODE_RATE_3_4,
       
  1269                                      4);
       
  1270   return mode;
       
  1271 }
       
  1272 
       
  1273 WifiMode
       
  1274 WifiPhy::GetOfdmRate54MbpsBW40MHz ()
       
  1275 {
       
  1276   static WifiMode mode =
       
  1277     WifiModeFactory::CreateWifiMode ("OfdmRate54MbpsBW40MHz",
       
  1278                                      WIFI_MOD_CLASS_HT,
       
  1279                                      false,
       
  1280                                      40000000, 54000000,
       
  1281                                      WIFI_CODE_RATE_1_2,
       
  1282                                      16);
       
  1283   return mode;
       
  1284 }
       
  1285 
       
  1286 WifiMode
       
  1287 WifiPhy::GetOfdmRate60MbpsBW40MHz ()
       
  1288 {
       
  1289   static WifiMode mode =
       
  1290     WifiModeFactory::CreateWifiMode ("OfdmRate60MbpsBW40MHz",
       
  1291                                      WIFI_MOD_CLASS_HT,
       
  1292                                      false,
       
  1293                                      40000000, 60000000,
       
  1294                                      WIFI_CODE_RATE_1_2,
       
  1295                                      16);
       
  1296   return mode;
       
  1297 }
       
  1298 
       
  1299 WifiMode
       
  1300 WifiPhy::GetOfdmRate81MbpsBW40MHz ()
       
  1301 {
       
  1302   static WifiMode mode =
       
  1303     WifiModeFactory::CreateWifiMode ("OfdmRate81MbpsBW40MHz",
       
  1304                                      WIFI_MOD_CLASS_HT,
       
  1305                                      false,
       
  1306                                      40000000, 81000000,
       
  1307                                      WIFI_CODE_RATE_3_4,
       
  1308                                      16);
       
  1309   return mode;
       
  1310 }
       
  1311 WifiMode
       
  1312 WifiPhy::GetOfdmRate90MbpsBW40MHz ()
       
  1313 {
       
  1314   static WifiMode mode =
       
  1315     WifiModeFactory::CreateWifiMode ("OfdmRate90MbpsBW40MHz",
       
  1316                                      WIFI_MOD_CLASS_HT,
       
  1317                                      false,
       
  1318                                      40000000, 90000000,
       
  1319                                      WIFI_CODE_RATE_3_4,
       
  1320                                      16);
       
  1321   return mode;
       
  1322 }
       
  1323 
       
  1324 WifiMode
       
  1325 WifiPhy::GetOfdmRate108MbpsBW40MHz ()
       
  1326 {
       
  1327   static WifiMode mode =
       
  1328     WifiModeFactory::CreateWifiMode ("OfdmRate108MbpsBW40MHz",
       
  1329                                      WIFI_MOD_CLASS_HT,
       
  1330                                      false,
       
  1331                                      40000000, 108000000,
       
  1332                                      WIFI_CODE_RATE_2_3,
       
  1333                                      64);
       
  1334   return mode;
       
  1335 }
       
  1336 WifiMode
       
  1337 WifiPhy::GetOfdmRate120MbpsBW40MHz ()
       
  1338 {
       
  1339   static WifiMode mode =
       
  1340     WifiModeFactory::CreateWifiMode ("OfdmRate120MbpsBW40MHz",
       
  1341                                      WIFI_MOD_CLASS_HT,
       
  1342                                      false,
       
  1343                                      40000000, 120000000,
       
  1344                                      WIFI_CODE_RATE_2_3,
       
  1345                                      64);
       
  1346   return mode;
       
  1347 }
       
  1348 WifiMode
       
  1349 WifiPhy::GetOfdmRate121_5MbpsBW40MHz ()
       
  1350 {
       
  1351   static WifiMode mode =
       
  1352     WifiModeFactory::CreateWifiMode ("OfdmRate121_5MbpsBW40MHz",
       
  1353                                      WIFI_MOD_CLASS_HT,
       
  1354                                      false,
       
  1355                                      40000000, 121500000,
       
  1356                                      WIFI_CODE_RATE_3_4,
       
  1357                                      64);
       
  1358   return mode;
       
  1359 }
       
  1360 WifiMode
       
  1361 WifiPhy::GetOfdmRate135MbpsBW40MHzShGi ()
       
  1362 {
       
  1363   static WifiMode mode =
       
  1364     WifiModeFactory::CreateWifiMode ("OfdmRate135MbpsBW40MHzShGi",
       
  1365                                      WIFI_MOD_CLASS_HT,
       
  1366                                      false,
       
  1367                                      40000000, 135000000,
       
  1368                                      WIFI_CODE_RATE_3_4,
       
  1369                                      64);
       
  1370   return mode;
       
  1371 }
       
  1372 WifiMode
       
  1373 WifiPhy::GetOfdmRate135MbpsBW40MHz ()
       
  1374 {
       
  1375   static WifiMode mode =
       
  1376     WifiModeFactory::CreateWifiMode ("OfdmRate135MbpsBW40MHz",
       
  1377                                      WIFI_MOD_CLASS_HT,
       
  1378                                      false,
       
  1379                                      40000000, 135000000,
       
  1380                                      WIFI_CODE_RATE_5_6,
       
  1381                                      64);
       
  1382   return mode;
       
  1383 }
       
  1384 
       
  1385 WifiMode
       
  1386 WifiPhy::GetOfdmRate150MbpsBW40MHz ()
       
  1387 {
       
  1388   static WifiMode mode =
       
  1389     WifiModeFactory::CreateWifiMode ("OfdmRate150MbpsBW40MHz",
       
  1390                                      WIFI_MOD_CLASS_HT,
       
  1391                                      false,
       
  1392                                      40000000, 150000000,
       
  1393                                      WIFI_CODE_RATE_5_6,
       
  1394                                      64);
       
  1395   return mode;
       
  1396 }
       
  1397 
       
  1398 
   837 
  1399 
   838 std::ostream& operator<< (std::ostream& os, enum WifiPhy::State state)
  1400 std::ostream& operator<< (std::ostream& os, enum WifiPhy::State state)
   839 {
  1401 {
   840   switch (state)
  1402   switch (state)
   841     {
  1403     {
   852     default:
  1414     default:
   853       NS_FATAL_ERROR ("Invalid WifiPhy state");
  1415       NS_FATAL_ERROR ("Invalid WifiPhy state");
   854       return (os << "INVALID");
  1416       return (os << "INVALID");
   855     }
  1417     }
   856 }
  1418 }
       
  1419 
       
  1420 
   857 
  1421 
   858 } // namespace ns3
  1422 } // namespace ns3
   859 
  1423 
   860 namespace {
  1424 namespace {
   861 
  1425 
   898     ns3::WifiPhy::GetOfdmRate4_5MbpsBW5MHz ();
  1462     ns3::WifiPhy::GetOfdmRate4_5MbpsBW5MHz ();
   899     ns3::WifiPhy::GetOfdmRate6MbpsBW5MHz ();
  1463     ns3::WifiPhy::GetOfdmRate6MbpsBW5MHz ();
   900     ns3::WifiPhy::GetOfdmRate9MbpsBW5MHz ();
  1464     ns3::WifiPhy::GetOfdmRate9MbpsBW5MHz ();
   901     ns3::WifiPhy::GetOfdmRate12MbpsBW5MHz ();
  1465     ns3::WifiPhy::GetOfdmRate12MbpsBW5MHz ();
   902     ns3::WifiPhy::GetOfdmRate13_5MbpsBW5MHz ();
  1466     ns3::WifiPhy::GetOfdmRate13_5MbpsBW5MHz ();
       
  1467     ns3::WifiPhy::GetOfdmRate6_5MbpsBW20MHz ();
       
  1468     ns3::WifiPhy::GetOfdmRate13MbpsBW20MHz ();
       
  1469     ns3::WifiPhy::GetOfdmRate19_5MbpsBW20MHz ();
       
  1470     ns3::WifiPhy::GetOfdmRate26MbpsBW20MHz ();
       
  1471     ns3::WifiPhy::GetOfdmRate39MbpsBW20MHz ();
       
  1472     ns3::WifiPhy::GetOfdmRate52MbpsBW20MHz ();
       
  1473     ns3::WifiPhy::GetOfdmRate58_5MbpsBW20MHz ();
       
  1474     ns3::WifiPhy::GetOfdmRate65MbpsBW20MHz ();
       
  1475     ns3::WifiPhy::GetOfdmRate13_5MbpsBW40MHz ();
       
  1476     ns3::WifiPhy::GetOfdmRate27MbpsBW40MHz ();
       
  1477     ns3::WifiPhy::GetOfdmRate40_5MbpsBW40MHz ();    
       
  1478     ns3::WifiPhy::GetOfdmRate54MbpsBW40MHz ();
       
  1479     ns3::WifiPhy::GetOfdmRate81MbpsBW40MHz ();
       
  1480     ns3::WifiPhy::GetOfdmRate108MbpsBW40MHz ();
       
  1481     ns3::WifiPhy::GetOfdmRate121_5MbpsBW40MHz ();
       
  1482     ns3::WifiPhy::GetOfdmRate135MbpsBW40MHz ();
       
  1483     ns3::WifiPhy::GetOfdmRate7_2MbpsBW20MHz ();
       
  1484     ns3::WifiPhy::GetOfdmRate14_4MbpsBW20MHz ();
       
  1485     ns3::WifiPhy::GetOfdmRate21_7MbpsBW20MHz ();
       
  1486     ns3::WifiPhy::GetOfdmRate28_9MbpsBW20MHz ();
       
  1487     ns3::WifiPhy::GetOfdmRate43_3MbpsBW20MHz ();
       
  1488     ns3::WifiPhy::GetOfdmRate57_8MbpsBW20MHz ();
       
  1489     ns3::WifiPhy::GetOfdmRate65MbpsBW20MHzShGi ();
       
  1490     ns3::WifiPhy::GetOfdmRate72_2MbpsBW20MHz ();
       
  1491 
   903   }
  1492   }
   904 } g_constructor;
  1493 } g_constructor;
   905 }
  1494 }