wifi: Fix missing spectrum channel attached to spectrum PHYs in tests

Also, when setting an RF channel, we need to find a spectrum channel covering the RF channel
This commit is contained in:
Sébastien Deronne
2022-12-10 23:08:07 +01:00
committed by Sebastien Deronne
parent 5c44a7ea01
commit 8ef23543f7
6 changed files with 483 additions and 536 deletions

View File

@@ -20,6 +20,8 @@
#include "ns3/adhoc-wifi-mac.h"
#include "ns3/channel-access-manager.h"
#include "ns3/frame-exchange-manager.h"
#include "ns3/interference-helper.h"
#include "ns3/multi-model-spectrum-channel.h"
#include "ns3/qos-txop.h"
#include "ns3/simulator.h"
#include "ns3/spectrum-wifi-phy.h"
@@ -409,7 +411,7 @@ class ChannelAccessManagerTest : public TestCase
Ptr<FrameExchangeManagerStub<TxopType>> m_feManager; //!< the Frame Exchange Manager stubbed
Ptr<ChannelAccessManagerStub> m_ChannelAccessManager; //!< the channel access manager
Ptr<WifiPhy> m_phy; //!< the PHY object
Ptr<SpectrumWifiPhy> m_phy; //!< the PHY object
TxopTests m_txop; //!< the vector of Txop test instances
uint32_t m_ackTimeoutValue; //!< the Ack timeout value
};
@@ -620,6 +622,8 @@ ChannelAccessManagerTest<TxopType>::StartTest(uint64_t slotTime,
// SetupPhyListener(), requires an attached PHY to determine the channel types
// to initialize
m_phy = CreateObject<SpectrumWifiPhy>();
m_phy->SetInterferenceHelper(CreateObject<InterferenceHelper>());
m_phy->SetChannel(CreateObject<MultiModelSpectrumChannel>());
m_phy->SetOperatingChannel(WifiPhy::ChannelTuple{0, chWidth, WIFI_PHY_BAND_UNSPECIFIED, 0});
m_phy->ConfigureStandard(WIFI_STANDARD_80211ac); // required to use 160 MHz channels
m_ChannelAccessManager->SetupPhyListener(m_phy);
@@ -1342,7 +1346,7 @@ class LargestIdlePrimaryChannelTest : public TestCase
void RunOne(uint16_t chWidth, WifiChannelListType busyChannel);
Ptr<ChannelAccessManager> m_cam; //!< channel access manager
Ptr<WifiPhy> m_phy; //!< PHY object
Ptr<SpectrumWifiPhy> m_phy; //!< PHY object
};
LargestIdlePrimaryChannelTest::LargestIdlePrimaryChannelTest()
@@ -1495,6 +1499,8 @@ LargestIdlePrimaryChannelTest::DoRun()
}
// create a new PHY operating on a channel of the current width
m_phy = CreateObject<SpectrumWifiPhy>();
m_phy->SetInterferenceHelper(CreateObject<InterferenceHelper>());
m_phy->SetChannel(CreateObject<MultiModelSpectrumChannel>());
m_phy->SetOperatingChannel(
WifiPhy::ChannelTuple{0, chWidth, WIFI_PHY_BAND_5GHZ, 0});
m_phy->ConfigureStandard(WIFI_STANDARD_80211ax);

View File

@@ -193,17 +193,24 @@ SpectrumWifiPhyBasicTest::~SpectrumWifiPhyBasicTest()
void
SpectrumWifiPhyBasicTest::DoSetup()
{
Ptr<MultiModelSpectrumChannel> spectrumChannel = CreateObject<MultiModelSpectrumChannel>();
Ptr<Node> node = CreateObject<Node>();
Ptr<WifiNetDevice> dev = CreateObject<WifiNetDevice>();
m_phy = CreateObject<SpectrumWifiPhy>();
m_phy->SetOperatingChannel(WifiPhy::ChannelTuple{CHANNEL_NUMBER, 0, WIFI_PHY_BAND_5GHZ, 0});
m_phy->ConfigureStandard(WIFI_STANDARD_80211n);
Ptr<InterferenceHelper> interferenceHelper = CreateObject<InterferenceHelper>();
m_phy->SetInterferenceHelper(interferenceHelper);
Ptr<ErrorRateModel> error = CreateObject<NistErrorRateModel>();
m_phy->SetErrorRateModel(error);
m_phy->SetDevice(dev);
m_phy->SetChannel(spectrumChannel);
m_phy->SetOperatingChannel(WifiPhy::ChannelTuple{CHANNEL_NUMBER, 0, WIFI_PHY_BAND_5GHZ, 0});
m_phy->ConfigureStandard(WIFI_STANDARD_80211n);
m_phy->SetReceiveOkCallback(
MakeCallback(&SpectrumWifiPhyBasicTest::SpectrumWifiPhyRxSuccess, this));
m_phy->SetReceiveErrorCallback(
MakeCallback(&SpectrumWifiPhyBasicTest::SpectrumWifiPhyRxFailure, this));
dev->SetPhy(m_phy);
node->AddDevice(dev);
}
void
@@ -538,13 +545,13 @@ SpectrumWifiPhyFilterTest::DoSetup()
Ptr<Node> txNode = CreateObject<Node>();
Ptr<WifiNetDevice> txDev = CreateObject<WifiNetDevice>();
m_txPhy = CreateObject<ExtSpectrumWifiPhy>();
m_txPhy->ConfigureStandard(WIFI_STANDARD_80211ax);
Ptr<InterferenceHelper> txInterferenceHelper = CreateObject<InterferenceHelper>();
m_txPhy->SetInterferenceHelper(txInterferenceHelper);
Ptr<ErrorRateModel> txErrorModel = CreateObject<NistErrorRateModel>();
m_txPhy->SetErrorRateModel(txErrorModel);
m_txPhy->SetDevice(txDev);
m_txPhy->SetChannel(spectrumChannel);
m_txPhy->ConfigureStandard(WIFI_STANDARD_80211ax);
Ptr<ConstantPositionMobilityModel> apMobility = CreateObject<ConstantPositionMobilityModel>();
m_txPhy->SetMobility(apMobility);
txDev->SetPhy(m_txPhy);
@@ -554,12 +561,12 @@ SpectrumWifiPhyFilterTest::DoSetup()
Ptr<Node> rxNode = CreateObject<Node>();
Ptr<WifiNetDevice> rxDev = CreateObject<WifiNetDevice>();
m_rxPhy = CreateObject<ExtSpectrumWifiPhy>();
m_rxPhy->ConfigureStandard(WIFI_STANDARD_80211ax);
Ptr<InterferenceHelper> rxInterferenceHelper = CreateObject<InterferenceHelper>();
m_rxPhy->SetInterferenceHelper(rxInterferenceHelper);
Ptr<ErrorRateModel> rxErrorModel = CreateObject<NistErrorRateModel>();
m_rxPhy->SetErrorRateModel(rxErrorModel);
m_rxPhy->SetChannel(spectrumChannel);
m_rxPhy->ConfigureStandard(WIFI_STANDARD_80211ax);
Ptr<ConstantPositionMobilityModel> sta1Mobility = CreateObject<ConstantPositionMobilityModel>();
m_rxPhy->SetMobility(sta1Mobility);
rxDev->SetPhy(m_rxPhy);

View File

@@ -240,9 +240,11 @@ WifiPhyCcaThresholdsTest::DoSetup()
m_vhtConfiguration = CreateObject<VhtConfiguration>();
m_device->SetVhtConfiguration(m_vhtConfiguration);
m_phy = Create<SpectrumWifiPhy>();
m_phy = CreateObject<SpectrumWifiPhy>();
m_phy->SetDevice(m_device);
m_device->SetPhy(m_phy);
m_phy->SetInterferenceHelper(CreateObject<InterferenceHelper>());
m_phy->SetChannel(CreateObject<MultiModelSpectrumChannel>());
auto channelNum = std::get<0>(
*WifiPhyOperatingChannel::FindFirst(0, 0, 160, WIFI_STANDARD_80211ax, WIFI_PHY_BAND_5GHZ));
@@ -1017,7 +1019,6 @@ WifiPhyCcaIndicationTest::DoSetup()
m_rxPhy = CreateObject<SpectrumWifiPhy>();
m_rxPhyStateListener = std::make_unique<CcaTestPhyListener>();
m_rxPhy->RegisterListener(m_rxPhyStateListener.get());
m_rxPhy->ConfigureStandard(WIFI_STANDARD_80211ax);
Ptr<InterferenceHelper> rxInterferenceHelper = CreateObject<InterferenceHelper>();
m_rxPhy->SetInterferenceHelper(rxInterferenceHelper);
Ptr<ErrorRateModel> rxErrorModel = CreateObject<NistErrorRateModel>();
@@ -1026,6 +1027,7 @@ WifiPhyCcaIndicationTest::DoSetup()
CreateObject<ThresholdPreambleDetectionModel>();
m_rxPhy->SetPreambleDetectionModel(preambleDetectionModel);
m_rxPhy->SetChannel(spectrumChannel);
m_rxPhy->ConfigureStandard(WIFI_STANDARD_80211ax);
m_rxPhy->SetDevice(rxDev);
rxDev->SetPhy(m_rxPhy);
rxNode->AddDevice(rxDev);
@@ -1033,13 +1035,13 @@ WifiPhyCcaIndicationTest::DoSetup()
Ptr<Node> txNode = CreateObject<Node>();
Ptr<WifiNetDevice> txDev = CreateObject<WifiNetDevice>();
m_txPhy = CreateObject<SpectrumWifiPhy>();
m_txPhy->ConfigureStandard(WIFI_STANDARD_80211ax);
m_txPhy->SetAttribute("ChannelSwitchDelay", TimeValue(Seconds(0)));
Ptr<InterferenceHelper> txInterferenceHelper = CreateObject<InterferenceHelper>();
m_txPhy->SetInterferenceHelper(txInterferenceHelper);
Ptr<ErrorRateModel> txErrorModel = CreateObject<NistErrorRateModel>();
m_txPhy->SetErrorRateModel(txErrorModel);
m_txPhy->SetChannel(spectrumChannel);
m_txPhy->ConfigureStandard(WIFI_STANDARD_80211ax);
m_txPhy->SetDevice(txDev);
txDev->SetPhy(m_txPhy);
txNode->AddDevice(txDev);

View File

@@ -709,13 +709,13 @@ TestDlOfdmaPhyTransmission::DoSetup()
Ptr<Node> apNode = CreateObject<Node>();
Ptr<WifiNetDevice> apDev = CreateObject<WifiNetDevice>();
m_phyAp = CreateObject<SpectrumWifiPhy>();
m_phyAp->ConfigureStandard(WIFI_STANDARD_80211ax);
Ptr<InterferenceHelper> apInterferenceHelper = CreateObject<InterferenceHelper>();
m_phyAp->SetInterferenceHelper(apInterferenceHelper);
Ptr<ErrorRateModel> apErrorModel = CreateObject<NistErrorRateModel>();
m_phyAp->SetErrorRateModel(apErrorModel);
m_phyAp->SetDevice(apDev);
m_phyAp->SetChannel(spectrumChannel);
m_phyAp->ConfigureStandard(WIFI_STANDARD_80211ax);
Ptr<ConstantPositionMobilityModel> apMobility = CreateObject<ConstantPositionMobilityModel>();
m_phyAp->SetMobility(apMobility);
apDev->SetPhy(m_phyAp);
@@ -725,13 +725,13 @@ TestDlOfdmaPhyTransmission::DoSetup()
Ptr<Node> sta1Node = CreateObject<Node>();
Ptr<WifiNetDevice> sta1Dev = CreateObject<WifiNetDevice>();
m_phySta1 = CreateObject<OfdmaSpectrumWifiPhy>(1);
m_phySta1->ConfigureStandard(WIFI_STANDARD_80211ax);
Ptr<InterferenceHelper> sta1InterferenceHelper = CreateObject<InterferenceHelper>();
m_phySta1->SetInterferenceHelper(sta1InterferenceHelper);
Ptr<ErrorRateModel> sta1ErrorModel = CreateObject<NistErrorRateModel>();
m_phySta1->SetErrorRateModel(sta1ErrorModel);
m_phySta1->SetDevice(sta1Dev);
m_phySta1->SetChannel(spectrumChannel);
m_phySta1->ConfigureStandard(WIFI_STANDARD_80211ax);
m_phySta1->SetReceiveOkCallback(MakeCallback(&TestDlOfdmaPhyTransmission::RxSuccessSta1, this));
m_phySta1->SetReceiveErrorCallback(
MakeCallback(&TestDlOfdmaPhyTransmission::RxFailureSta1, this));
@@ -744,13 +744,13 @@ TestDlOfdmaPhyTransmission::DoSetup()
Ptr<Node> sta2Node = CreateObject<Node>();
Ptr<WifiNetDevice> sta2Dev = CreateObject<WifiNetDevice>();
m_phySta2 = CreateObject<OfdmaSpectrumWifiPhy>(2);
m_phySta2->ConfigureStandard(WIFI_STANDARD_80211ax);
Ptr<InterferenceHelper> sta2InterferenceHelper = CreateObject<InterferenceHelper>();
m_phySta2->SetInterferenceHelper(sta2InterferenceHelper);
Ptr<ErrorRateModel> sta2ErrorModel = CreateObject<NistErrorRateModel>();
m_phySta2->SetErrorRateModel(sta2ErrorModel);
m_phySta2->SetDevice(sta2Dev);
m_phySta2->SetChannel(spectrumChannel);
m_phySta2->ConfigureStandard(WIFI_STANDARD_80211ax);
m_phySta2->SetReceiveOkCallback(MakeCallback(&TestDlOfdmaPhyTransmission::RxSuccessSta2, this));
m_phySta2->SetReceiveErrorCallback(
MakeCallback(&TestDlOfdmaPhyTransmission::RxFailureSta2, this));
@@ -763,13 +763,13 @@ TestDlOfdmaPhyTransmission::DoSetup()
Ptr<Node> sta3Node = CreateObject<Node>();
Ptr<WifiNetDevice> sta3Dev = CreateObject<WifiNetDevice>();
m_phySta3 = CreateObject<OfdmaSpectrumWifiPhy>(3);
m_phySta3->ConfigureStandard(WIFI_STANDARD_80211ax);
Ptr<InterferenceHelper> sta3InterferenceHelper = CreateObject<InterferenceHelper>();
m_phySta3->SetInterferenceHelper(sta3InterferenceHelper);
Ptr<ErrorRateModel> sta3ErrorModel = CreateObject<NistErrorRateModel>();
m_phySta3->SetErrorRateModel(sta3ErrorModel);
m_phySta3->SetDevice(sta3Dev);
m_phySta3->SetChannel(spectrumChannel);
m_phySta3->ConfigureStandard(WIFI_STANDARD_80211ax);
m_phySta3->SetReceiveOkCallback(MakeCallback(&TestDlOfdmaPhyTransmission::RxSuccessSta3, this));
m_phySta3->SetReceiveErrorCallback(
MakeCallback(&TestDlOfdmaPhyTransmission::RxFailureSta3, this));
@@ -1551,13 +1551,13 @@ TestDlOfdmaPhyPuncturing::DoSetup()
Ptr<Node> apNode = CreateObject<Node>();
Ptr<WifiNetDevice> apDev = CreateObject<WifiNetDevice>();
m_phyAp = CreateObject<SpectrumWifiPhy>();
m_phyAp->ConfigureStandard(WIFI_STANDARD_80211ax);
Ptr<InterferenceHelper> apInterferenceHelper = CreateObject<InterferenceHelper>();
m_phyAp->SetInterferenceHelper(apInterferenceHelper);
Ptr<ErrorRateModel> apErrorModel = CreateObject<NistErrorRateModel>();
m_phyAp->SetErrorRateModel(apErrorModel);
m_phyAp->SetDevice(apDev);
m_phyAp->SetChannel(spectrumChannel);
m_phyAp->ConfigureStandard(WIFI_STANDARD_80211ax);
Ptr<ConstantPositionMobilityModel> apMobility = CreateObject<ConstantPositionMobilityModel>();
m_phyAp->SetMobility(apMobility);
apDev->SetPhy(m_phyAp);
@@ -1567,13 +1567,13 @@ TestDlOfdmaPhyPuncturing::DoSetup()
Ptr<Node> sta1Node = CreateObject<Node>();
Ptr<WifiNetDevice> sta1Dev = CreateObject<WifiNetDevice>();
m_phySta1 = CreateObject<OfdmaSpectrumWifiPhy>(1);
m_phySta1->ConfigureStandard(WIFI_STANDARD_80211ax);
Ptr<InterferenceHelper> sta1InterferenceHelper = CreateObject<InterferenceHelper>();
m_phySta1->SetInterferenceHelper(sta1InterferenceHelper);
Ptr<ErrorRateModel> sta1ErrorModel = CreateObject<NistErrorRateModel>();
m_phySta1->SetErrorRateModel(sta1ErrorModel);
m_phySta1->SetDevice(sta1Dev);
m_phySta1->SetChannel(spectrumChannel);
m_phySta1->ConfigureStandard(WIFI_STANDARD_80211ax);
m_phySta1->SetReceiveOkCallback(MakeCallback(&TestDlOfdmaPhyPuncturing::RxSuccessSta1, this));
m_phySta1->SetReceiveErrorCallback(
MakeCallback(&TestDlOfdmaPhyPuncturing::RxFailureSta1, this));
@@ -1586,13 +1586,13 @@ TestDlOfdmaPhyPuncturing::DoSetup()
Ptr<Node> sta2Node = CreateObject<Node>();
Ptr<WifiNetDevice> sta2Dev = CreateObject<WifiNetDevice>();
m_phySta2 = CreateObject<OfdmaSpectrumWifiPhy>(2);
m_phySta2->ConfigureStandard(WIFI_STANDARD_80211ax);
Ptr<InterferenceHelper> sta2InterferenceHelper = CreateObject<InterferenceHelper>();
m_phySta2->SetInterferenceHelper(sta2InterferenceHelper);
Ptr<ErrorRateModel> sta2ErrorModel = CreateObject<NistErrorRateModel>();
m_phySta2->SetErrorRateModel(sta2ErrorModel);
m_phySta2->SetDevice(sta2Dev);
m_phySta2->SetChannel(spectrumChannel);
m_phySta2->ConfigureStandard(WIFI_STANDARD_80211ax);
m_phySta2->SetReceiveOkCallback(MakeCallback(&TestDlOfdmaPhyPuncturing::RxSuccessSta2, this));
m_phySta2->SetReceiveErrorCallback(
MakeCallback(&TestDlOfdmaPhyPuncturing::RxFailureSta2, this));
@@ -1909,11 +1909,12 @@ TestUlOfdmaPpduUid::DoSetup()
Ptr<Node> apNode = CreateObject<Node>();
Ptr<WifiNetDevice> apDev = CreateObject<WifiNetDevice>();
m_phyAp = CreateObject<OfdmaSpectrumWifiPhy>(0);
m_phyAp->ConfigureStandard(WIFI_STANDARD_80211ax);
Ptr<InterferenceHelper> apInterferenceHelper = CreateObject<InterferenceHelper>();
m_phyAp->SetInterferenceHelper(apInterferenceHelper);
Ptr<ErrorRateModel> apErrorModel = CreateObject<NistErrorRateModel>();
m_phyAp->SetErrorRateModel(apErrorModel);
m_phyAp->SetChannel(spectrumChannel);
m_phyAp->ConfigureStandard(WIFI_STANDARD_80211ax);
auto channelNum = std::get<0>(*WifiPhyOperatingChannel::FindFirst(0,
DEFAULT_FREQUENCY,
DEFAULT_CHANNEL_WIDTH,
@@ -1922,7 +1923,6 @@ TestUlOfdmaPpduUid::DoSetup()
m_phyAp->SetOperatingChannel(
WifiPhy::ChannelTuple{channelNum, DEFAULT_CHANNEL_WIDTH, (int)(WIFI_PHY_BAND_5GHZ), 0});
m_phyAp->SetDevice(apDev);
m_phyAp->SetChannel(spectrumChannel);
m_phyAp->TraceConnectWithoutContext("TxPpduUid",
MakeCallback(&TestUlOfdmaPpduUid::TxPpduAp, this));
Ptr<ConstantPositionMobilityModel> apMobility = CreateObject<ConstantPositionMobilityModel>();
@@ -1936,15 +1936,15 @@ TestUlOfdmaPpduUid::DoSetup()
Ptr<Node> sta1Node = CreateObject<Node>();
Ptr<WifiNetDevice> sta1Dev = CreateObject<WifiNetDevice>();
m_phySta1 = CreateObject<OfdmaSpectrumWifiPhy>(1);
m_phySta1->ConfigureStandard(WIFI_STANDARD_80211ax);
Ptr<InterferenceHelper> sta1InterferenceHelper = CreateObject<InterferenceHelper>();
m_phySta1->SetInterferenceHelper(sta1InterferenceHelper);
Ptr<ErrorRateModel> sta1ErrorModel = CreateObject<NistErrorRateModel>();
m_phySta1->SetErrorRateModel(sta1ErrorModel);
m_phySta1->SetChannel(spectrumChannel);
m_phySta1->ConfigureStandard(WIFI_STANDARD_80211ax);
m_phySta1->SetOperatingChannel(
WifiPhy::ChannelTuple{channelNum, DEFAULT_CHANNEL_WIDTH, (int)(WIFI_PHY_BAND_5GHZ), 0});
m_phySta1->SetDevice(sta1Dev);
m_phySta1->SetChannel(spectrumChannel);
m_phySta1->TraceConnectWithoutContext("TxPpduUid",
MakeCallback(&TestUlOfdmaPpduUid::TxPpduSta1, this));
Ptr<ConstantPositionMobilityModel> sta1Mobility = CreateObject<ConstantPositionMobilityModel>();
@@ -1956,15 +1956,15 @@ TestUlOfdmaPpduUid::DoSetup()
Ptr<Node> sta2Node = CreateObject<Node>();
Ptr<WifiNetDevice> sta2Dev = CreateObject<WifiNetDevice>();
m_phySta2 = CreateObject<OfdmaSpectrumWifiPhy>(2);
m_phySta2->ConfigureStandard(WIFI_STANDARD_80211ax);
Ptr<InterferenceHelper> sta2InterferenceHelper = CreateObject<InterferenceHelper>();
m_phySta2->SetInterferenceHelper(sta2InterferenceHelper);
Ptr<ErrorRateModel> sta2ErrorModel = CreateObject<NistErrorRateModel>();
m_phySta2->SetErrorRateModel(sta2ErrorModel);
m_phySta2->SetChannel(spectrumChannel);
m_phySta2->ConfigureStandard(WIFI_STANDARD_80211ax);
m_phySta2->SetOperatingChannel(
WifiPhy::ChannelTuple{channelNum, DEFAULT_CHANNEL_WIDTH, (int)(WIFI_PHY_BAND_5GHZ), 0});
m_phySta2->SetDevice(sta2Dev);
m_phySta2->SetChannel(spectrumChannel);
m_phySta2->TraceConnectWithoutContext("TxPpduUid",
MakeCallback(&TestUlOfdmaPpduUid::TxPpduSta2, this));
Ptr<ConstantPositionMobilityModel> sta2Mobility = CreateObject<ConstantPositionMobilityModel>();
@@ -2496,10 +2496,11 @@ TestMultipleHeTbPreambles::DoRxHeTbPpduOfdmaPart(Ptr<WifiSpectrumSignalParameter
void
TestMultipleHeTbPreambles::DoSetup()
{
Ptr<MultiModelSpectrumChannel> spectrumChannel = CreateObject<MultiModelSpectrumChannel>();
Ptr<Node> node = CreateObject<Node>();
Ptr<WifiNetDevice> dev = CreateObject<WifiNetDevice>();
dev->SetStandard(WIFI_STANDARD_80211ax);
m_phy = CreateObject<OfdmaSpectrumWifiPhy>(0);
m_phy->ConfigureStandard(WIFI_STANDARD_80211ax);
Ptr<InterferenceHelper> interferenceHelper = CreateObject<InterferenceHelper>();
Ptr<ErrorRateModel> error = CreateObject<NistErrorRateModel>();
Ptr<ApWifiMac> mac = CreateObject<ApWifiMac>();
@@ -2507,9 +2508,11 @@ TestMultipleHeTbPreambles::DoSetup()
dev->SetMac(mac);
m_phy->SetInterferenceHelper(interferenceHelper);
m_phy->SetErrorRateModel(error);
m_phy->SetChannel(spectrumChannel);
m_phy->ConfigureStandard(WIFI_STANDARD_80211ax);
m_phy->SetOperatingChannel(WifiPhy::ChannelTuple{DEFAULT_CHANNEL_NUMBER,
DEFAULT_CHANNEL_WIDTH,
(int)(WIFI_PHY_BAND_5GHZ),
WIFI_PHY_BAND_5GHZ,
0});
m_phy->TraceConnectWithoutContext("PhyRxDrop",
MakeCallback(&TestMultipleHeTbPreambles::RxDropped, this));
@@ -2522,6 +2525,8 @@ TestMultipleHeTbPreambles::DoSetup()
Ptr<HeConfiguration> heConfiguration = CreateObject<HeConfiguration>();
heConfiguration->SetMaxTbPpduDelay(NanoSeconds(400));
dev->SetHeConfiguration(heConfiguration);
dev->SetPhy(m_phy);
node->AddDevice(dev);
}
void
@@ -3717,7 +3722,6 @@ TestUlOfdmaPhyTransmission::DoSetup()
apMac->SetAttribute("BeaconGeneration", BooleanValue(false));
apDev->SetMac(apMac);
m_phyAp = CreateObject<OfdmaSpectrumWifiPhy>(0);
m_phyAp->ConfigureStandard(WIFI_STANDARD_80211ax);
Ptr<HeConfiguration> heConfiguration = CreateObject<HeConfiguration>();
apDev->SetHeConfiguration(heConfiguration);
Ptr<InterferenceHelper> apInterferenceHelper = CreateObject<InterferenceHelper>();
@@ -3726,6 +3730,7 @@ TestUlOfdmaPhyTransmission::DoSetup()
m_phyAp->SetErrorRateModel(apErrorModel);
m_phyAp->SetDevice(apDev);
m_phyAp->SetChannel(spectrumChannel);
m_phyAp->ConfigureStandard(WIFI_STANDARD_80211ax);
m_phyAp->SetReceiveOkCallback(MakeCallback(&TestUlOfdmaPhyTransmission::RxSuccess, this));
m_phyAp->SetReceiveErrorCallback(MakeCallback(&TestUlOfdmaPhyTransmission::RxFailure, this));
m_phyAp->SetPreambleDetectionModel(preambleDetectionModel);
@@ -3743,13 +3748,13 @@ TestUlOfdmaPhyTransmission::DoSetup()
sta1Dev->SetStandard(WIFI_STANDARD_80211ax);
sta1Dev->SetHeConfiguration(CreateObject<HeConfiguration>());
m_phySta1 = CreateObject<OfdmaSpectrumWifiPhy>(1);
m_phySta1->ConfigureStandard(WIFI_STANDARD_80211ax);
Ptr<InterferenceHelper> sta1InterferenceHelper = CreateObject<InterferenceHelper>();
m_phySta1->SetInterferenceHelper(sta1InterferenceHelper);
Ptr<ErrorRateModel> sta1ErrorModel = CreateObject<NistErrorRateModel>();
m_phySta1->SetErrorRateModel(sta1ErrorModel);
m_phySta1->SetDevice(sta1Dev);
m_phySta1->SetChannel(spectrumChannel);
m_phySta1->ConfigureStandard(WIFI_STANDARD_80211ax);
m_phySta1->SetPreambleDetectionModel(preambleDetectionModel);
Ptr<ConstantPositionMobilityModel> sta1Mobility = CreateObject<ConstantPositionMobilityModel>();
m_phySta1->SetMobility(sta1Mobility);
@@ -3762,13 +3767,13 @@ TestUlOfdmaPhyTransmission::DoSetup()
sta2Dev->SetStandard(WIFI_STANDARD_80211ax);
sta2Dev->SetHeConfiguration(CreateObject<HeConfiguration>());
m_phySta2 = CreateObject<OfdmaSpectrumWifiPhy>(2);
m_phySta2->ConfigureStandard(WIFI_STANDARD_80211ax);
Ptr<InterferenceHelper> sta2InterferenceHelper = CreateObject<InterferenceHelper>();
m_phySta2->SetInterferenceHelper(sta2InterferenceHelper);
Ptr<ErrorRateModel> sta2ErrorModel = CreateObject<NistErrorRateModel>();
m_phySta2->SetErrorRateModel(sta2ErrorModel);
m_phySta2->SetDevice(sta2Dev);
m_phySta2->SetChannel(spectrumChannel);
m_phySta2->ConfigureStandard(WIFI_STANDARD_80211ax);
m_phySta2->SetPreambleDetectionModel(preambleDetectionModel);
Ptr<ConstantPositionMobilityModel> sta2Mobility = CreateObject<ConstantPositionMobilityModel>();
m_phySta2->SetMobility(sta2Mobility);
@@ -3781,13 +3786,13 @@ TestUlOfdmaPhyTransmission::DoSetup()
sta3Dev->SetStandard(WIFI_STANDARD_80211ax);
sta3Dev->SetHeConfiguration(CreateObject<HeConfiguration>());
m_phySta3 = CreateObject<OfdmaSpectrumWifiPhy>(3);
m_phySta3->ConfigureStandard(WIFI_STANDARD_80211ax);
Ptr<InterferenceHelper> sta3InterferenceHelper = CreateObject<InterferenceHelper>();
m_phySta3->SetInterferenceHelper(sta3InterferenceHelper);
Ptr<ErrorRateModel> sta3ErrorModel = CreateObject<NistErrorRateModel>();
m_phySta3->SetErrorRateModel(sta3ErrorModel);
m_phySta3->SetDevice(sta3Dev);
m_phySta3->SetChannel(spectrumChannel);
m_phySta3->ConfigureStandard(WIFI_STANDARD_80211ax);
m_phySta3->SetPreambleDetectionModel(preambleDetectionModel);
Ptr<ConstantPositionMobilityModel> sta3Mobility = CreateObject<ConstantPositionMobilityModel>();
m_phySta3->SetMobility(sta3Mobility);
@@ -5075,7 +5080,6 @@ TestPhyPaddingExclusion::DoSetup()
apMac->SetAttribute("BeaconGeneration", BooleanValue(false));
apDev->SetMac(apMac);
m_phyAp = CreateObject<OfdmaSpectrumWifiPhy>(0);
m_phyAp->ConfigureStandard(WIFI_STANDARD_80211ax);
Ptr<HeConfiguration> heConfiguration = CreateObject<HeConfiguration>();
apDev->SetHeConfiguration(heConfiguration);
Ptr<InterferenceHelper> apInterferenceHelper = CreateObject<InterferenceHelper>();
@@ -5084,6 +5088,7 @@ TestPhyPaddingExclusion::DoSetup()
m_phyAp->SetErrorRateModel(apErrorModel);
m_phyAp->SetDevice(apDev);
m_phyAp->SetChannel(spectrumChannel);
m_phyAp->ConfigureStandard(WIFI_STANDARD_80211ax);
m_phyAp->AssignStreams(streamNumber);
auto channelNum = std::get<0>(*WifiPhyOperatingChannel::FindFirst(0,
DEFAULT_FREQUENCY,
@@ -5107,13 +5112,13 @@ TestPhyPaddingExclusion::DoSetup()
Ptr<Node> sta1Node = CreateObject<Node>();
Ptr<WifiNetDevice> sta1Dev = CreateObject<WifiNetDevice>();
m_phySta1 = CreateObject<OfdmaSpectrumWifiPhy>(1);
m_phySta1->ConfigureStandard(WIFI_STANDARD_80211ax);
Ptr<InterferenceHelper> sta1InterferenceHelper = CreateObject<InterferenceHelper>();
m_phySta1->SetInterferenceHelper(sta1InterferenceHelper);
Ptr<ErrorRateModel> sta1ErrorModel = CreateObject<NistErrorRateModel>();
m_phySta1->SetErrorRateModel(sta1ErrorModel);
m_phySta1->SetDevice(sta1Dev);
m_phySta1->SetChannel(spectrumChannel);
m_phySta1->ConfigureStandard(WIFI_STANDARD_80211ax);
m_phySta1->AssignStreams(streamNumber);
m_phySta1->SetOperatingChannel(
WifiPhy::ChannelTuple{channelNum, DEFAULT_CHANNEL_WIDTH, (int)(WIFI_PHY_BAND_5GHZ), 0});
@@ -5128,13 +5133,13 @@ TestPhyPaddingExclusion::DoSetup()
Ptr<Node> sta2Node = CreateObject<Node>();
Ptr<WifiNetDevice> sta2Dev = CreateObject<WifiNetDevice>();
m_phySta2 = CreateObject<OfdmaSpectrumWifiPhy>(2);
m_phySta2->ConfigureStandard(WIFI_STANDARD_80211ax);
Ptr<InterferenceHelper> sta2InterferenceHelper = CreateObject<InterferenceHelper>();
m_phySta2->SetInterferenceHelper(sta2InterferenceHelper);
Ptr<ErrorRateModel> sta2ErrorModel = CreateObject<NistErrorRateModel>();
m_phySta2->SetErrorRateModel(sta2ErrorModel);
m_phySta2->SetDevice(sta2Dev);
m_phySta2->SetChannel(spectrumChannel);
m_phySta2->ConfigureStandard(WIFI_STANDARD_80211ax);
m_phySta2->AssignStreams(streamNumber);
m_phySta2->SetOperatingChannel(
WifiPhy::ChannelTuple{channelNum, DEFAULT_CHANNEL_WIDTH, (int)(WIFI_PHY_BAND_5GHZ), 0});

File diff suppressed because it is too large Load Diff

View File

@@ -19,13 +19,16 @@
#include "ns3/interference-helper.h"
#include "ns3/log.h"
#include "ns3/multi-model-spectrum-channel.h"
#include "ns3/nist-error-rate-model.h"
#include "ns3/ofdm-phy.h"
#include "ns3/ofdm-ppdu.h"
#include "ns3/spectrum-phy.h"
#include "ns3/spectrum-wifi-helper.h"
#include "ns3/spectrum-wifi-phy.h"
#include "ns3/test.h"
#include "ns3/wifi-mac-header.h"
#include "ns3/wifi-net-device.h"
#include "ns3/wifi-psdu.h"
#include "ns3/wifi-spectrum-signal-parameters.h"
#include "ns3/wifi-spectrum-value-helper.h"
@@ -253,13 +256,18 @@ WifiPhyThresholdsTest::PhyStateChanged(Time start, Time duration, WifiPhyState n
void
WifiPhyThresholdsTest::DoSetup()
{
Ptr<MultiModelSpectrumChannel> spectrumChannel = CreateObject<MultiModelSpectrumChannel>();
Ptr<Node> node = CreateObject<Node>();
Ptr<WifiNetDevice> dev = CreateObject<WifiNetDevice>();
m_phy = CreateObject<SpectrumWifiPhy>();
m_phy->ConfigureStandard(WIFI_STANDARD_80211ax);
Ptr<InterferenceHelper> interferenceHelper = CreateObject<InterferenceHelper>();
m_phy->SetInterferenceHelper(interferenceHelper);
Ptr<ErrorRateModel> error = CreateObject<NistErrorRateModel>();
m_phy->SetErrorRateModel(error);
m_phy->SetDevice(dev);
m_phy->SetChannel(spectrumChannel);
m_phy->SetOperatingChannel(WifiPhy::ChannelTuple{CHANNEL_NUMBER, 0, WIFI_PHY_BAND_5GHZ, 0});
m_phy->ConfigureStandard(WIFI_STANDARD_80211ax);
m_phy->SetReceiveOkCallback(MakeCallback(&WifiPhyThresholdsTest::RxSuccess, this));
m_phy->SetReceiveErrorCallback(MakeCallback(&WifiPhyThresholdsTest::RxFailure, this));
m_phy->TraceConnectWithoutContext("PhyRxDrop",
@@ -267,6 +275,8 @@ WifiPhyThresholdsTest::DoSetup()
m_phy->GetState()->TraceConnectWithoutContext(
"State",
MakeCallback(&WifiPhyThresholdsTest::PhyStateChanged, this));
dev->SetPhy(m_phy);
node->AddDevice(dev);
}
void