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;
167 currentState = state->GetState();
171 "PHY State " << currentState <<
" does not match expected state "
181 m_phy = CreateObject<SpectrumWifiPhy>();
191 node->AddDevice(dev);
225 std::vector<bool> statusPerMpdu);
235 void DoRun()
override;
248 "Threshold preamble detection model test when no frame capture model is applied")
257 expectedSuccessCount,
258 "Didn't receive right number of successful packets");
260 expectedFailureCount,
261 "Didn't receive right number of unsuccessful packets");
268 std::vector<bool> statusPerMpdu)
292 CreateObject<ThresholdPreambleDetectionModel>();
293 preambleDetectionModel->SetAttribute(
"Threshold",
DoubleValue(4));
294 preambleDetectionModel->SetAttribute(
"MinimumRssi",
DoubleValue(-82));
303 int64_t streamNumber = 0;
307 double rxPowerDbm = -50;
328 WifiPhyState::CCA_BUSY);
334 WifiPhyState::CCA_BUSY);
382 WifiPhyState::CCA_BUSY);
388 WifiPhyState::CCA_BUSY);
428 WifiPhyState::CCA_BUSY);
434 WifiPhyState::CCA_BUSY);
473 WifiPhyState::CCA_BUSY);
479 WifiPhyState::CCA_BUSY);
494 WifiPhyState::CCA_BUSY);
498 WifiPhyState::CCA_BUSY);
537 WifiPhyState::CCA_BUSY);
543 WifiPhyState::CCA_BUSY);
578 WifiPhyState::CCA_BUSY);
584 WifiPhyState::CCA_BUSY);
627 WifiPhyState::CCA_BUSY);
659 WifiPhyState::CCA_BUSY);
694 WifiPhyState::CCA_BUSY);
700 WifiPhyState::CCA_BUSY);
714 WifiPhyState::CCA_BUSY);
773 WifiPhyState::CCA_BUSY);
779 WifiPhyState::CCA_BUSY);
841 std::vector<bool> statusPerMpdu);
851 void DoRun()
override;
863 "Threshold preamble detection model test when simple frame capture model is applied")
872 expectedSuccessCount,
873 "Didn't receive right number of successful packets");
875 expectedFailureCount,
876 "Didn't receive right number of unsuccessful packets");
883 std::vector<bool> statusPerMpdu)
907 CreateObject<ThresholdPreambleDetectionModel>();
908 preambleDetectionModel->SetAttribute(
"Threshold",
DoubleValue(4));
909 preambleDetectionModel->SetAttribute(
"MinimumRssi",
DoubleValue(-82));
913 frameCaptureModel->SetAttribute(
"Margin",
DoubleValue(5));
923 int64_t streamNumber = 1;
927 double rxPowerDbm = -50;
948 WifiPhyState::CCA_BUSY);
954 WifiPhyState::CCA_BUSY);
1002 WifiPhyState::CCA_BUSY);
1008 WifiPhyState::CCA_BUSY);
1012 WifiPhyState::IDLE);
1044 WifiPhyState::IDLE);
1048 WifiPhyState::CCA_BUSY);
1054 WifiPhyState::CCA_BUSY);
1058 WifiPhyState::IDLE);
1089 WifiPhyState::IDLE);
1093 WifiPhyState::CCA_BUSY);
1099 WifiPhyState::CCA_BUSY);
1114 WifiPhyState::CCA_BUSY);
1118 WifiPhyState::CCA_BUSY);
1122 WifiPhyState::IDLE);
1152 WifiPhyState::IDLE);
1157 WifiPhyState::IDLE);
1161 WifiPhyState::CCA_BUSY);
1167 WifiPhyState::CCA_BUSY);
1171 WifiPhyState::IDLE);
1202 WifiPhyState::IDLE);
1208 WifiPhyState::IDLE);
1212 WifiPhyState::CCA_BUSY);
1218 WifiPhyState::CCA_BUSY);
1232 WifiPhyState::IDLE);
1263 WifiPhyState::IDLE);
1267 WifiPhyState::CCA_BUSY);
1273 WifiPhyState::CCA_BUSY);
1277 WifiPhyState::IDLE);
1309 WifiPhyState::IDLE);
1313 WifiPhyState::CCA_BUSY);
1318 WifiPhyState::CCA_BUSY);
1322 WifiPhyState::IDLE);
1353 WifiPhyState::IDLE);
1357 WifiPhyState::CCA_BUSY);
1363 WifiPhyState::CCA_BUSY);
1376 WifiPhyState::IDLE);
1407 WifiPhyState::IDLE);
1411 WifiPhyState::CCA_BUSY);
1416 WifiPhyState::CCA_BUSY);
1420 WifiPhyState::IDLE);
1452 WifiPhyState::IDLE);
1456 WifiPhyState::CCA_BUSY);
1462 WifiPhyState::CCA_BUSY);
1475 WifiPhyState::IDLE);
1501 WifiPhyState::IDLE);
1505 WifiPhyState::CCA_BUSY);
1511 WifiPhyState::CCA_BUSY);
1524 WifiPhyState::IDLE);
1554 WifiPhyState::CCA_BUSY);
1586 WifiPhyState::CCA_BUSY);
1617 WifiPhyState::IDLE);
1621 WifiPhyState::CCA_BUSY);
1627 WifiPhyState::CCA_BUSY);
1641 WifiPhyState::CCA_BUSY);
1672 WifiPhyState::IDLE);
1677 WifiPhyState::CCA_BUSY);
1708 WifiPhyState::IDLE);
1714 WifiPhyState::IDLE);
1718 WifiPhyState::CCA_BUSY);
1724 WifiPhyState::CCA_BUSY);
1738 WifiPhyState::IDLE);
1849 void DoRun()
override;
1865 std::vector<bool> statusPerMpdu);
1905 std::vector<bool> statusPerMpdu)
1908 NS_ASSERT(!psdu->IsAggregate() || psdu->IsSingle());
1909 if (psdu->GetSize() == 1030)
1913 else if (psdu->GetSize() == 1530)
1923 if (p->GetSize() == 1030)
1927 else if (p->GetSize() == 1530)
1976 CreateObject<ThresholdPreambleDetectionModel>();
1977 preambleDetectionModel->SetAttribute(
"Threshold",
DoubleValue(2));
1981 frameCaptureModel->SetAttribute(
"Margin",
DoubleValue(5));
1991 int64_t streamNumber = 2;
1992 double rxPowerDbm = -30;
2090 void DoRun()
override;
2103 int64_t streamNumber = 0;
2107 double rxPowerDbm = -50;
2129 WifiPhyState::CCA_BUSY);
2135 WifiPhyState::CCA_BUSY);
2141 WifiPhyState::CCA_BUSY);
2145 WifiPhyState::IDLE);
2167 WifiPhyState::CCA_BUSY);
2173 WifiPhyState::CCA_BUSY);
2188 WifiPhyState::CCA_BUSY);
2192 WifiPhyState::CCA_BUSY);
2196 WifiPhyState::IDLE);
2219 WifiPhyState::CCA_BUSY);
2226 WifiPhyState::CCA_BUSY);
2230 WifiPhyState::CCA_BUSY);
2234 WifiPhyState::CCA_BUSY);
2238 WifiPhyState::IDLE);
2259 WifiPhyState::CCA_BUSY);
2265 WifiPhyState::CCA_BUSY);
2280 WifiPhyState::CCA_BUSY);
2284 WifiPhyState::CCA_BUSY);
2288 WifiPhyState::IDLE);
2313 WifiPhyState::CCA_BUSY);
2319 WifiPhyState::CCA_BUSY);
2341 WifiPhyState::CCA_BUSY);
2347 WifiPhyState::CCA_BUSY);
2353 WifiPhyState::CCA_BUSY);
2367 WifiPhyState::CCA_BUSY);
2389 WifiPhyState::CCA_BUSY);
2395 WifiPhyState::CCA_BUSY);
2401 WifiPhyState::CCA_BUSY);
2407 WifiPhyState::CCA_BUSY);
2428 WifiPhyState::CCA_BUSY);
2434 WifiPhyState::CCA_BUSY);
2440 WifiPhyState::CCA_BUSY);
2454 WifiPhyState::CCA_BUSY);
2473 void DoRun()
override;
2485 std::vector<bool> statusPerMpdu);
2589 std::vector<bool> statusPerMpdu)
2592 if (statusPerMpdu.empty())
2597 "Should have one receive status per MPDU");
2598 auto rxOkForMpdu = statusPerMpdu.begin();
2599 for (
auto mpdu = psdu->begin(); mpdu != psdu->end(); ++mpdu)
2620 else if (size == 1130)
2624 else if (size == 1230)
2628 else if (size == 1330)
2632 else if (size == 1430)
2636 else if (size == 1530)
2646 for (
auto mpdu = psdu->begin(); mpdu != psdu->end(); ++mpdu)
2659 else if (size == 1130)
2663 else if (size == 1230)
2667 else if (size == 1330)
2671 else if (size == 1430)
2675 else if (size == 1530)
2685 if (p->GetSize() == 1030)
2689 else if (p->GetSize() == 1130)
2693 else if (p->GetSize() == 1230)
2697 else if (p->GetSize() == 1330)
2701 else if (p->GetSize() == 1430)
2705 else if (p->GetSize() == 1530)
2716 "RX success bitmap for A-MPDU 1 is not as expected");
2724 "RX success bitmap for A-MPDU 2 is not as expected");
2732 "RX failure bitmap for A-MPDU 1 is not as expected");
2740 "RX failure bitmap for A-MPDU 2 is not as expected");
2748 "RX dropped bitmap for A-MPDU 1 is not as expected");
2756 "RX dropped bitmap for A-MPDU 2 is not as expected");
2766 currentState = state->GetState();
2769 "PHY State " << currentState <<
" does not match expected state "
2783 std::vector<Ptr<WifiMpdu>> mpduList;
2784 for (
size_t i = 0; i < 3; ++i)
2786 Ptr<Packet> p = Create<Packet>(referencePacketSize + i * 100);
2787 mpduList.push_back(Create<WifiMpdu>(p, hdr));
2803 txParams->psd = txPowerSpectrum;
2804 txParams->txPhy =
nullptr;
2805 txParams->duration = txDuration;
2806 txParams->ppdu = ppdu;
2822 CreateObject<ThresholdPreambleDetectionModel>();
2823 preambleDetectionModel->SetAttribute(
"Threshold",
DoubleValue(2));
2827 frameCaptureModel->SetAttribute(
"Margin",
DoubleValue(5));
2837 int64_t streamNumber = 1;
2838 double rxPowerDbm = -30;
4027 void DoRun()
override;
4045 :
TestCase(
"Check correct behavior when a STA is receiving a transmission using an unsupported "
4056 if (reason ==
RXING)
4058 std::cout <<
"Dropped a packet because already receiving" << std::endl;
4066 uint16_t m_nStations = 2;
4070 int64_t streamNumber = 100;
4073 wifiApNode.Create(1);
4076 wifiStaNodes.Create(m_nStations);
4080 spectrumChannel->AddPropagationLossModel(lossModel);
4082 CreateObject<ConstantSpeedPropagationDelayModel>();
4083 spectrumChannel->SetPropagationDelayModel(delayModel);
4086 phy.SetChannel(spectrumChannel);
4091 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
4094 mac.SetType(
"ns3::StaWifiMac",
4101 m_staDevices.
Add(wifi.Install(phy, mac, wifiStaNodes.Get(0)));
4103 m_staDevices.
Add(wifi.Install(phy, mac, wifiStaNodes.Get(1)));
4106 mac.SetType(
"ns3::ApWifiMac",
4113 "EnableBeaconJitter",
4116 m_apDevices = wifi.Install(phy, mac, wifiApNode);
4122 for (uint16_t i = 0; i < m_nStations; i++)
4124 dev = DynamicCast<WifiNetDevice>(m_staDevices.
Get(i));
4128 Ssid(
"wifi-backoff-ssid"));
4132 wifi.AssignStreams(m_apDevices, streamNumber);
4137 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
4138 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
4139 positionAlloc->Add(Vector(0.0, 1.0, 0.0));
4140 positionAlloc->Add(Vector(-1.0, 0.0, 0.0));
4141 mobility.SetPositionAllocator(positionAlloc);
4143 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
4144 mobility.Install(wifiApNode);
4145 mobility.Install(wifiStaNodes);
4148 dev = DynamicCast<WifiNetDevice>(m_apDevices.
Get(0));
4150 dev->GetMac()->GetAttribute(
"BE_Txop", ptr);
4153 packetSocket.
Install(wifiApNode);
4154 packetSocket.
Install(wifiStaNodes);
4157 for (uint16_t i = 0; i < m_nStations; i++)
4167 client->SetRemote(socket);
4168 wifiStaNodes.Get(i)->AddApplication(client);
4170 client->SetStopTime(
Seconds(1.0));
4172 legacyStaClient->SetAttribute(
"PacketSize",
UintegerValue(1500));
4173 legacyStaClient->SetAttribute(
"MaxPackets",
UintegerValue(200));
4175 legacyStaClient->SetRemote(socket);
4176 wifiStaNodes.Get(i)->AddApplication(legacyStaClient);
4178 legacyStaClient->SetStopTime(
Seconds(1.0));
4180 server->SetLocal(socket);
4181 wifiApNode.Get(0)->AddApplication(server);
4182 server->SetStartTime(
Seconds(0.0));
4183 server->SetStopTime(
Seconds(1.0));
4187 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyRxDrop",
4223 void DoRun()
override;
4231 void SendPpdu(uint16_t centerFreqMhz, uint16_t bandwidthMhz);
4243 std::vector<bool> statusPerMpdu);
4272 std::optional<Time> expectedLastRxSucceeded,
4273 std::optional<Time> expectedLastRxFailed,
4274 std::optional<Time> expectedLastRxDropped);
4289 :
TestCase(
"Check correct behavior when a STA is receiving a transmission using an unsupported "
4291 m_countRxSuccess(0),
4292 m_countRxFailure(0),
4293 m_countRxDropped(0),
4294 m_lastRxSucceeded(
std::nullopt),
4295 m_lastRxFailed(
std::nullopt),
4296 m_lastRxDropped(
std::nullopt)
4306 auto pkt = Create<Packet>(1000);
4318 auto txPowerSpectrum =
4324 auto txParams = Create<WifiSpectrumSignalParameters>();
4325 txParams->psd = txPowerSpectrum;
4326 txParams->txPhy =
nullptr;
4327 txParams->duration = txDuration;
4328 txParams->ppdu = ppdu;
4337 std::vector<bool> statusPerMpdu)
4365 std::optional<Time> expectedLastRxSucceeded,
4366 std::optional<Time> expectedLastRxFailed,
4367 std::optional<Time> expectedLastRxDropped)
4370 expectedCountRxSuccess,
4371 "Didn't receive right number of successful packets");
4374 expectedCountRxFailure,
4375 "Didn't receive right number of unsuccessful packets");
4378 expectedCountRxDropped,
4379 "Didn't receive right number of dropped packets");
4381 if (expectedCountRxSuccess > 0)
4384 NS_ASSERT(expectedLastRxSucceeded.has_value());
4386 expectedLastRxSucceeded.value(),
4387 "Didn't receive the last successful packet at the expected time");
4390 if (expectedCountRxFailure > 0)
4393 NS_ASSERT(expectedLastRxFailed.has_value());
4395 expectedLastRxFailed.value(),
4396 "Didn't receive the last unsuccessful packet at the expected time");
4399 if (expectedCountRxDropped > 0)
4402 NS_ASSERT(expectedLastRxDropped.has_value());
4404 expectedLastRxDropped.value(),
4405 "Didn't drop the last filtered packet at the expected time");
4415 m_rxPhy = CreateObject<SpectrumWifiPhy>();
4416 auto rxInterferenceHelper = CreateObject<InterferenceHelper>();
4418 auto rxErrorRateModel = CreateObject<NistErrorRateModel>();
4424 node->AddDevice(dev);
4434 m_txPhy = CreateObject<SpectrumWifiPhy>();
4435 auto txInterferenceHelper = CreateObject<InterferenceHelper>();
4437 auto txErrorRateModel = CreateObject<NistErrorRateModel>();
4459 int64_t streamNumber = 0;
4480 heSigAExpectedRxTime);
4503 void DoRun()
override;
4527 uint16_t phyCenterFreqMhz,
4529 uint16_t ppduCenterFreqMhz,
4530 bool expectedP20Overlap,
4531 bool expectedP20Covered);
4538 :
TestCase(
"Check correct detection of whether P20 is fully covered (hence it can be received) "
4539 "or overlaps with the bandwidth of an incoming PPDU")
4546 [[maybe_unused]]
auto [channelNumber, centerFreq, channelWidth, type, phyBand] =
4556 auto pkt = Create<Packet>(1000);
4559 auto psdu = Create<WifiPsdu>(pkt, hdr);
4568 m_rxPhy = CreateObject<SpectrumWifiPhy>();
4569 auto rxInterferenceHelper = CreateObject<InterferenceHelper>();
4571 auto rxErrorRateModel = CreateObject<NistErrorRateModel>();
4576 m_txPhy = CreateObject<SpectrumWifiPhy>();
4577 auto txInterferenceHelper = CreateObject<InterferenceHelper>();
4579 auto txErrorRateModel = CreateObject<NistErrorRateModel>();
4596 uint16_t phyCenterFreqMhz,
4598 uint16_t ppduCenterFreqMhz,
4599 bool expectedP20Overlap,
4600 bool expectedP20Covered)
4602 [[maybe_unused]]
const auto [channelNumber, centerFreq, channelWidth, type, phyBand] =
4608 auto p20MinFreq = p20CenterFreq - 10;
4609 auto p20MaxFreq = p20CenterFreq + 10;
4613 auto p20Overlap = ppdu->DoesOverlapChannel(p20MinFreq, p20MaxFreq);
4616 "PPDU is " << (expectedP20Overlap ?
"expected" :
"not expected")
4617 <<
" to overlap with the P20");
4623 "PPDU is " << (expectedP20Covered ?
"expected" :
"not expected")
4624 <<
" to cover the whole P20");
4728 void DoRun()
override;
4739 uint16_t expectedValue)
4740 :
TestCase(
"Test for early discard of signal in single-model-spectrum-channel::StartTx()"),
4742 m_expectedValue(expectedValue)
4767 "Received a different amount of packets than expected.");
4772 uint32_t senderNodeId [[maybe_unused]],
4773 double rxPower [[maybe_unused]],
4774 Time duration [[maybe_unused]])
4776 NS_LOG_FUNCTION(
this << signalType << senderNodeId << rxPower << duration);
4787 channel->AddSpectrumTransmitFilter(wifiFilter);
4791 m_tx = CreateObject<SpectrumWifiPhy>();
4796 Ptr<Node> nodeRx = CreateObject<Node>();
4798 m_rx = CreateObject<SpectrumWifiPhy>();
4818 node->AddDevice(dev);
4819 devRx->SetPhy(
m_rx);
4820 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.