20#include "ns3/ap-wifi-mac.h"
21#include "ns3/boolean.h"
22#include "ns3/constant-position-mobility-model.h"
23#include "ns3/ctrl-headers.h"
24#include "ns3/double.h"
25#include "ns3/he-configuration.h"
26#include "ns3/he-phy.h"
27#include "ns3/he-ppdu.h"
28#include "ns3/interference-helper.h"
30#include "ns3/mobility-helper.h"
31#include "ns3/multi-model-spectrum-channel.h"
32#include "ns3/nist-error-rate-model.h"
34#include "ns3/non-communicating-net-device.h"
35#include "ns3/pointer.h"
36#include "ns3/rng-seed-manager.h"
37#include "ns3/simulator.h"
38#include "ns3/spectrum-wifi-helper.h"
39#include "ns3/spectrum-wifi-phy.h"
40#include "ns3/sta-wifi-mac.h"
41#include "ns3/string.h"
43#include "ns3/threshold-preamble-detection-model.h"
44#include "ns3/waveform-generator.h"
45#include "ns3/wifi-mac-header.h"
46#include "ns3/wifi-net-device.h"
47#include "ns3/wifi-phy-listener.h"
48#include "ns3/wifi-psdu.h"
49#include "ns3/wifi-spectrum-phy-interface.h"
50#include "ns3/wifi-spectrum-signal-parameters.h"
51#include "ns3/wifi-spectrum-value-helper.h"
52#include "ns3/wifi-utils.h"
212 TypeId(
"ns3::OfdmaSpectrumWifiPhy")
214 .SetGroupName(
"Wifi")
215 .AddTraceSource(
"TxPpduUid",
216 "UID of the PPDU to be transmitted",
218 "ns3::OfdmaSpectrumWifiPhy::TxPpduUidCallback");
268std::map<std::pair<uint64_t, WifiPreamble>,
Ptr<Event>>&
307 void DoRun()
override;
319 std::vector<bool> statusPerMpdu);
330 std::vector<bool> statusPerMpdu);
341 std::vector<bool> statusPerMpdu);
397 void SendMuPpdu(uint16_t rxStaId1, uint16_t rxStaId2);
451 m_countRxSuccessSta1(0),
452 m_countRxSuccessSta2(0),
453 m_countRxSuccessSta3(0),
454 m_countRxFailureSta1(0),
455 m_countRxFailureSta2(0),
456 m_countRxFailureSta3(0),
457 m_countRxBytesSta1(0),
458 m_countRxBytesSta2(0),
459 m_countRxBytesSta3(0),
524 txVector.
SetRu(ru1, rxStaId1);
526 txVector.
SetNss(1, rxStaId1);
529 txVector.
SetRu(ru2, rxStaId2);
531 txVector.
SetNss(1, rxStaId2);
540 psdus.insert(std::make_pair(rxStaId1, psdu1));
549 psdus.insert(std::make_pair(rxStaId2, psdu2));
634 "The number of successfully received packets by STA 1 is not correct!");
637 "The number of unsuccessfuly received packets by STA 1 is not correct!");
640 "The number of bytes received by STA 1 is not correct!");
650 "The number of successfully received packets by STA 2 is not correct!");
653 "The number of unsuccessfuly received packets by STA 2 is not correct!");
656 "The number of bytes received by STA 2 is not correct!");
666 "The number of successfully received packets by STA 3 is not correct!");
669 "The number of unsuccessfuly received packets by STA 3 is not correct!");
672 "The number of bytes received by STA 3 is not correct!");
689 phy->GetAttribute(
"State", ptr);
691 currentState = state->GetState();
695 "PHY State " << currentState <<
" does not match expected state "
705 spectrumChannel->AddPropagationLossModel(lossModel);
707 CreateObject<ConstantSpeedPropagationDelayModel>();
708 spectrumChannel->SetPropagationDelayModel(delayModel);
712 m_phyAp = CreateObject<SpectrumWifiPhy>();
723 apNode->AggregateObject(apMobility);
724 apNode->AddDevice(apDev);
726 Ptr<Node> sta1Node = CreateObject<Node>();
728 m_phySta1 = CreateObject<OfdmaSpectrumWifiPhy>(1);
742 sta1Node->AggregateObject(sta1Mobility);
743 sta1Node->AddDevice(sta1Dev);
745 Ptr<Node> sta2Node = CreateObject<Node>();
747 m_phySta2 = CreateObject<OfdmaSpectrumWifiPhy>(2);
761 sta2Node->AggregateObject(sta2Mobility);
762 sta2Node->AddDevice(sta2Dev);
764 Ptr<Node> sta3Node = CreateObject<Node>();
766 m_phySta3 = CreateObject<OfdmaSpectrumWifiPhy>(3);
780 sta3Node->AggregateObject(sta3Mobility);
781 sta3Node->AddDevice(sta3Dev);
783 Ptr<Node> interfererNode = CreateObject<Node>();
789 interfererNode->AddDevice(interfererDev);
812 int64_t streamNumber = 0;
856 WifiPhyState::CCA_BUSY);
909 WifiPhyState::CCA_BUSY);
959 bands.push_back(bandInfo);
962 Ptr<SpectrumValue> interferencePsdRu1 = Create<SpectrumValue>(SpectrumInterferenceRu1);
963 double interferencePower = 0.1;
964 *interferencePsdRu1 = interferencePower / ((
m_channelWidth / 2) * 20e6);
989 WifiPhyState::CCA_BUSY);
994 WifiPhyState::CCA_BUSY);
999 WifiPhyState::CCA_BUSY);
1004 WifiPhyState::CCA_BUSY);
1029 bands.push_back(bandInfo);
1032 Ptr<SpectrumValue> interferencePsdRu2 = Create<SpectrumValue>(SpectrumInterferenceRu2);
1033 *interferencePsdRu2 = interferencePower / ((
m_channelWidth / 2) * 20e6);
1058 WifiPhyState::CCA_BUSY);
1063 (
m_channelWidth >= 40) ? WifiPhyState::IDLE : WifiPhyState::CCA_BUSY);
1068 (
m_channelWidth >= 40) ? WifiPhyState::IDLE : WifiPhyState::CCA_BUSY);
1073 (
m_channelWidth >= 40) ? WifiPhyState::IDLE : WifiPhyState::CCA_BUSY);
1098 bands.push_back(bandInfo);
1101 Ptr<SpectrumValue> interferencePsdAll = Create<SpectrumValue>(SpectrumInterferenceAll);
1102 *interferencePsdAll = interferencePower / (
m_channelWidth * 20e6);
1127 WifiPhyState::CCA_BUSY);
1132 WifiPhyState::CCA_BUSY);
1137 WifiPhyState::CCA_BUSY);
1142 WifiPhyState::CCA_BUSY);
1198 void DoRun()
override;
1210 const std::vector<bool> statusPerMpdu);
1222 std::vector<bool> statusPerMpdu);
1270 const std::vector<bool>& puncturedSubchannels);
1326 :
TestCase(
"DL-OFDMA PHY puncturing test"),
1327 m_countRxSuccessSta1(0),
1328 m_countRxSuccessSta2(0),
1329 m_countRxFailureSta1(0),
1330 m_countRxFailureSta2(0),
1331 m_countRxBytesSta1(0),
1332 m_countRxBytesSta2(0),
1335 m_indexSubchannel(0),
1355 const std::vector<bool>& puncturedSubchannels)
1371 puncturedSubchannels.empty()
1375 txVector.
SetRu(ru1, rxStaId1);
1377 txVector.
SetNss(1, rxStaId1);
1379 ruType = puncturedSubchannels.empty()
1385 txVector.
SetRu(ru2, rxStaId2);
1387 txVector.
SetNss(1, rxStaId2);
1389 std::vector<uint8_t> ruAlloc;
1390 if (puncturedSubchannels.empty())
1392 std::fill_n(std::back_inserter(ruAlloc), 4, 200);
1396 ruAlloc.push_back(puncturedSubchannels.at(1) ? 192 : 200);
1397 ruAlloc.push_back(puncturedSubchannels.at(1) ? 113 : 200);
1398 ruAlloc.push_back(puncturedSubchannels.at(2) ? 113
1399 : (puncturedSubchannels.at(3) ? 192 : 200));
1400 ruAlloc.push_back(puncturedSubchannels.at(2) ? 192
1401 : (puncturedSubchannels.at(3) ? 113 : 200));
1414 psdus.insert(std::make_pair(rxStaId1, psdu1));
1423 psdus.insert(std::make_pair(rxStaId2, psdu2));
1425 if (!puncturedSubchannels.empty())
1493 "The number of successfully received packets by STA 1 is not correct!");
1496 "The number of unsuccessfuly received packets by STA 1 is not correct!");
1499 "The number of bytes received by STA 1 is not correct!");
1509 "The number of successfully received packets by STA 2 is not correct!");
1512 "The number of unsuccessfuly received packets by STA 2 is not correct!");
1515 "The number of bytes received by STA 2 is not correct!");
1531 phy->GetAttribute(
"State", ptr);
1533 currentState = state->GetState();
1537 "PHY State " << currentState <<
" does not match expected state "
1547 spectrumChannel->AddPropagationLossModel(lossModel);
1549 CreateObject<ConstantSpeedPropagationDelayModel>();
1550 spectrumChannel->SetPropagationDelayModel(delayModel);
1552 Ptr<Node> apNode = CreateObject<Node>();
1554 m_phyAp = CreateObject<SpectrumWifiPhy>();
1565 apNode->AggregateObject(apMobility);
1566 apNode->AddDevice(apDev);
1568 Ptr<Node> sta1Node = CreateObject<Node>();
1570 m_phySta1 = CreateObject<OfdmaSpectrumWifiPhy>(1);
1584 sta1Node->AggregateObject(sta1Mobility);
1585 sta1Node->AddDevice(sta1Dev);
1587 Ptr<Node> sta2Node = CreateObject<Node>();
1589 m_phySta2 = CreateObject<OfdmaSpectrumWifiPhy>(2);
1603 sta2Node->AggregateObject(sta2Mobility);
1604 sta2Node->AddDevice(sta2Dev);
1606 Ptr<Node> interfererNode = CreateObject<Node>();
1612 interfererNode->AddDevice(interfererDev);
1633 int64_t streamNumber = 0;
1657 bandInfo.
fl = bandInfo.
fc - (5 * 1e6);
1658 bandInfo.
fh = bandInfo.
fc + (5 * 1e6);
1660 bands.push_back(bandInfo);
1664 double interferencePower = 0.1;
1665 *interferencePsd = interferencePower / 10e6;
1680 std::vector<bool>{});
1698 WifiPhyState::IDLE);
1703 WifiPhyState::IDLE);
1745 std::vector<bool> puncturedSubchannels;
1750 puncturedSubchannels.push_back(
true);
1754 puncturedSubchannels.push_back(
false);
1762 puncturedSubchannels);
1780 WifiPhyState::IDLE);
1785 WifiPhyState::IDLE);
1812 for (
auto index : {1, 2, 3})
1835 void DoRun()
override;
1876 void CheckUid(uint16_t staId, uint64_t expectedUid);
1888 :
TestCase(
"UL-OFDMA PPDU UID attribution test"),
1889 m_ppduUidAp(UINT64_MAX),
1890 m_ppduUidSta1(UINT64_MAX),
1891 m_ppduUidSta2(UINT64_MAX)
1905 spectrumChannel->AddPropagationLossModel(lossModel);
1907 CreateObject<ConstantSpeedPropagationDelayModel>();
1908 spectrumChannel->SetPropagationDelayModel(delayModel);
1910 Ptr<Node> apNode = CreateObject<Node>();
1912 m_phyAp = CreateObject<OfdmaSpectrumWifiPhy>(0);
1932 apNode->AggregateObject(apMobility);
1933 apNode->AddDevice(apDev);
1935 apDev->SetHeConfiguration(CreateObject<HeConfiguration>());
1937 Ptr<Node> sta1Node = CreateObject<Node>();
1939 m_phySta1 = CreateObject<OfdmaSpectrumWifiPhy>(1);
1954 sta1Node->AggregateObject(sta1Mobility);
1955 sta1Node->AddDevice(sta1Dev);
1957 Ptr<Node> sta2Node = CreateObject<Node>();
1959 m_phySta2 = CreateObject<OfdmaSpectrumWifiPhy>(2);
1974 sta2Node->AggregateObject(sta2Mobility);
1975 sta2Node->AddDevice(sta2Dev);
2013 "UID " << uid <<
" does not match expected one " << expectedUid <<
" for "
2060 uint16_t rxStaId1 = 1;
2062 txVector.
SetRu(ru1, rxStaId1);
2064 txVector.
SetNss(1, rxStaId1);
2066 uint16_t rxStaId2 = 2;
2068 txVector.
SetRu(ru2, rxStaId2);
2070 txVector.
SetNss(1, rxStaId2);
2081 psdus.insert(std::make_pair(rxStaId1, psdu1));
2090 psdus.insert(std::make_pair(rxStaId2, psdu2));
2114 uint16_t rxStaId1 = 1;
2116 txVector1.
SetRu(ru1, rxStaId1);
2118 txVector1.
SetNss(1, rxStaId1);
2119 trigVector.
SetRu(ru1, rxStaId1);
2121 trigVector.
SetNss(1, rxStaId1);
2130 psdus1.insert(std::make_pair(rxStaId1, psdu1));
2132 uint16_t rxStaId2 = 2;
2134 txVector2.
SetRu(ru2, rxStaId2);
2136 txVector2.
SetNss(1, rxStaId2);
2137 trigVector.
SetRu(ru2, rxStaId2);
2139 trigVector.
SetNss(1, rxStaId2);
2148 psdus2.insert(std::make_pair(rxStaId2, psdu2));
2158 Time txDuration = std::max(txDuration1, txDuration2);
2168 hePhyAp->SetTrigVector(trigVector, txDuration);
2196 psdus.insert(std::make_pair(
SU_STA_ID, psdu));
2219 int64_t streamNumber = 0;
2269 void DoRun()
override;
2280 void RxHeTbPpdu(uint64_t uid, uint16_t staId,
double txPowerWatts,
size_t payloadSize);
2329 :
TestCase(
"UL-OFDMA multiple RX events test"),
2330 m_totalBytesDropped(0),
2331 m_trigVector(
HePhy::GetHeMcs7(),
2370 for (
const auto& uid : uids)
2373 auto it = events.find(pair);
2374 bool found = (it != events.end());
2377 "HE TB PPDU with UID " << uid <<
" has not been received!");
2385 expectedBytesDropped,
2386 "The number of dropped bytes is not correct!");
2392 double txPowerWatts,
2408 txVector.
SetRu(ru, staId);
2410 txVector.
SetNss(1, staId);
2421 psdus.insert(std::make_pair(staId, psdu));
2433 Time nonOfdmaDuration =
m_phy->
GetHePhy()->CalculateNonOfdmaDurationForHeTb(txVector);
2435 m_phy->
GetHePhy()->GetCenterFrequencyForNonOfdmaPart(txVector, staId);
2437 uint16_t channelWidth = ruWidth < 20 ? 20 : ruWidth;
2444 rxParams->psd = rxPsd;
2445 rxParams->txPhy =
nullptr;
2446 rxParams->duration = nonOfdmaDuration;
2447 rxParams->ppdu = ppdu;
2448 rxParams->txWidth = channelWidth;
2451 std::tie(length, ppduDuration) =
2457 ppdu->ResetTxVector();
2461 Ptr<HePpdu> ppduOfdma = DynamicCast<HePpdu>(ppdu->Copy());
2463 const auto band =
m_phy->
GetHePhy()->GetRuBandForRx(txVector, staId);
2471 rxParamsOfdma->psd = rxPsd;
2472 rxParamsOfdma->txPhy =
nullptr;
2473 rxParamsOfdma->duration = ppduDuration - nonOfdmaDuration;
2474 rxParamsOfdma->ppdu = ppduOfdma;
2504 m_phy = CreateObject<OfdmaSpectrumWifiPhy>(0);
2508 mac->SetAttribute(
"BeaconGeneration",
BooleanValue(
false));
2522 CreateObject<ThresholdPreambleDetectionModel>();
2523 preambleDetectionModel->SetAttribute(
"Threshold",
DoubleValue(4));
2524 preambleDetectionModel->SetAttribute(
"MinimumRssi",
DoubleValue(-82));
2527 heConfiguration->SetMaxTbPpduDelay(
NanoSeconds(400));
2528 dev->SetHeConfiguration(heConfiguration);
2530 node->AddDevice(dev);
2545 int64_t streamNumber = 0;
2548 double txPowerWatts = 0.01;
2552 std::vector<uint64_t> uids{0};
2580 std::vector<uint64_t> uids{1, 2};
2624 std::vector<uint64_t> uids{3, 4};
2668 std::vector<uint64_t> uids{5, 6};
2703 std::vector<uint64_t>{uids[0]});
2716 std::vector<uint64_t> uids{7, 8};
2751 std::vector<uint64_t>{uids[0]});
2764 std::vector<uint64_t> uids{9};
2842 const std::vector<Time>& )
override
2958 void DoRun()
override;
2969 uint8_t bssColor)
const;
2988 std::size_t payloadSize,
3000 void SendHeSuPpdu(uint16_t txStaId, std::size_t payloadSize, uint64_t uid, uint8_t bssColor);
3060 double expectedRxPower);
3069 double expectedRxPower);
3100 Time expectedLastNotification,
3101 bool expectedSuccess);
3118 std::vector<bool> statusPerMpdu);
3155 bool scheduleTxSta1 =
true,
3157 WifiPhyState expectedStateBeforeEnd = WifiPhyState::RX,
3170 double rxPowerNonOfdmaRu1,
3171 double rxPowerNonOfdmaRu2,
3172 double rxPowerOfdmaRu1,
3173 double rxPowerOfdmaRu2);
3186 std::unique_ptr<OfdmaTestPhyListener>
3205 m_countRxSuccessFromSta1(0),
3206 m_countRxSuccessFromSta2(0),
3207 m_countRxFailureFromSta1(0),
3208 m_countRxFailureFromSta2(0),
3209 m_countRxBytesFromSta1(0),
3210 m_countRxBytesFromSta2(0),
3219 std::size_t payloadSize,
3244 std::ostringstream addr;
3245 addr <<
"00:00:00:00:00:0" << txStaId;
3249 psdus.insert(std::make_pair(
SU_STA_ID, psdu));
3256 else if (txStaId == 2)
3260 else if (txStaId == 3)
3264 else if (txStaId == 0)
3268 phy->SetPpduUid(uid);
3269 phy->Send(psdus, txVector);
3275 uint8_t bssColor)
const
3312 bool primary80MHz =
true;
3315 primary80MHz =
false;
3319 txVector.
SetRu(ru, txStaId);
3321 txVector.
SetNss(1, txStaId);
3331 channelWidth = (channelWidth == 160 ? 20 : channelWidth * 2);
3348 if (channelWidth == 20)
3352 else if (channelWidth == 40)
3356 else if (channelWidth == 80)
3360 else if (channelWidth == 160)
3369 uint16_t aid1 = (error ==
AID ? 3 : 1);
3370 uint16_t aid2 = (error ==
AID ? 4 : 2);
3373 txVector.
SetRu(ru1, aid1);
3375 txVector.
SetNss(1, aid1);
3377 HeRu::RuSpec ru2(ruType, (channelWidth == 160 ? 1 : 2), (channelWidth != 160));
3378 txVector.
SetRu(ru2, aid2);
3380 txVector.
SetNss(1, aid2);
3399 std::size_t payloadSize,
3404 NS_LOG_FUNCTION(
this << txStaId << index << payloadSize << uid << +bssColor << (incrementUid));
3418 std::ostringstream addr;
3419 addr <<
"00:00:00:00:00:0" << txStaId;
3423 psdus.insert(std::make_pair(txStaId, psdu));
3430 else if (txStaId == 2)
3434 else if (txStaId == 3)
3440 phy->CalculateTxDuration(psdu->GetSize(), txVector, phy->GetPhyBand(), txStaId);
3444 phy->SetPpduUid(uid);
3445 phy->Send(psdus, txVector);
3474 NS_LOG_FUNCTION(
this << *psdu << psdu->GetAddr2() << rxSignalInfo << txVector);
3475 if (psdu->GetAddr2() ==
Mac48Address(
"00:00:00:00:00:01"))
3480 else if (psdu->GetAddr2() ==
Mac48Address(
"00:00:00:00:00:02"))
3491 if (psdu->GetAddr2() ==
Mac48Address(
"00:00:00:00:00:01"))
3495 else if (psdu->GetAddr2() ==
Mac48Address(
"00:00:00:00:00:02"))
3508 "The number of successfully received packets from STA 1 is not correct!");
3512 "The number of unsuccessfuly received packets from STA 1 is not correct!");
3515 "The number of bytes received from STA 1 is not correct!");
3525 "The number of successfully received packets from STA 2 is not correct!");
3529 "The number of unsuccessfuly received packets from STA 2 is not correct!");
3532 "The number of bytes received from STA 2 is not correct!");
3538 double expectedRxPower)
3542 auto rxPower =
event->GetRxPowerW(band);
3548 "RX power " << rxPower <<
" over (" << band
3549 <<
") does not match expected power " << expectedRxPower
3556 double expectedRxPower)
3565 if (expectedRxPower > 0.0)
3568 phy->GetEnergyDuration(expectedRxPower - step, band).IsStrictlyPositive(),
3570 "At least " << expectedRxPower <<
" W expected for OFDMA part over (" << band <<
") at "
3573 phy->GetEnergyDuration(expectedRxPower + step, band).IsStrictlyPositive(),
3575 "At most " << expectedRxPower <<
" W expected for OFDMA part over (" << band <<
") at "
3581 phy->GetEnergyDuration(expectedRxPower + step, band).IsStrictlyPositive(),
3583 "At most " << expectedRxPower <<
" W expected for OFDMA part over (" << band <<
") at "
3593 "m_currentEvent for AP was not cleared");
3596 "m_currentEvent for STA 1 was not cleared");
3599 "m_currentEvent for STA 2 was not cleared");
3616 phy->GetAttribute(
"State", ptr);
3618 currentState = state->GetState();
3622 "PHY State " << currentState <<
" does not match expected state "
3628 Time expectedLastNotification)
3631 expectedNotifications,
3632 "Number of RX start notifications "
3634 <<
" does not match expected count " << expectedNotifications
3637 expectedLastNotification,
3638 "Last time RX start notification has been received "
3640 <<
" does not match expected time " << expectedLastNotification
3646 Time expectedLastNotification,
3647 bool expectedSuccess)
3650 expectedNotifications,
3651 "Number of RX end notifications "
3653 <<
" does not match expected count " << expectedNotifications
3656 expectedLastNotification,
3657 "Last time RX end notification has been received "
3659 <<
" does not match expected time " << expectedLastNotification
3663 "Last time RX end notification indicated a "
3665 <<
" but expected a " << (expectedSuccess ?
"success" :
"failure")
3690 heConfiguration->SetAttribute(
"BssColor",
UintegerValue(bssColor));
3697 phy->SetAttribute(
"PowerDensityLimit",
DoubleValue(psdLimit));
3706 spectrumChannel->AddPropagationLossModel(lossModel);
3708 CreateObject<ConstantSpeedPropagationDelayModel>();
3709 spectrumChannel->SetPropagationDelayModel(delayModel);
3712 CreateObject<ThresholdPreambleDetectionModel>();
3713 preambleDetectionModel->SetAttribute(
3717 preambleDetectionModel->SetAttribute(
"Threshold",
DoubleValue(-100));
3719 Ptr<Node> apNode = CreateObject<Node>();
3723 apMac->SetAttribute(
"BeaconGeneration",
BooleanValue(
false));
3724 apDev->SetMac(apMac);
3725 m_phyAp = CreateObject<OfdmaSpectrumWifiPhy>(0);
3727 apDev->SetHeConfiguration(heConfiguration);
3743 apMac->SetWifiPhys({
m_phyAp});
3744 apNode->AggregateObject(apMobility);
3745 apNode->AddDevice(apDev);
3747 Ptr<Node> sta1Node = CreateObject<Node>();
3750 sta1Dev->SetHeConfiguration(CreateObject<HeConfiguration>());
3751 m_phySta1 = CreateObject<OfdmaSpectrumWifiPhy>(1);
3763 sta1Node->AggregateObject(sta1Mobility);
3764 sta1Node->AddDevice(sta1Dev);
3766 Ptr<Node> sta2Node = CreateObject<Node>();
3769 sta2Dev->SetHeConfiguration(CreateObject<HeConfiguration>());
3770 m_phySta2 = CreateObject<OfdmaSpectrumWifiPhy>(2);
3782 sta2Node->AggregateObject(sta2Mobility);
3783 sta2Node->AddDevice(sta2Dev);
3785 Ptr<Node> sta3Node = CreateObject<Node>();
3788 sta3Dev->SetHeConfiguration(CreateObject<HeConfiguration>());
3789 m_phySta3 = CreateObject<OfdmaSpectrumWifiPhy>(3);
3801 sta3Node->AggregateObject(sta3Mobility);
3802 sta3Node->AddDevice(sta3Dev);
3804 Ptr<Node> interfererNode = CreateObject<Node>();
3810 interfererNode->AddDevice(interfererDev);
3814 for (
auto& phy : phys)
3817 phy->SetAttribute(
"TxPowerStart",
DoubleValue(16.0));
3818 phy->SetAttribute(
"TxPowerEnd",
DoubleValue(16.0));
3819 phy->SetAttribute(
"PowerDensityLimit",
DoubleValue(100.0));
3822 phy->SetAttribute(
"TxMaskInnerBandMinimumRejection",
DoubleValue(-100.0));
3823 phy->SetAttribute(
"TxMaskOuterBandMinimumRejection",
DoubleValue(-100.0));
3824 phy->SetAttribute(
"TxMaskOuterBandMaximumRejection",
DoubleValue(-100.0));
3859 bool scheduleTxSta1,
3860 Time ulTimeDifference,
3864 static uint64_t uid = 0;
3914 expectedStateBeforeEnd);
3919 expectedStateAtEnd);
3922 if (expectedSuccessFromSta1 + expectedFailuresFromSta1 + expectedSuccessFromSta2 +
3923 expectedFailuresFromSta2 >
3927 const bool isSuccess = (expectedSuccessFromSta1 > 0) || (expectedSuccessFromSta2 > 0);
3957 expectedSuccessFromSta1,
3958 expectedFailuresFromSta1,
3959 expectedBytesFromSta1);
3964 expectedSuccessFromSta2,
3965 expectedFailuresFromSta2,
3966 expectedBytesFromSta2);
3976 double rxPowerNonOfdmaRu1,
3977 double rxPowerNonOfdmaRu2,
3978 double rxPowerOfdmaRu1,
3979 double rxPowerOfdmaRu2)
3985 Time nonOfdmaDuration = hePhy->CalculateNonOfdmaDurationForHeTb(txVectorSta2);
3986 NS_ASSERT(nonOfdmaDuration == hePhy->CalculateNonOfdmaDurationForHeTb(txVectorSta1));
3988 std::vector<double> rxPowerNonOfdma{rxPowerNonOfdmaRu1, rxPowerNonOfdmaRu2};
3989 std::vector<WifiSpectrumBandInfo> nonOfdmaBand{hePhy->GetNonOfdmaBand(txVectorSta1, 1),
3990 hePhy->GetNonOfdmaBand(txVectorSta2, 2)};
3991 std::vector<double> rxPowerOfdma{rxPowerOfdmaRu1, rxPowerOfdmaRu2};
3992 std::vector<WifiSpectrumBandInfo> ofdmaBand{hePhy->GetRuBandForRx(txVectorSta1, 1),
3993 hePhy->GetRuBandForRx(txVectorSta2, 2)};
3995 for (uint8_t i = 0; i < 2; ++i)
4002 delay + detectionDuration +
4008 rxPowerNonOfdma[i]);
4014 rxPowerNonOfdma[i]);
4038 delay + detectionDuration +
4044 rxPowerNonOfdma[i]);
4050 rxPowerNonOfdma[i]);
4068 if (rxPowerOfdmaRu1 != 0.0)
4075 double rxPowerNonOfdmaSta1Only =
4077 ? rxPowerNonOfdma[0]
4078 : rxPowerNonOfdma[0] / 2;
4081 delay + detectionDuration +
4087 rxPowerNonOfdmaSta1Only);
4093 rxPowerNonOfdmaSta1Only);
4117 int64_t streamNumber = 0;
4155 "Reception of solicited HE TB PPDUs");
4174 "Reception of solicited HE TB PPDUs with delay (< 400ns) between the two signals");
4193 "Dropping of unsolicited HE TB PPDUs");
4205 WifiPhyState::CCA_BUSY);
4213 "Dropping of HE TB PPDUs with channel width differing from TRIGVECTOR");
4225 WifiPhyState::CCA_BUSY,
4234 "Dropping of HE TB PPDUs with UL Length differing from TRIGVECTOR");
4246 WifiPhyState::CCA_BUSY,
4255 "Dropping of HE TB PPDUs with AIDs differing from TRIGVECTOR");
4267 WifiPhyState::CCA_BUSY,
4278 "Reception of solicited HE TB PPDUs with interference on RU 1 during PSDU reception");
4285 bands.push_back(bandInfo);
4288 Ptr<SpectrumValue> interferencePsdRu1 = Create<SpectrumValue>(SpectrumInterferenceRu1);
4289 double interferencePower = 0.1;
4290 *interferencePsdRu1 = interferencePower / ((
m_channelWidth / 2) * 20e6);
4300 WifiPhyState::CCA_BUSY,
4317 "Reception of solicited HE TB PPDUs with interference on RU 2 during PSDU reception");
4323 bands.push_back(bandInfo);
4326 Ptr<SpectrumValue> interferencePsdRu2 = Create<SpectrumValue>(SpectrumInterferenceRu2);
4327 *interferencePsdRu2 = interferencePower / ((
m_channelWidth / 2) * 20e6);
4337 ? WifiPhyState::IDLE
4338 : WifiPhyState::CCA_BUSY,
4355 "Reception of solicited HE TB PPDUs with interference on the full band "
4356 "during PSDU reception");
4362 bands.push_back(bandInfo);
4365 Ptr<SpectrumValue> interferencePsdAll = Create<SpectrumValue>(SpectrumInterferenceAll);
4366 *interferencePsdAll = interferencePower / (
m_channelWidth * 20e6);
4376 WifiPhyState::CCA_BUSY,
4394 "Reception of solicited HE TB PPDUs with another HE TB PPDU arriving on RU "
4395 "1 during PSDU reception");
4428 WifiPhyState::CCA_BUSY,
4446 "Reception of solicited HE TB PPDUs with another HE TB PPDU arriving on RU "
4447 "2 during PSDU reception");
4478 ? WifiPhyState::IDLE
4479 : WifiPhyState::CCA_BUSY,
4497 "Reception of solicited HE TB PPDUs with an HE SU PPDU arriving during the 400 ns window");
4524 "Reception of solicited HE TB PPDU only on RU 2");
4532 ? WifiPhyState::IDLE
4533 : WifiPhyState::CCA_BUSY);
4554 "Measure power for reception of HE TB PPDU only on RU 2");
4583 "Measure power for reception of HE TB PPDU only on RU 2 with PSD limitation");
4596 double rxPowerOfdma = rxPower;
4634 "Measure power for reception of HE TB PPDU on both RUs");
4657 "Reception of an HE TB PPDU from another BSS");
4685 "Reception of solicited HE TB PPDUs with delay (< 400ns) between the two signals and "
4686 "reception of an HE TB PPDU from another BSS between the ends of the two HE TB PPDUs");
4699 WifiPhyState::CCA_BUSY,
4758 void DoRun()
override;
4769 std::size_t payloadSize,
4843 std::vector<bool> statusPerMpdu);
4866 :
TestCase(
"PHY padding exclusion test"),
4867 m_countRxSuccessFromSta1(0),
4868 m_countRxSuccessFromSta2(0),
4869 m_countRxFailureFromSta1(0),
4870 m_countRxFailureFromSta2(0),
4871 m_countRxBytesFromSta1(0),
4872 m_countRxBytesFromSta2(0)
4879 std::size_t payloadSize,
4897 txVector.
SetRu(ru, txStaId);
4899 txVector.
SetNss(1, txStaId);
4906 std::ostringstream addr;
4907 addr <<
"00:00:00:00:00:0" << txStaId;
4911 psdus.insert(std::make_pair(txStaId, psdu));
4918 else if (txStaId == 2)
4927 phy->Send(psdus, txVector);
4955 NS_LOG_FUNCTION(
this << *psdu << psdu->GetAddr2() << rxSignalInfo << txVector);
4956 if (psdu->GetAddr2() ==
Mac48Address(
"00:00:00:00:00:01"))
4961 else if (psdu->GetAddr2() ==
Mac48Address(
"00:00:00:00:00:02"))
4972 if (psdu->GetAddr2() ==
Mac48Address(
"00:00:00:00:00:01"))
4976 else if (psdu->GetAddr2() ==
Mac48Address(
"00:00:00:00:00:02"))
4989 "The number of successfully received packets from STA 1 is not correct!");
4993 "The number of unsuccessfuly received packets from STA 1 is not correct!");
4996 "The number of bytes received from STA 1 is not correct!");
5006 "The number of successfully received packets from STA 2 is not correct!");
5010 "The number of unsuccessfuly received packets from STA 2 is not correct!");
5013 "The number of bytes received from STA 2 is not correct!");
5021 "m_currentEvent for AP was not cleared");
5024 "m_currentEvent for STA 1 was not cleared");
5027 "m_currentEvent for STA 2 was not cleared");
5041 WifiPhyState currentState = phy->GetState()->GetState();
5045 "PHY State " << currentState <<
" does not match expected state "
5068 int64_t streamNumber = 0;
5073 spectrumChannel->AddPropagationLossModel(lossModel);
5075 CreateObject<ConstantSpeedPropagationDelayModel>();
5076 spectrumChannel->SetPropagationDelayModel(delayModel);
5078 Ptr<Node> apNode = CreateObject<Node>();
5081 apMac->SetAttribute(
"BeaconGeneration",
BooleanValue(
false));
5082 apDev->SetMac(apMac);
5083 m_phyAp = CreateObject<OfdmaSpectrumWifiPhy>(0);
5085 apDev->SetHeConfiguration(heConfiguration);
5108 apDev->SetHeConfiguration(CreateObject<HeConfiguration>());
5109 apMac->SetWifiPhys({
m_phyAp});
5110 apNode->AggregateObject(apMobility);
5111 apNode->AddDevice(apDev);
5113 Ptr<Node> sta1Node = CreateObject<Node>();
5115 m_phySta1 = CreateObject<OfdmaSpectrumWifiPhy>(1);
5130 sta1Dev->SetHeConfiguration(CreateObject<HeConfiguration>());
5131 sta1Node->AggregateObject(sta1Mobility);
5132 sta1Node->AddDevice(sta1Dev);
5134 Ptr<Node> sta2Node = CreateObject<Node>();
5136 m_phySta2 = CreateObject<OfdmaSpectrumWifiPhy>(2);
5151 sta2Dev->SetHeConfiguration(CreateObject<HeConfiguration>());
5152 sta2Node->AggregateObject(sta2Mobility);
5153 sta2Node->AddDevice(sta2Dev);
5155 Ptr<Node> interfererNode = CreateObject<Node>();
5161 interfererNode->AddDevice(interfererDev);
5198 std::tie(length, ppduDuration) =
5201 auto hePhyAp = DynamicCast<HePhy>(