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"
93 std::vector<bool> statusPerMpdu);
103 void DoRun()
override;
127 :
TestCase(
"Threshold preamble detection model test when no frame capture model is applied"),
153 WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity(
FREQUENCY,
159 txParams->psd = txPowerSpectrum;
160 txParams->txPhy =
nullptr;
161 txParams->duration = txDuration;
162 txParams->ppdu = ppdu;
184 currentState = state->GetState();
188 "PHY State " << currentState <<
" does not match expected state "
197 expectedSuccessCount,
198 "Didn't receive right number of successful packets");
200 expectedFailureCount,
201 "Didn't receive right number of unsuccessful packets");
208 std::vector<bool> statusPerMpdu)
230 m_phy = CreateObject<SpectrumWifiPhy>();
243 CreateObject<ThresholdPreambleDetectionModel>();
244 preambleDetectionModel->SetAttribute(
"Threshold",
DoubleValue(4));
245 preambleDetectionModel->SetAttribute(
"MinimumRssi",
DoubleValue(-82));
259 RngSeedManager::SetSeed(1);
260 RngSeedManager::SetRun(1);
261 int64_t streamNumber = 0;
265 double rxPowerDbm = -50;
271 Simulator::Schedule(
Seconds(1.0),
305 Simulator::Schedule(
Seconds(1.1),
317 Simulator::Schedule(
Seconds(2.0),
347 Simulator::Schedule(
Seconds(2.1),
359 Simulator::Schedule(
Seconds(3.0),
389 Simulator::Schedule(
Seconds(3.1),
400 Simulator::Schedule(
Seconds(4.0),
448 Simulator::Schedule(
Seconds(4.1),
460 Simulator::Schedule(
Seconds(5.0),
490 Simulator::Schedule(
Seconds(5.1),
503 Simulator::Schedule(
Seconds(6.0),
537 Simulator::Schedule(
Seconds(6.1),
549 Simulator::Schedule(
Seconds(7.0),
564 Simulator::Schedule(
Seconds(7.1),
577 Simulator::Schedule(
Seconds(8.0),
592 Simulator::Schedule(
Seconds(8.1),
603 Simulator::Schedule(
Seconds(9.0),
642 Simulator::Schedule(
Seconds(9.1),
653 Simulator::Schedule(
Seconds(10.0),
668 Simulator::Schedule(
Seconds(10.1),
680 Simulator::Schedule(
Seconds(11.0),
721 Simulator::Schedule(
Seconds(12.0),
732 Simulator::Destroy();
766 std::vector<bool> statusPerMpdu);
776 void DoRun()
override;
800 "Threshold preamble detection model test when simple frame capture model is applied"),
826 WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity(
FREQUENCY,
832 txParams->psd = txPowerSpectrum;
833 txParams->txPhy =
nullptr;
834 txParams->duration = txDuration;
835 txParams->ppdu = ppdu;
857 currentState = state->GetState();
861 "PHY State " << currentState <<
" does not match expected state "
870 expectedSuccessCount,
871 "Didn't receive right number of successful packets");
873 expectedFailureCount,
874 "Didn't receive right number of unsuccessful packets");
881 std::vector<bool> statusPerMpdu)
902 m_phy = CreateObject<SpectrumWifiPhy>();
915 CreateObject<ThresholdPreambleDetectionModel>();
916 preambleDetectionModel->SetAttribute(
"Threshold",
DoubleValue(4));
917 preambleDetectionModel->SetAttribute(
"MinimumRssi",
DoubleValue(-82));
921 frameCaptureModel->SetAttribute(
"Margin",
DoubleValue(5));
936 RngSeedManager::SetSeed(1);
937 RngSeedManager::SetRun(1);
938 int64_t streamNumber = 1;
942 double rxPowerDbm = -50;
948 Simulator::Schedule(
Seconds(1.0),
982 Simulator::Schedule(
Seconds(1.1),
994 Simulator::Schedule(
Seconds(2.0),
1024 Simulator::Schedule(
Seconds(2.1),
1036 Simulator::Schedule(
Seconds(3.0),
1066 Simulator::Schedule(
Seconds(3.1),
1077 Simulator::Schedule(
Seconds(4.0),
1125 Simulator::Schedule(
Seconds(4.1),
1137 Simulator::Schedule(
Seconds(5.0),
1171 Simulator::Schedule(
Seconds(5.1),
1183 Simulator::Schedule(
Seconds(6.0),
1227 Simulator::Schedule(
Seconds(6.1),
1239 Simulator::Schedule(
Seconds(7.0),
1243 Simulator::Schedule(
Seconds(7.0),
1269 Simulator::Schedule(
Seconds(7.1),
1281 Simulator::Schedule(
Seconds(8.0),
1285 Simulator::Schedule(
Seconds(8.0),
1310 Simulator::Schedule(
Seconds(8.1),
1321 Simulator::Schedule(
Seconds(9.0),
1325 Simulator::Schedule(
Seconds(9.0),
1359 Simulator::Schedule(
Seconds(9.1),
1371 Simulator::Schedule(
Seconds(10.0),
1375 Simulator::Schedule(
Seconds(10.0),
1400 Simulator::Schedule(
Seconds(10.1),
1412 Simulator::Schedule(
Seconds(11.0),
1416 Simulator::Schedule(
Seconds(11.0),
1450 Simulator::Schedule(
Seconds(11.1),
1463 Simulator::Schedule(
Seconds(12.0),
1497 Simulator::Schedule(
Seconds(12.1),
1509 Simulator::Schedule(
Seconds(13.0),
1524 Simulator::Schedule(
Seconds(13.1),
1537 Simulator::Schedule(
Seconds(14.0),
1552 Simulator::Schedule(
Seconds(14.1),
1563 Simulator::Schedule(
Seconds(15.0),
1602 Simulator::Schedule(
Seconds(15.1),
1615 Simulator::Schedule(
Seconds(16.0),
1635 Simulator::Schedule(
Seconds(16.1),
1647 Simulator::Schedule(
Seconds(17.0),
1691 Simulator::Schedule(
Seconds(17.1),
1700 Simulator::Schedule(
Seconds(18.0),
1709 Simulator::Schedule(
Seconds(18.1),
1717 Simulator::Schedule(
Seconds(19.0),
1726 Simulator::Schedule(
Seconds(19.1),
1734 Simulator::Schedule(
Seconds(20.0),
1738 Simulator::Schedule(
Seconds(20.0),
1743 Simulator::Schedule(
Seconds(20.1),
1751 Simulator::Schedule(
Seconds(21.0),
1755 Simulator::Schedule(
Seconds(21.0),
1761 Simulator::Schedule(
Seconds(21.1),
1768 Simulator::Destroy();
1788 void DoRun()
override;
1810 std::vector<bool> statusPerMpdu);
1846 :
TestCase(
"Simple frame capture model test"),
1847 m_rxSuccess1000B(false),
1848 m_rxSuccess1500B(false),
1849 m_rxDropped1000B(false),
1850 m_rxDropped1500B(false),
1874 WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity(
FREQUENCY,
1880 txParams->psd = txPowerSpectrum;
1881 txParams->txPhy =
nullptr;
1882 txParams->duration = txDuration;
1883 txParams->ppdu = ppdu;
1892 std::vector<bool> statusPerMpdu)
1900 else if (psdu->
GetSize() == 1530)
1914 else if (p->
GetSize() == 1530)
1961 m_phy = CreateObject<SpectrumWifiPhy>();
1974 CreateObject<ThresholdPreambleDetectionModel>();
1975 preambleDetectionModel->SetAttribute(
"Threshold",
DoubleValue(2));
1979 frameCaptureModel->SetAttribute(
"Margin",
DoubleValue(5));
1994 RngSeedManager::SetSeed(1);
1995 RngSeedManager::SetRun(1);
1996 int64_t streamNumber = 2;
1997 double rxPowerDbm = -30;
2003 Simulator::Schedule(
Seconds(1.0),
2019 Simulator::Schedule(
Seconds(2.0),
2029 Simulator::Schedule(
Seconds(2.1),
2038 Simulator::Schedule(
Seconds(3.0),
2049 Simulator::Schedule(
Seconds(3.1),
2058 Simulator::Schedule(
Seconds(4.0),
2072 Simulator::Destroy();
2098 void DoRun()
override;
2115 :
TestCase(
"PHY headers reception test"),
2139 WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity(
FREQUENCY,
2145 txParams->psd = txPowerSpectrum;
2146 txParams->txPhy =
nullptr;
2147 txParams->duration = txDuration;
2148 txParams->ppdu = ppdu;
2168 currentState = state->GetState();
2172 "PHY State " << currentState <<
" does not match expected state "
2184 m_phy = CreateObject<SpectrumWifiPhy>();
2203 RngSeedManager::SetSeed(1);
2204 RngSeedManager::SetRun(1);
2205 int64_t streamNumber = 0;
2209 double rxPowerDbm = -50;
2503 Simulator::Destroy();
2523 void DoRun()
override;
2535 std::vector<bool> statusPerMpdu);
2624 :
TestCase(
"A-MPDU reception test"),
2625 m_rxSuccessBitmapAmpdu1(0),
2626 m_rxSuccessBitmapAmpdu2(0),
2627 m_rxFailureBitmapAmpdu1(0),
2628 m_rxFailureBitmapAmpdu2(0),
2629 m_rxDroppedBitmapAmpdu1(0),
2630 m_rxDroppedBitmapAmpdu2(0),
2655 std::vector<bool> statusPerMpdu)
2658 if (statusPerMpdu.empty())
2663 "Should have one receive status per MPDU");
2664 auto rxOkForMpdu = statusPerMpdu.begin();
2665 for (
auto mpdu = psdu->
begin(); mpdu != psdu->
end(); ++mpdu)
2686 else if (size == 1130)
2690 else if (size == 1230)
2694 else if (size == 1330)
2698 else if (size == 1430)
2702 else if (size == 1530)
2712 for (
auto mpdu = psdu->
begin(); mpdu != psdu->
end(); ++mpdu)
2725 else if (size == 1130)
2729 else if (size == 1230)
2733 else if (size == 1330)
2737 else if (size == 1430)
2741 else if (size == 1530)
2755 else if (p->
GetSize() == 1130)
2759 else if (p->
GetSize() == 1230)
2763 else if (p->
GetSize() == 1330)
2767 else if (p->
GetSize() == 1430)
2771 else if (p->
GetSize() == 1530)
2782 "RX success bitmap for A-MPDU 1 is not as expected");
2790 "RX success bitmap for A-MPDU 2 is not as expected");
2798 "RX failure bitmap for A-MPDU 1 is not as expected");
2806 "RX failure bitmap for A-MPDU 2 is not as expected");
2814 "RX dropped bitmap for A-MPDU 1 is not as expected");
2822 "RX dropped bitmap for A-MPDU 2 is not as expected");
2832 currentState = state->GetState();
2835 "PHY State " << currentState <<
" does not match expected state "
2849 std::vector<Ptr<WifiMpdu>> mpduList;
2850 for (
size_t i = 0; i < 3; ++i)
2852 Ptr<Packet> p = Create<Packet>(referencePacketSize + i * 100);
2853 mpduList.push_back(Create<WifiMpdu>(p, hdr));
2863 WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity(
FREQUENCY,
2869 txParams->psd = txPowerSpectrum;
2870 txParams->txPhy =
nullptr;
2871 txParams->duration = txDuration;
2872 txParams->ppdu = ppdu;
2880 m_phy = CreateObject<SpectrumWifiPhy>();
2894 CreateObject<ThresholdPreambleDetectionModel>();
2895 preambleDetectionModel->SetAttribute(
"Threshold",
DoubleValue(2));
2899 frameCaptureModel->SetAttribute(
"Margin",
DoubleValue(5));
2914 RngSeedManager::SetSeed(1);
2915 RngSeedManager::SetRun(2);
2916 int64_t streamNumber = 1;
2917 double rxPowerDbm = -30;
2927 Simulator::Schedule(
Seconds(1.0),
2941 Simulator::Schedule(
Seconds(1.1),
2945 Simulator::Schedule(
Seconds(1.1),
2949 Simulator::Schedule(
Seconds(1.1),
2955 Simulator::Schedule(
Seconds(1.1),
2959 Simulator::Schedule(
Seconds(1.1),
2963 Simulator::Schedule(
Seconds(1.1),
2977 Simulator::Schedule(
Seconds(2.0),
2991 Simulator::Schedule(
Seconds(2.1),
2995 Simulator::Schedule(
Seconds(2.1),
2999 Simulator::Schedule(
Seconds(2.1),
3005 Simulator::Schedule(
Seconds(2.1),
3009 Simulator::Schedule(
Seconds(2.1),
3013 Simulator::Schedule(
Seconds(2.1),
3027 Simulator::Schedule(
Seconds(3.0),
3041 Simulator::Schedule(
Seconds(3.1),
3045 Simulator::Schedule(
Seconds(3.1),
3049 Simulator::Schedule(
Seconds(3.1),
3055 Simulator::Schedule(
Seconds(3.1),
3059 Simulator::Schedule(
Seconds(3.1),
3063 Simulator::Schedule(
Seconds(3.1),
3077 Simulator::Schedule(
Seconds(4.0),
3091 Simulator::Schedule(
Seconds(4.1),
3095 Simulator::Schedule(
Seconds(4.1),
3099 Simulator::Schedule(
Seconds(4.1),
3105 Simulator::Schedule(
Seconds(4.1),
3109 Simulator::Schedule(
Seconds(4.1),
3113 Simulator::Schedule(
Seconds(4.1),
3127 Simulator::Schedule(
Seconds(5.0),
3141 Simulator::Schedule(
Seconds(5.1),
3145 Simulator::Schedule(
Seconds(5.1),
3149 Simulator::Schedule(
Seconds(5.1),
3155 Simulator::Schedule(
Seconds(5.1),
3159 Simulator::Schedule(
Seconds(5.1),
3163 Simulator::Schedule(
Seconds(5.1),
3177 Simulator::Schedule(
Seconds(6.0),
3191 Simulator::Schedule(
Seconds(6.1),
3195 Simulator::Schedule(
Seconds(6.1),
3199 Simulator::Schedule(
Seconds(6.1),
3205 Simulator::Schedule(
Seconds(6.1),
3209 Simulator::Schedule(
Seconds(6.1),
3213 Simulator::Schedule(
Seconds(6.1),
3226 Simulator::Schedule(
Seconds(7.0),
3240 Simulator::Schedule(
Seconds(7.1),
3244 Simulator::Schedule(
Seconds(7.1),
3248 Simulator::Schedule(
Seconds(7.1),
3254 Simulator::Schedule(
Seconds(7.1),
3258 Simulator::Schedule(
Seconds(7.1),
3262 Simulator::Schedule(
Seconds(7.1),
3275 Simulator::Schedule(
Seconds(8.0),
3289 Simulator::Schedule(
Seconds(8.1),
3293 Simulator::Schedule(
Seconds(8.1),
3297 Simulator::Schedule(
Seconds(8.1),
3303 Simulator::Schedule(
Seconds(8.1),
3307 Simulator::Schedule(
Seconds(8.1),
3311 Simulator::Schedule(
Seconds(8.1),
3325 Simulator::Schedule(
Seconds(9.0),
3339 Simulator::Schedule(
Seconds(9.1),
3343 Simulator::Schedule(
Seconds(9.1),
3347 Simulator::Schedule(
Seconds(9.1),
3353 Simulator::Schedule(
Seconds(9.1),
3357 Simulator::Schedule(
Seconds(9.1),
3361 Simulator::Schedule(
Seconds(9.1),
3375 Simulator::Schedule(
Seconds(10.0),
3389 Simulator::Schedule(
Seconds(10.1),
3393 Simulator::Schedule(
Seconds(10.1),
3397 Simulator::Schedule(
Seconds(10.1),
3403 Simulator::Schedule(
Seconds(10.1),
3407 Simulator::Schedule(
Seconds(10.1),
3411 Simulator::Schedule(
Seconds(10.1),
3425 Simulator::Schedule(
Seconds(11.0),
3439 Simulator::Schedule(
Seconds(11.1),
3443 Simulator::Schedule(
Seconds(11.1),
3447 Simulator::Schedule(
Seconds(11.1),
3453 Simulator::Schedule(
Seconds(11.1),
3457 Simulator::Schedule(
Seconds(11.1),
3461 Simulator::Schedule(
Seconds(11.1),
3475 Simulator::Schedule(
Seconds(12.0),
3490 Simulator::Schedule(
Seconds(12.1),
3494 Simulator::Schedule(
Seconds(12.1),
3498 Simulator::Schedule(
Seconds(12.1),
3505 Simulator::Schedule(
Seconds(12.1),
3509 Simulator::Schedule(
Seconds(12.1),
3513 Simulator::Schedule(
Seconds(12.1),
3527 Simulator::Schedule(
Seconds(13.0),
3542 Simulator::Schedule(
Seconds(13.1),
3546 Simulator::Schedule(
Seconds(13.1),
3550 Simulator::Schedule(
Seconds(13.1),
3556 Simulator::Schedule(
Seconds(13.1),
3560 Simulator::Schedule(
Seconds(13.1),
3564 Simulator::Schedule(
Seconds(13.1),
3578 Simulator::Schedule(
Seconds(14.0),
3592 Simulator::Schedule(
Seconds(14.1),
3596 Simulator::Schedule(
Seconds(14.1),
3600 Simulator::Schedule(
Seconds(14.1),
3606 Simulator::Schedule(
Seconds(14.1),
3610 Simulator::Schedule(
Seconds(14.1),
3614 Simulator::Schedule(
Seconds(14.1),
3628 Simulator::Schedule(
Seconds(15.0),
3642 Simulator::Schedule(
Seconds(15.1),
3646 Simulator::Schedule(
Seconds(15.1),
3650 Simulator::Schedule(
Seconds(15.1),
3656 Simulator::Schedule(
Seconds(15.1),
3660 Simulator::Schedule(
Seconds(15.1),
3664 Simulator::Schedule(
Seconds(15.1),
3678 Simulator::Schedule(
Seconds(16.0),
3692 Simulator::Schedule(
Seconds(16.1),
3696 Simulator::Schedule(
Seconds(16.1),
3700 Simulator::Schedule(
Seconds(16.1),
3706 Simulator::Schedule(
Seconds(16.1),
3710 Simulator::Schedule(
Seconds(16.1),
3714 Simulator::Schedule(
Seconds(16.1),
3728 Simulator::Schedule(
Seconds(17.0),
3742 Simulator::Schedule(
Seconds(17.1),
3746 Simulator::Schedule(
Seconds(17.1),
3750 Simulator::Schedule(
Seconds(17.1),
3757 Simulator::Schedule(
Seconds(17.1),
3761 Simulator::Schedule(
Seconds(17.1),
3765 Simulator::Schedule(
Seconds(17.1),
3779 Simulator::Schedule(
Seconds(18.0),
3793 Simulator::Schedule(
Seconds(18.1),
3797 Simulator::Schedule(
Seconds(18.1),
3801 Simulator::Schedule(
Seconds(18.1),
3807 Simulator::Schedule(
Seconds(18.1),
3811 Simulator::Schedule(
Seconds(18.1),
3815 Simulator::Schedule(
Seconds(18.1),
3829 Simulator::Schedule(
Seconds(19.0),
3843 Simulator::Schedule(
Seconds(19.1),
3847 Simulator::Schedule(
Seconds(19.1),
3851 Simulator::Schedule(
Seconds(19.1),
3857 Simulator::Schedule(
Seconds(19.1),
3861 Simulator::Schedule(
Seconds(19.1),
3865 Simulator::Schedule(
Seconds(19.1),
3879 Simulator::Schedule(
Seconds(20.0),
3893 Simulator::Schedule(
Seconds(20.1),
3897 Simulator::Schedule(
Seconds(20.1),
3901 Simulator::Schedule(
Seconds(20.1),
3908 Simulator::Schedule(
Seconds(20.1),
3912 Simulator::Schedule(
Seconds(20.1),
3916 Simulator::Schedule(
Seconds(20.1),
3930 Simulator::Schedule(
Seconds(21.0),
3944 Simulator::Schedule(
Seconds(21.1),
3948 Simulator::Schedule(
Seconds(21.1),
3952 Simulator::Schedule(
Seconds(21.1),
3958 Simulator::Schedule(
Seconds(21.1),
3962 Simulator::Schedule(
Seconds(21.1),
3966 Simulator::Schedule(
Seconds(21.1),
3980 Simulator::Schedule(
Seconds(22.0),
3994 Simulator::Schedule(
Seconds(22.1),
3998 Simulator::Schedule(
Seconds(22.1),
4002 Simulator::Schedule(
Seconds(22.1),
4008 Simulator::Schedule(
Seconds(22.1),
4012 Simulator::Schedule(
Seconds(22.1),
4016 Simulator::Schedule(
Seconds(22.1),
4029 Simulator::Schedule(
Seconds(23.0),
4044 Simulator::Schedule(
Seconds(23.1),
4048 Simulator::Schedule(
Seconds(23.1),
4052 Simulator::Schedule(
Seconds(23.1),
4060 Simulator::Schedule(
Seconds(23.1),
4064 Simulator::Schedule(
Seconds(23.1),
4068 Simulator::Schedule(
Seconds(23.1),
4076 Simulator::Destroy();
4121 void DoRun()
override;
4126 :
TestCase(
"Check correct behavior when a STA is receiving a transmission using an unsupported "
4142 if (reason ==
RXING)
4144 std::cout <<
"Dropped a packet because already receiving" << std::endl;
4152 uint16_t m_nStations = 2;
4158 int64_t streamNumber = 100;
4168 spectrumChannel->AddPropagationLossModel(lossModel);
4170 CreateObject<ConstantSpeedPropagationDelayModel>();
4171 spectrumChannel->SetPropagationDelayModel(delayModel);
4174 phy.SetChannel(spectrumChannel);
4179 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
4182 mac.SetType(
"ns3::StaWifiMac",
4194 mac.SetType(
"ns3::ApWifiMac",
4201 "EnableBeaconJitter",
4210 for (uint16_t i = 0; i < m_nStations; i++)
4212 dev = DynamicCast<WifiNetDevice>(m_staDevices.
Get(i));
4216 Ssid(
"wifi-backoff-ssid"));
4220 wifi.AssignStreams(m_apDevices, streamNumber);
4225 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
4226 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
4227 positionAlloc->Add(Vector(0.0, 1.0, 0.0));
4228 positionAlloc->Add(Vector(-1.0, 0.0, 0.0));
4229 mobility.SetPositionAllocator(positionAlloc);
4231 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
4236 dev = DynamicCast<WifiNetDevice>(m_apDevices.
Get(0));
4238 dev->
GetMac()->GetAttribute(
"BE_Txop", ptr);
4245 for (uint16_t i = 0; i < m_nStations; i++)
4255 client->SetRemote(socket);
4258 client->SetStopTime(
Seconds(1.0));
4260 legacyStaClient->SetAttribute(
"PacketSize",
UintegerValue(1500));
4261 legacyStaClient->SetAttribute(
"MaxPackets",
UintegerValue(200));
4263 legacyStaClient->SetRemote(socket);
4266 legacyStaClient->SetStopTime(
Seconds(1.0));
4268 server->SetLocal(socket);
4270 server->SetStartTime(
Seconds(0.0));
4271 server->SetStopTime(
Seconds(1.0));
4275 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyRxDrop",
4283 Simulator::Destroy();
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.
~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.
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 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'.
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.
uint32_t GetSize() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
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>.
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.
Ptr< WifiMac > GetMac() const
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.
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.
virtual int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
This objects implements the PHY state machine of the Wifi device.
std::vector< Ptr< WifiMpdu > >::const_iterator end() const
Return a const iterator to past-the-last MPDU.
std::vector< Ptr< WifiMpdu > >::const_iterator begin() const
Return a const iterator to the first MPDU.
uint32_t GetSize() const
Return the size of the PSDU in bytes.
bool IsAggregate() const
Return true if the PSDU is an S-MPDU or A-MPDU.
bool IsSingle() const
Return true if the PSDU is an S-MPDU.
std::size_t GetNMpdus() const
Return the number of MPDUs constituting the PSDU.
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 ",...
Time Now()
create an ns3::Time instance which contains the current simulation time.
#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.
@ 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.
@ CCA_BUSY
The PHY layer has sense the medium busy through the CCA mechanism.
@ RX
The PHY layer is receiving a packet.
@ IDLE
The PHY layer is IDLE.
static const uint32_t packetSize
Packet size generated at the AP.