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/spectrum-wifi-helper.h"
41#include "ns3/spectrum-wifi-phy.h"
43#include "ns3/threshold-preamble-detection-model.h"
44#include "ns3/wifi-mac-header.h"
45#include "ns3/wifi-mpdu.h"
46#include "ns3/wifi-net-device.h"
47#include "ns3/wifi-psdu.h"
48#include "ns3/wifi-spectrum-signal-parameters.h"
49#include "ns3/wifi-spectrum-value-helper.h"
50#include "ns3/wifi-utils.h"
95 std::vector<bool> statusPerMpdu);
105 void DoRun()
override;
129 :
TestCase(
"Threshold preamble detection model test when no frame capture model is applied"),
161 txParams->psd = txPowerSpectrum;
162 txParams->txPhy =
nullptr;
163 txParams->duration = txDuration;
164 txParams->ppdu = ppdu;
187 currentState = state->GetState();
191 "PHY State " << currentState <<
" does not match expected state "
200 expectedSuccessCount,
201 "Didn't receive right number of successful packets");
203 expectedFailureCount,
204 "Didn't receive right number of unsuccessful packets");
211 std::vector<bool> statusPerMpdu)
233 m_phy = CreateObject<SpectrumWifiPhy>();
246 CreateObject<ThresholdPreambleDetectionModel>();
247 preambleDetectionModel->SetAttribute(
"Threshold",
DoubleValue(4));
248 preambleDetectionModel->SetAttribute(
"MinimumRssi",
DoubleValue(-82));
264 int64_t streamNumber = 0;
268 double rxPowerDbm = -50;
287 WifiPhyState::CCA_BUSY);
293 WifiPhyState::CCA_BUSY);
337 WifiPhyState::CCA_BUSY);
343 WifiPhyState::CCA_BUSY);
379 WifiPhyState::CCA_BUSY);
385 WifiPhyState::CCA_BUSY);
420 WifiPhyState::CCA_BUSY);
426 WifiPhyState::CCA_BUSY);
441 WifiPhyState::CCA_BUSY);
445 WifiPhyState::CCA_BUSY);
480 WifiPhyState::CCA_BUSY);
486 WifiPhyState::CCA_BUSY);
519 WifiPhyState::CCA_BUSY);
525 WifiPhyState::CCA_BUSY);
564 WifiPhyState::CCA_BUSY);
592 WifiPhyState::CCA_BUSY);
623 WifiPhyState::CCA_BUSY);
629 WifiPhyState::CCA_BUSY);
643 WifiPhyState::CCA_BUSY);
696 WifiPhyState::CCA_BUSY);
702 WifiPhyState::CCA_BUSY);
769 std::vector<bool> statusPerMpdu);
779 void DoRun()
override;
803 "Threshold preamble detection model test when simple frame capture model is applied"),
835 txParams->psd = txPowerSpectrum;
836 txParams->txPhy =
nullptr;
837 txParams->duration = txDuration;
838 txParams->ppdu = ppdu;
860 currentState = state->GetState();
864 "PHY State " << currentState <<
" does not match expected state "
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)
905 m_phy = CreateObject<SpectrumWifiPhy>();
918 CreateObject<ThresholdPreambleDetectionModel>();
919 preambleDetectionModel->SetAttribute(
"Threshold",
DoubleValue(4));
920 preambleDetectionModel->SetAttribute(
"MinimumRssi",
DoubleValue(-82));
924 frameCaptureModel->SetAttribute(
"Margin",
DoubleValue(5));
941 int64_t streamNumber = 1;
945 double rxPowerDbm = -50;
964 WifiPhyState::CCA_BUSY);
970 WifiPhyState::CCA_BUSY);
1010 WifiPhyState::IDLE);
1014 WifiPhyState::CCA_BUSY);
1020 WifiPhyState::CCA_BUSY);
1024 WifiPhyState::IDLE);
1052 WifiPhyState::IDLE);
1056 WifiPhyState::CCA_BUSY);
1062 WifiPhyState::CCA_BUSY);
1066 WifiPhyState::IDLE);
1093 WifiPhyState::IDLE);
1097 WifiPhyState::CCA_BUSY);
1103 WifiPhyState::CCA_BUSY);
1118 WifiPhyState::CCA_BUSY);
1122 WifiPhyState::CCA_BUSY);
1126 WifiPhyState::IDLE);
1152 WifiPhyState::IDLE);
1157 WifiPhyState::IDLE);
1161 WifiPhyState::CCA_BUSY);
1167 WifiPhyState::CCA_BUSY);
1171 WifiPhyState::IDLE);
1198 WifiPhyState::IDLE);
1204 WifiPhyState::IDLE);
1208 WifiPhyState::CCA_BUSY);
1214 WifiPhyState::CCA_BUSY);
1228 WifiPhyState::IDLE);
1255 WifiPhyState::IDLE);
1259 WifiPhyState::CCA_BUSY);
1265 WifiPhyState::CCA_BUSY);
1269 WifiPhyState::IDLE);
1297 WifiPhyState::IDLE);
1301 WifiPhyState::CCA_BUSY);
1306 WifiPhyState::CCA_BUSY);
1310 WifiPhyState::IDLE);
1337 WifiPhyState::IDLE);
1341 WifiPhyState::CCA_BUSY);
1347 WifiPhyState::CCA_BUSY);
1360 WifiPhyState::IDLE);
1387 WifiPhyState::IDLE);
1391 WifiPhyState::CCA_BUSY);
1396 WifiPhyState::CCA_BUSY);
1400 WifiPhyState::IDLE);
1428 WifiPhyState::IDLE);
1432 WifiPhyState::CCA_BUSY);
1438 WifiPhyState::CCA_BUSY);
1451 WifiPhyState::IDLE);
1475 WifiPhyState::IDLE);
1479 WifiPhyState::CCA_BUSY);
1485 WifiPhyState::CCA_BUSY);
1498 WifiPhyState::IDLE);
1524 WifiPhyState::CCA_BUSY);
1552 WifiPhyState::CCA_BUSY);
1579 WifiPhyState::IDLE);
1583 WifiPhyState::CCA_BUSY);
1589 WifiPhyState::CCA_BUSY);
1603 WifiPhyState::CCA_BUSY);
1630 WifiPhyState::IDLE);
1635 WifiPhyState::CCA_BUSY);
1662 WifiPhyState::IDLE);
1668 WifiPhyState::IDLE);
1672 WifiPhyState::CCA_BUSY);
1678 WifiPhyState::CCA_BUSY);
1692 WifiPhyState::IDLE);
1791 void DoRun()
override;
1813 std::vector<bool> statusPerMpdu);
1849 :
TestCase(
"Simple frame capture model test"),
1850 m_rxSuccess1000B(false),
1851 m_rxSuccess1500B(false),
1852 m_rxDropped1000B(false),
1853 m_rxDropped1500B(false),
1883 txParams->psd = txPowerSpectrum;
1884 txParams->txPhy =
nullptr;
1885 txParams->duration = txDuration;
1886 txParams->ppdu = ppdu;
1895 std::vector<bool> statusPerMpdu)
1898 NS_ASSERT(!psdu->IsAggregate() || psdu->IsSingle());
1899 if (psdu->GetSize() == 1030)
1903 else if (psdu->GetSize() == 1530)
1913 if (p->GetSize() == 1030)
1917 else if (p->GetSize() == 1530)
1964 m_phy = CreateObject<SpectrumWifiPhy>();
1977 CreateObject<ThresholdPreambleDetectionModel>();
1978 preambleDetectionModel->SetAttribute(
"Threshold",
DoubleValue(2));
1982 frameCaptureModel->SetAttribute(
"Margin",
DoubleValue(5));
1999 int64_t streamNumber = 2;
2000 double rxPowerDbm = -30;
2101 void DoRun()
override;
2118 :
TestCase(
"PHY headers reception test"),
2148 txParams->psd = txPowerSpectrum;
2149 txParams->txPhy =
nullptr;
2150 txParams->duration = txDuration;
2151 txParams->ppdu = ppdu;
2171 currentState = state->GetState();
2175 "PHY State " << currentState <<
" does not match expected state "
2187 m_phy = CreateObject<SpectrumWifiPhy>();
2208 int64_t streamNumber = 0;
2212 double rxPowerDbm = -50;
2227 WifiPhyState::CCA_BUSY);
2233 WifiPhyState::CCA_BUSY);
2239 WifiPhyState::CCA_BUSY);
2243 WifiPhyState::IDLE);
2258 WifiPhyState::CCA_BUSY);
2264 WifiPhyState::CCA_BUSY);
2279 WifiPhyState::CCA_BUSY);
2283 WifiPhyState::CCA_BUSY);
2287 WifiPhyState::IDLE);
2303 WifiPhyState::CCA_BUSY);
2310 WifiPhyState::CCA_BUSY);
2314 WifiPhyState::CCA_BUSY);
2318 WifiPhyState::CCA_BUSY);
2322 WifiPhyState::IDLE);
2336 WifiPhyState::CCA_BUSY);
2342 WifiPhyState::CCA_BUSY);
2357 WifiPhyState::CCA_BUSY);
2361 WifiPhyState::CCA_BUSY);
2365 WifiPhyState::IDLE);
2383 WifiPhyState::CCA_BUSY);
2389 WifiPhyState::CCA_BUSY);
2404 WifiPhyState::CCA_BUSY);
2410 WifiPhyState::CCA_BUSY);
2416 WifiPhyState::CCA_BUSY);
2430 WifiPhyState::CCA_BUSY);
2445 WifiPhyState::CCA_BUSY);
2451 WifiPhyState::CCA_BUSY);
2457 WifiPhyState::CCA_BUSY);
2463 WifiPhyState::CCA_BUSY);
2477 WifiPhyState::CCA_BUSY);
2483 WifiPhyState::CCA_BUSY);
2489 WifiPhyState::CCA_BUSY);
2503 WifiPhyState::CCA_BUSY);
2526 void DoRun()
override;
2538 std::vector<bool> statusPerMpdu);
2627 :
TestCase(
"A-MPDU reception test"),
2628 m_rxSuccessBitmapAmpdu1(0),
2629 m_rxSuccessBitmapAmpdu2(0),
2630 m_rxFailureBitmapAmpdu1(0),
2631 m_rxFailureBitmapAmpdu2(0),
2632 m_rxDroppedBitmapAmpdu1(0),
2633 m_rxDroppedBitmapAmpdu2(0),
2658 std::vector<bool> statusPerMpdu)
2661 if (statusPerMpdu.empty())
2666 "Should have one receive status per MPDU");
2667 auto rxOkForMpdu = statusPerMpdu.begin();
2668 for (
auto mpdu = psdu->begin(); mpdu != psdu->end(); ++mpdu)
2689 else if (size == 1130)
2693 else if (size == 1230)
2697 else if (size == 1330)
2701 else if (size == 1430)
2705 else if (size == 1530)
2715 for (
auto mpdu = psdu->begin(); mpdu != psdu->end(); ++mpdu)
2728 else if (size == 1130)
2732 else if (size == 1230)
2736 else if (size == 1330)
2740 else if (size == 1430)
2744 else if (size == 1530)
2754 if (p->GetSize() == 1030)
2758 else if (p->GetSize() == 1130)
2762 else if (p->GetSize() == 1230)
2766 else if (p->GetSize() == 1330)
2770 else if (p->GetSize() == 1430)
2774 else if (p->GetSize() == 1530)
2785 "RX success bitmap for A-MPDU 1 is not as expected");
2793 "RX success bitmap for A-MPDU 2 is not as expected");
2801 "RX failure bitmap for A-MPDU 1 is not as expected");
2809 "RX failure bitmap for A-MPDU 2 is not as expected");
2817 "RX dropped bitmap for A-MPDU 1 is not as expected");
2825 "RX dropped bitmap for A-MPDU 2 is not as expected");
2835 currentState = state->GetState();
2838 "PHY State " << currentState <<
" does not match expected state "
2852 std::vector<Ptr<WifiMpdu>> mpduList;
2853 for (
size_t i = 0; i < 3; ++i)
2855 Ptr<Packet> p = Create<Packet>(referencePacketSize + i * 100);
2856 mpduList.push_back(Create<WifiMpdu>(p, hdr));
2872 txParams->psd = txPowerSpectrum;
2873 txParams->txPhy =
nullptr;
2874 txParams->duration = txDuration;
2875 txParams->ppdu = ppdu;
2884 m_phy = CreateObject<SpectrumWifiPhy>();
2898 CreateObject<ThresholdPreambleDetectionModel>();
2899 preambleDetectionModel->SetAttribute(
"Threshold",
DoubleValue(2));
2903 frameCaptureModel->SetAttribute(
"Margin",
DoubleValue(5));
2920 int64_t streamNumber = 1;
2921 double rxPowerDbm = -30;
4125 void DoRun()
override;
4130 :
TestCase(
"Check correct behavior when a STA is receiving a transmission using an unsupported "
4146 if (reason ==
RXING)
4148 std::cout <<
"Dropped a packet because already receiving" << std::endl;
4156 uint16_t m_nStations = 2;
4162 int64_t streamNumber = 100;
4165 wifiApNode.Create(1);
4168 wifiStaNodes.Create(m_nStations);
4172 spectrumChannel->AddPropagationLossModel(lossModel);
4174 CreateObject<ConstantSpeedPropagationDelayModel>();
4175 spectrumChannel->SetPropagationDelayModel(delayModel);
4178 phy.SetChannel(spectrumChannel);
4183 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
4186 mac.SetType(
"ns3::StaWifiMac",
4193 m_staDevices.
Add(wifi.Install(phy, mac, wifiStaNodes.Get(0)));
4195 m_staDevices.
Add(wifi.Install(phy, mac, wifiStaNodes.Get(1)));
4198 mac.SetType(
"ns3::ApWifiMac",
4205 "EnableBeaconJitter",
4208 m_apDevices = wifi.Install(phy, mac, wifiApNode);
4214 for (uint16_t i = 0; i < m_nStations; i++)
4216 dev = DynamicCast<WifiNetDevice>(m_staDevices.
Get(i));
4220 Ssid(
"wifi-backoff-ssid"));
4224 wifi.AssignStreams(m_apDevices, streamNumber);
4229 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
4230 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
4231 positionAlloc->Add(Vector(0.0, 1.0, 0.0));
4232 positionAlloc->Add(Vector(-1.0, 0.0, 0.0));
4233 mobility.SetPositionAllocator(positionAlloc);
4235 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
4236 mobility.Install(wifiApNode);
4237 mobility.Install(wifiStaNodes);
4240 dev = DynamicCast<WifiNetDevice>(m_apDevices.
Get(0));
4242 dev->GetMac()->GetAttribute(
"BE_Txop", ptr);
4245 packetSocket.
Install(wifiApNode);
4246 packetSocket.
Install(wifiStaNodes);
4249 for (uint16_t i = 0; i < m_nStations; i++)
4259 client->SetRemote(socket);
4260 wifiStaNodes.Get(i)->AddApplication(client);
4262 client->SetStopTime(
Seconds(1.0));
4264 legacyStaClient->SetAttribute(
"PacketSize",
UintegerValue(1500));
4265 legacyStaClient->SetAttribute(
"MaxPackets",
UintegerValue(200));
4267 legacyStaClient->SetRemote(socket);
4268 wifiStaNodes.Get(i)->AddApplication(legacyStaClient);
4270 legacyStaClient->SetStopTime(
Seconds(1.0));
4272 server->SetLocal(socket);
4273 wifiApNode.Get(0)->AddApplication(server);
4274 server->SetStartTime(
Seconds(0.0));
4275 server->SetStopTime(
Seconds(1.0));
4279 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyRxDrop",
4315 void DoRun()
override;
4336 std::vector<bool> statusPerMpdu);
4365 std::optional<Time> expectedLastRxSucceeded,
4366 std::optional<Time> expectedLastRxFailed,
4367 std::optional<Time> expectedLastRxDropped);
4381 :
TestCase(
"Check correct behavior when a STA is receiving a transmission using an unsupported "
4383 m_countRxSuccess(0),
4384 m_countRxFailure(0),
4385 m_countRxDropped(0),
4386 m_lastRxSucceeded(
std::nullopt),
4387 m_lastRxFailed(
std::nullopt),
4388 m_lastRxDropped(
std::nullopt)
4394 uint16_t centerFreqMhz,
4395 uint16_t bandwidthMhz)
4400 auto pkt = Create<Packet>(1000);
4409 auto ppdu = Create<HePpdu>(psdu, txVector, centerFreqMhz, txDuration,
WIFI_PHY_BAND_5GHZ, 0);
4411 auto txPowerSpectrum =
4417 auto txParams = Create<WifiSpectrumSignalParameters>();
4418 txParams->psd = txPowerSpectrum;
4419 txParams->txPhy =
nullptr;
4420 txParams->duration = txDuration;
4421 txParams->ppdu = ppdu;
4422 txParams->txWidth = bandwidthMhz;
4431 std::vector<bool> statusPerMpdu)
4459 std::optional<Time> expectedLastRxSucceeded,
4460 std::optional<Time> expectedLastRxFailed,
4461 std::optional<Time> expectedLastRxDropped)
4464 expectedCountRxSuccess,
4465 "Didn't receive right number of successful packets");
4468 expectedCountRxFailure,
4469 "Didn't receive right number of unsuccessful packets");
4472 expectedCountRxDropped,
4473 "Didn't receive right number of dropped packets");
4475 if (expectedCountRxSuccess > 0)
4478 NS_ASSERT(expectedLastRxSucceeded.has_value());
4480 expectedLastRxSucceeded.value(),
4481 "Didn't receive the last successful packet at the expected time");
4484 if (expectedCountRxFailure > 0)
4487 NS_ASSERT(expectedLastRxFailed.has_value());
4489 expectedLastRxFailed.value(),
4490 "Didn't receive the last unsuccessful packet at the expected time");
4493 if (expectedCountRxDropped > 0)
4496 NS_ASSERT(expectedLastRxDropped.has_value());
4498 expectedLastRxDropped.value(),
4499 "Didn't drop the last filtered packet at the expected time");
4506 m_phy = CreateObject<SpectrumWifiPhy>();
4508 auto interferenceHelper = CreateObject<InterferenceHelper>();
4510 auto error = CreateObject<NistErrorRateModel>();
4534 int64_t streamNumber = 0;
4559 heSigAExpectedRxTime);
4582 void DoRun()
override;
4607 uint16_t phyCenterFreqMhz,
4609 uint16_t ppduCenterFreqMhz,
4610 bool expectedP20Overlap,
4611 bool expectedP20Covered);
4617 :
TestCase(
"Check correct detection of whether P20 is fully covered (hence it can be received) "
4618 "or overlaps with the bandwidth of an incoming PPDU")
4625 [[maybe_unused]]
auto [channelNumber, centerFreq, channelWidth, type, phyBand] =
4631 auto pkt = Create<Packet>(1000);
4634 auto psdu = Create<WifiPsdu>(pkt, hdr);
4637 return Create<HePpdu>(psdu, txVector, ppduCenterFreqMhz, txDuration, band, 0);
4643 m_phy = CreateObject<SpectrumWifiPhy>();
4645 auto interferenceHelper = CreateObject<InterferenceHelper>();
4647 auto error = CreateObject<NistErrorRateModel>();
4660 uint16_t phyCenterFreqMhz,
4662 uint16_t ppduCenterFreqMhz,
4663 bool expectedP20Overlap,
4664 bool expectedP20Covered)
4666 [[maybe_unused]]
const auto [channelNumber, centerFreq, channelWidth, type, phyBand] =
4671 auto p20MinFreq = p20CenterFreq - 10;
4672 auto p20MaxFreq = p20CenterFreq + 10;
4674 auto ppdu =
CreatePpdu(band, ppduCenterFreqMhz);
4676 auto p20Overlap = ppdu->DoesOverlapChannel(p20MinFreq, p20MaxFreq);
4679 "PPDU is " << (expectedP20Overlap ?
"expected" :
"not expected")
4680 <<
" to overlap with the P20");
4687 .GetChannelWidth());
4690 "PPDU is " << (expectedP20Covered ?
"expected" :
"not expected")
4691 <<
" to cover the whole P20");
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 unsuccessfuly received MPDUs in A-MPDU #1
uint8_t m_rxFailureBitmapAmpdu2
bitmap of unsuccessfuly received MPDUs in A-MPDU #2
void RxDropped(Ptr< const Packet > p, WifiPhyRxfailureReason reason)
RX dropped function.
~TestAmpduReception() override
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 DoTeardown() override
Implementation to do any local setup required for this TestCase.
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
Ptr< SpectrumWifiPhy > m_phy
Phy.
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...
void RunOne(WifiPhyBand band, uint16_t phyCenterFreqMhz, uint8_t p20Index, uint16_t ppduCenterFreqMhz, bool expectedP20Overlap, bool expectedP20Covered)
Run one function.
Ptr< SpectrumWifiPhy > m_phy
PHY.
TestPrimary20CoveredByPpdu()
void DoSetup() override
Implementation to do any local setup required for this TestCase.
void DoRun() override
Implementation to actually run this TestCase.
Ptr< HePpdu > CreatePpdu(WifiPhyBand band, uint16_t ppduCenterFreqMhz)
Function to create a PPDU.
void DoTeardown() override
Implementation to do any local setup required for this TestCase.
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 SendPacket(double rxPowerDbm, uint32_t packetSize)
Send packet function.
~TestSimpleFrameCaptureModel() override
void Reset()
Reset function.
Ptr< SpectrumWifiPhy > m_phy
Phy.
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.
uint64_t m_uid
the UID to use for the PPDU
void DoTeardown() override
Implementation to do any local setup required for this TestCase.
TestSimpleFrameCaptureModel()
bool m_rxDropped1000B
count dropped packets with 1000B payload
Preamble detection test w/o frame capture.
TestThresholdPreambleDetectionWithFrameCapture()
void CheckPhyState(WifiPhyState expectedState)
Schedule now to check the PHY state.
Ptr< SpectrumWifiPhy > m_phy
Phy.
void SendPacket(double rxPowerDbm)
Send packet function.
void RxFailure(Ptr< const WifiPsdu > psdu)
Spectrum wifi receive failure function.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
~TestThresholdPreambleDetectionWithFrameCapture() override
void DoTeardown() 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 DoCheckPhyState(WifiPhyState expectedState)
Check the PHY state now.
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.
uint64_t m_uid
the UID to use for the PPDU
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 DoCheckPhyState(WifiPhyState expectedState)
Check the PHY state now.
uint64_t m_uid
the UID to use for the PPDU
void DoTeardown() override
Implementation to do any local setup required for this TestCase.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
void SendPacket(double rxPowerDbm)
Send packet function.
Ptr< SpectrumWifiPhy > m_phy
Phy.
uint32_t m_countRxSuccess
count RX success
~TestThresholdPreambleDetectionWithoutFrameCapture() override
void CheckPhyState(WifiPhyState expectedState)
Schedule now to check the PHY state.
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.
TestUnsupportedBandwidthReception()
std::optional< Time > m_lastRxDropped
time of last RX drop, if any
std::optional< Time > m_lastRxSucceeded
time of last RX success, if any
Ptr< SpectrumWifiPhy > m_phy
PHY.
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(WifiPhyBand band, uint16_t centerFreqMhz, uint16_t bandwidthMhz)
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.
~TestUnsupportedModulationReception() override
void Dropped(std::string context, Ptr< const Packet > packet, WifiPhyRxfailureReason reason)
Callback invoked when PHY drops an incoming packet.
TestUnsupportedModulationReception()
Constructor.
uint16_t m_dropped
number of packets dropped by the AP because it was already receiving
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 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 StartRx(Ptr< SpectrumSignalParameters > rxParams)
Input method for delivering a signal from the spectrum channel and low-level PHY interface to this Sp...
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 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 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.
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.