diff --git a/src/wifi/model/eht/eht-phy.cc b/src/wifi/model/eht/eht-phy.cc index 324472b2d..fe8a87765 100644 --- a/src/wifi/model/eht/eht-phy.cc +++ b/src/wifi/model/eht/eht-phy.cc @@ -160,10 +160,8 @@ EhtPhy::BuildPpdu(const WifiConstPsduMap& psdus, const WifiTxVector& txVector, T NS_LOG_FUNCTION(this << psdus << txVector << ppduDuration); return Create(psdus, txVector, - m_wifiPhy->GetOperatingChannel().GetPrimaryChannelCenterFrequency( - txVector.GetChannelWidth()), + m_wifiPhy->GetOperatingChannel(), ppduDuration, - m_wifiPhy->GetPhyBand(), ObtainNextUid(txVector), HePpdu::PSD_NON_HE_PORTION); } diff --git a/src/wifi/model/eht/eht-ppdu.cc b/src/wifi/model/eht/eht-ppdu.cc index d441c6d97..4ba40737b 100644 --- a/src/wifi/model/eht/eht-ppdu.cc +++ b/src/wifi/model/eht/eht-ppdu.cc @@ -22,6 +22,7 @@ #include "eht-phy.h" #include "ns3/log.h" +#include "ns3/wifi-phy-operating-channel.h" #include "ns3/wifi-psdu.h" namespace ns3 @@ -31,15 +32,13 @@ NS_LOG_COMPONENT_DEFINE("EhtPpdu"); EhtPpdu::EhtPpdu(const WifiConstPsduMap& psdus, const WifiTxVector& txVector, - uint16_t txCenterFreq, + const WifiPhyOperatingChannel& channel, Time ppduDuration, - WifiPhyBand band, uint64_t uid, TxPsdFlag flag) - : HePpdu(psdus, txVector, txCenterFreq, ppduDuration, band, uid, flag) + : HePpdu(psdus, txVector, channel, ppduDuration, uid, flag) { - NS_LOG_FUNCTION(this << psdus << txVector << txCenterFreq << ppduDuration << band << uid - << flag); + NS_LOG_FUNCTION(this << psdus << txVector << channel << ppduDuration << uid << flag); // For EHT SU transmissions (carried in EHT MU PPDUs), we have to: // - store the EHT-SIG content channels diff --git a/src/wifi/model/eht/eht-ppdu.h b/src/wifi/model/eht/eht-ppdu.h index 15d61ef13..d0f7f464d 100644 --- a/src/wifi/model/eht/eht-ppdu.h +++ b/src/wifi/model/eht/eht-ppdu.h @@ -47,17 +47,15 @@ class EhtPpdu : public HePpdu * * \param psdus the PHY payloads (PSDUs) * \param txVector the TXVECTOR that was used for this PPDU - * \param txCenterFreq the center frequency (MHz) that was used for this PPDU + * \param channel the operating channel of the PHY used to transmit this PPDU * \param ppduDuration the transmission duration of this PPDU - * \param band the WifiPhyBand used for the transmission of this PPDU * \param uid the unique ID of this PPDU or of the triggering PPDU if this is an EHT TB PPDU * \param flag the flag indicating the type of Tx PSD to build */ EhtPpdu(const WifiConstPsduMap& psdus, const WifiTxVector& txVector, - uint16_t txCenterFreq, + const WifiPhyOperatingChannel& channel, Time ppduDuration, - WifiPhyBand band, uint64_t uid, TxPsdFlag flag); diff --git a/src/wifi/model/he/he-phy.cc b/src/wifi/model/he/he-phy.cc index baed855cb..5a2f7c917 100644 --- a/src/wifi/model/he/he-phy.cc +++ b/src/wifi/model/he/he-phy.cc @@ -339,10 +339,8 @@ HePhy::BuildPpdu(const WifiConstPsduMap& psdus, const WifiTxVector& txVector, Ti NS_LOG_FUNCTION(this << psdus << txVector << ppduDuration); return Create(psdus, txVector, - m_wifiPhy->GetOperatingChannel().GetPrimaryChannelCenterFrequency( - txVector.GetChannelWidth()), + m_wifiPhy->GetOperatingChannel(), ppduDuration, - m_wifiPhy->GetPhyBand(), ObtainNextUid(txVector), HePpdu::PSD_NON_HE_PORTION); } diff --git a/src/wifi/model/he/he-ppdu.cc b/src/wifi/model/he/he-ppdu.cc index c655dd95d..621a9359a 100644 --- a/src/wifi/model/he/he-ppdu.cc +++ b/src/wifi/model/he/he-ppdu.cc @@ -24,6 +24,7 @@ #include "he-phy.h" #include "ns3/log.h" +#include "ns3/wifi-phy-operating-channel.h" #include "ns3/wifi-phy.h" #include "ns3/wifi-psdu.h" #include "ns3/wifi-utils.h" @@ -50,20 +51,18 @@ operator<<(std::ostream& os, const HePpdu::TxPsdFlag& flag) HePpdu::HePpdu(const WifiConstPsduMap& psdus, const WifiTxVector& txVector, - uint16_t txCenterFreq, + const WifiPhyOperatingChannel& channel, Time ppduDuration, - WifiPhyBand band, uint64_t uid, TxPsdFlag flag) : OfdmPpdu(psdus.begin()->second, txVector, - txCenterFreq, - band, + channel, uid, - false) // don't instantiate LSigHeader of OfdmPpdu + false), // don't instantiate LSigHeader of OfdmPpdu + m_txPsdFlag(flag) { - NS_LOG_FUNCTION(this << psdus << txVector << txCenterFreq << ppduDuration << band << uid - << flag); + NS_LOG_FUNCTION(this << psdus << txVector << channel << ppduDuration << uid << flag); // overwrite with map (since only first element used by OfdmPpdu) m_psdus.begin()->second = nullptr; @@ -85,18 +84,16 @@ HePpdu::HePpdu(const WifiConstPsduMap& psdus, HePpdu::HePpdu(Ptr psdu, const WifiTxVector& txVector, - uint16_t txCenterFreq, + const WifiPhyOperatingChannel& channel, Time ppduDuration, - WifiPhyBand band, uint64_t uid) : OfdmPpdu(psdu, txVector, - txCenterFreq, - band, + channel, uid, false) // don't instantiate LSigHeader of OfdmPpdu { - NS_LOG_FUNCTION(this << psdu << txVector << txCenterFreq << ppduDuration << band << uid); + NS_LOG_FUNCTION(this << psdu << txVector << channel << ppduDuration << uid); NS_ASSERT(!IsMu()); SetPhyHeaders(txVector, ppduDuration); SetTxPsdFlag(PSD_NON_HE_PORTION); @@ -126,7 +123,8 @@ void HePpdu::SetLSigHeader(LSigHeader& lSig, Time ppduDuration) const { uint8_t sigExtension = 0; - if (m_band == WIFI_PHY_BAND_2_4GHZ) + NS_ASSERT(m_operatingChannel.IsSet()); + if (m_operatingChannel.GetPhyBand() == WIFI_PHY_BAND_2_4GHZ) { sigExtension = 6; } @@ -240,7 +238,8 @@ HePpdu::GetTxDuration() const Time tSymbol = NanoSeconds(12800 + txVector.GetGuardInterval()); Time preambleDuration = WifiPhy::CalculatePhyPreambleAndHeaderDuration(txVector); uint8_t sigExtension = 0; - if (m_band == WIFI_PHY_BAND_2_4GHZ) + NS_ASSERT(m_operatingChannel.IsSet()); + if (m_operatingChannel.GetPhyBand() == WIFI_PHY_BAND_2_4GHZ) { sigExtension = 6; } diff --git a/src/wifi/model/he/he-ppdu.h b/src/wifi/model/he/he-ppdu.h index 082f1d6b9..de316d707 100644 --- a/src/wifi/model/he/he-ppdu.h +++ b/src/wifi/model/he/he-ppdu.h @@ -163,16 +163,14 @@ class HePpdu : public OfdmPpdu * * \param psdu the PHY payload (PSDU) * \param txVector the TXVECTOR that was used for this PPDU - * \param txCenterFreq the center frequency (MHz) that was used for this PPDU + * \param channel the operating channel of the PHY used to transmit this PPDU * \param ppduDuration the transmission duration of this PPDU - * \param band the WifiPhyBand used for the transmission of this PPDU * \param uid the unique ID of this PPDU */ HePpdu(Ptr psdu, const WifiTxVector& txVector, - uint16_t txCenterFreq, + const WifiPhyOperatingChannel& channel, Time ppduDuration, - WifiPhyBand band, uint64_t uid); /** * Create an MU HE PPDU, storing a map of PSDUs. @@ -181,17 +179,15 @@ class HePpdu : public OfdmPpdu * * \param psdus the PHY payloads (PSDUs) * \param txVector the TXVECTOR that was used for this PPDU - * \param txCenterFreq the center frequency (MHz) that was used for this PPDU + * \param channel the operating channel of the PHY used to transmit this PPDU * \param ppduDuration the transmission duration of this PPDU - * \param band the WifiPhyBand used for the transmission of this PPDU * \param uid the unique ID of this PPDU or of the triggering PPDU if this is an HE TB PPDU * \param flag the flag indicating the type of Tx PSD to build */ HePpdu(const WifiConstPsduMap& psdus, const WifiTxVector& txVector, - uint16_t txCenterFreq, + const WifiPhyOperatingChannel& channel, Time ppduDuration, - WifiPhyBand band, uint64_t uid, TxPsdFlag flag); diff --git a/src/wifi/model/ht/ht-phy.cc b/src/wifi/model/ht/ht-phy.cc index f28bcfa73..dfa742544 100644 --- a/src/wifi/model/ht/ht-phy.cc +++ b/src/wifi/model/ht/ht-phy.cc @@ -381,10 +381,8 @@ HtPhy::BuildPpdu(const WifiConstPsduMap& psdus, const WifiTxVector& txVector, Ti NS_LOG_FUNCTION(this << psdus << txVector << ppduDuration); return Create(psdus.begin()->second, txVector, - m_wifiPhy->GetOperatingChannel().GetPrimaryChannelCenterFrequency( - txVector.GetChannelWidth()), + m_wifiPhy->GetOperatingChannel(), ppduDuration, - m_wifiPhy->GetPhyBand(), ObtainNextUid(txVector)); } diff --git a/src/wifi/model/ht/ht-ppdu.cc b/src/wifi/model/ht/ht-ppdu.cc index 4ff6d07c0..19144dea1 100644 --- a/src/wifi/model/ht/ht-ppdu.cc +++ b/src/wifi/model/ht/ht-ppdu.cc @@ -24,6 +24,7 @@ #include "ht-phy.h" #include "ns3/log.h" +#include "ns3/wifi-phy-operating-channel.h" #include "ns3/wifi-phy.h" #include "ns3/wifi-psdu.h" #include "ns3/wifi-utils.h" @@ -35,18 +36,16 @@ NS_LOG_COMPONENT_DEFINE("HtPpdu"); HtPpdu::HtPpdu(Ptr psdu, const WifiTxVector& txVector, - uint16_t txCenterFreq, + const WifiPhyOperatingChannel& channel, Time ppduDuration, - WifiPhyBand band, uint64_t uid) : OfdmPpdu(psdu, txVector, - txCenterFreq, - band, + channel, uid, false) // don't instantiate LSigHeader of OfdmPpdu { - NS_LOG_FUNCTION(this << psdu << txVector << txCenterFreq << ppduDuration << band << uid); + NS_LOG_FUNCTION(this << psdu << txVector << channel << ppduDuration << uid); SetPhyHeaders(txVector, ppduDuration, psdu->GetSize()); } @@ -74,7 +73,8 @@ void HtPpdu::SetLSigHeader(LSigHeader& lSig, Time ppduDuration) const { uint8_t sigExtension = 0; - if (m_band == WIFI_PHY_BAND_2_4GHZ) + NS_ASSERT(m_operatingChannel.IsSet()); + if (m_operatingChannel.GetPhyBand() == WIFI_PHY_BAND_2_4GHZ) { sigExtension = 6; } @@ -158,7 +158,9 @@ HtPpdu::GetTxDuration() const htLength = m_htSig.GetHtLength(); #endif - ppduDuration = WifiPhy::CalculateTxDuration(htLength, txVector, m_band); + NS_ASSERT(m_operatingChannel.IsSet()); + ppduDuration = + WifiPhy::CalculateTxDuration(htLength, txVector, m_operatingChannel.GetPhyBand()); return ppduDuration; } diff --git a/src/wifi/model/ht/ht-ppdu.h b/src/wifi/model/ht/ht-ppdu.h index 65dc77f0f..a9e20ee19 100644 --- a/src/wifi/model/ht/ht-ppdu.h +++ b/src/wifi/model/ht/ht-ppdu.h @@ -139,16 +139,14 @@ class HtPpdu : public OfdmPpdu * * \param psdu the PHY payload (PSDU) * \param txVector the TXVECTOR that was used for this PPDU - * \param txCenterFreq the center frequency (MHz) that was used for this PPDU + * \param channel the operating channel of the PHY used to transmit this PPDU * \param ppduDuration the transmission duration of this PPDU - * \param band the WifiPhyBand used for the transmission of this PPDU * \param uid the unique ID of this PPDU */ HtPpdu(Ptr psdu, const WifiTxVector& txVector, - uint16_t txCenterFreq, + const WifiPhyOperatingChannel& channel, Time ppduDuration, - WifiPhyBand band, uint64_t uid); Time GetTxDuration() const override; diff --git a/src/wifi/model/interference-helper.cc b/src/wifi/model/interference-helper.cc index 4bafa918d..9ba49d5d2 100644 --- a/src/wifi/model/interference-helper.cc +++ b/src/wifi/model/interference-helper.cc @@ -28,6 +28,7 @@ #include "ns3/log.h" #include "ns3/packet.h" #include "ns3/simulator.h" +#include "ns3/wifi-phy-operating-channel.h" #include #include @@ -232,8 +233,9 @@ InterferenceHelper::AddForeignSignal(Time duration, RxPowerWattPerChannelBand& r WifiMacHeader hdr; hdr.SetType(WIFI_MAC_QOSDATA); hdr.SetQosTid(0); - Ptr fakePpdu = - Create(Create(Create(0), hdr), WifiTxVector(), 0); + Ptr fakePpdu = Create(Create(Create(0), hdr), + WifiTxVector(), + WifiPhyOperatingChannel()); Add(fakePpdu, WifiTxVector(), duration, rxPowerW); } diff --git a/src/wifi/model/non-ht/dsss-phy.cc b/src/wifi/model/non-ht/dsss-phy.cc index cd6dd53c2..61ee66a52 100644 --- a/src/wifi/model/non-ht/dsss-phy.cc +++ b/src/wifi/model/non-ht/dsss-phy.cc @@ -200,8 +200,7 @@ DsssPhy::BuildPpdu(const WifiConstPsduMap& psdus, const WifiTxVector& txVector, NS_LOG_FUNCTION(this << psdus << txVector << ppduDuration); return Create(psdus.begin()->second, txVector, - m_wifiPhy->GetOperatingChannel().GetPrimaryChannelCenterFrequency( - txVector.GetChannelWidth()), + m_wifiPhy->GetOperatingChannel(), ppduDuration, ObtainNextUid(txVector)); } diff --git a/src/wifi/model/non-ht/dsss-ppdu.cc b/src/wifi/model/non-ht/dsss-ppdu.cc index 1d7c97c7b..80b29262a 100644 --- a/src/wifi/model/non-ht/dsss-ppdu.cc +++ b/src/wifi/model/non-ht/dsss-ppdu.cc @@ -24,6 +24,7 @@ #include "dsss-phy.h" #include "ns3/log.h" +#include "ns3/wifi-phy-operating-channel.h" #include "ns3/wifi-phy.h" #include "ns3/wifi-psdu.h" @@ -34,12 +35,12 @@ NS_LOG_COMPONENT_DEFINE("DsssPpdu"); DsssPpdu::DsssPpdu(Ptr psdu, const WifiTxVector& txVector, - uint16_t txCenterFreq, + const WifiPhyOperatingChannel& channel, Time ppduDuration, uint64_t uid) - : WifiPpdu(psdu, txVector, txCenterFreq, uid) + : WifiPpdu(psdu, txVector, channel, uid) { - NS_LOG_FUNCTION(this << psdu << txVector << txCenterFreq << ppduDuration << uid); + NS_LOG_FUNCTION(this << psdu << txVector << channel << ppduDuration << uid); SetPhyHeaders(txVector, ppduDuration); } diff --git a/src/wifi/model/non-ht/dsss-ppdu.h b/src/wifi/model/non-ht/dsss-ppdu.h index 75e587cde..222619514 100644 --- a/src/wifi/model/non-ht/dsss-ppdu.h +++ b/src/wifi/model/non-ht/dsss-ppdu.h @@ -101,13 +101,13 @@ class DsssPpdu : public WifiPpdu * * \param psdu the PHY payload (PSDU) * \param txVector the TXVECTOR that was used for this PPDU - * \param txCenterFreq the center frequency (MHz) that was used for this PPDU + * \param channel the operating channel of the PHY used to transmit this PPDU * \param ppduDuration the transmission duration of this PPDU * \param uid the unique ID of this PPDU */ DsssPpdu(Ptr psdu, const WifiTxVector& txVector, - uint16_t txCenterFreq, + const WifiPhyOperatingChannel& channel, Time ppduDuration, uint64_t uid); diff --git a/src/wifi/model/non-ht/erp-ofdm-phy.cc b/src/wifi/model/non-ht/erp-ofdm-phy.cc index c7da35fcf..fe05aa978 100644 --- a/src/wifi/model/non-ht/erp-ofdm-phy.cc +++ b/src/wifi/model/non-ht/erp-ofdm-phy.cc @@ -116,9 +116,7 @@ ErpOfdmPhy::BuildPpdu(const WifiConstPsduMap& psdus, return Create( psdus.begin()->second, txVector, - m_wifiPhy->GetOperatingChannel().GetPrimaryChannelCenterFrequency( - txVector.GetChannelWidth()), - m_wifiPhy->GetPhyBand(), + m_wifiPhy->GetOperatingChannel(), m_wifiPhy->GetLatestPhyEntity()->ObtainNextUid( txVector)); // use latest PHY entity to handle MU-RTS sent with non-HT rate } diff --git a/src/wifi/model/non-ht/erp-ofdm-ppdu.cc b/src/wifi/model/non-ht/erp-ofdm-ppdu.cc index f7f002ace..157d6b1cb 100644 --- a/src/wifi/model/non-ht/erp-ofdm-ppdu.cc +++ b/src/wifi/model/non-ht/erp-ofdm-ppdu.cc @@ -23,6 +23,7 @@ #include "erp-ofdm-phy.h" #include "ns3/log.h" +#include "ns3/wifi-phy-operating-channel.h" #include "ns3/wifi-psdu.h" namespace ns3 @@ -32,12 +33,11 @@ NS_LOG_COMPONENT_DEFINE("ErpOfdmPpdu"); ErpOfdmPpdu::ErpOfdmPpdu(Ptr psdu, const WifiTxVector& txVector, - uint16_t txCenterFreq, - WifiPhyBand band, + const WifiPhyOperatingChannel& channel, uint64_t uid) - : OfdmPpdu(psdu, txVector, txCenterFreq, band, uid, true) // add LSigHeader of OfdmPpdu + : OfdmPpdu(psdu, txVector, channel, uid, true) // add LSigHeader of OfdmPpdu { - NS_LOG_FUNCTION(this << psdu << txVector << txCenterFreq << band << uid); + NS_LOG_FUNCTION(this << psdu << txVector << channel << uid); } void diff --git a/src/wifi/model/non-ht/erp-ofdm-ppdu.h b/src/wifi/model/non-ht/erp-ofdm-ppdu.h index 8f54c224b..2cc7a5334 100644 --- a/src/wifi/model/non-ht/erp-ofdm-ppdu.h +++ b/src/wifi/model/non-ht/erp-ofdm-ppdu.h @@ -49,14 +49,12 @@ class ErpOfdmPpdu : public OfdmPpdu * * \param psdu the PHY payload (PSDU) * \param txVector the TXVECTOR that was used for this PPDU - * \param txCenterFreq the center frequency (MHz) that was used for this PPDU - * \param band the WifiPhyBand used for the transmission of this PPDU + * \param channel the operating channel of the PHY used to transmit this PPDU * \param uid the unique ID of this PPDU */ ErpOfdmPpdu(Ptr psdu, const WifiTxVector& txVector, - uint16_t txCenterFreq, - WifiPhyBand band, + const WifiPhyOperatingChannel& channel, uint64_t uid); Ptr Copy() const override; diff --git a/src/wifi/model/non-ht/ofdm-phy.cc b/src/wifi/model/non-ht/ofdm-phy.cc index ba49d7da2..cbe33bf9a 100644 --- a/src/wifi/model/non-ht/ofdm-phy.cc +++ b/src/wifi/model/non-ht/ofdm-phy.cc @@ -298,9 +298,7 @@ OfdmPhy::BuildPpdu(const WifiConstPsduMap& psdus, return Create( psdus.begin()->second, txVector, - m_wifiPhy->GetOperatingChannel().GetPrimaryChannelCenterFrequency( - txVector.GetChannelWidth()), - m_wifiPhy->GetPhyBand(), + m_wifiPhy->GetOperatingChannel(), m_wifiPhy->GetLatestPhyEntity()->ObtainNextUid( txVector)); // use latest PHY entity to handle MU-RTS sent with non-HT rate } diff --git a/src/wifi/model/non-ht/ofdm-ppdu.cc b/src/wifi/model/non-ht/ofdm-ppdu.cc index 3d3949795..a7833f034 100644 --- a/src/wifi/model/non-ht/ofdm-ppdu.cc +++ b/src/wifi/model/non-ht/ofdm-ppdu.cc @@ -24,6 +24,7 @@ #include "ofdm-phy.h" #include "ns3/log.h" +#include "ns3/wifi-phy-operating-channel.h" #include "ns3/wifi-phy.h" #include "ns3/wifi-psdu.h" @@ -34,15 +35,13 @@ NS_LOG_COMPONENT_DEFINE("OfdmPpdu"); OfdmPpdu::OfdmPpdu(Ptr psdu, const WifiTxVector& txVector, - uint16_t txCenterFreq, - WifiPhyBand band, + const WifiPhyOperatingChannel& channel, uint64_t uid, bool instantiateLSig /* = true */) - : WifiPpdu(psdu, txVector, txCenterFreq, uid), - m_band(band), + : WifiPpdu(psdu, txVector, channel, uid), m_channelWidth(txVector.IsNonHtDuplicate() ? 20 : txVector.GetChannelWidth()) { - NS_LOG_FUNCTION(this << psdu << txVector << txCenterFreq << band << uid); + NS_LOG_FUNCTION(this << psdu << txVector << channel << uid); if (instantiateLSig) { SetPhyHeaders(txVector, psdu->GetSize()); @@ -112,7 +111,8 @@ OfdmPpdu::GetTxDuration() const #else length = m_lSig.GetLength(); #endif - return WifiPhy::CalculateTxDuration(length, txVector, m_band); + NS_ASSERT(m_operatingChannel.IsSet()); + return WifiPhy::CalculateTxDuration(length, txVector, m_operatingChannel.GetPhyBand()); } Ptr diff --git a/src/wifi/model/non-ht/ofdm-ppdu.h b/src/wifi/model/non-ht/ofdm-ppdu.h index 96c4d6b88..4cf5c789c 100644 --- a/src/wifi/model/non-ht/ofdm-ppdu.h +++ b/src/wifi/model/non-ht/ofdm-ppdu.h @@ -105,16 +105,14 @@ class OfdmPpdu : public WifiPpdu * * \param psdu the PHY payload (PSDU) * \param txVector the TXVECTOR that was used for this PPDU - * \param txCenterFreq the center frequency (MHz) that was used for this PPDU - * \param band the WifiPhyBand used for the transmission of this PPDU + * \param channel the operating channel of the PHY used to transmit this PPDU * \param uid the unique ID of this PPDU * \param instantiateLSig flag used to instantiate LSigHeader (set LSigHeader's * rate and length), should be disabled by child classes */ OfdmPpdu(Ptr psdu, const WifiTxVector& txVector, - uint16_t txCenterFreq, - WifiPhyBand band, + const WifiPhyOperatingChannel& channel, uint64_t uid, bool instantiateLSig = true); @@ -122,7 +120,6 @@ class OfdmPpdu : public WifiPpdu Ptr Copy() const override; protected: - WifiPhyBand m_band; //!< the WifiPhyBand used to transmit that PPDU #ifndef NS3_BUILD_PROFILE_DEBUG LSigHeader m_lSig; //!< the L-SIG PHY header #endif diff --git a/src/wifi/model/phy-entity.cc b/src/wifi/model/phy-entity.cc index d41f64c1b..b4ef7206e 100644 --- a/src/wifi/model/phy-entity.cc +++ b/src/wifi/model/phy-entity.cc @@ -246,8 +246,7 @@ PhyEntity::BuildPpdu(const WifiConstPsduMap& psdus, const WifiTxVector& txVector "version in the amendment-specific subclasses instead!"); return Create(psdus.begin()->second, txVector, - m_wifiPhy->GetOperatingChannel().GetPrimaryChannelCenterFrequency( - txVector.GetChannelWidth())); // should be overloaded + m_wifiPhy->GetOperatingChannel()); // should be overloaded } Time diff --git a/src/wifi/model/vht/vht-phy.cc b/src/wifi/model/vht/vht-phy.cc index 068d130d5..4edba093b 100644 --- a/src/wifi/model/vht/vht-phy.cc +++ b/src/wifi/model/vht/vht-phy.cc @@ -250,10 +250,8 @@ VhtPhy::BuildPpdu(const WifiConstPsduMap& psdus, const WifiTxVector& txVector, T NS_LOG_FUNCTION(this << psdus << txVector << ppduDuration); return Create(psdus.begin()->second, txVector, - m_wifiPhy->GetOperatingChannel().GetPrimaryChannelCenterFrequency( - txVector.GetChannelWidth()), + m_wifiPhy->GetOperatingChannel(), ppduDuration, - m_wifiPhy->GetPhyBand(), ObtainNextUid(txVector)); } diff --git a/src/wifi/model/vht/vht-ppdu.cc b/src/wifi/model/vht/vht-ppdu.cc index 13a4d2477..cac529461 100644 --- a/src/wifi/model/vht/vht-ppdu.cc +++ b/src/wifi/model/vht/vht-ppdu.cc @@ -24,6 +24,7 @@ #include "vht-phy.h" #include "ns3/log.h" +#include "ns3/wifi-phy-operating-channel.h" #include "ns3/wifi-phy.h" #include "ns3/wifi-psdu.h" @@ -34,18 +35,16 @@ NS_LOG_COMPONENT_DEFINE("VhtPpdu"); VhtPpdu::VhtPpdu(Ptr psdu, const WifiTxVector& txVector, - uint16_t txCenterFreq, + const WifiPhyOperatingChannel& channel, Time ppduDuration, - WifiPhyBand band, uint64_t uid) : OfdmPpdu(psdu, txVector, - txCenterFreq, - band, + channel, uid, false) // don't instantiate LSigHeader of OfdmPpdu { - NS_LOG_FUNCTION(this << psdu << txVector << txCenterFreq << ppduDuration << band << uid); + NS_LOG_FUNCTION(this << psdu << txVector << channel << ppduDuration << uid); SetPhyHeaders(txVector, ppduDuration); } diff --git a/src/wifi/model/vht/vht-ppdu.h b/src/wifi/model/vht/vht-ppdu.h index b1735dba2..72df7544f 100644 --- a/src/wifi/model/vht/vht-ppdu.h +++ b/src/wifi/model/vht/vht-ppdu.h @@ -23,6 +23,7 @@ #define VHT_PPDU_H #include "ns3/ofdm-ppdu.h" +#include "ns3/wifi-phy-operating-channel.h" /** * \file @@ -153,16 +154,14 @@ class VhtPpdu : public OfdmPpdu * * \param psdu the PHY payload (PSDU) * \param txVector the TXVECTOR that was used for this PPDU - * \param txCenterFreq the center frequency (MHz) that was used for this PPDU + * \param channel the operating channel of the PHY used to transmit this PPDU * \param ppduDuration the transmission duration of this PPDU - * \param band the WifiPhyBand used for the transmission of this PPDU * \param uid the unique ID of this PPDU */ VhtPpdu(Ptr psdu, const WifiTxVector& txVector, - uint16_t txCenterFreq, + const WifiPhyOperatingChannel& channel, Time ppduDuration, - WifiPhyBand band, uint64_t uid); Time GetTxDuration() const override; diff --git a/src/wifi/model/wifi-ppdu.cc b/src/wifi/model/wifi-ppdu.cc index e5b4d5992..c9aee663a 100644 --- a/src/wifi/model/wifi-ppdu.cc +++ b/src/wifi/model/wifi-ppdu.cc @@ -23,6 +23,7 @@ #include "ns3/log.h" #include "ns3/packet.h" +#include "ns3/wifi-phy-operating-channel.h" namespace ns3 { @@ -31,33 +32,39 @@ NS_LOG_COMPONENT_DEFINE("WifiPpdu"); WifiPpdu::WifiPpdu(Ptr psdu, const WifiTxVector& txVector, - uint16_t txCenterFreq, + const WifiPhyOperatingChannel& channel, uint64_t uid /* = UINT64_MAX */) : m_preamble(txVector.GetPreambleType()), m_modulation(txVector.IsValid() ? txVector.GetModulationClass() : WIFI_MOD_CLASS_UNKNOWN), - m_txCenterFreq(txCenterFreq), + m_txCenterFreq(channel.IsSet() + ? channel.GetPrimaryChannelCenterFrequency(txVector.GetChannelWidth()) + : 0), m_uid(uid), m_txVector(txVector), + m_operatingChannel(channel), #ifdef NS3_BUILD_PROFILE_DEBUG m_phyHeaders(Create()), #endif m_truncatedTx(false), m_txPowerLevel(txVector.GetTxPowerLevel()) { - NS_LOG_FUNCTION(this << *psdu << txVector << txCenterFreq << uid); + NS_LOG_FUNCTION(this << *psdu << txVector << channel << uid); m_psdus.insert(std::make_pair(SU_STA_ID, psdu)); } WifiPpdu::WifiPpdu(const WifiConstPsduMap& psdus, const WifiTxVector& txVector, - uint16_t txCenterFreq, + const WifiPhyOperatingChannel& channel, uint64_t uid) : m_preamble(txVector.GetPreambleType()), m_modulation(txVector.IsValid() ? txVector.GetMode(psdus.begin()->first).GetModulationClass() : WIFI_MOD_CLASS_UNKNOWN), - m_txCenterFreq(txCenterFreq), + m_txCenterFreq(channel.IsSet() + ? channel.GetPrimaryChannelCenterFrequency(txVector.GetChannelWidth()) + : 0), m_uid(uid), m_txVector(txVector), + m_operatingChannel(channel), #ifdef NS3_BUILD_PROFILE_DEBUG m_phyHeaders(Create()), #endif @@ -65,7 +72,7 @@ WifiPpdu::WifiPpdu(const WifiConstPsduMap& psdus, m_txPowerLevel(txVector.GetTxPowerLevel()), m_txAntennas(txVector.GetNTx()) { - NS_LOG_FUNCTION(this << psdus << txVector << txCenterFreq << uid); + NS_LOG_FUNCTION(this << psdus << txVector << channel << uid); m_psdus = psdus; } diff --git a/src/wifi/model/wifi-ppdu.h b/src/wifi/model/wifi-ppdu.h index 28716116a..3f5d7c2f6 100644 --- a/src/wifi/model/wifi-ppdu.h +++ b/src/wifi/model/wifi-ppdu.h @@ -40,6 +40,7 @@ namespace ns3 class Packet; class WifiPsdu; +class WifiPhyOperatingChannel; /** * Map of const PSDUs indexed by STA-ID @@ -60,24 +61,24 @@ class WifiPpdu : public SimpleRefCount * * \param psdu the PHY payload (PSDU) * \param txVector the TXVECTOR that was used for this PPDU - * \param txCenterFreq the center frequency (MHz) that was used for this PPDU + * \param channel the operating channel of the PHY used to transmit this PPDU * \param uid the unique ID of this PPDU */ WifiPpdu(Ptr psdu, const WifiTxVector& txVector, - uint16_t txCenterFreq, + const WifiPhyOperatingChannel& channel, uint64_t uid = UINT64_MAX); /** * Create a PPDU storing a map of PSDUs. * * \param psdus the PHY payloads (PSDUs) * \param txVector the TXVECTOR that was used for this PPDU - * \param txCenterFreq the center frequency (MHz) that was used for this PPDU + * \param channel the operating channel of the PHY used to transmit this PPDU * \param uid the unique ID of this PPDU */ WifiPpdu(const WifiConstPsduMap& psdus, const WifiTxVector& txVector, - uint16_t txCenterFreq, + const WifiPhyOperatingChannel& channel, uint64_t uid); /** * Destructor for WifiPpdu. @@ -206,6 +207,7 @@ class WifiPpdu : public SimpleRefCount mutable std::optional m_txVector; //!< the TXVECTOR at TX PHY or the reconstructed TXVECTOR at RX PHY (or //!< std::nullopt if TXVECTOR has not been reconstructed yet) + const WifiPhyOperatingChannel& m_operatingChannel; //!< the operating channel of the PHY #ifdef NS3_BUILD_PROFILE_DEBUG Ptr m_phyHeaders; //!< the PHY headers contained in this PPDU diff --git a/src/wifi/test/spectrum-wifi-phy-test.cc b/src/wifi/test/spectrum-wifi-phy-test.cc index 1d0af757f..613fd6519 100644 --- a/src/wifi/test/spectrum-wifi-phy-test.cc +++ b/src/wifi/test/spectrum-wifi-phy-test.cc @@ -38,7 +38,6 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE("SpectrumWifiPhyBasicTest"); static const uint8_t CHANNEL_NUMBER = 36; -static const uint32_t FREQUENCY = 5180; // MHz static const uint16_t CHANNEL_WIDTH = 20; // MHz static const uint16_t GUARD_WIDTH = CHANNEL_WIDTH; // MHz (expanded to channel width to model spectrum mask) @@ -75,9 +74,11 @@ class SpectrumWifiPhyBasicTest : public TestCase /** * Make signal function * \param txPowerWatts the transmit power in watts + * \param channel the operating channel of the PHY used for the transmission * \returns Ptr */ - Ptr MakeSignal(double txPowerWatts); + Ptr MakeSignal(double txPowerWatts, + const WifiPhyOperatingChannel& channel); /** * Send signal function * \param txPowerWatts the transmit power in watts @@ -121,10 +122,17 @@ SpectrumWifiPhyBasicTest::SpectrumWifiPhyBasicTest(std::string name) // Make a Wi-Fi signal to inject directly to the StartRx() method Ptr -SpectrumWifiPhyBasicTest::MakeSignal(double txPowerWatts) +SpectrumWifiPhyBasicTest::MakeSignal(double txPowerWatts, const WifiPhyOperatingChannel& channel) { - WifiTxVector txVector = - WifiTxVector(OfdmPhy::GetOfdmRate6Mbps(), 0, WIFI_PREAMBLE_LONG, 800, 1, 1, 0, 20, false); + WifiTxVector txVector = WifiTxVector(OfdmPhy::GetOfdmRate6Mbps(), + 0, + WIFI_PREAMBLE_LONG, + 800, + 1, + 1, + 0, + CHANNEL_WIDTH, + false); Ptr pkt = Create(1000); WifiMacHeader hdr; @@ -135,13 +143,13 @@ SpectrumWifiPhyBasicTest::MakeSignal(double txPowerWatts) Ptr psdu = Create(pkt, hdr); Time txDuration = m_phy->CalculateTxDuration(psdu->GetSize(), txVector, m_phy->GetPhyBand()); - Ptr ppdu = Create(psdu, txVector, FREQUENCY, WIFI_PHY_BAND_5GHZ, m_uid++); + Ptr ppdu = Create(psdu, txVector, channel, m_uid++); - Ptr txPowerSpectrum = - WifiSpectrumValueHelper::CreateOfdmTxPowerSpectralDensity(FREQUENCY, - CHANNEL_WIDTH, - txPowerWatts, - GUARD_WIDTH); + Ptr txPowerSpectrum = WifiSpectrumValueHelper::CreateOfdmTxPowerSpectralDensity( + channel.GetPrimaryChannelCenterFrequency(CHANNEL_WIDTH), + CHANNEL_WIDTH, + txPowerWatts, + GUARD_WIDTH); Ptr txParams = Create(); txParams->psd = txPowerSpectrum; txParams->txPhy = nullptr; @@ -156,7 +164,7 @@ SpectrumWifiPhyBasicTest::MakeSignal(double txPowerWatts) void SpectrumWifiPhyBasicTest::SendSignal(double txPowerWatts) { - m_phy->StartRx(MakeSignal(txPowerWatts)); + m_phy->StartRx(MakeSignal(txPowerWatts, m_phy->GetOperatingChannel())); } void diff --git a/src/wifi/test/wifi-phy-cca-test.cc b/src/wifi/test/wifi-phy-cca-test.cc index 652cfe3d0..2ab7b0dbe 100644 --- a/src/wifi/test/wifi-phy-cca-test.cc +++ b/src/wifi/test/wifi-phy-cca-test.cc @@ -94,27 +94,31 @@ class WifiPhyCcaThresholdsTest : public TestCase Ptr CreateDummyPsdu(); /** * Create a non-HT PPDU + * \param channel the operating channel of the PHY used for the transmission * \return a non-HT PPDU */ - Ptr CreateDummyNonHtPpdu(); + Ptr CreateDummyNonHtPpdu(const WifiPhyOperatingChannel& channel); /** * Create a HT PPDU * \param bandwidth the bandwidth used for the transmission the PPDU in MHz + * \param channel the operating channel of the PHY used for the transmission * \return a HT PPDU */ - Ptr CreateDummyHtPpdu(uint16_t bandwidth); + Ptr CreateDummyHtPpdu(uint16_t bandwidth, const WifiPhyOperatingChannel& channel); /** * Create a VHT PPDU * \param bandwidth the bandwidth used for the transmission the PPDU in MHz + * \param channel the operating channel of the PHY used for the transmission * \return a VHT PPDU */ - Ptr CreateDummyVhtPpdu(uint16_t bandwidth); + Ptr CreateDummyVhtPpdu(uint16_t bandwidth, const WifiPhyOperatingChannel& channel); /** * Create a HE PPDU * \param bandwidth the bandwidth used for the transmission the PPDU in MHz + * \param channel the operating channel of the PHY used for the transmission * \return a HE PPDU */ - Ptr CreateDummyHePpdu(uint16_t bandwidth); + Ptr CreateDummyHePpdu(uint16_t bandwidth, const WifiPhyOperatingChannel& channel); /** * Function to verify the CCA threshold that is being reported by a given PHY entity upon @@ -167,54 +171,42 @@ WifiPhyCcaThresholdsTest::CreateDummyPsdu() } Ptr -WifiPhyCcaThresholdsTest::CreateDummyNonHtPpdu() +WifiPhyCcaThresholdsTest::CreateDummyNonHtPpdu(const WifiPhyOperatingChannel& channel) { WifiTxVector txVector = WifiTxVector(OfdmPhy::GetOfdmRate6Mbps(), 0, WIFI_PREAMBLE_LONG, 800, 1, 1, 0, 20, false); Ptr psdu = CreateDummyPsdu(); - return Create(psdu, txVector, P20_CENTER_FREQUENCY, WIFI_PHY_BAND_5GHZ, 0); + return Create(psdu, txVector, channel, 0); } Ptr -WifiPhyCcaThresholdsTest::CreateDummyHtPpdu(uint16_t bandwidth) +WifiPhyCcaThresholdsTest::CreateDummyHtPpdu(uint16_t bandwidth, + const WifiPhyOperatingChannel& channel) { WifiTxVector txVector = WifiTxVector(HtPhy::GetHtMcs0(), 0, WIFI_PREAMBLE_HT_MF, 800, 1, 1, 0, bandwidth, false); Ptr psdu = CreateDummyPsdu(); - return Create(psdu, - txVector, - P20_CENTER_FREQUENCY, - MicroSeconds(100), - WIFI_PHY_BAND_5GHZ, - 0); + return Create(psdu, txVector, channel, MicroSeconds(100), 0); } Ptr -WifiPhyCcaThresholdsTest::CreateDummyVhtPpdu(uint16_t bandwidth) +WifiPhyCcaThresholdsTest::CreateDummyVhtPpdu(uint16_t bandwidth, + const WifiPhyOperatingChannel& channel) { WifiTxVector txVector = WifiTxVector(VhtPhy::GetVhtMcs0(), 0, WIFI_PREAMBLE_VHT_SU, 800, 1, 1, 0, bandwidth, false); Ptr psdu = CreateDummyPsdu(); - return Create(psdu, - txVector, - P20_CENTER_FREQUENCY, - MicroSeconds(100), - WIFI_PHY_BAND_5GHZ, - 0); + return Create(psdu, txVector, channel, MicroSeconds(100), 0); } Ptr -WifiPhyCcaThresholdsTest::CreateDummyHePpdu(uint16_t bandwidth) +WifiPhyCcaThresholdsTest::CreateDummyHePpdu(uint16_t bandwidth, + const WifiPhyOperatingChannel& channel) { WifiTxVector txVector = WifiTxVector(HePhy::GetHeMcs0(), 0, WIFI_PREAMBLE_HE_SU, 800, 1, 1, 0, bandwidth, false); Ptr psdu = CreateDummyPsdu(); - return Create(psdu, - txVector, - P20_CENTER_FREQUENCY, - MicroSeconds(100), - WIFI_PHY_BAND_5GHZ, - 0); + return Create(psdu, txVector, channel, MicroSeconds(100), 0); } void @@ -252,13 +244,9 @@ WifiPhyCcaThresholdsTest::DoSetup() m_phy->SetDevice(m_device); m_device->SetPhy(m_phy); - auto channelNum = std::get<0>(*WifiPhyOperatingChannel::FindFirst(0, - P20_CENTER_FREQUENCY, - 20, - WIFI_STANDARD_80211ax, - WIFI_PHY_BAND_5GHZ)); - m_phy->SetOperatingChannel(WifiPhy::ChannelTuple{channelNum, 20, WIFI_PHY_BAND_5GHZ, 0}); - m_phy->SetOperatingChannel(WifiPhy::ChannelTuple{channelNum, 20, WIFI_PHY_BAND_5GHZ, 0}); + auto channelNum = std::get<0>( + *WifiPhyOperatingChannel::FindFirst(0, 0, 160, WIFI_STANDARD_80211ax, WIFI_PHY_BAND_5GHZ)); + m_phy->SetOperatingChannel(WifiPhy::ChannelTuple{channelNum, 160, WIFI_PHY_BAND_5GHZ, 0}); m_phy->ConfigureStandard(WIFI_STANDARD_80211ax); m_obssPdAlgorithm = CreateObject(); @@ -292,7 +280,7 @@ WifiPhyCcaThresholdsTest::RunOne() // OFDM PHY: 20 MHz non-HT PPDU in primary channel (20 MHz) if power above CCA sensitivity // threshold VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_OFDM), - CreateDummyNonHtPpdu(), + CreateDummyNonHtPpdu(m_phy->GetOperatingChannel()), WIFI_CHANLIST_PRIMARY, m_CcaSensitivityDbm); @@ -315,14 +303,14 @@ WifiPhyCcaThresholdsTest::RunOne() // HT PHY: 20 MHz HT PPDU in primary channel (20 MHz) if power in primary above CCA sensitivity // threshold VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_HT), - CreateDummyHtPpdu(20), + CreateDummyHtPpdu(20, m_phy->GetOperatingChannel()), WIFI_CHANLIST_PRIMARY, m_CcaSensitivityDbm); // HT PHY: 40 MHz HT PPDU in primary channel (20 MHz) if power in primary above CCA sensitivity // threshold VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_HT), - CreateDummyHtPpdu(40), + CreateDummyHtPpdu(40, m_phy->GetOperatingChannel()), WIFI_CHANLIST_PRIMARY, m_CcaSensitivityDbm); @@ -357,28 +345,28 @@ WifiPhyCcaThresholdsTest::RunOne() // VHT PHY: 20 MHz VHT PPDU in primary channel (20 MHz) if power in primary above CCA // sensitivity threshold VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_VHT), - CreateDummyVhtPpdu(20), + CreateDummyVhtPpdu(20, m_phy->GetOperatingChannel()), WIFI_CHANLIST_PRIMARY, m_CcaSensitivityDbm); // VHT PHY: 40 MHz VHT PPDU in primary channel (20 MHz) if power in primary above CCA // sensitivity threshold VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_VHT), - CreateDummyVhtPpdu(40), + CreateDummyVhtPpdu(40, m_phy->GetOperatingChannel()), WIFI_CHANLIST_PRIMARY, m_CcaSensitivityDbm); // VHT PHY: 80 MHz VHT PPDU in primary channel (20 MHz) if power in primary above CCA // sensitivity threshold VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_VHT), - CreateDummyVhtPpdu(80), + CreateDummyVhtPpdu(80, m_phy->GetOperatingChannel()), WIFI_CHANLIST_PRIMARY, m_CcaSensitivityDbm); // VHT PHY: 160 MHz VHT PPDU in primary channel (20 MHz) if power in primary above CCA // sensitivity threshold VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_VHT), - CreateDummyVhtPpdu(160), + CreateDummyVhtPpdu(160, m_phy->GetOperatingChannel()), WIFI_CHANLIST_PRIMARY, m_CcaSensitivityDbm); @@ -387,42 +375,42 @@ WifiPhyCcaThresholdsTest::RunOne() // VHT PHY: 20 MHz VHT PPDU in secondary channel (20 MHz) if power above the CCA sensitivity // threshold corresponding to a 20 MHz PPDU that does not occupy the primary 20 MHz VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_VHT), - CreateDummyVhtPpdu(20), + CreateDummyVhtPpdu(20, m_phy->GetOperatingChannel()), WIFI_CHANLIST_SECONDARY, std::get<0>(m_secondaryCcaSensitivityThresholds)); // VHT PHY: 20 MHz VHT PPDU in secondary40 channel (40 MHz) if power above the CCA sensitivity // threshold corresponding to a 20 MHz PPDU that does not occupy the primary 20 MHz VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_VHT), - CreateDummyVhtPpdu(20), + CreateDummyVhtPpdu(20, m_phy->GetOperatingChannel()), WIFI_CHANLIST_SECONDARY40, std::get<0>(m_secondaryCcaSensitivityThresholds)); // VHT PHY: 40 MHz VHT PPDU in secondary40 channel (40 MHz) if power above the CCA sensitivity // threshold corresponding to a 40 MHz PPDU that does not occupy the primary 20 MHz VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_VHT), - CreateDummyVhtPpdu(40), + CreateDummyVhtPpdu(40, m_phy->GetOperatingChannel()), WIFI_CHANLIST_SECONDARY40, std::get<1>(m_secondaryCcaSensitivityThresholds)); // VHT PHY: 20 MHz VHT PPDU in secondary80 channel (80 MHz) if power above the CCA sensitivity // threshold corresponding to a 20 MHz PPDU that does not occupy the primary 20 MHz VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_VHT), - CreateDummyVhtPpdu(20), + CreateDummyVhtPpdu(20, m_phy->GetOperatingChannel()), WIFI_CHANLIST_SECONDARY80, std::get<0>(m_secondaryCcaSensitivityThresholds)); // VHT PHY: 40 MHz VHT PPDU in secondary80 channel (80 MHz) if power above the CCA sensitivity // threshold corresponding to a 40 MHz PPDU that does not occupy the primary 20 MHz VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_VHT), - CreateDummyVhtPpdu(40), + CreateDummyVhtPpdu(40, m_phy->GetOperatingChannel()), WIFI_CHANLIST_SECONDARY80, std::get<1>(m_secondaryCcaSensitivityThresholds)); // VHT PHY: 80 MHz VHT PPDU in secondary80 channel (80 MHz) if power above the CCA sensitivity // threshold corresponding to a 80 MHz PPDU that does not occupy the primary 20 MHz VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_VHT), - CreateDummyVhtPpdu(80), + CreateDummyVhtPpdu(80, m_phy->GetOperatingChannel()), WIFI_CHANLIST_SECONDARY80, std::get<2>(m_secondaryCcaSensitivityThresholds)); @@ -457,28 +445,28 @@ WifiPhyCcaThresholdsTest::RunOne() // HE PHY: 20 MHz HE PPDU in primary channel (20 MHz) if power in primary above CCA sensitivity // threshold VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_HE), - CreateDummyHePpdu(20), + CreateDummyHePpdu(20, m_phy->GetOperatingChannel()), WIFI_CHANLIST_PRIMARY, m_CcaSensitivityDbm); // HE PHY: 40 MHz HE PPDU in primary channel (20 MHz) if power in primary above CCA sensitivity // threshold VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_HE), - CreateDummyHePpdu(40), + CreateDummyHePpdu(40, m_phy->GetOperatingChannel()), WIFI_CHANLIST_PRIMARY, m_CcaSensitivityDbm); // HE PHY: 80 MHz HE PPDU in primary channel (20 MHz) if power in primary above CCA sensitivity // threshold VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_HE), - CreateDummyHePpdu(80), + CreateDummyHePpdu(80, m_phy->GetOperatingChannel()), WIFI_CHANLIST_PRIMARY, m_CcaSensitivityDbm); // HE PHY: 160 MHz HE PPDU in primary channel (20 MHz) if power in primary above CCA sensitivity // threshold VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_HE), - CreateDummyHePpdu(160), + CreateDummyHePpdu(160, m_phy->GetOperatingChannel()), WIFI_CHANLIST_PRIMARY, m_CcaSensitivityDbm); @@ -488,7 +476,7 @@ WifiPhyCcaThresholdsTest::RunOne() // sensitivity threshold corresponding to a 20 MHz PPDU that does not occupy the primary 20 MHz // and the OBSS-PD level VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_HE), - CreateDummyHePpdu(20), + CreateDummyHePpdu(20, m_phy->GetOperatingChannel()), WIFI_CHANLIST_SECONDARY, std::max(m_obssPdLevel, std::get<0>(m_secondaryCcaSensitivityThresholds))); @@ -496,7 +484,7 @@ WifiPhyCcaThresholdsTest::RunOne() // sensitivity threshold corresponding to a 20 MHz PPDU that does not occupy the primary 20 MHz // and the OBSS-PD level VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_HE), - CreateDummyHePpdu(20), + CreateDummyHePpdu(20, m_phy->GetOperatingChannel()), WIFI_CHANLIST_SECONDARY40, std::max(m_obssPdLevel, std::get<0>(m_secondaryCcaSensitivityThresholds))); @@ -505,7 +493,7 @@ WifiPhyCcaThresholdsTest::RunOne() // and the OBSS-PD level plus 3 dB VerifyCcaThreshold( m_phy->GetPhyEntity(WIFI_MOD_CLASS_HE), - CreateDummyHePpdu(40), + CreateDummyHePpdu(40, m_phy->GetOperatingChannel()), WIFI_CHANLIST_SECONDARY40, std::max(m_obssPdLevel + 3.0, std::get<1>(m_secondaryCcaSensitivityThresholds))); @@ -513,7 +501,7 @@ WifiPhyCcaThresholdsTest::RunOne() // sensitivity threshold corresponding to a 20 MHz PPDU that does not occupy the primary 20 MHz // and the OBSS-PD level VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_HE), - CreateDummyHePpdu(20), + CreateDummyHePpdu(20, m_phy->GetOperatingChannel()), WIFI_CHANLIST_SECONDARY80, std::max(m_obssPdLevel, std::get<0>(m_secondaryCcaSensitivityThresholds))); @@ -522,7 +510,7 @@ WifiPhyCcaThresholdsTest::RunOne() // and the OBSS-PD level plus 3 dB VerifyCcaThreshold( m_phy->GetPhyEntity(WIFI_MOD_CLASS_HE), - CreateDummyHePpdu(40), + CreateDummyHePpdu(40, m_phy->GetOperatingChannel()), WIFI_CHANLIST_SECONDARY80, std::max(m_obssPdLevel + 3.0, std::get<1>(m_secondaryCcaSensitivityThresholds))); @@ -531,7 +519,7 @@ WifiPhyCcaThresholdsTest::RunOne() // and the OBSS-PD level plus 6 dB VerifyCcaThreshold( m_phy->GetPhyEntity(WIFI_MOD_CLASS_HE), - CreateDummyHePpdu(80), + CreateDummyHePpdu(80, m_phy->GetOperatingChannel()), WIFI_CHANLIST_SECONDARY80, std::max(m_obssPdLevel + 6.0, std::get<2>(m_secondaryCcaSensitivityThresholds))); } diff --git a/src/wifi/test/wifi-phy-ofdma-test.cc b/src/wifi/test/wifi-phy-ofdma-test.cc index 2ea4874cb..11d5aa490 100644 --- a/src/wifi/test/wifi-phy-ofdma-test.cc +++ b/src/wifi/test/wifi-phy-ofdma-test.cc @@ -2433,9 +2433,8 @@ TestMultipleHeTbPreambles::RxHeTbPpdu(uint64_t uid, m_phy->CalculateTxDuration(psdu->GetSize(), txVector, m_phy->GetPhyBand(), staId); Ptr ppdu = Create(psdus, txVector, - DEFAULT_FREQUENCY, + m_phy->GetOperatingChannel(), ppduDuration, - WIFI_PHY_BAND_5GHZ, uid, HePpdu::PSD_NON_HE_PORTION); diff --git a/src/wifi/test/wifi-phy-reception-test.cc b/src/wifi/test/wifi-phy-reception-test.cc index d494d9746..b4ff9265d 100644 --- a/src/wifi/test/wifi-phy-reception-test.cc +++ b/src/wifi/test/wifi-phy-reception-test.cc @@ -149,7 +149,7 @@ TestThresholdPreambleDetectionWithoutFrameCapture::SendPacket(double rxPowerDbm) Time txDuration = m_phy->CalculateTxDuration(psdu->GetSize(), txVector, m_phy->GetPhyBand()); Ptr ppdu = - Create(psdu, txVector, FREQUENCY, txDuration, WIFI_PHY_BAND_5GHZ, m_uid++); + Create(psdu, txVector, m_phy->GetOperatingChannel(), txDuration, m_uid++); Ptr txPowerSpectrum = WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity(FREQUENCY, @@ -823,7 +823,7 @@ TestThresholdPreambleDetectionWithFrameCapture::SendPacket(double rxPowerDbm) Time txDuration = m_phy->CalculateTxDuration(psdu->GetSize(), txVector, m_phy->GetPhyBand()); Ptr ppdu = - Create(psdu, txVector, FREQUENCY, txDuration, WIFI_PHY_BAND_5GHZ, m_uid++); + Create(psdu, txVector, m_phy->GetOperatingChannel(), txDuration, m_uid++); Ptr txPowerSpectrum = WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity(FREQUENCY, @@ -1871,7 +1871,7 @@ TestSimpleFrameCaptureModel::SendPacket(double rxPowerDbm, uint32_t packetSize) Time txDuration = m_phy->CalculateTxDuration(psdu->GetSize(), txVector, m_phy->GetPhyBand()); Ptr ppdu = - Create(psdu, txVector, FREQUENCY, txDuration, WIFI_PHY_BAND_5GHZ, m_uid++); + Create(psdu, txVector, m_phy->GetOperatingChannel(), txDuration, m_uid++); Ptr txPowerSpectrum = WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity(FREQUENCY, @@ -2136,7 +2136,7 @@ TestPhyHeadersReception::SendPacket(double rxPowerDbm) Time txDuration = m_phy->CalculateTxDuration(psdu->GetSize(), txVector, m_phy->GetPhyBand()); Ptr ppdu = - Create(psdu, txVector, FREQUENCY, txDuration, WIFI_PHY_BAND_5GHZ, m_uid++); + Create(psdu, txVector, m_phy->GetOperatingChannel(), txDuration, m_uid++); Ptr txPowerSpectrum = WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity(FREQUENCY, @@ -2860,7 +2860,7 @@ TestAmpduReception::SendAmpduWithThreeMpdus(double rxPowerDbm, uint32_t referenc Time txDuration = m_phy->CalculateTxDuration(psdu->GetSize(), txVector, m_phy->GetPhyBand()); Ptr ppdu = - Create(psdu, txVector, FREQUENCY, txDuration, WIFI_PHY_BAND_5GHZ, m_uid++); + Create(psdu, txVector, m_phy->GetOperatingChannel(), txDuration, m_uid++); Ptr txPowerSpectrum = WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity(FREQUENCY, @@ -4317,11 +4317,10 @@ class TestUnsupportedBandwidthReception : public TestCase /** * Function to create a PPDU * - * \param band the PHY band to use * \param centerFreqMhz the center frequency used for the transmission of the PPDU (in MHz) * \param bandwidthMhz the bandwidth used for the transmission of the PPDU (in MHz) */ - void SendPpdu(WifiPhyBand band, uint16_t centerFreqMhz, uint16_t bandwidthMhz); + void SendPpdu(uint16_t centerFreqMhz, uint16_t bandwidthMhz); /** * Function called upon a PSDU received successfully @@ -4374,7 +4373,8 @@ class TestUnsupportedBandwidthReception : public TestCase std::optional