diff --git a/src/wifi/examples/wifi-test-interference-helper.cc b/src/wifi/examples/wifi-test-interference-helper.cc index 5fc40cbf1..309ae085b 100644 --- a/src/wifi/examples/wifi-test-interference-helper.cc +++ b/src/wifi/examples/wifi-test-interference-helper.cc @@ -60,6 +60,7 @@ #include "ns3/spectrum-wifi-phy.h" #include "ns3/propagation-loss-model.h" #include "ns3/propagation-delay-model.h" +#include "ns3/interference-helper.h" #include "ns3/nist-error-rate-model.h" #include "ns3/constant-position-mobility-model.h" #include "ns3/simple-frame-capture-model.h" @@ -252,10 +253,18 @@ InterferenceExperiment::Run (struct InterferenceExperiment::Input input) rx->CreateWifiSpectrumPhyInterface (devRx); rx->SetDevice (devRx); - Ptr error = CreateObject (); - m_txA->SetErrorRateModel (error); - m_txB->SetErrorRateModel (error); - rx->SetErrorRateModel (error); + Ptr interferenceTxA = CreateObject (); + m_txA->SetInterferenceHelper (interferenceTxA); + Ptr errorTxA = CreateObject (); + m_txA->SetErrorRateModel (errorTxA); + Ptr interferenceTxB = CreateObject (); + m_txB->SetInterferenceHelper (interferenceTxB); + Ptr errorTxB = CreateObject (); + m_txB->SetErrorRateModel (errorTxB); + Ptr interferenceRx = CreateObject (); + rx->SetInterferenceHelper (interferenceRx); + Ptr errorRx = CreateObject (); + rx->SetErrorRateModel (errorRx); m_txA->SetChannel (channel); m_txB->SetChannel (channel); rx->SetChannel (channel); diff --git a/src/wifi/helper/spectrum-wifi-helper.cc b/src/wifi/helper/spectrum-wifi-helper.cc index c881331e9..eeea8d0ee 100644 --- a/src/wifi/helper/spectrum-wifi-helper.cc +++ b/src/wifi/helper/spectrum-wifi-helper.cc @@ -22,6 +22,7 @@ #include "ns3/log.h" #include "ns3/names.h" #include "ns3/spectrum-wifi-phy.h" +#include "ns3/interference-helper.h" #include "ns3/error-rate-model.h" #include "ns3/frame-capture-model.h" #include "ns3/preamble-detection-model.h" @@ -37,6 +38,7 @@ SpectrumWifiPhyHelper::SpectrumWifiPhyHelper () : m_channel (0) { m_phy.SetTypeId ("ns3::SpectrumWifiPhy"); + SetInterferenceHelper ("ns3::InterferenceHelper"); SetErrorRateModel ("ns3::TableBasedErrorRateModel"); } @@ -58,6 +60,8 @@ SpectrumWifiPhyHelper::Create (Ptr node, Ptr device) const { Ptr phy = m_phy.Create (); phy->CreateWifiSpectrumPhyInterface (device); + Ptr interference = m_interferenceHelper.Create (); + phy->SetInterferenceHelper (interference); Ptr error = m_errorRateModel.Create (); phy->SetErrorRateModel (error); if (m_frameCaptureModel.IsTypeIdSet ()) diff --git a/src/wifi/helper/wifi-helper.h b/src/wifi/helper/wifi-helper.h index 9fb36c31e..953caf84f 100644 --- a/src/wifi/helper/wifi-helper.h +++ b/src/wifi/helper/wifi-helper.h @@ -69,6 +69,16 @@ public: */ void Set (std::string name, const AttributeValue &v); + /** + * Helper function used to set the interference helper. + * + * \tparam Args \deduced Template type parameter pack for the sequence of name-value pairs. + * \param type the type of interference helper + * \param args A sequence of name-value pairs of the attributes to set. + */ + template + void SetInterferenceHelper (std::string type, Args&&... args); + /** * Helper function used to set the error rate model. * @@ -174,6 +184,7 @@ protected: uint16_t staId = SU_STA_ID); ObjectFactory m_phy; ///< PHY object + ObjectFactory m_interferenceHelper; ///< interference helper ObjectFactory m_errorRateModel; ///< error rate model ObjectFactory m_frameCaptureModel; ///< frame capture model ObjectFactory m_preambleDetectionModel; ///< preamble detection model @@ -416,6 +427,14 @@ protected: namespace ns3 { +template +void +WifiPhyHelper::SetInterferenceHelper (std::string type, Args&&... args) +{ + m_interferenceHelper.SetTypeId (type); + m_interferenceHelper.Set (args...); +} + template void WifiPhyHelper::SetErrorRateModel (std::string type, Args&&... args) diff --git a/src/wifi/helper/yans-wifi-helper.cc b/src/wifi/helper/yans-wifi-helper.cc index 7621df218..79919ee3d 100644 --- a/src/wifi/helper/yans-wifi-helper.cc +++ b/src/wifi/helper/yans-wifi-helper.cc @@ -23,6 +23,7 @@ #include "ns3/names.h" #include "ns3/propagation-loss-model.h" #include "ns3/propagation-delay-model.h" +#include "ns3/interference-helper.h" #include "ns3/error-rate-model.h" #include "ns3/frame-capture-model.h" #include "ns3/preamble-detection-model.h" @@ -128,6 +129,7 @@ YansWifiPhyHelper::YansWifiPhyHelper () : m_channel (0) { m_phy.SetTypeId ("ns3::YansWifiPhy"); + SetInterferenceHelper ("ns3::InterferenceHelper"); SetErrorRateModel ("ns3::TableBasedErrorRateModel"); } @@ -148,6 +150,8 @@ Ptr YansWifiPhyHelper::Create (Ptr node, Ptr device) const { Ptr phy = m_phy.Create (); + Ptr interference = m_interferenceHelper.Create (); + phy->SetInterferenceHelper (interference); Ptr error = m_errorRateModel.Create (); phy->SetErrorRateModel (error); if (m_frameCaptureModel.IsTypeIdSet ()) diff --git a/src/wifi/model/wifi-phy.cc b/src/wifi/model/wifi-phy.cc index 0238c950c..6ca067610 100644 --- a/src/wifi/model/wifi-phy.cc +++ b/src/wifi/model/wifi-phy.cc @@ -326,7 +326,6 @@ WifiPhy::WifiPhy () m_timeLastPreambleDetected (Seconds (0)) { NS_LOG_FUNCTION (this); - m_interference = CreateObject (); m_random = CreateObject (); m_state = CreateObject (); } @@ -353,6 +352,11 @@ WifiPhy::DoDispose (void) m_wifiRadioEnergyModel = 0; m_postReceptionErrorModel = 0; m_supportedChannelWidthSet.clear (); + if (m_interference != nullptr) + { + m_interference->Dispose (); + } + m_interference = 0; m_random = 0; m_state = 0; m_currentEvent = 0; @@ -442,8 +446,11 @@ void WifiPhy::SetRxNoiseFigure (double noiseFigureDb) { NS_LOG_FUNCTION (this << noiseFigureDb); - m_interference->SetNoiseFigure (DbToRatio (noiseFigureDb)); - m_interference->SetNumberOfReceiveAntennas (GetNumberOfAntennas ()); + if (m_interference) + { + m_interference->SetNoiseFigure (DbToRatio (noiseFigureDb)); + } + m_noiseFigureDb = noiseFigureDb; } void @@ -556,10 +563,18 @@ WifiPhy::GetMobility (void) const } void -WifiPhy::SetErrorRateModel (const Ptr rate) +WifiPhy::SetInterferenceHelper (const Ptr helper) { - m_interference->SetErrorRateModel (rate); - m_interference->SetNumberOfReceiveAntennas (GetNumberOfAntennas ()); + m_interference = helper; + m_interference->SetNoiseFigure (DbToRatio (m_noiseFigureDb)); + m_interference->SetNumberOfReceiveAntennas (m_numberOfAntennas); +} + +void +WifiPhy::SetErrorRateModel (const Ptr model) +{ + NS_ASSERT (m_interference != nullptr); + m_interference->SetErrorRateModel (model); } void @@ -1061,9 +1076,13 @@ WifiPhy::DoChannelSwitch (void) void WifiPhy::SetNumberOfAntennas (uint8_t antennas) { + NS_LOG_FUNCTION (this << +antennas); NS_ASSERT_MSG (antennas > 0 && antennas <= 4, "unsupported number of antennas"); m_numberOfAntennas = antennas; - m_interference->SetNumberOfReceiveAntennas (antennas); + if (m_interference) + { + m_interference->SetNumberOfReceiveAntennas (antennas); + } } uint8_t diff --git a/src/wifi/model/wifi-phy.h b/src/wifi/model/wifi-phy.h index 3a94612b9..d4f52f308 100644 --- a/src/wifi/model/wifi-phy.h +++ b/src/wifi/model/wifi-phy.h @@ -887,12 +887,19 @@ public: */ bool GetShortPhyPreambleSupported (void) const; + /** + * Sets the interference helper. + * + * \param helper the interference helper + */ + virtual void SetInterferenceHelper (const Ptr helper); + /** * Sets the error rate model. * - * \param rate the error rate model + * \param model the error rate model */ - void SetErrorRateModel (const Ptr rate); + void SetErrorRateModel (const Ptr model); /** * Attach a receive ErrorModel to the WifiPhy. * @@ -1373,6 +1380,8 @@ private: uint8_t m_txSpatialStreams; //!< Number of supported TX spatial streams uint8_t m_rxSpatialStreams; //!< Number of supported RX spatial streams + double m_noiseFigureDb; //!< The noise figure in dB + Time m_channelSwitchDelay; //!< Time required to switch between channel Ptr m_device; //!< Pointer to the device diff --git a/src/wifi/model/yans-wifi-phy.cc b/src/wifi/model/yans-wifi-phy.cc index 67f39c1da..b373ce746 100644 --- a/src/wifi/model/yans-wifi-phy.cc +++ b/src/wifi/model/yans-wifi-phy.cc @@ -45,6 +45,12 @@ YansWifiPhy::GetTypeId (void) YansWifiPhy::YansWifiPhy () { NS_LOG_FUNCTION (this); +} + +void +YansWifiPhy::SetInterferenceHelper (const Ptr helper) +{ + WifiPhy::SetInterferenceHelper (helper); //add dummy band for Yans WifiSpectrumBand band; band.first = 0; diff --git a/src/wifi/model/yans-wifi-phy.h b/src/wifi/model/yans-wifi-phy.h index 8bf7dc822..eb9182c44 100644 --- a/src/wifi/model/yans-wifi-phy.h +++ b/src/wifi/model/yans-wifi-phy.h @@ -56,7 +56,7 @@ public: YansWifiPhy (); virtual ~YansWifiPhy (); - // Implementation of pure virtual method. + void SetInterferenceHelper (const Ptr helper) override; void StartTx (Ptr ppdu) override; Ptr GetChannel (void) const override; uint16_t GetGuardBandwidth (uint16_t currentChannelWidth) const override; diff --git a/src/wifi/test/power-rate-adaptation-test.cc b/src/wifi/test/power-rate-adaptation-test.cc index 9d6877a74..59347bee3 100644 --- a/src/wifi/test/power-rate-adaptation-test.cc +++ b/src/wifi/test/power-rate-adaptation-test.cc @@ -27,6 +27,7 @@ #include "ns3/simulator.h" #include "ns3/test.h" #include "ns3/frame-exchange-manager.h" +#include "ns3/interference-helper.h" #include "ns3/wifi-default-protection-manager.h" #include "ns3/wifi-default-ack-manager.h" @@ -99,6 +100,8 @@ PowerRateAdaptationTest::ConfigureNode () * Create and configure phy layer. */ Ptr phy = CreateObject (); + Ptr interferenceHelper = CreateObject (); + phy->SetInterferenceHelper (interferenceHelper); phy->SetChannel (channel); phy->SetDevice (dev); phy->SetMobility (mobility); diff --git a/src/wifi/test/spectrum-wifi-phy-test.cc b/src/wifi/test/spectrum-wifi-phy-test.cc index e226f56eb..aad4d2bfa 100644 --- a/src/wifi/test/spectrum-wifi-phy-test.cc +++ b/src/wifi/test/spectrum-wifi-phy-test.cc @@ -22,6 +22,7 @@ #include "ns3/wifi-spectrum-value-helper.h" #include "ns3/multi-model-spectrum-channel.h" #include "ns3/spectrum-wifi-phy.h" +#include "ns3/interference-helper.h" #include "ns3/nist-error-rate-model.h" #include "ns3/wifi-mac-header.h" #include "ns3/wifi-spectrum-signal-parameters.h" @@ -177,6 +178,8 @@ SpectrumWifiPhyBasicTest::DoSetup (void) m_phy = CreateObject (); m_phy->SetOperatingChannel (WifiPhy::ChannelTuple {CHANNEL_NUMBER, 0, WIFI_PHY_BAND_5GHZ, 0}); m_phy->ConfigureStandard (WIFI_STANDARD_80211n); + Ptr interferenceHelper = CreateObject (); + m_phy->SetInterferenceHelper (interferenceHelper); Ptr error = CreateObject (); m_phy->SetErrorRateModel (error); m_phy->SetReceiveOkCallback (MakeCallback (&SpectrumWifiPhyBasicTest::SpectrumWifiPhyRxSuccess, this)); @@ -471,8 +474,10 @@ SpectrumWifiPhyFilterTest::DoSetup (void) m_txPhy = CreateObject (); m_txPhy->CreateWifiSpectrumPhyInterface (txDev); m_txPhy->ConfigureStandard (WIFI_STANDARD_80211ax); - Ptr error = CreateObject (); - m_txPhy->SetErrorRateModel (error); + Ptr txInterferenceHelper = CreateObject (); + m_txPhy->SetInterferenceHelper (txInterferenceHelper); + Ptr txErrorModel = CreateObject (); + m_txPhy->SetErrorRateModel (txErrorModel); m_txPhy->SetDevice (txDev); m_txPhy->SetChannel (spectrumChannel); Ptr apMobility = CreateObject (); @@ -486,7 +491,10 @@ SpectrumWifiPhyFilterTest::DoSetup (void) m_rxPhy = CreateObject (); m_rxPhy->CreateWifiSpectrumPhyInterface (rxDev); m_rxPhy->ConfigureStandard (WIFI_STANDARD_80211ax); - m_rxPhy->SetErrorRateModel (error); + Ptr rxInterferenceHelper = CreateObject (); + m_rxPhy->SetInterferenceHelper (rxInterferenceHelper); + Ptr rxErrorModel = CreateObject (); + m_rxPhy->SetErrorRateModel (rxErrorModel); m_rxPhy->SetChannel (spectrumChannel); Ptr sta1Mobility = CreateObject (); m_rxPhy->SetMobility (sta1Mobility); diff --git a/src/wifi/test/wifi-aggregation-test.cc b/src/wifi/test/wifi-aggregation-test.cc index 306e63c58..3d507c88d 100644 --- a/src/wifi/test/wifi-aggregation-test.cc +++ b/src/wifi/test/wifi-aggregation-test.cc @@ -25,6 +25,7 @@ #include "ns3/wifi-psdu.h" #include "ns3/sta-wifi-mac.h" #include "ns3/yans-wifi-phy.h" +#include "ns3/interference-helper.h" #include "ns3/mac-tx-middle.h" #include "ns3/ht-frame-exchange-manager.h" #include "ns3/msdu-aggregator.h" @@ -102,6 +103,8 @@ AmpduAggregationTest::DoRun (void) * Create and configure phy layer. */ m_phy = CreateObject (); + Ptr interferenceHelper = CreateObject (); + m_phy->SetInterferenceHelper (interferenceHelper); m_phy->SetDevice (m_device); m_phy->ConfigureStandard (WIFI_STANDARD_80211n); m_device->SetPhy (m_phy); @@ -351,6 +354,8 @@ TwoLevelAggregationTest::DoRun (void) * Create and configure phy layer. */ m_phy = CreateObject (); + Ptr interferenceHelper = CreateObject (); + m_phy->SetInterferenceHelper (interferenceHelper); m_phy->SetDevice (m_device); m_phy->ConfigureStandard (WIFI_STANDARD_80211n); m_device->SetPhy (m_phy); @@ -585,6 +590,8 @@ HeAggregationTest::DoRunSubTest (uint16_t bufferSize) * Create and configure phy layer. */ m_phy = CreateObject (); + Ptr interferenceHelper = CreateObject (); + m_phy->SetInterferenceHelper (interferenceHelper); m_phy->SetDevice (m_device); m_phy->ConfigureStandard (WIFI_STANDARD_80211ax); m_device->SetPhy (m_phy); diff --git a/src/wifi/test/wifi-phy-ofdma-test.cc b/src/wifi/test/wifi-phy-ofdma-test.cc index ffd078313..1efc6c128 100644 --- a/src/wifi/test/wifi-phy-ofdma-test.cc +++ b/src/wifi/test/wifi-phy-ofdma-test.cc @@ -659,8 +659,10 @@ TestDlOfdmaPhyTransmission::DoSetup (void) m_phyAp = CreateObject (); m_phyAp->CreateWifiSpectrumPhyInterface (apDev); m_phyAp->ConfigureStandard (WIFI_STANDARD_80211ax); - Ptr error = CreateObject (); - m_phyAp->SetErrorRateModel (error); + Ptr apInterferenceHelper = CreateObject (); + m_phyAp->SetInterferenceHelper (apInterferenceHelper); + Ptr apErrorModel = CreateObject (); + m_phyAp->SetErrorRateModel (apErrorModel); m_phyAp->SetDevice (apDev); m_phyAp->SetChannel (spectrumChannel); Ptr apMobility = CreateObject (); @@ -674,7 +676,10 @@ TestDlOfdmaPhyTransmission::DoSetup (void) m_phySta1 = CreateObject (1); m_phySta1->CreateWifiSpectrumPhyInterface (sta1Dev); m_phySta1->ConfigureStandard (WIFI_STANDARD_80211ax); - m_phySta1->SetErrorRateModel (error); + Ptr sta1InterferenceHelper = CreateObject (); + m_phySta1->SetInterferenceHelper (sta1InterferenceHelper); + Ptr sta1ErrorModel = CreateObject (); + m_phySta1->SetErrorRateModel (sta1ErrorModel); m_phySta1->SetDevice (sta1Dev); m_phySta1->SetChannel (spectrumChannel); m_phySta1->SetReceiveOkCallback (MakeCallback (&TestDlOfdmaPhyTransmission::RxSuccessSta1, this)); @@ -690,7 +695,10 @@ TestDlOfdmaPhyTransmission::DoSetup (void) m_phySta2 = CreateObject (2); m_phySta2->CreateWifiSpectrumPhyInterface (sta2Dev); m_phySta2->ConfigureStandard (WIFI_STANDARD_80211ax); - m_phySta2->SetErrorRateModel (error); + Ptr sta2InterferenceHelper = CreateObject (); + m_phySta2->SetInterferenceHelper (sta2InterferenceHelper); + Ptr sta2ErrorModel = CreateObject (); + m_phySta2->SetErrorRateModel (sta2ErrorModel); m_phySta2->SetDevice (sta2Dev); m_phySta2->SetChannel (spectrumChannel); m_phySta2->SetReceiveOkCallback (MakeCallback (&TestDlOfdmaPhyTransmission::RxSuccessSta2, this)); @@ -706,7 +714,10 @@ TestDlOfdmaPhyTransmission::DoSetup (void) m_phySta3 = CreateObject (3); m_phySta3->CreateWifiSpectrumPhyInterface (sta3Dev); m_phySta3->ConfigureStandard (WIFI_STANDARD_80211ax); - m_phySta3->SetErrorRateModel (error); + Ptr sta3InterferenceHelper = CreateObject (); + m_phySta3->SetInterferenceHelper (sta3InterferenceHelper); + Ptr sta3ErrorModel = CreateObject (); + m_phySta3->SetErrorRateModel (sta3ErrorModel); m_phySta3->SetDevice (sta3Dev); m_phySta3->SetChannel (spectrumChannel); m_phySta3->SetReceiveOkCallback (MakeCallback (&TestDlOfdmaPhyTransmission::RxSuccessSta3, this)); @@ -1045,8 +1056,10 @@ TestUlOfdmaPpduUid::DoSetup (void) m_phyAp = CreateObject (0); m_phyAp->CreateWifiSpectrumPhyInterface (apDev); m_phyAp->ConfigureStandard (WIFI_STANDARD_80211ax); - Ptr error = CreateObject (); - m_phyAp->SetErrorRateModel (error); + Ptr apInterferenceHelper = CreateObject (); + m_phyAp->SetInterferenceHelper (apInterferenceHelper); + Ptr apErrorModel = CreateObject (); + m_phyAp->SetErrorRateModel (apErrorModel); auto channelNum = std::get<0> (*WifiPhyOperatingChannel::FindFirst (0, DEFAULT_FREQUENCY, DEFAULT_CHANNEL_WIDTH, WIFI_STANDARD_80211ax, @@ -1067,7 +1080,10 @@ TestUlOfdmaPpduUid::DoSetup (void) m_phySta1 = CreateObject (1); m_phySta1->CreateWifiSpectrumPhyInterface (sta1Dev); m_phySta1->ConfigureStandard (WIFI_STANDARD_80211ax); - m_phySta1->SetErrorRateModel (error); + Ptr sta1InterferenceHelper = CreateObject (); + m_phySta1->SetInterferenceHelper (sta1InterferenceHelper); + Ptr sta1ErrorModel = CreateObject (); + m_phySta1->SetErrorRateModel (sta1ErrorModel); m_phySta1->SetOperatingChannel (WifiPhy::ChannelTuple {channelNum, DEFAULT_CHANNEL_WIDTH, (int)(WIFI_PHY_BAND_5GHZ), 0}); m_phySta1->SetDevice (sta1Dev); @@ -1084,7 +1100,10 @@ TestUlOfdmaPpduUid::DoSetup (void) m_phySta2 = CreateObject (2); m_phySta2->CreateWifiSpectrumPhyInterface (sta2Dev); m_phySta2->ConfigureStandard (WIFI_STANDARD_80211ax); - m_phySta2->SetErrorRateModel (error); + Ptr sta2InterferenceHelper = CreateObject (); + m_phySta2->SetInterferenceHelper (sta2InterferenceHelper); + Ptr sta2ErrorModel = CreateObject (); + m_phySta2->SetErrorRateModel (sta2ErrorModel); m_phySta2->SetOperatingChannel (WifiPhy::ChannelTuple {channelNum, DEFAULT_CHANNEL_WIDTH, (int)(WIFI_PHY_BAND_5GHZ), 0}); m_phySta2->SetDevice (sta2Dev); @@ -1524,10 +1543,12 @@ TestMultipleHeTbPreambles::DoSetup (void) Ptr dev = CreateObject (); m_phy = CreateObject (0); m_phy->ConfigureStandard (WIFI_STANDARD_80211ax); + Ptr interferenceHelper = CreateObject (); Ptr error = CreateObject (); Ptr mac = CreateObject (); mac->SetAttribute ("BeaconGeneration", BooleanValue (false)); dev->SetMac (mac); + m_phy->SetInterferenceHelper (interferenceHelper); m_phy->SetErrorRateModel (error); m_phy->SetOperatingChannel (WifiPhy::ChannelTuple {DEFAULT_CHANNEL_NUMBER, DEFAULT_CHANNEL_WIDTH, (int)(WIFI_PHY_BAND_5GHZ), 0}); @@ -2242,8 +2263,10 @@ TestUlOfdmaPhyTransmission::DoSetup (void) m_phyAp->ConfigureStandard (WIFI_STANDARD_80211ax); Ptr heConfiguration = CreateObject (); apDev->SetHeConfiguration (heConfiguration); - Ptr error = CreateObject (); - m_phyAp->SetErrorRateModel (error); + Ptr apInterferenceHelper = CreateObject (); + m_phyAp->SetInterferenceHelper (apInterferenceHelper); + Ptr apErrorModel = CreateObject (); + m_phyAp->SetErrorRateModel (apErrorModel); m_phyAp->SetDevice (apDev); m_phyAp->SetChannel (spectrumChannel); m_phyAp->SetReceiveOkCallback (MakeCallback (&TestUlOfdmaPhyTransmission::RxSuccess, this)); @@ -2260,7 +2283,10 @@ TestUlOfdmaPhyTransmission::DoSetup (void) m_phySta1 = CreateObject (1); m_phySta1->CreateWifiSpectrumPhyInterface (sta1Dev); m_phySta1->ConfigureStandard (WIFI_STANDARD_80211ax); - m_phySta1->SetErrorRateModel (error); + Ptr sta1InterferenceHelper = CreateObject (); + m_phySta1->SetInterferenceHelper (sta1InterferenceHelper); + Ptr sta1ErrorModel = CreateObject (); + m_phySta1->SetErrorRateModel (sta1ErrorModel); m_phySta1->SetDevice (sta1Dev); m_phySta1->SetChannel (spectrumChannel); m_phySta1->SetPreambleDetectionModel (preambleDetectionModel); @@ -2275,7 +2301,10 @@ TestUlOfdmaPhyTransmission::DoSetup (void) m_phySta2 = CreateObject (2); m_phySta2->CreateWifiSpectrumPhyInterface (sta2Dev); m_phySta2->ConfigureStandard (WIFI_STANDARD_80211ax); - m_phySta2->SetErrorRateModel (error); + Ptr sta2InterferenceHelper = CreateObject (); + m_phySta2->SetInterferenceHelper (sta2InterferenceHelper); + Ptr sta2ErrorModel = CreateObject (); + m_phySta2->SetErrorRateModel (sta2ErrorModel); m_phySta2->SetDevice (sta2Dev); m_phySta2->SetChannel (spectrumChannel); m_phySta2->SetPreambleDetectionModel (preambleDetectionModel); @@ -2290,7 +2319,10 @@ TestUlOfdmaPhyTransmission::DoSetup (void) m_phySta3 = CreateObject (3); m_phySta3->CreateWifiSpectrumPhyInterface (sta3Dev); m_phySta3->ConfigureStandard (WIFI_STANDARD_80211ax); - m_phySta3->SetErrorRateModel (error); + Ptr sta3InterferenceHelper = CreateObject (); + m_phySta3->SetInterferenceHelper (sta3InterferenceHelper); + Ptr sta3ErrorModel = CreateObject (); + m_phySta3->SetErrorRateModel (sta3ErrorModel); m_phySta3->SetDevice (sta3Dev); m_phySta3->SetChannel (spectrumChannel); m_phySta3->SetPreambleDetectionModel (preambleDetectionModel); @@ -3127,8 +3159,10 @@ TestPhyPaddingExclusion::DoSetup (void) m_phyAp->ConfigureStandard (WIFI_STANDARD_80211ax); Ptr heConfiguration = CreateObject (); apDev->SetHeConfiguration (heConfiguration); - Ptr error = CreateObject (); - m_phyAp->SetErrorRateModel (error); + Ptr apInterferenceHelper = CreateObject (); + m_phyAp->SetInterferenceHelper (apInterferenceHelper); + Ptr apErrorModel = CreateObject (); + m_phyAp->SetErrorRateModel (apErrorModel); m_phyAp->SetDevice (apDev); m_phyAp->SetChannel (spectrumChannel); m_phyAp->AssignStreams (streamNumber); @@ -3152,7 +3186,10 @@ TestPhyPaddingExclusion::DoSetup (void) m_phySta1 = CreateObject (1); m_phySta1->CreateWifiSpectrumPhyInterface (sta1Dev); m_phySta1->ConfigureStandard (WIFI_STANDARD_80211ax); - m_phySta1->SetErrorRateModel (error); + Ptr sta1InterferenceHelper = CreateObject (); + m_phySta1->SetInterferenceHelper (sta1InterferenceHelper); + Ptr sta1ErrorModel = CreateObject (); + m_phySta1->SetErrorRateModel (sta1ErrorModel); m_phySta1->SetDevice (sta1Dev); m_phySta1->SetChannel (spectrumChannel); m_phySta1->AssignStreams (streamNumber); @@ -3169,7 +3206,10 @@ TestPhyPaddingExclusion::DoSetup (void) m_phySta2 = CreateObject (2); m_phySta2->CreateWifiSpectrumPhyInterface (sta2Dev); m_phySta2->ConfigureStandard (WIFI_STANDARD_80211ax); - m_phySta2->SetErrorRateModel (error); + Ptr sta2InterferenceHelper = CreateObject (); + m_phySta2->SetInterferenceHelper (sta2InterferenceHelper); + Ptr sta2ErrorModel = CreateObject (); + m_phySta2->SetErrorRateModel (sta2ErrorModel); m_phySta2->SetDevice (sta2Dev); m_phySta2->SetChannel (spectrumChannel); m_phySta2->AssignStreams (streamNumber); diff --git a/src/wifi/test/wifi-phy-reception-test.cc b/src/wifi/test/wifi-phy-reception-test.cc index cefa147f2..b2ab1f72a 100644 --- a/src/wifi/test/wifi-phy-reception-test.cc +++ b/src/wifi/test/wifi-phy-reception-test.cc @@ -36,6 +36,7 @@ #include "ns3/wifi-net-device.h" #include "ns3/wifi-spectrum-value-helper.h" #include "ns3/spectrum-wifi-phy.h" +#include "ns3/interference-helper.h" #include "ns3/nist-error-rate-model.h" #include "ns3/wifi-mac-header.h" #include "ns3/ampdu-tag.h" @@ -205,6 +206,8 @@ TestThresholdPreambleDetectionWithoutFrameCapture::DoSetup (void) { m_phy = CreateObject (); m_phy->ConfigureStandard (WIFI_STANDARD_80211ax); + Ptr interferenceHelper = CreateObject (); + m_phy->SetInterferenceHelper (interferenceHelper); Ptr error = CreateObject (); m_phy->SetErrorRateModel (error); m_phy->SetOperatingChannel (WifiPhy::ChannelTuple {CHANNEL_NUMBER, 0, WIFI_PHY_BAND_5GHZ, 0}); @@ -569,6 +572,8 @@ TestThresholdPreambleDetectionWithFrameCapture::DoSetup (void) { m_phy = CreateObject (); m_phy->ConfigureStandard (WIFI_STANDARD_80211ax); + Ptr interferenceHelper = CreateObject (); + m_phy->SetInterferenceHelper (interferenceHelper); Ptr error = CreateObject (); m_phy->SetErrorRateModel (error); m_phy->SetOperatingChannel (WifiPhy::ChannelTuple {CHANNEL_NUMBER, 0, WIFI_PHY_BAND_5GHZ, 0}); @@ -1107,6 +1112,8 @@ TestSimpleFrameCaptureModel::DoSetup (void) { m_phy = CreateObject (); m_phy->ConfigureStandard (WIFI_STANDARD_80211ax); + Ptr interferenceHelper = CreateObject (); + m_phy->SetInterferenceHelper (interferenceHelper); Ptr error = CreateObject (); m_phy->SetErrorRateModel (error); m_phy->SetOperatingChannel (WifiPhy::ChannelTuple {CHANNEL_NUMBER, 0, WIFI_PHY_BAND_5GHZ, 0}); @@ -1280,6 +1287,8 @@ TestPhyHeadersReception::DoSetup (void) { m_phy = CreateObject (); m_phy->ConfigureStandard (WIFI_STANDARD_80211ax); + Ptr interferenceHelper = CreateObject (); + m_phy->SetInterferenceHelper (interferenceHelper); Ptr error = CreateObject (); m_phy->SetErrorRateModel (error); m_phy->SetOperatingChannel (WifiPhy::ChannelTuple {CHANNEL_NUMBER, 0, WIFI_PHY_BAND_5GHZ, 0}); @@ -1777,6 +1786,8 @@ TestAmpduReception::DoSetup (void) { m_phy = CreateObject (); m_phy->ConfigureStandard (WIFI_STANDARD_80211ax); + Ptr interferenceHelper = CreateObject (); + m_phy->SetInterferenceHelper (interferenceHelper); Ptr error = CreateObject (); m_phy->SetErrorRateModel (error); m_phy->SetOperatingChannel (WifiPhy::ChannelTuple {CHANNEL_NUMBER, 0, WIFI_PHY_BAND_5GHZ, 0}); diff --git a/src/wifi/test/wifi-phy-thresholds-test.cc b/src/wifi/test/wifi-phy-thresholds-test.cc index 6586c7d94..286832fe5 100644 --- a/src/wifi/test/wifi-phy-thresholds-test.cc +++ b/src/wifi/test/wifi-phy-thresholds-test.cc @@ -23,6 +23,7 @@ #include "ns3/spectrum-wifi-helper.h" #include "ns3/wifi-spectrum-value-helper.h" #include "ns3/spectrum-wifi-phy.h" +#include "ns3/interference-helper.h" #include "ns3/nist-error-rate-model.h" #include "ns3/wifi-mac-header.h" #include "ns3/wifi-spectrum-signal-parameters.h" @@ -231,6 +232,8 @@ WifiPhyThresholdsTest::DoSetup (void) { m_phy = CreateObject (); m_phy->ConfigureStandard (WIFI_STANDARD_80211ax); + Ptr interferenceHelper = CreateObject (); + m_phy->SetInterferenceHelper (interferenceHelper); Ptr error = CreateObject (); m_phy->SetErrorRateModel (error); m_phy->SetOperatingChannel (WifiPhy::ChannelTuple {CHANNEL_NUMBER, 0, WIFI_PHY_BAND_5GHZ, 0}); diff --git a/src/wifi/test/wifi-test.cc b/src/wifi/test/wifi-test.cc index 0a38ca92d..b6e6806e7 100644 --- a/src/wifi/test/wifi-test.cc +++ b/src/wifi/test/wifi-test.cc @@ -28,6 +28,7 @@ #include "ns3/adhoc-wifi-mac.h" #include "ns3/ap-wifi-mac.h" #include "ns3/propagation-loss-model.h" +#include "ns3/interference-helper.h" #include "ns3/yans-error-rate-model.h" #include "ns3/constant-position-mobility-model.h" #include "ns3/test.h" @@ -154,6 +155,8 @@ WifiTest::CreateOne (Vector pos, Ptr channel) Ptr mobility = CreateObject (); Ptr phy = CreateObject (); + Ptr interferenceHelper = CreateObject (); + phy->SetInterferenceHelper (interferenceHelper); Ptr error = CreateObject (); phy->SetErrorRateModel (error); phy->SetChannel (channel); @@ -330,6 +333,8 @@ InterferenceHelperSequenceTest::CreateOne (Vector pos, Ptr chan Ptr mobility = CreateObject (); Ptr phy = CreateObject (); + Ptr interferenceHelper = CreateObject (); + phy->SetInterferenceHelper (interferenceHelper); Ptr error = CreateObject (); phy->SetErrorRateModel (error); phy->SetChannel (channel); @@ -538,6 +543,8 @@ DcfImmediateAccessBroadcastTestCase::DoRun (void) Ptr txMobility = CreateObject (); Ptr txPhy = CreateObject (); + Ptr txInterferenceHelper = CreateObject (); + txPhy->SetInterferenceHelper (txInterferenceHelper); Ptr txError = CreateObject (); txPhy->SetErrorRateModel (txError); txPhy->SetChannel (channel); @@ -1765,9 +1772,11 @@ Bug2831TestCase::DoRun (void) apMobility->SetPosition (Vector (0.0, 0.0, 0.0)); apNode->AggregateObject (apMobility); - Ptr error = CreateObject (); m_apPhy = CreateObject (); - m_apPhy->SetErrorRateModel (error); + Ptr apInterferenceHelper = CreateObject (); + m_apPhy->SetInterferenceHelper (apInterferenceHelper); + Ptr apErrorModel = CreateObject (); + m_apPhy->SetErrorRateModel (apErrorModel); m_apPhy->SetChannel (channel); m_apPhy->SetMobility (apMobility); m_apPhy->SetDevice (apDev); @@ -1779,7 +1788,10 @@ Bug2831TestCase::DoRun (void) staNode->AggregateObject (staMobility); m_staPhy = CreateObject (); - m_staPhy->SetErrorRateModel (error); + Ptr staInterferenceHelper = CreateObject (); + m_staPhy->SetInterferenceHelper (staInterferenceHelper); + Ptr staErrorModel = CreateObject (); + m_staPhy->SetErrorRateModel (staErrorModel); m_staPhy->SetChannel (channel); m_staPhy->SetMobility (staMobility); m_staPhy->SetDevice (apDev);