wifi: Compute and store received power per RU if PHY supports 802.11ax
This commit is contained in:
@@ -141,6 +141,20 @@ SpectrumWifiPhy::UpdateInterferenceHelperBands (void)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (GetPhyStandard () >= WIFI_PHY_STANDARD_80211ax)
|
||||
{
|
||||
for (unsigned int type = 0; type < 7; type++)
|
||||
{
|
||||
HeRu::RuType ruType = static_cast <HeRu::RuType> (type);
|
||||
for (std::size_t index = 1; index <= HeRu::GetNRus (channelWidth, ruType); index++)
|
||||
{
|
||||
HeRu::SubcarrierGroup group = HeRu::GetSubcarrierGroup (channelWidth, ruType, index);
|
||||
HeRu::SubcarrierRange range = std::make_pair (group.front ().first, group.back ().second);
|
||||
WifiSpectrumBand band = ConvertHeRuSubcarriers (channelWidth, range);
|
||||
m_interference.AddBand (band);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ptr<Channel>
|
||||
@@ -274,6 +288,26 @@ SpectrumWifiPhy::StartRx (Ptr<SpectrumSignalParameters> rxParams)
|
||||
rxPowerW.insert ({filteredBand, rxPowerPerBandW});
|
||||
NS_LOG_DEBUG ("Signal power received after antenna gain for 20 MHz channel band " << +i << ": " << rxPowerPerBandW << " W (" << WToDbm (rxPowerPerBandW) << " dBm)");
|
||||
}
|
||||
|
||||
if (GetPhyStandard () >= WIFI_PHY_STANDARD_80211ax)
|
||||
{
|
||||
for (unsigned int type = 0; type < 7; type++)
|
||||
{
|
||||
HeRu::RuType ruType = static_cast <HeRu::RuType> (type);
|
||||
for (std::size_t index = 1; index <= HeRu::GetNRus (channelWidth, ruType); index++)
|
||||
{
|
||||
HeRu::SubcarrierGroup group = HeRu::GetSubcarrierGroup (channelWidth, ruType, index);
|
||||
HeRu::SubcarrierRange range = std::make_pair (group.front ().first, group.back ().second);
|
||||
WifiSpectrumBand band = ConvertHeRuSubcarriers (channelWidth, range);
|
||||
Ptr<SpectrumValue> filter = WifiSpectrumValueHelper::CreateRfFilter (GetFrequency (), channelWidth, GetBandBandwidth (), GetGuardBandwidth (channelWidth), band);
|
||||
SpectrumValue filteredSignal = (*filter) * (*receivedSignalPsd);
|
||||
NS_LOG_DEBUG ("Signal power received (watts) before antenna gain for RU with type " << ruType << " and range (" << range.first << "; " << range.second << ") -> (" << band.first << "; " << band.second << "): " << Integral (filteredSignal));
|
||||
double rxPowerPerBandW = Integral (filteredSignal) * DbToRatio (GetRxGain ());
|
||||
NS_LOG_DEBUG ("Signal power received after antenna gain for RU with type " << ruType << " and range (" << range.first << "; " << range.second << ") -> (" << band.first << "; " << band.second << "): " << rxPowerPerBandW << " W (" << WToDbm (rxPowerPerBandW) << " dBm)");
|
||||
rxPowerW.insert ({band, rxPowerPerBandW});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_LOG_DEBUG ("Total signal power received after antenna gain: " << totalRxPowerW << " W (" << WToDbm (totalRxPowerW) << " dBm)");
|
||||
|
||||
@@ -483,9 +517,9 @@ SpectrumWifiPhy::GetBand (uint16_t bandWidth, uint8_t bandIndex)
|
||||
}
|
||||
|
||||
WifiSpectrumBand
|
||||
SpectrumWifiPhy::ConvertHeRuIndices (uint16_t channelWidth, HeRu::SubcarrierRange range) const
|
||||
SpectrumWifiPhy::ConvertHeRuSubcarriers (uint16_t channelWidth, HeRu::SubcarrierRange range) const
|
||||
{
|
||||
WifiSpectrumBand convertedIndices;
|
||||
WifiSpectrumBand convertedSubcarriers;
|
||||
uint32_t nGuardBands = static_cast<uint32_t> (((2 * GetGuardBandwidth (channelWidth) * 1e6) / GetBandBandwidth ()) + 0.5);
|
||||
uint32_t centerFrequencyIndex = 0;
|
||||
switch (channelWidth)
|
||||
@@ -506,9 +540,9 @@ SpectrumWifiPhy::ConvertHeRuIndices (uint16_t channelWidth, HeRu::SubcarrierRang
|
||||
NS_FATAL_ERROR ("ChannelWidth " << channelWidth << " unsupported");
|
||||
break;
|
||||
}
|
||||
convertedIndices.first = centerFrequencyIndex + range.first;
|
||||
convertedIndices.second = centerFrequencyIndex + range.second;
|
||||
return convertedIndices;
|
||||
convertedSubcarriers.first = centerFrequencyIndex + range.first;
|
||||
convertedSubcarriers.second = centerFrequencyIndex + range.second;
|
||||
return convertedSubcarriers;
|
||||
}
|
||||
|
||||
} //namespace ns3
|
||||
|
||||
@@ -192,11 +192,11 @@ private:
|
||||
/**
|
||||
* \param channelWidth the total channel width (MHz) used for the OFDMA transmission
|
||||
* \param range the subcarrier range of the HE RU
|
||||
* \return the converted indices
|
||||
* \return the converted subcarriers
|
||||
*
|
||||
* This is a helper function to convert HE RU indices, which are relative to the center frequency subcarrier, to the indices used by the Spectrum model.
|
||||
* This is a helper function to convert HE RU subcarriers, which are relative to the center frequency subcarrier, to the indexes used by the Spectrum model.
|
||||
*/
|
||||
WifiSpectrumBand ConvertHeRuIndices (uint16_t channelWidth, HeRu::SubcarrierRange range) const;
|
||||
WifiSpectrumBand ConvertHeRuSubcarriers (uint16_t channelWidth, HeRu::SubcarrierRange range) const;
|
||||
|
||||
/**
|
||||
* Perform run-time spectrum model change
|
||||
|
||||
@@ -407,6 +407,34 @@ SpectrumWifiPhyFilterTest::RxCallback (Ptr<const Packet> p, RxPowerWattPerChanne
|
||||
expectedNumBands += (m_rxChannelWidth / 40);
|
||||
expectedNumBands += (m_rxChannelWidth / 80);
|
||||
expectedNumBands += (m_rxChannelWidth / 160);
|
||||
if (m_rxChannelWidth == 20)
|
||||
{
|
||||
expectedNumBands += 9; /* RU_26_TONE */
|
||||
expectedNumBands += 4; /* RU_52_TONE */
|
||||
expectedNumBands += 2; /* RU_106_TONE */
|
||||
expectedNumBands += 1; /* RU_242_TONE */
|
||||
}
|
||||
else if (m_rxChannelWidth == 40)
|
||||
{
|
||||
expectedNumBands += 18; /* RU_26_TONE */
|
||||
expectedNumBands += 8; /* RU_52_TONE */
|
||||
expectedNumBands += 4; /* RU_106_TONE */
|
||||
expectedNumBands += 2; /* RU_242_TONE */
|
||||
expectedNumBands += 1; /* RU_484_TONE */
|
||||
}
|
||||
else if (m_rxChannelWidth >= 80)
|
||||
{
|
||||
expectedNumBands += 37 * (m_rxChannelWidth / 80); /* RU_26_TONE */
|
||||
expectedNumBands += 16 * (m_rxChannelWidth / 80); /* RU_52_TONE */
|
||||
expectedNumBands += 8 * (m_rxChannelWidth / 80); /* RU_106_TONE */
|
||||
expectedNumBands += 4 * (m_rxChannelWidth / 80); /* RU_242_TONE */
|
||||
expectedNumBands += 2 * (m_rxChannelWidth / 80); /* RU_484_TONE */
|
||||
expectedNumBands += 1 * (m_rxChannelWidth / 80); /* RU_996_TONE */
|
||||
if (m_rxChannelWidth == 160)
|
||||
{
|
||||
++expectedNumBands; /* RU_2x996_TONE */
|
||||
}
|
||||
}
|
||||
NS_TEST_ASSERT_MSG_EQ (numBands, expectedNumBands, "Total number of bands handled by the receiver is incorrect");
|
||||
|
||||
uint16_t channelWidth = std::min (m_txChannelWidth, m_rxChannelWidth);
|
||||
@@ -441,6 +469,9 @@ SpectrumWifiPhyFilterTest::RxCallback (Ptr<const Packet> p, RxPowerWattPerChanne
|
||||
void
|
||||
SpectrumWifiPhyFilterTest::DoSetup (void)
|
||||
{
|
||||
//WifiHelper::EnableLogComponents ();
|
||||
//LogComponentEnable ("SpectrumWifiPhyBasicTest", LOG_LEVEL_ALL);
|
||||
|
||||
Ptr<MultiModelSpectrumChannel> spectrumChannel = CreateObject<MultiModelSpectrumChannel> ();
|
||||
Ptr<FriisPropagationLossModel> lossModel = CreateObject<FriisPropagationLossModel> ();
|
||||
lossModel->SetFrequency (5.180e9);
|
||||
|
||||
Reference in New Issue
Block a user