|
|
| 135 |
Ptr<SpectrumValue> c = Create<SpectrumValue> (GetSpectrumModel (centerFrequency, channelWidth, bandBandwidth, guardBandwidth)); |
135 |
Ptr<SpectrumValue> c = Create<SpectrumValue> (GetSpectrumModel (centerFrequency, channelWidth, bandBandwidth, guardBandwidth)); |
| 136 |
uint32_t nGuardBands = static_cast<uint32_t>(((2 * guardBandwidth * 1e6) / bandBandwidth) + 0.5); |
136 |
uint32_t nGuardBands = static_cast<uint32_t>(((2 * guardBandwidth * 1e6) / bandBandwidth) + 0.5); |
| 137 |
uint32_t nAllocatedBands = static_cast<uint32_t>(((channelWidth * 1e6) / bandBandwidth) + 0.5); |
137 |
uint32_t nAllocatedBands = static_cast<uint32_t>(((channelWidth * 1e6) / bandBandwidth) + 0.5); |
| 138 |
NS_ASSERT_MSG (c->GetSpectrumModel ()->GetNumBands () == (nAllocatedBands + nGuardBands + 1), "Unexpected number of bands"); |
138 |
NS_ASSERT_MSG (c->GetSpectrumModel ()->GetNumBands () == (nAllocatedBands + nGuardBands + 1), "Unexpected number of bands " << c->GetSpectrumModel ()->GetNumBands ()); |
| 139 |
double txPowerPerBand = 0; |
139 |
double txPowerPerBand = 0; |
| 140 |
uint32_t start1 = 0; |
140 |
uint32_t start1 = 0; |
| 141 |
uint32_t stop1 = 0; |
141 |
uint32_t stop1 = 0; |
|
|
| 144 |
switch (channelWidth) |
144 |
switch (channelWidth) |
| 145 |
{ |
145 |
{ |
| 146 |
case 20: |
146 |
case 20: |
|
|
147 |
default: |
| 147 |
// 52 subcarriers (48 data + 4 pilot) |
148 |
// 52 subcarriers (48 data + 4 pilot) |
| 148 |
// skip guard band and 6 subbands, then place power in 26 subbands, then |
149 |
// skip guard band and 6 subbands, then place power in 26 subbands, then |
| 149 |
// skip the center subband, then place power in 26 subbands, then skip |
150 |
// skip the center subband, then place power in 26 subbands, then skip |
|
|
| 176 |
start2 = stop1 + 2; |
177 |
start2 = stop1 + 2; |
| 177 |
stop2 = start2 + 8 - 1; |
178 |
stop2 = start2 + 8 - 1; |
| 178 |
break; |
179 |
break; |
| 179 |
default: |
|
|
| 180 |
NS_FATAL_ERROR ("ChannelWidth " << channelWidth << " unsupported"); |
| 181 |
break; |
| 182 |
} |
180 |
} |
| 183 |
NS_LOG_DEBUG ("Power per band " << txPowerPerBand); |
181 |
NS_LOG_DEBUG ("Power per band " << txPowerPerBand); |
| 184 |
Values::iterator vit = c->ValuesBegin (); |
182 |
Values::iterator vit = c->ValuesBegin (); |
|
|
| 210 |
Bands::const_iterator bit = c->ConstBandsBegin (); |
208 |
Bands::const_iterator bit = c->ConstBandsBegin (); |
| 211 |
uint32_t nGuardBands = static_cast<uint32_t>(((2 * guardBandwidth * 1e6) / bandBandwidth) + 0.5); |
209 |
uint32_t nGuardBands = static_cast<uint32_t>(((2 * guardBandwidth * 1e6) / bandBandwidth) + 0.5); |
| 212 |
uint32_t nAllocatedBands = static_cast<uint32_t>(((channelWidth * 1e6) / bandBandwidth) + 0.5); |
210 |
uint32_t nAllocatedBands = static_cast<uint32_t>(((channelWidth * 1e6) / bandBandwidth) + 0.5); |
| 213 |
NS_ASSERT_MSG (c->GetSpectrumModel ()->GetNumBands () == (nAllocatedBands + nGuardBands + 1), "Unexpected number of bands"); |
211 |
NS_ASSERT_MSG (c->GetSpectrumModel ()->GetNumBands () == (nAllocatedBands + nGuardBands + 1), "Unexpected number of bands " << c->GetSpectrumModel ()->GetNumBands ()); |
| 214 |
double txPowerPerBand; |
212 |
double txPowerPerBand; |
| 215 |
// skip the guard band and 4 subbands, then place power in 28 subbands, then |
213 |
// skip the guard band and 4 subbands, then place power in 28 subbands, then |
| 216 |
// skip the center subband, then place power in 28 subbands, then skip |
214 |
// skip the center subband, then place power in 28 subbands, then skip |
|
|
| 362 |
", " << start15 << "-" << stop15 << |
360 |
", " << start15 << "-" << stop15 << |
| 363 |
", " << start16 << "-" << stop16); |
361 |
", " << start16 << "-" << stop16); |
| 364 |
break; |
362 |
break; |
| 365 |
default: |
|
|
| 366 |
NS_FATAL_ERROR ("ChannelWidth " << channelWidth << " unsupported"); |
| 367 |
break; |
| 368 |
} |
363 |
} |
| 369 |
NS_LOG_DEBUG ("Integrated power " << Integral (*c)); |
364 |
NS_LOG_DEBUG ("Integrated power " << Integral (*c)); |
| 370 |
NS_ASSERT_MSG (std::abs (txPowerW - Integral (*c)) < 1e-6, "Power allocation failed"); |
365 |
NS_ASSERT_MSG (std::abs (txPowerW - Integral (*c)) < 1e-6, "Power allocation failed"); |
|
|
| 381 |
Bands::const_iterator bit = c->ConstBandsBegin (); |
376 |
Bands::const_iterator bit = c->ConstBandsBegin (); |
| 382 |
uint32_t nGuardBands = static_cast<uint32_t>(((2 * guardBandwidth * 1e6) / bandBandwidth) + 0.5); |
377 |
uint32_t nGuardBands = static_cast<uint32_t>(((2 * guardBandwidth * 1e6) / bandBandwidth) + 0.5); |
| 383 |
uint32_t nAllocatedBands = static_cast<uint32_t>(((channelWidth * 1e6) / bandBandwidth) + 0.5); |
378 |
uint32_t nAllocatedBands = static_cast<uint32_t>(((channelWidth * 1e6) / bandBandwidth) + 0.5); |
| 384 |
NS_ASSERT_MSG (c->GetSpectrumModel ()->GetNumBands () == (nAllocatedBands + nGuardBands + 1), "Unexpected number of bands"); |
379 |
NS_ASSERT_MSG (c->GetSpectrumModel ()->GetNumBands () == (nAllocatedBands + nGuardBands + 1), "Unexpected number of bands " << c->GetSpectrumModel ()->GetNumBands ()); |
| 385 |
double txPowerPerBand; |
380 |
double txPowerPerBand; |
| 386 |
uint32_t start1; |
381 |
uint32_t start1; |
| 387 |
uint32_t stop1; |
382 |
uint32_t stop1; |