wifi: Do not use reconstructed TXVECTOR from PPDU for PHY TX functions
This commit is contained in:
committed by
Sebastien Deronne
parent
fe60645362
commit
472c7dc283
@@ -1186,9 +1186,8 @@ HePhy::ObtainNextUid (const WifiTxVector& txVector)
|
||||
}
|
||||
|
||||
Ptr<SpectrumValue>
|
||||
HePhy::GetTxPowerSpectralDensity (double txPowerW, Ptr<const WifiPpdu> ppdu) const
|
||||
HePhy::GetTxPowerSpectralDensity (double txPowerW, Ptr<const WifiPpdu> 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<const WifiPpdu> 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<const WifiPpdu> ppdu)
|
||||
HePhy::StartTx (Ptr<const WifiPpdu> ppdu, const WifiTxVector& txVector)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << ppdu);
|
||||
if (ppdu->GetType () == WIFI_PPDU_TYPE_UL_MU ||
|
||||
@@ -1306,20 +1305,20 @@ HePhy::StartTx (Ptr<const WifiPpdu> 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<HePpdu> (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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ public:
|
||||
void CancelAllEvents (void) override;
|
||||
uint16_t GetStaId (const Ptr<const WifiPpdu> ppdu) const override;
|
||||
uint16_t GetMeasurementChannelWidth (const Ptr<const WifiPpdu> ppdu) const override;
|
||||
void StartTx (Ptr<const WifiPpdu> ppdu) override;
|
||||
void StartTx (Ptr<const WifiPpdu> ppdu, const WifiTxVector& txVector) override;
|
||||
Time CalculateTxDuration (WifiConstPsduMap psduMap, const WifiTxVector& txVector, WifiPhyBand band) const override;
|
||||
void SwitchMaybeToCcaBusy (const Ptr<const WifiPpdu> ppdu) override;
|
||||
double GetCcaThreshold (const Ptr<const WifiPpdu> ppdu, WifiChannelListType channelType) const override;
|
||||
@@ -414,7 +414,7 @@ protected:
|
||||
void DoResetReceive (Ptr<Event> event) override;
|
||||
void DoAbortCurrentReception (WifiPhyRxfailureReason reason) override;
|
||||
uint64_t ObtainNextUid (const WifiTxVector& txVector) override;
|
||||
Ptr<SpectrumValue> GetTxPowerSpectralDensity (double txPowerW, Ptr<const WifiPpdu> ppdu) const override;
|
||||
Ptr<SpectrumValue> GetTxPowerSpectralDensity (double txPowerW, Ptr<const WifiPpdu> ppdu, const WifiTxVector& txVector) const override;
|
||||
uint32_t GetMaxPsduSize (void) const override;
|
||||
WifiConstPsduMap GetWifiConstPsduMap (Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector) const override;
|
||||
|
||||
|
||||
@@ -434,9 +434,8 @@ HtPhy::IsConfigSupported (Ptr<const WifiPpdu> ppdu) const
|
||||
}
|
||||
|
||||
Ptr<SpectrumValue>
|
||||
HtPhy::GetTxPowerSpectralDensity (double txPowerW, Ptr<const WifiPpdu> ppdu) const
|
||||
HtPhy::GetTxPowerSpectralDensity (double txPowerW, Ptr<const WifiPpdu> /* 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);
|
||||
|
||||
@@ -449,7 +449,7 @@ protected:
|
||||
PhyFieldRxStatus DoEndReceiveField (WifiPpduField field, Ptr<Event> event) override;
|
||||
bool IsAllConfigSupported (WifiPpduField field, Ptr<const WifiPpdu> ppdu) const override;
|
||||
bool IsConfigSupported (Ptr<const WifiPpdu> ppdu) const override;
|
||||
Ptr<SpectrumValue> GetTxPowerSpectralDensity (double txPowerW, Ptr<const WifiPpdu> ppdu) const override;
|
||||
Ptr<SpectrumValue> GetTxPowerSpectralDensity (double txPowerW, Ptr<const WifiPpdu> ppdu, const WifiTxVector& txVector) const override;
|
||||
uint32_t GetMaxPsduSize (void) const override;
|
||||
CcaIndication GetCcaIndication (const Ptr<const WifiPpdu> ppdu) override;
|
||||
|
||||
|
||||
@@ -245,9 +245,8 @@ DsssPhy::GetMeasurementChannelWidth (const Ptr<const WifiPpdu> ppdu) const
|
||||
}
|
||||
|
||||
Ptr<SpectrumValue>
|
||||
DsssPhy::GetTxPowerSpectralDensity (double txPowerW, Ptr<const WifiPpdu> ppdu) const
|
||||
DsssPhy::GetTxPowerSpectralDensity (double txPowerW, Ptr<const WifiPpdu> /* 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);
|
||||
|
||||
@@ -151,7 +151,7 @@ public:
|
||||
|
||||
private:
|
||||
PhyFieldRxStatus DoEndReceiveField (WifiPpduField field, Ptr<Event> event) override;
|
||||
Ptr<SpectrumValue> GetTxPowerSpectralDensity (double txPowerW, Ptr<const WifiPpdu> ppdu) const override;
|
||||
Ptr<SpectrumValue> GetTxPowerSpectralDensity (double txPowerW, Ptr<const WifiPpdu> ppdu, const WifiTxVector& txVector) const override;
|
||||
uint16_t GetRxChannelWidth (const WifiTxVector& txVector) const override;
|
||||
uint16_t GetMeasurementChannelWidth (const Ptr<const WifiPpdu> ppdu) const override;
|
||||
|
||||
|
||||
@@ -338,9 +338,8 @@ OfdmPhy::IsAllConfigSupported (WifiPpduField /* field */, Ptr<const WifiPpdu> pp
|
||||
}
|
||||
|
||||
Ptr<SpectrumValue>
|
||||
OfdmPhy::GetTxPowerSpectralDensity (double txPowerW, Ptr<const WifiPpdu> ppdu) const
|
||||
OfdmPhy::GetTxPowerSpectralDensity (double txPowerW, Ptr<const WifiPpdu> /* 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);
|
||||
|
||||
@@ -315,7 +315,7 @@ public:
|
||||
|
||||
protected:
|
||||
PhyFieldRxStatus DoEndReceiveField (WifiPpduField field, Ptr<Event> event) override;
|
||||
Ptr<SpectrumValue> GetTxPowerSpectralDensity (double txPowerW, Ptr<const WifiPpdu> ppdu) const override;
|
||||
Ptr<SpectrumValue> GetTxPowerSpectralDensity (double txPowerW, Ptr<const WifiPpdu> ppdu, const WifiTxVector& txVector) const override;
|
||||
uint32_t GetMaxPsduSize (void) const override;
|
||||
uint16_t GetMeasurementChannelWidth (const Ptr<const WifiPpdu> ppdu) const override;
|
||||
|
||||
|
||||
@@ -1132,24 +1132,24 @@ PhyEntity::NotifyPayloadBegin (const WifiTxVector& txVector, const Time& payload
|
||||
}
|
||||
|
||||
void
|
||||
PhyEntity::StartTx (Ptr<const WifiPpdu> ppdu)
|
||||
PhyEntity::StartTx (Ptr<const WifiPpdu> 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<const WifiPpdu> ppdu, std::string type)
|
||||
PhyEntity::Transmit (Time txDuration, Ptr<const WifiPpdu> 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<SpectrumValue> txPowerSpectrum = GetTxPowerSpectralDensity (txPowerWatts, ppdu);
|
||||
Ptr<SpectrumValue> txPowerSpectrum = GetTxPowerSpectralDensity (txPowerWatts, ppdu, txVector);
|
||||
Ptr<WifiSpectrumSignalParameters> txParams = Create<WifiSpectrumSignalParameters> ();
|
||||
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<SpectrumWifiPhy> (m_wifiPhy);
|
||||
|
||||
@@ -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<const WifiPpdu> ppdu);
|
||||
virtual void StartTx (Ptr<const WifiPpdu> 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<const WifiPpdu> ppdu, std::string type);
|
||||
void Transmit (Time txDuration, Ptr<const WifiPpdu> 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<SpectrumValue> GetTxPowerSpectralDensity (double txPowerW, Ptr<const WifiPpdu> ppdu) const = 0;
|
||||
virtual Ptr<SpectrumValue> GetTxPowerSpectralDensity (double txPowerW, Ptr<const WifiPpdu> ppdu, const WifiTxVector& txVector) const = 0;
|
||||
|
||||
/**
|
||||
* Get the center frequency of the channel corresponding the current TxVector rather than
|
||||
|
||||
@@ -402,10 +402,10 @@ SpectrumWifiPhy::CreateWifiSpectrumPhyInterface (Ptr<NetDevice> device)
|
||||
}
|
||||
|
||||
void
|
||||
SpectrumWifiPhy::StartTx (Ptr<const WifiPpdu> ppdu)
|
||||
SpectrumWifiPhy::StartTx (Ptr<const WifiPpdu> ppdu, const WifiTxVector& txVector)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << ppdu);
|
||||
GetPhyEntity (ppdu->GetModulation ())->StartTx (ppdu);
|
||||
GetPhyEntity (ppdu->GetModulation ())->StartTx (ppdu, txVector);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
virtual ~SpectrumWifiPhy ();
|
||||
|
||||
// Implementation of pure virtual method.
|
||||
void StartTx (Ptr<const WifiPpdu> ppdu) override;
|
||||
void StartTx (Ptr<const WifiPpdu> ppdu, const WifiTxVector& txVector) override;
|
||||
Ptr<Channel> GetChannel (void) const override;
|
||||
uint16_t GetGuardBandwidth (uint16_t currentChannelWidth) const override;
|
||||
std::tuple<double, double, double> GetTxMaskRejectionParams (void) const override;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<const WifiPpdu> ppdu) = 0;
|
||||
virtual void StartTx (Ptr<const WifiPpdu> ppdu, const WifiTxVector& txVector) = 0;
|
||||
|
||||
/**
|
||||
* Put in sleep mode.
|
||||
|
||||
@@ -86,10 +86,10 @@ YansWifiPhy::SetChannel (const Ptr<YansWifiChannel> channel)
|
||||
}
|
||||
|
||||
void
|
||||
YansWifiPhy::StartTx (Ptr<const WifiPpdu> ppdu)
|
||||
YansWifiPhy::StartTx (Ptr<const WifiPpdu> 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 ());
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
virtual ~YansWifiPhy ();
|
||||
|
||||
void SetInterferenceHelper (const Ptr<InterferenceHelper> helper) override;
|
||||
void StartTx (Ptr<const WifiPpdu> ppdu) override;
|
||||
void StartTx (Ptr<const WifiPpdu> ppdu, const WifiTxVector& txVector) override;
|
||||
Ptr<Channel> GetChannel (void) const override;
|
||||
uint16_t GetGuardBandwidth (uint16_t currentChannelWidth) const override;
|
||||
std::tuple<double, double, double> GetTxMaskRejectionParams (void) const override;
|
||||
|
||||
@@ -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<const WifiPpdu> ppdu) override;
|
||||
void StartTx (Ptr<const WifiPpdu> ppdu, const WifiTxVector& txVector) override;
|
||||
|
||||
/**
|
||||
* Set the global PPDU UID counter.
|
||||
@@ -258,10 +259,10 @@ OfdmaSpectrumWifiPhy::SetTriggerFrameUid (uint64_t uid)
|
||||
}
|
||||
|
||||
void
|
||||
OfdmaSpectrumWifiPhy::StartTx (Ptr<const WifiPpdu> ppdu)
|
||||
OfdmaSpectrumWifiPhy::StartTx (Ptr<const WifiPpdu> ppdu, const WifiTxVector& txVector)
|
||||
{
|
||||
m_phyTxPpduUidTrace (ppdu->GetUid ());
|
||||
SpectrumWifiPhy::StartTx (ppdu);
|
||||
SpectrumWifiPhy::StartTx (ppdu, txVector);
|
||||
}
|
||||
|
||||
std::map <std::pair<uint64_t, WifiPreamble>, Ptr<Event> > &
|
||||
|
||||
Reference in New Issue
Block a user