From 40a6be3407924e690a389bb5917c17ebc4c6de0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deronne?= Date: Sun, 13 Nov 2022 18:04:14 +0100 Subject: [PATCH] wifi: Add support for non-HT duplicate --- src/wifi/model/non-ht/ofdm-phy.cc | 31 ++++++++++++++++++++++-------- src/wifi/model/non-ht/ofdm-ppdu.cc | 2 +- src/wifi/model/wifi-tx-vector.cc | 7 +++++++ src/wifi/model/wifi-tx-vector.h | 10 ++++++++-- 4 files changed, 39 insertions(+), 11 deletions(-) diff --git a/src/wifi/model/non-ht/ofdm-phy.cc b/src/wifi/model/non-ht/ofdm-phy.cc index a714aecdd..7eaf385bb 100644 --- a/src/wifi/model/non-ht/ofdm-phy.cc +++ b/src/wifi/model/non-ht/ofdm-phy.cc @@ -369,14 +369,29 @@ OfdmPhy::GetTxPowerSpectralDensity(double txPowerW, Ptr ppdu) co uint16_t channelWidth = txVector.GetChannelWidth(); NS_LOG_FUNCTION(this << centerFrequency << channelWidth << txPowerW); const auto& txMaskRejectionParams = GetTxMaskRejectionParams(); - Ptr v = WifiSpectrumValueHelper::CreateOfdmTxPowerSpectralDensity( - centerFrequency, - channelWidth, - txPowerW, - GetGuardBandwidth(channelWidth), - std::get<0>(txMaskRejectionParams), - std::get<1>(txMaskRejectionParams), - std::get<2>(txMaskRejectionParams)); + Ptr v; + if (txVector.IsNonHtDuplicate()) + { + v = WifiSpectrumValueHelper::CreateDuplicated20MhzTxPowerSpectralDensity( + centerFrequency, + channelWidth, + txPowerW, + GetGuardBandwidth(channelWidth), + std::get<0>(txMaskRejectionParams), + std::get<1>(txMaskRejectionParams), + std::get<2>(txMaskRejectionParams)); + } + else + { + v = WifiSpectrumValueHelper::CreateOfdmTxPowerSpectralDensity( + centerFrequency, + channelWidth, + txPowerW, + GetGuardBandwidth(channelWidth), + std::get<0>(txMaskRejectionParams), + std::get<1>(txMaskRejectionParams), + std::get<2>(txMaskRejectionParams)); + } return v; } diff --git a/src/wifi/model/non-ht/ofdm-ppdu.cc b/src/wifi/model/non-ht/ofdm-ppdu.cc index 4541983ad..3d3949795 100644 --- a/src/wifi/model/non-ht/ofdm-ppdu.cc +++ b/src/wifi/model/non-ht/ofdm-ppdu.cc @@ -40,7 +40,7 @@ OfdmPpdu::OfdmPpdu(Ptr psdu, bool instantiateLSig /* = true */) : WifiPpdu(psdu, txVector, txCenterFreq, uid), m_band(band), - m_channelWidth(txVector.GetChannelWidth()) + m_channelWidth(txVector.IsNonHtDuplicate() ? 20 : txVector.GetChannelWidth()) { NS_LOG_FUNCTION(this << psdu << txVector << txCenterFreq << band << uid); if (instantiateLSig) diff --git a/src/wifi/model/wifi-tx-vector.cc b/src/wifi/model/wifi-tx-vector.cc index 2e5909dff..669f662a1 100644 --- a/src/wifi/model/wifi-tx-vector.cc +++ b/src/wifi/model/wifi-tx-vector.cc @@ -253,6 +253,13 @@ WifiTxVector::IsLdpc() const return m_ldpc; } +bool +WifiTxVector::IsNonHtDuplicate() const +{ + return ((m_channelWidth >= 40) && !IsMu() && + (GetMode().GetModulationClass() < WIFI_MOD_CLASS_HT)); +} + void WifiTxVector::SetMode(WifiMode mode) { diff --git a/src/wifi/model/wifi-tx-vector.h b/src/wifi/model/wifi-tx-vector.h index 80a03210a..472155a2a 100644 --- a/src/wifi/model/wifi-tx-vector.h +++ b/src/wifi/model/wifi-tx-vector.h @@ -269,13 +269,13 @@ class WifiTxVector /** * Checks whether the PSDU contains A-MPDU. * \returns true if this PSDU has A-MPDU aggregation, - * false otherwise. + * false otherwise */ bool IsAggregation() const; /** * Sets if PSDU contains A-MPDU. * - * \param aggregation whether the PSDU contains A-MPDU or not. + * \param aggregation whether the PSDU contains A-MPDU or not */ void SetAggregation(bool aggregation); /** @@ -304,6 +304,12 @@ class WifiTxVector * \param ldpc enable or disable LDPC */ void SetLdpc(bool ldpc); + /** + * Checks whether this TXVECTOR corresponds to a non-HT duplicate. + * \returns true if this TXVECTOR corresponds to a non-HT duplicate, + * false otherwise. + */ + bool IsNonHtDuplicate() const; /** * Set the BSS color * \param color the BSS color