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

(-)a/src/wifi/model/wifi-mode.cc (-16 / +11 lines)
 Lines 112-145    Link Here 
112
  NS_ASSERT (nss <= 4);
112
  NS_ASSERT (nss <= 4);
113
  struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
113
  struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
114
  uint64_t dataRate = 0;
114
  uint64_t dataRate = 0;
115
  uint32_t usableSubCarriers = 0;
116
  double symbolRate = 0;
117
  double codingRate = 0;
118
  uint32_t numberOfBitsPerSubcarrier = log2 (GetConstellationSize ());
115
  if (item->modClass == WIFI_MOD_CLASS_DSSS)
119
  if (item->modClass == WIFI_MOD_CLASS_DSSS)
116
    {
120
    {
117
      dataRate = (11000000 / 11) * log2 (GetConstellationSize ());
121
      dataRate = ((11000000 / 11) * numberOfBitsPerSubcarrier);
118
    }
122
    }
119
  else if (item->modClass == WIFI_MOD_CLASS_HR_DSSS)
123
  else if (item->modClass == WIFI_MOD_CLASS_HR_DSSS)
120
    {
124
    {
121
      dataRate = (11000000 / 8) * log2 (GetConstellationSize ());
125
      dataRate = ((11000000 / 8) * numberOfBitsPerSubcarrier);
122
    }
126
    }
123
  else if (item->modClass == WIFI_MOD_CLASS_OFDM || item->modClass == WIFI_MOD_CLASS_ERP_OFDM)
127
  else if (item->modClass == WIFI_MOD_CLASS_OFDM || item->modClass == WIFI_MOD_CLASS_ERP_OFDM)
124
    {
128
    {
125
      double symbolRate = (1 / 4.0) * 1e6;
129
      usableSubCarriers = 48;
126
127
      uint32_t usableSubCarriers;
128
      switch (channelWidth)
130
      switch (channelWidth)
129
        {
131
        {
130
        case 20:
132
        case 20:
131
        default:
133
        default:
132
          usableSubCarriers = 48;
134
          symbolRate = (1 / 4.0) * 1e6;
133
          break;
135
          break;
134
        case 10:
136
        case 10:
135
          usableSubCarriers = 24;
137
          symbolRate = (1 / 8.0) * 1e6;
136
          break;
138
          break;
137
        case 5:
139
        case 5:
138
          usableSubCarriers = 12;
140
          symbolRate = (1 / 16.0) * 1e6;
139
          break;
141
          break;
140
        }
142
        }
141
143
142
      double codingRate;
143
      switch (GetCodeRate ())
144
      switch (GetCodeRate ())
144
        {
145
        {
145
        case WIFI_CODE_RATE_3_4:
146
        case WIFI_CODE_RATE_3_4:
 Lines 157-164    Link Here 
157
          break;
158
          break;
158
        }
159
        }
159
160
160
      uint32_t numberOfBitsPerSubcarrier = log2 (GetConstellationSize ());
161
162
      dataRate = lrint (ceil (symbolRate * usableSubCarriers * numberOfBitsPerSubcarrier * codingRate));
161
      dataRate = lrint (ceil (symbolRate * usableSubCarriers * numberOfBitsPerSubcarrier * codingRate));
163
    }
162
    }
164
  else if (item->modClass == WIFI_MOD_CLASS_HT || item->modClass == WIFI_MOD_CLASS_VHT)
163
  else if (item->modClass == WIFI_MOD_CLASS_HT || item->modClass == WIFI_MOD_CLASS_VHT)
 Lines 171-177    Link Here 
171
        {
170
        {
172
          NS_ASSERT_MSG (channelWidth != 80, "VHT MCS 6 forbidden at 80 MHz when NSS = 3");
171
          NS_ASSERT_MSG (channelWidth != 80, "VHT MCS 6 forbidden at 80 MHz when NSS = 3");
173
        }
172
        }
174
      double symbolRate;
173
175
      if (!isShortGuardInterval)
174
      if (!isShortGuardInterval)
176
        {
175
        {
177
          symbolRate = (1 / 4.0) * 1e6;
176
          symbolRate = (1 / 4.0) * 1e6;
 Lines 181-187    Link Here 
181
          symbolRate = (1 / 3.6) * 1e6;
180
          symbolRate = (1 / 3.6) * 1e6;
182
        }
181
        }
183
182
184
      uint32_t usableSubCarriers;
185
      switch (channelWidth)
183
      switch (channelWidth)
186
        {
184
        {
187
        case 20:
185
        case 20:
 Lines 199-205    Link Here 
199
          break;
197
          break;
200
        }
198
        }
201
199
202
      double codingRate;
203
      switch (GetCodeRate ())
200
      switch (GetCodeRate ())
204
        {
201
        {
205
        case WIFI_CODE_RATE_5_6:
202
        case WIFI_CODE_RATE_5_6:
 Lines 220-227    Link Here 
220
          break;
217
          break;
221
        }
218
        }
222
219
223
      uint32_t numberOfBitsPerSubcarrier = log2 (GetConstellationSize ());
224
225
      dataRate = lrint (ceil (symbolRate * usableSubCarriers * numberOfBitsPerSubcarrier * codingRate));
220
      dataRate = lrint (ceil (symbolRate * usableSubCarriers * numberOfBitsPerSubcarrier * codingRate));
226
    }
221
    }
227
  else
222
  else

Return to bug 2351