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

(-)a/src/wifi/model/wifi-mode.cc (+94 lines)
 Lines 390-395    Link Here 
390
  return item->modClass;
390
  return item->modClass;
391
}
391
}
392
392
393
WifiMode
394
WifiMode::GetNonHtReferenceRate (uint8_t nss) const
395
{
396
  WifiMode mode;
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
            mode = WifiModeFactory::CreateWifiMode ("OfdmRate6Mbps",
406
                                                    WIFI_MOD_CLASS_OFDM,
407
                                                    true,
408
                                                    WIFI_CODE_RATE_1_2,
409
                                                    2);
410
          else if (codeRate == WIFI_CODE_RATE_3_4)
411
            mode = WifiModeFactory::CreateWifiMode ("OfdmRate9Mbps",
412
                                                    WIFI_MOD_CLASS_OFDM,
413
                                                    false,
414
                                                    WIFI_CODE_RATE_3_4,
415
                                                    2);
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 4:
420
          if (codeRate == WIFI_CODE_RATE_1_2)
421
            mode = WifiModeFactory::CreateWifiMode ("OfdmRate12Mbps",
422
                                                    WIFI_MOD_CLASS_OFDM,
423
                                                    true,
424
                                                    WIFI_CODE_RATE_1_2,
425
                                                    4);
426
          else if (codeRate == WIFI_CODE_RATE_3_4)
427
            mode = WifiModeFactory::CreateWifiMode ("OfdmRate18Mbps",
428
                                                    WIFI_MOD_CLASS_OFDM,
429
                                                    false,
430
                                                    WIFI_CODE_RATE_3_4,
431
                                                    4);
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 16:
436
          if (codeRate == WIFI_CODE_RATE_1_2)
437
            mode = WifiModeFactory::CreateWifiMode ("OfdmRate24Mbps",
438
                                                    WIFI_MOD_CLASS_OFDM,
439
                                                    true,
440
                                                    WIFI_CODE_RATE_1_2,
441
                                                    16);
442
          else if (codeRate == WIFI_CODE_RATE_3_4)
443
            mode = WifiModeFactory::CreateWifiMode ("OfdmRate36Mbps",
444
                                                    WIFI_MOD_CLASS_OFDM,
445
                                                    false,
446
                                                    WIFI_CODE_RATE_3_4,
447
                                                    16);
448
          else
449
            NS_FATAL_ERROR ("Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
450
          break;
451
        case 64:
452
          if (codeRate == WIFI_CODE_RATE_1_2 || codeRate == WIFI_CODE_RATE_2_3)
453
            mode = WifiModeFactory::CreateWifiMode ("OfdmRate48Mbps",
454
                                                    WIFI_MOD_CLASS_OFDM,
455
                                                    false,
456
                                                    WIFI_CODE_RATE_2_3,
457
                                                    64);
458
          else if (codeRate == WIFI_CODE_RATE_3_4 || codeRate == WIFI_CODE_RATE_5_6)
459
            mode = WifiModeFactory::CreateWifiMode ("OfdmRate54Mbps",
460
                                                    WIFI_MOD_CLASS_OFDM,
461
                                                    false,
462
                                                    WIFI_CODE_RATE_3_4,
463
                                                    64);
464
          else
465
            NS_FATAL_ERROR ("Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
466
          break;
467
        case 256:
468
          if (codeRate == WIFI_CODE_RATE_3_4 || codeRate == WIFI_CODE_RATE_5_6)
469
            mode = WifiModeFactory::CreateWifiMode ("OfdmRate54Mbps",
470
                                               WIFI_MOD_CLASS_OFDM,
471
                                               false,
472
                                               WIFI_CODE_RATE_3_4,
473
                                               64);
474
          else
475
            NS_FATAL_ERROR ("Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
476
          break;
477
        default:
478
            NS_FATAL_ERROR ("Wrong constellation size");
479
        }
480
    }
481
  else
482
    mode = *this;
483
484
  return mode;
485
}
486
393
WifiMode::WifiMode ()
487
WifiMode::WifiMode ()
394
  : m_uid (0)
488
  : m_uid (0)
395
{
489
{
(-)a/src/wifi/model/wifi-mode.h (-1 / +10 lines)
 Lines 176-182    Link Here 
176
   * \returns the Modulation Class (Section 9.7.8 "Modulation classes"; IEEE 802.11-2012)
176
   * \returns the Modulation Class (Section 9.7.8 "Modulation classes"; IEEE 802.11-2012)
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
  /**
181
   * \returns the WifiMode which represents 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 determined by the HT MCS
186
   * and get the non-HT reference rate by lookup into Table 9-5 of IEEE 802.11-2012.
187
   */
188
  WifiMode GetNonHtReferenceRate (uint8_t nss) const;
180
189
181
  /**
190
  /**
182
   * Create an invalid WifiMode. Calling any method on the
191
   * Create an invalid WifiMode. Calling any method on the

Return to bug 2317