9#include "ns3/ampdu-tag.h"
10#include "ns3/ap-wifi-mac.h"
11#include "ns3/boolean.h"
12#include "ns3/config.h"
13#include "ns3/double.h"
14#include "ns3/he-phy.h"
15#include "ns3/he-ppdu.h"
16#include "ns3/interference-helper.h"
18#include "ns3/mobility-helper.h"
19#include "ns3/mpdu-aggregator.h"
20#include "ns3/multi-model-spectrum-channel.h"
21#include "ns3/nist-error-rate-model.h"
22#include "ns3/packet-socket-address.h"
23#include "ns3/packet-socket-client.h"
24#include "ns3/packet-socket-helper.h"
25#include "ns3/packet-socket-server.h"
26#include "ns3/pointer.h"
27#include "ns3/rng-seed-manager.h"
28#include "ns3/simple-frame-capture-model.h"
29#include "ns3/single-model-spectrum-channel.h"
30#include "ns3/spectrum-wifi-helper.h"
31#include "ns3/spectrum-wifi-phy.h"
33#include "ns3/threshold-preamble-detection-model.h"
34#include "ns3/wifi-bandwidth-filter.h"
35#include "ns3/wifi-mac-header.h"
36#include "ns3/wifi-mpdu.h"
37#include "ns3/wifi-net-device.h"
38#include "ns3/wifi-ns3-constants.h"
39#include "ns3/wifi-psdu.h"
40#include "ns3/wifi-spectrum-phy-interface.h"
41#include "ns3/wifi-spectrum-signal-parameters.h"
42#include "ns3/wifi-spectrum-value-helper.h"
43#include "ns3/wifi-utils.h"
141 txParams->psd = txPowerSpectrum;
142 txParams->txPhy =
nullptr;
143 txParams->duration = txDuration;
144 txParams->ppdu = ppdu;
146 m_phy->StartRx(txParams,
nullptr);
162 m_phy->GetAttribute(
"State", ptr);
164 currentState = state->GetState();
168 "PHY State " << currentState <<
" does not match expected state "
180 m_phy->SetInterferenceHelper(interferenceHelper);
182 m_phy->SetErrorRateModel(error);
183 m_phy->SetDevice(dev);
184 m_phy->AddChannel(spectrumChannel);
188 node->AddDevice(dev);
222 const std::vector<bool>& statusPerMpdu);
232 void DoRun()
override;
245 "Threshold preamble detection model test when no frame capture model is applied")
254 expectedSuccessCount,
255 "Didn't receive right number of successful packets");
257 expectedFailureCount,
258 "Didn't receive right number of unsuccessful packets");
265 const std::vector<bool>& statusPerMpdu)
283 m_phy->SetReceiveOkCallback(
285 m_phy->SetReceiveErrorCallback(
290 preambleDetectionModel->SetAttribute(
"Threshold",
DoubleValue(4));
291 preambleDetectionModel->SetAttribute(
"MinimumRssi",
DoubleValue(-82));
292 m_phy->SetPreambleDetectionModel(preambleDetectionModel);
300 int64_t streamNumber = 0;
301 m_phy->AssignStreams(streamNumber);
554 rxPower =
dBm_u{-70};
753 rxPower =
dBm_u{-81};
792 rxPower =
dBm_u{-83};
838 const std::vector<bool>& statusPerMpdu);
848 void DoRun()
override;
860 "Threshold preamble detection model test when simple frame capture model is applied")
869 expectedSuccessCount,
870 "Didn't receive right number of successful packets");
872 expectedFailureCount,
873 "Didn't receive right number of unsuccessful packets");
880 const std::vector<bool>& statusPerMpdu)
898 m_phy->SetReceiveOkCallback(
900 m_phy->SetReceiveErrorCallback(
905 preambleDetectionModel->SetAttribute(
"Threshold",
DoubleValue(4));
906 preambleDetectionModel->SetAttribute(
"MinimumRssi",
DoubleValue(-82));
907 m_phy->SetPreambleDetectionModel(preambleDetectionModel);
910 frameCaptureModel->SetAttribute(
"Margin",
DoubleValue(5));
912 m_phy->SetFrameCaptureModel(frameCaptureModel);
920 int64_t streamNumber = 1;
921 m_phy->AssignStreams(streamNumber);
1142 rxPower +
dB_u{3.0},
1192 rxPower +
dB_u{6.0},
1396 rxPower +
dB_u{3.0},
1441 rxPower +
dB_u{6.0},
1481 rxPower =
dBm_u{-70};
1662 rxPower +
dB_u{3.0},
1698 rxPower +
dB_u{6.0},
1743 rxPower =
dBm_u{-50};
1755 rxPower +
dB_u{50.0},
1776 rxPower +
dB_u{10.0},
1797 rxPower +
dB_u{50.0},
1818 rxPower +
dB_u{10.0},
1846 void DoRun()
override;
1862 const std::vector<bool>& statusPerMpdu);
1902 const std::vector<bool>& statusPerMpdu)
1905 NS_ASSERT(!psdu->IsAggregate() || psdu->IsSingle());
1906 if (psdu->GetSize() == 1030)
1910 else if (psdu->GetSize() == 1530)
1920 if (p->GetSize() == 1030)
1924 else if (p->GetSize() == 1530)
1969 m_phy->TraceConnectWithoutContext(
"PhyRxDrop",
1974 preambleDetectionModel->SetAttribute(
"Threshold",
DoubleValue(2));
1975 m_phy->SetPreambleDetectionModel(preambleDetectionModel);
1978 frameCaptureModel->SetAttribute(
"Margin",
DoubleValue(5));
1980 m_phy->SetFrameCaptureModel(frameCaptureModel);
1988 int64_t streamNumber = 2;
1990 m_phy->AssignStreams(streamNumber);
2043 rxPower +
dB_u{6.0},
2065 rxPower +
dB_u{6.0},
2087 void DoRun()
override;
2100 int64_t streamNumber = 0;
2101 m_phy->AssignStreams(streamNumber);
2268 rxPower =
dBm_u{-70};
2430 void DoRun()
override;
2442 const std::vector<bool>& statusPerMpdu);
2546 const std::vector<bool>& statusPerMpdu)
2549 if (statusPerMpdu.empty())
2554 "Should have one receive status per MPDU");
2555 auto rxOkForMpdu = statusPerMpdu.begin();
2556 for (
auto mpdu = psdu->begin(); mpdu != psdu->end(); ++mpdu)
2577 else if (size == 1130)
2581 else if (size == 1230)
2585 else if (size == 1330)
2589 else if (size == 1430)
2593 else if (size == 1530)
2603 for (
auto mpdu = psdu->begin(); mpdu != psdu->end(); ++mpdu)
2616 else if (size == 1130)
2620 else if (size == 1230)
2624 else if (size == 1330)
2628 else if (size == 1430)
2632 else if (size == 1530)
2642 if (p->GetSize() == 1030)
2646 else if (p->GetSize() == 1130)
2650 else if (p->GetSize() == 1230)
2654 else if (p->GetSize() == 1330)
2658 else if (p->GetSize() == 1430)
2662 else if (p->GetSize() == 1530)
2673 "RX success bitmap for A-MPDU 1 is not as expected");
2681 "RX success bitmap for A-MPDU 2 is not as expected");
2689 "RX failure bitmap for A-MPDU 1 is not as expected");
2697 "RX failure bitmap for A-MPDU 2 is not as expected");
2705 "RX dropped bitmap for A-MPDU 1 is not as expected");
2713 "RX dropped bitmap for A-MPDU 2 is not as expected");
2721 m_phy->GetAttribute(
"State", ptr);
2723 currentState = state->GetState();
2726 "PHY State " << currentState <<
" does not match expected state "
2747 std::vector<Ptr<WifiMpdu>> mpduList;
2748 for (
size_t i = 0; i < 3; ++i)
2768 txParams->psd = txPowerSpectrum;
2769 txParams->txPhy =
nullptr;
2770 txParams->duration = txDuration;
2771 txParams->ppdu = ppdu;
2773 m_phy->StartRx(txParams,
nullptr);
2783 m_phy->TraceConnectWithoutContext(
"PhyRxDrop",
2788 preambleDetectionModel->SetAttribute(
"Threshold",
DoubleValue(2));
2789 m_phy->SetPreambleDetectionModel(preambleDetectionModel);
2792 frameCaptureModel->SetAttribute(
"Margin",
DoubleValue(5));
2794 m_phy->SetFrameCaptureModel(frameCaptureModel);
2802 int64_t streamNumber = 1;
2804 m_phy->AssignStreams(streamNumber);
2816 rxPower -
dB_u{100},
2873 rxPower -
dB_u{100},
2916 rxPower -
dB_u{100},
2973 rxPower -
dB_u{100},
3016 rxPower -
dB_u{100},
3073 rxPower -
dB_u{100},
3115 rxPower -
dB_u{100},
3171 rxPower -
dB_u{100},
3221 rxPower +
dB_u{3.0},
3314 rxPower +
dB_u{3.0},
3371 rxPower +
dB_u{3.0},
3467 rxPower +
dB_u{3.0},
3524 rxPower +
dB_u{6.0},
3567 rxPower +
dB_u{6.0},
3624 rxPower +
dB_u{6.0},
3668 rxPower +
dB_u{6.0},
3775 rxPower +
dB_u{6.0},
3819 rxPower +
dB_u{6.0},
3992 void DoRun()
override;
4010 :
TestCase(
"Check correct behavior when a STA is receiving a transmission using an unsupported "
4021 if (reason ==
RXING)
4023 std::cout <<
"Dropped a packet because already receiving" << std::endl;
4031 uint16_t m_nStations = 2;
4035 int64_t streamNumber = 100;
4038 wifiApNode.Create(1);
4041 wifiStaNodes.Create(m_nStations);
4045 spectrumChannel->AddPropagationLossModel(lossModel);
4048 spectrumChannel->SetPropagationDelayModel(delayModel);
4051 phy.SetChannel(spectrumChannel);
4056 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
4059 mac.SetType(
"ns3::StaWifiMac",
4066 m_staDevices.
Add(wifi.Install(phy, mac, wifiStaNodes.Get(0)));
4068 m_staDevices.
Add(wifi.Install(phy, mac, wifiStaNodes.Get(1)));
4071 mac.SetType(
"ns3::ApWifiMac",
4078 "EnableBeaconJitter",
4081 m_apDevices = wifi.Install(phy, mac, wifiApNode);
4087 for (uint16_t i = 0; i < m_nStations; i++)
4093 Ssid(
"wifi-backoff-ssid"));
4102 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
4103 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
4104 positionAlloc->Add(Vector(0.0, 1.0, 0.0));
4105 positionAlloc->Add(Vector(-1.0, 0.0, 0.0));
4106 mobility.SetPositionAllocator(positionAlloc);
4108 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
4109 mobility.Install(wifiApNode);
4110 mobility.Install(wifiStaNodes);
4115 dev->GetMac()->GetAttribute(
"BE_Txop", ptr);
4118 packetSocket.
Install(wifiApNode);
4119 packetSocket.
Install(wifiStaNodes);
4122 for (uint16_t i = 0; i < m_nStations; i++)
4132 client->SetRemote(socket);
4133 wifiStaNodes.Get(i)->AddApplication(client);
4135 client->SetStopTime(
Seconds(1));
4137 legacyStaClient->SetAttribute(
"PacketSize",
UintegerValue(1500));
4138 legacyStaClient->SetAttribute(
"MaxPackets",
UintegerValue(200));
4140 legacyStaClient->SetRemote(socket);
4141 wifiStaNodes.Get(i)->AddApplication(legacyStaClient);
4143 legacyStaClient->SetStopTime(
Seconds(1));
4145 server->SetLocal(socket);
4146 wifiApNode.Get(0)->AddApplication(server);
4147 server->SetStartTime(
Seconds(0));
4148 server->SetStopTime(
Seconds(1));
4152 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyRxDrop",
4188 void DoRun()
override;
4208 const std::vector<bool>& statusPerMpdu);
4237 std::optional<Time> expectedLastRxSucceeded,
4238 std::optional<Time> expectedLastRxFailed,
4239 std::optional<Time> expectedLastRxDropped);
4254 :
TestCase(
"Check correct behavior when a STA is receiving a transmission using an unsupported "
4290 auto txPowerSpectrum =
4297 txParams->psd = txPowerSpectrum;
4298 txParams->txPhy =
nullptr;
4299 txParams->duration = txDuration;
4300 txParams->ppdu = ppdu;
4302 m_rxPhy->StartRx(txParams,
nullptr);
4309 const std::vector<bool>& statusPerMpdu)
4337 std::optional<Time> expectedLastRxSucceeded,
4338 std::optional<Time> expectedLastRxFailed,
4339 std::optional<Time> expectedLastRxDropped)
4342 expectedCountRxSuccess,
4343 "Didn't receive right number of successful packets");
4346 expectedCountRxFailure,
4347 "Didn't receive right number of unsuccessful packets");
4350 expectedCountRxDropped,
4351 "Didn't receive right number of dropped packets");
4353 if (expectedCountRxSuccess > 0)
4356 NS_ASSERT(expectedLastRxSucceeded.has_value());
4358 expectedLastRxSucceeded.value(),
4359 "Didn't receive the last successful packet at the expected time");
4362 if (expectedCountRxFailure > 0)
4365 NS_ASSERT(expectedLastRxFailed.has_value());
4367 expectedLastRxFailed.value(),
4368 "Didn't receive the last unsuccessful packet at the expected time");
4371 if (expectedCountRxDropped > 0)
4374 NS_ASSERT(expectedLastRxDropped.has_value());
4376 expectedLastRxDropped.value(),
4377 "Didn't drop the last filtered packet at the expected time");
4389 m_rxPhy->SetInterferenceHelper(rxInterferenceHelper);
4391 m_rxPhy->SetErrorRateModel(rxErrorRateModel);
4393 m_rxPhy->AddChannel(spectrumChannel);
4396 node->AddDevice(dev);
4398 m_rxPhy->SetReceiveOkCallback(
4400 m_rxPhy->SetReceiveErrorCallback(
4402 m_rxPhy->TraceConnectWithoutContext(
4408 m_txPhy->SetInterferenceHelper(txInterferenceHelper);
4410 m_txPhy->SetErrorRateModel(txErrorRateModel);
4411 m_txPhy->AddChannel(spectrumChannel);
4431 int64_t streamNumber = 0;
4432 m_rxPhy->AssignStreams(streamNumber);
4456 heSigAExpectedRxTime);
4479 void DoRun()
override;
4503 MHz_u phyCenterFreq,
4505 MHz_u ppduCenterFreq,
4506 bool expectedP20Overlap,
4507 bool expectedP20Covered);
4514 :
TestCase(
"Check correct detection of whether P20 is fully covered (hence it can be received) "
4515 "or overlaps with the bandwidth of an incoming PPDU")
4554 m_rxPhy->SetInterferenceHelper(rxInterferenceHelper);
4556 m_rxPhy->SetErrorRateModel(rxErrorRateModel);
4562 m_txPhy->SetInterferenceHelper(txInterferenceHelper);
4564 m_txPhy->SetErrorRateModel(txErrorRateModel);
4580 MHz_u phyCenterFreq,
4582 MHz_u ppduCenterFreq,
4583 bool expectedP20Overlap,
4584 bool expectedP20Covered)
4594 auto p20CenterFreq =
m_rxPhy->GetOperatingChannel().GetPrimaryChannelCenterFrequency(
MHz_u{20});
4595 auto p20MinFreq = p20CenterFreq -
MHz_u{10};
4596 auto p20MaxFreq = p20CenterFreq +
MHz_u{10};
4600 auto p20Overlap = ppdu->DoesOverlapChannel(p20MinFreq, p20MaxFreq);
4603 "PPDU is " << (expectedP20Overlap ?
"expected" :
"not expected")
4604 <<
" to overlap with the P20");
4610 "PPDU is " << (expectedP20Covered ?
"expected" :
"not expected")
4611 <<
" to cover the whole P20");
4718 void DoRun()
override;
4729 uint16_t expectedValue)
4730 :
TestCase(
"Test for early discard of signal in single-model-spectrum-channel::StartTx()"),
4756 m_tx->Send(psdu, txVector);
4764 "Received a different amount of packets than expected.");
4770 uint32_t senderNodeId [[maybe_unused]],
4771 double rxPower [[maybe_unused]],
4772 Time duration [[maybe_unused]])
4774 NS_LOG_FUNCTION(
this << signal << senderNodeId << rxPower << duration);
4785 channel->AddSpectrumTransmitFilter(wifiFilter);
4790 m_tx->SetDevice(dev);
4797 m_rx->SetDevice(devRx);
4800 m_tx->SetInterferenceHelper(interferenceTx);
4802 m_tx->SetErrorRateModel(errorTx);
4805 m_rx->SetInterferenceHelper(interferenceRx);
4807 m_rx->SetErrorRateModel(errorRx);
4809 m_tx->AddChannel(channel);
4810 m_rx->AddChannel(channel);
4816 node->AddDevice(dev);
4817 devRx->SetPhy(
m_rx);
4818 nodeRx->AddDevice(devRx);
4820 m_rx->TraceConnectWithoutContext(
4896 void DoRun()
override;
4908 :
TestCase(
"Test for correct WifiPhyRxfailureReason from PhyRxDrop trace"),
4934 phy->Send(psdu, txVector);
4942 "Packet was dropped due to the wrong drop reason reported ");
4973 m_phyA->SetInterferenceHelper(interferenceTx);
4975 m_phyA->SetErrorRateModel(errorTx);
4978 m_phyB->SetInterferenceHelper(interferenceRx);
4980 m_phyB->SetErrorRateModel(errorRx);
4982 m_phyA->AddChannel(channel);
4983 m_phyB->AddChannel(channel);
4992 node->AddDevice(devA);
4994 nodeRx->AddDevice(devB);
4996 m_phyB->TraceConnectWithoutContext(
"PhyRxDrop",
void IncrementSuccessBitmap(uint32_t size)
Increment reception success bitmap.
uint8_t m_rxDroppedBitmapAmpdu2
bitmap of dropped MPDUs in A-MPDU #2
void CheckRxSuccessBitmapAmpdu2(uint8_t expected)
Check the RX success bitmap for A-MPDU 2.
void DoRun() override
Implementation to actually run this TestCase.
void CheckRxDroppedBitmapAmpdu1(uint8_t expected)
Check the RX dropped bitmap for A-MPDU 1.
uint8_t m_rxSuccessBitmapAmpdu1
bitmap of successfully received MPDUs in A-MPDU #1
uint8_t m_rxFailureBitmapAmpdu1
bitmap of unsuccessfully received MPDUs in A-MPDU #1
uint8_t m_rxFailureBitmapAmpdu2
bitmap of unsuccessfully received MPDUs in A-MPDU #2
void RxDropped(Ptr< const Packet > p, WifiPhyRxfailureReason reason)
RX dropped function.
void SendAmpduWithThreeMpdus(dBm_u rxPower, uint32_t referencePacketSize)
Send A-MPDU with 3 MPDUs of different size (i-th MSDU will have 100 bytes more than (i-1)-th).
void RxFailure(Ptr< const WifiPsdu > psdu)
RX failure function.
void CheckRxFailureBitmapAmpdu2(uint8_t expected)
Check the RX failure bitmap for A-MPDU 2.
uint8_t m_rxDroppedBitmapAmpdu1
bitmap of dropped MPDUs in A-MPDU #1
void IncrementFailureBitmap(uint32_t size)
Increment reception failure bitmap.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
void ResetBitmaps()
Reset bitmaps function.
void CheckPhyState(WifiPhyState expectedState)
Check the PHY state.
void RxSuccess(Ptr< const WifiPsdu > psdu, RxSignalInfo rxSignalInfo, const WifiTxVector &txVector, const std::vector< bool > &statusPerMpdu)
RX success function.
void CheckRxSuccessBitmapAmpdu1(uint8_t expected)
Check the RX success bitmap for A-MPDU 1.
void CheckRxFailureBitmapAmpdu1(uint8_t expected)
Check the RX failure bitmap for A-MPDU 1.
uint8_t m_rxSuccessBitmapAmpdu2
bitmap of successfully received MPDUs in A-MPDU #2
void CheckRxDroppedBitmapAmpdu2(uint8_t expected)
Check the RX dropped bitmap for A-MPDU 2.
This test verifies that the WifiPhyRxfailureReason distinguishes between two cases: 1) a drop due to ...
WifiPhyRxfailureReason m_expectedReason
expected WifiPhyRxfailureReason
void PhyDropTraceSink(Ptr< const Packet > p, WifiPhyRxfailureReason reason)
RX dropped function.
void DoRun() override
Implementation to actually run this TestCase.
WifiPhyRxfailureReason m_observedReason
observed WifiPhyRxfailureReason
void CheckDropReason()
Event scheduled at end of simulation for validation.
void DoTeardown() override
Implementation to do any local setup required for this TestCase.
Time m_delay
delay between transmissions in MicroSeconds
Ptr< SpectrumWifiPhy > m_phyA
transmit function
void DoSetup() override
Implementation to do any local setup required for this TestCase.
Ptr< SpectrumWifiPhy > m_phyB
transmit/receive function
TestPhyDropDueToTx(Time delay, WifiPhyRxfailureReason expectedReason)
Constructor.
void Send(Ptr< WifiPhy > phy) const
Send function (sends a single packet).
Primary 20 MHz Covered By Ppdu Test This test checks whether the functions WifiPpdu::DoesOverlapChann...
Ptr< SpectrumWifiPhy > m_rxPhy
RX PHY.
TestPrimary20CoveredByPpdu()
void DoSetup() override
Implementation to do any local setup required for this TestCase.
void RunOne(WifiPhyBand band, MHz_u phyCenterFreq, uint8_t p20Index, MHz_u ppduCenterFreq, bool expectedP20Overlap, bool expectedP20Covered)
Run one function.
Ptr< HePpdu > CreatePpdu(MHz_u ppduCenterFreq)
Function to create a PPDU.
void DoRun() override
Implementation to actually run this TestCase.
void DoTeardown() override
Implementation to do any local setup required for this TestCase.
Ptr< SpectrumWifiPhy > m_txPhy
TX PHY.
Simple frame capture model test.
void Expect1000BPacketReceived()
Verify whether 1000 bytes packet has been received.
bool m_rxDropped1500B
count dropped packets with 1500B payload
void DoSetup() override
Implementation to do any local setup required for this TestCase.
void Expect1500BPacketDropped()
Verify whether 1500 bytes packet has been dropped.
void Expect1000BPacketDropped()
Verify whether 1000 bytes packet has been dropped.
void Reset()
Reset function.
void RxSuccess(Ptr< const WifiPsdu > psdu, RxSignalInfo rxSignalInfo, const WifiTxVector &txVector, const std::vector< bool > &statusPerMpdu)
Spectrum wifi receive success function.
void RxDropped(Ptr< const Packet > p, WifiPhyRxfailureReason reason)
RX dropped function.
void DoRun() override
Implementation to actually run this TestCase.
bool m_rxSuccess1000B
count received packets with 1000B payload
bool m_rxSuccess1500B
count received packets with 1500B payload
void Expect1500BPacketReceived()
Verify whether 1500 bytes packet has been received.
TestSimpleFrameCaptureModel()
bool m_rxDropped1000B
count dropped packets with 1000B payload
This test verifies the correct function of the WifiBandwidthFilter.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
uint8_t m_channel
channel for packet transmission
uint16_t m_expectedValue
expected count of receive events
void Send() const
Send function (sends a single packet).
Ptr< SpectrumWifiPhy > m_tx
transmit function
Ptr< SpectrumWifiPhy > m_rx
receive function
void DoRun() override
Implementation to actually run this TestCase.
void CheckRxPacketCount(uint16_t expectedValue)
Event scheduled at end of simulation for validation.
void RxBegin(Ptr< const SpectrumSignalParameters > signal, uint32_t senderNodeId, double rxPower, Time duration)
Callback invoked when the PHY model starts to process a signal.
void DoTeardown() override
Implementation to do any local setup required for this TestCase.
TestSpectrumChannelWithBandwidthFilter(uint8_t channel, uint16_t expectedValue)
Constructor.
uint32_t m_countRxBegin
count of receive events
Preamble detection test w/o frame capture.
TestThresholdPreambleDetectionWithFrameCapture()
void RxFailure(Ptr< const WifiPsdu > psdu)
Spectrum wifi receive failure function.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
uint32_t m_countRxSuccess
count RX success
void DoRun() override
Implementation to actually run this TestCase.
uint32_t m_countRxFailure
count RX failure
void RxSuccess(Ptr< const WifiPsdu > psdu, RxSignalInfo rxSignalInfo, const WifiTxVector &txVector, const std::vector< bool > &statusPerMpdu)
Spectrum wifi receive success function.
void CheckRxPacketCount(uint32_t expectedSuccessCount, uint32_t expectedFailureCount)
Check the number of received packets.
Preamble detection test w/o frame capture.
void DoRun() override
Implementation to actually run this TestCase.
TestThresholdPreambleDetectionWithoutFrameCapture()
void RxSuccess(Ptr< const WifiPsdu > psdu, RxSignalInfo rxSignalInfo, const WifiTxVector &txVector, const std::vector< bool > &statusPerMpdu)
Spectrum wifi receive success function.
uint32_t m_countRxFailure
count RX failure
void CheckRxPacketCount(uint32_t expectedSuccessCount, uint32_t expectedFailureCount)
Check the number of received packets.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
uint32_t m_countRxSuccess
count RX success
void RxFailure(Ptr< const WifiPsdu > psdu)
Spectrum wifi receive failure function.
Unsupported Bandwidth Reception Test This test checks whether a PHY receiving a PPDU sent over a chan...
uint32_t m_countRxSuccess
count RX success
void DoSetup() override
Implementation to do any local setup required for this TestCase.
Ptr< SpectrumWifiPhy > m_rxPhy
RX PHY.
TestUnsupportedBandwidthReception()
std::optional< Time > m_lastRxDropped
time of last RX drop, if any
Ptr< SpectrumWifiPhy > m_txPhy
TX PHY.
std::optional< Time > m_lastRxSucceeded
time of last RX success, if any
void RxSuccess(Ptr< const WifiPsdu > psdu, RxSignalInfo rxSignalInfo, const WifiTxVector &txVector, const std::vector< bool > &statusPerMpdu)
Function called upon a PSDU received successfully.
void DoTeardown() override
Implementation to do any local setup required for this TestCase.
uint32_t m_countRxFailure
count RX failure
void CheckRx(uint32_t expectedCountRxSuccess, uint32_t expectedCountRxFailure, uint32_t expectedCountRxDropped, std::optional< Time > expectedLastRxSucceeded, std::optional< Time > expectedLastRxFailed, std::optional< Time > expectedLastRxDropped)
Check the reception results.
void RxFailure(Ptr< const WifiPsdu > psdu)
Function called upon a PSDU received unsuccessfully.
void DoRun() override
Implementation to actually run this TestCase.
std::optional< Time > m_lastRxFailed
time of last RX failure, if any
void SendPpdu(MHz_u centerFreq, MHz_u bandwidth)
Function to create a PPDU.
void RxDropped(Ptr< const Packet > packet, WifiPhyRxfailureReason reason)
Function called upon a PSDU dropped by the PHY.
uint32_t m_countRxDropped
count RX drop
Unsupported Modulation Reception Test This test creates a mixed network, in which an HE STA and a VHT...
void DoRun() override
Implementation to actually run this TestCase.
void CheckResults()
Check correctness of transmitted frames.
void Dropped(std::string context, Ptr< const Packet > packet, WifiPhyRxfailureReason reason)
Callback invoked when PHY drops an incoming packet.
~TestUnsupportedModulationReception() override=default
TestUnsupportedModulationReception()
uint16_t m_dropped
number of packets dropped by the AP because it was already receiving
WifiPhyReceptionTest(std::string test_name)
Constructor.
void SendPacket(dBm_u rxPower, uint32_t packetSize, uint8_t mcs)
Send packet function.
void DoTeardown() override
Implementation to do any local setup required for this TestCase.
~WifiPhyReceptionTest() override=default
Destructor.
void DoCheckPhyState(WifiPhyState expectedState)
Check the PHY state now.
void CheckPhyState(WifiPhyState expectedState)
Schedule now to check the PHY state.
uint64_t m_uid
the UID to use for the PPDU
Ptr< SpectrumWifiPhy > m_phy
the PHY
void DoSetup() override
Implementation to do any local setup required for this TestCase.
wifi PHY reception Test Suite
WifiPhyReceptionTestSuite()
AttributeValue implementation for Boolean.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
static WifiMode GetHeMcs(uint8_t index)
Return the HE MCS corresponding to the provided index.
static WifiMode GetHeMcs0()
Return MCS 0 from HE MCS values.
static WifiMode GetHeMcs7()
Return MCS 7 from HE MCS values.
Helper class used to assign positions and mobility models to nodes.
holds a vector of ns3::NetDevice pointers
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
keep track of a set of node pointers.
an address for a packet socket
void SetProtocol(uint16_t protocol)
Set the protocol.
void SetPhysicalAddress(const Address address)
Set the destination address.
void SetSingleDevice(uint32_t device)
Set the address to match only a specified NetDevice.
Give ns3::PacketSocket powers to ns3::Node.
void Install(Ptr< Node > node) const
Aggregate an instance of a ns3::PacketSocketFactory onto the provided node.
AttributeValue implementation for Pointer.
Smart pointer class similar to boost::intrusive_ptr.
static void SetRun(uint64_t run)
Set the run number of simulation.
static void SetSeed(uint32_t seed)
Set the seed.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static Time Now()
Return the current simulation virtual time.
static void Run()
Run the simulation.
static EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Make it easy to create and manage PHY objects for the spectrum model.
The IEEE 802.11 SSID Information Element.
AttributeValue implementation for Ssid.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
TestCase(const TestCase &)=delete
Caller graph was not generated because of its size.
TestSuite(std::string name, Type type=Type::UNIT)
Construct a new test suite.
Simulation virtual time values and global simulation resolution.
AttributeValue implementation for Time.
Hold an unsigned integer type.
helps to create WifiNetDevice objects
static int64_t AssignStreams(NetDeviceContainer c, int64_t stream)
Assign a fixed random variable stream number to the random variables used by the PHY and MAC aspects ...
create MAC layers for a ns3::WifiNetDevice.
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
WifiChannelConfig::SegmentWithoutUnits ChannelTuple
kept for backward compatibility, can be deprecated when using strong types
static ConstIterator FindFirst(uint8_t number, MHz_u frequency, MHz_u width, WifiStandard standard, WifiPhyBand band, ConstIterator start=GetFrequencyChannels().begin())
Find the first frequency segment matching the specified parameters.
This objects implements the PHY state machine of the Wifi device.
static Ptr< SpectrumValue > CreateHeOfdmTxPowerSpectralDensity(MHz_u centerFrequency, MHz_u channelWidth, Watt_u txPower, MHz_u guardBandwidth, dBr_u minInnerBand=dBr_u{-20}, dBr_u minOuterband=dBr_u{-28}, dBr_u lowestPoint=dBr_u{-40}, const std::vector< bool > &puncturedSubchannels={})
Create a transmit power spectral density corresponding to OFDM High Efficiency (HE/EHT) (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,...
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...
void SetDefault(std::string name, const AttributeValue &value)
void Connect(std::string path, const CallbackBase &cb)
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time Seconds(double value)
Construct a Time in the indicated unit.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
WifiPhyRxfailureReason
Enumeration of the possible reception failure reasons.
WifiPhyBand
Identifies the PHY band.
@ SIGNAL_DETECTION_ABORTED_BY_TX
@ RECEPTION_ABORTED_BY_TX
@ WIFI_PHY_BAND_2_4GHZ
The 2.4 GHz band.
@ WIFI_PHY_BAND_5GHZ
The 5 GHz band.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
WifiPhyState
The state of the PHY layer.
@ IDLE
The PHY layer is IDLE.
@ CCA_BUSY
The PHY layer has sense the medium busy through the CCA mechanism.
@ RX
The PHY layer is receiving a packet.
static constexpr uint8_t WIFI_MIN_TX_PWR_LEVEL
minimum TX power level value
double MHz_u
MHz weak type.
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
double dBm_u
dBm weak type
Watt_u DbmToW(dBm_u val)
Convert from dBm to Watts.
const Time DEFAULT_BEACON_INTERVAL
Default Beacon interval.
static const uint8_t CHANNEL_NUMBER
static const MHz_u GUARD_WIDTH
static const MHz_u CHANNEL_WIDTH
RxSignalInfo structure containing info on the received signal.
static const uint8_t CHANNEL_NUMBER
static const MHz_u FREQUENCY
static WifiPhyReceptionTestSuite wifiPhyReceptionTestSuite
the test suite
static const MHz_u GUARD_WIDTH
static const MHz_u CHANNEL_WIDTH
static const uint32_t packetSize
Packet size generated at the AP.