src/wifi/model/yans-error-rate-model.cc
changeset 11628 243b71de25a0
parent 11450 9f4ae69f12b7
--- a/src/wifi/model/yans-error-rate-model.cc	Wed Sep 02 16:37:05 2015 -0700
+++ b/src/wifi/model/yans-error-rate-model.cc	Thu Sep 03 22:16:49 2015 +0200
@@ -180,20 +180,21 @@
 }
 
 double
-YansErrorRateModel::GetChunkSuccessRate (WifiMode mode, double snr, uint32_t nbits) const
+YansErrorRateModel::GetChunkSuccessRate (WifiMode mode, WifiTxVector txVector, double snr, uint32_t nbits) const
 {
   if (mode.GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM
       || mode.GetModulationClass () == WIFI_MOD_CLASS_OFDM
-      || mode.GetModulationClass () == WIFI_MOD_CLASS_HT)
+      || mode.GetModulationClass () == WIFI_MOD_CLASS_HT
+      || mode.GetModulationClass () == WIFI_MOD_CLASS_VHT)
     {
-      if (mode.GetConstellationSize () == 2)
+      if (mode.GetConstellationSize (1) == 2)
         {
-          if (mode.GetCodeRate () == WIFI_CODE_RATE_1_2)
+          if (mode.GetCodeRate (1) == WIFI_CODE_RATE_1_2)
             {
               return GetFecBpskBer (snr,
                                     nbits,
-                                    mode.GetBandwidth (), //signal spread
-                                    mode.GetPhyRate (), //phy rate
+                                    txVector.GetChannelWidth () * 1000000, //signal spread
+                                    mode.GetPhyRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), 1), //phy rate
                                     10, //dFree
                                     11); //adFree
             }
@@ -201,20 +202,20 @@
             {
               return GetFecBpskBer (snr,
                                     nbits,
-                                    mode.GetBandwidth (), //signal spread
-                                    mode.GetPhyRate (), //phy rate
+                                    txVector.GetChannelWidth () * 1000000, //signal spread
+                                    mode.GetPhyRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), 1), //phy rate
                                     5, //dFree
                                     8); //adFree
             }
         }
-      else if (mode.GetConstellationSize () == 4)
+      else if (mode.GetConstellationSize (1) == 4)
         {
-          if (mode.GetCodeRate () == WIFI_CODE_RATE_1_2)
+          if (mode.GetCodeRate (1) == WIFI_CODE_RATE_1_2)
             {
               return GetFecQamBer (snr,
                                    nbits,
-                                   mode.GetBandwidth (), //signal spread
-                                   mode.GetPhyRate (), //phy rate
+                                   txVector.GetChannelWidth () * 1000000, //signal spread
+                                   mode.GetPhyRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), 1), //phy rate
                                    4, //m
                                    10, //dFree
                                    11, //adFree
@@ -224,22 +225,22 @@
             {
               return GetFecQamBer (snr,
                                    nbits,
-                                   mode.GetBandwidth (), //signal spread
-                                   mode.GetPhyRate (), //phy rate
+                                   txVector.GetChannelWidth () * 1000000, //signal spread
+                                   mode.GetPhyRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), 1), //phy rate
                                    4, //m
                                    5, //dFree
                                    8, //adFree
                                    31); //adFreePlusOne
             }
         }
-      else if (mode.GetConstellationSize () == 16)
+      else if (mode.GetConstellationSize (1) == 16)
         {
-          if (mode.GetCodeRate () == WIFI_CODE_RATE_1_2)
+          if (mode.GetCodeRate (1) == WIFI_CODE_RATE_1_2)
             {
               return GetFecQamBer (snr,
                                    nbits,
-                                   mode.GetBandwidth (), //signal spread
-                                   mode.GetPhyRate (), //phy rate
+                                   txVector.GetChannelWidth () * 1000000, //signal spread
+                                   mode.GetPhyRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), 1), //phy rate
                                    16, //m
                                    10, //dFree
                                    11, //adFree
@@ -249,34 +250,34 @@
             {
               return GetFecQamBer (snr,
                                    nbits,
-                                   mode.GetBandwidth (), //signal spread
-                                   mode.GetPhyRate (), //phy rate
+                                   txVector.GetChannelWidth () * 1000000, //signal spread
+                                   mode.GetPhyRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), 1), //phy rate
                                    16, //m
                                    5, //dFree
                                    8, //adFree
                                    31); //adFreePlusOne
             }
         }
-      else if (mode.GetConstellationSize () == 64)
+      else if (mode.GetConstellationSize (1) == 64)
         {
-          if (mode.GetCodeRate () == WIFI_CODE_RATE_2_3)
+          if (mode.GetCodeRate (1) == WIFI_CODE_RATE_2_3)
             {
               return GetFecQamBer (snr,
                                    nbits,
-                                   mode.GetBandwidth (), //signal spread
-                                   mode.GetPhyRate (), //phy rate
+                                   txVector.GetChannelWidth () * 1000000, //signal spread
+                                   mode.GetPhyRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), 1), //phy rate
                                    64, //m
                                    6, //dFree
                                    1, //adFree
                                    16); //adFreePlusOne
             }
-          if (mode.GetCodeRate () == WIFI_CODE_RATE_5_6)
+          if (mode.GetCodeRate (1) == WIFI_CODE_RATE_5_6)
             {
               //Table B.32  in Pâl Frenger et al., "Multi-rate Convolutional Codes".
               return GetFecQamBer (snr,
                                    nbits,
-                                   mode.GetBandwidth (), //signal spread
-                                   mode.GetPhyRate (), //phy rate
+                                   txVector.GetChannelWidth () * 1000000, //signal spread
+                                   mode.GetPhyRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), 1), //phy rate
                                    64, //m
                                    4, //dFree
                                    14, //adFree
@@ -286,18 +287,45 @@
             {
               return GetFecQamBer (snr,
                                    nbits,
-                                   mode.GetBandwidth (), //signal spread
-                                   mode.GetPhyRate (), //phy rate
+                                   txVector.GetChannelWidth () * 1000000, //signal spread
+                                   mode.GetPhyRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), 1), //phy rate
                                    64, //m
                                    5, //dFree
                                    8, //adFree
                                    31); //adFreePlusOne
             }
         }
+      else if (mode.GetConstellationSize (1) == 256)
+        {
+          if (mode.GetCodeRate (1) == WIFI_CODE_RATE_5_6)
+            {
+              return GetFecQamBer (snr,
+                                   nbits,
+                                   txVector.GetChannelWidth () * 1000000, // signal spread
+                                   mode.GetPhyRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), 1), // phy rate
+                                   256, // m
+                                   4,  // dFree
+                                   14,  // adFree
+                                   69  // adFreePlusOne
+                                   );
+            }
+          else
+            {
+              return GetFecQamBer (snr,
+                                   nbits,
+                                   txVector.GetChannelWidth () * 1000000, // signal spread
+                                   mode.GetPhyRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), 1), // phy rate
+                                   256, // m
+                                   5,  // dFree
+                                   8,  // adFree
+                                   31  // adFreePlusOne
+                                   );
+            }
+        }
     }
-  else if (mode.GetModulationClass () == WIFI_MOD_CLASS_DSSS)
+  else if (mode.GetModulationClass () == WIFI_MOD_CLASS_DSSS || mode.GetModulationClass () == WIFI_MOD_CLASS_HR_DSSS)
     {
-      switch (mode.GetDataRate ())
+      switch (mode.GetDataRate (20, 0, 1))
         {
         case 1000000:
           return DsssErrorRateModel::GetDsssDbpskSuccessRate (snr, nbits);
@@ -307,6 +335,8 @@
           return DsssErrorRateModel::GetDsssDqpskCck5_5SuccessRate (snr, nbits);
         case 11000000:
           return DsssErrorRateModel::GetDsssDqpskCck11SuccessRate (snr, nbits);
+        default:
+          NS_ASSERT ("undefined DSSS/HR-DSSS datarate");
         }
     }
   return 0;