20 #include "ns3/config.h"
21 #include "ns3/he-configuration.h"
22 #include "ns3/he-frame-exchange-manager.h"
23 #include "ns3/he-phy.h"
24 #include "ns3/mobility-helper.h"
25 #include "ns3/multi-model-spectrum-channel.h"
26 #include "ns3/multi-user-scheduler.h"
27 #include "ns3/packet-socket-client.h"
28 #include "ns3/packet-socket-helper.h"
29 #include "ns3/packet-socket-server.h"
30 #include "ns3/packet.h"
31 #include "ns3/qos-utils.h"
32 #include "ns3/rng-seed-manager.h"
33 #include "ns3/spectrum-wifi-helper.h"
34 #include "ns3/string.h"
36 #include "ns3/wifi-acknowledgment.h"
37 #include "ns3/wifi-mac-header.h"
38 #include "ns3/wifi-mac-queue.h"
39 #include "ns3/wifi-net-device.h"
40 #include "ns3/wifi-protection.h"
41 #include "ns3/wifi-psdu.h"
81 void ComputeWifiTxVector();
99 TypeId(
"ns3::TestMultiUserScheduler")
101 .SetGroupName(
"Wifi")
105 "Modulation class for DL MU PPDUs and TB PPDUs.",
144 : TriggerFrameType::BASIC_TRIGGER);
153 uint32_t ampduSize = (ulTriggerType == TriggerFrameType::BSRP_TRIGGER)
159 for (
auto it = staList.begin(); it != staList.end();)
164 Time duration = WifiPhy::CalculateTxDuration(ampduSize,
167 staList.begin()->first);
170 std::tie(length, duration) = HePhy::ConvertHeTbPpduDurationToLSigLength(
200 NS_LOG_DEBUG(
"Remaining TXOP duration is not enough for BSRP TF exchange");
213 for (
auto it = staList.cbegin(); it != staList.cend();)
217 NS_ABORT_MSG_IF(staList.size() != 4,
"There must be 4 associated stations");
223 for (
auto& sta : staList)
228 for (tid = 0; tid < 8; tid++)
250 NS_LOG_DEBUG(
"Not enough time to send frames to all the stations");
254 std::vector<Ptr<WifiMpdu>> mpduList;
256 ->GetMpduAggregator()
259 if (mpduList.size() > 1)
261 m_psduMap[sta.first] = Create<WifiPsdu>(std::move(mpduList));
265 m_psduMap[sta.first] = Create<WifiPsdu>(mpdu,
true);
310 for (
auto it = staList.cbegin(); it != staList.cend();)
314 NS_ABORT_MSG_IF(staList.size() != 4,
"There must be 4 associated stations");
320 ruType = HeRu::RU_52_TONE;
324 ruType = HeRu::RU_106_TONE;
328 ruType = HeRu::RU_242_TONE;
332 ruType = HeRu::RU_484_TONE;
339 bool primary80 =
true;
340 std::size_t ruIndex = 1;
342 for (
auto& sta : staList)
344 if (bw == 160 && ruIndex == 3)
351 m_txVector.SetSigBMode(VhtPhy::GetVhtMcs5());
422 uint32_t maxAmpduSize,
424 uint16_t nPktsPerSta,
441 void TraceCw(uint32_t staIndex, uint32_t cw, uint8_t );
462 void DoRun()
override;
499 uint32_t maxAmpduSize,
501 uint16_t nPktsPerSta,
504 :
TestCase(
"Check correct operation of DL OFDMA acknowledgment sequences"),
506 m_sockets(m_nStations),
507 m_channelWidth(width),
508 m_dlMuAckType(dlType),
509 m_maxAmpduSize(maxAmpduSize),
510 m_txopLimit(txopLimit),
511 m_nPktsPerSta(nPktsPerSta),
512 m_muEdcaParameterSet(muEdcaParameterSet),
513 m_scenario(scenario),
514 m_ulPktsGenerated(false),
517 m_edcaDisabledStartTime(
Seconds(0)),
518 m_cwValues(std::vector<uint32_t>(m_nStations, 2))
591 for (
const auto& [staId, psdu] : psduMap)
594 << psdu->GetHeader(0).GetTypeString() <<
" #MPDUs " << psdu->GetNMpdus()
595 << (psdu->GetHeader(0).IsQosData()
598 << std::setprecision(10) <<
" txDuration " << txDuration <<
" duration/ID "
599 << psdu->GetHeader(0).GetDuration() <<
" #TX PSDUs = " <<
m_txPsdus.size()
600 <<
" size=" << (*psdu->begin())->GetSize() <<
"\n"
601 <<
"TXVECTOR: " << txVector <<
"\n");
618 while ((mpdu = queue->PeekByTidAndAddress(i * 2,
619 staDev->GetMac()->GetAddress(),
620 lastInFlight)) !=
nullptr)
622 if (mpdu->IsInFlight())
635 psduMap.begin()->second->GetHeader(0).HasData())
637 Mac48Address sender = psduMap.begin()->second->GetAddr2();
643 if (dev->GetAddress() == sender)
667 else if (!txVector.
IsMu() && psduMap.begin()->second->GetHeader(0).IsBlockAck() &&
672 psduMap.begin()->second->GetPayload(0)->PeekHeader(blockAck);
682 else if (!txVector.
IsMu() && psduMap.begin()->second->GetHeader(0).IsTrigger() &&
686 psduMap.
begin()->second->GetPayload(0)->PeekHeader(trigger);
701 client->SetStartTime(txDuration);
748 "Expected a Trigger Frame");
753 "Expected one User Info field per station");
756 "Expected the MU-RTS to occupy the entire channel width");
757 for (
const auto& userInfo : trigger)
761 "Unexpected RU Allocation value in MU-RTS");
770 m_txPsdus[1].psduMap.begin()->second->GetNMpdus() == 1 &&
773 "Expected a CTS frame");
776 "Expected the CTS to occupy the entire channel width");
790 m_txPsdus[2].psduMap.begin()->second->GetNMpdus() == 1 &&
793 "Expected a CTS frame");
796 "Expected the CTS to occupy the entire channel width");
810 m_txPsdus[3].psduMap.begin()->second->GetNMpdus() == 1 &&
813 "Expected a CTS frame");
816 "Expected the CTS to occupy the entire channel width");
830 m_txPsdus[4].psduMap.begin()->second->GetNMpdus() == 1 &&
833 "Expected a CTS frame");
836 "Expected the CTS to occupy the entire channel width");
852 "Expected a Trigger Frame");
857 "Expected one User Info field per station");
870 m_txPsdus[6].psduMap.begin()->second->GetNMpdus() == 1),
872 "Expected a QoS Null frame in a TB PPDU");
885 uint8_t tid = staId * 2;
892 tEnd + sifs + tolerance,
893 "QoS Null frame in HE TB PPDU sent too late");
899 "Expected null Duration/ID for QoS Null frame in HE TB PPDU");
908 m_txPsdus[7].psduMap.begin()->second->GetNMpdus() == 1),
910 "Expected a QoS Null frame in a TB PPDU");
923 uint8_t tid = staId * 2;
929 tEnd + sifs + tolerance,
930 "QoS Null frame in HE TB PPDU sent too late");
931 qosNullNavEnd =
m_txPsdus[7].endTx +
m_txPsdus[7].psduMap.begin()->second->GetDuration();
936 "Expected null Duration/ID for QoS Null frame in HE TB PPDU");
945 m_txPsdus[8].psduMap.begin()->second->GetNMpdus() == 1),
947 "Expected a QoS Null frame in an HE TB PPDU");
960 uint8_t tid = staId * 2;
966 tEnd + sifs + tolerance,
967 "QoS Null frame in HE TB PPDU sent too late");
968 qosNullNavEnd =
m_txPsdus[8].endTx +
m_txPsdus[8].psduMap.begin()->second->GetDuration();
973 "Expected null Duration/ID for QoS Null frame in HE TB PPDU");
982 m_txPsdus[9].psduMap.begin()->second->GetNMpdus() == 1),
984 "Expected a QoS Null frame in an HE TB PPDU");
997 uint8_t tid = staId * 2;
1003 tEnd + sifs + tolerance,
1004 "QoS Null frame in HE TB PPDU sent too late");
1005 qosNullNavEnd =
m_txPsdus[9].endTx +
m_txPsdus[9].psduMap.begin()->second->GetDuration();
1010 "Expected null Duration/ID for QoS Null frame in HE TB PPDU");
1036 "Expected at least 15 transmitted packet");
1042 "Expected a Trigger Frame");
1047 "Expected one User Info field per station");
1050 "Expected the MU-RTS to occupy the entire channel width");
1051 for (
const auto& userInfo : trigger)
1055 "Unexpected RU Allocation value in MU-RTS");
1066 m_txPsdus[11].psduMap.begin()->second->GetNMpdus() == 1 &&
1069 "Expected a CTS frame");
1072 "Expected the CTS to occupy the entire channel width");
1082 "Duration/ID in CTS frame is too long");
1088 m_txPsdus[12].psduMap.begin()->second->GetNMpdus() == 1 &&
1091 "Expected a CTS frame");
1094 "Expected the CTS to occupy the entire channel width");
1104 "Duration/ID in CTS frame is too long");
1110 m_txPsdus[13].psduMap.begin()->second->GetNMpdus() == 1 &&
1113 "Expected a CTS frame");
1116 "Expected the CTS to occupy the entire channel width");
1126 "Duration/ID in CTS frame is too long");
1132 m_txPsdus[14].psduMap.begin()->second->GetNMpdus() == 1 &&
1135 "Expected a CTS frame");
1138 "Expected the CTS to occupy the entire channel width");
1148 "Duration/ID in CTS frame is too long");
1166 "Expected a Trigger Frame");
1171 "Expected one User Info field per station");
1183 m_txPsdus[16].psduMap.begin()->second->GetNMpdus() == 2 &&
1184 m_txPsdus[16].psduMap.begin()->second->GetHeader(0).IsQosData() &&
1185 m_txPsdus[16].psduMap.begin()->second->GetHeader(1).IsQosData()),
1187 "Expected 2 QoS data frames in an HE TB PPDU");
1192 tEnd + sifs + tolerance,
1193 "QoS data frames in HE TB PPDU sent too late");
1202 m_txPsdus[17].psduMap.begin()->second->GetNMpdus() == 2 &&
1203 m_txPsdus[17].psduMap.begin()->second->GetHeader(0).IsQosData() &&
1204 m_txPsdus[17].psduMap.begin()->second->GetHeader(1).IsQosData()),
1206 "Expected 2 QoS data frames in an HE TB PPDU");
1210 tEnd + sifs + tolerance,
1211 "QoS data frames in HE TB PPDU sent too late");
1212 qosDataNavEnd =
m_txPsdus[17].endTx +
m_txPsdus[17].psduMap.begin()->second->GetDuration();
1220 m_txPsdus[18].psduMap.begin()->second->GetNMpdus() == 2 &&
1221 m_txPsdus[18].psduMap.begin()->second->GetHeader(0).IsQosData() &&
1222 m_txPsdus[18].psduMap.begin()->second->GetHeader(1).IsQosData()),
1224 "Expected 2 QoS data frames in an HE TB PPDU");
1228 tEnd + sifs + tolerance,
1229 "QoS data frames in HE TB PPDU sent too late");
1230 qosDataNavEnd =
m_txPsdus[18].endTx +
m_txPsdus[18].psduMap.begin()->second->GetDuration();
1238 m_txPsdus[19].psduMap.begin()->second->GetNMpdus() == 2 &&
1239 m_txPsdus[19].psduMap.begin()->second->GetHeader(0).IsQosData() &&
1240 m_txPsdus[19].psduMap.begin()->second->GetHeader(1).IsQosData()),
1242 "Expected 2 QoS data frames in an HE TB PPDU");
1246 tEnd + sifs + tolerance,
1247 "QoS data frames in HE TB PPDU sent too late");
1248 qosDataNavEnd =
m_txPsdus[19].endTx +
m_txPsdus[19].psduMap.begin()->second->GetDuration();
1258 "Expected a Block Ack");
1263 "Expected one Per AID TID Info subfield per station");
1264 for (uint8_t i = 0; i < 4; i++)
1277 "Duration/ID in Multi-STA BlockAck is too short");
1280 "Duration/ID in Multi-STA BlockAck is too long");
1289 "Expected at least 26 transmitted packet");
1295 "Expected a Trigger Frame");
1300 "Expected one User Info field per station");
1303 "Expected the MU-RTS to occupy the entire channel width");
1304 for (
const auto& userInfo : trigger)
1308 "Unexpected RU Allocation value in MU-RTS");
1320 m_txPsdus[22].psduMap.begin()->second->GetNMpdus() == 1 &&
1323 "Expected a CTS frame");
1326 "Expected the CTS to occupy the entire channel width");
1336 "Duration/ID in CTS frame is too long");
1342 m_txPsdus[23].psduMap.begin()->second->GetNMpdus() == 1 &&
1345 "Expected a CTS frame");
1348 "Expected the CTS to occupy the entire channel width");
1358 "Duration/ID in CTS frame is too long");
1364 m_txPsdus[24].psduMap.begin()->second->GetNMpdus() == 1 &&
1367 "Expected a CTS frame");
1370 "Expected the CTS to occupy the entire channel width");
1380 "Duration/ID in CTS frame is too long");
1386 m_txPsdus[25].psduMap.begin()->second->GetNMpdus() == 1 &&
1389 "Expected a CTS frame");
1392 "Expected the CTS to occupy the entire channel width");
1402 "Duration/ID in CTS frame is too long");
1418 "Expected a DL MU PPDU");
1421 "Expected 4 PSDUs within the DL MU PPDU");
1425 "TX duration cannot exceed max PPDU duration");
1426 for (
auto& psdu :
m_txPsdus[26].psduMap)
1430 "Max A-MPDU size exceeded");
1438 for (
auto& psdu :
m_txPsdus[26].psduMap)
1442 dlMuNavEnd += psdu.second->GetDuration();
1448 "Duration/ID must be the same for all PSDUs");
1455 std::size_t nTxPsdus = 0;
1457 if (
m_dlMuAckType == WifiAcknowledgment::DL_MU_BAR_BA_SEQUENCE)
1487 "Expected a Block Ack");
1498 "Duration/ID in 1st BlockAck frame is too short");
1501 "Duration/ID in 1st BlockAck is too long");
1507 "Expected a Block Ack Request");
1512 tEnd + sifs + tolerance,
1513 "First Block Ack Request sent too late");
1523 "Duration/ID in BlockAckReq is too short");
1526 "Duration/ID in BlockAckReq is too long");
1533 "Expected a Block Ack");
1545 "Duration/ID in BlockAck is too long");
1552 "Duration/ID in BlockAck is too short");
1554 barNavEnd + tolerance,
1555 "Duration/ID in BlockAck is too long");
1558 "Expected null Duration/ID for BlockAck");
1565 "Expected a Block Ack Request");
1570 tEnd + sifs + tolerance,
1571 "Second Block Ack Request sent too late");
1581 "Duration/ID in BlockAckReq is too short");
1584 "Duration/ID in BlockAckReq is too long");
1591 "Expected a Block Ack");
1603 "Duration/ID in BlockAck is too long");
1610 "Duration/ID in BlockAck is too short");
1612 barNavEnd + tolerance,
1613 "Duration/ID in BlockAck is too long");
1616 "Expected null Duration/ID for BlockAck");
1623 "Expected a Block Ack Request");
1628 tEnd + sifs + tolerance,
1629 "Third Block Ack Request sent too late");
1639 "Duration/ID in BlockAckReq is too short");
1642 "Duration/ID in BlockAckReq is too long");
1649 "Expected a Block Ack");
1661 "Duration/ID in BlockAck is too long");
1668 "Duration/ID in BlockAck is too short");
1670 barNavEnd + tolerance,
1671 "Duration/ID in BlockAck is too long");
1674 "Expected null Duration/ID for BlockAck");
1679 else if (
m_dlMuAckType == WifiAcknowledgment::DL_MU_TF_MU_BAR)
1704 "Expected a MU-BAR Trigger Frame");
1712 "Duration/ID in MU-BAR Trigger Frame is too short");
1715 "Duration/ID in MU-BAR Trigger Frame is too long");
1720 m_txPsdus[28].psduMap.begin()->second->GetHeader(0).IsBlockAck()),
1722 "Expected a Block Ack");
1727 tEnd + sifs + tolerance,
1728 "Block Ack in HE TB PPDU sent too late");
1737 "Expected null Duration/ID for BlockAck");
1743 m_txPsdus[29].psduMap.begin()->second->GetHeader(0).IsBlockAck()),
1745 "Expected a Block Ack");
1749 tEnd + sifs + tolerance,
1750 "Block Ack in HE TB PPDU sent too late");
1751 baNavEnd =
m_txPsdus[29].endTx +
m_txPsdus[29].psduMap.begin()->second->GetDuration();
1756 "Duration/ID in 1st BlockAck is too long");
1761 "Expected null Duration/ID for BlockAck");
1767 m_txPsdus[30].psduMap.begin()->second->GetHeader(0).IsBlockAck()),
1769 "Expected a Block Ack");
1773 tEnd + sifs + tolerance,
1774 "Block Ack in HE TB PPDU sent too late");
1775 baNavEnd =
m_txPsdus[30].endTx +
m_txPsdus[30].psduMap.begin()->second->GetDuration();
1780 "Duration/ID in 1st BlockAck is too long");
1785 "Expected null Duration/ID for BlockAck");
1791 m_txPsdus[31].psduMap.begin()->second->GetHeader(0).IsBlockAck()),
1793 "Expected a Block Ack");
1797 tEnd + sifs + tolerance,
1798 "Block Ack in HE TB PPDU sent too late");
1799 baNavEnd =
m_txPsdus[31].endTx +
m_txPsdus[31].psduMap.begin()->second->GetDuration();
1804 "Duration/ID in 1st BlockAck is too long");
1809 "Expected null Duration/ID for BlockAck");
1814 else if (
m_dlMuAckType == WifiAcknowledgment::DL_MU_AGGREGATE_TF)
1835 for (
auto& psdu :
m_txPsdus[26].psduMap)
1839 "Expected an aggregated MU-BAR Trigger Frame");
1845 m_txPsdus[27].psduMap.begin()->second->GetHeader(0).IsBlockAck()),
1847 "Expected a Block Ack");
1852 tEnd + sifs + tolerance,
1853 "Block Ack in HE TB PPDU sent too late");
1862 "Expected null Duration/ID for BlockAck");
1868 m_txPsdus[28].psduMap.begin()->second->GetHeader(0).IsBlockAck()),
1870 "Expected a Block Ack");
1874 tEnd + sifs + tolerance,
1875 "Block Ack in HE TB PPDU sent too late");
1876 baNavEnd =
m_txPsdus[28].endTx +
m_txPsdus[28].psduMap.begin()->second->GetDuration();
1884 "Expected null Duration/ID for BlockAck");
1890 m_txPsdus[29].psduMap.begin()->second->GetHeader(0).IsBlockAck()),
1892 "Expected a Block Ack");
1896 tEnd + sifs + tolerance,
1897 "Block Ack in HE TB PPDU sent too late");
1898 baNavEnd =
m_txPsdus[29].endTx +
m_txPsdus[29].psduMap.begin()->second->GetDuration();
1906 "Expected null Duration/ID for BlockAck");
1912 m_txPsdus[30].psduMap.begin()->second->GetHeader(0).IsBlockAck()),
1914 "Expected a Block Ack");
1918 tEnd + sifs + tolerance,
1919 "Block Ack in HE TB PPDU sent too late");
1920 baNavEnd =
m_txPsdus[30].endTx +
m_txPsdus[30].psduMap.begin()->second->GetDuration();
1928 "Expected null Duration/ID for BlockAck");
1936 "Not all DL packets have been received");
1943 for (std::size_t i = nTxPsdus; i <
m_txPsdus.size(); ++i)
1946 !
m_txPsdus[i].psduMap.begin()->second->GetHeader(0).IsCts() &&
1947 m_txPsdus[i].psduMap.begin()->second->GetHeader(0).GetAddr2() !=
1955 "A station transmitted before the MU EDCA timer expired");
1967 "A station did not set the correct MU CW min");
1977 uint32_t previousSeed = RngSeedManager::GetSeed();
1978 uint64_t previousRun = RngSeedManager::GetRun();
1981 int64_t streamNumber = 10;
1994 spectrumChannel->AddPropagationLossModel(lossModel);
1996 CreateObject<ConstantSpeedPropagationDelayModel>();
1997 spectrumChannel->SetPropagationDelayModel(delayModel);
2000 phy.SetPcapDataLinkType(WifiPhyHelper::DLT_IEEE802_11_RADIO);
2001 phy.SetErrorRateModel(
"ns3::NistErrorRateModel");
2002 phy.SetChannel(spectrumChannel);
2006 phy.Set(
"ChannelSettings",
StringValue(
"{36, 20, BAND_5GHZ, 0}"));
2009 phy.Set(
"ChannelSettings",
StringValue(
"{38, 40, BAND_5GHZ, 0}"));
2012 phy.Set(
"ChannelSettings",
StringValue(
"{42, 80, BAND_5GHZ, 0}"));
2015 phy.Set(
"ChannelSettings",
StringValue(
"{50, 160, BAND_5GHZ, 0}"));
2018 NS_ABORT_MSG(
"Invalid channel bandwidth (must be 20, 40, 80 or 160)");
2064 wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
2067 wifi.ConfigHeOptions(
"MuBeAifsn",
2085 mac.SetType(
"ns3::StaWifiMac",
2093 "BE_BlockAckThreshold",
2100 "BK_BlockAckThreshold",
2107 "VI_BlockAckThreshold",
2114 "VO_BlockAckThreshold",
2132 mac.SetType(
"ns3::ApWifiMac",
"BeaconGeneration",
BooleanValue(
true));
2133 mac.SetMultiUserScheduler(
2134 "ns3::TestMultiUserScheduler",
2138 "AccessReqInterval",
2140 "DelayAccessReqUponAccess",
2142 mac.SetAckManager(
"ns3::WifiDefaultAckManager",
2143 "DlMuAckSequenceType",
2155 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
2156 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
2157 positionAlloc->Add(Vector(0.0, 1.0, 0.0));
2158 positionAlloc->Add(Vector(-1.0, 0.0, 0.0));
2159 positionAlloc->Add(Vector(-1.0, -1.0, 0.0));
2160 mobility.SetPositionAllocator(positionAlloc);
2162 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
2167 for (uint32_t i = 0; i < allDevices.
GetN(); i++)
2169 auto dev = DynamicCast<WifiNetDevice>(allDevices.
Get(i));
2176 dev->GetMac()->GetQosTxop(
AC_BE)->SetAifsn(3);
2177 dev->GetMac()->GetQosTxop(
AC_BK)->SetAifsn(3);
2178 dev->GetMac()->GetQosTxop(
AC_VI)->SetAifsn(3);
2179 dev->GetMac()->GetQosTxop(
AC_VO)->SetAifsn(3);
2201 client1->SetRemote(socket);
2204 client1->SetStopTime(
Seconds(2.0));
2209 client2->SetAttribute(
"PacketSize",
UintegerValue(1400 + i * 100));
2213 client2->SetRemote(socket);
2215 client2->SetStartTime(
Seconds(1.5003));
2216 client2->SetStopTime(
Seconds(2.5));
2219 server->SetLocal(socket);
2242 client1->SetStopTime(
Seconds(2.0));
2254 Config::Connect(
"/NodeList/*/ApplicationList/0/$ns3::PacketSocketServer/Rx",
2257 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyTxPsduBegin",
2267 Simulator::Destroy();
2289 using MuEdcaParams = std::initializer_list<OfdmaAckSequenceTest::MuEdcaParameterSet>;
2291 for (
auto& muEdcaParameterSet : MuEdcaParams{{0, 0, 0, 0} ,
2292 {0, 127, 2047, 100} ,
2293 {10, 127, 2047, 100} })
2295 for (
const auto scenario :
2299 WifiAcknowledgment::DL_MU_BAR_BA_SEQUENCE,
2307 WifiAcknowledgment::DL_MU_AGGREGATE_TF,
2315 WifiAcknowledgment::DL_MU_TF_MU_BAR,
2323 WifiAcknowledgment::DL_MU_BAR_BA_SEQUENCE,
2331 WifiAcknowledgment::DL_MU_AGGREGATE_TF,
2339 WifiAcknowledgment::DL_MU_TF_MU_BAR,
Test OFDMA acknowledgment sequences.
OfdmaAckSequenceTest(uint16_t width, WifiAcknowledgment::Method dlType, uint32_t maxAmpduSize, uint16_t txopLimit, uint16_t nPktsPerSta, MuEdcaParameterSet muEdcaParameterSet, WifiOfdmaScenario scenario)
Constructor.
std::vector< FrameInfo > m_txPsdus
transmitted PSDUs
Time m_edcaDisabledStartTime
time when disabling EDCA started
uint16_t m_flushed
number of DL packets flushed after DL MU PPDU
uint8_t m_muRtsRuAllocation
B7-B1 of RU Allocation subfield of MU-RTS.
void Transmit(std::string context, WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
Callback invoked when FrameExchangeManager passes PSDUs to the PHY.
static constexpr uint16_t m_muTimerRes
MU timer resolution in usec.
uint16_t m_received
number of packets received by the stations
void CheckResults(Time sifs, Time slotTime, uint8_t aifsn)
Check correctness of transmitted frames.
WifiAcknowledgment::Method m_dlMuAckType
DL MU ack sequence type.
bool m_ulPktsGenerated
whether UL packets for HE TB PPDUs have been generated
uint16_t m_nPktsPerSta
number of packets to send to each station
NetDeviceContainer m_staDevices
stations' devices
std::vector< PacketSocketAddress > m_sockets
packet socket addresses for STAs
uint16_t m_txopLimit
TXOP limit in microseconds.
void DoRun() override
Implementation to actually run this TestCase.
void L7Receive(std::string context, Ptr< const Packet > p, const Address &addr)
Function to trace packets received by the server application.
uint16_t m_channelWidth
PHY channel bandwidth in MHz.
WifiOfdmaScenario m_scenario
OFDMA scenario to test.
~OfdmaAckSequenceTest() override
uint32_t m_maxAmpduSize
maximum A-MPDU size in bytes
Ptr< WifiNetDevice > m_apDevice
AP's device.
std::vector< uint32_t > m_cwValues
CW used by stations after MU exchange.
void TraceCw(uint32_t staIndex, uint32_t cw, uint8_t)
Function to trace CW value used by the given station after the MU exchange.
WifiPreamble m_tbPreamble
expected preamble type for TB PPDUs
uint16_t m_nStations
number of stations
MuEdcaParameterSet m_muEdcaParameterSet
MU EDCA Parameter Set.
WifiPreamble m_dlMuPreamble
expected preamble type for DL MU PPDUs
Dummy Multi User Scheduler used to test OFDMA ack sequences.
WifiPsduMap m_psduMap
the DL MU PPDU to transmit
TxFormat m_txFormat
the format of next transmission
WifiModulationClass m_modClass
modulation class for DL MU PPDUs and TB PPDUs
WifiTxVector m_txVector
the TX vector for MU PPDUs
UlMuInfo ComputeUlMuInfo() override
Prepare the information required to solicit an UL MU transmission.
TriggerFrameType m_ulTriggerType
Trigger Frame type for UL MU.
WifiTxParameters m_txParams
TX parameters.
TxFormat SelectTxFormat() override
Select the format of the next transmission.
void ComputeWifiTxVector()
Compute the TX vector to use for MU PPDUs.
~TestMultiUserScheduler() override
static TypeId GetTypeId()
Get the type ID.
WifiMacHeader m_triggerHdr
MAC header for Trigger Frame.
CtrlTriggerHeader m_trigger
Trigger Frame to send.
DlMuInfo ComputeDlMuInfo() override
Compute the information required to perform a DL MU transmission.
wifi MAC OFDMA Test Suite
a polymophic address class
const std::map< uint16_t, Mac48Address > & GetStaList(uint8_t linkId) const
Get a const reference to the map of associated stations on the given link.
Hold variables of type enum.
RuType
The different HE Resource Unit (RU) types.
Helper class used to assign positions and mobility models to nodes.
MultiUserScheduler is an abstract base class defining the API that APs supporting at least VHT can us...
bool m_initialFrame
true if a TXOP is being started
Ptr< ApWifiMac > m_apMac
the AP wifi MAC
uint16_t m_allowedWidth
the allowed width in MHz for the current transmission
Time m_availableTime
the time available for frame exchange
Ptr< WifiRemoteStationManager > GetWifiRemoteStationManager(uint8_t linkId) const
Get the station manager attached to the AP on the given link.
uint32_t GetMaxSizeOfQosNullAmpdu(const CtrlTriggerHeader &trigger) const
Get the maximum size in bytes among the A-MPDUs containing QoS Null frames and solicited by the given...
Ptr< HeFrameExchangeManager > GetHeFem(uint8_t linkId) const
Get the HE Frame Exchange Manager attached to the AP on the given link.
TxFormat
Enumeration of the possible transmission formats.
holds a vector of ns3::NetDevice pointers
uint32_t GetN() const
Get the number of Ptr<NetDevice> stored in this container.
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
void AddHeader(const Header &header)
Add header to this packet.
uint32_t GetSize() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
an address for a packet socket
void SetProtocol(uint16_t protocol)
Set the protocol.
void SetPhysicalAddress(const Address address)
Set the destination address.
void SetSingleDevice(uint32_t device)
Set the address to match only a specified NetDevice.
Give ns3::PacketSocket powers to ns3::Node.
void Install(Ptr< Node > node) const
Aggregate an instance of a ns3::PacketSocketFactory onto the provided node.
Ptr< WifiMpdu > PeekNextMpdu(uint8_t linkId, uint8_t tid=8, Mac48Address recipient=Mac48Address::GetBroadcast(), Ptr< const WifiMpdu > mpdu=nullptr)
Peek the next frame to transmit on the given link to the given receiver and of the given TID from the...
Ptr< WifiMpdu > GetNextMpdu(uint8_t linkId, Ptr< WifiMpdu > peekedItem, WifiTxParameters &txParams, Time availableTime, bool initialFrame)
Prepare the frame to transmit on the given link starting from the MPDU that has been previously peeke...
Make it easy to create and manage PHY objects for the spectrum model.
The IEEE 802.11 SSID Information Element.
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.
int64_t GetMicroSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Ptr< WifiMacQueue > GetWifiMacQueue() const
Return the packet queue associated with this Txop.
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.
Ptr< HeConfiguration > GetHeConfiguration() const
Ptr< WifiPhy > GetWifiPhy(uint8_t linkId=SINGLE_LINK_OP_ID) const
bool GetHeSupported() const
Return whether the device supports HE.
Ptr< WifiRemoteStationManager > GetWifiRemoteStationManager(uint8_t linkId=0) const
Mac48Address GetAddress() const
Ptr< QosTxop > GetQosTxop(AcIndex ac) const
Accessor for a specified EDCA object.
Ptr< WifiMac > GetMac() const
uint32_t GetIfIndex() const override
Address GetAddress() const override
Time GetSlot() const
Return the slot duration for this PHY.
uint16_t GetChannelWidth() const
Time GetSifs() const
Return the Short Interframe Space (SIFS) for this PHY.
WifiPhyBand GetPhyBand() const
Get the configured Wi-Fi band.
This class stores the TX parameters (TX vector, protection mechanism, acknowledgment mechanism,...
std::unique_ptr< WifiProtection > m_protection
protection method
std::unique_ptr< WifiAcknowledgment > m_acknowledgment
acknowledgment method
Time m_txDuration
TX duration of the frame.
WifiTxVector m_txVector
TXVECTOR of the frame being prepared.
void Clear()
Reset the TX parameters.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
void SetRuAllocation(const RuAllocation &ruAlloc, uint8_t p20Index)
Set RU_ALLOCATION field.
void SetEhtPpduType(uint8_t type)
Set the EHT_PPDU_TYPE parameter.
void SetTxPowerLevel(uint8_t powerlevel)
Sets the selected transmission power level.
void SetChannelWidth(uint16_t channelWidth)
Sets the selected channelWidth (in MHz)
void SetGuardInterval(uint16_t guardInterval)
Sets the guard interval duration (in nanoseconds)
void SetHeMuUserInfo(uint16_t staId, HeMuUserInfo userInfo)
Set the HE MU user-specific transmission information for the given STA-ID.
WifiPreamble GetPreambleType() const
void SetPreambleType(WifiPreamble preamble)
Sets the preamble type.
void SetGlobal(std::string name, const AttributeValue &value)
void SetDefault(std::string name, const AttributeValue &value)
void Connect(std::string path, const CallbackBase &cb)
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
#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.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Time Now()
create an ns3::Time instance which contains the current simulation time.
#define NS_TEST_EXPECT_MSG_GT_OR_EQ(actual, limit, msg)
Test that an actual value is greater than or equal to limit and report if not.
#define NS_TEST_EXPECT_MSG_LT_OR_EQ(actual, limit, msg)
Test that an actual value is less than or equal to a limit and report if not.
#define NS_TEST_EXPECT_MSG_LT(actual, limit, msg)
Test that an actual value is less than a limit and report if not.
#define NS_TEST_EXPECT_MSG_NE(actual, limit, msg)
Test that an actual and expected (limit) value are not equal and report if not.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
#define NS_TEST_ASSERT_MSG_GT_OR_EQ(actual, limit, msg)
Test that an actual value is greater than or equal to a limit and report and abort if not.
WifiOfdmaScenario
The scenarios.
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.
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
WifiModulationClass
This enumeration defines the modulation classes per (Table 10-6 "Modulation classes"; IEEE 802....
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
TriggerFrameType
The different Trigger frame types.
@ WIFI_PHY_BAND_5GHZ
The 5 GHz band.
@ WIFI_MOD_CLASS_EHT
EHT (Clause 36)
@ WIFI_MOD_CLASS_HE
HE (Clause 27)
NLOHMANN_BASIC_JSON_TPL_DECLARATION std::string to_string(const NLOHMANN_BASIC_JSON_TPL &j)
user-defined to_string function for JSON values
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Time GetPpduMaxTime(WifiPreamble preamble)
Get the maximum PPDU duration (see Section 10.14 of 802.11-2016) for the PHY layers defining the aPPD...
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
bool IsEht(WifiPreamble preamble)
Return true if a preamble corresponds to an EHT transmission.
Ptr< const AttributeChecker > MakeEnumChecker(T v, std::string n, Ts... args)
Make an EnumChecker pre-configured with a set of allowed values by name.
static constexpr uint8_t SINGLE_LINK_OP_ID
Link ID for single link operations (helps tracking places where correct link ID is to be used to supp...
static constexpr uint16_t SU_STA_ID
STA_ID to identify a single user (SU)
std::unordered_map< uint16_t, Ptr< WifiPsdu > > WifiPsduMap
Map of PSDUs indexed by STA-ID.
Information about transmitted frames.
Time startTx
start TX time
WifiTxVector txVector
TXVECTOR.
WifiConstPsduMap psduMap
transmitted PSDU map
uint8_t muAifsn
MU AIFS (0 to disable EDCA)
uint16_t muCwMin
MU CW min.
uint8_t muTimer
MU EDCA Timer in units of 8192 microseconds (0 not to use MU EDCA)
uint16_t muCwMax
MU CW max.
Information to be provided in case of DL MU transmission.
Information to be provided in case of UL MU transmission.
Method
Available acknowledgment methods.
static WifiMacOfdmaTestSuite g_wifiMacOfdmaTestSuite
the test suite