View | Details | Raw Unified | Return to bug 2317
Collapse All | Expand All

(-)a/src/wifi/model/wifi-mode.cc (+58 lines)
 Lines 390-395    Link Here 
390
  return item->modClass;
390
  return item->modClass;
391
}
391
}
392
392
393
uint64_t
394
WifiMode::GetNonHtReferenceRate (uint8_t nss) const
395
{
396
  uint64_t dataRate;
397
  struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
398
  if (item->modClass == WIFI_MOD_CLASS_HT || item->modClass == WIFI_MOD_CLASS_VHT)
399
    {
400
      WifiCodeRate codeRate = GetCodeRate(nss);
401
      switch(GetConstellationSize(nss))
402
        {
403
        case 2:
404
          if (codeRate == WIFI_CODE_RATE_1_2)
405
            dataRate = 6000000;
406
          else if (codeRate == WIFI_CODE_RATE_3_4)
407
            dataRate = 9000000;
408
          else
409
            NS_FATAL_ERROR ("Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
410
          break;
411
        case 4:
412
          if (codeRate == WIFI_CODE_RATE_1_2)
413
            dataRate = 12000000;
414
          else if (codeRate == WIFI_CODE_RATE_3_4)
415
            dataRate = 18000000;
416
          else
417
            NS_FATAL_ERROR ("Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
418
          break;
419
        case 16:
420
          if (codeRate == WIFI_CODE_RATE_1_2)
421
            dataRate = 24000000;
422
          else if (codeRate == WIFI_CODE_RATE_3_4)
423
            dataRate = 36000000;
424
          else
425
            NS_FATAL_ERROR ("Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
426
          break;
427
        case 64:
428
          if (codeRate == WIFI_CODE_RATE_1_2 || codeRate == WIFI_CODE_RATE_2_3)
429
            dataRate = 48000000;
430
          else if (codeRate == WIFI_CODE_RATE_3_4 || codeRate == WIFI_CODE_RATE_5_6)
431
            dataRate = 54000000;
432
          else
433
            NS_FATAL_ERROR ("Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
434
          break;
435
        case 256:
436
          if (codeRate == WIFI_CODE_RATE_3_4 || codeRate == WIFI_CODE_RATE_5_6)
437
            dataRate = 54000000;
438
          else
439
            NS_FATAL_ERROR ("Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
440
          break;
441
        default:
442
            NS_FATAL_ERROR ("Wrong constellation size");
443
        }
444
    }
445
  else
446
    NS_FATAL_ERROR ("Trying to get reference rate for a non-HT rate");
447
448
  return dataRate;
449
}
450
393
WifiMode::WifiMode ()
451
WifiMode::WifiMode ()
394
  : m_uid (0)
452
  : m_uid (0)
395
{
453
{
(-)a/src/wifi/model/wifi-mode.h (-1 / +9 lines)
 Lines 177-183    Link Here 
177
   * to which this WifiMode belongs.
177
   * to which this WifiMode belongs.
178
   */
178
   */
179
  enum WifiModulationClass GetModulationClass () const;
179
  enum WifiModulationClass GetModulationClass () const;
180
180
  /**
181
   * \returns the rate (in bps) of the non-HT Reference Rate
182
   * which corresponds to the HT MCS of this WifiMode.
183
   *
184
   * To convert an HT MCS to is corresponding non-HT Reference Rate
185
   * use the modulation and coding rate of the HT MCS
186
   * and lookup in Table 9-5 of IEEE 802.11-2012.
187
   */
188
  uint64_t GetNonHtReferenceRate (uint8_t nss) const;
181
  /**
189
  /**
182
   * Create an invalid WifiMode. Calling any method on the
190
   * Create an invalid WifiMode. Calling any method on the
183
   * instance created will trigger an assert. This is useful
191
   * instance created will trigger an assert. This is useful

Return to bug 2317