wifi: Store transmission width in WifiPpdu

This commit is contained in:
Sébastien Deronne
2023-07-26 20:35:14 +02:00
committed by Sébastien Deronne
parent d46f8857d7
commit 3034748f9a
6 changed files with 23 additions and 16 deletions

View File

@@ -413,10 +413,10 @@ HePpdu::GetStaId() const
}
uint16_t
HePpdu::GetTransmissionChannelWidth() const
HePpdu::GetTxChannelWidth() const
{
const auto& txVector = GetTxVector();
if (txVector.IsUlMu() && GetStaId() != SU_STA_ID)
if (const auto& txVector = GetTxVector();
txVector.IsValid() && txVector.IsUlMu() && GetStaId() != SU_STA_ID)
{
TxPsdFlag flag = GetTxPsdFlag();
uint16_t ruWidth = HeRu::GetBandwidth(txVector.GetRu(GetStaId()).GetRuType());
@@ -427,7 +427,7 @@ HePpdu::GetTransmissionChannelWidth() const
}
else
{
return OfdmPpdu::GetTransmissionChannelWidth();
return OfdmPpdu::GetTxChannelWidth();
}
}

View File

@@ -154,7 +154,7 @@ class HePpdu : public OfdmPpdu
Ptr<WifiPpdu> Copy() const override;
WifiPpduType GetType() const override;
uint16_t GetStaId() const override;
uint16_t GetTransmissionChannelWidth() const override;
uint16_t GetTxChannelWidth() const override;
/**
* Get the payload of the PPDU.

View File

@@ -2185,7 +2185,7 @@ WifiPhy::GetTxPowerForTransmission(Ptr<const WifiPpdu> ppdu) const
}
// Apply power density constraint on EIRP
uint16_t channelWidth = ppdu->GetTransmissionChannelWidth();
uint16_t channelWidth = ppdu->GetTxChannelWidth();
double txPowerDbmPerMhz =
(txPowerDbm + GetTxGain()) - RatioToDb(channelWidth); // account for antenna gain since EIRP
NS_LOG_INFO("txPowerDbm=" << txPowerDbm << " with txPowerDbmPerMhz=" << txPowerDbmPerMhz

View File

@@ -43,7 +43,8 @@ WifiPpdu::WifiPpdu(Ptr<const WifiPsdu> psdu,
m_operatingChannel(channel),
m_truncatedTx(false),
m_txPowerLevel(txVector.GetTxPowerLevel()),
m_txAntennas(txVector.GetNTx())
m_txAntennas(txVector.GetNTx()),
m_txChannelWidth(txVector.GetChannelWidth())
{
NS_LOG_FUNCTION(this << *psdu << txVector << channel << uid);
m_psdus.insert(std::make_pair(SU_STA_ID, psdu));
@@ -64,7 +65,8 @@ WifiPpdu::WifiPpdu(const WifiConstPsduMap& psdus,
m_operatingChannel(channel),
m_truncatedTx(false),
m_txPowerLevel(txVector.GetTxPowerLevel()),
m_txAntennas(txVector.GetNTx())
m_txAntennas(txVector.GetNTx()),
m_txChannelWidth(txVector.GetChannelWidth())
{
NS_LOG_FUNCTION(this << psdus << txVector << channel << uid);
m_psdus = psdus;
@@ -140,9 +142,9 @@ WifiPpdu::GetModulation() const
}
uint16_t
WifiPpdu::GetTransmissionChannelWidth() const
WifiPpdu::GetTxChannelWidth() const
{
return GetTxVector().GetChannelWidth();
return m_txChannelWidth;
}
uint16_t
@@ -155,9 +157,8 @@ bool
WifiPpdu::DoesOverlapChannel(uint16_t minFreq, uint16_t maxFreq) const
{
NS_LOG_FUNCTION(this << m_txCenterFreq << minFreq << maxFreq);
uint16_t txChannelWidth = GetTxVector().GetChannelWidth();
uint16_t minTxFreq = m_txCenterFreq - txChannelWidth / 2;
uint16_t maxTxFreq = m_txCenterFreq + txChannelWidth / 2;
uint16_t minTxFreq = m_txCenterFreq - m_txChannelWidth / 2;
uint16_t maxTxFreq = m_txCenterFreq + m_txChannelWidth / 2;
/**
* The PPDU does not overlap the channel in two cases.
*

View File

@@ -134,7 +134,7 @@ class WifiPpdu : public SimpleRefCount<WifiPpdu>
*
* \return the effective channel width (in MHz) used for the tranmsission
*/
virtual uint16_t GetTransmissionChannelWidth() const;
virtual uint16_t GetTxChannelWidth() const;
/**
* \return the center frequency (MHz) used for the transmission of this PPDU
@@ -222,7 +222,13 @@ class WifiPpdu : public SimpleRefCount<WifiPpdu>
uint8_t m_txPowerLevel; //!< the transmission power level (used only for TX and initializing the
//!< returned WifiTxVector)
uint8_t m_txAntennas; //!< the number of antennas used to transmit this PPDU
}; // class WifiPpdu
uint16_t m_txChannelWidth; /**< The channel width (MHz) used for the transmission of this
PPDU. This has to be stored since channel width can not
always be obtained from the PHY headers, especially for
non-HT PPDU, since we do not sense the spectrum to
determine the occupied channel width for simplicity. */
}; // class WifiPpdu
/**
* \brief Stream insertion operator.

View File

@@ -137,7 +137,7 @@ YansWifiChannel::Receive(Ptr<YansWifiPhy> phy, Ptr<const WifiPpdu> ppdu, double
// Do no further processing if signal is too weak
// Current implementation assumes constant RX power over the PPDU duration
// Compare received TX power per MHz to normalized RX sensitivity
uint16_t txWidth = ppdu->GetTransmissionChannelWidth();
uint16_t txWidth = ppdu->GetTxChannelWidth();
if ((rxPowerDbm + phy->GetRxGain()) < phy->GetRxSensitivity() + RatioToDb(txWidth / 20.0))
{
NS_LOG_INFO("Received signal too weak to process: " << rxPowerDbm << " dBm");