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"
127 Time txDuration =
m_phy->CalculateTxDuration(psdu->GetSize(), txVector,
m_phy->GetPhyBand());
139 txParams->psd = txPowerSpectrum;
140 txParams->txPhy =
nullptr;
141 txParams->duration = txDuration;
142 txParams->ppdu = ppdu;
144 m_phy->StartRx(txParams,
nullptr);
160 m_phy->GetAttribute(
"State", ptr);
162 currentState = state->GetState();
166 "PHY State " << currentState <<
" does not match expected state "
178 m_phy->SetInterferenceHelper(interferenceHelper);
180 m_phy->SetErrorRateModel(error);
181 m_phy->SetDevice(dev);
182 m_phy->AddChannel(spectrumChannel);
186 node->AddDevice(dev);
220 std::vector<bool> statusPerMpdu);
230 void DoRun()
override;
243 "Threshold preamble detection model test when no frame capture model is applied")
252 expectedSuccessCount,
253 "Didn't receive right number of successful packets");
255 expectedFailureCount,
256 "Didn't receive right number of unsuccessful packets");
263 std::vector<bool> statusPerMpdu)
281 m_phy->SetReceiveOkCallback(
283 m_phy->SetReceiveErrorCallback(
288 preambleDetectionModel->SetAttribute(
"Threshold",
DoubleValue(4));
289 preambleDetectionModel->SetAttribute(
"MinimumRssi",
DoubleValue(-82));
290 m_phy->SetPreambleDetectionModel(preambleDetectionModel);
298 int64_t streamNumber = 0;
299 m_phy->AssignStreams(streamNumber);
323 WifiPhyState::CCA_BUSY);
329 WifiPhyState::CCA_BUSY);
377 WifiPhyState::CCA_BUSY);
383 WifiPhyState::CCA_BUSY);
423 WifiPhyState::CCA_BUSY);
429 WifiPhyState::CCA_BUSY);
468 WifiPhyState::CCA_BUSY);
474 WifiPhyState::CCA_BUSY);
489 WifiPhyState::CCA_BUSY);
493 WifiPhyState::CCA_BUSY);
520 rxPower +
static_cast<dB_u>(3.0),
532 WifiPhyState::CCA_BUSY);
538 WifiPhyState::CCA_BUSY);
573 WifiPhyState::CCA_BUSY);
579 WifiPhyState::CCA_BUSY);
622 WifiPhyState::CCA_BUSY);
654 WifiPhyState::CCA_BUSY);
689 WifiPhyState::CCA_BUSY);
695 WifiPhyState::CCA_BUSY);
709 WifiPhyState::CCA_BUSY);
731 rxPower +
static_cast<dB_u>(3.0),
768 WifiPhyState::CCA_BUSY);
774 WifiPhyState::CCA_BUSY);
836 std::vector<bool> statusPerMpdu);
846 void DoRun()
override;
858 "Threshold preamble detection model test when simple frame capture model is applied")
867 expectedSuccessCount,
868 "Didn't receive right number of successful packets");
870 expectedFailureCount,
871 "Didn't receive right number of unsuccessful packets");
878 std::vector<bool> statusPerMpdu)
896 m_phy->SetReceiveOkCallback(
898 m_phy->SetReceiveErrorCallback(
903 preambleDetectionModel->SetAttribute(
"Threshold",
DoubleValue(4));
904 preambleDetectionModel->SetAttribute(
"MinimumRssi",
DoubleValue(-82));
905 m_phy->SetPreambleDetectionModel(preambleDetectionModel);
908 frameCaptureModel->SetAttribute(
"Margin",
DoubleValue(5));
910 m_phy->SetFrameCaptureModel(frameCaptureModel);
918 int64_t streamNumber = 1;
919 m_phy->AssignStreams(streamNumber);
943 WifiPhyState::CCA_BUSY);
949 WifiPhyState::CCA_BUSY);
997 WifiPhyState::CCA_BUSY);
1003 WifiPhyState::CCA_BUSY);
1007 WifiPhyState::IDLE);
1039 WifiPhyState::IDLE);
1043 WifiPhyState::CCA_BUSY);
1049 WifiPhyState::CCA_BUSY);
1053 WifiPhyState::IDLE);
1084 WifiPhyState::IDLE);
1088 WifiPhyState::CCA_BUSY);
1094 WifiPhyState::CCA_BUSY);
1109 WifiPhyState::CCA_BUSY);
1113 WifiPhyState::CCA_BUSY);
1117 WifiPhyState::IDLE);
1140 rxPower +
static_cast<dB_u>(3.0),
1147 WifiPhyState::IDLE);
1152 WifiPhyState::IDLE);
1156 WifiPhyState::CCA_BUSY);
1162 WifiPhyState::CCA_BUSY);
1166 WifiPhyState::IDLE);
1190 rxPower +
static_cast<dB_u>(6.0),
1197 WifiPhyState::IDLE);
1203 WifiPhyState::IDLE);
1207 WifiPhyState::CCA_BUSY);
1213 WifiPhyState::CCA_BUSY);
1227 WifiPhyState::IDLE);
1258 WifiPhyState::IDLE);
1262 WifiPhyState::CCA_BUSY);
1268 WifiPhyState::CCA_BUSY);
1272 WifiPhyState::IDLE);
1304 WifiPhyState::IDLE);
1308 WifiPhyState::CCA_BUSY);
1313 WifiPhyState::CCA_BUSY);
1317 WifiPhyState::IDLE);
1348 WifiPhyState::IDLE);
1352 WifiPhyState::CCA_BUSY);
1358 WifiPhyState::CCA_BUSY);
1371 WifiPhyState::IDLE);
1394 rxPower +
static_cast<dB_u>(3.0),
1402 WifiPhyState::IDLE);
1406 WifiPhyState::CCA_BUSY);
1411 WifiPhyState::CCA_BUSY);
1415 WifiPhyState::IDLE);
1439 rxPower +
static_cast<dB_u>(6.0),
1447 WifiPhyState::IDLE);
1451 WifiPhyState::CCA_BUSY);
1457 WifiPhyState::CCA_BUSY);
1470 WifiPhyState::IDLE);
1496 WifiPhyState::IDLE);
1500 WifiPhyState::CCA_BUSY);
1506 WifiPhyState::CCA_BUSY);
1519 WifiPhyState::IDLE);
1549 WifiPhyState::CCA_BUSY);
1581 WifiPhyState::CCA_BUSY);
1612 WifiPhyState::IDLE);
1616 WifiPhyState::CCA_BUSY);
1622 WifiPhyState::CCA_BUSY);
1636 WifiPhyState::CCA_BUSY);
1660 rxPower +
static_cast<dB_u>(3.0),
1667 WifiPhyState::IDLE);
1672 WifiPhyState::CCA_BUSY);
1696 rxPower +
static_cast<dB_u>(6.0),
1703 WifiPhyState::IDLE);
1709 WifiPhyState::IDLE);
1713 WifiPhyState::CCA_BUSY);
1719 WifiPhyState::CCA_BUSY);
1733 WifiPhyState::IDLE);
1753 rxPower +
static_cast<dB_u>(50.0),
1774 rxPower +
static_cast<dB_u>(10.0),
1795 rxPower +
static_cast<dB_u>(50.0),
1816 rxPower +
static_cast<dB_u>(10.0),
1844 void DoRun()
override;
1860 std::vector<bool> statusPerMpdu);
1900 std::vector<bool> statusPerMpdu)
1903 NS_ASSERT(!psdu->IsAggregate() || psdu->IsSingle());
1904 if (psdu->GetSize() == 1030)
1908 else if (psdu->GetSize() == 1530)
1918 if (p->GetSize() == 1030)
1922 else if (p->GetSize() == 1530)
1967 m_phy->TraceConnectWithoutContext(
"PhyRxDrop",
1972 preambleDetectionModel->SetAttribute(
"Threshold",
DoubleValue(2));
1973 m_phy->SetPreambleDetectionModel(preambleDetectionModel);
1976 frameCaptureModel->SetAttribute(
"Margin",
DoubleValue(5));
1978 m_phy->SetFrameCaptureModel(frameCaptureModel);
1986 int64_t streamNumber = 2;
1987 dBm_u rxPower = -30;
1988 m_phy->AssignStreams(streamNumber);
2041 rxPower +
static_cast<dB_u>(6.0),
2063 rxPower +
static_cast<dB_u>(6.0),
2085 void DoRun()
override;
2098 int64_t streamNumber = 0;
2099 m_phy->AssignStreams(streamNumber);
2102 dBm_u rxPower = -50;
2119 WifiPhyState::CCA_BUSY);
2125 WifiPhyState::CCA_BUSY);
2131 WifiPhyState::CCA_BUSY);
2135 WifiPhyState::IDLE);
2152 WifiPhyState::CCA_BUSY);
2158 WifiPhyState::CCA_BUSY);
2173 WifiPhyState::CCA_BUSY);
2177 WifiPhyState::CCA_BUSY);
2181 WifiPhyState::IDLE);
2199 WifiPhyState::CCA_BUSY);
2206 WifiPhyState::CCA_BUSY);
2210 WifiPhyState::CCA_BUSY);
2214 WifiPhyState::CCA_BUSY);
2218 WifiPhyState::IDLE);
2234 WifiPhyState::CCA_BUSY);
2240 WifiPhyState::CCA_BUSY);
2255 WifiPhyState::CCA_BUSY);
2259 WifiPhyState::CCA_BUSY);
2263 WifiPhyState::IDLE);
2283 WifiPhyState::CCA_BUSY);
2289 WifiPhyState::CCA_BUSY);
2306 WifiPhyState::CCA_BUSY);
2312 WifiPhyState::CCA_BUSY);
2318 WifiPhyState::CCA_BUSY);
2332 WifiPhyState::CCA_BUSY);
2349 WifiPhyState::CCA_BUSY);
2355 WifiPhyState::CCA_BUSY);
2361 WifiPhyState::CCA_BUSY);
2367 WifiPhyState::CCA_BUSY);
2383 WifiPhyState::CCA_BUSY);
2389 WifiPhyState::CCA_BUSY);
2395 WifiPhyState::CCA_BUSY);
2409 WifiPhyState::CCA_BUSY);
2428 void DoRun()
override;
2440 std::vector<bool> statusPerMpdu);
2544 std::vector<bool> statusPerMpdu)
2547 if (statusPerMpdu.empty())
2552 "Should have one receive status per MPDU");
2553 auto rxOkForMpdu = statusPerMpdu.begin();
2554 for (
auto mpdu = psdu->begin(); mpdu != psdu->end(); ++mpdu)
2575 else if (size == 1130)
2579 else if (size == 1230)
2583 else if (size == 1330)
2587 else if (size == 1430)
2591 else if (size == 1530)
2601 for (
auto mpdu = psdu->begin(); mpdu != psdu->end(); ++mpdu)
2614 else if (size == 1130)
2618 else if (size == 1230)
2622 else if (size == 1330)
2626 else if (size == 1430)
2630 else if (size == 1530)
2640 if (p->GetSize() == 1030)
2644 else if (p->GetSize() == 1130)
2648 else if (p->GetSize() == 1230)
2652 else if (p->GetSize() == 1330)
2656 else if (p->GetSize() == 1430)
2660 else if (p->GetSize() == 1530)
2671 "RX success bitmap for A-MPDU 1 is not as expected");
2679 "RX success bitmap for A-MPDU 2 is not as expected");
2687 "RX failure bitmap for A-MPDU 1 is not as expected");
2695 "RX failure bitmap for A-MPDU 2 is not as expected");
2703 "RX dropped bitmap for A-MPDU 1 is not as expected");
2711 "RX dropped bitmap for A-MPDU 2 is not as expected");
2719 m_phy->GetAttribute(
"State", ptr);
2721 currentState = state->GetState();
2724 "PHY State " << currentState <<
" does not match expected state "
2745 std::vector<Ptr<WifiMpdu>> mpduList;
2746 for (
size_t i = 0; i < 3; ++i)
2753 Time txDuration =
m_phy->CalculateTxDuration(psdu->GetSize(), txVector,
m_phy->GetPhyBand());
2765 txParams->psd = txPowerSpectrum;
2766 txParams->txPhy =
nullptr;
2767 txParams->duration = txDuration;
2768 txParams->ppdu = ppdu;
2770 m_phy->StartRx(txParams,
nullptr);
2780 m_phy->TraceConnectWithoutContext(
"PhyRxDrop",
2785 preambleDetectionModel->SetAttribute(
"Threshold",
DoubleValue(2));
2786 m_phy->SetPreambleDetectionModel(preambleDetectionModel);
2789 frameCaptureModel->SetAttribute(
"Margin",
DoubleValue(5));
2791 m_phy->SetFrameCaptureModel(frameCaptureModel);
2799 int64_t streamNumber = 1;
2800 dBm_u rxPower = -30;
2801 m_phy->AssignStreams(streamNumber);
3218 rxPower +
static_cast<dB_u>(3.0),
3311 rxPower +
static_cast<dB_u>(3.0),
3368 rxPower +
static_cast<dB_u>(3.0),
3464 rxPower +
static_cast<dB_u>(3.0),
3521 rxPower +
static_cast<dB_u>(6.0),
3564 rxPower +
static_cast<dB_u>(6.0),
3621 rxPower +
static_cast<dB_u>(6.0),
3665 rxPower +
static_cast<dB_u>(6.0),
3772 rxPower +
static_cast<dB_u>(6.0),
3816 rxPower +
static_cast<dB_u>(6.0),
3989 void DoRun()
override;
4007 :
TestCase(
"Check correct behavior when a STA is receiving a transmission using an unsupported "
4018 if (reason ==
RXING)
4020 std::cout <<
"Dropped a packet because already receiving" << std::endl;
4028 uint16_t m_nStations = 2;
4032 int64_t streamNumber = 100;
4035 wifiApNode.Create(1);
4038 wifiStaNodes.Create(m_nStations);
4042 spectrumChannel->AddPropagationLossModel(lossModel);
4045 spectrumChannel->SetPropagationDelayModel(delayModel);
4048 phy.SetChannel(spectrumChannel);
4053 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
4056 mac.SetType(
"ns3::StaWifiMac",
4063 m_staDevices.
Add(wifi.Install(phy, mac, wifiStaNodes.Get(0)));
4065 m_staDevices.
Add(wifi.Install(phy, mac, wifiStaNodes.Get(1)));
4068 mac.SetType(
"ns3::ApWifiMac",
4075 "EnableBeaconJitter",
4078 m_apDevices = wifi.Install(phy, mac, wifiApNode);
4084 for (uint16_t i = 0; i < m_nStations; i++)
4090 Ssid(
"wifi-backoff-ssid"));
4099 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
4100 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
4101 positionAlloc->Add(Vector(0.0, 1.0, 0.0));
4102 positionAlloc->Add(Vector(-1.0, 0.0, 0.0));
4103 mobility.SetPositionAllocator(positionAlloc);
4105 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
4106 mobility.Install(wifiApNode);
4107 mobility.Install(wifiStaNodes);
4112 dev->GetMac()->GetAttribute(
"BE_Txop", ptr);
4115 packetSocket.
Install(wifiApNode);
4116 packetSocket.
Install(wifiStaNodes);
4119 for (uint16_t i = 0; i < m_nStations; i++)
4129 client->SetRemote(socket);
4130 wifiStaNodes.Get(i)->AddApplication(client);
4132 client->SetStopTime(
Seconds(1.0));
4134 legacyStaClient->SetAttribute(
"PacketSize",
UintegerValue(1500));
4135 legacyStaClient->SetAttribute(
"MaxPackets",
UintegerValue(200));
4137 legacyStaClient->SetRemote(socket);
4138 wifiStaNodes.Get(i)->AddApplication(legacyStaClient);
4140 legacyStaClient->SetStopTime(
Seconds(1.0));
4142 server->SetLocal(socket);
4143 wifiApNode.Get(0)->AddApplication(server);
4144 server->SetStartTime(
Seconds(0.0));
4145 server->SetStopTime(
Seconds(1.0));
4149 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyRxDrop",
4185 void DoRun()
override;
4205 std::vector<bool> statusPerMpdu);
4234 std::optional<Time> expectedLastRxSucceeded,
4235 std::optional<Time> expectedLastRxFailed,
4236 std::optional<Time> expectedLastRxDropped);
4251 :
TestCase(
"Check correct behavior when a STA is receiving a transmission using an unsupported "
4253 m_countRxSuccess(0),
4254 m_countRxFailure(0),
4255 m_countRxDropped(0),
4256 m_lastRxSucceeded(
std::nullopt),
4257 m_lastRxFailed(
std::nullopt),
4258 m_lastRxDropped(
std::nullopt)
4283 m_rxPhy->CalculateTxDuration(psdu->GetSize(), txVector,
m_rxPhy->GetPhyBand());
4293 txParams->psd = txPowerSpectrum;
4294 txParams->txPhy =
nullptr;
4295 txParams->duration = txDuration;
4296 txParams->ppdu = ppdu;
4298 m_rxPhy->StartRx(txParams,
nullptr);
4305 std::vector<bool> statusPerMpdu)
4333 std::optional<Time> expectedLastRxSucceeded,
4334 std::optional<Time> expectedLastRxFailed,
4335 std::optional<Time> expectedLastRxDropped)
4338 expectedCountRxSuccess,
4339 "Didn't receive right number of successful packets");
4342 expectedCountRxFailure,
4343 "Didn't receive right number of unsuccessful packets");
4346 expectedCountRxDropped,
4347 "Didn't receive right number of dropped packets");
4349 if (expectedCountRxSuccess > 0)
4352 NS_ASSERT(expectedLastRxSucceeded.has_value());
4354 expectedLastRxSucceeded.value(),
4355 "Didn't receive the last successful packet at the expected time");
4358 if (expectedCountRxFailure > 0)
4361 NS_ASSERT(expectedLastRxFailed.has_value());
4363 expectedLastRxFailed.value(),
4364 "Didn't receive the last unsuccessful packet at the expected time");
4367 if (expectedCountRxDropped > 0)
4370 NS_ASSERT(expectedLastRxDropped.has_value());
4372 expectedLastRxDropped.value(),
4373 "Didn't drop the last filtered packet at the expected time");
4385 m_rxPhy->SetInterferenceHelper(rxInterferenceHelper);
4387 m_rxPhy->SetErrorRateModel(rxErrorRateModel);
4389 m_rxPhy->AddChannel(spectrumChannel);
4392 node->AddDevice(dev);
4394 m_rxPhy->SetReceiveOkCallback(
4396 m_rxPhy->SetReceiveErrorCallback(
4398 m_rxPhy->TraceConnectWithoutContext(
4404 m_txPhy->SetInterferenceHelper(txInterferenceHelper);
4406 m_txPhy->SetErrorRateModel(txErrorRateModel);
4407 m_txPhy->AddChannel(spectrumChannel);
4427 int64_t streamNumber = 0;
4428 m_rxPhy->AssignStreams(streamNumber);
4448 heSigAExpectedRxTime);
4471 void DoRun()
override;
4495 MHz_u phyCenterFreq,
4497 MHz_u ppduCenterFreq,
4498 bool expectedP20Overlap,
4499 bool expectedP20Covered);
4506 :
TestCase(
"Check correct detection of whether P20 is fully covered (hence it can be received) "
4507 "or overlaps with the bandwidth of an incoming PPDU")
4535 auto txDuration =
m_txPhy->CalculateTxDuration(psdu->GetSize(), txVector, channelInfo.band);
4545 m_rxPhy->SetInterferenceHelper(rxInterferenceHelper);
4547 m_rxPhy->SetErrorRateModel(rxErrorRateModel);
4553 m_txPhy->SetInterferenceHelper(txInterferenceHelper);
4555 m_txPhy->SetErrorRateModel(txErrorRateModel);
4571 MHz_u phyCenterFreq,
4573 MHz_u ppduCenterFreq,
4574 bool expectedP20Overlap,
4575 bool expectedP20Covered)
4577 const auto& channelInfo =
4582 auto p20CenterFreq =
m_rxPhy->GetOperatingChannel().GetPrimaryChannelCenterFrequency(20);
4583 auto p20MinFreq = p20CenterFreq - 10;
4584 auto p20MaxFreq = p20CenterFreq + 10;
4588 auto p20Overlap = ppdu->DoesOverlapChannel(p20MinFreq, p20MaxFreq);
4591 "PPDU is " << (expectedP20Overlap ?
"expected" :
"not expected")
4592 <<
" to overlap with the P20");
4598 "PPDU is " << (expectedP20Covered ?
"expected" :
"not expected")
4599 <<
" to cover the whole P20");
4706 void DoRun()
override;
4717 uint16_t expectedValue)
4718 :
TestCase(
"Test for early discard of signal in single-model-spectrum-channel::StartTx()"),
4720 m_expectedValue(expectedValue)
4744 m_tx->Send(psdu, txVector);
4752 "Received a different amount of packets than expected.");
4758 uint32_t senderNodeId [[maybe_unused]],
4759 double rxPower [[maybe_unused]],
4760 Time duration [[maybe_unused]])
4762 NS_LOG_FUNCTION(
this << signal << senderNodeId << rxPower << duration);
4773 channel->AddSpectrumTransmitFilter(wifiFilter);
4778 m_tx->SetDevice(dev);
4779 m_tx->SetTxPowerStart(20);
4780 m_tx->SetTxPowerEnd(20);
4785 m_rx->SetDevice(devRx);
4788 m_tx->SetInterferenceHelper(interferenceTx);
4790 m_tx->SetErrorRateModel(errorTx);
4793 m_rx->SetInterferenceHelper(interferenceRx);
4795 m_rx->SetErrorRateModel(errorRx);
4797 m_tx->AddChannel(channel);
4798 m_rx->AddChannel(channel);
4804 node->AddDevice(dev);
4805 devRx->SetPhy(
m_rx);
4806 nodeRx->AddDevice(devRx);
4808 m_rx->TraceConnectWithoutContext(
4884 void DoRun()
override;
4896 :
TestCase(
"Test for correct WifiPhyRxfailureReason from PhyRxDrop trace"),
4898 m_expectedReason(expectedReason)
4922 phy->Send(psdu, txVector);
4930 "Packet was dropped due to the wrong drop reason reported ");
4950 m_phyA->SetTxPowerStart(20);
4951 m_phyA->SetTxPowerEnd(20);
4957 m_phyB->SetTxPowerStart(20);
4958 m_phyB->SetTxPowerEnd(20);
4961 m_phyA->SetInterferenceHelper(interferenceTx);
4963 m_phyA->SetErrorRateModel(errorTx);
4966 m_phyB->SetInterferenceHelper(interferenceRx);
4968 m_phyB->SetErrorRateModel(errorRx);
4970 m_phyA->AddChannel(channel);
4971 m_phyB->AddChannel(channel);
4980 node->AddDevice(devA);
4982 nodeRx->AddDevice(devB);
4984 m_phyB->TraceConnectWithoutContext(
"PhyRxDrop",
5049 TestCase::Duration::QUICK);
5051 TestCase::Duration::QUICK);
void RxSuccess(Ptr< const WifiPsdu > psdu, RxSignalInfo rxSignalInfo, WifiTxVector txVector, std::vector< bool > statusPerMpdu)
RX success function.
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 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, WifiTxVector txVector, 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 RxSuccess(Ptr< const WifiPsdu > psdu, RxSignalInfo rxSignalInfo, WifiTxVector txVector, std::vector< bool > statusPerMpdu)
Spectrum wifi receive success function.
void DoRun() override
Implementation to actually run this TestCase.
uint32_t m_countRxFailure
count RX failure
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, WifiTxVector txVector, 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 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 RxSuccess(Ptr< const WifiPsdu > psdu, RxSignalInfo rxSignalInfo, WifiTxVector txVector, std::vector< bool > statusPerMpdu)
Function called upon a PSDU received successfully.
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()
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.
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.
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=-20, dBr_u minOuterband=-28, dBr_u lowestPoint=-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.