wifi: Add TX center frequency to WifiSpectrumSignalParameters

In this way, SpectrumWifiPhy::StartRx() does not have to obtain
the transmitting PHY just to retrieve the TX center frequency. Also,
the current approach does not work with multi-link devices because the
receiver should be able to know which PHY was used on the transmitter
side to send the frame.
This commit is contained in:
Stefano Avallone
2022-01-27 18:16:33 +01:00
parent 1ada1e8db1
commit 424fbd53fe
4 changed files with 5 additions and 8 deletions

View File

@@ -1061,6 +1061,7 @@ PhyEntity::Transmit (Time txDuration, Ptr<WifiPpdu> ppdu, std::string type)
txParams->duration = txDuration;
txParams->psd = txPowerSpectrum;
txParams->ppdu = ppdu;
txParams->txCenterFreq = GetCenterFrequencyForChannelWidth (ppdu->GetTxVector ());
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);

View File

@@ -356,13 +356,6 @@ SpectrumWifiPhy::StartRx (Ptr<SpectrumSignalParameters> rxParams)
// does not overlap with the receiver's primary20 channel
if (wifiRxParams->txPhy != 0)
{
Ptr<WifiNetDevice> dev = DynamicCast<WifiNetDevice> (rxParams->txPhy->GetDevice ());
NS_ASSERT (dev != 0);
Ptr<WifiPhy> txPhy = dev->GetPhy ();
NS_ASSERT (txPhy != 0);
uint16_t txChannelWidth = wifiRxParams->ppdu->GetTxVector ().GetChannelWidth ();
uint16_t txCenterFreq = txPhy->GetOperatingChannel ().GetPrimaryChannelCenterFrequency (txChannelWidth);
// if the channel width is a multiple of 20 MHz, then we consider the primary20 channel
uint16_t width = (GetChannelWidth () % 20 == 0 ? 20 : GetChannelWidth ());
uint16_t p20MinFreq =
@@ -370,7 +363,7 @@ SpectrumWifiPhy::StartRx (Ptr<SpectrumSignalParameters> rxParams)
uint16_t p20MaxFreq =
GetOperatingChannel ().GetPrimaryChannelCenterFrequency (width) + width / 2;
if (!wifiRxParams->ppdu->CanBeReceived (txCenterFreq, p20MinFreq, p20MaxFreq))
if (!wifiRxParams->ppdu->CanBeReceived (wifiRxParams->txCenterFreq, p20MinFreq, p20MaxFreq))
{
NS_LOG_INFO ("Cannot receive the PPDU, consider it as interference");
m_interference.Add (wifiRxParams->ppdu, wifiRxParams->ppdu->GetTxVector (),

View File

@@ -28,6 +28,7 @@ namespace ns3 {
NS_LOG_COMPONENT_DEFINE ("WifiSpectrumSignalParameters");
WifiSpectrumSignalParameters::WifiSpectrumSignalParameters ()
: txCenterFreq (0)
{
NS_LOG_FUNCTION (this);
}
@@ -37,6 +38,7 @@ WifiSpectrumSignalParameters::WifiSpectrumSignalParameters (const WifiSpectrumSi
{
NS_LOG_FUNCTION (this << &p);
ppdu = p.ppdu;
txCenterFreq = p.txCenterFreq;
}
Ptr<SpectrumSignalParameters>

View File

@@ -51,6 +51,7 @@ struct WifiSpectrumSignalParameters : public SpectrumSignalParameters
WifiSpectrumSignalParameters (const WifiSpectrumSignalParameters& p);
Ptr<WifiPpdu> ppdu; ///< The PPDU being transmitted
uint16_t txCenterFreq; ///< the center frequency of the transmitted signal in MHz
};
} // namespace ns3