From a53ff7ab6e95f4d0710fc1906018c909a5152131 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deronne?= Date: Tue, 25 Apr 2023 22:09:27 +0200 Subject: [PATCH] wifi: Improve preamble puncturing for non-HT duplicate PSDs --- src/wifi/model/wifi-spectrum-value-helper.cc | 21 ++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/wifi/model/wifi-spectrum-value-helper.cc b/src/wifi/model/wifi-spectrum-value-helper.cc index e4b67d67f..7f7b02d2f 100644 --- a/src/wifi/model/wifi-spectrum-value-helper.cc +++ b/src/wifi/model/wifi-spectrum-value-helper.cc @@ -276,26 +276,26 @@ WifiSpectrumValueHelper::CreateDuplicated20MhzTxPowerSpectralDensity( subBands; // list of data/pilot-containing subBands (sent at 0dBr) subBands.resize(num20MhzBands * 2); // the center subcarrier is skipped, hence 2 subbands per 20 MHz subchannel + std::vector puncturedBands; uint32_t start = (nGuardBands / 2) + (numUnallocatedSubcarriersPer20MHz / 2); uint32_t stop; uint8_t index = 0; for (auto it = subBands.begin(); it != subBands.end();) { - if (!puncturedSubchannels.empty() && puncturedSubchannels.at(index++)) - { - // if subchannel is punctured, skip it and go the next one - NS_LOG_DEBUG("20 MHz subchannel " << +index << " is punctured"); - it += 2; - continue; - } stop = start + (numAllocatedSubcarriersPer20MHz / 2) - 1; *it = std::make_pair(start, stop); ++it; + uint32_t puncturedStart = start; start = stop + 2; // skip center subcarrier stop = start + (numAllocatedSubcarriersPer20MHz / 2) - 1; *it = std::make_pair(start, stop); ++it; start = stop + numUnallocatedSubcarriersPer20MHz; + uint32_t puncturedStop = stop; + if (!puncturedSubchannels.empty() && puncturedSubchannels.at(index++)) + { + puncturedBands.emplace_back(puncturedStart, puncturedStop); + } } // Prepare spectrum mask specific variables @@ -303,6 +303,9 @@ WifiSpectrumValueHelper::CreateDuplicated20MhzTxPowerSpectralDensity( (2e6 / carrierSpacing) + 0.5); // size in number of subcarriers of the 0dBr<->20dBr slope (2MHz for HT/VHT) WifiSpectrumBandIndices maskBand(0, nAllocatedBands + nGuardBands); + uint32_t puncturedSlopeWidth = + static_cast((500e3 / carrierSpacing) + + 0.5); // size in number of subcarriers of the punctured slope band // Build transmit spectrum mask CreateSpectrumMaskForOfdm(c, @@ -313,7 +316,9 @@ WifiSpectrumValueHelper::CreateDuplicated20MhzTxPowerSpectralDensity( innerSlopeWidth, minInnerBandDbr, minOuterBandDbr, - lowestPointDbr); + lowestPointDbr, + puncturedBands, + puncturedSlopeWidth); NormalizeSpectrumMask(c, txPowerW); NS_ASSERT_MSG(std::abs(txPowerW - Integral(*c)) < 1e-6, "Power allocation failed"); return c;