wifi: (fixes #394) Obtain coherent Rx width for DSSS PhyEntity of HE-capable PHYs

Since the RxSpectrumModel is built using HE parameters
This commit is contained in:
Rediet
2021-05-26 11:07:09 +02:00
parent 5b6220c268
commit 867cc1981d
5 changed files with 35 additions and 4 deletions

View File

@@ -220,6 +220,22 @@ DsssPhy::EndReceiveHeader (Ptr<Event> event)
return status;
}
uint16_t
DsssPhy::GetRxChannelWidth (const WifiTxVector& txVector) const
{
if (m_wifiPhy->GetChannelWidth () > 20)
{
/*
* This is a workaround necessary with HE-capable PHYs,
* since their DSSS entity will reuse its RxSpectrumModel.
* Without this hack, SpectrumWifiPhy::GetBand will crash.
* FIXME: see issue #402 for a better solution.
*/
return 20;
}
return PhyEntity::GetRxChannelWidth (txVector);
}
Ptr<SpectrumValue>
DsssPhy::GetTxPowerSpectralDensity (double txPowerW, Ptr<const WifiPpdu> ppdu) const
{

View File

@@ -157,6 +157,7 @@ public:
private:
PhyFieldRxStatus DoEndReceiveField (WifiPpduField field, Ptr<Event> event) override;
Ptr<SpectrumValue> GetTxPowerSpectralDensity (double txPowerW, Ptr<const WifiPpdu> ppdu) const override;
uint16_t GetRxChannelWidth (const WifiTxVector& txVector) const override;
/**
* \param txVector the transmission parameters

View File

@@ -717,7 +717,7 @@ PhyEntity::GetReceptionStatus (Ptr<const WifiPsdu> psdu, Ptr<Event> event, uint1
std::pair<uint16_t, WifiSpectrumBand>
PhyEntity::GetChannelWidthAndBand (const WifiTxVector& txVector, uint16_t /* staId */) const
{
uint16_t channelWidth = std::min (m_wifiPhy->GetChannelWidth (), txVector.GetChannelWidth ());
uint16_t channelWidth = GetRxChannelWidth (txVector);
return std::make_pair (channelWidth, m_wifiPhy->GetPrimaryBand (channelWidth));
}
@@ -1008,7 +1008,13 @@ PhyEntity::GetCurrentEvent (void) const
uint16_t
PhyEntity::GetMeasurementChannelWidth (const Ptr<const WifiPpdu> ppdu) const
{
return std::min (m_wifiPhy->GetChannelWidth (), ppdu->GetTxVector ().GetChannelWidth ());
return GetRxChannelWidth (ppdu->GetTxVector ());
}
uint16_t
PhyEntity::GetRxChannelWidth (const WifiTxVector& txVector) const
{
return std::min (m_wifiPhy->GetChannelWidth (), txVector.GetChannelWidth ());
}
uint64_t

View File

@@ -432,6 +432,14 @@ public:
*/
virtual uint16_t GetMeasurementChannelWidth (const Ptr<const WifiPpdu> ppdu) const;
/**
* Return the channel width used in the reception spectrum model.
*
* \param txVector the TXVECTOR of the PPDU that is being received
* \return the channel width (in MHz) used for RxSpectrumModel
*/
virtual uint16_t GetRxChannelWidth (const WifiTxVector& txVector) const;
/**
* This function is called by SpectrumWifiPhy to send
* the PPDU while performing amendment-specific actions.

View File

@@ -311,10 +311,10 @@ SpectrumWifiPhy::StartRx (Ptr<SpectrumSignalParameters> rxParams)
WifiSpectrumBand filteredBand = GetBand (bw, i);
Ptr<SpectrumValue> filter = WifiSpectrumValueHelper::CreateRfFilter (GetFrequency (), channelWidth, GetBandBandwidth (), GetGuardBandwidth (channelWidth), filteredBand);
SpectrumValue filteredSignal = (*filter) * (*receivedSignalPsd);
NS_LOG_DEBUG ("Signal power received (watts) before antenna gain for" << bw << " MHz channel band " << +i << ": " << Integral (filteredSignal));
NS_LOG_DEBUG ("Signal power received (watts) before antenna gain for " << bw << " MHz channel band " << +i << ": " << Integral (filteredSignal));
double rxPowerPerBandW = Integral (filteredSignal) * DbToRatio (GetRxGain ());
rxPowerW.insert ({filteredBand, rxPowerPerBandW});
NS_LOG_DEBUG ("Signal power received after antenna gain for" << bw << " MHz channel band " << +i << ": " << rxPowerPerBandW << " W (" << WToDbm (rxPowerPerBandW) << " dBm)");
NS_LOG_DEBUG ("Signal power received after antenna gain for " << bw << " MHz channel band " << +i << ": " << rxPowerPerBandW << " W (" << WToDbm (rxPowerPerBandW) << " dBm)");
}
}