9#include "ns3/ampdu-tag.h"
10#include "ns3/ap-wifi-mac.h"
11#include "ns3/boolean.h"
12#include "ns3/config.h"
13#include "ns3/double.h"
14#include "ns3/he-phy.h"
15#include "ns3/he-ppdu.h"
16#include "ns3/interference-helper.h"
18#include "ns3/mobility-helper.h"
19#include "ns3/mpdu-aggregator.h"
20#include "ns3/multi-model-spectrum-channel.h"
21#include "ns3/nist-error-rate-model.h"
22#include "ns3/packet-socket-address.h"
23#include "ns3/packet-socket-client.h"
24#include "ns3/packet-socket-helper.h"
25#include "ns3/packet-socket-server.h"
26#include "ns3/pointer.h"
27#include "ns3/rng-seed-manager.h"
28#include "ns3/simple-frame-capture-model.h"
29#include "ns3/single-model-spectrum-channel.h"
30#include "ns3/spectrum-wifi-helper.h"
31#include "ns3/spectrum-wifi-phy.h"
33#include "ns3/threshold-preamble-detection-model.h"
34#include "ns3/wifi-bandwidth-filter.h"
35#include "ns3/wifi-mac-header.h"
36#include "ns3/wifi-mpdu.h"
37#include "ns3/wifi-net-device.h"
38#include "ns3/wifi-psdu.h"
39#include "ns3/wifi-spectrum-phy-interface.h"
40#include "ns3/wifi-spectrum-signal-parameters.h"
41#include "ns3/wifi-spectrum-value-helper.h"
42#include "ns3/wifi-utils.h"
128 SpectrumWifiPhy::CalculateTxDuration(psdu->GetSize(), txVector,
m_phy->GetPhyBand());
140 txParams->psd = txPowerSpectrum;
141 txParams->txPhy =
nullptr;
142 txParams->duration = txDuration;
143 txParams->ppdu = ppdu;
145 m_phy->StartRx(txParams,
nullptr);
161 m_phy->GetAttribute(
"State", ptr);
163 currentState = state->GetState();
167 "PHY State " << currentState <<
" does not match expected state "
179 m_phy->SetInterferenceHelper(interferenceHelper);
181 m_phy->SetErrorRateModel(error);
182 m_phy->SetDevice(dev);
183 m_phy->AddChannel(spectrumChannel);
187 node->AddDevice(dev);
221 const std::vector<bool>& statusPerMpdu);
231 void DoRun()
override;
244 "Threshold preamble detection model test when no frame capture model is applied")
253 expectedSuccessCount,
254 "Didn't receive right number of successful packets");
256 expectedFailureCount,
257 "Didn't receive right number of unsuccessful packets");
264 const std::vector<bool>& statusPerMpdu)
282 m_phy->SetReceiveOkCallback(
284 m_phy->SetReceiveErrorCallback(
289 preambleDetectionModel->SetAttribute(
"Threshold",
DoubleValue(4));
290 preambleDetectionModel->SetAttribute(
"MinimumRssi",
DoubleValue(-82));
291 m_phy->SetPreambleDetectionModel(preambleDetectionModel);
299 int64_t streamNumber = 0;
300 m_phy->AssignStreams(streamNumber);
324 WifiPhyState::CCA_BUSY);
330 WifiPhyState::CCA_BUSY);
378 WifiPhyState::CCA_BUSY);
384 WifiPhyState::CCA_BUSY);
424 WifiPhyState::CCA_BUSY);
430 WifiPhyState::CCA_BUSY);
469 WifiPhyState::CCA_BUSY);
475 WifiPhyState::CCA_BUSY);
490 WifiPhyState::CCA_BUSY);
494 WifiPhyState::CCA_BUSY);
533 WifiPhyState::CCA_BUSY);
539 WifiPhyState::CCA_BUSY);
553 rxPower =
dBm_u{-70};
574 WifiPhyState::CCA_BUSY);
580 WifiPhyState::CCA_BUSY);
623 WifiPhyState::CCA_BUSY);
655 WifiPhyState::CCA_BUSY);
690 WifiPhyState::CCA_BUSY);
696 WifiPhyState::CCA_BUSY);
710 WifiPhyState::CCA_BUSY);
752 rxPower =
dBm_u{-81};
769 WifiPhyState::CCA_BUSY);
775 WifiPhyState::CCA_BUSY);
791 rxPower =
dBm_u{-83};
837 const std::vector<bool>& statusPerMpdu);
847 void DoRun()
override;
859 "Threshold preamble detection model test when simple frame capture model is applied")
868 expectedSuccessCount,
869 "Didn't receive right number of successful packets");
871 expectedFailureCount,
872 "Didn't receive right number of unsuccessful packets");
879 const std::vector<bool>& statusPerMpdu)
897 m_phy->SetReceiveOkCallback(
899 m_phy->SetReceiveErrorCallback(
904 preambleDetectionModel->SetAttribute(
"Threshold",
DoubleValue(4));
905 preambleDetectionModel->SetAttribute(
"MinimumRssi",
DoubleValue(-82));
906 m_phy->SetPreambleDetectionModel(preambleDetectionModel);
909 frameCaptureModel->SetAttribute(
"Margin",
DoubleValue(5));
911 m_phy->SetFrameCaptureModel(frameCaptureModel);
919 int64_t streamNumber = 1;
920 m_phy->AssignStreams(streamNumber);
944 WifiPhyState::CCA_BUSY);
950 WifiPhyState::CCA_BUSY);
998 WifiPhyState::CCA_BUSY);
1004 WifiPhyState::CCA_BUSY);
1008 WifiPhyState::IDLE);
1040 WifiPhyState::IDLE);
1044 WifiPhyState::CCA_BUSY);
1050 WifiPhyState::CCA_BUSY);
1054 WifiPhyState::IDLE);
1085 WifiPhyState::IDLE);
1089 WifiPhyState::CCA_BUSY);
1095 WifiPhyState::CCA_BUSY);
1110 WifiPhyState::CCA_BUSY);
1114 WifiPhyState::CCA_BUSY);
1118 WifiPhyState::IDLE);
1141 rxPower +
dB_u{3.0},
1148 WifiPhyState::IDLE);
1153 WifiPhyState::IDLE);
1157 WifiPhyState::CCA_BUSY);
1163 WifiPhyState::CCA_BUSY);
1167 WifiPhyState::IDLE);
1191 rxPower +
dB_u{6.0},
1198 WifiPhyState::IDLE);
1204 WifiPhyState::IDLE);
1208 WifiPhyState::CCA_BUSY);
1214 WifiPhyState::CCA_BUSY);
1228 WifiPhyState::IDLE);
1259 WifiPhyState::IDLE);
1263 WifiPhyState::CCA_BUSY);
1269 WifiPhyState::CCA_BUSY);
1273 WifiPhyState::IDLE);
1305 WifiPhyState::IDLE);
1309 WifiPhyState::CCA_BUSY);
1314 WifiPhyState::CCA_BUSY);
1318 WifiPhyState::IDLE);
1349 WifiPhyState::IDLE);
1353 WifiPhyState::CCA_BUSY);
1359 WifiPhyState::CCA_BUSY);
1372 WifiPhyState::IDLE);
1395 rxPower +
dB_u{3.0},
1403 WifiPhyState::IDLE);
1407 WifiPhyState::CCA_BUSY);
1412 WifiPhyState::CCA_BUSY);
1416 WifiPhyState::IDLE);
1440 rxPower +
dB_u{6.0},
1448 WifiPhyState::IDLE);
1452 WifiPhyState::CCA_BUSY);
1458 WifiPhyState::CCA_BUSY);
1471 WifiPhyState::IDLE);
1480 rxPower =
dBm_u{-70};
1497 WifiPhyState::IDLE);
1501 WifiPhyState::CCA_BUSY);
1507 WifiPhyState::CCA_BUSY);
1520 WifiPhyState::IDLE);
1550 WifiPhyState::CCA_BUSY);
1582 WifiPhyState::CCA_BUSY);
1613 WifiPhyState::IDLE);
1617 WifiPhyState::CCA_BUSY);
1623 WifiPhyState::CCA_BUSY);
1637 WifiPhyState::CCA_BUSY);
1661 rxPower +
dB_u{3.0},
1668 WifiPhyState::IDLE);
1673 WifiPhyState::CCA_BUSY);
1697 rxPower +
dB_u{6.0},
1704 WifiPhyState::IDLE);
1710 WifiPhyState::IDLE);
1714 WifiPhyState::CCA_BUSY);
1720 WifiPhyState::CCA_BUSY);
1734 WifiPhyState::IDLE);
1742 rxPower =
dBm_u{-50};
1754 rxPower +
dB_u{50.0},
1775 rxPower +
dB_u{10.0},
1796 rxPower +
dB_u{50.0},
1817 rxPower +
dB_u{10.0},
1845 void DoRun()
override;
1861 const std::vector<bool>& statusPerMpdu);
1901 const std::vector<bool>& statusPerMpdu)
1904 NS_ASSERT(!psdu->IsAggregate() || psdu->IsSingle());
1905 if (psdu->GetSize() == 1030)
1909 else if (psdu->GetSize() == 1530)
1919 if (p->GetSize() == 1030)
1923 else if (p->GetSize() == 1530)
1968 m_phy->TraceConnectWithoutContext(
"PhyRxDrop",
1973 preambleDetectionModel->SetAttribute(
"Threshold",
DoubleValue(2));
1974 m_phy->SetPreambleDetectionModel(preambleDetectionModel);
1977 frameCaptureModel->SetAttribute(
"Margin",
DoubleValue(5));
1979 m_phy->SetFrameCaptureModel(frameCaptureModel);
1987 int64_t streamNumber = 2;
1989 m_phy->AssignStreams(streamNumber);
2042 rxPower +
dB_u{6.0},
2064 rxPower +
dB_u{6.0},
2086 void DoRun()
override;
2099 int64_t streamNumber = 0;
2100 m_phy->AssignStreams(streamNumber);
2120 WifiPhyState::CCA_BUSY);
2126 WifiPhyState::CCA_BUSY);
2132 WifiPhyState::CCA_BUSY);
2136 WifiPhyState::IDLE);
2153 WifiPhyState::CCA_BUSY);
2159 WifiPhyState::CCA_BUSY);
2174 WifiPhyState::CCA_BUSY);
2178 WifiPhyState::CCA_BUSY);
2182 WifiPhyState::IDLE);
2200 WifiPhyState::CCA_BUSY);
2207 WifiPhyState::CCA_BUSY);
2211 WifiPhyState::CCA_BUSY);
2215 WifiPhyState::CCA_BUSY);
2219 WifiPhyState::IDLE);
2235 WifiPhyState::CCA_BUSY);
2241 WifiPhyState::CCA_BUSY);
2256 WifiPhyState::CCA_BUSY);
2260 WifiPhyState::CCA_BUSY);
2264 WifiPhyState::IDLE);
2267 rxPower =
dBm_u{-70};
2284 WifiPhyState::CCA_BUSY);
2290 WifiPhyState::CCA_BUSY);
2307 WifiPhyState::CCA_BUSY);
2313 WifiPhyState::CCA_BUSY);
2319 WifiPhyState::CCA_BUSY);
2333 WifiPhyState::CCA_BUSY);
2350 WifiPhyState::CCA_BUSY);
2356 WifiPhyState::CCA_BUSY);
2362 WifiPhyState::CCA_BUSY);
2368 WifiPhyState::CCA_BUSY);
2384 WifiPhyState::CCA_BUSY);
2390 WifiPhyState::CCA_BUSY);
2396 WifiPhyState::CCA_BUSY);
2410 WifiPhyState::CCA_BUSY);
2429 void DoRun()
override;
2441 const std::vector<bool>& statusPerMpdu);
2545 const std::vector<bool>& statusPerMpdu)
2548 if (statusPerMpdu.empty())
2553 "Should have one receive status per MPDU");
2554 auto rxOkForMpdu = statusPerMpdu.begin();
2555 for (
auto mpdu = psdu->begin(); mpdu != psdu->end(); ++mpdu)
2576 else if (size == 1130)
2580 else if (size == 1230)
2584 else if (size == 1330)
2588 else if (size == 1430)
2592 else if (size == 1530)
2602 for (
auto mpdu = psdu->begin(); mpdu != psdu->end(); ++mpdu)
2615 else if (size == 1130)
2619 else if (size == 1230)
2623 else if (size == 1330)
2627 else if (size == 1430)
2631 else if (size == 1530)
2641 if (p->GetSize() == 1030)
2645 else if (p->GetSize() == 1130)
2649 else if (p->GetSize() == 1230)
2653 else if (p->GetSize() == 1330)
2657 else if (p->GetSize() == 1430)
2661 else if (p->GetSize() == 1530)
2672 "RX success bitmap for A-MPDU 1 is not as expected");
2680 "RX success bitmap for A-MPDU 2 is not as expected");
2688 "RX failure bitmap for A-MPDU 1 is not as expected");
2696 "RX failure bitmap for A-MPDU 2 is not as expected");
2704 "RX dropped bitmap for A-MPDU 1 is not as expected");
2712 "RX dropped bitmap for A-MPDU 2 is not as expected");
2720 m_phy->GetAttribute(
"State", ptr);
2722 currentState = state->GetState();
2725 "PHY State " << currentState <<
" does not match expected state "
2746 std::vector<Ptr<WifiMpdu>> mpduList;
2747 for (
size_t i = 0; i < 3; ++i)
2755 SpectrumWifiPhy::CalculateTxDuration(psdu->GetSize(), txVector,
m_phy->GetPhyBand());
2767 txParams->psd = txPowerSpectrum;
2768 txParams->txPhy =
nullptr;
2769 txParams->duration = txDuration;
2770 txParams->ppdu = ppdu;
2772 m_phy->StartRx(txParams,
nullptr);
2782 m_phy->TraceConnectWithoutContext(
"PhyRxDrop",
2787 preambleDetectionModel->SetAttribute(
"Threshold",
DoubleValue(2));
2788 m_phy->SetPreambleDetectionModel(preambleDetectionModel);
2791 frameCaptureModel->SetAttribute(
"Margin",
DoubleValue(5));
2793 m_phy->SetFrameCaptureModel(frameCaptureModel);
2801 int64_t streamNumber = 1;
2803 m_phy->AssignStreams(streamNumber);
2815 rxPower -
dB_u{100},
2872 rxPower -
dB_u{100},
2915 rxPower -
dB_u{100},
2972 rxPower -
dB_u{100},
3015 rxPower -
dB_u{100},
3072 rxPower -
dB_u{100},
3114 rxPower -
dB_u{100},
3170 rxPower -
dB_u{100},
3220 rxPower +
dB_u{3.0},
3313 rxPower +
dB_u{3.0},
3370 rxPower +
dB_u{3.0},
3466 rxPower +
dB_u{3.0},
3523 rxPower +
dB_u{6.0},
3566 rxPower +
dB_u{6.0},
3623 rxPower +
dB_u{6.0},
3667 rxPower +
dB_u{6.0},
3774 rxPower +
dB_u{6.0},
3818 rxPower +
dB_u{6.0},
3991 void DoRun()
override;
4009 :
TestCase(
"Check correct behavior when a STA is receiving a transmission using an unsupported "
4020 if (reason ==
RXING)
4022 std::cout <<
"Dropped a packet because already receiving" << std::endl;
4030 uint16_t m_nStations = 2;
4034 int64_t streamNumber = 100;
4037 wifiApNode.Create(1);
4040 wifiStaNodes.Create(m_nStations);
4044 spectrumChannel->AddPropagationLossModel(lossModel);
4047 spectrumChannel->SetPropagationDelayModel(delayModel);
4050 phy.SetChannel(spectrumChannel);
4055 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
4058 mac.SetType(
"ns3::StaWifiMac",
4065 m_staDevices.
Add(wifi.Install(phy, mac, wifiStaNodes.Get(0)));
4067 m_staDevices.
Add(wifi.Install(phy, mac, wifiStaNodes.Get(1)));
4070 mac.SetType(
"ns3::ApWifiMac",
4077 "EnableBeaconJitter",
4080 m_apDevices = wifi.Install(phy, mac, wifiApNode);
4086 for (uint16_t i = 0; i < m_nStations; i++)
4092 Ssid(
"wifi-backoff-ssid"));
4101 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
4102 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
4103 positionAlloc->Add(Vector(0.0, 1.0, 0.0));
4104 positionAlloc->Add(Vector(-1.0, 0.0, 0.0));
4105 mobility.SetPositionAllocator(positionAlloc);
4107 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
4108 mobility.Install(wifiApNode);
4109 mobility.Install(wifiStaNodes);
4114 dev->GetMac()->GetAttribute(
"BE_Txop", ptr);
4117 packetSocket.
Install(wifiApNode);
4118 packetSocket.
Install(wifiStaNodes);
4121 for (uint16_t i = 0; i < m_nStations; i++)
4131 client->SetRemote(socket);
4132 wifiStaNodes.Get(i)->AddApplication(client);
4134 client->SetStopTime(
Seconds(1));
4136 legacyStaClient->SetAttribute(
"PacketSize",
UintegerValue(1500));
4137 legacyStaClient->SetAttribute(
"MaxPackets",
UintegerValue(200));
4139 legacyStaClient->SetRemote(socket);
4140 wifiStaNodes.Get(i)->AddApplication(legacyStaClient);
4142 legacyStaClient->SetStopTime(
Seconds(1));
4144 server->SetLocal(socket);
4145 wifiApNode.Get(0)->AddApplication(server);
4146 server->SetStartTime(
Seconds(0));
4147 server->SetStopTime(
Seconds(1));
4151 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyRxDrop",
4187 void DoRun()
override;
4207 const std::vector<bool>& statusPerMpdu);
4236 std::optional<Time> expectedLastRxSucceeded,
4237 std::optional<Time> expectedLastRxFailed,
4238 std::optional<Time> expectedLastRxDropped);
4253 :
TestCase(
"Check correct behavior when a STA is receiving a transmission using an unsupported "
4255 m_countRxSuccess(0),
4256 m_countRxFailure(0),
4257 m_countRxDropped(0),
4258 m_lastRxSucceeded(
std::nullopt),
4259 m_lastRxFailed(
std::nullopt),
4260 m_lastRxDropped(
std::nullopt)
4285 SpectrumWifiPhy::CalculateTxDuration(psdu->GetSize(), txVector,
m_rxPhy->GetPhyBand());
4289 auto txPowerSpectrum =
4296 txParams->psd = txPowerSpectrum;
4297 txParams->txPhy =
nullptr;
4298 txParams->duration = txDuration;
4299 txParams->ppdu = ppdu;
4301 m_rxPhy->StartRx(txParams,
nullptr);
4308 const std::vector<bool>& statusPerMpdu)
4336 std::optional<Time> expectedLastRxSucceeded,
4337 std::optional<Time> expectedLastRxFailed,
4338 std::optional<Time> expectedLastRxDropped)
4341 expectedCountRxSuccess,
4342 "Didn't receive right number of successful packets");
4345 expectedCountRxFailure,
4346 "Didn't receive right number of unsuccessful packets");
4349 expectedCountRxDropped,
4350 "Didn't receive right number of dropped packets");
4352 if (expectedCountRxSuccess > 0)
4355 NS_ASSERT(expectedLastRxSucceeded.has_value());
4357 expectedLastRxSucceeded.value(),
4358 "Didn't receive the last successful packet at the expected time");
4361 if (expectedCountRxFailure > 0)
4364 NS_ASSERT(expectedLastRxFailed.has_value());
4366 expectedLastRxFailed.value(),
4367 "Didn't receive the last unsuccessful packet at the expected time");
4370 if (expectedCountRxDropped > 0)
4373 NS_ASSERT(expectedLastRxDropped.has_value());
4375 expectedLastRxDropped.value(),
4376 "Didn't drop the last filtered packet at the expected time");
4388 m_rxPhy->SetInterferenceHelper(rxInterferenceHelper);
4390 m_rxPhy->SetErrorRateModel(rxErrorRateModel);
4392 m_rxPhy->AddChannel(spectrumChannel);
4395 node->AddDevice(dev);
4397 m_rxPhy->SetReceiveOkCallback(
4399 m_rxPhy->SetReceiveErrorCallback(
4401 m_rxPhy->TraceConnectWithoutContext(
4407 m_txPhy->SetInterferenceHelper(txInterferenceHelper);
4409 m_txPhy->SetErrorRateModel(txErrorRateModel);
4410 m_txPhy->AddChannel(spectrumChannel);
4430 int64_t streamNumber = 0;
4431 m_rxPhy->AssignStreams(streamNumber);
4455 heSigAExpectedRxTime);
4478 void DoRun()
override;
4502 MHz_u phyCenterFreq,
4504 MHz_u ppduCenterFreq,
4505 bool expectedP20Overlap,
4506 bool expectedP20Covered);
4513 :
TestCase(
"Check correct detection of whether P20 is fully covered (hence it can be received) "
4514 "or overlaps with the bandwidth of an incoming PPDU")
4543 SpectrumWifiPhy::CalculateTxDuration(psdu->GetSize(), txVector, channelInfo.band);
4553 m_rxPhy->SetInterferenceHelper(rxInterferenceHelper);
4555 m_rxPhy->SetErrorRateModel(rxErrorRateModel);
4561 m_txPhy->SetInterferenceHelper(txInterferenceHelper);
4563 m_txPhy->SetErrorRateModel(txErrorRateModel);
4579 MHz_u phyCenterFreq,
4581 MHz_u ppduCenterFreq,
4582 bool expectedP20Overlap,
4583 bool expectedP20Covered)
4593 auto p20CenterFreq =
m_rxPhy->GetOperatingChannel().GetPrimaryChannelCenterFrequency(
MHz_u{20});
4594 auto p20MinFreq = p20CenterFreq -
MHz_u{10};
4595 auto p20MaxFreq = p20CenterFreq +
MHz_u{10};
4599 auto p20Overlap = ppdu->DoesOverlapChannel(p20MinFreq, p20MaxFreq);
4602 "PPDU is " << (expectedP20Overlap ?
"expected" :
"not expected")
4603 <<
" to overlap with the P20");
4609 "PPDU is " << (expectedP20Covered ?
"expected" :
"not expected")
4610 <<
" to cover the whole P20");
4717 void DoRun()
override;
4728 uint16_t expectedValue)
4729 :
TestCase(
"Test for early discard of signal in single-model-spectrum-channel::StartTx()"),
4731 m_expectedValue(expectedValue)
4755 m_tx->Send(psdu, txVector);
4763 "Received a different amount of packets than expected.");
4769 uint32_t senderNodeId [[maybe_unused]],
4770 double rxPower [[maybe_unused]],
4771 Time duration [[maybe_unused]])
4773 NS_LOG_FUNCTION(
this << signal << senderNodeId << rxPower << duration);
4784 channel->AddSpectrumTransmitFilter(wifiFilter);
4789 m_tx->SetDevice(dev);
4796 m_rx->SetDevice(devRx);
4799 m_tx->SetInterferenceHelper(interferenceTx);
4801 m_tx->SetErrorRateModel(errorTx);
4804 m_rx->SetInterferenceHelper(interferenceRx);
4806 m_rx->SetErrorRateModel(errorRx);
4808 m_tx->AddChannel(channel);
4809 m_rx->AddChannel(channel);
4815 node->AddDevice(dev);
4816 devRx->SetPhy(
m_rx);
4817 nodeRx->AddDevice(devRx);
4819 m_rx->TraceConnectWithoutContext(
4895 void DoRun()
override;
4907 :
TestCase(
"Test for correct WifiPhyRxfailureReason from PhyRxDrop trace"),
4909 m_expectedReason(expectedReason)
4933 phy->Send(psdu, txVector);
4941 "Packet was dropped due to the wrong drop reason reported ");
4972 m_phyA->SetInterferenceHelper(interferenceTx);
4974 m_phyA->SetErrorRateModel(errorTx);
4977 m_phyB->SetInterferenceHelper(interferenceRx);
4979 m_phyB->SetErrorRateModel(errorRx);
4981 m_phyA->AddChannel(channel);
4982 m_phyB->AddChannel(channel);
4991 node->AddDevice(devA);
4993 nodeRx->AddDevice(devB);
4995 m_phyB->TraceConnectWithoutContext(
"PhyRxDrop",
5060 TestCase::Duration::QUICK);
5062 TestCase::Duration::QUICK);
void IncrementSuccessBitmap(uint32_t size)
Increment reception success bitmap.
uint8_t m_rxDroppedBitmapAmpdu2
bitmap of dropped MPDUs in A-MPDU #2
void CheckRxSuccessBitmapAmpdu2(uint8_t expected)
Check the RX success bitmap for A-MPDU 2.
void DoRun() override
Implementation to actually run this TestCase.
void CheckRxDroppedBitmapAmpdu1(uint8_t expected)
Check the RX dropped bitmap for A-MPDU 1.
uint8_t m_rxSuccessBitmapAmpdu1
bitmap of successfully received MPDUs in A-MPDU #1
uint8_t m_rxFailureBitmapAmpdu1
bitmap of unsuccessfully received MPDUs in A-MPDU #1
uint8_t m_rxFailureBitmapAmpdu2
bitmap of unsuccessfully received MPDUs in A-MPDU #2
void RxDropped(Ptr< const Packet > p, WifiPhyRxfailureReason reason)
RX dropped function.
void SendAmpduWithThreeMpdus(dBm_u rxPower, uint32_t referencePacketSize)
Send A-MPDU with 3 MPDUs of different size (i-th MSDU will have 100 bytes more than (i-1)-th).
void RxFailure(Ptr< const WifiPsdu > psdu)
RX failure function.
void CheckRxFailureBitmapAmpdu2(uint8_t expected)
Check the RX failure bitmap for A-MPDU 2.
uint8_t m_rxDroppedBitmapAmpdu1
bitmap of dropped MPDUs in A-MPDU #1
void IncrementFailureBitmap(uint32_t size)
Increment reception failure bitmap.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
void ResetBitmaps()
Reset bitmaps function.
void CheckPhyState(WifiPhyState expectedState)
Check the PHY state.
void RxSuccess(Ptr< const WifiPsdu > psdu, RxSignalInfo rxSignalInfo, const WifiTxVector &txVector, const std::vector< bool > &statusPerMpdu)
RX success function.
void CheckRxSuccessBitmapAmpdu1(uint8_t expected)
Check the RX success bitmap for A-MPDU 1.
void CheckRxFailureBitmapAmpdu1(uint8_t expected)
Check the RX failure bitmap for A-MPDU 1.
uint8_t m_rxSuccessBitmapAmpdu2
bitmap of successfully received MPDUs in A-MPDU #2
void CheckRxDroppedBitmapAmpdu2(uint8_t expected)
Check the RX dropped bitmap for A-MPDU 2.
This test verifies that the WifiPhyRxfailureReason distinguishes between two cases: 1) a drop due to ...
WifiPhyRxfailureReason m_expectedReason
expected WifiPhyRxfailureReason
void PhyDropTraceSink(Ptr< const Packet > p, WifiPhyRxfailureReason reason)
RX dropped function.
void DoRun() override
Implementation to actually run this TestCase.
WifiPhyRxfailureReason m_observedReason
observed WifiPhyRxfailureReason
void CheckDropReason()
Event scheduled at end of simulation for validation.
void DoTeardown() override
Implementation to do any local setup required for this TestCase.
Time m_delay
delay between transmissions in MicroSeconds
Ptr< SpectrumWifiPhy > m_phyA
transmit function
void DoSetup() override
Implementation to do any local setup required for this TestCase.
Ptr< SpectrumWifiPhy > m_phyB
transmit/receive function
TestPhyDropDueToTx(Time delay, WifiPhyRxfailureReason expectedReason)
Constructor.
void Send(Ptr< WifiPhy > phy) const
Send function (sends a single packet)
Primary 20 MHz Covered By Ppdu Test This test checks whether the functions WifiPpdu::DoesOverlapChann...
Ptr< SpectrumWifiPhy > m_rxPhy
RX PHY.
TestPrimary20CoveredByPpdu()
void DoSetup() override
Implementation to do any local setup required for this TestCase.
void RunOne(WifiPhyBand band, MHz_u phyCenterFreq, uint8_t p20Index, MHz_u ppduCenterFreq, bool expectedP20Overlap, bool expectedP20Covered)
Run one function.
Ptr< HePpdu > CreatePpdu(MHz_u ppduCenterFreq)
Function to create a PPDU.
void DoRun() override
Implementation to actually run this TestCase.
void DoTeardown() override
Implementation to do any local setup required for this TestCase.
Ptr< SpectrumWifiPhy > m_txPhy
TX PHY.
Simple frame capture model test.
void Expect1000BPacketReceived()
Verify whether 1000 bytes packet has been received.
bool m_rxDropped1500B
count dropped packets with 1500B payload
void DoSetup() override
Implementation to do any local setup required for this TestCase.
void Expect1500BPacketDropped()
Verify whether 1500 bytes packet has been dropped.
void Expect1000BPacketDropped()
Verify whether 1000 bytes packet has been dropped.
void Reset()
Reset function.
void RxSuccess(Ptr< const WifiPsdu > psdu, RxSignalInfo rxSignalInfo, const WifiTxVector &txVector, const std::vector< bool > &statusPerMpdu)
Spectrum wifi receive success function.
void RxDropped(Ptr< const Packet > p, WifiPhyRxfailureReason reason)
RX dropped function.
void DoRun() override
Implementation to actually run this TestCase.
bool m_rxSuccess1000B
count received packets with 1000B payload
bool m_rxSuccess1500B
count received packets with 1500B payload
void Expect1500BPacketReceived()
Verify whether 1500 bytes packet has been received.
TestSimpleFrameCaptureModel()
bool m_rxDropped1000B
count dropped packets with 1000B payload
This test verifies the correct function of the WifiBandwidthFilter.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
uint8_t m_channel
channel for packet transmission
uint16_t m_expectedValue
expected count of receive events
void Send() const
Send function (sends a single packet)
Ptr< SpectrumWifiPhy > m_tx
transmit function
Ptr< SpectrumWifiPhy > m_rx
receive function
void DoRun() override
Implementation to actually run this TestCase.
void CheckRxPacketCount(uint16_t expectedValue)
Event scheduled at end of simulation for validation.
void RxBegin(Ptr< const SpectrumSignalParameters > signal, uint32_t senderNodeId, double rxPower, Time duration)
Callback invoked when the PHY model starts to process a signal.
void DoTeardown() override
Implementation to do any local setup required for this TestCase.
TestSpectrumChannelWithBandwidthFilter(uint8_t channel, uint16_t expectedValue)
Constructor.
uint32_t m_countRxBegin
count of receive events
Preamble detection test w/o frame capture.
TestThresholdPreambleDetectionWithFrameCapture()
void RxFailure(Ptr< const WifiPsdu > psdu)
Spectrum wifi receive failure function.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
uint32_t m_countRxSuccess
count RX success
void DoRun() override
Implementation to actually run this TestCase.
uint32_t m_countRxFailure
count RX failure
void RxSuccess(Ptr< const WifiPsdu > psdu, RxSignalInfo rxSignalInfo, const WifiTxVector &txVector, const std::vector< bool > &statusPerMpdu)
Spectrum wifi receive success function.
void CheckRxPacketCount(uint32_t expectedSuccessCount, uint32_t expectedFailureCount)
Check the number of received packets.
Preamble detection test w/o frame capture.
void DoRun() override
Implementation to actually run this TestCase.
TestThresholdPreambleDetectionWithoutFrameCapture()
void RxSuccess(Ptr< const WifiPsdu > psdu, RxSignalInfo rxSignalInfo, const WifiTxVector &txVector, const std::vector< bool > &statusPerMpdu)
Spectrum wifi receive success function.
uint32_t m_countRxFailure
count RX failure
void CheckRxPacketCount(uint32_t expectedSuccessCount, uint32_t expectedFailureCount)
Check the number of received packets.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
uint32_t m_countRxSuccess
count RX success
void RxFailure(Ptr< const WifiPsdu > psdu)
Spectrum wifi receive failure function.
Unsupported Bandwidth Reception Test This test checks whether a PHY receiving a PPDU sent over a chan...
uint32_t m_countRxSuccess
count RX success
void DoSetup() override
Implementation to do any local setup required for this TestCase.
Ptr< SpectrumWifiPhy > m_rxPhy
RX PHY.
TestUnsupportedBandwidthReception()
std::optional< Time > m_lastRxDropped
time of last RX drop, if any
Ptr< SpectrumWifiPhy > m_txPhy
TX PHY.
std::optional< Time > m_lastRxSucceeded
time of last RX success, if any
void RxSuccess(Ptr< const WifiPsdu > psdu, RxSignalInfo rxSignalInfo, const WifiTxVector &txVector, const std::vector< bool > &statusPerMpdu)
Function called upon a PSDU received successfully.
void DoTeardown() override
Implementation to do any local setup required for this TestCase.
uint32_t m_countRxFailure
count RX failure
void CheckRx(uint32_t expectedCountRxSuccess, uint32_t expectedCountRxFailure, uint32_t expectedCountRxDropped, std::optional< Time > expectedLastRxSucceeded, std::optional< Time > expectedLastRxFailed, std::optional< Time > expectedLastRxDropped)
Check the reception results.
void RxFailure(Ptr< const WifiPsdu > psdu)
Function called upon a PSDU received unsuccessfuly.
void DoRun() override
Implementation to actually run this TestCase.
std::optional< Time > m_lastRxFailed
time of last RX failure, if any
void SendPpdu(MHz_u centerFreq, MHz_u bandwidth)
Function to create a PPDU.
void RxDropped(Ptr< const Packet > packet, WifiPhyRxfailureReason reason)
Function called upon a PSDU dropped by the PHY.
uint32_t m_countRxDropped
count RX drop
Unsupported Modulation Reception Test This test creates a mixed network, in which an HE STA and a VHT...
void DoRun() override
Implementation to actually run this TestCase.
void CheckResults()
Check correctness of transmitted frames.
void Dropped(std::string context, Ptr< const Packet > packet, WifiPhyRxfailureReason reason)
Callback invoked when PHY drops an incoming packet.
~TestUnsupportedModulationReception() override=default
TestUnsupportedModulationReception()
uint16_t m_dropped
number of packets dropped by the AP because it was already receiving
Wifi Phy Reception Test base class.
WifiPhyReceptionTest(std::string test_name)
Constructor.
void SendPacket(dBm_u rxPower, uint32_t packetSize, uint8_t mcs)
Send packet function.
void DoTeardown() override
Implementation to do any local setup required for this TestCase.
~WifiPhyReceptionTest() override=default
Destructor.
void DoCheckPhyState(WifiPhyState expectedState)
Check the PHY state now.
void CheckPhyState(WifiPhyState expectedState)
Schedule now to check the PHY state.
uint64_t m_uid
the UID to use for the PPDU
Ptr< SpectrumWifiPhy > m_phy
the PHY
void DoSetup() override
Implementation to do any local setup required for this TestCase.
wifi PHY reception Test Suite
WifiPhyReceptionTestSuite()
AttributeValue implementation for Boolean.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
static WifiMode GetHeMcs(uint8_t index)
Return the HE MCS corresponding to the provided index.
static WifiMode GetHeMcs0()
Return MCS 0 from HE MCS values.
static WifiMode GetHeMcs7()
Return MCS 7 from HE MCS values.
Helper class used to assign positions and mobility models to nodes.
holds a vector of ns3::NetDevice pointers
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
keep track of a set of node pointers.
an address for a packet socket
void SetProtocol(uint16_t protocol)
Set the protocol.
void SetPhysicalAddress(const Address address)
Set the destination address.
void SetSingleDevice(uint32_t device)
Set the address to match only a specified NetDevice.
Give ns3::PacketSocket powers to ns3::Node.
void Install(Ptr< Node > node) const
Aggregate an instance of a ns3::PacketSocketFactory onto the provided node.
AttributeValue implementation for Pointer.
Smart pointer class similar to boost::intrusive_ptr.
static void SetRun(uint64_t run)
Set the run number of simulation.
static void SetSeed(uint32_t seed)
Set the seed.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static Time Now()
Return the current simulation virtual time.
static void Run()
Run the simulation.
static EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Make it easy to create and manage PHY objects for the spectrum model.
The IEEE 802.11 SSID Information Element.
AttributeValue implementation for Ssid.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Simulation virtual time values and global simulation resolution.
AttributeValue implementation for Time.
Hold an unsigned integer type.
helps to create WifiNetDevice objects
static int64_t AssignStreams(NetDeviceContainer c, int64_t stream)
Assign a fixed random variable stream number to the random variables used by the PHY and MAC aspects ...
create MAC layers for a ns3::WifiNetDevice.
std::tuple< uint8_t, MHz_u, WifiPhyBand, uint8_t > ChannelTuple
Tuple identifying a segment of an operating channel.
static ConstIterator FindFirst(uint8_t number, MHz_u frequency, MHz_u width, WifiStandard standard, WifiPhyBand band, ConstIterator start=m_frequencyChannels.begin())
Find the first frequency segment matching the specified parameters.
This objects implements the PHY state machine of the Wifi device.
static Ptr< SpectrumValue > CreateHeOfdmTxPowerSpectralDensity(MHz_u centerFrequency, MHz_u channelWidth, Watt_u txPower, MHz_u guardBandwidth, dBr_u minInnerBand=dBr_u{-20}, dBr_u minOuterband=dBr_u{-28}, dBr_u lowestPoint=dBr_u{-40}, const std::vector< bool > &puncturedSubchannels={})
Create a transmit power spectral density corresponding to OFDM High Efficiency (HE) (802....
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
void SetDefault(std::string name, const AttributeValue &value)
void Connect(std::string path, const CallbackBase &cb)
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time Seconds(double value)
Construct a Time in the indicated unit.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
WifiPhyRxfailureReason
Enumeration of the possible reception failure reasons.
WifiPhyBand
Identifies the PHY band.
@ SIGNAL_DETECTION_ABORTED_BY_TX
@ RECEPTION_ABORTED_BY_TX
@ WIFI_PHY_BAND_2_4GHZ
The 2.4 GHz band.
@ WIFI_PHY_BAND_5GHZ
The 5 GHz band.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
WifiPhyState
The state of the PHY layer.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
Watt_u DbmToW(dBm_u val)
Convert from dBm to Watts.
RxSignalInfo structure containing info on the received signal.
static const uint8_t CHANNEL_NUMBER
static const MHz_u FREQUENCY
static WifiPhyReceptionTestSuite wifiPhyReceptionTestSuite
the test suite
static const MHz_u GUARD_WIDTH
static const MHz_u CHANNEL_WIDTH
static const uint32_t packetSize
Packet size generated at the AP.