24 #include "ns3/pointer.h" 25 #include "ns3/string.h" 26 #include "ns3/simulator.h" 27 #include "ns3/rng-seed-manager.h" 28 #include "ns3/constant-position-mobility-model.h" 29 #include "ns3/wifi-spectrum-signal-parameters.h" 30 #include "ns3/wifi-spectrum-value-helper.h" 31 #include "ns3/multi-model-spectrum-channel.h" 32 #include "ns3/spectrum-wifi-phy.h" 33 #include "ns3/nist-error-rate-model.h" 34 #include "ns3/wifi-mac-header.h" 35 #include "ns3/wifi-net-device.h" 36 #include "ns3/wifi-psdu.h" 37 #include "ns3/he-ppdu.h" 38 #include "ns3/wifi-utils.h" 39 #include "ns3/ap-wifi-mac.h" 40 #include "ns3/sta-wifi-mac.h" 41 #include "ns3/he-configuration.h" 42 #include "ns3/ctrl-headers.h" 43 #include "ns3/threshold-preamble-detection-model.h" 44 #include "ns3/he-phy.h" 45 #include "ns3/waveform-generator.h" 46 #include "ns3/non-communicating-net-device.h" 47 #include "ns3/spectrum-wifi-helper.h" 48 #include "ns3/mobility-helper.h" 89 void SetGlobalPpduUid (uint64_t uid);
112 return HePhy::GetStaId (ppdu);
210 static TypeId tid =
TypeId (
"ns3::OfdmaSpectrumWifiPhy")
212 .SetGroupName (
"Wifi")
213 .AddTraceSource (
"TxPpduUid",
214 "UID of the PPDU to be transmitted",
216 "ns3::OfdmaSpectrumWifiPhy::TxPpduUidCallback")
237 SpectrumWifiPhy::DoInitialize ();
244 SpectrumWifiPhy::DoDispose ();
264 SpectrumWifiPhy::StartTx (ppdu);
267 std::map <std::pair<uint64_t, WifiPreamble>,
Ptr<Event> > &
314 void DoRun (
void)
override;
324 WifiTxVector txVector, std::vector<bool> statusPerMpdu);
333 WifiTxVector txVector, std::vector<bool> statusPerMpdu);
342 WifiTxVector txVector, std::vector<bool> statusPerMpdu);
366 void CheckResultsSta1 (uint32_t expectedRxSuccess, uint32_t expectedRxFailure, uint32_t expectedRxBytes);
373 void CheckResultsSta2 (uint32_t expectedRxSuccess, uint32_t expectedRxFailure, uint32_t expectedRxBytes);
380 void CheckResultsSta3 (uint32_t expectedRxSuccess, uint32_t expectedRxFailure, uint32_t expectedRxBytes);
392 void SendMuPpdu (uint16_t rxStaId1, uint16_t rxStaId2);
446 m_countRxSuccessSta1 (0),
447 m_countRxSuccessSta2 (0),
448 m_countRxSuccessSta3 (0),
449 m_countRxFailureSta1 (0),
450 m_countRxFailureSta2 (0),
451 m_countRxFailureSta3 (0),
452 m_countRxBytesSta1 (0),
453 m_countRxBytesSta2 (0),
454 m_countRxBytesSta3 (0),
484 ruType = HeRu::RU_106_TONE;
488 ruType = HeRu::RU_242_TONE;
492 ruType = HeRu::RU_484_TONE;
496 ruType = HeRu::RU_996_TONE;
504 txVector.
SetRu (ru1, rxStaId1);
505 txVector.
SetMode (HePhy::GetHeMcs7 (), rxStaId1);
506 txVector.
SetNss (1, rxStaId1);
509 txVector.
SetRu (ru2, rxStaId2);
510 txVector.
SetMode (HePhy::GetHeMcs9 (), rxStaId2);
511 txVector.
SetNss (1, rxStaId2);
518 hdr1.SetSequenceNumber (1);
520 psdus.insert (std::make_pair (rxStaId1, psdu1));
527 hdr2.SetSequenceNumber (2);
529 psdus.insert (std::make_pair (rxStaId2, psdu2));
637 phy->GetAttribute (
"State", ptr);
654 Ptr<Node> apNode = CreateObject<Node> ();
656 m_phyAp = CreateObject<SpectrumWifiPhy> ();
669 Ptr<Node> sta1Node = CreateObject<Node> ();
671 m_phySta1 = CreateObject<OfdmaSpectrumWifiPhy> (1);
685 Ptr<Node> sta2Node = CreateObject<Node> ();
687 m_phySta2 = CreateObject<OfdmaSpectrumWifiPhy> (2);
701 Ptr<Node> sta3Node = CreateObject<Node> ();
703 m_phySta3 = CreateObject<OfdmaSpectrumWifiPhy> (3);
717 Ptr<Node> interfererNode = CreateObject<Node> ();
723 interfererNode->
AddDevice (interfererDev);
744 RngSeedManager::SetSeed (1);
745 RngSeedManager::SetRun (1);
746 int64_t streamNumber = 0;
822 bands.push_back (bandInfo);
825 Ptr<SpectrumValue> interferencePsdRu1 = Create<SpectrumValue> (SpectrumInterferenceRu1);
826 double interferencePower = 0.1;
827 *interferencePsdRu1 = interferencePower / ((
m_channelWidth / 2) * 20e6);
858 bands.push_back (bandInfo);
861 Ptr<SpectrumValue> interferencePsdRu2 = Create<SpectrumValue> (SpectrumInterferenceRu2);
862 *interferencePsdRu2 = interferencePower / ((
m_channelWidth / 2) * 20e6);
893 bands.push_back (bandInfo);
896 Ptr<SpectrumValue> interferencePsdAll = Create<SpectrumValue> (SpectrumInterferenceAll);
897 *interferencePsdAll = interferencePower / (
m_channelWidth * 20e6);
946 Simulator::Destroy ();
965 void DoRun (
void)
override;
1006 void CheckUid (uint16_t staId, uint64_t expectedUid);
1018 :
TestCase (
"UL-OFDMA PPDU UID attribution test"),
1019 m_ppduUidAp (UINT64_MAX),
1020 m_ppduUidSta1 (UINT64_MAX),
1021 m_ppduUidSta2 (UINT64_MAX)
1039 Ptr<Node> apNode = CreateObject<Node> ();
1041 m_phyAp = CreateObject<OfdmaSpectrumWifiPhy> (0);
1057 Ptr<Node> sta1Node = CreateObject<Node> ();
1059 m_phySta1 = CreateObject<OfdmaSpectrumWifiPhy> (1);
1074 Ptr<Node> sta2Node = CreateObject<Node> ();
1076 m_phySta2 = CreateObject<OfdmaSpectrumWifiPhy> (2);
1163 uint16_t rxStaId1 = 1;
1165 txVector.
SetRu (ru1, rxStaId1);
1166 txVector.
SetMode (HePhy::GetHeMcs7 (), rxStaId1);
1167 txVector.
SetNss (1, rxStaId1);
1169 uint16_t rxStaId2 = 2;
1171 txVector.
SetRu (ru2, rxStaId2);
1172 txVector.
SetMode (HePhy::GetHeMcs9 (), rxStaId2);
1173 txVector.
SetNss (1, rxStaId2);
1180 hdr1.SetSequenceNumber (1);
1182 psdus.insert (std::make_pair (rxStaId1, psdu1));
1189 hdr2.SetSequenceNumber (2);
1191 psdus.insert (std::make_pair (rxStaId2, psdu2));
1204 uint16_t rxStaId1 = 1;
1206 txVector1.
SetRu (ru1, rxStaId1);
1207 txVector1.
SetMode (HePhy::GetHeMcs7 (), rxStaId1);
1208 txVector1.
SetNss (1, rxStaId1);
1215 hdr1.SetSequenceNumber (1);
1217 psdus1.insert (std::make_pair (rxStaId1, psdu1));
1219 uint16_t rxStaId2 = 2;
1221 txVector2.
SetRu (ru2, rxStaId2);
1222 txVector2.
SetMode (HePhy::GetHeMcs9 (), rxStaId2);
1223 txVector2.
SetNss (1, rxStaId2);
1230 hdr2.SetSequenceNumber (2);
1232 psdus2.insert (std::make_pair (rxStaId2, psdu2));
1257 hdr.SetAddr1 (Mac48Address::GetBroadcast ());
1258 hdr.SetSequenceNumber (1);
1260 psdus.insert (std::make_pair (
SU_STA_ID, psdu));
1281 RngSeedManager::SetSeed (1);
1282 RngSeedManager::SetRun (1);
1283 int64_t streamNumber = 0;
1315 Simulator::Destroy ();
1333 void DoRun (
void)
override;
1343 void RxHeTbPpdu (uint64_t uid, uint16_t staId,
double txPowerWatts,
size_t payloadSize);
1391 :
TestCase (
"UL-OFDMA multiple RX events test"),
1392 m_totalBytesDropped (0)
1421 for (
auto const& uid : uids)
1424 auto it = events.find (pair);
1425 bool found = (it != events.end ());
1444 txVector.
SetRu (ru, staId);
1445 txVector.
SetMode (HePhy::GetHeMcs7 (), staId);
1446 txVector.
SetNss (1, staId);
1453 hdr.SetSequenceNumber (1);
1455 psdus.insert (std::make_pair (staId, psdu));
1459 HePpdu::PSD_HE_TB_NON_OFDMA_PORTION);
1462 Time nonOfdmaDuration =
m_phy->
GetHePhy ()->CalculateNonOfdmaDurationForHeTb (txVector);
1463 uint32_t centerFrequency =
m_phy->
GetHePhy ()->GetCenterFrequencyForNonOfdmaPart (txVector, staId);
1464 uint16_t ruWidth = HeRu::GetBandwidth (txVector.GetRu (staId).GetRuType ());
1465 uint16_t channelWidth = ruWidth < 20 ? 20 : ruWidth;
1468 rxParams->psd = rxPsd;
1469 rxParams->txPhy = 0;
1470 rxParams->duration = nonOfdmaDuration;
1471 rxParams->ppdu = ppdu;
1477 ppduOfdma->
SetTxPsdFlag (HePpdu::PSD_HE_TB_OFDMA_PORTION);
1481 rxParamsOfdma->
psd = rxPsd;
1482 rxParamsOfdma->
txPhy = 0;
1483 rxParamsOfdma->
duration = ppduDuration - nonOfdmaDuration;
1484 rxParamsOfdma->
ppdu = ppduOfdma;
1506 m_phy = CreateObject<OfdmaSpectrumWifiPhy> (0);
1534 RngSeedManager::SetSeed (1);
1535 RngSeedManager::SetRun (1);
1536 int64_t streamNumber = 0;
1539 double txPowerWatts = 0.01;
1543 std::vector<uint64_t> uids {0};
1554 std::vector<uint64_t> uids {1, 2};
1568 std::vector<uint64_t> uids {3, 4};
1582 std::vector<uint64_t> uids {5, 6};
1597 std::vector<uint64_t> uids {7, 8};
1612 std::vector<uint64_t> uids {9};
1625 Simulator::Destroy ();
1643 void DoRun (
void)
override;
1661 void SendHeTbPpdu (uint16_t txStaId, std::size_t index, std::size_t payloadSize, uint64_t uid, uint8_t bssColor);
1670 void SendHeSuPpdu (uint16_t txStaId, std::size_t payloadSize, uint64_t uid, uint8_t bssColor);
1708 void CheckRxFromSta1 (uint32_t expectedSuccess, uint32_t expectedFailures, uint32_t expectedBytes);
1716 void CheckRxFromSta2 (uint32_t expectedSuccess, uint32_t expectedFailures, uint32_t expectedBytes);
1784 uint32_t expectedSuccessFromSta1, uint32_t expectedFailuresFromSta1, uint32_t expectedBytesFromSta1,
1785 uint32_t expectedSuccessFromSta2, uint32_t expectedFailuresFromSta2, uint32_t expectedBytesFromSta2,
1798 double rxPowerOfdmaRu1,
double rxPowerOfdmaRu2);
1827 m_countRxSuccessFromSta1 (0),
1828 m_countRxSuccessFromSta2 (0),
1829 m_countRxFailureFromSta1 (0),
1830 m_countRxFailureFromSta2 (0),
1831 m_countRxBytesFromSta1 (0),
1832 m_countRxBytesFromSta2 (0),
1845 WifiTxVector txVector =
WifiTxVector (HePhy::GetHeMcs7 (), 0,
WIFI_PREAMBLE_HE_SU, 800, 1, 1, 0,
m_channelWidth,
false,
false,
false, bssColor);
1852 std::ostringstream addr;
1853 addr <<
"00:00:00:00:00:0" << txStaId;
1855 hdr.SetSequenceNumber (1);
1857 psdus.insert (std::make_pair (
SU_STA_ID, psdu));
1864 else if (txStaId == 2)
1868 else if (txStaId == 3)
1872 else if (txStaId == 0)
1876 phy->SetPpduUid (uid);
1877 phy->Send (psdus, txVector);
1883 WifiTxVector txVector =
WifiTxVector (HePhy::GetHeMcs7 (), 0,
WIFI_PREAMBLE_HE_TB, 800, 1, 1, 0,
m_channelWidth,
false,
false,
false, bssColor);
1888 ruType = HeRu::RU_106_TONE;
1892 ruType = HeRu::RU_242_TONE;
1896 ruType = HeRu::RU_484_TONE;
1900 ruType = HeRu::RU_996_TONE;
1907 bool primary80MHz =
true;
1910 primary80MHz =
false;
1915 txVector.
SetRu (ru, txStaId);
1916 txVector.
SetMode (HePhy::GetHeMcs7 (), txStaId);
1917 txVector.
SetNss (1, txStaId);
1924 NS_LOG_FUNCTION (
this << txStaId << index << payloadSize << uid << +bssColor);
1933 std::ostringstream addr;
1934 addr <<
"00:00:00:00:00:0" << txStaId;
1936 hdr.SetSequenceNumber (1);
1938 psdus.insert (std::make_pair (txStaId, psdu));
1945 else if (txStaId == 2)
1949 else if (txStaId == 3)
1954 Time txDuration =
phy->CalculateTxDuration (psdu->
GetSize (), txVector,
phy->GetPhyBand (), txStaId);
1955 txVector.
SetLength (HePhy::ConvertHeTbPpduDurationToLSigLength (txDuration,
phy->GetPhyBand ()));
1957 phy->SetPpduUid (uid);
1958 phy->Send (psdus, txVector);
2032 double rxPower =
event->GetRxPowerW (band);
2033 NS_LOG_FUNCTION (
this << band.first << band.second << expectedRxPower << rxPower);
2035 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 ());
2046 NS_LOG_FUNCTION (
this << band.first << band.second << expectedRxPower);
2048 if (expectedRxPower > 0.0)
2051 "At least " << expectedRxPower <<
" W expected for OFDMA part over (" << band.first <<
", " << band.second <<
") at " <<
Simulator::Now ());
2053 "At most " << expectedRxPower <<
" W expected for OFDMA part over (" << band.first <<
", " << band.second <<
") at " <<
Simulator::Now ());
2058 "At most " << expectedRxPower <<
" W expected for OFDMA part over (" << band.first <<
", " << band.second <<
") at " <<
Simulator::Now ());
2082 phy->GetAttribute (
"State", ptr);
2109 heConfiguration->SetAttribute (
"BssColor",
UintegerValue (bssColor));
2133 Ptr<Node> apNode = CreateObject<Node> ();
2136 apMac->SetAttribute (
"BeaconGeneration",
BooleanValue (
false));
2137 apDev->SetMac (apMac);
2138 m_phyAp = CreateObject<OfdmaSpectrumWifiPhy> (0);
2142 apDev->SetHeConfiguration (heConfiguration);
2156 Ptr<Node> sta1Node = CreateObject<Node> ();
2158 m_phySta1 = CreateObject<OfdmaSpectrumWifiPhy> (1);
2171 Ptr<Node> sta2Node = CreateObject<Node> ();
2173 m_phySta2 = CreateObject<OfdmaSpectrumWifiPhy> (2);
2186 Ptr<Node> sta3Node = CreateObject<Node> ();
2188 m_phySta3 = CreateObject<OfdmaSpectrumWifiPhy> (3);
2201 Ptr<Node> interfererNode = CreateObject<Node> ();
2207 interfererNode->
AddDevice (interfererDev);
2211 for (
auto &
phy : phys)
2244 uint32_t expectedSuccessFromSta1, uint32_t expectedFailuresFromSta1, uint32_t expectedBytesFromSta1,
2245 uint32_t expectedSuccessFromSta2, uint32_t expectedFailuresFromSta2, uint32_t expectedBytesFromSta2,
2246 bool scheduleTxSta1,
WifiPhyState expectedStateBeforeEnd)
2265 expectedSuccessFromSta1, expectedFailuresFromSta1, expectedBytesFromSta1);
2268 expectedSuccessFromSta2, expectedFailuresFromSta2, expectedBytesFromSta2);
2278 double rxPowerOfdmaRu1,
double rxPowerOfdmaRu2)
2280 Time detectionDuration = WifiPhy::GetPreambleDetectionDuration ();
2287 std::vector<double> rxPowerNonOfdma { rxPowerNonOfdmaRu1, rxPowerNonOfdmaRu2 };
2289 std::vector<double> rxPowerOfdma { rxPowerOfdmaRu1, rxPowerOfdmaRu2 };
2292 for (uint8_t i = 0; i < 2; ++i)
2298 Simulator::Schedule (delay + detectionDuration +
NanoSeconds (1),
2300 nonOfdmaBand[i], rxPowerNonOfdma[i]);
2301 Simulator::Schedule (delay + nonOfdmaDuration -
NanoSeconds (1),
2303 nonOfdmaBand[i], rxPowerNonOfdma[i]);
2305 Simulator::Schedule (delay + nonOfdmaDuration +
NanoSeconds (1),
2307 ofdmaBand[i], rxPowerOfdma[i]);
2310 ofdmaBand[i], rxPowerOfdma[i]);
2318 Simulator::Schedule (delay + detectionDuration +
NanoSeconds (1),
2320 nonOfdmaBand[i], rxPowerNonOfdma[i]);
2321 Simulator::Schedule (delay + nonOfdmaDuration -
NanoSeconds (1),
2323 nonOfdmaBand[i], rxPowerNonOfdma[i]);
2325 Simulator::Schedule (delay + nonOfdmaDuration +
NanoSeconds (1),
2327 ofdmaBand[i], rxPowerOfdma[i]);
2330 ofdmaBand[i], rxPowerOfdma[i]);
2333 if (rxPowerOfdmaRu1 != 0.0)
2340 double rxPowerNonOfdmaSta1Only = (
m_channelWidth >= 40) ? rxPowerNonOfdma[0] : rxPowerNonOfdma[0] / 2;
2342 Simulator::Schedule (delay + detectionDuration +
NanoSeconds (1),
2344 nonOfdmaBand[0], rxPowerNonOfdmaSta1Only);
2345 Simulator::Schedule (delay + nonOfdmaDuration -
NanoSeconds (1),
2347 nonOfdmaBand[0], rxPowerNonOfdmaSta1Only);
2349 Simulator::Schedule (delay + nonOfdmaDuration +
NanoSeconds (1),
2351 ofdmaBand[0], rxPowerOfdma[0]);
2354 ofdmaBand[0], rxPowerOfdma[0]);
2361 RngSeedManager::SetSeed (1);
2362 RngSeedManager::SetRun (1);
2363 int64_t streamNumber = 0;
2396 "Reception of solicited HE TB PPDUs");
2406 "Reception of unsolicited HE TB PPDUs");
2416 "Reception of solicited HE TB PPDUs with interference on RU 1 during PSDU reception");
2423 bands.push_back (bandInfo);
2426 Ptr<SpectrumValue> interferencePsdRu1 = Create<SpectrumValue> (SpectrumInterferenceRu1);
2427 double interferencePower = 0.1;
2428 *interferencePsdRu1 = interferencePower / ((
m_channelWidth / 2) * 20e6);
2440 "Reception of unsolicited HE TB PPDUs with interference on RU 1 during PSDU reception");
2452 "Reception of solicited HE TB PPDUs with interference on RU 2 during PSDU reception");
2458 bands.push_back (bandInfo);
2461 Ptr<SpectrumValue> interferencePsdRu2 = Create<SpectrumValue> (SpectrumInterferenceRu2);
2462 *interferencePsdRu2 = interferencePower / ((
m_channelWidth / 2) * 20e6);
2474 "Reception of unsolicited HE TB PPDUs with interference on RU 2 during PSDU reception");
2486 "Reception of solicited HE TB PPDUs with interference on the full band during PSDU reception");
2492 bands.push_back (bandInfo);
2495 Ptr<SpectrumValue> interferencePsdAll = Create<SpectrumValue> (SpectrumInterferenceAll);
2496 *interferencePsdAll = interferencePower / (
m_channelWidth * 20e6);
2508 "Reception of unsolicited HE TB PPDUs with interference on the full band during PSDU reception");
2521 "Reception of solicited HE TB PPDUs with another HE TB PPDU arriving on RU 1 during PSDU reception");
2525 uint32_t succ, fail, bytes;
2550 "Reception of unsolicited HE TB PPDUs with another HE TB PPDU arriving on RU 1 during PSDU reception");
2563 "Reception of solicited HE TB PPDUs with another HE TB PPDU arriving on RU 2 during PSDU reception");
2591 "Reception of unsolicited HE TB PPDUs with another HE TB PPDU arriving on RU2 during payload reception");
2603 "Reception of solicited HE TB PPDUs with an HE SU PPDU arriving during the 400 ns window");
2615 "Reception of unsolicited HE TB PPDUs with an HE SU PPDU arriving during the 400 ns window");
2627 "Reception of solicited HE TB PPDU only on RU 2");
2642 "Reception of unsolicited HE TB PPDUs only on RU 2");
2674 "Measure power for reception of HE TB PPDU only on RU 2");
2675 double rxPower =
DbmToW (19);
2689 "Measure power for reception of HE TB PPDU only on RU 2 with PSD limitation");
2695 double rxPowerOfdma = rxPower;
2718 "Measure power for reception of HE TB PPDU on both RUs");
2720 double rxPowerNonOfdma = (
m_channelWidth >= 40) ? rxPower : rxPower * 2;
2722 rxPowerNonOfdma, rxPowerNonOfdma,
2733 "Reception of an HE SU PPDU from another BSS");
2774 Simulator::Destroy ();
2792 void DoRun (
void)
override;
2801 void SendHeTbPpdu (uint16_t txStaId, std::size_t index, std::size_t payloadSize,
Time txDuration);
2825 void CheckRxFromSta1 (uint32_t expectedSuccess, uint32_t expectedFailures, uint32_t expectedBytes);
2833 void CheckRxFromSta2 (uint32_t expectedSuccess, uint32_t expectedFailures, uint32_t expectedBytes);
2884 :
TestCase (
"PHY padding exclusion test"),
2885 m_countRxSuccessFromSta1 (0),
2886 m_countRxSuccessFromSta2 (0),
2887 m_countRxFailureFromSta1 (0),
2888 m_countRxFailureFromSta2 (0),
2889 m_countRxBytesFromSta1 (0),
2890 m_countRxBytesFromSta2 (0)
2899 WifiTxVector txVector =
WifiTxVector (HePhy::GetHeMcs7 (), 0,
WIFI_PREAMBLE_HE_TB, 800, 1, 1, 0,
DEFAULT_CHANNEL_WIDTH,
false,
false, 1);
2902 txVector.
SetRu (ru, txStaId);
2903 txVector.
SetMode (HePhy::GetHeMcs7 (), txStaId);
2904 txVector.
SetNss (1, txStaId);
2911 std::ostringstream addr;
2912 addr <<
"00:00:00:00:00:0" << txStaId;
2914 hdr.SetSequenceNumber (1);
2916 psdus.insert (std::make_pair (txStaId, psdu));
2923 else if (txStaId == 2)
2928 txVector.
SetLength (HePhy::ConvertHeTbPpduDurationToLSigLength (txDuration,
phy->GetPhyBand ()));
2930 phy->SetPpduUid (0);
2931 phy->Send (psdus, txVector);
3039 RngSeedManager::SetSeed (1);
3040 RngSeedManager::SetRun (1);
3041 int64_t streamNumber = 0;
3050 Ptr<Node> apNode = CreateObject<Node> ();
3053 apMac->SetAttribute (
"BeaconGeneration",
BooleanValue (
false));
3054 apDev->SetMac (apMac);
3055 m_phyAp = CreateObject<OfdmaSpectrumWifiPhy> (0);
3059 apDev->SetHeConfiguration (heConfiguration);
3075 Ptr<Node> sta1Node = CreateObject<Node> ();
3077 m_phySta1 = CreateObject<OfdmaSpectrumWifiPhy> (1);
3092 Ptr<Node> sta2Node = CreateObject<Node> ();
3094 m_phySta2 = CreateObject<OfdmaSpectrumWifiPhy> (2);
3109 Ptr<Node> interfererNode = CreateObject<Node> ();
3115 interfererNode->
AddDevice (interfererDev);
3135 Time ppduWithPaddingDuration = expectedPpduDuration + 10 *
NanoSeconds (12800 + 800 );
3167 bands.push_back (bandInfo);
3170 Ptr<SpectrumValue> interferencePsdRu1 = Create<SpectrumValue> (SpectrumInterferenceRu1);
3171 double interferencePower = 0.1;
3191 Simulator::Destroy ();
3209 void DoRun (
void)
override;
3216 void SendMuBar (std::vector <uint16_t> staIds);
3232 void RunOne (
bool setupBa);
3250 WifiTxVector txVector, std::vector<bool> statusPerMpdu);
3275 :
TestCase (
"UL-OFDMA power control test"),
3280 m_txPowerLevels (0),
3281 m_requestedRssiSta1 (0),
3282 m_requestedRssiSta2 (0),
3308 NS_ASSERT (!staIds.empty () && staIds.size () <= 2);
3314 muBar.SetMoreTF (
true);
3315 muBar.SetCsRequired (
true);
3317 muBar.SetGiAndLtfType (1600, 2);
3318 muBar.SetApTxPower (static_cast<int8_t> (
m_txPowerAp));
3319 muBar.SetUlSpatialReuse (60500);
3321 HeRu::RuType ru = (staIds.size () == 1) ? HeRu::RU_242_TONE : HeRu::RU_106_TONE;
3322 std::size_t index = 1;
3323 int8_t ulTargetRssi = -40;
3324 for (
auto const& staId : staIds)
3337 else if (staId == 2)
3348 bar.
SetType (BlockAckReqType::COMPRESSED);
3364 if (staIds.size () == 1)
3366 uint16_t aidSta1 = DynamicCast<StaWifiMac> (
m_sta1Dev->
GetMac ())->GetAssociationId ();
3367 if (staIds.front () == aidSta1)
3390 uint16_t staId = staIds.front ();
3393 psdus.insert (std::make_pair (
SU_STA_ID, psdu));
3403 double rssi = rxSignalInfo.
rssi;
3431 Ptr<Node> apNode = CreateObject<Node> ();
3449 wifi.SetRemoteStationManager (
"ns3::ConstantRateWifiManager",
3454 mac.SetType (
"ns3::StaWifiMac");
3456 wifi.AssignStreams (staDevs, 0);
3457 m_sta1Dev = DynamicCast<WifiNetDevice> (staDevs.
Get (0));
3459 m_sta2Dev = DynamicCast<WifiNetDevice> (staDevs.
Get (1));
3465 mac.SetType (
"ns3::ApWifiMac",
3468 m_apDev = DynamicCast<WifiNetDevice> (
wifi.Install (spectrumPhy,
mac, apNode).Get (0));
3476 mobility.SetMobilityModel (
"ns3::ConstantPositionMobilityModel");
3478 positionAlloc->
Add (Vector (0.0, 0.0, 0.0));
3479 positionAlloc->
Add (Vector (1.0, 0.0, 0.0));
3480 positionAlloc->
Add (Vector (2.0, 0.0, 0.0));
3481 mobility.SetPositionAllocator (positionAlloc);
3486 lossModel->SetDefaultLoss (50.0);
3507 RngSeedManager::SetSeed (1);
3508 RngSeedManager::SetRun (1);
3509 int64_t streamNumber = 0;
3550 std::vector<uint16_t> staIds {1};
3556 std::vector<uint16_t> staIds {2};
3562 std::vector<uint16_t> staIds {1, 2};
3639 Simulator::Destroy ();
void Dispose(void)
Dispose of this Object.
PHY entity for HE (11ax)HE PHY is based on VHT PHY.
void RxSuccessSta3(Ptr< WifiPsdu > psdu, RxSignalInfo rxSignalInfo, WifiTxVector txVector, std::vector< bool > statusPerMpdu)
Receive success function for STA 3.
void Set(std::string name, const AttributeValue &v)
void SetTriggerFrameUid(uint64_t uid)
Since we assume trigger frame was previously received from AP, this is used to set its UID...
void DoSetup(void) override
Implementation to do any local setup required for this TestCase.
void CheckResultsSta2(uint32_t expectedRxSuccess, uint32_t expectedRxFailure, uint32_t expectedRxBytes)
Check the results for STA 2.
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
Ptr< WifiPpdu > Copy(void) const override
Copy this instance.
Simulation virtual time values and global simulation resolution.
Time GetEnergyDuration(double energyW, WifiSpectrumBand band)
double m_rssiSta2
expected RSSI (in dBm) from STA 2 at AP for HE TB PPDUs
Ptr< PhyEntity > GetPhyEntity(WifiModulationClass modulation) const
Get the supported PHY entity corresponding to the modulation class, for the WifiPhy instance...
void SendMuPpdu(uint16_t rxStaId1, uint16_t rxStaId2)
Send MU-PPDU function.
double m_rssiSta1
expected RSSI (in dBm) from STA 1 at AP for HE TB PPDUs
Smart pointer class similar to boost::intrusive_ptr.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
uint32_t m_countRxFailureSta2
count RX failure for STA 2
uint32_t m_countRxBytesFromSta1
count RX bytes from STA 1
AttributeValue implementation for Boolean.
Ptr< WifiNetDevice > m_sta2Dev
network device of STA 2
Ptr< HeConfiguration > GetHeConfiguration(void) const
double m_txPowerAp
transmit power (in dBm) of AP
void StopInterference(void)
Stop interference function.
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
uint64_t m_totalBytesDropped
total number of dropped bytes
Time CalculateNonOfdmaDurationForHeTb(const WifiTxVector &txVector) const
uint64_t GetUid(void) const
Get the UID of the PPDU.
void SetDuration(Time duration)
Set the Duration/ID field on all the MPDUs.
Ptr< OfdmaTestHePhy > m_ofdmTestHePhy
Pointer to HE PHY instance used for OFDMA test.
void DoRun(void) override
Implementation to actually run this TestCase.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
double m_txPowerStart
minimum transmission power (in dBm) for STAs
uint32_t m_countRxFailureFromSta1
count RX failure from STA 1
uint32_t m_countRxFailureFromSta1
count RX failure from STA 1
Ptr< WifiPpdu > ppdu
The PPDU being transmitted.
Hold variables of type string.
void RxHeTbPpduOfdmaPart(Ptr< WifiSpectrumSignalParameters > rxParamsOfdma)
Receive OFDMA part of HE TB PPDU function.
void RxDropped(Ptr< const Packet > p, WifiPhyRxfailureReason reason)
RX dropped function.
void DoSetup(void) override
Implementation to do any local setup required for this TestCase.
uint32_t m_countRxBytesSta2
count RX bytes for STA 2
void StartRx(Ptr< SpectrumSignalParameters > rxParams)
Input method for delivering a signal from the spectrum channel and low-level PHY interface to this Sp...
WifiPhyBand GetPhyBand(void) const
Get the configured Wi-Fi band.
void CheckPhyState(Ptr< OfdmaSpectrumWifiPhy > phy, WifiPhyState expectedState)
Check the PHY state.
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.
double DbmToW(double dBm)
Convert from dBm to Watts.
void DoCheckPhyState(Ptr< OfdmaSpectrumWifiPhy > phy, WifiPhyState expectedState)
Check the PHY state.
void TxPpduAp(uint64_t uid)
Transmitted PPDU information function for AP.
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
Time m_expectedPpduDuration
expected duration to send MU PPDU
Ptr< SpectrumWifiPhy > m_phyAp
PHY of AP.
Ptr< OfdmaSpectrumWifiPhy > m_phySta3
PHY of STA 3.
void SetReceiveErrorCallback(RxErrorCallback callback)
void RxSuccessSta2(Ptr< WifiPsdu > psdu, RxSignalInfo rxSignalInfo, WifiTxVector txVector, std::vector< bool > statusPerMpdu)
Receive success function for STA 2.
uint32_t m_countRxSuccessSta3
count RX success for STA 3
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
virtual ~TestMultipleHeTbPreambles()
WifiPhyRxfailureReason
Enumeration of the possible reception failure reasons.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
void RxFailureSta2(Ptr< WifiPsdu > psdu)
Receive failure function for STA 2.
virtual ~OfdmaTestHePhy()
void RunOne()
Run one function.
void Reset(void)
Reset function.
void SetMobility(const Ptr< MobilityModel > mobility)
assign a mobility model to this device
void VerifyEventsCleared(void)
Verify all events are cleared at end of TX or RX.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Ptr< WaveformGenerator > m_phyInterferer
PHY of interferer.
void SetUlTargetRssi(int8_t dBm)
Set the UL Target RSSI subfield to indicate the expected receive signal power in dBm.
uint32_t m_countRxBytesSta3
count RX bytes for STA 3
void Reset(void)
Reset data upon end of TX or RX.
Ptr< WifiNetDevice > m_apDev
network device of AP
void AddPropagationLossModel(Ptr< PropagationLossModel > loss)
Add the single-frequency propagation loss model to be used.
Ptr< OfdmaSpectrumWifiPhy > m_phySta2
PHY of STA 2.
void CheckRxFromSta2(uint32_t expectedSuccess, uint32_t expectedFailures, uint32_t expectedBytes)
Check the received PSDUs from STA2.
void SetUlFecCodingType(bool ldpc)
Set the UL FEC Coding Type subfield, which indicates whether BCC or LDPC is used. ...
void RxSuccess(Ptr< WifiPsdu > psdu, RxSignalInfo rxSignalInfo, WifiTxVector txVector, std::vector< bool > statusPerMpdu)
Receive success function.
void CheckBytesDropped(size_t expectedBytesDropped)
Check the number of bytes dropped.
helps to create WifiNetDevice objects
void DoTeardown(void) override
Implementation to do any local setup required for this TestCase.
uint32_t m_countRxSuccessSta2
count RX success for STA 2
void SetTxPsdFlag(TxPsdFlag flag)
uint32_t m_countRxSuccessFromSta2
count RX success from STA 2
void SendTbPpdu(void)
Send TB-PPDU from both STAs.
void CheckPhyState(Ptr< OfdmaSpectrumWifiPhy > phy, WifiPhyState expectedState)
Schedule now to check the PHY state.
std::vector< BandInfo > Bands
Container of BandInfo.
uint32_t m_countRxBytesFromSta1
count RX bytes from STA 1
Ptr< OfdmaSpectrumWifiPhy > m_phySta1
PHY of STA 1.
static const WifiPhyBand DEFAULT_WIFI_BAND
void DoCheckPhyState(Ptr< OfdmaSpectrumWifiPhy > phy, WifiPhyState expectedState)
Check the PHY state now.
a polymophic address class
void SendHeTbPpdu(uint16_t txStaId, std::size_t index, std::size_t payloadSize, Time txDuration)
Send HE TB PPDU function.
void SetMuBarTriggerDepUserInfo(const CtrlBAckRequestHeader &bar)
Set the Trigger Dependent User Info subfield for the MU-BAR variant of Trigger frames, which includes a BAR Control subfield and a BAR Information subfield.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
void DoTeardown(void) override
Implementation to do any local setup required for this TestCase.
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.
uint32_t GetSize(void) const
Return the size of the PSDU in bytes.
void CheckResultsSta1(uint32_t expectedRxSuccess, uint32_t expectedRxFailure, uint32_t expectedRxBytes)
Check the results for STA 1.
void SetDevice(const Ptr< NetDevice > device)
Sets the device this PHY is associated with.
void SetBssColor(Ptr< WifiPhy > phy, uint8_t bssColor)
Set the BSS color.
void VerifyEventsCleared(void)
Verify all events are cleared at end of TX or RX.
uint32_t m_countRxBytesSta1
count RX bytes for STA 1
WifiPreamble GetPreambleType(void) const
void StartTx(Ptr< WifiPpdu > ppdu) override
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
WifiTxVector GetTxVectorForHeTbPpdu(uint16_t txStaId, std::size_t index, uint8_t bssColor) const
Get TXVECTOR for HE TB PPDU.
virtual ~TestPhyPaddingExclusion()
Keep track of the current position and velocity of an object.
double m_requestedRssiSta1
requested RSSI (in dBm) from STA 1 at AP for HE TB PPDUs
RxSignalInfo structure containing info on the received signal.
void SendHeSuPpdu(uint16_t txStaId, std::size_t payloadSize, uint64_t uid, uint8_t bssColor)
Send HE SU PPDU function.
uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const override
TracedCallback< uint64_t > m_phyTxPpduUidTrace
Callback providing UID of the PPDU that is about to be transmitted.
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.
SpectrumWifiPhy used for testing OFDMA.
void DoTeardown(void) override
Implementation to do any local setup required for this TestCase.
void CheckHeTbPreambles(size_t nEvents, std::vector< uint64_t > uids)
Check the received HE TB preambles.
void ResetPpduUid(void)
Reset the global PPDU UID counter in WifiPhy.
HE PHY slightly modified so as to return a given STA-ID in case of DL MU for OfdmaSpectrumWifiPhy.
Ptr< OfdmaSpectrumWifiPhy > m_phySta1
PHY of STA 1.
AttributeValue implementation for Time.
void SetMac(const Ptr< WifiMac > mac)
void RxHeTbPpdu(uint64_t uid, uint16_t staId, double txPowerWatts, size_t payloadSize)
Receive HE TB PPDU function.
double m_txPowerEnd
maximum transmission power (in dBm) for STAs
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
void RxFailureSta3(Ptr< WifiPsdu > psdu)
Receive failure function for STA 3.
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
void SetChannel(Ptr< SpectrumChannel > channel)
Hold an unsigned integer type.
Address GetAddress(void) const override
void SetPhyIndex(uint16_t bw, uint8_t p20Index)
Set the RU PHY index.
void DoSetup(void) override
Implementation to do any local setup required for this TestCase.
void LogScenario(std::string log) const
Log scenario description.
void SchedulePowerMeasurementChecks(Time delay, double rxPowerNonOfdmaRu1, double rxPowerNonOfdmaRu2, double rxPowerOfdmaRu1, double rxPowerOfdmaRu2)
Schedule power measurement related checks.
void DoRun(void) override
Implementation to actually run this TestCase.
double fc
center frequency
#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.
Ptr< const HePhy > GetHePhy(void) const
Ptr< WaveformGenerator > m_phyInterferer
PHY of interferer.
uint64_t m_ppduUidAp
UID of PPDU transmitted by AP.
uint32_t m_countRxSuccessSta1
count RX success for STA 1
void CheckRxFromSta1(uint32_t expectedSuccess, uint32_t expectedFailures, uint32_t expectedBytes)
Check the received PSDUs from STA1.
void SetPreambleDetectionModel(const Ptr< PreambleDetectionModel > preambleDetectionModel)
Sets the preamble detection model.
holds a vector of ns3::NetDevice pointers
void Reset()
Reset function.
uint64_t m_previouslyRxPpduUid
UID of the previously received PPDU, reset to UINT64_MAX upon transmission.
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 ...
virtual ~TestUlOfdmaPpduUid()
Ptr< Event > GetCurrentEvent(void)
The PHY layer has sense the medium busy through the CCA mechanism.
Ptr< SpectrumPhy > txPhy
The SpectrumPhy instance that is making the transmission.
UL-OFDMA power control test.
void CheckPhyState(Ptr< OfdmaSpectrumWifiPhy > phy, WifiPhyState expectedState)
Check the PHY state.
TestDlOfdmaPhyTransmission()
void CheckRxFromSta2(uint32_t expectedSuccess, uint32_t expectedFailures, uint32_t expectedBytes)
Check the received PSDUs from STA2.
std::pair< uint32_t, uint32_t > WifiSpectrumBand
typedef for a pair of start and stop sub-band indexes
uint16_t m_channelWidth
channel width in MHz
802.11 PHY layer modelThis PHY implements a spectrum-aware enhancement of the 802.11 SpectrumWifiPhy model.
Ptr< OfdmaSpectrumWifiPhy > m_phySta3
PHY of STA 3.
uint32_t m_countRxFailureFromSta2
count RX failure from STA 2
void RxSuccessSta1(Ptr< WifiPsdu > psdu, RxSignalInfo rxSignalInfo, WifiTxVector txVector, std::vector< bool > statusPerMpdu)
Receive success function for STA 1.
uint32_t m_countRxBytesFromSta2
count RX bytes from STA 2
UL-OFDMA multiple RX events test.
Mac48Address GetAddr2(void) const
Get the Transmitter Address (TA), which is common to all the MPDUs.
void RunOne()
Run one function.
virtual ~TestUlOfdmaPowerControl()
Ptr< OfdmaSpectrumWifiPhy > m_phyAp
PHY of AP.
#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...
const WifiMacHeader & GetHeader(std::size_t i) const
Get the header of the i-th MPDU.
uint16_t m_channelWidth
channel width in MHz
Ptr< OfdmaSpectrumWifiPhy > m_phySta1
PHY of STA 1.
void SetOwner(Ptr< WifiPhy > wifiPhy)
Set the WifiPhy owning this PHY entity.
void SetNss(uint8_t nss)
Sets the number of Nss.
uint32_t m_countRxFailureSta1
count RX failure for STA 1
void CheckUid(uint16_t staId, uint64_t expectedUid)
Check the UID of the transmitted PPDU.
Ptr< OfdmaSpectrumWifiPhy > m_phy
Phy.
void CheckResultsSta3(uint32_t expectedRxSuccess, uint32_t expectedRxFailure, uint32_t expectedRxBytes)
Check the results for STA 3.
uint16_t m_frequency
frequency in MHz
void SetErrorRateModel(const Ptr< ErrorRateModel > rate)
Sets the error rate model.
void DoSetup(void) override
Implementation to do any local setup required for this TestCase.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
void SetGlobalPpduUid(uint64_t uid)
Set the global PPDU UID counter.
void DoRun(void) override
Implementation to actually run this TestCase.
Ptr< WifiPhy > GetPhy(void) const
virtual ~TestDlOfdmaPhyTransmission()
void RxSuccess(Ptr< WifiPsdu > psdu, RxSignalInfo rxSignalInfo, WifiTxVector txVector, std::vector< bool > statusPerMpdu)
Receive success function.
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
static TypeId GetTypeId(void)
Get the type ID.
std::size_t GetNMpdus(void) const
Return the number of MPDUs constituting the PSDU.
uint32_t m_countRxBytesFromSta2
count RX bytes from STA 2
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint32_t m_countRxSuccessFromSta1
count RX success from STA 1
double fl
lower limit of subband
keep track of a set of node pointers.
Hold objects of type Ptr<T>.
void DoDispose(void) override
Destructor implementation.
void RunOne(bool setupBa)
Run one simulation with an optional BA session set up phase.
void ReplaceReceiveOkCallbackOfAp(void)
Replace the AP's MacLow callback on its PHY's ReceiveOkCallback by the ReceiveOkCallbackAtAp method...
WifiPhyState
The state of the PHY layer.
uint32_t m_countRxSuccessFromSta1
count RX success from STA 1
uint8_t m_bssColor
BSS color.
void(* TxPpduUidCallback)(uint64_t uid)
TracedCallback signature for UID of transmitted PPDU.
static uint64_t m_globalPpduUid
Global counter of the PPDU UID.
void CheckRxFromSta1(uint32_t expectedSuccess, uint32_t expectedFailures, uint32_t expectedBytes)
Check the received PSDUs from STA1.
Ptr< SpectrumWifiPhy > m_phyAp
PHY of AP.
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...
RuType
The different HE Resource Unit (RU) types.
void DoInitialize(void) override
Initialize() implementation.
void SendMuBar(std::vector< uint16_t > staIds)
Send a MU BAR through the AP to the STAs listed in the provided vector.
void GenerateInterference(Ptr< SpectrumValue > interferencePsd, Time duration)
Generate interference function.
void DoRun(void) override
Implementation to actually run this TestCase.
wifi PHY OFDMA Test Suite
void RxFailure(Ptr< WifiPsdu > psdu)
Receive failure function.
Ptr< OfdmaSpectrumWifiPhy > m_phySta2
PHY of STA 2.
double m_tol
tolerance (in dB) between received and expected RSSIs
void SendSuPpdu(uint16_t txStaId)
Send SU-PPDU function.
uint32_t m_countRxFailureSta3
count RX failure for STA 3
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...
create MAC layers for a ns3::WifiNetDevice.
Ptr< WifiNetDevice > m_sta1Dev
network device of STA 1
void SetErrorRateModel(std::string name, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
WifiSpectrumBand GetRuBandForRx(const WifiTxVector &txVector, uint16_t staId) const
Get the band in the RX spectrum associated with the RU used by the PSDU transmitted to/by a given STA...
void TxPpduSta1(uint64_t uid)
Transmitted PPDU information function for STA 1.
void Reset(void)
Reset the initial value of every attribute as well as the value of every global to what they were bef...
User Info field of Trigger frames.
void SetMode(WifiMode mode)
Sets the selected payload transmission mode.
bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber) override
static const uint8_t DEFAULT_CHANNEL_NUMBER
void StopInterference(void)
Stop interference function.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
WifiPhyBand
Identifies the PHY band.
Helper class used to assign positions and mobility models to nodes.
void DoTeardown(void) override
Implementation to do any local setup required for this TestCase.
void DoSetup(void) override
Implementation to do any local setup required for this TestCase.
void SetReceiveOkCallback(RxOkCallback callback)
TestUlOfdmaPowerControl()
This objects implements the PHY state machine of the Wifi device.
void SetRuAllocation(HeRu::RuSpec ru)
Set the RU Allocation subfield according to the specified RU.
WifiPhyState GetState(void) const
Return the current state of WifiPhy.
uint32_t m_countRxFailureFromSta2
count RX failure from STA 2
Ptr< WifiMac > GetMac(void) const
void SetFrequency(uint16_t freq) override
If the operating channel for this object has not been set yet, the given center frequency is saved an...
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
uint64_t m_ppduUidSta2
UID of PPDU transmitted by STA2.
static const uint16_t DEFAULT_CHANNEL_WIDTH
std::map< std::pair< uint64_t, WifiPreamble >, Ptr< Event > > & GetCurrentPreambleEvents(void)
Time GetSifs(void) const
Return the Short Interframe Space (SIFS) for this PHY.
virtual ~OfdmaSpectrumWifiPhy()
Ptr< SpectrumValue > psd
The Power Spectral Density of the waveform, in linear units.
void Reset()
Reset function.
void DoCheckPhyState(Ptr< OfdmaSpectrumWifiPhy > phy, WifiPhyState expectedState)
Check the PHY state.
uint32_t m_countRxSuccessFromSta2
count RX success from STA 2
PHY padding exclusion test.
void TxPpduSta2(uint64_t uid)
Transmitted PPDU information function for STA 2.
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...
InterferenceHelper m_interference
the class handling interference computations
void SetPsdLimit(Ptr< WifiPhy > phy, double psdLimit)
Set the PSD limit.
Ptr< OfdmaSpectrumWifiPhy > m_phyAp
PHY of AP.
void DoRun(void) override
Implementation to actually run this TestCase.
OfdmaTestHePhy(uint16_t staId)
Constructor.
void SetPropagationDelayModel(Ptr< PropagationDelayModel > delay)
Set the propagation delay model to be used.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
uint32_t GetBlockAckSize(BlockAckType type)
Return the total BlockAck size (including FCS trailer).
void StopInterference(void)
Stop interference function.
Time Seconds(double value)
Construct a Time in the indicated unit.
The PHY layer is receiving a packet.
void SetChannelNumber(uint8_t id) override
Set channel number.
Time GetEnergyDuration(double energyW, WifiSpectrumBand band)
Wrapper to InterferenceHelper method.
void Add(Vector v)
Add a position to the list of positions.
double m_requestedRssiSta2
requested RSSI (in dBm) from STA 2 at AP for HE TB PPDUs
void RunOne()
Run one function.
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...
TestMultipleHeTbPreambles()
void SendMuPpdu(void)
Send MU-PPDU toward both STAs.
UL-OFDMA PPDU UID attribution test.
Time duration
The duration of the packet transmission.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
void GenerateInterference(Ptr< SpectrumValue > interferencePsd, Time duration)
Generate interference function.
void SetUlMcs(uint8_t mcs)
Set the UL MCS subfield, which indicates the MCS of the solicited HE TB PPDU.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Time m_expectedPpduDuration
expected duration to send MU PPDU
void ResetResults()
Reset the results.
virtual ~TestUlOfdmaPhyTransmission()
Ptr< OfdmaSpectrumWifiPhy > m_phySta2
PHY of STA 2.
Ptr< OfdmaSpectrumWifiPhy > m_phySta2
PHY of STA 2.
void SetLength(uint16_t length)
Set the LENGTH field of the L-SIG.
OfdmaSpectrumWifiPhy(uint16_t staId)
Constructor.
void DoSetup(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, uint64_t uid, uint8_t bssColor)
Send HE TB PPDU function.
double fh
upper limit of subband
uint16_t m_staId
ID of the STA to which this PHY belongs to.
void SetChannel(const Ptr< SpectrumChannel > channel)
Set the SpectrumChannel this SpectrumWifiPhy is to be connected to.
This class can be used to hold variables of floating point type such as 'double' or 'float'...
std::map< WifiModulationClass, Ptr< PhyEntity > > m_phyEntities
This map holds the supported PHY entities.
void ReceiveOkCallbackAtAp(Ptr< WifiPsdu > psdu, RxSignalInfo rxSignalInfo, WifiTxVector txVector, std::vector< bool > statusPerMpdu)
Receive OK callback function at AP.
void RxFailure(Ptr< WifiPsdu > psdu)
Receive failure function.
void DoTeardown(void) override
Implementation to do any local setup required for this TestCase.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
The building block of a SpectrumModel.
WifiSpectrumBand GetNonOfdmaBand(const WifiTxVector &txVector, uint16_t staId) const
Get the band used to transmit the non-OFDMA part of an HE TB PPDU.
void SetChannelWidth(uint16_t channelwidth) override
If the operating channel for this object has not been set yet, the given channel width is saved and w...
Ptr< OfdmaSpectrumWifiPhy > m_phyAp
PHY of AP.
void RxFailureSta1(Ptr< WifiPsdu > psdu)
Receive failure function for STA 1.
a unique identifier for an interface.
uint8_t m_txPowerLevels
number of transmission power levels for STAs
void ConfigureStandardAndBand(WifiPhyStandard standard, WifiPhyBand band) override
Configure the PHY-level parameters for different Wi-Fi standard.
void SetRu(HeRu::RuSpec ru, uint16_t staId)
Set the RU specification for the STA-ID.
Ptr< Event > m_currentEvent
Hold the current event.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
TestUlOfdmaPhyTransmission()
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
static const uint16_t DEFAULT_GUARD_WIDTH
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...
uint64_t m_ppduUidSta1
UID of PPDU transmitted by STA1.
Ptr< WaveformGenerator > m_phyInterferer
PHY of interferer.
void DoRun(void) override
Implementation to actually run this TestCase.
void SetPpduUid(uint64_t uid)
Set the global PPDU UID counter.
virtual int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
static WifiPhyOfdmaTestSuite wifiPhyOfdmaTestSuite
the test suite
void AddHeader(const Header &header)
Add header to this packet.
void DoRxHeTbPpduOfdmaPart(Ptr< WifiSpectrumSignalParameters > rxParamsOfdma)
Receive OFDMA part of HE TB PPDU function.
Ptr< OfdmaSpectrumWifiPhy > m_phySta1
PHY of STA 1.
void CreateWifiSpectrumPhyInterface(Ptr< NetDevice > device)
Method to encapsulate the creation of the WifiSpectrumPhyInterface object (used to bind the WifiSpect...
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)
Schedule test to perform.
void SetUlDcm(bool dcm)
Set the UL DCM subfield, which indicates whether or not DCM is used.
TestPhyPaddingExclusion()
void GenerateInterference(Ptr< SpectrumValue > interferencePsd, Time duration)
Generate interference function.
uint16_t m_frequency
frequency in MHz
void DoTeardown(void) override
Implementation to do any local setup required for this TestCase.
virtual WifiPpduType GetType(void) const
Return the PPDU type (.
static const uint32_t DEFAULT_FREQUENCY
Make it easy to create and manage PHY objects for the spectrum model.