LEFT | RIGHT |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2009 CTTC | 3 * Copyright (c) 2009 CTTC |
4 * Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari | 4 * Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari |
5 * Copyright (c) 2017 Orange Labs | 5 * Copyright (c) 2017 Orange Labs |
6 * | 6 * |
7 * This program is free software; you can redistribute it and/or modify | 7 * This program is free software; you can redistribute it and/or modify |
8 * it under the terms of the GNU General Public License version 2 as | 8 * it under the terms of the GNU General Public License version 2 as |
9 * published by the Free Software Foundation; | 9 * published by the Free Software Foundation; |
10 * | 10 * |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 158 |
159 Ptr<SpectrumValue> | 159 Ptr<SpectrumValue> |
160 WifiSpectrumValueHelper::CreateOfdmTxPowerSpectralDensity (uint32_t centerFreque
ncy, uint8_t channelWidth, double txPowerW, uint8_t guardBandwidth) | 160 WifiSpectrumValueHelper::CreateOfdmTxPowerSpectralDensity (uint32_t centerFreque
ncy, uint8_t channelWidth, double txPowerW, uint8_t guardBandwidth) |
161 { | 161 { |
162 NS_LOG_FUNCTION (centerFrequency << (uint16_t)channelWidth << txPowerW << (uin
t16_t)guardBandwidth); | 162 NS_LOG_FUNCTION (centerFrequency << (uint16_t)channelWidth << txPowerW << (uin
t16_t)guardBandwidth); |
163 double bandBandwidth = 312500; | 163 double bandBandwidth = 312500; |
164 Ptr<SpectrumValue> c = Create<SpectrumValue> (GetSpectrumModel (centerFrequenc
y, channelWidth, bandBandwidth, guardBandwidth)); | 164 Ptr<SpectrumValue> c = Create<SpectrumValue> (GetSpectrumModel (centerFrequenc
y, channelWidth, bandBandwidth, guardBandwidth)); |
165 uint32_t nGuardBands = static_cast<uint32_t>(((2 * guardBandwidth * 1e6) / ban
dBandwidth) + 0.5); | 165 uint32_t nGuardBands = static_cast<uint32_t>(((2 * guardBandwidth * 1e6) / ban
dBandwidth) + 0.5); |
166 uint32_t nAllocatedBands = static_cast<uint32_t>(((channelWidth * 1e6) / bandB
andwidth) + 0.5); | 166 uint32_t nAllocatedBands = static_cast<uint32_t>(((channelWidth * 1e6) / bandB
andwidth) + 0.5); |
167 NS_ASSERT_MSG (c->GetSpectrumModel ()->GetNumBands () == (nAllocatedBands + nG
uardBands + 1), "Unexpected number of bands " << c->GetSpectrumModel ()->GetNumB
ands ()); | 167 NS_ASSERT_MSG (c->GetSpectrumModel ()->GetNumBands () == (nAllocatedBands + nG
uardBands + 1), "Unexpected number of bands " << c->GetSpectrumModel ()->GetNumB
ands ()); |
168 double txPowerPerBand = 0.0; | 168 double txPowerPerBandW = 0.0; |
169 uint32_t start1 = 0; | 169 uint32_t start1 = 0; |
170 uint32_t stop1 = 0; | 170 uint32_t stop1 = 0; |
171 uint32_t start2 = 0; | 171 uint32_t start2 = 0; |
172 uint32_t stop2 = 0; | 172 uint32_t stop2 = 0; |
173 uint32_t innerSlopeWidth = 0; | 173 uint32_t innerSlopeWidth = 0; |
174 switch (channelWidth) | 174 switch (channelWidth) |
175 { | 175 { |
176 case 20: | 176 case 20: |
177 default: | |
178 // 52 subcarriers (48 data + 4 pilot) | 177 // 52 subcarriers (48 data + 4 pilot) |
179 // skip guard band and 6 subbands, then place power in 26 subbands, then | 178 // skip guard band and 6 subbands, then place power in 26 subbands, then |
180 // skip the center subband, then place power in 26 subbands, then skip | 179 // skip the center subband, then place power in 26 subbands, then skip |
181 // the final 6 subbands and the guard band. | 180 // the final 6 subbands and the guard band. |
182 txPowerPerBand = txPowerW / 52; | 181 txPowerPerBandW = txPowerW / 52; |
183 start1 = (nGuardBands / 2) + 6; | 182 start1 = (nGuardBands / 2) + 6; |
184 stop1 = start1 + 26 - 1; | 183 stop1 = start1 + 26 - 1; |
185 start2 = stop1 + 2; | 184 start2 = stop1 + 2; |
186 stop2 = start2 + 26 - 1; | 185 stop2 = start2 + 26 - 1; |
187 innerSlopeWidth = static_cast<uint32_t>((2e6 / bandBandwidth) + 0.5); // [
-11;-9] & [9;11] | 186 innerSlopeWidth = static_cast<uint32_t>((2e6 / bandBandwidth) + 0.5); // [
-11;-9] & [9;11] |
188 break; | 187 break; |
189 case 10: | 188 case 10: |
190 // 28 subcarriers (24 data + 4 pilot) | 189 // 28 subcarriers (24 data + 4 pilot) |
191 // skip guard band and 2 subbands, then place power in 14 subbands, then | 190 // skip guard band and 2 subbands, then place power in 14 subbands, then |
192 // skip the center subband, then place power in 14 subbands, then skip | 191 // skip the center subband, then place power in 14 subbands, then skip |
193 // the final 2 subbands and the guard band. | 192 // the final 2 subbands and the guard band. |
194 txPowerPerBand = txPowerW / 28; | 193 txPowerPerBandW = txPowerW / 28; |
195 start1 = (nGuardBands / 2) + 2; | 194 start1 = (nGuardBands / 2) + 2; |
196 stop1 = start1 + 14 - 1; | 195 stop1 = start1 + 14 - 1; |
197 start2 = stop1 + 2; | 196 start2 = stop1 + 2; |
198 stop2 = start2 + 14 - 1; | 197 stop2 = start2 + 14 - 1; |
199 innerSlopeWidth = static_cast<uint32_t>((1e6 / bandBandwidth) + 0.5); // [
-5.5;-4.5] & [4.5;5.5] | 198 innerSlopeWidth = static_cast<uint32_t>((1e6 / bandBandwidth) + 0.5); // [
-5.5;-4.5] & [4.5;5.5] |
200 break; | 199 break; |
201 case 5: | 200 case 5: |
202 // 16 subcarriers (12 data + 4 pilot) | 201 // 16 subcarriers (12 data + 4 pilot) |
203 // skip guard band and 2 subbands, then place power in 8 subbands, then | 202 // skip guard band and 2 subbands, then place power in 8 subbands, then |
204 // skip the center subband, then place power in 8 subbands, then skip | 203 // skip the center subband, then place power in 8 subbands, then skip |
205 // the final 2 subbands and the guard. | 204 // the final 2 subbands and the guard. |
206 txPowerPerBand = txPowerW / 16; | 205 txPowerPerBandW = txPowerW / 16; |
207 start1 = (nGuardBands / 2) + 2; | 206 start1 = (nGuardBands / 2) + 2; |
208 stop1 = start1 + 8 - 1; | 207 stop1 = start1 + 8 - 1; |
209 start2 = stop1 + 2; | 208 start2 = stop1 + 2; |
210 stop2 = start2 + 8 - 1; | 209 stop2 = start2 + 8 - 1; |
211 innerSlopeWidth = static_cast<uint32_t>((5e5 / bandBandwidth) + 0.5); // [
-2.75;-2.5] & [2.5;2.75] | 210 innerSlopeWidth = static_cast<uint32_t>((5e5 / bandBandwidth) + 0.5); // [
-2.75;-2.5] & [2.5;2.75] |
212 break; | 211 break; |
| 212 default: |
| 213 NS_FATAL_ERROR ("Channel width should be correctly set."); |
| 214 return 0; |
213 } | 215 } |
214 | 216 |
215 //Build transmit spectrum mask | 217 //Build transmit spectrum mask |
216 std::vector <StartStop> subBands; | 218 std::vector <StartStop> subBands; |
217 subBands.push_back (std::make_pair (start1, stop1)); | 219 subBands.push_back (std::make_pair (start1, stop1)); |
218 subBands.push_back (std::make_pair (start2, stop2)); | 220 subBands.push_back (std::make_pair (start2, stop2)); |
219 StartStop maskBand (0, nAllocatedBands + nGuardBands); | 221 StartStop maskBand (0, nAllocatedBands + nGuardBands); |
220 if (channelWidth > 20) | |
221 { | |
222 //To handle cases where legacy OFDM is used for HT/VHT/HE STAs using bandw
idth of 40 MHz and above | |
223 nAllocatedBands = static_cast<uint32_t>(((20e6) / bandBandwidth) + 0.5); | |
224 nGuardBands = nAllocatedBands * 2; | |
225 maskBand.first = start1 - 6 - (nGuardBands / 2); | |
226 maskBand.second = stop2 + 5 + (nGuardBands / 2) + 1; | |
227 } | |
228 | |
229 CreateSpectrumMaskForOfdm (c, subBands, maskBand, | 222 CreateSpectrumMaskForOfdm (c, subBands, maskBand, |
230 txPowerPerBand, nGuardBands, | 223 txPowerPerBandW, nGuardBands, |
231 innerSlopeWidth); | 224 innerSlopeWidth, -40.0); // -40 dBr for the outmost
points of the standard defined mask for 11a, 11g and downclocked versions of 11
a for 11p |
232 NormalizeSpectrumMask (c, txPowerW); | 225 NormalizeSpectrumMask (c, txPowerW); |
233 NS_ASSERT_MSG (std::abs (txPowerW - Integral (*c)) < 1e-6, "Power allocation f
ailed"); | 226 NS_ASSERT_MSG (std::abs (txPowerW - Integral (*c)) < 1e-6, "Power allocation f
ailed"); |
234 return c; | 227 return c; |
235 } | 228 } |
236 | 229 |
237 Ptr<SpectrumValue> | 230 Ptr<SpectrumValue> |
238 WifiSpectrumValueHelper::CreateHtOfdmTxPowerSpectralDensity (uint32_t centerFreq
uency, uint8_t channelWidth, double txPowerW, uint8_t guardBandwidth) | 231 WifiSpectrumValueHelper::CreateHtOfdmTxPowerSpectralDensity (uint32_t centerFreq
uency, uint8_t channelWidth, double txPowerW, uint8_t guardBandwidth) |
239 { | 232 { |
240 NS_LOG_FUNCTION (centerFrequency << (uint16_t)channelWidth << txPowerW << (uin
t16_t)guardBandwidth); | 233 NS_LOG_FUNCTION (centerFrequency << (uint16_t)channelWidth << txPowerW << (uin
t16_t)guardBandwidth); |
241 double bandBandwidth = 312500; | 234 double bandBandwidth = 312500; |
242 Ptr<SpectrumValue> c = Create<SpectrumValue> (GetSpectrumModel (centerFrequenc
y, channelWidth, bandBandwidth, guardBandwidth)); | 235 Ptr<SpectrumValue> c = Create<SpectrumValue> (GetSpectrumModel (centerFrequenc
y, channelWidth, bandBandwidth, guardBandwidth)); |
243 uint32_t nGuardBands = static_cast<uint32_t>(((2 * guardBandwidth * 1e6) / ban
dBandwidth) + 0.5); | 236 uint32_t nGuardBands = static_cast<uint32_t>(((2 * guardBandwidth * 1e6) / ban
dBandwidth) + 0.5); |
244 uint32_t nAllocatedBands = static_cast<uint32_t>(((channelWidth * 1e6) / bandB
andwidth) + 0.5); | 237 uint32_t nAllocatedBands = static_cast<uint32_t>(((channelWidth * 1e6) / bandB
andwidth) + 0.5); |
245 NS_ASSERT_MSG (c->GetSpectrumModel ()->GetNumBands () == (nAllocatedBands + nG
uardBands + 1), "Unexpected number of bands " << c->GetSpectrumModel ()->GetNumB
ands ()); | 238 NS_ASSERT_MSG (c->GetSpectrumModel ()->GetNumBands () == (nAllocatedBands + nG
uardBands + 1), "Unexpected number of bands " << c->GetSpectrumModel ()->GetNumB
ands ()); |
246 double txPowerPerBand = 0.0; | 239 double txPowerPerBandW = 0.0; |
247 // skip the guard band and 4 subbands, then place power in 28 subbands, then | 240 // skip the guard band and 4 subbands, then place power in 28 subbands, then |
248 // skip the center subband, then place power in 28 subbands, then skip | 241 // skip the center subband, then place power in 28 subbands, then skip |
249 // the final 4 subbands and the guard band. | 242 // the final 4 subbands and the guard band. |
250 // Repeat for each 20 MHz band. | 243 // Repeat for each 20 MHz band. |
251 uint32_t start1 = (nGuardBands / 2) + 4; | 244 uint32_t start1 = (nGuardBands / 2) + 4; |
252 uint32_t stop1 = start1 + 28 - 1; | 245 uint32_t stop1 = start1 + 28 - 1; |
253 uint32_t start2 = stop1 + 2; | 246 uint32_t start2 = stop1 + 2; |
254 uint32_t stop2 = start2 + 28 - 1; | 247 uint32_t stop2 = start2 + 28 - 1; |
255 uint32_t start3 = stop2 + (2 * 4); | 248 uint32_t start3 = stop2 + (2 * 4); |
256 uint32_t stop3 = start3 + 28 - 1; | 249 uint32_t stop3 = start3 + 28 - 1; |
(...skipping 27 matching lines...) Expand all Loading... |
284 uint32_t innerSlopeWidth = static_cast<uint32_t>((2e6 / bandBandwidth) + 0.5);
//size in number of subcarriers of the 0dBr<->20dBr slope (2MHz for HT/VHT) | 277 uint32_t innerSlopeWidth = static_cast<uint32_t>((2e6 / bandBandwidth) + 0.5);
//size in number of subcarriers of the 0dBr<->20dBr slope (2MHz for HT/VHT) |
285 double lowestPointDbr = (centerFrequency >= 5000) ? | 278 double lowestPointDbr = (centerFrequency >= 5000) ? |
286 -40.0 : //if 5 GHz band | 279 -40.0 : //if 5 GHz band |
287 -45.0; //if 2.4 GHz band | 280 -45.0; //if 2.4 GHz band |
288 std::vector <StartStop> subBands; //list of data/pilot-containing subBands (se
nt at 0dBr) | 281 std::vector <StartStop> subBands; //list of data/pilot-containing subBands (se
nt at 0dBr) |
289 StartStop maskBand (0, nAllocatedBands + nGuardBands); | 282 StartStop maskBand (0, nAllocatedBands + nGuardBands); |
290 switch (channelWidth) | 283 switch (channelWidth) |
291 { | 284 { |
292 case 20: | 285 case 20: |
293 // 56 subcarriers (52 data + 4 pilot) | 286 // 56 subcarriers (52 data + 4 pilot) |
294 txPowerPerBand = txPowerW / 56; | 287 txPowerPerBandW = txPowerW / 56; |
295 subBands.push_back (std::make_pair (start1, stop1)); | 288 subBands.push_back (std::make_pair (start1, stop1)); |
296 subBands.push_back (std::make_pair (start2, stop2)); | 289 subBands.push_back (std::make_pair (start2, stop2)); |
297 break; | 290 break; |
298 case 40: | 291 case 40: |
299 // 112 subcarriers (104 data + 8 pilot)· | 292 // 112 subcarriers (104 data + 8 pilot)· |
300 // possible alternative: 114 subcarriers (108 data + 6 pilot) | 293 // possible alternative: 114 subcarriers (108 data + 6 pilot) |
301 txPowerPerBand = txPowerW / 112; | 294 txPowerPerBandW = txPowerW / 112; |
302 subBands.push_back (std::make_pair (start1, stop1)); | 295 subBands.push_back (std::make_pair (start1, stop1)); |
303 subBands.push_back (std::make_pair (start2, stop2)); | 296 subBands.push_back (std::make_pair (start2, stop2)); |
304 subBands.push_back (std::make_pair (start3, stop3)); | 297 subBands.push_back (std::make_pair (start3, stop3)); |
305 subBands.push_back (std::make_pair (start4, stop4)); | 298 subBands.push_back (std::make_pair (start4, stop4)); |
306 break; | 299 break; |
307 case 80: | 300 case 80: |
308 // 224 subcarriers (208 data + 16 pilot)· | 301 // 224 subcarriers (208 data + 16 pilot)· |
309 // possible alternative: 242 subcarriers (234 data + 8 pilot) | 302 // possible alternative: 242 subcarriers (234 data + 8 pilot) |
310 txPowerPerBand = txPowerW / 224; | 303 txPowerPerBandW = txPowerW / 224; |
311 NS_ASSERT (lowestPointDbr == -40.0); | 304 NS_ASSERT (lowestPointDbr == -40.0); |
312 subBands.push_back (std::make_pair (start1, stop1)); | 305 subBands.push_back (std::make_pair (start1, stop1)); |
313 subBands.push_back (std::make_pair (start2, stop2)); | 306 subBands.push_back (std::make_pair (start2, stop2)); |
314 subBands.push_back (std::make_pair (start3, stop3)); | 307 subBands.push_back (std::make_pair (start3, stop3)); |
315 subBands.push_back (std::make_pair (start4, stop4)); | 308 subBands.push_back (std::make_pair (start4, stop4)); |
316 subBands.push_back (std::make_pair (start5, stop5)); | 309 subBands.push_back (std::make_pair (start5, stop5)); |
317 subBands.push_back (std::make_pair (start6, stop6)); | 310 subBands.push_back (std::make_pair (start6, stop6)); |
318 subBands.push_back (std::make_pair (start7, stop7)); | 311 subBands.push_back (std::make_pair (start7, stop7)); |
319 subBands.push_back (std::make_pair (start8, stop8)); | 312 subBands.push_back (std::make_pair (start8, stop8)); |
320 break; | 313 break; |
321 case 160: | 314 case 160: |
322 // 448 subcarriers (416 data + 32 pilot) | 315 // 448 subcarriers (416 data + 32 pilot) |
323 // possible alternative: 484 subcarriers (468 data + 16 pilot) | 316 // possible alternative: 484 subcarriers (468 data + 16 pilot) |
324 txPowerPerBand = txPowerW / 448; | 317 txPowerPerBandW = txPowerW / 448; |
325 NS_ASSERT (lowestPointDbr == -40.0); | 318 NS_ASSERT (lowestPointDbr == -40.0); |
326 subBands.push_back (std::make_pair (start1, stop1)); | 319 subBands.push_back (std::make_pair (start1, stop1)); |
327 subBands.push_back (std::make_pair (start2, stop2)); | 320 subBands.push_back (std::make_pair (start2, stop2)); |
328 subBands.push_back (std::make_pair (start3, stop3)); | 321 subBands.push_back (std::make_pair (start3, stop3)); |
329 subBands.push_back (std::make_pair (start4, stop4)); | 322 subBands.push_back (std::make_pair (start4, stop4)); |
330 subBands.push_back (std::make_pair (start5, stop5)); | 323 subBands.push_back (std::make_pair (start5, stop5)); |
331 subBands.push_back (std::make_pair (start6, stop6)); | 324 subBands.push_back (std::make_pair (start6, stop6)); |
332 subBands.push_back (std::make_pair (start7, stop7)); | 325 subBands.push_back (std::make_pair (start7, stop7)); |
333 subBands.push_back (std::make_pair (start8, stop8)); | 326 subBands.push_back (std::make_pair (start8, stop8)); |
334 subBands.push_back (std::make_pair (start9, stop9)); | 327 subBands.push_back (std::make_pair (start9, stop9)); |
335 subBands.push_back (std::make_pair (start10, stop10)); | 328 subBands.push_back (std::make_pair (start10, stop10)); |
336 subBands.push_back (std::make_pair (start11, stop11)); | 329 subBands.push_back (std::make_pair (start11, stop11)); |
337 subBands.push_back (std::make_pair (start12, stop12)); | 330 subBands.push_back (std::make_pair (start12, stop12)); |
338 subBands.push_back (std::make_pair (start13, stop13)); | 331 subBands.push_back (std::make_pair (start13, stop13)); |
339 subBands.push_back (std::make_pair (start14, stop14)); | 332 subBands.push_back (std::make_pair (start14, stop14)); |
340 subBands.push_back (std::make_pair (start15, stop15)); | 333 subBands.push_back (std::make_pair (start15, stop15)); |
341 subBands.push_back (std::make_pair (start16, stop16)); | 334 subBands.push_back (std::make_pair (start16, stop16)); |
342 break; | 335 break; |
343 } | 336 } |
344 | 337 |
345 //Build transmit spectrum mask | 338 //Build transmit spectrum mask |
346 CreateSpectrumMaskForOfdm (c, subBands, maskBand, | 339 CreateSpectrumMaskForOfdm (c, subBands, maskBand, |
347 txPowerPerBand, nGuardBands, | 340 txPowerPerBandW, nGuardBands, |
348 innerSlopeWidth, lowestPointDbr); | 341 innerSlopeWidth, lowestPointDbr); |
349 NormalizeSpectrumMask (c, txPowerW); | 342 NormalizeSpectrumMask (c, txPowerW); |
350 NS_ASSERT_MSG (std::abs (txPowerW - Integral (*c)) < 1e-6, "Power allocation f
ailed"); | 343 NS_ASSERT_MSG (std::abs (txPowerW - Integral (*c)) < 1e-6, "Power allocation f
ailed"); |
351 return c; | 344 return c; |
352 } | 345 } |
353 | 346 |
354 Ptr<SpectrumValue> | 347 Ptr<SpectrumValue> |
355 WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity (uint32_t centerFreq
uency, uint8_t channelWidth, double txPowerW, uint8_t guardBandwidth) | 348 WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity (uint32_t centerFreq
uency, uint8_t channelWidth, double txPowerW, uint8_t guardBandwidth) |
356 { | 349 { |
357 NS_LOG_FUNCTION (centerFrequency << (uint16_t)channelWidth << txPowerW << (uin
t16_t)guardBandwidth); | 350 NS_LOG_FUNCTION (centerFrequency << (uint16_t)channelWidth << txPowerW << (uin
t16_t)guardBandwidth); |
358 double bandBandwidth = 78125; | 351 double bandBandwidth = 78125; |
359 Ptr<SpectrumValue> c = Create<SpectrumValue> (GetSpectrumModel (centerFrequenc
y, channelWidth, bandBandwidth, guardBandwidth)); | 352 Ptr<SpectrumValue> c = Create<SpectrumValue> (GetSpectrumModel (centerFrequenc
y, channelWidth, bandBandwidth, guardBandwidth)); |
360 uint32_t nGuardBands = static_cast<uint32_t>(((2 * guardBandwidth * 1e6) / ban
dBandwidth) + 0.5); | 353 uint32_t nGuardBands = static_cast<uint32_t>(((2 * guardBandwidth * 1e6) / ban
dBandwidth) + 0.5); |
361 uint32_t nAllocatedBands = static_cast<uint32_t>(((channelWidth * 1e6) / bandB
andwidth) + 0.5); | 354 uint32_t nAllocatedBands = static_cast<uint32_t>(((channelWidth * 1e6) / bandB
andwidth) + 0.5); |
362 NS_ASSERT_MSG (c->GetSpectrumModel ()->GetNumBands () == (nAllocatedBands + nG
uardBands + 1), "Unexpected number of bands " << c->GetSpectrumModel ()->GetNumB
ands ()); | 355 NS_ASSERT_MSG (c->GetSpectrumModel ()->GetNumBands () == (nAllocatedBands + nG
uardBands + 1), "Unexpected number of bands " << c->GetSpectrumModel ()->GetNumB
ands ()); |
363 double txPowerPerBand = 0.0; | 356 double txPowerPerBandW = 0.0; |
364 uint32_t start1; | 357 uint32_t start1; |
365 uint32_t stop1; | 358 uint32_t stop1; |
366 uint32_t start2; | 359 uint32_t start2; |
367 uint32_t stop2; | 360 uint32_t stop2; |
368 uint32_t start3; | 361 uint32_t start3; |
369 uint32_t stop3; | 362 uint32_t stop3; |
370 uint32_t start4; | 363 uint32_t start4; |
371 uint32_t stop4; | 364 uint32_t stop4; |
372 //Prepare spectrum mask specific variables | 365 //Prepare spectrum mask specific variables |
373 uint32_t innerSlopeWidth = static_cast<uint32_t>((1e6 / bandBandwidth) + 0.5);
//size in number of subcarriers of the 0dBr<->20dBr slope | 366 uint32_t innerSlopeWidth = static_cast<uint32_t>((1e6 / bandBandwidth) + 0.5);
//size in number of subcarriers of the 0dBr<->20dBr slope |
374 double lowestPointDbr = (centerFrequency >= 5000) ? | 367 double lowestPointDbr = (centerFrequency >= 5000) ? |
375 -40.0 : //if 5 GHz band | 368 -40.0 : //if 5 GHz band |
376 -45.0; //if 2.4 GHz band | 369 -45.0; //if 2.4 GHz band |
377 std::vector <StartStop> subBands; //list of data/pilot-containing subBands (se
nt at 0dBr) | 370 std::vector <StartStop> subBands; //list of data/pilot-containing subBands (se
nt at 0dBr) |
378 StartStop maskBand (0, nAllocatedBands + nGuardBands); | 371 StartStop maskBand (0, nAllocatedBands + nGuardBands); |
379 switch (channelWidth) | 372 switch (channelWidth) |
380 { | 373 { |
381 case 20: | 374 case 20: |
382 // 242 subcarriers (234 data + 8 pilot) | 375 // 242 subcarriers (234 data + 8 pilot) |
383 txPowerPerBand = txPowerW / 242; | 376 txPowerPerBandW = txPowerW / 242; |
384 innerSlopeWidth = static_cast<uint32_t>((5e5 / bandBandwidth) + 0.5); // [
-10.25;-9.75] & [9.75;10.25] | 377 innerSlopeWidth = static_cast<uint32_t>((5e5 / bandBandwidth) + 0.5); // [
-10.25;-9.75] & [9.75;10.25] |
385 // skip the guard band and 6 subbands, then place power in 121 subbands, t
hen | 378 // skip the guard band and 6 subbands, then place power in 121 subbands, t
hen |
386 // skip 3 DC, then place power in 121 subbands, then skip | 379 // skip 3 DC, then place power in 121 subbands, then skip |
387 // the final 6 subbands and the guard band. | 380 // the final 6 subbands and the guard band. |
388 start1 = (nGuardBands / 2) + 6; | 381 start1 = (nGuardBands / 2) + 6; |
389 stop1 = start1 + 121 - 1; | 382 stop1 = start1 + 121 - 1; |
390 start2 = stop1 + 4; | 383 start2 = stop1 + 4; |
391 stop2 = start2 + 121 - 1; | 384 stop2 = start2 + 121 - 1; |
392 subBands.push_back (std::make_pair (start1, stop1)); | 385 subBands.push_back (std::make_pair (start1, stop1)); |
393 subBands.push_back (std::make_pair (start2, stop2)); | 386 subBands.push_back (std::make_pair (start2, stop2)); |
394 break; | 387 break; |
395 case 40: | 388 case 40: |
396 // 484 subcarriers (468 data + 16 pilot) | 389 // 484 subcarriers (468 data + 16 pilot) |
397 txPowerPerBand = txPowerW / 484; | 390 txPowerPerBandW = txPowerW / 484; |
398 // skip the guard band and 12 subbands, then place power in 242 subbands,
then | 391 // skip the guard band and 12 subbands, then place power in 242 subbands,
then |
399 // skip 5 DC, then place power in 242 subbands, then skip | 392 // skip 5 DC, then place power in 242 subbands, then skip |
400 // the final 12 subbands and the guard band. | 393 // the final 12 subbands and the guard band. |
401 start1 = (nGuardBands / 2) + 12; | 394 start1 = (nGuardBands / 2) + 12; |
402 stop1 = start1 + 242 - 1; | 395 stop1 = start1 + 242 - 1; |
403 start2 = stop1 + 6; | 396 start2 = stop1 + 6; |
404 stop2 = start2 + 242 - 1; | 397 stop2 = start2 + 242 - 1; |
405 subBands.push_back (std::make_pair (start1, stop1)); | 398 subBands.push_back (std::make_pair (start1, stop1)); |
406 subBands.push_back (std::make_pair (start2, stop2)); | 399 subBands.push_back (std::make_pair (start2, stop2)); |
407 break; | 400 break; |
408 case 80: | 401 case 80: |
409 // 996 subcarriers (980 data + 16 pilot) | 402 // 996 subcarriers (980 data + 16 pilot) |
410 txPowerPerBand = txPowerW / 996; | 403 txPowerPerBandW = txPowerW / 996; |
411 // skip the guard band and 12 subbands, then place power in 498 subbands,
then | 404 // skip the guard band and 12 subbands, then place power in 498 subbands,
then |
412 // skip 5 DC, then place power in 498 subbands, then skip | 405 // skip 5 DC, then place power in 498 subbands, then skip |
413 // the final 12 subbands and the guard band. | 406 // the final 12 subbands and the guard band. |
414 start1 = (nGuardBands / 2) + 12; | 407 start1 = (nGuardBands / 2) + 12; |
415 stop1 = start1 + 498 - 1; | 408 stop1 = start1 + 498 - 1; |
416 start2 = stop1 + 6; | 409 start2 = stop1 + 6; |
417 stop2 = start2 + 498 - 1; | 410 stop2 = start2 + 498 - 1; |
418 subBands.push_back (std::make_pair (start1, stop1)); | 411 subBands.push_back (std::make_pair (start1, stop1)); |
419 subBands.push_back (std::make_pair (start2, stop2)); | 412 subBands.push_back (std::make_pair (start2, stop2)); |
420 break; | 413 break; |
421 case 160: | 414 case 160: |
422 // 2 x 996 subcarriers (2 x 80 MHZ bands) | 415 // 2 x 996 subcarriers (2 x 80 MHZ bands) |
423 txPowerPerBand = txPowerW / (2 * 996); | 416 txPowerPerBandW = txPowerW / (2 * 996); |
424 start1 = (nGuardBands / 2) + 12; | 417 start1 = (nGuardBands / 2) + 12; |
425 stop1 = start1 + 498 - 1; | 418 stop1 = start1 + 498 - 1; |
426 start2 = stop1 + 6; | 419 start2 = stop1 + 6; |
427 stop2 = start2 + 498 - 1; | 420 stop2 = start2 + 498 - 1; |
428 start3 = stop2 + (2 * 12); | 421 start3 = stop2 + (2 * 12); |
429 stop3 = start3 + 498 - 1; | 422 stop3 = start3 + 498 - 1; |
430 start4 = stop3 + 6; | 423 start4 = stop3 + 6; |
431 stop4 = start4 + 498 - 1; | 424 stop4 = start4 + 498 - 1; |
432 subBands.push_back (std::make_pair (start1, stop1)); | 425 subBands.push_back (std::make_pair (start1, stop1)); |
433 subBands.push_back (std::make_pair (start2, stop2)); | 426 subBands.push_back (std::make_pair (start2, stop2)); |
434 subBands.push_back (std::make_pair (start3, stop3)); | 427 subBands.push_back (std::make_pair (start3, stop3)); |
435 subBands.push_back (std::make_pair (start4, stop4)); | 428 subBands.push_back (std::make_pair (start4, stop4)); |
436 break; | 429 break; |
437 default: | 430 default: |
438 NS_FATAL_ERROR ("ChannelWidth " << channelWidth << " unsupported"); | 431 NS_FATAL_ERROR ("ChannelWidth " << channelWidth << " unsupported"); |
439 break; | 432 break; |
440 } | 433 } |
441 | 434 |
442 //Build transmit spectrum mask | 435 //Build transmit spectrum mask |
443 CreateSpectrumMaskForOfdm (c, subBands, maskBand, | 436 CreateSpectrumMaskForOfdm (c, subBands, maskBand, |
444 txPowerPerBand, nGuardBands, | 437 txPowerPerBandW, nGuardBands, |
445 innerSlopeWidth, lowestPointDbr); | 438 innerSlopeWidth, lowestPointDbr); |
446 NormalizeSpectrumMask (c, txPowerW); | 439 NormalizeSpectrumMask (c, txPowerW); |
447 NS_ASSERT_MSG (std::abs (txPowerW - Integral (*c)) < 1e-6, "Power allocation f
ailed"); | 440 NS_ASSERT_MSG (std::abs (txPowerW - Integral (*c)) < 1e-6, "Power allocation f
ailed"); |
448 return c; | 441 return c; |
449 } | 442 } |
450 | 443 |
451 Ptr<SpectrumValue> | 444 Ptr<SpectrumValue> |
452 WifiSpectrumValueHelper::CreateNoisePowerSpectralDensity (uint32_t centerFrequen
cy, uint8_t channelWidth, double bandBandwidth, double noiseFigure, uint8_t guar
dBandwidth) | 445 WifiSpectrumValueHelper::CreateNoisePowerSpectralDensity (uint32_t centerFrequen
cy, uint8_t channelWidth, double bandBandwidth, double noiseFigure, uint8_t guar
dBandwidth) |
453 { | 446 { |
454 Ptr<SpectrumModel> model = GetSpectrumModel (centerFrequency, channelWidth, ba
ndBandwidth, guardBandwidth); | 447 Ptr<SpectrumModel> model = GetSpectrumModel (centerFrequency, channelWidth, ba
ndBandwidth, guardBandwidth); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 uint32_t innerSlopeWidth, do
uble lowestPointDbr) | 500 uint32_t innerSlopeWidth, do
uble lowestPointDbr) |
508 { | 501 { |
509 NS_LOG_FUNCTION (c << allocatedSubBands.front ().first << allocatedSubBands.ba
ck ().second << maskBand.first << maskBand.second << txPowerPerBandW << nGuardBa
nds << innerSlopeWidth << lowestPointDbr); | 502 NS_LOG_FUNCTION (c << allocatedSubBands.front ().first << allocatedSubBands.ba
ck ().second << maskBand.first << maskBand.second << txPowerPerBandW << nGuardBa
nds << innerSlopeWidth << lowestPointDbr); |
510 uint32_t numSubBands = allocatedSubBands.size (); | 503 uint32_t numSubBands = allocatedSubBands.size (); |
511 uint32_t numBands = c->GetSpectrumModel ()->GetNumBands (); | 504 uint32_t numBands = c->GetSpectrumModel ()->GetNumBands (); |
512 uint32_t numMaskBands = maskBand.second - maskBand.first + 1; | 505 uint32_t numMaskBands = maskBand.second - maskBand.first + 1; |
513 NS_ASSERT (numSubBands && numBands && numMaskBands); | 506 NS_ASSERT (numSubBands && numBands && numMaskBands); |
514 NS_LOG_LOGIC ("Power per band " << txPowerPerBandW << "W"); | 507 NS_LOG_LOGIC ("Power per band " << txPowerPerBandW << "W"); |
515 | 508 |
516 //Different power levels | 509 //Different power levels |
517 double txPowerPerBandDbm = (10.0 * std::log10 (txPowerPerBandW * 1000.0)); | 510 double txPowerRefDbm = (10.0 * std::log10 (txPowerPerBandW * 1000.0)); |
518 double txPowerMinus20dBr = txPowerPerBandDbm - 20; | 511 double txPowerInnerBandMinDbm = txPowerRefDbm - 20; |
519 double txPowerMinus28dBr = txPowerPerBandDbm - 28; | 512 double txPowerMiddleBandMinDbm = txPowerRefDbm - 28; |
520 double txPowerLowestPoint = txPowerPerBandDbm + lowestPointDbr; //TODO also ta
ke into account dBm/MHz constraints | 513 double txPowerOuterBandMinDbm = txPowerRefDbm + lowestPointDbr; //TODO also ta
ke into account dBm/MHz constraints |
521 | 514 |
522 //Different widths (in number of bands) | 515 //Different widths (in number of bands) |
523 uint32_t outerSlopeWidth = nGuardBands / 4; | 516 uint32_t outerSlopeWidth = nGuardBands / 4; // nGuardBands is the total left+r
ight guard band. The left/right outer part is half of the left/right guard band. |
524 uint32_t middleSlopeWidth = outerSlopeWidth - (innerSlopeWidth / 2); | 517 uint32_t middleSlopeWidth = outerSlopeWidth - (innerSlopeWidth / 2); |
525 StartStop outerBandLeft (maskBand.first, //to handle cases where allocated cha
nnel is under WifiPhy configured channel width. | 518 StartStop outerBandLeft (maskBand.first, //to handle cases where allocated cha
nnel is under WifiPhy configured channel width. |
526 maskBand.first + outerSlopeWidth - 1); | 519 maskBand.first + outerSlopeWidth - 1); |
527 StartStop middleBandLeft (outerBandLeft.second + 1, | 520 StartStop middleBandLeft (outerBandLeft.second + 1, |
528 outerBandLeft.second + middleSlopeWidth); | 521 outerBandLeft.second + middleSlopeWidth); |
529 StartStop innerBandLeft (allocatedSubBands.front ().first - innerSlopeWidth, | 522 StartStop innerBandLeft (allocatedSubBands.front ().first - innerSlopeWidth, |
530 allocatedSubBands.front ().first - 1); //better to pl
ace slope based on allocated subcarriers | 523 allocatedSubBands.front ().first - 1); //better to pl
ace slope based on allocated subcarriers |
531 StartStop flatJunctionLeft (middleBandLeft.second + 1, | 524 StartStop flatJunctionLeft (middleBandLeft.second + 1, |
532 innerBandLeft.first - 1); //in order to handle shi
ft due to guard subcarriers | 525 innerBandLeft.first - 1); //in order to handle shi
ft due to guard subcarriers |
533 StartStop outerBandRight (maskBand.second - outerSlopeWidth + 1, | 526 StartStop outerBandRight (maskBand.second - outerSlopeWidth + 1, |
(...skipping 14 matching lines...) Expand all Loading... |
548 "middleBandRight=[" << middleBandRight.first << ";" << middleBan
dRight.second << "] " << | 541 "middleBandRight=[" << middleBandRight.first << ";" << middleBan
dRight.second << "] " << |
549 "outerBandRight=[" << outerBandRight.first << ";" << outerBandRi
ght.second << "] "); | 542 "outerBandRight=[" << outerBandRight.first << ";" << outerBandRi
ght.second << "] "); |
550 NS_ASSERT (numMaskBands == ((allocatedSubBands.back ().second - allocatedSubBa
nds.front ().first + 1) //equivalent to allocatedBand (includes notches and DC) | 543 NS_ASSERT (numMaskBands == ((allocatedSubBands.back ().second - allocatedSubBa
nds.front ().first + 1) //equivalent to allocatedBand (includes notches and DC) |
551 + 2 * (innerSlopeWidth + middleSlopeWidth + outerSl
opeWidth) | 544 + 2 * (innerSlopeWidth + middleSlopeWidth + outerSl
opeWidth) |
552 + (flatJunctionLeft.second - flatJunctionLeft.first
+ 1) //flat junctions | 545 + (flatJunctionLeft.second - flatJunctionLeft.first
+ 1) //flat junctions |
553 + (flatJunctionRight.second - flatJunctionRight.fir
st + 1))); | 546 + (flatJunctionRight.second - flatJunctionRight.fir
st + 1))); |
554 | 547 |
555 //Different slopes | 548 //Different slopes |
556 double innerSlope = 20.0 / innerSlopeWidth; //0 to 20dBr | 549 double innerSlope = 20.0 / innerSlopeWidth; //0 to 20dBr |
557 double middleSlope = 8.0 / middleSlopeWidth; //20 to 28dBr | 550 double middleSlope = 8.0 / middleSlopeWidth; //20 to 28dBr |
558 double outerSlope = (txPowerMinus28dBr - txPowerLowestPoint) / outerSlopeWidth
; | 551 double outerSlope = (txPowerMiddleBandMinDbm - txPowerOuterBandMinDbm) / outer
SlopeWidth; |
559 | 552 |
560 //Build spectrum mask | 553 //Build spectrum mask |
561 Values::iterator vit = c->ValuesBegin (); | 554 Values::iterator vit = c->ValuesBegin (); |
562 Bands::const_iterator bit = c->ConstBandsBegin (); | 555 Bands::const_iterator bit = c->ConstBandsBegin (); |
563 double txPowerW = 0.0; | 556 double txPowerW = 0.0; |
564 for (size_t i = 0; i < numBands; i++, vit++, bit++) | 557 for (size_t i = 0; i < numBands; i++, vit++, bit++) |
565 { | 558 { |
566 if (i < maskBand.first || i > maskBand.second) //outside the spectrum mask | 559 if (i < maskBand.first || i > maskBand.second) //outside the spectrum mask |
567 { | 560 { |
568 txPowerW = 0.0; | 561 txPowerW = 0.0; |
569 } | 562 } |
570 else if (i <= outerBandLeft.second && i >= outerBandLeft.first) //better t
o put greater first (less computation) | 563 else if (i <= outerBandLeft.second && i >= outerBandLeft.first) //better t
o put greater first (less computation) |
571 { | 564 { |
572 txPowerW = std::pow (10.0, (txPowerLowestPoint + ((i - outerBandLeft.f
irst) * outerSlope)) / 10.0) / 1000.0; | 565 txPowerW = DbmToW (txPowerOuterBandMinDbm + ((i - outerBandLeft.first)
* outerSlope)); |
573 } | 566 } |
574 else if (i <= middleBandLeft.second && i >= middleBandLeft.first) | 567 else if (i <= middleBandLeft.second && i >= middleBandLeft.first) |
575 { | 568 { |
576 txPowerW = std::pow (10.0, (txPowerMinus28dBr + ((i - middleBandLeft.f
irst) * middleSlope)) / 10.0) / 1000.0; | 569 txPowerW = DbmToW (txPowerMiddleBandMinDbm + ((i - middleBandLeft.firs
t) * middleSlope)); |
577 } | 570 } |
578 else if (i <= flatJunctionLeft.second && i >= flatJunctionLeft.first) | 571 else if (i <= flatJunctionLeft.second && i >= flatJunctionLeft.first) |
579 { | 572 { |
580 txPowerW = std::pow (10.0, txPowerMinus20dBr / 10.0) / 1000.0; | 573 txPowerW = DbmToW (txPowerInnerBandMinDbm); |
581 } | 574 } |
582 else if (i <= innerBandLeft.second && i >= innerBandLeft.first) | 575 else if (i <= innerBandLeft.second && i >= innerBandLeft.first) |
583 { | 576 { |
584 txPowerW = std::pow (10.0, (txPowerMinus20dBr + ((i - innerBandLeft.fi
rst) * innerSlope)) / 10.0) / 1000.0; | 577 txPowerW = DbmToW (txPowerInnerBandMinDbm + ((i - innerBandLeft.first)
* innerSlope)); |
585 } | 578 } |
586 else if (i <= allocatedSubBands.back ().second && i >= allocatedSubBands.f
ront ().first) //roughly in allocated band | 579 else if (i <= allocatedSubBands.back ().second && i >= allocatedSubBands.f
ront ().first) //roughly in allocated band |
587 { | 580 { |
588 bool insideSubBand = false; | 581 bool insideSubBand = false; |
589 for (uint32_t j = 0; !insideSubBand && j < numSubBands; j++) //continu
e until inside a sub-band | 582 for (uint32_t j = 0; !insideSubBand && j < numSubBands; j++) //continu
e until inside a sub-band |
590 { | 583 { |
591 insideSubBand = (i <= allocatedSubBands[j].second) && (i >= alloca
tedSubBands[j].first); | 584 insideSubBand = (i <= allocatedSubBands[j].second) && (i >= alloca
tedSubBands[j].first); |
592 } | 585 } |
593 if (insideSubBand) | 586 if (insideSubBand) |
594 { | 587 { |
595 txPowerW = txPowerPerBandW; | 588 txPowerW = txPowerPerBandW; |
596 } | 589 } |
597 else | 590 else |
598 { | 591 { |
599 txPowerW = std::pow (10.0, txPowerMinus20dBr / 10.0) / 1000.0; //c
onsider that nulled as much as possible inband but power leakage -> -20dBr | 592 txPowerW = DbmToW (txPowerInnerBandMinDbm); //consider that nulled
as much as possible inband but power leakage -> -20dBr |
600 } | 593 } |
601 } | 594 } |
602 else if (i <= innerBandRight.second && i >= innerBandRight.first) | 595 else if (i <= innerBandRight.second && i >= innerBandRight.first) |
603 { | 596 { |
604 txPowerW = std::pow (10.0, (txPowerPerBandDbm - ((i - innerBandRight.f
irst + 1) * innerSlope)) / 10.0) / 1000.0; // +1 so as to be symmetric with left
slope | 597 txPowerW = DbmToW (txPowerRefDbm - ((i - innerBandRight.first + 1) * i
nnerSlope)); // +1 so as to be symmetric with left slope |
605 } | 598 } |
606 else if (i <= flatJunctionRight.second && i >= flatJunctionRight.first) | 599 else if (i <= flatJunctionRight.second && i >= flatJunctionRight.first) |
607 { | 600 { |
608 txPowerW = std::pow (10.0, txPowerMinus20dBr / 10.0) / 1000.0; | 601 txPowerW = DbmToW (txPowerInnerBandMinDbm); |
609 } | 602 } |
610 else if (i <= middleBandRight.second && i >= middleBandRight.first) | 603 else if (i <= middleBandRight.second && i >= middleBandRight.first) |
611 { | 604 { |
612 txPowerW = std::pow (10.0, (txPowerMinus20dBr - ((i - middleBandRight.
first + 1) * middleSlope)) / 10.0) / 1000.0; // +1 so as to be symmetric with le
ft slope | 605 txPowerW = DbmToW (txPowerInnerBandMinDbm - ((i - middleBandRight.firs
t + 1) * middleSlope)); // +1 so as to be symmetric with left slope |
613 } | 606 } |
614 else if (i <= outerBandRight.second && i >= outerBandRight.first) | 607 else if (i <= outerBandRight.second && i >= outerBandRight.first) |
615 { | 608 { |
616 txPowerW = std::pow (10.0, (txPowerMinus28dBr - ((i - outerBandRight.f
irst + 1) * outerSlope)) / 10.0) / 1000.0; // +1 so as to be symmetric with left
slope | 609 txPowerW = DbmToW (txPowerMiddleBandMinDbm - ((i - outerBandRight.firs
t + 1) * outerSlope)); // +1 so as to be symmetric with left slope |
617 } | 610 } |
618 else | 611 else |
619 { | 612 { |
620 NS_FATAL_ERROR ("Should have handled all cases"); | 613 NS_FATAL_ERROR ("Should have handled all cases"); |
621 } | 614 } |
622 double txPowerDbr = 10 * std::log10 (txPowerW / txPowerPerBandW); | 615 double txPowerDbr = 10 * std::log10 (txPowerW / txPowerPerBandW); |
623 NS_LOG_LOGIC (uint32_t(i) << " -> " << txPowerDbr); | 616 NS_LOG_LOGIC (uint32_t(i) << " -> " << txPowerDbr); |
624 *vit = txPowerW / (bit->fh - bit->fl); | 617 *vit = txPowerW / (bit->fh - bit->fl); |
625 } | 618 } |
626 NS_LOG_INFO ("Added signal power to subbands " << allocatedSubBands.front ().f
irst << "-" << allocatedSubBands.back ().second); | 619 NS_LOG_INFO ("Added signal power to subbands " << allocatedSubBands.front ().f
irst << "-" << allocatedSubBands.back ().second); |
627 } | 620 } |
628 | 621 |
629 void | 622 void |
630 WifiSpectrumValueHelper::NormalizeSpectrumMask (Ptr<SpectrumValue> c, double txP
owerW) | 623 WifiSpectrumValueHelper::NormalizeSpectrumMask (Ptr<SpectrumValue> c, double txP
owerW) |
631 { | 624 { |
632 NS_LOG_FUNCTION (c << txPowerW); | 625 NS_LOG_FUNCTION (c << txPowerW); |
633 //Normalize power so that total signal power equals transmit power | 626 //Normalize power so that total signal power equals transmit power |
634 double currentTxPowerW = Integral (*c); | 627 double currentTxPowerW = Integral (*c); |
635 double normalizationRatio = currentTxPowerW / txPowerW; | 628 double normalizationRatio = currentTxPowerW / txPowerW; |
636 NS_LOG_LOGIC ("Current power: " << currentTxPowerW << "W vs expected power: "
<< txPowerW << "W" << | 629 NS_LOG_LOGIC ("Current power: " << currentTxPowerW << "W vs expected power: "
<< txPowerW << "W" << |
637 " -> ratio (C/E) = " << normalizationRatio); | 630 " -> ratio (C/E) = " << normalizationRatio); |
638 Values::iterator vit = c->ValuesBegin (); | 631 Values::iterator vit = c->ValuesBegin (); |
639 for (size_t i = 0; i < c->GetSpectrumModel ()->GetNumBands (); i++, vit++) | 632 for (size_t i = 0; i < c->GetSpectrumModel ()->GetNumBands (); i++, vit++) |
640 { | 633 { |
641 *vit = (*vit) / normalizationRatio; | 634 *vit = (*vit) / normalizationRatio; |
642 } | 635 } |
| 636 } |
| 637 |
| 638 double |
| 639 WifiSpectrumValueHelper::DbmToW (double dBm) |
| 640 { |
| 641 double mW = std::pow (10.0, dBm / 10.0); |
| 642 return mW / 1000.0; |
643 } | 643 } |
644 | 644 |
645 static Ptr<SpectrumModel> g_WifiSpectrumModel5Mhz; ///< static initializer for t
he class | 645 static Ptr<SpectrumModel> g_WifiSpectrumModel5Mhz; ///< static initializer for t
he class |
646 | 646 |
647 WifiSpectrumValueHelper::~WifiSpectrumValueHelper () | 647 WifiSpectrumValueHelper::~WifiSpectrumValueHelper () |
648 { | 648 { |
649 } | 649 } |
650 | 650 |
651 WifiSpectrumValue5MhzFactory::~WifiSpectrumValue5MhzFactory () | 651 WifiSpectrumValue5MhzFactory::~WifiSpectrumValue5MhzFactory () |
652 { | 652 { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 (*rf)[channel + 3] = 1; | 729 (*rf)[channel + 3] = 1; |
730 (*rf)[channel + 4] = 1; | 730 (*rf)[channel + 4] = 1; |
731 (*rf)[channel + 5] = 1; | 731 (*rf)[channel + 5] = 1; |
732 (*rf)[channel + 6] = 1; | 732 (*rf)[channel + 6] = 1; |
733 | 733 |
734 return rf; | 734 return rf; |
735 } | 735 } |
736 | 736 |
737 | 737 |
738 } // namespace ns3 | 738 } // namespace ns3 |
LEFT | RIGHT |