20#include "ns3/ampdu-tag.h"
21#include "ns3/ap-wifi-mac.h"
22#include "ns3/boolean.h"
23#include "ns3/config.h"
24#include "ns3/double.h"
25#include "ns3/he-phy.h"
26#include "ns3/he-ppdu.h"
27#include "ns3/interference-helper.h"
29#include "ns3/mobility-helper.h"
30#include "ns3/mpdu-aggregator.h"
31#include "ns3/multi-model-spectrum-channel.h"
32#include "ns3/nist-error-rate-model.h"
33#include "ns3/packet-socket-address.h"
34#include "ns3/packet-socket-client.h"
35#include "ns3/packet-socket-helper.h"
36#include "ns3/packet-socket-server.h"
37#include "ns3/pointer.h"
38#include "ns3/rng-seed-manager.h"
39#include "ns3/simple-frame-capture-model.h"
40#include "ns3/single-model-spectrum-channel.h"
41#include "ns3/spectrum-wifi-helper.h"
42#include "ns3/spectrum-wifi-phy.h"
44#include "ns3/threshold-preamble-detection-model.h"
45#include "ns3/wifi-bandwidth-filter.h"
46#include "ns3/wifi-mac-header.h"
47#include "ns3/wifi-mpdu.h"
48#include "ns3/wifi-net-device.h"
49#include "ns3/wifi-psdu.h"
50#include "ns3/wifi-spectrum-phy-interface.h"
51#include "ns3/wifi-spectrum-signal-parameters.h"
52#include "ns3/wifi-spectrum-value-helper.h"
53#include "ns3/wifi-utils.h"
144 txParams->psd = txPowerSpectrum;
145 txParams->txPhy =
nullptr;
146 txParams->duration = txDuration;
147 txParams->ppdu = ppdu;
168 currentState = state->GetState();
172 "PHY State " << currentState <<
" does not match expected state "
182 m_phy = CreateObject<SpectrumWifiPhy>();
192 node->AddDevice(dev);
226 std::vector<bool> statusPerMpdu);
236 void DoRun()
override;
249 "Threshold preamble detection model test when no frame capture model is applied")
258 expectedSuccessCount,
259 "Didn't receive right number of successful packets");
261 expectedFailureCount,
262 "Didn't receive right number of unsuccessful packets");
269 std::vector<bool> statusPerMpdu)
293 CreateObject<ThresholdPreambleDetectionModel>();
294 preambleDetectionModel->SetAttribute(
"Threshold",
DoubleValue(4));
295 preambleDetectionModel->SetAttribute(
"MinimumRssi",
DoubleValue(-82));
304 int64_t streamNumber = 0;
308 double rxPowerDbm = -50;
329 WifiPhyState::CCA_BUSY);
335 WifiPhyState::CCA_BUSY);
383 WifiPhyState::CCA_BUSY);
389 WifiPhyState::CCA_BUSY);
429 WifiPhyState::CCA_BUSY);
435 WifiPhyState::CCA_BUSY);
474 WifiPhyState::CCA_BUSY);
480 WifiPhyState::CCA_BUSY);
495 WifiPhyState::CCA_BUSY);
499 WifiPhyState::CCA_BUSY);
538 WifiPhyState::CCA_BUSY);
544 WifiPhyState::CCA_BUSY);
579 WifiPhyState::CCA_BUSY);
585 WifiPhyState::CCA_BUSY);
628 WifiPhyState::CCA_BUSY);
660 WifiPhyState::CCA_BUSY);
695 WifiPhyState::CCA_BUSY);
701 WifiPhyState::CCA_BUSY);
715 WifiPhyState::CCA_BUSY);
774 WifiPhyState::CCA_BUSY);
780 WifiPhyState::CCA_BUSY);
842 std::vector<bool> statusPerMpdu);
852 void DoRun()
override;
864 "Threshold preamble detection model test when simple frame capture model is applied")
873 expectedSuccessCount,
874 "Didn't receive right number of successful packets");
876 expectedFailureCount,
877 "Didn't receive right number of unsuccessful packets");
884 std::vector<bool> statusPerMpdu)
908 CreateObject<ThresholdPreambleDetectionModel>();
909 preambleDetectionModel->SetAttribute(
"Threshold",
DoubleValue(4));
910 preambleDetectionModel->SetAttribute(
"MinimumRssi",
DoubleValue(-82));
914 frameCaptureModel->SetAttribute(
"Margin",
DoubleValue(5));
924 int64_t streamNumber = 1;
928 double rxPowerDbm = -50;
949 WifiPhyState::CCA_BUSY);
955 WifiPhyState::CCA_BUSY);
1003 WifiPhyState::CCA_BUSY);
1009 WifiPhyState::CCA_BUSY);
1013 WifiPhyState::IDLE);
1045 WifiPhyState::IDLE);
1049 WifiPhyState::CCA_BUSY);
1055 WifiPhyState::CCA_BUSY);
1059 WifiPhyState::IDLE);
1090 WifiPhyState::IDLE);
1094 WifiPhyState::CCA_BUSY);
1100 WifiPhyState::CCA_BUSY);
1115 WifiPhyState::CCA_BUSY);
1119 WifiPhyState::CCA_BUSY);
1123 WifiPhyState::IDLE);
1153 WifiPhyState::IDLE);
1158 WifiPhyState::IDLE);
1162 WifiPhyState::CCA_BUSY);
1168 WifiPhyState::CCA_BUSY);
1172 WifiPhyState::IDLE);
1203 WifiPhyState::IDLE);
1209 WifiPhyState::IDLE);
1213 WifiPhyState::CCA_BUSY);
1219 WifiPhyState::CCA_BUSY);
1233 WifiPhyState::IDLE);
1264 WifiPhyState::IDLE);
1268 WifiPhyState::CCA_BUSY);
1274 WifiPhyState::CCA_BUSY);
1278 WifiPhyState::IDLE);
1310 WifiPhyState::IDLE);
1314 WifiPhyState::CCA_BUSY);
1319 WifiPhyState::CCA_BUSY);
1323 WifiPhyState::IDLE);
1354 WifiPhyState::IDLE);
1358 WifiPhyState::CCA_BUSY);
1364 WifiPhyState::CCA_BUSY);
1377 WifiPhyState::IDLE);
1408 WifiPhyState::IDLE);
1412 WifiPhyState::CCA_BUSY);
1417 WifiPhyState::CCA_BUSY);
1421 WifiPhyState::IDLE);
1453 WifiPhyState::IDLE);
1457 WifiPhyState::CCA_BUSY);
1463 WifiPhyState::CCA_BUSY);
1476 WifiPhyState::IDLE);
1502 WifiPhyState::IDLE);
1506 WifiPhyState::CCA_BUSY);
1512 WifiPhyState::CCA_BUSY);
1525 WifiPhyState::IDLE);
1555 WifiPhyState::CCA_BUSY);
1587 WifiPhyState::CCA_BUSY);
1618 WifiPhyState::IDLE);
1622 WifiPhyState::CCA_BUSY);
1628 WifiPhyState::CCA_BUSY);
1642 WifiPhyState::CCA_BUSY);
1673 WifiPhyState::IDLE);
1678 WifiPhyState::CCA_BUSY);
1709 WifiPhyState::IDLE);
1715 WifiPhyState::IDLE);
1719 WifiPhyState::CCA_BUSY);
1725 WifiPhyState::CCA_BUSY);
1739 WifiPhyState::IDLE);
1850 void DoRun()
override;
1866 std::vector<bool> statusPerMpdu);
1906 std::vector<bool> statusPerMpdu)
1909 NS_ASSERT(!psdu->IsAggregate() || psdu->IsSingle());
1910 if (psdu->GetSize() == 1030)
1914 else if (psdu->GetSize() == 1530)
1924 if (p->GetSize() == 1030)
1928 else if (p->GetSize() == 1530)
1977 CreateObject<ThresholdPreambleDetectionModel>();
1978 preambleDetectionModel->SetAttribute(
"Threshold",
DoubleValue(2));
1982 frameCaptureModel->SetAttribute(
"Margin",
DoubleValue(5));
1992 int64_t streamNumber = 2;
1993 double rxPowerDbm = -30;
2091 void DoRun()
override;
2104 int64_t streamNumber = 0;
2108 double rxPowerDbm = -50;
2130 WifiPhyState::CCA_BUSY);
2136 WifiPhyState::CCA_BUSY);
2142 WifiPhyState::CCA_BUSY);
2146 WifiPhyState::IDLE);
2168 WifiPhyState::CCA_BUSY);
2174 WifiPhyState::CCA_BUSY);
2189 WifiPhyState::CCA_BUSY);
2193 WifiPhyState::CCA_BUSY);
2197 WifiPhyState::IDLE);
2220 WifiPhyState::CCA_BUSY);
2227 WifiPhyState::CCA_BUSY);
2231 WifiPhyState::CCA_BUSY);
2235 WifiPhyState::CCA_BUSY);
2239 WifiPhyState::IDLE);
2260 WifiPhyState::CCA_BUSY);
2266 WifiPhyState::CCA_BUSY);
2281 WifiPhyState::CCA_BUSY);
2285 WifiPhyState::CCA_BUSY);
2289 WifiPhyState::IDLE);
2314 WifiPhyState::CCA_BUSY);
2320 WifiPhyState::CCA_BUSY);
2342 WifiPhyState::CCA_BUSY);
2348 WifiPhyState::CCA_BUSY);
2354 WifiPhyState::CCA_BUSY);
2368 WifiPhyState::CCA_BUSY);
2390 WifiPhyState::CCA_BUSY);
2396 WifiPhyState::CCA_BUSY);
2402 WifiPhyState::CCA_BUSY);
2408 WifiPhyState::CCA_BUSY);
2429 WifiPhyState::CCA_BUSY);
2435 WifiPhyState::CCA_BUSY);
2441 WifiPhyState::CCA_BUSY);
2455 WifiPhyState::CCA_BUSY);
2474 void DoRun()
override;
2486 std::vector<bool> statusPerMpdu);
2590 std::vector<bool> statusPerMpdu)
2593 if (statusPerMpdu.empty())
2598 "Should have one receive status per MPDU");
2599 auto rxOkForMpdu = statusPerMpdu.begin();
2600 for (
auto mpdu = psdu->begin(); mpdu != psdu->end(); ++mpdu)
2621 else if (size == 1130)
2625 else if (size == 1230)
2629 else if (size == 1330)
2633 else if (size == 1430)
2637 else if (size == 1530)
2647 for (
auto mpdu = psdu->begin(); mpdu != psdu->end(); ++mpdu)
2660 else if (size == 1130)
2664 else if (size == 1230)
2668 else if (size == 1330)
2672 else if (size == 1430)
2676 else if (size == 1530)
2686 if (p->GetSize() == 1030)
2690 else if (p->GetSize() == 1130)
2694 else if (p->GetSize() == 1230)
2698 else if (p->GetSize() == 1330)
2702 else if (p->GetSize() == 1430)
2706 else if (p->GetSize() == 1530)
2717 "RX success bitmap for A-MPDU 1 is not as expected");
2725 "RX success bitmap for A-MPDU 2 is not as expected");
2733 "RX failure bitmap for A-MPDU 1 is not as expected");
2741 "RX failure bitmap for A-MPDU 2 is not as expected");
2749 "RX dropped bitmap for A-MPDU 1 is not as expected");
2757 "RX dropped bitmap for A-MPDU 2 is not as expected");
2767 currentState = state->GetState();
2770 "PHY State " << currentState <<
" does not match expected state "
2784 std::vector<Ptr<WifiMpdu>> mpduList;
2785 for (
size_t i = 0; i < 3; ++i)
2787 Ptr<Packet> p = Create<Packet>(referencePacketSize + i * 100);
2788 mpduList.push_back(Create<WifiMpdu>(p, hdr));
2804 txParams->psd = txPowerSpectrum;
2805 txParams->txPhy =
nullptr;
2806 txParams->duration = txDuration;
2807 txParams->ppdu = ppdu;
2824 CreateObject<ThresholdPreambleDetectionModel>();
2825 preambleDetectionModel->SetAttribute(
"Threshold",
DoubleValue(2));
2829 frameCaptureModel->SetAttribute(
"Margin",
DoubleValue(5));
2839 int64_t streamNumber = 1;
2840 double rxPowerDbm = -30;
4029 void DoRun()
override;
4047 :
TestCase(
"Check correct behavior when a STA is receiving a transmission using an unsupported "
4058 if (reason ==
RXING)
4060 std::cout <<
"Dropped a packet because already receiving" << std::endl;
4068 uint16_t m_nStations = 2;
4072 int64_t streamNumber = 100;
4075 wifiApNode.Create(1);
4078 wifiStaNodes.Create(m_nStations);
4082 spectrumChannel->AddPropagationLossModel(lossModel);
4084 CreateObject<ConstantSpeedPropagationDelayModel>();
4085 spectrumChannel->SetPropagationDelayModel(delayModel);
4088 phy.SetChannel(spectrumChannel);
4093 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
4096 mac.SetType(
"ns3::StaWifiMac",
4103 m_staDevices.
Add(wifi.Install(phy, mac, wifiStaNodes.Get(0)));
4105 m_staDevices.
Add(wifi.Install(phy, mac, wifiStaNodes.Get(1)));
4108 mac.SetType(
"ns3::ApWifiMac",
4115 "EnableBeaconJitter",
4118 m_apDevices = wifi.Install(phy, mac, wifiApNode);
4124 for (uint16_t i = 0; i < m_nStations; i++)
4126 dev = DynamicCast<WifiNetDevice>(m_staDevices.
Get(i));
4130 Ssid(
"wifi-backoff-ssid"));
4134 wifi.AssignStreams(m_apDevices, streamNumber);
4139 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
4140 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
4141 positionAlloc->Add(Vector(0.0, 1.0, 0.0));
4142 positionAlloc->Add(Vector(-1.0, 0.0, 0.0));
4143 mobility.SetPositionAllocator(positionAlloc);
4145 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
4146 mobility.Install(wifiApNode);
4147 mobility.Install(wifiStaNodes);
4150 dev = DynamicCast<WifiNetDevice>(m_apDevices.
Get(0));
4152 dev->GetMac()->GetAttribute(
"BE_Txop", ptr);
4155 packetSocket.
Install(wifiApNode);
4156 packetSocket.
Install(wifiStaNodes);
4159 for (uint16_t i = 0; i < m_nStations; i++)
4169 client->SetRemote(socket);
4170 wifiStaNodes.Get(i)->AddApplication(client);
4172 client->SetStopTime(
Seconds(1.0));
4174 legacyStaClient->SetAttribute(
"PacketSize",
UintegerValue(1500));
4175 legacyStaClient->SetAttribute(
"MaxPackets",
UintegerValue(200));
4177 legacyStaClient->SetRemote(socket);
4178 wifiStaNodes.Get(i)->AddApplication(legacyStaClient);
4180 legacyStaClient->SetStopTime(
Seconds(1.0));
4182 server->SetLocal(socket);
4183 wifiApNode.Get(0)->AddApplication(server);
4184 server->SetStartTime(
Seconds(0.0));
4185 server->SetStopTime(
Seconds(1.0));
4189 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyRxDrop",
4225 void DoRun()
override;
4233 void SendPpdu(uint16_t centerFreqMhz, uint16_t bandwidthMhz);
4245 std::vector<bool> statusPerMpdu);
4274 std::optional<Time> expectedLastRxSucceeded,
4275 std::optional<Time> expectedLastRxFailed,
4276 std::optional<Time> expectedLastRxDropped);
4291 :
TestCase(
"Check correct behavior when a STA is receiving a transmission using an unsupported "
4293 m_countRxSuccess(0),
4294 m_countRxFailure(0),
4295 m_countRxDropped(0),
4296 m_lastRxSucceeded(
std::nullopt),
4297 m_lastRxFailed(
std::nullopt),
4298 m_lastRxDropped(
std::nullopt)
4308 auto pkt = Create<Packet>(1000);
4320 auto txPowerSpectrum =
4326 auto txParams = Create<WifiSpectrumSignalParameters>();
4327 txParams->psd = txPowerSpectrum;
4328 txParams->txPhy =
nullptr;
4329 txParams->duration = txDuration;
4330 txParams->ppdu = ppdu;
4331 txParams->txWidth = bandwidthMhz;
4340 std::vector<bool> statusPerMpdu)
4368 std::optional<Time> expectedLastRxSucceeded,
4369 std::optional<Time> expectedLastRxFailed,
4370 std::optional<Time> expectedLastRxDropped)
4373 expectedCountRxSuccess,
4374 "Didn't receive right number of successful packets");
4377 expectedCountRxFailure,
4378 "Didn't receive right number of unsuccessful packets");
4381 expectedCountRxDropped,
4382 "Didn't receive right number of dropped packets");
4384 if (expectedCountRxSuccess > 0)
4387 NS_ASSERT(expectedLastRxSucceeded.has_value());
4389 expectedLastRxSucceeded.value(),
4390 "Didn't receive the last successful packet at the expected time");
4393 if (expectedCountRxFailure > 0)
4396 NS_ASSERT(expectedLastRxFailed.has_value());
4398 expectedLastRxFailed.value(),
4399 "Didn't receive the last unsuccessful packet at the expected time");
4402 if (expectedCountRxDropped > 0)
4405 NS_ASSERT(expectedLastRxDropped.has_value());
4407 expectedLastRxDropped.value(),
4408 "Didn't drop the last filtered packet at the expected time");
4418 m_rxPhy = CreateObject<SpectrumWifiPhy>();
4419 auto rxInterferenceHelper = CreateObject<InterferenceHelper>();
4421 auto rxErrorRateModel = CreateObject<NistErrorRateModel>();
4427 node->AddDevice(dev);
4437 m_txPhy = CreateObject<SpectrumWifiPhy>();
4438 auto txInterferenceHelper = CreateObject<InterferenceHelper>();
4440 auto txErrorRateModel = CreateObject<NistErrorRateModel>();
4462 int64_t streamNumber = 0;
4483 heSigAExpectedRxTime);
4506 void DoRun()
override;
4530 uint16_t phyCenterFreqMhz,
4532 uint16_t ppduCenterFreqMhz,
4533 bool expectedP20Overlap,
4534 bool expectedP20Covered);
4541 :
TestCase(
"Check correct detection of whether P20 is fully covered (hence it can be received) "
4542 "or overlaps with the bandwidth of an incoming PPDU")
4549 [[maybe_unused]]
auto [channelNumber, centerFreq, channelWidth, type, phyBand] =
4559 auto pkt = Create<Packet>(1000);
4562 auto psdu = Create<WifiPsdu>(pkt, hdr);
4571 m_rxPhy = CreateObject<SpectrumWifiPhy>();
4572 auto rxInterferenceHelper = CreateObject<InterferenceHelper>();
4574 auto rxErrorRateModel = CreateObject<NistErrorRateModel>();
4579 m_txPhy = CreateObject<SpectrumWifiPhy>();
4580 auto txInterferenceHelper = CreateObject<InterferenceHelper>();
4582 auto txErrorRateModel = CreateObject<NistErrorRateModel>();
4599 uint16_t phyCenterFreqMhz,
4601 uint16_t ppduCenterFreqMhz,
4602 bool expectedP20Overlap,
4603 bool expectedP20Covered)
4605 [[maybe_unused]]
const auto [channelNumber, centerFreq, channelWidth, type, phyBand] =
4611 auto p20MinFreq = p20CenterFreq - 10;
4612 auto p20MaxFreq = p20CenterFreq + 10;
4616 auto p20Overlap = ppdu->DoesOverlapChannel(p20MinFreq, p20MaxFreq);
4619 "PPDU is " << (expectedP20Overlap ?
"expected" :
"not expected")
4620 <<
" to overlap with the P20");
4627 .GetChannelWidth());
4630 "PPDU is " << (expectedP20Covered ?
"expected" :
"not expected")
4631 <<
" to cover the whole P20");
4735 void DoRun()
override;
4746 uint16_t expectedValue)
4747 :
TestCase(
"Test for early discard of signal in single-model-spectrum-channel::StartTx()"),
4749 m_expectedValue(expectedValue)
4774 "Received a different amount of packets than expected.");
4779 uint32_t senderNodeId [[maybe_unused]],
4780 double rxPower [[maybe_unused]],
4781 Time duration [[maybe_unused]])
4783 NS_LOG_FUNCTION(
this << signalType << senderNodeId << rxPower << duration);
4794 channel->AddSpectrumTransmitFilter(wifiFilter);
4798 m_tx = CreateObject<SpectrumWifiPhy>();
4803 Ptr<Node> nodeRx = CreateObject<Node>();
4805 m_rx = CreateObject<SpectrumWifiPhy>();
4825 node->AddDevice(dev);
4826 devRx->SetPhy(
m_rx);
4827 nodeRx->AddDevice(devRx);
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(double rxPowerDbm, 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.
Primary 20 MHz Covered By Ppdu Test This test checks whether the functions WifiPpdu::DoesOverlapChann...
Ptr< SpectrumWifiPhy > m_rxPhy
RX PHY.
void RunOne(WifiPhyBand band, uint16_t phyCenterFreqMhz, uint8_t p20Index, uint16_t ppduCenterFreqMhz, bool expectedP20Overlap, bool expectedP20Covered)
Run one function.
TestPrimary20CoveredByPpdu()
Ptr< HePpdu > CreatePpdu(uint16_t ppduCenterFreqMhz)
Function to create a PPDU.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
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.
uint16_t m_expectedValue
expected count of receive events
void Send() const
Send function (sends a single packet)
TestSpectrumChannelWithBandwidthFilter(uint16_t channel, uint16_t expectedValue)
Constructor.
Ptr< SpectrumWifiPhy > m_tx
transmit function
Ptr< SpectrumWifiPhy > m_rx
receive function
void RxBegin(bool signalType, uint32_t senderNodeId, double rxPower, Time duration)
Callback invoked when the PHY model starts to process a signal.
void DoRun() override
Implementation to actually run this TestCase.
void CheckRxPacketCount(uint16_t expectedValue)
Event scheduled at end of simulation for validation.
void DoTeardown() override
Implementation to do any local setup required for this TestCase.
uint16_t m_channel
channel for packet transmission
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.
void SendPpdu(uint16_t centerFreqMhz, uint16_t bandwidthMhz)
Function to create a PPDU.
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 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 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
void SendPacket(double rxPowerDbm, uint32_t packetSize, uint8_t mcs)
Send packet function.
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.
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
void GetAttribute(std::string name, AttributeValue &value) const
Get the value of an attribute, raising fatal errors if unsuccessful.
void Dispose()
Dispose of this Object.
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.
Hold objects of type Ptr<T>.
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.
void SetDevice(const Ptr< WifiNetDevice > device) override
Sets the device this PHY is associated with.
void StartRx(Ptr< SpectrumSignalParameters > rxParams, Ptr< const WifiSpectrumPhyInterface > interface)
Input method for delivering a signal from the spectrum channel and low-level PHY interface to this Sp...
void AddChannel(const Ptr< SpectrumChannel > channel, const FrequencyRange &freqRange=WHOLE_WIFI_SPECTRUM)
Attach a SpectrumChannel to use for a given frequency range.
The IEEE 802.11 SSID Information Element.
AttributeValue implementation for Ssid.
void AddTestCase(TestCase *testCase, TestDuration 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
create MAC layers for a ns3::WifiNetDevice.
virtual void SetInterferenceHelper(const Ptr< InterferenceHelper > helper)
Sets the interference helper.
void Send(Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector)
This function is a wrapper for the Send variant that accepts a WifiConstPsduMap as first argument.
void SetErrorRateModel(const Ptr< ErrorRateModel > model)
Sets the error rate model.
void SetReceiveErrorCallback(RxErrorCallback callback)
virtual void ConfigureStandard(WifiStandard standard)
Configure the PHY-level parameters for different Wi-Fi standard.
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
void SetOperatingChannel(const ChannelTuple &channelTuple)
If the standard for this object has not been set yet, store the given channel settings.
WifiPhyBand GetPhyBand() const
Get the configured Wi-Fi band.
Ptr< PhyEntity > GetPhyEntity(WifiModulationClass modulation) const
Get the supported PHY entity corresponding to the modulation class.
void SetTxPowerEnd(double end)
Sets the maximum available transmission power level (dBm).
void SetPreambleDetectionModel(const Ptr< PreambleDetectionModel > preambleDetectionModel)
Sets the preamble detection model.
void SetReceiveOkCallback(RxOkCallback callback)
void SetFrameCaptureModel(const Ptr< FrameCaptureModel > frameCaptureModel)
Sets the frame capture model.
std::tuple< uint8_t, uint16_t, int, uint8_t > ChannelTuple
Tuple identifying an operating channel.
const WifiPhyOperatingChannel & GetOperatingChannel() const
Get a const reference to the operating channel.
void SetTxPowerStart(double start)
Sets the minimum available transmission power level (dBm).
virtual int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
static ConstIterator FindFirst(uint8_t number, uint16_t frequency, uint16_t width, WifiStandard standard, WifiPhyBand band, ConstIterator start=m_frequencyChannels.begin())
Find the first channel matching the specified parameters.
uint16_t GetPrimaryChannelCenterFrequency(uint16_t primaryChannelWidth) const
Get the center frequency of the primary channel of the given width.
This objects implements the PHY state machine of the Wifi device.
static Ptr< SpectrumValue > CreateHeOfdmTxPowerSpectralDensity(uint32_t centerFrequency, uint16_t channelWidth, double txPowerW, uint16_t guardBandwidth, double minInnerBandDbr=-20, double minOuterbandDbr=-28, double lowestPointDbr=-40, const std::vector< bool > &puncturedSubchannels=std::vector< bool >{})
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 ",...
#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.
@ 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.
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...
double DbmToW(double dBm)
Convert from dBm to Watts.
RxSignalInfo structure containing info on the received signal.
static const uint8_t CHANNEL_NUMBER
static const uint16_t GUARD_WIDTH
static const uint16_t CHANNEL_WIDTH
static WifiPhyReceptionTestSuite wifiPhyReceptionTestSuite
the test suite
static const uint32_t FREQUENCY
WifiPhyState
The state of the PHY layer.
static const uint32_t packetSize
Packet size generated at the AP.