diff --git a/src/wifi/model/he/he-phy.cc b/src/wifi/model/he/he-phy.cc index 1e92b688b..00bcf8773 100644 --- a/src/wifi/model/he/he-phy.cc +++ b/src/wifi/model/he/he-phy.cc @@ -1186,9 +1186,8 @@ HePhy::ObtainNextUid (const WifiTxVector& txVector) } Ptr -HePhy::GetTxPowerSpectralDensity (double txPowerW, Ptr ppdu) const +HePhy::GetTxPowerSpectralDensity (double txPowerW, Ptr ppdu, const WifiTxVector& txVector) const { - const WifiTxVector& txVector = ppdu->GetTxVector (); uint16_t centerFrequency = GetCenterFrequencyForChannelWidth (txVector); uint16_t channelWidth = txVector.GetChannelWidth (); NS_LOG_FUNCTION (this << centerFrequency << channelWidth << txPowerW); @@ -1226,7 +1225,7 @@ HePhy::GetTxPowerSpectralDensity (double txPowerW, Ptr ppdu) con } else { - const auto band = GetRuBandForTx (txVector, GetStaId (hePpdu)); + const auto band = GetRuBandForTx (ppdu->GetTxVector (), GetStaId (hePpdu)); // Use TXVECTOR from PPDU since the one passed by the MAC does not have PHY index set return WifiSpectrumValueHelper::CreateHeMuOfdmTxPowerSpectralDensity (centerFrequency, channelWidth, txPowerW, @@ -1298,7 +1297,7 @@ HePhy::GetCenterFrequencyForNonOfdmaPart (const WifiTxVector& txVector, uint16_t } void -HePhy::StartTx (Ptr ppdu) +HePhy::StartTx (Ptr ppdu, const WifiTxVector& txVector) { NS_LOG_FUNCTION (this << ppdu); if (ppdu->GetType () == WIFI_PPDU_TYPE_UL_MU || @@ -1306,20 +1305,20 @@ HePhy::StartTx (Ptr ppdu) { //non-OFDMA part Time nonOfdmaDuration = ppdu->GetType () == WIFI_PPDU_TYPE_UL_MU ? - CalculateNonOfdmaDurationForHeTb (ppdu->GetTxVector ()) : - CalculateNonOfdmaDurationForHeMu (ppdu->GetTxVector ()); - Transmit (nonOfdmaDuration, ppdu, "non-OFDMA transmission"); + CalculateNonOfdmaDurationForHeTb (txVector) : + CalculateNonOfdmaDurationForHeMu (txVector); + Transmit (nonOfdmaDuration, ppdu, txVector, "non-OFDMA transmission"); //OFDMA part auto hePpdu = DynamicCast (ppdu->Copy ()); //since flag will be modified NS_ASSERT (hePpdu); hePpdu->SetTxPsdFlag (HePpdu::PSD_HE_PORTION); Time ofdmaDuration = ppdu->GetTxDuration () - nonOfdmaDuration; - Simulator::Schedule (nonOfdmaDuration, &PhyEntity::Transmit, this, ofdmaDuration, hePpdu, "OFDMA transmission"); + Simulator::Schedule (nonOfdmaDuration, &PhyEntity::Transmit, this, ofdmaDuration, hePpdu, txVector, "OFDMA transmission"); } else { - PhyEntity::StartTx (ppdu); + PhyEntity::StartTx (ppdu, txVector); } } diff --git a/src/wifi/model/he/he-phy.h b/src/wifi/model/he/he-phy.h index 1c702af12..31a33d2d7 100644 --- a/src/wifi/model/he/he-phy.h +++ b/src/wifi/model/he/he-phy.h @@ -101,7 +101,7 @@ public: void CancelAllEvents (void) override; uint16_t GetStaId (const Ptr ppdu) const override; uint16_t GetMeasurementChannelWidth (const Ptr ppdu) const override; - void StartTx (Ptr ppdu) override; + void StartTx (Ptr ppdu, const WifiTxVector& txVector) override; Time CalculateTxDuration (WifiConstPsduMap psduMap, const WifiTxVector& txVector, WifiPhyBand band) const override; void SwitchMaybeToCcaBusy (const Ptr ppdu) override; double GetCcaThreshold (const Ptr ppdu, WifiChannelListType channelType) const override; @@ -414,7 +414,7 @@ protected: void DoResetReceive (Ptr event) override; void DoAbortCurrentReception (WifiPhyRxfailureReason reason) override; uint64_t ObtainNextUid (const WifiTxVector& txVector) override; - Ptr GetTxPowerSpectralDensity (double txPowerW, Ptr ppdu) const override; + Ptr GetTxPowerSpectralDensity (double txPowerW, Ptr ppdu, const WifiTxVector& txVector) const override; uint32_t GetMaxPsduSize (void) const override; WifiConstPsduMap GetWifiConstPsduMap (Ptr psdu, const WifiTxVector& txVector) const override; diff --git a/src/wifi/model/ht/ht-phy.cc b/src/wifi/model/ht/ht-phy.cc index cfcd848fc..7ef4e19ab 100644 --- a/src/wifi/model/ht/ht-phy.cc +++ b/src/wifi/model/ht/ht-phy.cc @@ -434,9 +434,8 @@ HtPhy::IsConfigSupported (Ptr ppdu) const } Ptr -HtPhy::GetTxPowerSpectralDensity (double txPowerW, Ptr ppdu) const +HtPhy::GetTxPowerSpectralDensity (double txPowerW, Ptr /* ppdu */, const WifiTxVector& txVector) const { - const WifiTxVector& txVector = ppdu->GetTxVector (); uint16_t centerFrequency = GetCenterFrequencyForChannelWidth (txVector); uint16_t channelWidth = txVector.GetChannelWidth (); NS_LOG_FUNCTION (this << centerFrequency << channelWidth << txPowerW); diff --git a/src/wifi/model/ht/ht-phy.h b/src/wifi/model/ht/ht-phy.h index 53e8bbc19..6529357a4 100644 --- a/src/wifi/model/ht/ht-phy.h +++ b/src/wifi/model/ht/ht-phy.h @@ -449,7 +449,7 @@ protected: PhyFieldRxStatus DoEndReceiveField (WifiPpduField field, Ptr event) override; bool IsAllConfigSupported (WifiPpduField field, Ptr ppdu) const override; bool IsConfigSupported (Ptr ppdu) const override; - Ptr GetTxPowerSpectralDensity (double txPowerW, Ptr ppdu) const override; + Ptr GetTxPowerSpectralDensity (double txPowerW, Ptr ppdu, const WifiTxVector& txVector) const override; uint32_t GetMaxPsduSize (void) const override; CcaIndication GetCcaIndication (const Ptr ppdu) override; diff --git a/src/wifi/model/non-ht/dsss-phy.cc b/src/wifi/model/non-ht/dsss-phy.cc index ebcdc88e6..b4541a1ea 100644 --- a/src/wifi/model/non-ht/dsss-phy.cc +++ b/src/wifi/model/non-ht/dsss-phy.cc @@ -245,9 +245,8 @@ DsssPhy::GetMeasurementChannelWidth (const Ptr ppdu) const } Ptr -DsssPhy::GetTxPowerSpectralDensity (double txPowerW, Ptr ppdu) const +DsssPhy::GetTxPowerSpectralDensity (double txPowerW, Ptr /* ppdu */, const WifiTxVector& txVector) const { - const WifiTxVector& txVector = ppdu->GetTxVector (); uint16_t centerFrequency = GetCenterFrequencyForChannelWidth (txVector); uint16_t channelWidth = txVector.GetChannelWidth (); NS_LOG_FUNCTION (this << centerFrequency << channelWidth << txPowerW); diff --git a/src/wifi/model/non-ht/dsss-phy.h b/src/wifi/model/non-ht/dsss-phy.h index aa08599b4..d0df0b931 100644 --- a/src/wifi/model/non-ht/dsss-phy.h +++ b/src/wifi/model/non-ht/dsss-phy.h @@ -151,7 +151,7 @@ public: private: PhyFieldRxStatus DoEndReceiveField (WifiPpduField field, Ptr event) override; - Ptr GetTxPowerSpectralDensity (double txPowerW, Ptr ppdu) const override; + Ptr GetTxPowerSpectralDensity (double txPowerW, Ptr ppdu, const WifiTxVector& txVector) const override; uint16_t GetRxChannelWidth (const WifiTxVector& txVector) const override; uint16_t GetMeasurementChannelWidth (const Ptr ppdu) const override; diff --git a/src/wifi/model/non-ht/ofdm-phy.cc b/src/wifi/model/non-ht/ofdm-phy.cc index e3a3f1527..aa32f159f 100644 --- a/src/wifi/model/non-ht/ofdm-phy.cc +++ b/src/wifi/model/non-ht/ofdm-phy.cc @@ -338,9 +338,8 @@ OfdmPhy::IsAllConfigSupported (WifiPpduField /* field */, Ptr pp } Ptr -OfdmPhy::GetTxPowerSpectralDensity (double txPowerW, Ptr ppdu) const +OfdmPhy::GetTxPowerSpectralDensity (double txPowerW, Ptr /* ppdu */, const WifiTxVector& txVector) const { - const WifiTxVector& txVector = ppdu->GetTxVector (); uint16_t centerFrequency = GetCenterFrequencyForChannelWidth (txVector); uint16_t channelWidth = txVector.GetChannelWidth (); NS_LOG_FUNCTION (this << centerFrequency << channelWidth << txPowerW); diff --git a/src/wifi/model/non-ht/ofdm-phy.h b/src/wifi/model/non-ht/ofdm-phy.h index 8bfa1e616..b738f5449 100644 --- a/src/wifi/model/non-ht/ofdm-phy.h +++ b/src/wifi/model/non-ht/ofdm-phy.h @@ -315,7 +315,7 @@ public: protected: PhyFieldRxStatus DoEndReceiveField (WifiPpduField field, Ptr event) override; - Ptr GetTxPowerSpectralDensity (double txPowerW, Ptr ppdu) const override; + Ptr GetTxPowerSpectralDensity (double txPowerW, Ptr ppdu, const WifiTxVector& txVector) const override; uint32_t GetMaxPsduSize (void) const override; uint16_t GetMeasurementChannelWidth (const Ptr ppdu) const override; diff --git a/src/wifi/model/phy-entity.cc b/src/wifi/model/phy-entity.cc index c60079602..c35774041 100644 --- a/src/wifi/model/phy-entity.cc +++ b/src/wifi/model/phy-entity.cc @@ -1132,24 +1132,24 @@ PhyEntity::NotifyPayloadBegin (const WifiTxVector& txVector, const Time& payload } void -PhyEntity::StartTx (Ptr ppdu) +PhyEntity::StartTx (Ptr ppdu, const WifiTxVector& txVector) { - NS_LOG_FUNCTION (this << ppdu); - Transmit (ppdu->GetTxDuration (), ppdu, "transmission"); + NS_LOG_FUNCTION (this << ppdu << txVector); + Transmit (ppdu->GetTxDuration (), ppdu, txVector, "transmission"); } void -PhyEntity::Transmit (Time txDuration, Ptr ppdu, std::string type) +PhyEntity::Transmit (Time txDuration, Ptr ppdu, const WifiTxVector& txVector, std::string type) { - NS_LOG_FUNCTION (this << txDuration << ppdu << type); + NS_LOG_FUNCTION (this << txDuration << ppdu << txVector << type); double txPowerWatts = DbmToW (m_wifiPhy->GetTxPowerForTransmission (ppdu) + m_wifiPhy->GetTxGain ()); NS_LOG_DEBUG ("Start " << type << ": signal power before antenna gain=" << WToDbm (txPowerWatts) << "dBm"); - Ptr txPowerSpectrum = GetTxPowerSpectralDensity (txPowerWatts, ppdu); + Ptr txPowerSpectrum = GetTxPowerSpectralDensity (txPowerWatts, ppdu, txVector); Ptr txParams = Create (); txParams->duration = txDuration; txParams->psd = txPowerSpectrum; txParams->ppdu = ppdu; - txParams->txCenterFreq = GetCenterFrequencyForChannelWidth (ppdu->GetTxVector ()); + txParams->txCenterFreq = GetCenterFrequencyForChannelWidth (txVector); NS_LOG_DEBUG ("Starting " << type << " with power " << WToDbm (txPowerWatts) << " dBm on channel " << +m_wifiPhy->GetChannelNumber () << " for " << txParams->duration.As (Time::MS)); NS_LOG_DEBUG ("Starting " << type << " with integrated spectrum power " << WToDbm (Integral (*txPowerSpectrum)) << " dBm; spectrum model Uid: " << txPowerSpectrum->GetSpectrumModel ()->GetUid ()); auto spectrumWifiPhy = DynamicCast (m_wifiPhy); diff --git a/src/wifi/model/phy-entity.h b/src/wifi/model/phy-entity.h index 1baeefa2a..93cd85840 100644 --- a/src/wifi/model/phy-entity.h +++ b/src/wifi/model/phy-entity.h @@ -447,8 +447,9 @@ public: * \see SpectrumWifiPhy::StartTx * * \param ppdu the PPDU to send + * \param txVector the TXVECTOR used for the transmission of the PPDU */ - virtual void StartTx (Ptr ppdu); + virtual void StartTx (Ptr ppdu, const WifiTxVector& txVector); /** * This function prepares most of the WifiSpectrumSignalParameters @@ -457,9 +458,10 @@ public: * * \param txDuration the duration of the transmission * \param ppdu the PPDU to send + * \param txVector the TXVECTOR used for the transmission of the PPDU * \param type the type of transmission (for logging) */ - void Transmit (Time txDuration, Ptr ppdu, std::string type); + void Transmit (Time txDuration, Ptr ppdu, const WifiTxVector& txVector, std::string type); /** * \param psduMap the PSDU(s) to transmit indexed by STA-ID @@ -776,12 +778,13 @@ protected: /** * \param txPowerW power in W to spread across the bands * \param ppdu the PPDU that will be transmitted + * \param txVector the transmission parameters * \return Pointer to SpectrumValue * * This is a helper function to create the right TX PSD corresponding * to the amendment of this PHY. */ - virtual Ptr GetTxPowerSpectralDensity (double txPowerW, Ptr ppdu) const = 0; + virtual Ptr GetTxPowerSpectralDensity (double txPowerW, Ptr ppdu, const WifiTxVector& txVector) const = 0; /** * Get the center frequency of the channel corresponding the current TxVector rather than diff --git a/src/wifi/model/spectrum-wifi-phy.cc b/src/wifi/model/spectrum-wifi-phy.cc index 2fccfed08..8c1fb2c1c 100644 --- a/src/wifi/model/spectrum-wifi-phy.cc +++ b/src/wifi/model/spectrum-wifi-phy.cc @@ -402,10 +402,10 @@ SpectrumWifiPhy::CreateWifiSpectrumPhyInterface (Ptr device) } void -SpectrumWifiPhy::StartTx (Ptr ppdu) +SpectrumWifiPhy::StartTx (Ptr ppdu, const WifiTxVector& txVector) { NS_LOG_FUNCTION (this << ppdu); - GetPhyEntity (ppdu->GetModulation ())->StartTx (ppdu); + GetPhyEntity (ppdu->GetModulation ())->StartTx (ppdu, txVector); } void diff --git a/src/wifi/model/spectrum-wifi-phy.h b/src/wifi/model/spectrum-wifi-phy.h index 41fe8e866..90fb7692d 100644 --- a/src/wifi/model/spectrum-wifi-phy.h +++ b/src/wifi/model/spectrum-wifi-phy.h @@ -67,7 +67,7 @@ public: virtual ~SpectrumWifiPhy (); // Implementation of pure virtual method. - void StartTx (Ptr ppdu) override; + void StartTx (Ptr ppdu, const WifiTxVector& txVector) override; Ptr GetChannel (void) const override; uint16_t GetGuardBandwidth (uint16_t currentChannelWidth) const override; std::tuple GetTxMaskRejectionParams (void) const override; diff --git a/src/wifi/model/wifi-phy.cc b/src/wifi/model/wifi-phy.cc index 383dff629..030e570cb 100644 --- a/src/wifi/model/wifi-phy.cc +++ b/src/wifi/model/wifi-phy.cc @@ -1634,7 +1634,7 @@ WifiPhy::Send (WifiConstPsduMap psdus, const WifiTxVector& txVector) m_endTxEvent = Simulator::Schedule (txDuration, &WifiPhy::NotifyTxEnd, this, psdus); //TODO: fix for MU - StartTx (ppdu); + StartTx (ppdu, txVector); m_channelAccessRequested = false; m_powerRestricted = false; diff --git a/src/wifi/model/wifi-phy.h b/src/wifi/model/wifi-phy.h index 37115eabd..7166a41d1 100644 --- a/src/wifi/model/wifi-phy.h +++ b/src/wifi/model/wifi-phy.h @@ -145,8 +145,9 @@ public: /** * \param ppdu the PPDU to send + * \param txVector the TXVECTOR to use to send the PPDU */ - virtual void StartTx (Ptr ppdu) = 0; + virtual void StartTx (Ptr ppdu, const WifiTxVector& txVector) = 0; /** * Put in sleep mode. diff --git a/src/wifi/model/yans-wifi-phy.cc b/src/wifi/model/yans-wifi-phy.cc index 2060dd990..1d715a3dd 100644 --- a/src/wifi/model/yans-wifi-phy.cc +++ b/src/wifi/model/yans-wifi-phy.cc @@ -86,10 +86,10 @@ YansWifiPhy::SetChannel (const Ptr channel) } void -YansWifiPhy::StartTx (Ptr ppdu) +YansWifiPhy::StartTx (Ptr ppdu, const WifiTxVector& txVector) { NS_LOG_FUNCTION (this << ppdu); - NS_LOG_DEBUG ("Start transmission: signal power before antenna gain=" << GetPowerDbm (ppdu->GetTxVector ().GetTxPowerLevel ()) << "dBm"); + NS_LOG_DEBUG ("Start transmission: signal power before antenna gain=" << GetPowerDbm (txVector.GetTxPowerLevel ()) << "dBm"); m_channel->Send (this, ppdu, GetTxPowerForTransmission (ppdu) + GetTxGain ()); } diff --git a/src/wifi/model/yans-wifi-phy.h b/src/wifi/model/yans-wifi-phy.h index 94207f9f7..81aafac34 100644 --- a/src/wifi/model/yans-wifi-phy.h +++ b/src/wifi/model/yans-wifi-phy.h @@ -57,7 +57,7 @@ public: virtual ~YansWifiPhy (); void SetInterferenceHelper (const Ptr helper) override; - void StartTx (Ptr ppdu) override; + void StartTx (Ptr ppdu, const WifiTxVector& txVector) override; Ptr GetChannel (void) const override; uint16_t GetGuardBandwidth (uint16_t currentChannelWidth) const override; std::tuple GetTxMaskRejectionParams (void) const override; diff --git a/src/wifi/test/wifi-phy-ofdma-test.cc b/src/wifi/test/wifi-phy-ofdma-test.cc index e0eab6a5d..b466706cb 100644 --- a/src/wifi/test/wifi-phy-ofdma-test.cc +++ b/src/wifi/test/wifi-phy-ofdma-test.cc @@ -156,8 +156,9 @@ public: /** * \param ppdu the PPDU to send + * \param txVector the TXVECTOR used for the transmission of the PPDU */ - void StartTx (Ptr ppdu) override; + void StartTx (Ptr ppdu, const WifiTxVector& txVector) override; /** * Set the global PPDU UID counter. @@ -258,10 +259,10 @@ OfdmaSpectrumWifiPhy::SetTriggerFrameUid (uint64_t uid) } void -OfdmaSpectrumWifiPhy::StartTx (Ptr ppdu) +OfdmaSpectrumWifiPhy::StartTx (Ptr ppdu, const WifiTxVector& txVector) { m_phyTxPpduUidTrace (ppdu->GetUid ()); - SpectrumWifiPhy::StartTx (ppdu); + SpectrumWifiPhy::StartTx (ppdu, txVector); } std::map , Ptr > &