24 #include "ns3/pointer.h"
25 #include "ns3/string.h"
26 #include "ns3/double.h"
27 #include "ns3/boolean.h"
28 #include "ns3/simulator.h"
29 #include "ns3/rng-seed-manager.h"
30 #include "ns3/constant-position-mobility-model.h"
31 #include "ns3/wifi-spectrum-signal-parameters.h"
32 #include "ns3/wifi-spectrum-value-helper.h"
33 #include "ns3/multi-model-spectrum-channel.h"
34 #include "ns3/spectrum-wifi-phy.h"
35 #include "ns3/nist-error-rate-model.h"
36 #include "ns3/interference-helper.h"
37 #include "ns3/wifi-mac-header.h"
38 #include "ns3/wifi-net-device.h"
39 #include "ns3/wifi-psdu.h"
40 #include "ns3/he-ppdu.h"
41 #include "ns3/wifi-utils.h"
42 #include "ns3/ap-wifi-mac.h"
43 #include "ns3/sta-wifi-mac.h"
44 #include "ns3/he-configuration.h"
45 #include "ns3/ctrl-headers.h"
46 #include "ns3/threshold-preamble-detection-model.h"
47 #include "ns3/he-phy.h"
48 #include "ns3/waveform-generator.h"
49 #include "ns3/non-communicating-net-device.h"
50 #include "ns3/spectrum-wifi-helper.h"
51 #include "ns3/mobility-helper.h"
92 void SetGlobalPpduUid (uint64_t uid);
115 return HePhy::GetStaId (ppdu);
213 static TypeId tid =
TypeId (
"ns3::OfdmaSpectrumWifiPhy")
215 .SetGroupName (
"Wifi")
216 .AddTraceSource (
"TxPpduUid",
217 "UID of the PPDU to be transmitted",
219 "ns3::OfdmaSpectrumWifiPhy::TxPpduUidCallback")
240 SpectrumWifiPhy::DoInitialize ();
247 SpectrumWifiPhy::DoDispose ();
267 SpectrumWifiPhy::StartTx (ppdu);
270 std::map <std::pair<uint64_t, WifiPreamble>,
Ptr<Event> > &
317 void DoRun (
void)
override;
327 WifiTxVector txVector, std::vector<bool> statusPerMpdu);
336 WifiTxVector txVector, std::vector<bool> statusPerMpdu);
345 WifiTxVector txVector, std::vector<bool> statusPerMpdu);
369 void CheckResultsSta1 (uint32_t expectedRxSuccess, uint32_t expectedRxFailure, uint32_t expectedRxBytes);
376 void CheckResultsSta2 (uint32_t expectedRxSuccess, uint32_t expectedRxFailure, uint32_t expectedRxBytes);
383 void CheckResultsSta3 (uint32_t expectedRxSuccess, uint32_t expectedRxFailure, uint32_t expectedRxBytes);
395 void SendMuPpdu (uint16_t rxStaId1, uint16_t rxStaId2);
449 m_countRxSuccessSta1 (0),
450 m_countRxSuccessSta2 (0),
451 m_countRxSuccessSta3 (0),
452 m_countRxFailureSta1 (0),
453 m_countRxFailureSta2 (0),
454 m_countRxFailureSta3 (0),
455 m_countRxBytesSta1 (0),
456 m_countRxBytesSta2 (0),
457 m_countRxBytesSta3 (0),
487 ruType = HeRu::RU_106_TONE;
491 ruType = HeRu::RU_242_TONE;
495 ruType = HeRu::RU_484_TONE;
499 ruType = HeRu::RU_996_TONE;
507 txVector.
SetRu (ru1, rxStaId1);
508 txVector.
SetMode (HePhy::GetHeMcs7 (), rxStaId1);
509 txVector.
SetNss (1, rxStaId1);
512 txVector.
SetRu (ru2, rxStaId2);
513 txVector.
SetMode (HePhy::GetHeMcs9 (), rxStaId2);
514 txVector.
SetNss (1, rxStaId2);
523 psdus.insert (std::make_pair (rxStaId1, psdu1));
532 psdus.insert (std::make_pair (rxStaId2, psdu2));
640 phy->GetAttribute (
"State", ptr);
642 currentState = state->GetState ();
653 spectrumChannel->AddPropagationLossModel (lossModel);
655 spectrumChannel->SetPropagationDelayModel (delayModel);
657 Ptr<Node> apNode = CreateObject<Node> ();
659 m_phyAp = CreateObject<SpectrumWifiPhy> ();
674 Ptr<Node> sta1Node = CreateObject<Node> ();
676 m_phySta1 = CreateObject<OfdmaSpectrumWifiPhy> (1);
693 Ptr<Node> sta2Node = CreateObject<Node> ();
695 m_phySta2 = CreateObject<OfdmaSpectrumWifiPhy> (2);
712 Ptr<Node> sta3Node = CreateObject<Node> ();
714 m_phySta3 = CreateObject<OfdmaSpectrumWifiPhy> (3);
731 Ptr<Node> interfererNode = CreateObject<Node> ();
737 interfererNode->
AddDevice (interfererDev);
758 RngSeedManager::SetSeed (1);
759 RngSeedManager::SetRun (1);
760 int64_t streamNumber = 0;
837 bands.push_back (bandInfo);
840 Ptr<SpectrumValue> interferencePsdRu1 = Create<SpectrumValue> (SpectrumInterferenceRu1);
841 double interferencePower = 0.1;
842 *interferencePsdRu1 = interferencePower / ((
m_channelWidth / 2) * 20e6);
873 bands.push_back (bandInfo);
876 Ptr<SpectrumValue> interferencePsdRu2 = Create<SpectrumValue> (SpectrumInterferenceRu2);
877 *interferencePsdRu2 = interferencePower / ((
m_channelWidth / 2) * 20e6);
908 bands.push_back (bandInfo);
911 Ptr<SpectrumValue> interferencePsdAll = Create<SpectrumValue> (SpectrumInterferenceAll);
912 *interferencePsdAll = interferencePower / (
m_channelWidth * 20e6);
961 Simulator::Destroy ();
980 void DoRun (
void)
override;
1021 void CheckUid (uint16_t staId, uint64_t expectedUid);
1033 :
TestCase (
"UL-OFDMA PPDU UID attribution test"),
1034 m_ppduUidAp (UINT64_MAX),
1035 m_ppduUidSta1 (UINT64_MAX),
1036 m_ppduUidSta2 (UINT64_MAX)
1050 spectrumChannel->AddPropagationLossModel (lossModel);
1052 spectrumChannel->SetPropagationDelayModel (delayModel);
1054 Ptr<Node> apNode = CreateObject<Node> ();
1056 m_phyAp = CreateObject<OfdmaSpectrumWifiPhy> (0);
1063 auto channelNum = std::get<0> (*WifiPhyOperatingChannel::FindFirst (0,
DEFAULT_FREQUENCY,
1078 Ptr<Node> sta1Node = CreateObject<Node> ();
1080 m_phySta1 = CreateObject<OfdmaSpectrumWifiPhy> (1);
1098 Ptr<Node> sta2Node = CreateObject<Node> ();
1100 m_phySta2 = CreateObject<OfdmaSpectrumWifiPhy> (2);
1190 uint16_t rxStaId1 = 1;
1192 txVector.
SetRu (ru1, rxStaId1);
1193 txVector.
SetMode (HePhy::GetHeMcs7 (), rxStaId1);
1194 txVector.
SetNss (1, rxStaId1);
1196 uint16_t rxStaId2 = 2;
1198 txVector.
SetRu (ru2, rxStaId2);
1199 txVector.
SetMode (HePhy::GetHeMcs9 (), rxStaId2);
1200 txVector.
SetNss (1, rxStaId2);
1209 psdus.insert (std::make_pair (rxStaId1, psdu1));
1218 psdus.insert (std::make_pair (rxStaId2, psdu2));
1231 uint16_t rxStaId1 = 1;
1233 txVector1.
SetRu (ru1, rxStaId1);
1234 txVector1.
SetMode (HePhy::GetHeMcs7 (), rxStaId1);
1235 txVector1.
SetNss (1, rxStaId1);
1244 psdus1.insert (std::make_pair (rxStaId1, psdu1));
1246 uint16_t rxStaId2 = 2;
1248 txVector2.
SetRu (ru2, rxStaId2);
1249 txVector2.
SetMode (HePhy::GetHeMcs9 (), rxStaId2);
1250 txVector2.
SetNss (1, rxStaId2);
1259 psdus2.insert (std::make_pair (rxStaId2, psdu2));
1284 hdr.
SetAddr1 (Mac48Address::GetBroadcast ());
1287 psdus.insert (std::make_pair (
SU_STA_ID, psdu));
1308 RngSeedManager::SetSeed (1);
1309 RngSeedManager::SetRun (1);
1310 int64_t streamNumber = 0;
1342 Simulator::Destroy ();
1360 void DoRun (
void)
override;
1370 void RxHeTbPpdu (uint64_t uid, uint16_t staId,
double txPowerWatts,
size_t payloadSize);
1419 :
TestCase (
"UL-OFDMA multiple RX events test"),
1420 m_totalBytesDropped (0),
1451 for (
auto const& uid : uids)
1454 auto it = events.find (pair);
1455 bool found = (it != events.end ());
1474 txVector.
SetRu (ru, staId);
1475 txVector.
SetMode (HePhy::GetHeMcs7 (), staId);
1476 txVector.
SetNss (1, staId);
1487 psdus.insert (std::make_pair (staId, psdu));
1491 HePpdu::PSD_HE_TB_NON_OFDMA_PORTION, 0);
1494 Time nonOfdmaDuration =
m_phy->
GetHePhy ()->CalculateNonOfdmaDurationForHeTb (txVector);
1495 uint32_t centerFrequency =
m_phy->
GetHePhy ()->GetCenterFrequencyForNonOfdmaPart (txVector, staId);
1496 uint16_t ruWidth = HeRu::GetBandwidth (txVector.
GetRu (staId).
GetRuType ());
1497 uint16_t channelWidth = ruWidth < 20 ? 20 : ruWidth;
1500 rxParams->psd = rxPsd;
1501 rxParams->txPhy = 0;
1502 rxParams->duration = nonOfdmaDuration;
1503 rxParams->ppdu = ppdu;
1506 std::tie (length, ppduDuration) = HePhy::ConvertHeTbPpduDurationToLSigLength (ppduDuration, txVector,
m_phy->
GetPhyBand ());
1514 Ptr<HePpdu> ppduOfdma = DynamicCast<HePpdu> (ppdu->Copy ());
1515 ppduOfdma->SetTxPsdFlag (HePpdu::PSD_HE_TB_OFDMA_PORTION);
1519 rxParamsOfdma->psd = rxPsd;
1520 rxParamsOfdma->txPhy = 0;
1521 rxParamsOfdma->duration = ppduDuration - nonOfdmaDuration;
1522 rxParamsOfdma->ppdu = ppduOfdma;
1544 m_phy = CreateObject<OfdmaSpectrumWifiPhy> (0);
1558 preambleDetectionModel->SetAttribute (
"Threshold",
DoubleValue (4));
1559 preambleDetectionModel->SetAttribute (
"MinimumRssi",
DoubleValue (-82));
1573 RngSeedManager::SetSeed (1);
1574 RngSeedManager::SetRun (1);
1575 int64_t streamNumber = 0;
1578 double txPowerWatts = 0.01;
1582 std::vector<uint64_t> uids {0};
1593 std::vector<uint64_t> uids {1, 2};
1607 std::vector<uint64_t> uids {3, 4};
1621 std::vector<uint64_t> uids {5, 6};
1636 std::vector<uint64_t> uids {7, 8};
1651 std::vector<uint64_t> uids {9};
1662 Simulator::Destroy ();
1693 void DoRun (
void)
override;
1718 void SendHeTbPpdu (uint16_t txStaId, std::size_t index, std::size_t payloadSize, uint64_t uid, uint8_t bssColor);
1727 void SendHeSuPpdu (uint16_t txStaId, std::size_t payloadSize, uint64_t uid, uint8_t bssColor);
1765 void CheckRxFromSta1 (uint32_t expectedSuccess, uint32_t expectedFailures, uint32_t expectedBytes);
1773 void CheckRxFromSta2 (uint32_t expectedSuccess, uint32_t expectedFailures, uint32_t expectedBytes);
1842 uint32_t expectedSuccessFromSta1, uint32_t expectedFailuresFromSta1, uint32_t expectedBytesFromSta1,
1843 uint32_t expectedSuccessFromSta2, uint32_t expectedFailuresFromSta2, uint32_t expectedBytesFromSta2,
1857 double rxPowerOfdmaRu1,
double rxPowerOfdmaRu2);
1886 m_countRxSuccessFromSta1 (0),
1887 m_countRxSuccessFromSta2 (0),
1888 m_countRxFailureFromSta1 (0),
1889 m_countRxFailureFromSta2 (0),
1890 m_countRxBytesFromSta1 (0),
1891 m_countRxBytesFromSta2 (0),
1904 WifiTxVector txVector =
WifiTxVector (HePhy::GetHeMcs7 (), 0,
WIFI_PREAMBLE_HE_SU, 800, 1, 1, 0,
m_channelWidth,
false,
false,
false, bssColor);
1911 std::ostringstream addr;
1912 addr <<
"00:00:00:00:00:0" << txStaId;
1916 psdus.insert (std::make_pair (
SU_STA_ID, psdu));
1923 else if (txStaId == 2)
1927 else if (txStaId == 3)
1931 else if (txStaId == 0)
1935 phy->SetPpduUid (uid);
1936 phy->Send (psdus, txVector);
1942 WifiTxVector txVector =
WifiTxVector (HePhy::GetHeMcs7 (), 0,
WIFI_PREAMBLE_HE_TB, 800, 1, 1, 0,
m_channelWidth,
false,
false,
false, bssColor);
1947 ruType = HeRu::RU_106_TONE;
1951 ruType = HeRu::RU_242_TONE;
1955 ruType = HeRu::RU_484_TONE;
1959 ruType = HeRu::RU_996_TONE;
1966 bool primary80MHz =
true;
1969 primary80MHz =
false;
1974 txVector.
SetRu (ru, txStaId);
1975 txVector.
SetMode (HePhy::GetHeMcs7 (), txStaId);
1976 txVector.
SetNss (1, txStaId);
1986 channelWidth = (channelWidth == 160 ? 20 : channelWidth * 2);
1990 channelWidth,
false,
false,
false, bssColor);
1993 if (channelWidth == 20)
1995 ruType = (error ==
RU_TYPE ? HeRu::RU_52_TONE : HeRu::RU_106_TONE);
1997 else if (channelWidth == 40)
1999 ruType = (error ==
RU_TYPE ? HeRu::RU_106_TONE : HeRu::RU_242_TONE);
2001 else if (channelWidth == 80)
2003 ruType = (error ==
RU_TYPE ? HeRu::RU_242_TONE : HeRu::RU_484_TONE);
2005 else if (channelWidth == 160)
2007 ruType = (error ==
RU_TYPE ? HeRu::RU_484_TONE : HeRu::RU_996_TONE);
2014 uint16_t aid1 = (error ==
AID ? 3 : 1);
2015 uint16_t aid2 = (error ==
AID ? 4 : 2);
2019 txVector.
SetRu (ru1, aid1);
2020 txVector.
SetMode ((error ==
MCS ? HePhy::GetHeMcs5 () : HePhy::GetHeMcs7 ()), aid1);
2021 txVector.
SetNss (1, aid1);
2023 HeRu::RuSpec ru2 (ruType, (channelWidth == 160 ? 1 : 2),
2024 (channelWidth == 160 ?
false :
true));
2026 txVector.
SetRu (ru2, aid2);
2027 txVector.
SetMode ((error ==
MCS ? HePhy::GetHeMcs5 () : HePhy::GetHeMcs7 ()), aid2);
2028 txVector.
SetNss (1, aid2);
2046 NS_LOG_FUNCTION (
this << txStaId << index << payloadSize << uid << +bssColor);
2055 std::ostringstream addr;
2056 addr <<
"00:00:00:00:00:0" << txStaId;
2060 psdus.insert (std::make_pair (txStaId, psdu));
2067 else if (txStaId == 2)
2071 else if (txStaId == 3)
2076 Time txDuration =
phy->CalculateTxDuration (psdu->
GetSize (), txVector,
phy->GetPhyBand (), txStaId);
2077 txVector.
SetLength (HePhy::ConvertHeTbPpduDurationToLSigLength (txDuration, txVector,
phy->GetPhyBand ()).first);
2079 phy->SetPpduUid (uid);
2080 phy->Send (psdus, txVector);
2154 double rxPower =
event->GetRxPowerW (band);
2155 NS_LOG_FUNCTION (
this << band.first << band.second << expectedRxPower << rxPower);
2157 NS_TEST_ASSERT_MSG_EQ_TOL (rxPower, expectedRxPower, 5e-3,
"RX power " << rxPower <<
" over (" << band.first <<
", " << band.second <<
") does not match expected power " << expectedRxPower <<
" at " <<
Simulator::Now ());
2168 NS_LOG_FUNCTION (
this << band.first << band.second << expectedRxPower);
2170 if (expectedRxPower > 0.0)
2173 "At least " << expectedRxPower <<
" W expected for OFDMA part over (" << band.first <<
", " << band.second <<
") at " <<
Simulator::Now ());
2175 "At most " << expectedRxPower <<
" W expected for OFDMA part over (" << band.first <<
", " << band.second <<
") at " <<
Simulator::Now ());
2180 "At most " << expectedRxPower <<
" W expected for OFDMA part over (" << band.first <<
", " << band.second <<
") at " <<
Simulator::Now ());
2204 phy->GetAttribute (
"State", ptr);
2206 currentState = state->GetState ();
2231 heConfiguration->SetAttribute (
"BssColor",
UintegerValue (bssColor));
2247 spectrumChannel->AddPropagationLossModel (lossModel);
2249 spectrumChannel->SetPropagationDelayModel (delayModel);
2252 preambleDetectionModel->SetAttribute (
"MinimumRssi",
DoubleValue (-8));
2253 preambleDetectionModel->SetAttribute (
"Threshold",
DoubleValue (-100));
2255 Ptr<Node> apNode = CreateObject<Node> ();
2259 apMac->SetAttribute (
"BeaconGeneration",
BooleanValue (
false));
2261 m_phyAp = CreateObject<OfdmaSpectrumWifiPhy> (0);
2281 Ptr<Node> sta1Node = CreateObject<Node> ();
2283 m_phySta1 = CreateObject<OfdmaSpectrumWifiPhy> (1);
2299 Ptr<Node> sta2Node = CreateObject<Node> ();
2301 m_phySta2 = CreateObject<OfdmaSpectrumWifiPhy> (2);
2317 Ptr<Node> sta3Node = CreateObject<Node> ();
2319 m_phySta3 = CreateObject<OfdmaSpectrumWifiPhy> (3);
2335 Ptr<Node> interfererNode = CreateObject<Node> ();
2341 interfererNode->
AddDevice (interfererDev);
2345 for (
auto &
phy : phys)
2378 uint32_t expectedSuccessFromSta1, uint32_t expectedFailuresFromSta1, uint32_t expectedBytesFromSta1,
2379 uint32_t expectedSuccessFromSta2, uint32_t expectedFailuresFromSta2, uint32_t expectedBytesFromSta2,
2380 bool scheduleTxSta1,
WifiPhyState expectedStateBeforeEnd,
2383 static uint64_t uid = 0;
2411 expectedSuccessFromSta1, expectedFailuresFromSta1, expectedBytesFromSta1);
2414 expectedSuccessFromSta2, expectedFailuresFromSta2, expectedBytesFromSta2);
2424 double rxPowerOfdmaRu1,
double rxPowerOfdmaRu2)
2426 Time detectionDuration = WifiPhy::GetPreambleDetectionDuration ();
2430 Time nonOfdmaDuration = hePhy->CalculateNonOfdmaDurationForHeTb (txVectorSta2);
2431 NS_ASSERT (nonOfdmaDuration == hePhy->CalculateNonOfdmaDurationForHeTb (txVectorSta1));
2433 std::vector<double> rxPowerNonOfdma { rxPowerNonOfdmaRu1, rxPowerNonOfdmaRu2 };
2434 std::vector<WifiSpectrumBand> nonOfdmaBand { hePhy->GetNonOfdmaBand (txVectorSta1, 1), hePhy->GetNonOfdmaBand (txVectorSta2, 2) };
2435 std::vector<double> rxPowerOfdma { rxPowerOfdmaRu1, rxPowerOfdmaRu2 };
2436 std::vector<WifiSpectrumBand> ofdmaBand { hePhy->GetRuBandForRx (txVectorSta1, 1), hePhy->GetRuBandForRx (txVectorSta2, 2) };
2438 for (uint8_t i = 0; i < 2; ++i)
2444 Simulator::Schedule (delay + detectionDuration +
NanoSeconds (1),
2446 nonOfdmaBand[i], rxPowerNonOfdma[i]);
2447 Simulator::Schedule (delay + nonOfdmaDuration -
NanoSeconds (1),
2449 nonOfdmaBand[i], rxPowerNonOfdma[i]);
2451 Simulator::Schedule (delay + nonOfdmaDuration +
NanoSeconds (1),
2453 ofdmaBand[i], rxPowerOfdma[i]);
2456 ofdmaBand[i], rxPowerOfdma[i]);
2464 Simulator::Schedule (delay + detectionDuration +
NanoSeconds (1),
2466 nonOfdmaBand[i], rxPowerNonOfdma[i]);
2467 Simulator::Schedule (delay + nonOfdmaDuration -
NanoSeconds (1),
2469 nonOfdmaBand[i], rxPowerNonOfdma[i]);
2471 Simulator::Schedule (delay + nonOfdmaDuration +
NanoSeconds (1),
2473 ofdmaBand[i], rxPowerOfdma[i]);
2476 ofdmaBand[i], rxPowerOfdma[i]);
2479 if (rxPowerOfdmaRu1 != 0.0)
2486 double rxPowerNonOfdmaSta1Only = (
m_channelWidth >= 40) ? rxPowerNonOfdma[0] : rxPowerNonOfdma[0] / 2;
2488 Simulator::Schedule (delay + detectionDuration +
NanoSeconds (1),
2490 nonOfdmaBand[0], rxPowerNonOfdmaSta1Only);
2491 Simulator::Schedule (delay + nonOfdmaDuration -
NanoSeconds (1),
2493 nonOfdmaBand[0], rxPowerNonOfdmaSta1Only);
2495 Simulator::Schedule (delay + nonOfdmaDuration +
NanoSeconds (1),
2497 ofdmaBand[0], rxPowerOfdma[0]);
2500 ofdmaBand[0], rxPowerOfdma[0]);
2507 RngSeedManager::SetSeed (1);
2508 RngSeedManager::SetRun (1);
2509 int64_t streamNumber = 0;
2543 "Reception of solicited HE TB PPDUs");
2553 "Dropping of unsolicited HE TB PPDUs");
2564 "Dropping of HE TB PPDUs with channel width differing from TRIGVECTOR");
2575 "Dropping of HE TB PPDUs with UL Length differing from TRIGVECTOR");
2586 "Dropping of HE TB PPDUs with AIDs differing from TRIGVECTOR");
2597 "Dropping of HE TB PPDUs with RU type differing from TRIGVECTOR");
2608 "Dropping of HE TB PPDUs with MCS differing from TRIGVECTOR");
2619 "Reception of solicited HE TB PPDUs with interference on RU 1 during PSDU reception");
2626 bands.push_back (bandInfo);
2629 Ptr<SpectrumValue> interferencePsdRu1 = Create<SpectrumValue> (SpectrumInterferenceRu1);
2630 double interferencePower = 0.1;
2631 *interferencePsdRu1 = interferencePower / ((
m_channelWidth / 2) * 20e6);
2643 "Reception of solicited HE TB PPDUs with interference on RU 2 during PSDU reception");
2649 bands.push_back (bandInfo);
2652 Ptr<SpectrumValue> interferencePsdRu2 = Create<SpectrumValue> (SpectrumInterferenceRu2);
2653 *interferencePsdRu2 = interferencePower / ((
m_channelWidth / 2) * 20e6);
2665 "Reception of solicited HE TB PPDUs with interference on the full band during PSDU reception");
2671 bands.push_back (bandInfo);
2674 Ptr<SpectrumValue> interferencePsdAll = Create<SpectrumValue> (SpectrumInterferenceAll);
2675 *interferencePsdAll = interferencePower / (
m_channelWidth * 20e6);
2688 "Reception of solicited HE TB PPDUs with another HE TB PPDU arriving on RU 1 during PSDU reception");
2692 uint32_t succ, fail, bytes;
2717 "Reception of solicited HE TB PPDUs with another HE TB PPDU arriving on RU 2 during PSDU reception");
2744 "Reception of solicited HE TB PPDUs with an HE SU PPDU arriving during the 400 ns window");
2756 "Reception of solicited HE TB PPDU only on RU 2");
2770 "Measure power for reception of HE TB PPDU only on RU 2");
2771 double rxPower =
DbmToW (19);
2785 "Measure power for reception of HE TB PPDU only on RU 2 with PSD limitation");
2791 double rxPowerOfdma = rxPower;
2814 "Measure power for reception of HE TB PPDU on both RUs");
2816 double rxPowerNonOfdma = (
m_channelWidth >= 40) ? rxPower : rxPower * 2;
2818 rxPowerNonOfdma, rxPowerNonOfdma,
2829 "Reception of an HE SU PPDU from another BSS");
2870 Simulator::Destroy ();
2888 void DoRun (
void)
override;
2897 void SendHeTbPpdu (uint16_t txStaId, std::size_t index, std::size_t payloadSize,
Time txDuration);
2927 void CheckRxFromSta1 (uint32_t expectedSuccess, uint32_t expectedFailures, uint32_t expectedBytes);
2935 void CheckRxFromSta2 (uint32_t expectedSuccess, uint32_t expectedFailures, uint32_t expectedBytes);
2986 :
TestCase (
"PHY padding exclusion test"),
2987 m_countRxSuccessFromSta1 (0),
2988 m_countRxSuccessFromSta2 (0),
2989 m_countRxFailureFromSta1 (0),
2990 m_countRxFailureFromSta2 (0),
2991 m_countRxBytesFromSta1 (0),
2992 m_countRxBytesFromSta2 (0)
3001 WifiTxVector txVector =
WifiTxVector (HePhy::GetHeMcs7 (), 0,
WIFI_PREAMBLE_HE_TB, 800, 1, 1, 0,
DEFAULT_CHANNEL_WIDTH,
false,
false, 1);
3004 txVector.
SetRu (ru, txStaId);
3005 txVector.
SetMode (HePhy::GetHeMcs7 (), txStaId);
3006 txVector.
SetNss (1, txStaId);
3013 std::ostringstream addr;
3014 addr <<
"00:00:00:00:00:0" << txStaId;
3018 psdus.insert (std::make_pair (txStaId, psdu));
3025 else if (txStaId == 2)
3030 txVector.
SetLength (HePhy::ConvertHeTbPpduDurationToLSigLength (txDuration, txVector,
phy->GetPhyBand ()).first);
3032 phy->SetPpduUid (0);
3033 phy->Send (psdus, txVector);
3141 RngSeedManager::SetSeed (1);
3142 RngSeedManager::SetRun (1);
3143 int64_t streamNumber = 0;
3148 spectrumChannel->AddPropagationLossModel (lossModel);
3150 spectrumChannel->SetPropagationDelayModel (delayModel);
3152 Ptr<Node> apNode = CreateObject<Node> ();
3155 apMac->SetAttribute (
"BeaconGeneration",
BooleanValue (
false));
3157 m_phyAp = CreateObject<OfdmaSpectrumWifiPhy> (0);
3169 auto channelNum = std::get<0> (*WifiPhyOperatingChannel::FindFirst (0,
DEFAULT_FREQUENCY,
3184 Ptr<Node> sta1Node = CreateObject<Node> ();
3186 m_phySta1 = CreateObject<OfdmaSpectrumWifiPhy> (1);
3204 Ptr<Node> sta2Node = CreateObject<Node> ();
3206 m_phySta2 = CreateObject<OfdmaSpectrumWifiPhy> (2);
3224 Ptr<Node> interfererNode = CreateObject<Node> ();
3230 interfererNode->
AddDevice (interfererDev);
3252 trigVector.
SetMode (HePhy::GetHeMcs7 (), 1);
3253 trigVector.
SetNss (1, 1);
3255 trigVector.
SetMode (HePhy::GetHeMcs7 (), 2);
3256 trigVector.
SetNss (1, 2);
3258 std::tie (length, ppduDuration) = HePhy::ConvertHeTbPpduDurationToLSigLength (ppduDuration,
3263 hePhyAp->SetTrigVector (trigVector, ppduDuration);
3270 Time ppduWithPaddingDuration = expectedPpduDuration + 10 *
NanoSeconds (12800 + 800 );
3280 ppduWithPaddingDuration);
3302 ppduWithPaddingDuration);
3310 bands.push_back (bandInfo);
3313 Ptr<SpectrumValue> interferencePsdRu1 = Create<SpectrumValue> (SpectrumInterferenceRu1);
3314 double interferencePower = 0.1;
3334 Simulator::Destroy ();
3352 void DoRun (
void)
override;
3359 void SendMuBar (std::vector <uint16_t> staIds);
3375 void RunOne (
bool setupBa);
3393 WifiTxVector txVector, std::vector<bool> statusPerMpdu);
3418 :
TestCase (
"UL-OFDMA power control test"),
3423 m_txPowerLevels (0),
3424 m_requestedRssiSta1 (0),
3425 m_requestedRssiSta2 (0),
3451 NS_ASSERT (!staIds.empty () && staIds.size () <= 2);
3463 HeRu::RuType ru = (staIds.size () == 1) ? HeRu::RU_242_TONE : HeRu::RU_106_TONE;
3464 std::size_t index = 1;
3465 int8_t ulTargetRssi = -40;
3466 for (
auto const& staId : staIds)
3479 else if (staId == 2)
3490 bar.
SetType (BlockAckReqType::COMPRESSED);
3509 if (staIds.size () == 1)
3511 uint16_t aidSta1 = DynamicCast<StaWifiMac> (
m_sta1Dev->
GetMac ())->GetAssociationId ();
3512 if (staIds.front () == aidSta1)
3535 uint16_t staId = staIds.front ();
3538 psdus.insert (std::make_pair (
SU_STA_ID, psdu));
3548 double rssi = rxSignalInfo.
rssi;
3576 Ptr<Node> apNode = CreateObject<Node> ();
3582 spectrumChannel->AddPropagationLossModel (lossModel);
3584 spectrumChannel->SetPropagationDelayModel (delayModel);
3589 spectrumPhy.
Set (
"ChannelSettings",
StringValue (
"{0, 0, BAND_5GHZ, 0}"));
3593 wifi.SetRemoteStationManager (
"ns3::ConstantRateWifiManager",
3598 mac.SetType (
"ns3::StaWifiMac");
3600 wifi.AssignStreams (staDevs, 0);
3601 m_sta1Dev = DynamicCast<WifiNetDevice> (staDevs.
Get (0));
3603 m_sta2Dev = DynamicCast<WifiNetDevice> (staDevs.
Get (1));
3609 mac.SetType (
"ns3::ApWifiMac",
3612 m_apDev = DynamicCast<WifiNetDevice> (
wifi.Install (spectrumPhy,
mac, apNode).Get (0));
3620 mobility.SetMobilityModel (
"ns3::ConstantPositionMobilityModel");
3622 positionAlloc->Add (Vector (0.0, 0.0, 0.0));
3623 positionAlloc->Add (Vector (1.0, 0.0, 0.0));
3624 positionAlloc->Add (Vector (2.0, 0.0, 0.0));
3625 mobility.SetPositionAllocator (positionAlloc);
3630 lossModel->SetDefaultLoss (50.0);
3651 RngSeedManager::SetSeed (1);
3652 RngSeedManager::SetRun (1);
3653 int64_t streamNumber = 0;
3687 apMac->SetAttribute (
"BeaconGeneration",
BooleanValue (
false));
3694 std::vector<uint16_t> staIds {1};
3700 std::vector<uint16_t> staIds {2};
3706 std::vector<uint16_t> staIds {1, 2};
3783 Simulator::Destroy ();
SpectrumWifiPhy used for testing OFDMA.
Time GetEnergyDuration(double energyW, WifiSpectrumBand band)
Wrapper to InterferenceHelper method.
void SetTriggerFrameUid(uint64_t uid)
Since we assume trigger frame was previously received from AP, this is used to set its UID.
void(* TxPpduUidCallback)(uint64_t uid)
TracedCallback signature for UID of transmitted PPDU.
void StartTx(Ptr< WifiPpdu > ppdu) override
void SetPpduUid(uint64_t uid)
Set the global PPDU UID counter.
Ptr< Event > GetCurrentEvent(void)
void DoInitialize(void) override
Initialize() implementation.
Ptr< const HePhy > GetHePhy(void) const
Ptr< OfdmaTestHePhy > m_ofdmTestHePhy
Pointer to HE PHY instance used for OFDMA test.
uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const override
void DoDispose(void) override
Destructor implementation.
OfdmaSpectrumWifiPhy(uint16_t staId)
Constructor.
virtual ~OfdmaSpectrumWifiPhy()
std::map< std::pair< uint64_t, WifiPreamble >, Ptr< Event > > & GetCurrentPreambleEvents(void)
static TypeId GetTypeId(void)
Get the type ID.
TracedCallback< uint64_t > m_phyTxPpduUidTrace
Callback providing UID of the PPDU that is about to be transmitted.
HE PHY slightly modified so as to return a given STA-ID in case of DL MU for OfdmaSpectrumWifiPhy.
OfdmaTestHePhy(uint16_t staId)
Constructor.
virtual ~OfdmaTestHePhy()
void SetGlobalPpduUid(uint64_t uid)
Set the global PPDU UID counter.
uint16_t GetStaId(const Ptr< const WifiPpdu > ppdu) const override
Return the STA ID that has been assigned to the station this PHY belongs to.
uint16_t m_staId
ID of the STA to which this PHY belongs to.
uint16_t m_frequency
frequency in MHz
uint16_t m_channelWidth
channel width in MHz
uint32_t m_countRxFailureSta2
count RX failure for STA 2
void RxSuccessSta3(Ptr< WifiPsdu > psdu, RxSignalInfo rxSignalInfo, WifiTxVector txVector, std::vector< bool > statusPerMpdu)
Receive success function for STA 3.
void RunOne()
Run one function.
void RxFailureSta2(Ptr< WifiPsdu > psdu)
Receive failure function for STA 2.
uint32_t m_countRxBytesSta2
count RX bytes for STA 2
Time m_expectedPpduDuration
expected duration to send MU PPDU
void RxFailureSta1(Ptr< WifiPsdu > psdu)
Receive failure function for STA 1.
void GenerateInterference(Ptr< SpectrumValue > interferencePsd, Time duration)
Generate interference function.
void DoRun(void) override
Implementation to actually run this TestCase.
void RxSuccessSta2(Ptr< WifiPsdu > psdu, RxSignalInfo rxSignalInfo, WifiTxVector txVector, std::vector< bool > statusPerMpdu)
Receive success function for STA 2.
Ptr< WaveformGenerator > m_phyInterferer
PHY of interferer.
void DoTeardown(void) override
Implementation to do any local setup required for this TestCase.
uint32_t m_countRxFailureSta3
count RX failure for STA 3
void StopInterference(void)
Stop interference function.
virtual ~TestDlOfdmaPhyTransmission()
uint32_t m_countRxBytesSta1
count RX bytes for STA 1
TestDlOfdmaPhyTransmission()
Ptr< OfdmaSpectrumWifiPhy > m_phySta2
PHY of STA 2.
void DoSetup(void) override
Implementation to do any local setup required for this TestCase.
Ptr< SpectrumWifiPhy > m_phyAp
PHY of AP.
Ptr< OfdmaSpectrumWifiPhy > m_phySta1
PHY of STA 1.
void CheckResultsSta2(uint32_t expectedRxSuccess, uint32_t expectedRxFailure, uint32_t expectedRxBytes)
Check the results for STA 2.
void RxFailureSta3(Ptr< WifiPsdu > psdu)
Receive failure function for STA 3.
void CheckPhyState(Ptr< OfdmaSpectrumWifiPhy > phy, WifiPhyState expectedState)
Schedule now to check the PHY state.
uint32_t m_countRxSuccessSta2
count RX success for STA 2
uint32_t m_countRxFailureSta1
count RX failure for STA 1
void CheckResultsSta1(uint32_t expectedRxSuccess, uint32_t expectedRxFailure, uint32_t expectedRxBytes)
Check the results for STA 1.
Ptr< OfdmaSpectrumWifiPhy > m_phySta3
PHY of STA 3.
uint32_t m_countRxSuccessSta3
count RX success for STA 3
void DoCheckPhyState(Ptr< OfdmaSpectrumWifiPhy > phy, WifiPhyState expectedState)
Check the PHY state now.
uint32_t m_countRxBytesSta3
count RX bytes for STA 3
void RxSuccessSta1(Ptr< WifiPsdu > psdu, RxSignalInfo rxSignalInfo, WifiTxVector txVector, std::vector< bool > statusPerMpdu)
Receive success function for STA 1.
void ResetResults()
Reset the results.
uint32_t m_countRxSuccessSta1
count RX success for STA 1
void CheckResultsSta3(uint32_t expectedRxSuccess, uint32_t expectedRxFailure, uint32_t expectedRxBytes)
Check the results for STA 3.
void SendMuPpdu(uint16_t rxStaId1, uint16_t rxStaId2)
Send MU-PPDU function.
UL-OFDMA multiple RX events test.
WifiTxVector m_trigVector
TRIGVECTOR.
Ptr< OfdmaSpectrumWifiPhy > m_phy
Phy.
void Reset(void)
Reset function.
void DoRun(void) override
Implementation to actually run this TestCase.
void RxHeTbPpduOfdmaPart(Ptr< WifiSpectrumSignalParameters > rxParamsOfdma)
Receive OFDMA part of HE TB PPDU function.
void CheckHeTbPreambles(size_t nEvents, std::vector< uint64_t > uids)
Check the received HE TB preambles.
void DoTeardown(void) override
Implementation to do any local setup required for this TestCase.
void RxHeTbPpdu(uint64_t uid, uint16_t staId, double txPowerWatts, size_t payloadSize)
Receive HE TB PPDU function.
void DoSetup(void) override
Implementation to do any local setup required for this TestCase.
TestMultipleHeTbPreambles()
uint64_t m_totalBytesDropped
total number of dropped bytes
void CheckBytesDropped(size_t expectedBytesDropped)
Check the number of bytes dropped.
virtual ~TestMultipleHeTbPreambles()
void RxDropped(Ptr< const Packet > p, WifiPhyRxfailureReason reason)
RX dropped function.
void DoRxHeTbPpduOfdmaPart(Ptr< WifiSpectrumSignalParameters > rxParamsOfdma)
Receive OFDMA part of HE TB PPDU function.
PHY padding exclusion test.
void CheckRxFromSta1(uint32_t expectedSuccess, uint32_t expectedFailures, uint32_t expectedBytes)
Check the received PSDUs from STA1.
Ptr< OfdmaSpectrumWifiPhy > m_phySta2
PHY of STA 2.
void VerifyEventsCleared(void)
Verify all events are cleared at end of TX or RX.
TestPhyPaddingExclusion()
void DoCheckPhyState(Ptr< OfdmaSpectrumWifiPhy > phy, WifiPhyState expectedState)
Check the PHY state.
void RxFailure(Ptr< WifiPsdu > psdu)
Receive failure function.
void GenerateInterference(Ptr< SpectrumValue > interferencePsd, Time duration)
Generate interference function.
Ptr< WaveformGenerator > m_phyInterferer
PHY of interferer.
uint32_t m_countRxSuccessFromSta2
count RX success from STA 2
void DoSetup(void) override
Implementation to do any local setup required for this TestCase.
uint32_t m_countRxBytesFromSta1
count RX bytes from STA 1
void StopInterference(void)
Stop interference function.
Ptr< OfdmaSpectrumWifiPhy > m_phyAp
PHY of AP.
Ptr< OfdmaSpectrumWifiPhy > m_phySta1
PHY of STA 1.
void DoTeardown(void) override
Implementation to do any local setup required for this TestCase.
void SendHeTbPpdu(uint16_t txStaId, std::size_t index, std::size_t payloadSize, Time txDuration)
Send HE TB PPDU function.
void RxSuccess(Ptr< WifiPsdu > psdu, RxSignalInfo rxSignalInfo, WifiTxVector txVector, std::vector< bool > statusPerMpdu)
Receive success function.
void SetTrigVector(Time ppduDuration)
Set TRIGVECTOR for HE TB PPDU.
void Reset()
Reset function.
uint32_t m_countRxFailureFromSta1
count RX failure from STA 1
uint32_t m_countRxSuccessFromSta1
count RX success from STA 1
void RunOne()
Run one function.
void CheckRxFromSta2(uint32_t expectedSuccess, uint32_t expectedFailures, uint32_t expectedBytes)
Check the received PSDUs from STA2.
virtual ~TestPhyPaddingExclusion()
void DoRun(void) override
Implementation to actually run this TestCase.
uint32_t m_countRxFailureFromSta2
count RX failure from STA 2
uint32_t m_countRxBytesFromSta2
count RX bytes from STA 2
void CheckPhyState(Ptr< OfdmaSpectrumWifiPhy > phy, WifiPhyState expectedState)
Check the PHY state.
void DoTeardown(void) override
Implementation to do any local setup required for this TestCase.
void GenerateInterference(Ptr< SpectrumValue > interferencePsd, Time duration)
Generate interference function.
void VerifyEventsCleared(void)
Verify all events are cleared at end of TX or RX.
WifiTxVector GetTxVectorForHeTbPpdu(uint16_t txStaId, std::size_t index, uint8_t bssColor) const
Get TXVECTOR for HE TB PPDU.
uint32_t m_countRxFailureFromSta1
count RX failure from STA 1
void CheckOfdmaRxPower(Ptr< OfdmaSpectrumWifiPhy > phy, WifiSpectrumBand band, double expectedRxPower)
Check the received power for the OFDMA part of the HE TB PPDUs over the given band.
void StopInterference(void)
Stop interference function.
void RxFailure(Ptr< WifiPsdu > psdu)
Receive failure function.
void DoCheckPhyState(Ptr< OfdmaSpectrumWifiPhy > phy, WifiPhyState expectedState)
Check the PHY state.
uint32_t m_countRxBytesFromSta1
count RX bytes from STA 1
uint16_t m_frequency
frequency in MHz
TrigVectorInfo
Erroneous info included in a TRIGVECTOR.
void SchedulePowerMeasurementChecks(Time delay, double rxPowerNonOfdmaRu1, double rxPowerNonOfdmaRu2, double rxPowerOfdmaRu1, double rxPowerOfdmaRu2)
Schedule power measurement related checks.
void SetBssColor(Ptr< WifiPhy > phy, uint8_t bssColor)
Set the BSS color.
void ScheduleTest(Time delay, bool solicited, WifiPhyState expectedStateAtEnd, uint32_t expectedSuccessFromSta1, uint32_t expectedFailuresFromSta1, uint32_t expectedBytesFromSta1, uint32_t expectedSuccessFromSta2, uint32_t expectedFailuresFromSta2, uint32_t expectedBytesFromSta2, bool scheduleTxSta1=true, WifiPhyState expectedStateBeforeEnd=WifiPhyState::RX, TrigVectorInfo error=NONE)
Schedule test to perform.
Ptr< OfdmaSpectrumWifiPhy > m_phySta2
PHY of STA 2.
void LogScenario(std::string log) const
Log scenario description.
void CheckRxFromSta2(uint32_t expectedSuccess, uint32_t expectedFailures, uint32_t expectedBytes)
Check the received PSDUs from STA2.
void SetPsdLimit(Ptr< WifiPhy > phy, double psdLimit)
Set the PSD limit.
uint32_t m_countRxBytesFromSta2
count RX bytes from STA 2
void Reset()
Reset function.
void DoSetup(void) override
Implementation to do any local setup required for this TestCase.
void CheckPhyState(Ptr< OfdmaSpectrumWifiPhy > phy, WifiPhyState expectedState)
Check the PHY state.
Ptr< OfdmaSpectrumWifiPhy > m_phySta1
PHY of STA 1.
TestUlOfdmaPhyTransmission()
void CheckRxFromSta1(uint32_t expectedSuccess, uint32_t expectedFailures, uint32_t expectedBytes)
Check the received PSDUs from STA1.
void DoRun(void) override
Implementation to actually run this TestCase.
void CheckNonOfdmaRxPower(Ptr< OfdmaSpectrumWifiPhy > phy, WifiSpectrumBand band, double expectedRxPower)
Check the received power for the non-OFDMA of the HE TB PPDUs over the given band.
void RxSuccess(Ptr< WifiPsdu > psdu, RxSignalInfo rxSignalInfo, WifiTxVector txVector, std::vector< bool > statusPerMpdu)
Receive success function.
void RunOne()
Run one function.
uint32_t m_countRxSuccessFromSta2
count RX success from STA 2
Ptr< WaveformGenerator > m_phyInterferer
PHY of interferer.
Ptr< OfdmaSpectrumWifiPhy > m_phySta3
PHY of STA 3.
uint16_t m_channelWidth
channel width in MHz
void SendHeSuPpdu(uint16_t txStaId, std::size_t payloadSize, uint64_t uid, uint8_t bssColor)
Send HE SU PPDU function.
uint32_t m_countRxFailureFromSta2
count RX failure from STA 2
void SendHeTbPpdu(uint16_t txStaId, std::size_t index, std::size_t payloadSize, uint64_t uid, uint8_t bssColor)
Send HE TB PPDU function.
void SetTrigVector(uint8_t bssColor, TrigVectorInfo error)
Set TRIGVECTOR for HE TB PPDU.
Time m_expectedPpduDuration
expected duration to send MU PPDU
uint32_t m_countRxSuccessFromSta1
count RX success from STA 1
virtual ~TestUlOfdmaPhyTransmission()
Ptr< OfdmaSpectrumWifiPhy > m_phyAp
PHY of AP.
UL-OFDMA power control test.
double m_requestedRssiSta1
requested RSSI (in dBm) from STA 1 at AP for HE TB PPDUs
double m_txPowerStart
minimum transmission power (in dBm) for STAs
double m_rssiSta2
expected RSSI (in dBm) from STA 2 at AP for HE TB PPDUs
Ptr< WifiNetDevice > m_sta2Dev
network device of STA 2
void DoRun(void) override
Implementation to actually run this TestCase.
double m_txPowerEnd
maximum transmission power (in dBm) for STAs
void SetupBa(Address destination)
Send a QoS Data packet to the destination station in order to set up a block Ack session (so that the...
Ptr< WifiNetDevice > m_sta1Dev
network device of STA 1
double m_tol
tolerance (in dB) between received and expected RSSIs
Ptr< WifiNetDevice > m_apDev
network device of AP
uint8_t m_bssColor
BSS color.
double m_rssiSta1
expected RSSI (in dBm) from STA 1 at AP for HE TB PPDUs
uint8_t m_txPowerLevels
number of transmission power levels for STAs
double m_requestedRssiSta2
requested RSSI (in dBm) from STA 2 at AP for HE TB PPDUs
void DoTeardown(void) override
Implementation to do any local setup required for this TestCase.
TestUlOfdmaPowerControl()
double m_txPowerAp
transmit power (in dBm) of AP
void ReplaceReceiveOkCallbackOfAp(void)
Replace the AP's callback on its PHY's ReceiveOkCallback by the ReceiveOkCallbackAtAp method.
void RunOne(bool setupBa)
Run one simulation with an optional BA session set up phase.
Ptr< SpectrumWifiPhy > m_phyAp
PHY of AP.
virtual ~TestUlOfdmaPowerControl()
void ReceiveOkCallbackAtAp(Ptr< WifiPsdu > psdu, RxSignalInfo rxSignalInfo, WifiTxVector txVector, std::vector< bool > statusPerMpdu)
Receive OK callback function at AP.
void DoSetup(void) override
Implementation to do any local setup required for this TestCase.
void SendMuBar(std::vector< uint16_t > staIds)
Send a MU BAR through the AP to the STAs listed in the provided vector.
UL-OFDMA PPDU UID attribution test.
virtual ~TestUlOfdmaPpduUid()
void SendMuPpdu(void)
Send MU-PPDU toward both STAs.
void TxPpduSta1(uint64_t uid)
Transmitted PPDU information function for STA 1.
void CheckUid(uint16_t staId, uint64_t expectedUid)
Check the UID of the transmitted PPDU.
void TxPpduAp(uint64_t uid)
Transmitted PPDU information function for AP.
void TxPpduSta2(uint64_t uid)
Transmitted PPDU information function for STA 2.
Ptr< OfdmaSpectrumWifiPhy > m_phySta2
PHY of STA 2.
uint64_t m_ppduUidAp
UID of PPDU transmitted by AP.
void DoRun(void) override
Implementation to actually run this TestCase.
void DoTeardown(void) override
Implementation to do any local setup required for this TestCase.
void SendTbPpdu(void)
Send TB-PPDU from both STAs.
void ResetPpduUid(void)
Reset the global PPDU UID counter in WifiPhy.
uint64_t m_ppduUidSta1
UID of PPDU transmitted by STA1.
uint64_t m_ppduUidSta2
UID of PPDU transmitted by STA2.
void DoSetup(void) override
Implementation to do any local setup required for this TestCase.
Ptr< OfdmaSpectrumWifiPhy > m_phySta1
PHY of STA 1.
Ptr< OfdmaSpectrumWifiPhy > m_phyAp
PHY of AP.
void SendSuPpdu(uint16_t txStaId)
Send SU-PPDU function.
wifi PHY OFDMA Test Suite
a polymophic address class
AttributeValue implementation for Boolean.
User Info field of Trigger frames.
void SetAid12(uint16_t aid)
Set the AID12 subfield, which carries the 12 LSBs of the AID of the station for which this User Info ...
void SetUlFecCodingType(bool ldpc)
Set the UL FEC Coding Type subfield, which indicates whether BCC or LDPC is used.
void SetUlMcs(uint8_t mcs)
Set the UL MCS subfield, which indicates the MCS of the solicited HE TB PPDU.
void SetMuBarTriggerDepUserInfo(const CtrlBAckRequestHeader &bar)
Set the Trigger Dependent User Info subfield for the MU-BAR variant of Trigger frames,...
void SetUlDcm(bool dcm)
Set the UL DCM subfield, which indicates whether or not DCM is used.
void SetSsAllocation(uint8_t startingSs, uint8_t nSs)
Set the SS Allocation subfield, which is present when the AID12 subfield is neither 0 nor 2045.
void SetUlTargetRssi(int8_t dBm)
Set the UL Target RSSI subfield to indicate the expected receive signal power in dBm.
void SetRuAllocation(HeRu::RuSpec ru)
Set the RU Allocation subfield according to the specified RU.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
RuType GetRuType(void) const
Get the RU type.
void SetPhyIndex(uint16_t bw, uint8_t p20Index)
Set the RU PHY index.
RuType
The different HE Resource Unit (RU) types.
Helper class used to assign positions and mobility models to nodes.
Keep track of the current position and velocity of an object.
holds a vector of ns3::NetDevice pointers
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.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
void Dispose(void)
Dispose of this Object.
void AddHeader(const Header &header)
Add header to this packet.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
void SetOwner(Ptr< WifiPhy > wifiPhy)
Set the WifiPhy owning this PHY entity.
static uint64_t m_globalPpduUid
Global counter of the PPDU UID.
Hold objects of type Ptr<T>.
Smart pointer class similar to boost::intrusive_ptr.
Make it easy to create and manage PHY objects for the spectrum model.
void SetChannel(Ptr< SpectrumChannel > channel)
void SetChannel(const Ptr< SpectrumChannel > channel)
Set the SpectrumChannel this SpectrumWifiPhy is to be connected to.
void StartRx(Ptr< SpectrumSignalParameters > rxParams)
Input method for delivering a signal from the spectrum channel and low-level PHY interface to this Sp...
void CreateWifiSpectrumPhyInterface(Ptr< NetDevice > device)
Method to encapsulate the creation of the WifiSpectrumPhyInterface object (used to bind the WifiSpect...
Hold variables of type string.
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.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Hold an unsigned integer type.
helps to create WifiNetDevice objects
create MAC layers for a ns3::WifiNetDevice.
void SetMac(const Ptr< WifiMac > mac)
void SetHeConfiguration(Ptr< HeConfiguration > heConfiguration)
Ptr< WifiMac > GetMac(void) const
bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber) override
Address GetAddress(void) const override
Ptr< WifiPhy > GetPhy(void) const
void SetStandard(WifiStandard standard)
Set the Wifi standard.
void SetPhy(const Ptr< WifiPhy > phy)
Ptr< HeConfiguration > GetHeConfiguration(void) const
void Set(std::string name, const AttributeValue &v)
void SetErrorRateModel(std::string type, Args &&... args)
Helper function used to set the error rate model.
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.
std::map< std::pair< uint64_t, WifiPreamble >, Ptr< Event > > m_currentPreambleEvents
store event associated to a PPDU (that has a unique ID and preamble combination) whose preamble is be...
WifiPhyBand GetPhyBand(void) const
Get the configured Wi-Fi band.
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 Reset(void)
Reset data upon end of TX or RX.
std::map< WifiModulationClass, Ptr< PhyEntity > > m_phyEntities
This map holds the supported PHY entities.
void SetOperatingChannel(const ChannelTuple &channelTuple)
If the standard for this object has not been set yet, store the given channel settings.
Ptr< Event > m_currentEvent
Hold the current event.
Ptr< PhyEntity > GetPhyEntity(WifiModulationClass modulation) const
Get the supported PHY entity corresponding to the modulation class, for the WifiPhy instance.
uint64_t m_previouslyRxPpduUid
UID of the previously received PPDU, reset to UINT64_MAX upon transmission.
void SetDevice(const Ptr< WifiNetDevice > device)
Sets the device this PHY is associated with.
void SetPreambleDetectionModel(const Ptr< PreambleDetectionModel > preambleDetectionModel)
Sets the preamble detection model.
Time GetSifs(void) const
Return the Short Interframe Space (SIFS) for this PHY.
void SetMobility(const Ptr< MobilityModel > mobility)
assign a mobility model to this device
Ptr< InterferenceHelper > m_interference
Pointer to a helper responsible for interference computations.
void SetReceiveOkCallback(RxOkCallback callback)
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.
uint32_t GetSize(void) const
Return the size of the PSDU in bytes.
const WifiMacHeader & GetHeader(std::size_t i) const
Get the header of the i-th MPDU.
std::size_t GetNMpdus(void) const
Return the number of MPDUs constituting the PSDU.
Mac48Address GetAddr2(void) const
Get the Transmitter Address (TA), which is common to all the MPDUs.
void SetDuration(Time duration)
Set the Duration/ID field on all the MPDUs.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
WifiPreamble GetPreambleType(void) const
HeRu::RuSpec GetRu(uint16_t staId) const
Get the RU specification for the STA-ID.
void SetRu(HeRu::RuSpec ru, uint16_t staId)
Set the RU specification for the STA-ID.
void SetLength(uint16_t length)
Set the LENGTH field of the L-SIG.
const HeMuUserInfoMap & GetHeMuUserInfoMap(void) const
Get a const reference to the map HE MU user-specific transmission information indexed by STA-ID.
void SetMode(WifiMode mode)
Sets the selected payload transmission mode.
void SetNss(uint8_t nss)
Sets the number of Nss.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
void Reset(void)
Reset the initial value of every attribute as well as the value of every global to what they were bef...
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Time Now(void)
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_ASSERT_MSG_EQ_TOL(actual, limit, tol, msg)
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report and...
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.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
WifiPhyRxfailureReason
Enumeration of the possible reception failure reasons.
WifiPhyBand
Identifies the PHY band.
@ WIFI_PHY_BAND_5GHZ
The 5 GHz band.
@ WIFI_MOD_CLASS_HE
HE (Clause 27)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
std::pair< uint32_t, uint32_t > WifiSpectrumBand
typedef for a pair of start and stop sub-band indexes
std::vector< BandInfo > Bands
Container of BandInfo.
double DbmToW(double dBm)
Convert from dBm to Watts.
uint32_t GetBlockAckSize(BlockAckType type)
Return the total BlockAck size (including FCS trailer).
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
The building block of a SpectrumModel.
double fc
center frequency
double fl
lower limit of subband
double fh
upper limit of subband
HE MU specific user transmission parameters.
RxSignalInfo structure containing info on the received signal.
static const uint16_t DEFAULT_CHANNEL_WIDTH
static WifiPhyOfdmaTestSuite wifiPhyOfdmaTestSuite
the test suite
static const uint8_t DEFAULT_CHANNEL_NUMBER
static const WifiPhyBand DEFAULT_WIFI_BAND
static const uint16_t DEFAULT_GUARD_WIDTH
static const uint32_t DEFAULT_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.