diff --git a/src/wifi/model/he/he-phy.cc b/src/wifi/model/he/he-phy.cc index b84267a6a..ab7291b84 100644 --- a/src/wifi/model/he/he-phy.cc +++ b/src/wifi/model/he/he-phy.cc @@ -341,7 +341,9 @@ HePhy::BuildPpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, { flag = HePpdu::PSD_NON_HE_TB; } - return Create (psdus, txVector, ppduDuration, m_wifiPhy->GetPhyBand (), + return Create (psdus, txVector, + m_wifiPhy->GetOperatingChannel ().GetPrimaryChannelCenterFrequency (txVector.GetChannelWidth ()), + ppduDuration, m_wifiPhy->GetPhyBand (), ObtainNextUid (txVector), flag, m_wifiPhy->GetOperatingChannel ().GetPrimaryChannelIndex (20)); } diff --git a/src/wifi/model/he/he-ppdu.cc b/src/wifi/model/he/he-ppdu.cc index 919354bb6..3cf7f7a01 100644 --- a/src/wifi/model/he/he-ppdu.cc +++ b/src/wifi/model/he/he-ppdu.cc @@ -47,11 +47,11 @@ std::ostream& operator<< (std::ostream& os, const HePpdu::TxPsdFlag &flag) } } -HePpdu::HePpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, Time ppduDuration, - WifiPhyBand band, uint64_t uid, TxPsdFlag flag, uint8_t p20Index) - : OfdmPpdu (psdus.begin ()->second, txVector, band, uid, false) //don't instantiate LSigHeader of OfdmPpdu +HePpdu::HePpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, uint16_t txCenterFreq, + Time ppduDuration, WifiPhyBand band, uint64_t uid, TxPsdFlag flag, uint8_t p20Index) + : OfdmPpdu (psdus.begin ()->second, txVector, txCenterFreq, band, uid, false) //don't instantiate LSigHeader of OfdmPpdu { - NS_LOG_FUNCTION (this << psdus << txVector << ppduDuration << band << uid << flag); + NS_LOG_FUNCTION (this << psdus << txVector << txCenterFreq << ppduDuration << band << uid << flag); //overwrite with map (since only first element used by OfdmPpdu) m_psdus.begin ()->second = 0; @@ -72,11 +72,11 @@ HePpdu::HePpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, Ti SetTxPsdFlag (flag); } -HePpdu::HePpdu (Ptr psdu, const WifiTxVector& txVector, Time ppduDuration, - WifiPhyBand band, uint64_t uid) - : OfdmPpdu (psdu, txVector, band, uid, false) //don't instantiate LSigHeader of OfdmPpdu +HePpdu::HePpdu (Ptr psdu, const WifiTxVector& txVector, uint16_t txCenterFreq, + Time ppduDuration, WifiPhyBand band, uint64_t uid) + : OfdmPpdu (psdu, txVector, txCenterFreq, band, uid, false) //don't instantiate LSigHeader of OfdmPpdu { - NS_LOG_FUNCTION (this << psdu << txVector << ppduDuration << band << uid); + NS_LOG_FUNCTION (this << psdu << txVector << txCenterFreq << ppduDuration << band << uid); NS_ASSERT (!IsMu ()); SetPhyHeaders (txVector, ppduDuration); SetTxPsdFlag (PSD_NON_HE_TB); @@ -259,16 +259,15 @@ HePpdu::GetTransmissionChannelWidth (void) const } bool -HePpdu::CanBeReceived (uint16_t txCenterFreq, uint16_t p20MinFreq, uint16_t p20MaxFreq) const +HePpdu::CanBeReceived (uint16_t p20MinFreq, uint16_t p20MaxFreq) const { - NS_LOG_FUNCTION (this << txCenterFreq << p20MinFreq << p20MaxFreq); - + NS_LOG_FUNCTION (this << p20MinFreq << p20MaxFreq); if (IsUlMu ()) { // APs are able to receive TB PPDUs sent on a band other than the primary20 channel return true; } - return OfdmPpdu::CanBeReceived (txCenterFreq, p20MinFreq, p20MaxFreq); + return OfdmPpdu::CanBeReceived (p20MinFreq, p20MaxFreq); } HePpdu::TxPsdFlag diff --git a/src/wifi/model/he/he-ppdu.h b/src/wifi/model/he/he-ppdu.h index 28de677f6..a9f5ed683 100644 --- a/src/wifi/model/he/he-ppdu.h +++ b/src/wifi/model/he/he-ppdu.h @@ -167,12 +167,13 @@ public: * * \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 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, Time ppduDuration, - WifiPhyBand band, uint64_t uid); + HePpdu (Ptr psdu, const WifiTxVector& txVector, uint16_t txCenterFreq, + Time ppduDuration, WifiPhyBand band, uint64_t uid); /** * Create an MU HE PPDU, storing a map of PSDUs. * @@ -180,14 +181,15 @@ public: * * \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 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 * \param p20Index the index of the primary 20 MHz channel */ - HePpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, Time ppduDuration, - WifiPhyBand band, uint64_t uid, TxPsdFlag flag, uint8_t p20Index); + HePpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, uint16_t txCenterFreq, + Time ppduDuration, WifiPhyBand band, uint64_t uid, TxPsdFlag flag, uint8_t p20Index); /** * Destructor for HePpdu. */ @@ -198,8 +200,7 @@ public: WifiPpduType GetType (void) const override; uint16_t GetStaId (void) const override; uint16_t GetTransmissionChannelWidth (void) const override; - bool CanBeReceived (uint16_t txCenterFreq, uint16_t p20MinFreq, - uint16_t p20MaxFreq) const override; + bool CanBeReceived (uint16_t p20MinFreq, uint16_t p20MaxFreq) const override; /** * Get the payload of the PPDU. diff --git a/src/wifi/model/ht/ht-phy.cc b/src/wifi/model/ht/ht-phy.cc index e0583b264..581bf12e9 100644 --- a/src/wifi/model/ht/ht-phy.cc +++ b/src/wifi/model/ht/ht-phy.cc @@ -358,7 +358,9 @@ Ptr HtPhy::BuildPpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, Time ppduDuration) { NS_LOG_FUNCTION (this << psdus << txVector << ppduDuration); - return Create (psdus.begin ()->second, txVector, ppduDuration, m_wifiPhy->GetPhyBand (), + return Create (psdus.begin ()->second, txVector, + m_wifiPhy->GetOperatingChannel ().GetPrimaryChannelCenterFrequency (txVector.GetChannelWidth ()), + 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 c7121b55d..c178c5d8f 100644 --- a/src/wifi/model/ht/ht-ppdu.cc +++ b/src/wifi/model/ht/ht-ppdu.cc @@ -31,11 +31,11 @@ namespace ns3 { NS_LOG_COMPONENT_DEFINE ("HtPpdu"); -HtPpdu::HtPpdu (Ptr psdu, const WifiTxVector& txVector, Time ppduDuration, +HtPpdu::HtPpdu (Ptr psdu, const WifiTxVector& txVector, uint16_t txCenterFreq, Time ppduDuration, WifiPhyBand band, uint64_t uid) - : OfdmPpdu (psdu, txVector, band, uid, false) //don't instantiate LSigHeader of OfdmPpdu + : OfdmPpdu (psdu, txVector, txCenterFreq, band, uid, false) //don't instantiate LSigHeader of OfdmPpdu { - NS_LOG_FUNCTION (this << psdu << txVector << ppduDuration << band << uid); + NS_LOG_FUNCTION (this << psdu << txVector << txCenterFreq << ppduDuration << band << uid); uint8_t sigExtension = 0; if (m_band == WIFI_PHY_BAND_2_4GHZ) { @@ -79,7 +79,7 @@ HtPpdu::GetTxDuration (void) const Ptr HtPpdu::Copy (void) const { - return Create (GetPsdu (), GetTxVector (), GetTxDuration (), m_band, m_uid); + return Create (GetPsdu (), GetTxVector (), m_txCenterFreq, GetTxDuration (), m_band, m_uid); } HtPpdu::HtSigHeader::HtSigHeader () diff --git a/src/wifi/model/ht/ht-ppdu.h b/src/wifi/model/ht/ht-ppdu.h index 2c568a9b0..578e282b2 100644 --- a/src/wifi/model/ht/ht-ppdu.h +++ b/src/wifi/model/ht/ht-ppdu.h @@ -141,12 +141,13 @@ public: * * \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 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, Time ppduDuration, - WifiPhyBand band, uint64_t uid); + HtPpdu (Ptr psdu, const WifiTxVector& txVector, uint16_t txCenterFreq, + Time ppduDuration, WifiPhyBand band, uint64_t uid); /** * Destructor for HtPpdu. */ diff --git a/src/wifi/model/interference-helper.cc b/src/wifi/model/interference-helper.cc index 6c607be78..3c0b41ec9 100644 --- a/src/wifi/model/interference-helper.cc +++ b/src/wifi/model/interference-helper.cc @@ -224,7 +224,7 @@ InterferenceHelper::AddForeignSignal (Time duration, RxPowerWattPerChannelBand& hdr.SetType (WIFI_MAC_QOSDATA); hdr.SetQosTid (0); Ptr fakePpdu = Create (Create (Create (0), hdr), - WifiTxVector ()); + WifiTxVector (), 0); 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 d69c239ee..ebcdc88e6 100644 --- a/src/wifi/model/non-ht/dsss-phy.cc +++ b/src/wifi/model/non-ht/dsss-phy.cc @@ -182,8 +182,9 @@ Ptr DsssPhy::BuildPpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, Time ppduDuration) { NS_LOG_FUNCTION (this << psdus << txVector << ppduDuration); - return Create (psdus.begin ()->second, txVector, ppduDuration, - ObtainNextUid (txVector)); + return Create (psdus.begin ()->second, txVector, + m_wifiPhy->GetOperatingChannel ().GetPrimaryChannelCenterFrequency (txVector.GetChannelWidth ()), + ppduDuration, ObtainNextUid (txVector)); } PhyEntity::PhyFieldRxStatus diff --git a/src/wifi/model/non-ht/dsss-ppdu.cc b/src/wifi/model/non-ht/dsss-ppdu.cc index bfb6812e4..616f5fa87 100644 --- a/src/wifi/model/non-ht/dsss-ppdu.cc +++ b/src/wifi/model/non-ht/dsss-ppdu.cc @@ -30,10 +30,11 @@ namespace ns3 { NS_LOG_COMPONENT_DEFINE ("DsssPpdu"); -DsssPpdu::DsssPpdu (Ptr psdu, const WifiTxVector& txVector, Time ppduDuration, uint64_t uid) - : WifiPpdu (psdu, txVector, uid) +DsssPpdu::DsssPpdu (Ptr psdu, const WifiTxVector& txVector, + uint16_t txCenterFreq, Time ppduDuration, uint64_t uid) + : WifiPpdu (psdu, txVector, txCenterFreq, uid) { - NS_LOG_FUNCTION (this << psdu << txVector << ppduDuration << uid); + NS_LOG_FUNCTION (this << psdu << txVector << txCenterFreq << ppduDuration << uid); m_dsssSig.SetRate (txVector.GetMode ().GetDataRate (22)); Time psduDuration = ppduDuration - WifiPhy::CalculatePhyPreambleAndHeaderDuration (txVector); m_dsssSig.SetLength (psduDuration.GetMicroSeconds ()); @@ -65,7 +66,7 @@ DsssPpdu::GetTxDuration (void) const Ptr DsssPpdu::Copy (void) const { - return Create (GetPsdu (), GetTxVector (), GetTxDuration (), m_uid); + return Create (GetPsdu (), GetTxVector (), m_txCenterFreq, GetTxDuration (), m_uid); } DsssPpdu::DsssSigHeader::DsssSigHeader () diff --git a/src/wifi/model/non-ht/dsss-ppdu.h b/src/wifi/model/non-ht/dsss-ppdu.h index 33eca69cc..8b1c98c21 100644 --- a/src/wifi/model/non-ht/dsss-ppdu.h +++ b/src/wifi/model/non-ht/dsss-ppdu.h @@ -103,10 +103,12 @@ public: * * \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 ppduDuration the transmission duration of this PPDU * \param uid the unique ID of this PPDU */ - DsssPpdu (Ptr psdu, const WifiTxVector& txVector, Time ppduDuration, uint64_t uid); + DsssPpdu (Ptr psdu, const WifiTxVector& txVector, + uint16_t txCenterFreq, Time ppduDuration, uint64_t uid); /** * Destructor for DsssPpdu. */ diff --git a/src/wifi/model/non-ht/erp-ofdm-phy.cc b/src/wifi/model/non-ht/erp-ofdm-phy.cc index de3e4e6d5..b2685ae1d 100644 --- a/src/wifi/model/non-ht/erp-ofdm-phy.cc +++ b/src/wifi/model/non-ht/erp-ofdm-phy.cc @@ -106,8 +106,9 @@ Ptr ErpOfdmPhy::BuildPpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, Time /* ppduDuration */) { NS_LOG_FUNCTION (this << psdus << txVector); - return Create (psdus.begin ()->second, txVector, m_wifiPhy->GetPhyBand (), - ObtainNextUid (txVector)); + return Create (psdus.begin ()->second, txVector, + m_wifiPhy->GetOperatingChannel ().GetPrimaryChannelCenterFrequency (txVector.GetChannelWidth ()), + m_wifiPhy->GetPhyBand (), ObtainNextUid (txVector)); } void diff --git a/src/wifi/model/non-ht/erp-ofdm-ppdu.cc b/src/wifi/model/non-ht/erp-ofdm-ppdu.cc index 97b18b4b5..f7ab69e23 100644 --- a/src/wifi/model/non-ht/erp-ofdm-ppdu.cc +++ b/src/wifi/model/non-ht/erp-ofdm-ppdu.cc @@ -29,10 +29,10 @@ namespace ns3 { NS_LOG_COMPONENT_DEFINE ("ErpOfdmPpdu"); ErpOfdmPpdu::ErpOfdmPpdu (Ptr psdu, const WifiTxVector& txVector, - WifiPhyBand band, uint64_t uid) - : OfdmPpdu (psdu, txVector, band, uid, true) //instantiate LSigHeader of OfdmPpdu + uint16_t txCenterFreq, WifiPhyBand band, uint64_t uid) + : OfdmPpdu (psdu, txVector, txCenterFreq, band, uid, true) //instantiate LSigHeader of OfdmPpdu { - NS_LOG_FUNCTION (this << psdu << txVector << band << uid); + NS_LOG_FUNCTION (this << psdu << txVector << txCenterFreq << band << uid); } ErpOfdmPpdu::~ErpOfdmPpdu () @@ -53,7 +53,7 @@ ErpOfdmPpdu::DoGetTxVector (void) const Ptr ErpOfdmPpdu::Copy (void) const { - return Create (GetPsdu (), GetTxVector (), m_band, m_uid); + return Create (GetPsdu (), GetTxVector (), m_txCenterFreq, m_band, m_uid); } } //namespace ns3 diff --git a/src/wifi/model/non-ht/erp-ofdm-ppdu.h b/src/wifi/model/non-ht/erp-ofdm-ppdu.h index 45602faf2..17daeea80 100644 --- a/src/wifi/model/non-ht/erp-ofdm-ppdu.h +++ b/src/wifi/model/non-ht/erp-ofdm-ppdu.h @@ -49,11 +49,12 @@ public: * * \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 uid the unique ID of this PPDU */ ErpOfdmPpdu (Ptr psdu, const WifiTxVector& txVector, - WifiPhyBand band, uint64_t uid); + uint16_t txCenterFreq, WifiPhyBand band, uint64_t uid); /** * Destructor for ErpOfdmPpdu. */ diff --git a/src/wifi/model/non-ht/ofdm-phy.cc b/src/wifi/model/non-ht/ofdm-phy.cc index 5b5ab9c00..d74895f8f 100644 --- a/src/wifi/model/non-ht/ofdm-phy.cc +++ b/src/wifi/model/non-ht/ofdm-phy.cc @@ -275,8 +275,9 @@ Ptr OfdmPhy::BuildPpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, Time /* ppduDuration */) { NS_LOG_FUNCTION (this << psdus << txVector); - return Create (psdus.begin ()->second, txVector, m_wifiPhy->GetPhyBand (), - ObtainNextUid (txVector)); + return Create (psdus.begin ()->second, txVector, + m_wifiPhy->GetOperatingChannel ().GetPrimaryChannelCenterFrequency (txVector.GetChannelWidth ()), + m_wifiPhy->GetPhyBand (), ObtainNextUid (txVector)); } PhyEntity::PhyFieldRxStatus diff --git a/src/wifi/model/non-ht/ofdm-ppdu.cc b/src/wifi/model/non-ht/ofdm-ppdu.cc index a2fc4b6f8..77724562e 100644 --- a/src/wifi/model/non-ht/ofdm-ppdu.cc +++ b/src/wifi/model/non-ht/ofdm-ppdu.cc @@ -31,13 +31,13 @@ namespace ns3 { NS_LOG_COMPONENT_DEFINE ("OfdmPpdu"); OfdmPpdu::OfdmPpdu (Ptr psdu, const WifiTxVector& txVector, - WifiPhyBand band, uint64_t uid, - bool instantiateLSig /* = true */) - : WifiPpdu (psdu, txVector, uid), + uint16_t txCenterFreq, WifiPhyBand band, + uint64_t uid, bool instantiateLSig /* = true */) + : WifiPpdu (psdu, txVector, txCenterFreq, uid), m_band (band), m_channelWidth (txVector.GetChannelWidth ()) { - NS_LOG_FUNCTION (this << psdu << txVector << band << uid); + NS_LOG_FUNCTION (this << psdu << txVector << txCenterFreq << band << uid); if (instantiateLSig) { m_lSig.SetRate (txVector.GetMode ().GetDataRate (txVector), m_channelWidth); @@ -73,7 +73,7 @@ OfdmPpdu::GetTxDuration (void) const Ptr OfdmPpdu::Copy (void) const { - return Create (GetPsdu (), GetTxVector (), m_band, m_uid); + return Create (GetPsdu (), GetTxVector (), m_txCenterFreq, m_band, m_uid); } OfdmPpdu::LSigHeader::LSigHeader () diff --git a/src/wifi/model/non-ht/ofdm-ppdu.h b/src/wifi/model/non-ht/ofdm-ppdu.h index 29b97787d..810225440 100644 --- a/src/wifi/model/non-ht/ofdm-ppdu.h +++ b/src/wifi/model/non-ht/ofdm-ppdu.h @@ -107,12 +107,14 @@ public: * * \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 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, WifiPhyBand band, uint64_t uid, + OfdmPpdu (Ptr psdu, const WifiTxVector& txVector, + uint16_t txCenterFreq, WifiPhyBand band, uint64_t uid, bool instantiateLSig = true); /** * Destructor for OfdmPpdu. diff --git a/src/wifi/model/phy-entity.cc b/src/wifi/model/phy-entity.cc index 9fb01a89d..32376d171 100644 --- a/src/wifi/model/phy-entity.cc +++ b/src/wifi/model/phy-entity.cc @@ -231,7 +231,8 @@ PhyEntity::BuildPpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVect { NS_LOG_FUNCTION (this << psdus << txVector); NS_FATAL_ERROR ("This method is unsupported for the base PhyEntity class. Use the overloaded version in the amendment-specific subclasses instead!"); - return Create (psdus.begin ()->second, txVector); //should be overloaded + return Create (psdus.begin ()->second, txVector, + m_wifiPhy->GetOperatingChannel ().GetPrimaryChannelCenterFrequency (txVector.GetChannelWidth ())); //should be overloaded } Time diff --git a/src/wifi/model/spectrum-wifi-phy.cc b/src/wifi/model/spectrum-wifi-phy.cc index fad6ee60f..6b28414c9 100644 --- a/src/wifi/model/spectrum-wifi-phy.cc +++ b/src/wifi/model/spectrum-wifi-phy.cc @@ -364,7 +364,7 @@ SpectrumWifiPhy::StartRx (Ptr rxParams) uint16_t p20MaxFreq = GetOperatingChannel ().GetPrimaryChannelCenterFrequency (width) + width / 2; - if (!wifiRxParams->ppdu->CanBeReceived (wifiRxParams->txCenterFreq, p20MinFreq, p20MaxFreq)) + if (!wifiRxParams->ppdu->CanBeReceived (p20MinFreq, p20MaxFreq)) { NS_LOG_INFO ("Cannot receive the PPDU, consider it as interference"); m_interference->Add (wifiRxParams->ppdu, wifiRxParams->ppdu->GetTxVector (), diff --git a/src/wifi/model/vht/vht-phy.cc b/src/wifi/model/vht/vht-phy.cc index df9b03467..b2e03f99e 100644 --- a/src/wifi/model/vht/vht-phy.cc +++ b/src/wifi/model/vht/vht-phy.cc @@ -229,7 +229,9 @@ Ptr VhtPhy::BuildPpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, Time ppduDuration) { NS_LOG_FUNCTION (this << psdus << txVector << ppduDuration); - return Create (psdus.begin ()->second, txVector, ppduDuration, m_wifiPhy->GetPhyBand (), + return Create (psdus.begin ()->second, txVector, + m_wifiPhy->GetOperatingChannel ().GetPrimaryChannelCenterFrequency (txVector.GetChannelWidth ()), + 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 9f803a5aa..0465cc512 100644 --- a/src/wifi/model/vht/vht-ppdu.cc +++ b/src/wifi/model/vht/vht-ppdu.cc @@ -30,11 +30,11 @@ namespace ns3 { NS_LOG_COMPONENT_DEFINE ("VhtPpdu"); -VhtPpdu::VhtPpdu (Ptr psdu, const WifiTxVector& txVector, Time ppduDuration, - WifiPhyBand band, uint64_t uid) - : OfdmPpdu (psdu, txVector, band, uid, false) //don't instantiate LSigHeader of OfdmPpdu +VhtPpdu::VhtPpdu (Ptr psdu, const WifiTxVector& txVector, uint16_t txCenterFreq, + Time ppduDuration, WifiPhyBand band, uint64_t uid) + : OfdmPpdu (psdu, txVector, txCenterFreq, band, uid, false) //don't instantiate LSigHeader of OfdmPpdu { - NS_LOG_FUNCTION (this << psdu << txVector << ppduDuration << band << uid); + NS_LOG_FUNCTION (this << psdu << txVector << txCenterFreq << ppduDuration << band << uid); uint16_t length = ((ceil ((static_cast (ppduDuration.GetNanoSeconds () - (20 * 1000)) / 1000) / 4.0) * 3) - 3); m_lSig.SetLength (length); m_vhtSig.SetMuFlag (m_preamble == WIFI_PREAMBLE_VHT_MU); @@ -86,7 +86,7 @@ VhtPpdu::GetTxDuration (void) const Ptr VhtPpdu::Copy (void) const { - return Create (GetPsdu (), GetTxVector (), GetTxDuration (), m_band, m_uid); + return Create (GetPsdu (), GetTxVector (), m_txCenterFreq, GetTxDuration (), m_band, m_uid); } WifiPpduType diff --git a/src/wifi/model/vht/vht-ppdu.h b/src/wifi/model/vht/vht-ppdu.h index 2b91889b2..a9bd1e867 100644 --- a/src/wifi/model/vht/vht-ppdu.h +++ b/src/wifi/model/vht/vht-ppdu.h @@ -155,12 +155,13 @@ public: * * \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 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, Time ppduDuration, - WifiPhyBand band, uint64_t uid); + VhtPpdu (Ptr psdu, const WifiTxVector& txVector, uint16_t txCenterFreq, + Time ppduDuration, WifiPhyBand band, uint64_t uid); /** * Destructor for VhtPpdu. */ diff --git a/src/wifi/model/wifi-ppdu.cc b/src/wifi/model/wifi-ppdu.cc index dad56f234..516b1feaf 100644 --- a/src/wifi/model/wifi-ppdu.cc +++ b/src/wifi/model/wifi-ppdu.cc @@ -27,26 +27,28 @@ namespace ns3 { NS_LOG_COMPONENT_DEFINE ("WifiPpdu"); -WifiPpdu::WifiPpdu (Ptr psdu, const WifiTxVector& txVector, uint64_t uid /* = UINT64_MAX */) +WifiPpdu::WifiPpdu (Ptr psdu, const WifiTxVector& txVector, uint16_t txCenterFreq, uint64_t uid /* = UINT64_MAX */) : m_preamble (txVector.GetPreambleType ()), m_modulation (txVector.IsValid () ? txVector.GetModulationClass () : WIFI_MOD_CLASS_UNKNOWN), + m_txCenterFreq (txCenterFreq), m_uid (uid), m_truncatedTx (false), m_txPowerLevel (txVector.GetTxPowerLevel ()) { - NS_LOG_FUNCTION (this << *psdu << txVector << uid); + NS_LOG_FUNCTION (this << *psdu << txVector << txCenterFreq << uid); m_psdus.insert (std::make_pair (SU_STA_ID, psdu)); } -WifiPpdu::WifiPpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, uint64_t uid) +WifiPpdu::WifiPpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, uint16_t txCenterFreq, 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_uid (uid), m_truncatedTx (false), m_txPowerLevel (txVector.GetTxPowerLevel ()), m_txAntennas (txVector.GetNTx ()) { - NS_LOG_FUNCTION (this << psdus << txVector << uid); + NS_LOG_FUNCTION (this << psdus << txVector << txCenterFreq << uid); m_psdus = psdus; } @@ -107,14 +109,13 @@ WifiPpdu::GetTransmissionChannelWidth (void) const } bool -WifiPpdu::CanBeReceived (uint16_t txCenterFreq, uint16_t p20MinFreq, - uint16_t p20MaxFreq) const +WifiPpdu::CanBeReceived (uint16_t p20MinFreq, uint16_t p20MaxFreq) const { - NS_LOG_FUNCTION (this << txCenterFreq << p20MinFreq << p20MaxFreq); + NS_LOG_FUNCTION (this << m_txCenterFreq << p20MinFreq << p20MaxFreq); uint16_t txChannelWidth = GetTxVector ().GetChannelWidth (); - uint16_t minTxFreq = txCenterFreq - txChannelWidth / 2; - uint16_t maxTxFreq = txCenterFreq + txChannelWidth / 2; + uint16_t minTxFreq = m_txCenterFreq - txChannelWidth / 2; + uint16_t maxTxFreq = m_txCenterFreq + txChannelWidth / 2; if (minTxFreq > p20MinFreq || maxTxFreq < p20MaxFreq) { @@ -179,7 +180,7 @@ Ptr WifiPpdu::Copy (void) const { NS_FATAL_ERROR ("This method should not be called for the base WifiPpdu class. Use the overloaded version in the amendment-specific PPDU subclasses instead!"); - return Create (GetPsdu (), GetTxVector ()); + return Create (GetPsdu (), GetTxVector (), m_txCenterFreq); } std::ostream & operator << (std::ostream &os, const Ptr &ppdu) diff --git a/src/wifi/model/wifi-ppdu.h b/src/wifi/model/wifi-ppdu.h index e020da776..a57f8f3d3 100644 --- a/src/wifi/model/wifi-ppdu.h +++ b/src/wifi/model/wifi-ppdu.h @@ -56,17 +56,19 @@ public: * * \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 uid the unique ID of this PPDU */ - WifiPpdu (Ptr psdu, const WifiTxVector& txVector, uint64_t uid = UINT64_MAX); + WifiPpdu (Ptr psdu, const WifiTxVector& txVector, uint16_t txCenterFreq, 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 uid the unique ID of this PPDU */ - WifiPpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, uint64_t uid); + WifiPpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, uint16_t txCenterFreq, uint64_t uid); /** * Destructor for WifiPpdu. */ @@ -116,14 +118,11 @@ public: * channel. Normally, a PPDU can be received if it is transmitted over a * channel that overlaps the primary20 channel of a PHY entity. * - * \param txCenterFreq the center frequency (MHz) of the channel over which the - * PPDU is transmitted * \param p20MinFreq the minimum frequency (MHz) of the primary channel * \param p20MaxFreq the maximum frequency (MHz) of the primary channel * \return true if this PPDU can be received, false otherwise */ - virtual bool CanBeReceived (uint16_t txCenterFreq, uint16_t p20MinFreq, - uint16_t p20MaxFreq) const; + virtual bool CanBeReceived (uint16_t p20MinFreq, uint16_t p20MaxFreq) const; /** * Get the modulation used for the PPDU. @@ -177,6 +176,7 @@ protected: WifiPreamble m_preamble; //!< the PHY preamble WifiModulationClass m_modulation; //!< the modulation used for the transmission of this PPDU WifiConstPsduMap m_psdus; //!< the PSDUs contained in this PPDU + uint16_t m_txCenterFreq; //!< the center frequency (MHz) used for the transmission of this PPDU uint64_t m_uid; //!< the unique ID of this PPDU private: diff --git a/src/wifi/test/spectrum-wifi-phy-test.cc b/src/wifi/test/spectrum-wifi-phy-test.cc index 996e4b125..20f376dd7 100644 --- a/src/wifi/test/spectrum-wifi-phy-test.cc +++ b/src/wifi/test/spectrum-wifi-phy-test.cc @@ -132,7 +132,7 @@ 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, WIFI_PHY_BAND_5GHZ, m_uid++); + Ptr ppdu = Create (psdu, txVector, FREQUENCY, WIFI_PHY_BAND_5GHZ, m_uid++); Ptr txPowerSpectrum = WifiSpectrumValueHelper::CreateOfdmTxPowerSpectralDensity (FREQUENCY, CHANNEL_WIDTH, txPowerWatts, GUARD_WIDTH); Ptr txParams = Create (); diff --git a/src/wifi/test/wifi-phy-ofdma-test.cc b/src/wifi/test/wifi-phy-ofdma-test.cc index d7ae8e07e..2697f0abc 100644 --- a/src/wifi/test/wifi-phy-ofdma-test.cc +++ b/src/wifi/test/wifi-phy-ofdma-test.cc @@ -1491,7 +1491,8 @@ TestMultipleHeTbPreambles::RxHeTbPpdu (uint64_t uid, uint16_t staId, double txPo psdus.insert (std::make_pair (staId, psdu)); Time ppduDuration = m_phy->CalculateTxDuration (psdu->GetSize (), txVector, m_phy->GetPhyBand (), staId); - Ptr ppdu = Create (psdus, txVector, ppduDuration, WIFI_PHY_BAND_5GHZ, uid, + Ptr ppdu = Create (psdus, txVector, DEFAULT_FREQUENCY, + ppduDuration, WIFI_PHY_BAND_5GHZ, uid, HePpdu::PSD_HE_TB_NON_OFDMA_PORTION, 0); //Send non-OFDMA part diff --git a/src/wifi/test/wifi-phy-reception-test.cc b/src/wifi/test/wifi-phy-reception-test.cc index ae497c967..2d6e13a56 100644 --- a/src/wifi/test/wifi-phy-reception-test.cc +++ b/src/wifi/test/wifi-phy-reception-test.cc @@ -142,7 +142,7 @@ TestThresholdPreambleDetectionWithoutFrameCapture::SendPacket (double rxPowerDbm Ptr psdu = Create (pkt, hdr); Time txDuration = m_phy->CalculateTxDuration (psdu->GetSize (), txVector, m_phy->GetPhyBand ()); - Ptr ppdu = Create (psdu, txVector, txDuration, WIFI_PHY_BAND_5GHZ, m_uid++); + Ptr ppdu = Create (psdu, txVector, FREQUENCY, txDuration, WIFI_PHY_BAND_5GHZ, m_uid++); Ptr txPowerSpectrum = WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity (FREQUENCY, CHANNEL_WIDTH, DbmToW (rxPowerDbm), GUARD_WIDTH); @@ -510,7 +510,7 @@ TestThresholdPreambleDetectionWithFrameCapture::SendPacket (double rxPowerDbm) Ptr psdu = Create (pkt, hdr); Time txDuration = m_phy->CalculateTxDuration (psdu->GetSize (), txVector, m_phy->GetPhyBand ()); - Ptr ppdu = Create (psdu, txVector, txDuration, WIFI_PHY_BAND_5GHZ, m_uid++); + Ptr ppdu = Create (psdu, txVector, FREQUENCY, txDuration, WIFI_PHY_BAND_5GHZ, m_uid++); Ptr txPowerSpectrum = WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity (FREQUENCY, CHANNEL_WIDTH, DbmToW (rxPowerDbm), GUARD_WIDTH); @@ -1032,7 +1032,7 @@ TestSimpleFrameCaptureModel::SendPacket (double rxPowerDbm, uint32_t packetSize) Ptr psdu = Create (pkt, hdr); Time txDuration = m_phy->CalculateTxDuration (psdu->GetSize (), txVector, m_phy->GetPhyBand ()); - Ptr ppdu = Create (psdu, txVector, txDuration, WIFI_PHY_BAND_5GHZ, m_uid++); + Ptr ppdu = Create (psdu, txVector, FREQUENCY, txDuration, WIFI_PHY_BAND_5GHZ, m_uid++); Ptr txPowerSpectrum = WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity (FREQUENCY, CHANNEL_WIDTH, DbmToW (rxPowerDbm), GUARD_WIDTH); @@ -1249,7 +1249,7 @@ TestPhyHeadersReception::SendPacket (double rxPowerDbm) Ptr psdu = Create (pkt, hdr); Time txDuration = m_phy->CalculateTxDuration (psdu->GetSize (), txVector, m_phy->GetPhyBand ()); - Ptr ppdu = Create (psdu, txVector, txDuration, WIFI_PHY_BAND_5GHZ, m_uid++); + Ptr ppdu = Create (psdu, txVector, FREQUENCY, txDuration, WIFI_PHY_BAND_5GHZ, m_uid++); Ptr txPowerSpectrum = WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity (FREQUENCY, CHANNEL_WIDTH, DbmToW (rxPowerDbm), GUARD_WIDTH); @@ -1770,7 +1770,7 @@ TestAmpduReception::SendAmpduWithThreeMpdus (double rxPowerDbm, uint32_t referen Time txDuration = m_phy->CalculateTxDuration (psdu->GetSize (), txVector, m_phy->GetPhyBand ()); - Ptr ppdu = Create (psdu, txVector, txDuration, WIFI_PHY_BAND_5GHZ, m_uid++); + Ptr ppdu = Create (psdu, txVector, FREQUENCY, txDuration, WIFI_PHY_BAND_5GHZ, m_uid++); Ptr txPowerSpectrum = WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity (FREQUENCY, CHANNEL_WIDTH, DbmToW (rxPowerDbm), GUARD_WIDTH); diff --git a/src/wifi/test/wifi-phy-thresholds-test.cc b/src/wifi/test/wifi-phy-thresholds-test.cc index 286832fe5..71781f795 100644 --- a/src/wifi/test/wifi-phy-thresholds-test.cc +++ b/src/wifi/test/wifi-phy-thresholds-test.cc @@ -151,7 +151,7 @@ WifiPhyThresholdsTest::MakeWifiSignal (double txPowerWatts) Ptr psdu = Create (pkt, hdr); Time txDuration = m_phy->CalculateTxDuration (psdu->GetSize (), txVector, m_phy->GetPhyBand ()); - Ptr ppdu = Create (psdu, txVector, WIFI_PHY_BAND_5GHZ, 0); + Ptr ppdu = Create (psdu, txVector, FREQUENCY, WIFI_PHY_BAND_5GHZ, 0); Ptr txPowerSpectrum = WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity (FREQUENCY, CHANNEL_WIDTH, txPowerWatts, CHANNEL_WIDTH); Ptr txParams = Create ();