wifi: Pass information about the spectrum PHY interface to SpectrumWifiPhy::StartRx

This commit is contained in:
Sébastien Deronne
2023-01-24 22:40:06 +01:00
committed by Sebastien Deronne
parent 30ec962813
commit dec1f2ca24
7 changed files with 29 additions and 18 deletions

View File

@@ -303,9 +303,14 @@ SpectrumWifiPhy::CanStartRx(Ptr<const WifiPpdu> ppdu, uint16_t txWidth) const
}
void
SpectrumWifiPhy::StartRx(Ptr<SpectrumSignalParameters> rxParams)
SpectrumWifiPhy::StartRx(Ptr<SpectrumSignalParameters> rxParams,
Ptr<const WifiSpectrumPhyInterface> interface)
{
NS_LOG_FUNCTION(this << rxParams);
NS_ASSERT(!interface ||
interface == m_currentSpectrumPhyInterface); // TODO: Add support for receiving from
// multiple RF interfaces
const auto range = GetCurrentFrequencyRange();
NS_LOG_FUNCTION(this << rxParams << interface << range);
Time rxDuration = rxParams->duration;
Ptr<SpectrumValue> receivedSignalPsd = rxParams->psd;
NS_LOG_DEBUG("Received signal with PSD " << *receivedSignalPsd << " and duration "
@@ -407,14 +412,14 @@ SpectrumWifiPhy::StartRx(Ptr<SpectrumSignalParameters> rxParams)
if (!wifiRxParams)
{
NS_LOG_INFO("Received non Wi-Fi signal");
m_interference->AddForeignSignal(rxDuration, rxPowerW, GetCurrentFrequencyRange());
m_interference->AddForeignSignal(rxDuration, rxPowerW, range);
SwitchMaybeToCcaBusy(nullptr);
return;
}
if (wifiRxParams && m_disableWifiReception)
{
NS_LOG_INFO("Received Wi-Fi signal but blocked from syncing");
m_interference->AddForeignSignal(rxDuration, rxPowerW, GetCurrentFrequencyRange());
m_interference->AddForeignSignal(rxDuration, rxPowerW, range);
SwitchMaybeToCcaBusy(nullptr);
return;
}
@@ -427,7 +432,7 @@ SpectrumWifiPhy::StartRx(Ptr<SpectrumSignalParameters> rxParams)
if (totalRxPowerW < DbmToW(GetRxSensitivity()) * (txWidth / 20.0))
{
NS_LOG_INFO("Received signal too weak to process: " << WToDbm(totalRxPowerW) << " dBm");
m_interference->Add(ppdu, txVector, rxDuration, rxPowerW, GetCurrentFrequencyRange());
m_interference->Add(ppdu, txVector, rxDuration, rxPowerW, range);
SwitchMaybeToCcaBusy(nullptr);
return;
}
@@ -437,7 +442,7 @@ SpectrumWifiPhy::StartRx(Ptr<SpectrumSignalParameters> rxParams)
if (!CanStartRx(ppdu, txWidth))
{
NS_LOG_INFO("Cannot start reception of the PPDU, consider it as interference");
m_interference->Add(ppdu, txVector, rxDuration, rxPowerW, GetCurrentFrequencyRange());
m_interference->Add(ppdu, txVector, rxDuration, rxPowerW, range);
SwitchMaybeToCcaBusy(ppdu);
return;
}

View File

@@ -91,8 +91,10 @@ class SpectrumWifiPhy : public WifiPhy
* and low-level PHY interface to this SpectrumWifiPhy instance.
*
* \param rxParams Input signal parameters
* \param interface the Spectrum PHY interface for which the signal has been detected
*/
void StartRx(Ptr<SpectrumSignalParameters> rxParams);
void StartRx(Ptr<SpectrumSignalParameters> rxParams,
Ptr<const WifiSpectrumPhyInterface> interface);
/**
* \param antenna an AntennaModel to include in the transmitted

View File

@@ -150,7 +150,7 @@ WifiSpectrumPhyInterface::GetChannelWidth() const
void
WifiSpectrumPhyInterface::StartRx(Ptr<SpectrumSignalParameters> params)
{
m_spectrumWifiPhy->StartRx(params);
m_spectrumWifiPhy->StartRx(params, this);
}
void

View File

@@ -15,6 +15,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "ns3/boolean.h"
#include "ns3/constant-position-mobility-model.h"
#include "ns3/he-phy.h" //includes OFDM PHY
#include "ns3/interference-helper.h"
@@ -190,7 +191,7 @@ SpectrumWifiPhyBasicTest::MakeSignal(double txPowerWatts, const WifiPhyOperating
void
SpectrumWifiPhyBasicTest::SendSignal(double txPowerWatts)
{
m_phy->StartRx(MakeSignal(txPowerWatts, m_phy->GetOperatingChannel()));
m_phy->StartRx(MakeSignal(txPowerWatts, m_phy->GetOperatingChannel()), nullptr);
}
void
@@ -1002,6 +1003,7 @@ SpectrumWifiPhyMultipleInterfacesTest::DoSetup()
auto txNode = CreateObject<Node>();
auto txDev = CreateObject<WifiNetDevice>();
auto txPhy = CreateObject<ExtSpectrumWifiPhy>();
txPhy->SetAttribute("ChannelSwitchDelay", TimeValue(Seconds(0)));
auto txInterferenceHelper = CreateObject<InterferenceHelper>();
txPhy->SetInterferenceHelper(txInterferenceHelper);
auto txError = CreateObject<NistErrorRateModel>();
@@ -1018,13 +1020,13 @@ SpectrumWifiPhyMultipleInterfacesTest::DoSetup()
txPhy->ConfigureStandard(WIFI_STANDARD_80211ax);
txDev->SetPhy(txPhy);
txNode->AddDevice(txDev);
txPhy->SetAttribute("ChannelSwitchDelay", TimeValue(Seconds(0)));
m_txPhys.push_back(txPhy);
auto rxNode = CreateObject<Node>();
auto rxDev = CreateObject<WifiNetDevice>();
auto rxPhy = CreateObject<ExtSpectrumWifiPhy>();
rxPhy->SetAttribute("ChannelSwitchDelay", TimeValue(Seconds(0)));
auto rxInterferenceHelper = CreateObject<InterferenceHelper>();
rxPhy->SetInterferenceHelper(rxInterferenceHelper);
auto rxError = CreateObject<NistErrorRateModel>();
@@ -1041,7 +1043,6 @@ SpectrumWifiPhyMultipleInterfacesTest::DoSetup()
rxPhy->ConfigureStandard(WIFI_STANDARD_80211ax);
rxDev->SetPhy(rxPhy);
rxNode->AddDevice(rxDev);
rxPhy->SetAttribute("ChannelSwitchDelay", TimeValue(Seconds(0)));
const auto index = m_rxPhys.size();
rxPhy->SetReceiveOkCallback(

View File

@@ -46,6 +46,7 @@
#include "ns3/wifi-net-device.h"
#include "ns3/wifi-phy-listener.h"
#include "ns3/wifi-psdu.h"
#include "ns3/wifi-spectrum-phy-interface.h"
#include "ns3/wifi-spectrum-signal-parameters.h"
#include "ns3/wifi-spectrum-value-helper.h"
#include "ns3/wifi-utils.h"
@@ -2454,7 +2455,7 @@ TestMultipleHeTbPreambles::RxHeTbPpdu(uint64_t uid,
auto hePhy = DynamicCast<HePhy>(m_phy->GetLatestPhyEntity());
hePhy->SetTrigVector(m_trigVector, ppduDuration);
ppdu->ResetTxVector();
m_phy->StartRx(rxParams);
m_phy->StartRx(rxParams, nullptr);
// Schedule OFDMA part
Ptr<HePpdu> ppduOfdma = DynamicCast<HePpdu>(ppdu->Copy()); // since flag will be modified
@@ -2490,7 +2491,7 @@ TestMultipleHeTbPreambles::DoRxHeTbPpduOfdmaPart(Ptr<WifiSpectrumSignalParameter
// This is needed to make sure the OFDMA part is started as the last event since HE-SIG-A should
// end at the exact same time as the start For normal WifiNetDevices, this the reception of the
// OFDMA part is scheduled after end of HE-SIG-A decoding.
m_phy->StartRx(rxParamsOfdma);
m_phy->StartRx(rxParamsOfdma, nullptr);
}
void

View File

@@ -45,6 +45,7 @@
#include "ns3/wifi-mpdu.h"
#include "ns3/wifi-net-device.h"
#include "ns3/wifi-psdu.h"
#include "ns3/wifi-spectrum-phy-interface.h"
#include "ns3/wifi-spectrum-signal-parameters.h"
#include "ns3/wifi-spectrum-value-helper.h"
#include "ns3/wifi-utils.h"
@@ -144,7 +145,7 @@ WifiPhyReceptionTest::SendPacket(double rxPowerDbm, uint32_t packetSize, uint8_t
txParams->ppdu = ppdu;
txParams->txWidth = CHANNEL_WIDTH;
m_phy->StartRx(txParams);
m_phy->StartRx(txParams, nullptr);
}
void
@@ -2804,7 +2805,7 @@ TestAmpduReception::SendAmpduWithThreeMpdus(double rxPowerDbm, uint32_t referenc
txParams->ppdu = ppdu;
txParams->txWidth = CHANNEL_WIDTH;
m_phy->StartRx(txParams);
m_phy->StartRx(txParams, nullptr);
}
void
@@ -4327,7 +4328,7 @@ TestUnsupportedBandwidthReception::SendPpdu(uint16_t centerFreqMhz, uint16_t ban
txParams->ppdu = ppdu;
txParams->txWidth = bandwidthMhz;
m_rxPhy->StartRx(txParams);
m_rxPhy->StartRx(txParams, nullptr);
}
void

View File

@@ -30,6 +30,7 @@
#include "ns3/wifi-mac-header.h"
#include "ns3/wifi-net-device.h"
#include "ns3/wifi-psdu.h"
#include "ns3/wifi-spectrum-phy-interface.h"
#include "ns3/wifi-spectrum-signal-parameters.h"
#include "ns3/wifi-spectrum-value-helper.h"
#include "ns3/wifi-utils.h"
@@ -202,11 +203,11 @@ WifiPhyThresholdsTest::SendSignal(double txPowerWatts, bool wifiSignal)
{
if (wifiSignal)
{
m_phy->StartRx(MakeWifiSignal(txPowerWatts, m_phy->GetOperatingChannel()));
m_phy->StartRx(MakeWifiSignal(txPowerWatts, m_phy->GetOperatingChannel()), nullptr);
}
else
{
m_phy->StartRx(MakeForeignSignal(txPowerWatts));
m_phy->StartRx(MakeForeignSignal(txPowerWatts), nullptr);
}
}