18#include "ns3/boolean.h"
19#include "ns3/constant-position-mobility-model.h"
20#include "ns3/he-phy.h"
21#include "ns3/interference-helper.h"
23#include "ns3/multi-model-spectrum-channel.h"
24#include "ns3/nist-error-rate-model.h"
25#include "ns3/ofdm-ppdu.h"
26#include "ns3/pointer.h"
27#include "ns3/spectrum-wifi-helper.h"
28#include "ns3/spectrum-wifi-phy.h"
29#include "ns3/string.h"
31#include "ns3/wifi-mac-header.h"
32#include "ns3/wifi-net-device.h"
33#include "ns3/wifi-phy-listener.h"
34#include "ns3/wifi-psdu.h"
35#include "ns3/wifi-spectrum-phy-interface.h"
36#include "ns3/wifi-spectrum-signal-parameters.h"
37#include "ns3/wifi-spectrum-value-helper.h"
38#include "ns3/wifi-utils.h"
107 std::vector<bool> statusPerMpdu);
116 void DoRun()
override;
164 txParams->psd = txPowerSpectrum;
165 txParams->txPhy =
nullptr;
166 txParams->duration = txDuration;
167 txParams->ppdu = ppdu;
183 std::vector<bool> statusPerMpdu)
208 m_phy = CreateObject<SpectrumWifiPhy>();
222 node->AddDevice(dev);
236 double txPowerWatts = 0.010;
297 const std::vector<Time>& )
override
367 void DoRun()
override;
384 m_listener = std::make_shared<TestPhyListener>();
391 double txPowerWatts = 0.010;
399 "Didn't receive NotifyCcaBusyStart (once preamble is detected + prolonged by L-SIG "
400 "reception, then switched to Rx by at the beginning of data)");
429 void DoRun()
override;
458 :
TestCase(
"SpectrumWifiPhy test RX filters"),
459 m_txChannelWidth(20),
501 for (
const auto& pair : rxPowersW)
503 NS_LOG_INFO(
"band: (" << pair.first <<
") -> powerW=" << pair.second <<
" ("
504 <<
WToDbm(pair.second) <<
" dBm)");
507 size_t numBands = rxPowersW.size();
516 "Total number of bands handled by the receiver is incorrect");
520 auto it = rxPowersW.find(band);
521 NS_LOG_INFO(
"powerW total band: " << it->second <<
" (" <<
WToDbm(it->second) <<
" dBm)");
522 int totalRxPower =
static_cast<int>(
WToDbm(it->second) + 0.5);
523 int expectedTotalRxPower;
528 expectedTotalRxPower = 16;
533 expectedTotalRxPower =
537 expectedTotalRxPower,
538 "Total received power is not correct");
543 it = rxPowersW.find(band);
544 NS_LOG_INFO(
"powerW in primary 20 MHz channel: " << it->second <<
" (" <<
WToDbm(it->second)
546 int rxPowerPrimaryChannel20 =
static_cast<int>(
WToDbm(it->second) + 0.5);
547 int expectedRxPowerPrimaryChannel20 = 16 -
static_cast<int>(
RatioToDb(channelWidth / 20));
549 expectedRxPowerPrimaryChannel20,
550 "Received power in the primary 20 MHz band is not correct");
562 lossModel->SetFrequency(5.180e9);
563 spectrumChannel->AddPropagationLossModel(lossModel);
565 CreateObject<ConstantSpeedPropagationDelayModel>();
566 spectrumChannel->SetPropagationDelayModel(delayModel);
570 m_txPhy = CreateObject<ExtSpectrumWifiPhy>();
581 txNode->AggregateObject(apMobility);
582 txNode->AddDevice(txDev);
586 m_rxPhy = CreateObject<ExtSpectrumWifiPhy>();
596 rxNode->AggregateObject(sta1Mobility);
597 rxNode->AddDevice(rxDev);
614 uint16_t txFrequency;
639 uint16_t rxFrequency;
665 for (uint16_t bw = 160; bw >= 20; bw = bw / 2)
669 for (
unsigned int type = 0; type < 7; type++)
672 for (std::size_t index = 1; index <=
HeRu::GetNRus(bw, ruType); index++)
677 std::make_pair(subcarrierGroup.front().first,
678 subcarrierGroup.back().second);
802 void DoRun()
override;
814 uint8_t channelNumber,
815 uint16_t channelWidth);
849 std::vector<bool> statusPerMpdu);
868 bool interferencesExpected);
878 bool interferencesExpected);
897 const std::vector<std::size_t>& expectedConnectedPhysPerChannel);
924 std::vector<uint32_t>
926 std::vector<uint32_t>
935 bool trackSignalsInactiveInterfaces)
936 :
TestCase{
"SpectrumWifiPhy test operation with multiple RF interfaces"},
937 m_trackSignalsInactiveInterfaces{trackSignalsInactiveInterfaces}
944 uint8_t channelNumber,
945 uint16_t channelWidth)
947 NS_LOG_FUNCTION(
this << index << band << +channelNumber << channelWidth);
949 listener->m_notifyMaybeCcaBusyStart = 0;
950 listener->m_ccaBusyStart =
Seconds(0);
951 listener->m_ccaBusyEnd =
Seconds(0);
961 NS_LOG_FUNCTION(
this << phy << txPowerDbm << payloadSize << phy->GetCurrentFrequencyRange()
962 << phy->GetChannelWidth() << phy->GetChannelNumber());
978 phy->SetTxPowerStart(txPowerDbm);
979 phy->SetTxPowerEnd(txPowerDbm);
989 const auto payloadBytes = packet->GetSize() - 30;
990 NS_LOG_FUNCTION(
this << index << payloadBytes << phy->GetCurrentFrequencyRange()
991 << phy->GetChannelWidth() << phy->GetChannelNumber());
1018 bool interferencesExpected)
1031 interferencesExpected);
1037 bool interferencesExpected)
1041 phy->GetAttribute(
"InterferenceHelper", ptr);
1044 const auto energyDuration = interferenceHelper->GetEnergyDuration(0, band);
1046 interferencesExpected,
1047 "Incorrect interferences detection");
1057 const std::vector<std::size_t>& expectedConnectedPhysPerChannel)
1059 NS_LOG_FUNCTION(
this << index << expectedNumRx << expectedNumRxSuccess << expectedRxBytes
1060 << expectedFrequencyRangeActiveRfInterface);
1061 const auto phy =
m_rxPhys.at(index);
1062 std::size_t numActiveInterfaces = 0;
1063 for (
const auto& [freqRange, interface] : phy->GetSpectrumPhyInterfaces())
1065 const auto expectedActive = (freqRange == expectedFrequencyRangeActiveRfInterface);
1066 const auto isActive = (
interface == phy->GetCurrentInterface());
1070 numActiveInterfaces++;
1078 expectedConnectedPhysPerChannel.at(i),
1079 "Incorrect number of PHYs attached to the spectrum channel");
1083 expectedNumRxSuccess,
1084 "Unexpected amount of successfully received packets");
1087 "Unexpected amount of unsuccessfully received packets");
1089 expectedNumRxSuccess,
1090 "Unexpected amount of RX payload start indication");
1095 bool expectedCcaBusyIndication,
1096 Time switchingDelay)
1098 const auto expectedCcaBusyStart =
1100 const auto expectedCcaBusyEnd = expectedCcaBusyIndication ?
m_lastTxEnd :
Seconds(0);
1101 NS_LOG_FUNCTION(
this << index << expectedCcaBusyIndication << expectedCcaBusyStart
1102 << expectedCcaBusyEnd);
1104 const auto ccaBusyIndication = (listener->m_notifyMaybeCcaBusyStart > 0);
1105 const auto ccaBusyStart = listener->m_ccaBusyStart;
1106 const auto ccaBusyEnd = listener->m_ccaBusyEnd;
1108 expectedCcaBusyIndication,
1109 "CCA busy indication check failed");
1127 for (std::size_t rxPhyIndex = 0; rxPhyIndex <
m_rxPhys.size(); ++rxPhyIndex)
1129 auto txPhy =
m_txPhys.at(rxPhyIndex);
1131 txPhy->GetPhyBand(),
1132 txPhy->GetChannelNumber(),
1133 txPhy->GetChannelWidth());
1167 struct SpectrumPhyInterfaceInfo
1172 std::string bandName;
1184 const std::vector<SpectrumPhyInterfaceInfo> interfaces{
1190 for (std::size_t i = 0; i < interfaces.size(); ++i)
1192 auto spectrumChannel = CreateObject<MultiModelSpectrumChannel>();
1193 [[maybe_unused]]
const auto [channel, frequency, channelWidth, type, band] =
1198 interfaces.at(i).band));
1200 std::ostringstream oss;
1201 oss <<
"{" << +interfaces.at(i).number <<
", 0, " << interfaces.at(i).bandName <<
", 0}";
1203 phyHelper.
AddChannel(spectrumChannel, interfaces.at(i).range);
1209 mac.SetType(
"ns3::ApWifiMac",
"BeaconGeneration",
BooleanValue(
false));
1210 phyHelper.
Set(
"TrackSignalsFromInactiveInterfaces",
BooleanValue(
false));
1211 auto apDevice = wifi.Install(phyHelper, mac, wifiApNode.Get(0));
1213 mac.SetType(
"ns3::StaWifiMac",
"ActiveProbing",
BooleanValue(
false));
1214 phyHelper.
Set(
"TrackSignalsFromInactiveInterfaces",
1216 auto staDevice = wifi.Install(phyHelper, mac, wifiStaNode.
Get(0));
1218 for (std::size_t i = 0; i < interfaces.size(); ++i)
1221 DynamicCast<SpectrumWifiPhy>(DynamicCast<WifiNetDevice>(apDevice.Get(0))->GetPhy(i));
1224 const auto index =
m_rxPhys.size();
1226 DynamicCast<SpectrumWifiPhy>(DynamicCast<WifiNetDevice>(staDevice.Get(0))->GetPhy(i));
1227 rxPhy->TraceConnectWithoutContext(
1231 rxPhy->SetReceiveOkCallback(
1233 rxPhy->SetReceiveErrorCallback(
1236 auto listener = std::make_shared<TestPhyListener>();
1237 rxPhy->RegisterListener(listener);
1270 const auto ccaEdThresholdDbm = -62.0;
1271 const auto txAfterChannelSwitchDelay =
1274 const auto checkResultsDelay =
1276 const auto flushResultsDelay =
1278 const auto txOngoingAfterTxStartedDelay =
1285 std::vector<std::size_t> expectedConnectedPhysPerChannel =
1289 std::vector<std::size_t>{2, 2, 2, 2};
1292 for (std::size_t i = 0; i < 4; ++i)
1302 for (std::size_t j = 0; j < 4; ++j)
1306 const auto& expectedFreqRange = txPhy->GetCurrentFrequencyRange();
1311 txPpduPhy->GetCurrentFrequencyRange(),
1312 txPpduPhy->GetBand(txPpduPhy->GetChannelWidth(), 0),
1320 (i == j) ? 1000 : 0,
1322 expectedConnectedPhysPerChannel);
1330 for (std::size_t i = 0; i < 4; ++i)
1340 const auto& expectedFreqRange = txPpduPhy->GetCurrentFrequencyRange();
1341 for (std::size_t j = 0; j < 4; ++j)
1345 for (std::size_t k = 0; k < expectedConnectedPhysPerChannel.size(); ++k)
1347 expectedConnectedPhysPerChannel.at(k) = (k == i) ? 5 : 1;
1355 txPpduPhy->GetPhyBand(),
1356 txPpduPhy->GetChannelNumber(),
1357 txPpduPhy->GetChannelWidth());
1362 txPpduPhy->GetCurrentFrequencyRange(),
1363 txPpduPhy->GetBand(txPpduPhy->GetChannelWidth(), 0),
1373 expectedConnectedPhysPerChannel);
1382 const auto secondSpectrumChannelIndex = 1;
1383 auto channel36TxPhy =
m_txPhys.at(secondSpectrumChannelIndex);
1384 const auto& expectedFreqRange = channel36TxPhy->GetCurrentFrequencyRange();
1385 for (std::size_t i = 0; i < 4; ++i)
1395 for (std::size_t j = 0; j < 4; ++j)
1399 for (std::size_t k = 0; k < expectedConnectedPhysPerChannel.size(); ++k)
1401 expectedConnectedPhysPerChannel.at(k) =
1402 (k == secondSpectrumChannelIndex) ? 5 : 1;
1416 (i == secondSpectrumChannelIndex) ? 1 : 0,
1417 (i == secondSpectrumChannelIndex) ? 1 : 0,
1418 (i == secondSpectrumChannelIndex) ? 1000 : 0,
1420 expectedConnectedPhysPerChannel);
1428 for (
const auto txPowerDbm : {-60.0 , -70.0 })
1430 for (std::size_t i = 0; i < 4; ++i)
1432 for (std::size_t j = 0; j < 4; ++j)
1435 const auto startChannel =
1440 txPpduPhy->GetPhyBand());
1441 for (uint16_t bw = txPpduPhy->GetChannelWidth(); bw >= 20; bw /= 2)
1443 [[maybe_unused]]
const auto [channel, frequency, channelWidth, type, band] =
1448 txPpduPhy->GetPhyBand(),
1464 for (std::size_t k = 0; k < 4; ++k)
1466 if ((i != j) && (k == i))
1470 const auto expectCcaBusyIndication =
1471 (k == i) ? (txPowerDbm >= ccaEdThresholdDbm)
1473 ? ((txPowerDbm >= ccaEdThresholdDbm) ? (j == k) :
false)
1476 delay + checkResultsDelay,
1480 expectCcaBusyIndication,
1481 txOngoingAfterTxStartedDelay);
1516 txPpduPhy->GetPhyBand(),
1517 txPpduPhy->GetChannelNumber(),
1518 txPpduPhy->GetChannelWidth());
1536 txPpduPhy->GetPhyBand(),
1537 txPpduPhy->GetChannelNumber(),
1538 txPpduPhy->GetChannelWidth());
1558 txPpduPhy->GetCurrentFrequencyRange(),
1559 expectedConnectedPhysPerChannel);
1588 void DoRun()
override;
1592 :
TestCase(
"Check PHY interfaces added to PHY instances using helper")
1603 phyHelper.
Set(0,
"ChannelSettings",
StringValue(
"{2, 0, BAND_2_4GHZ, 0}"));
1604 phyHelper.
Set(1,
"ChannelSettings",
StringValue(
"{36, 0, BAND_5GHZ, 0}"));
1605 phyHelper.
Set(2,
"ChannelSettings",
StringValue(
"{1, 0, BAND_6GHZ, 0}"));
1619 DynamicCast<SpectrumWifiPhy>(DynamicCast<WifiNetDevice>(device.Get(0))->GetPhy(0));
1623 "Incorrect number of PHY interfaces added to PHY link ID 0");
1626 DynamicCast<SpectrumWifiPhy>(DynamicCast<WifiNetDevice>(device.Get(0))->GetPhy(1));
1630 "Incorrect number of PHY interfaces added to PHY link ID 1");
1633 DynamicCast<SpectrumWifiPhy>(DynamicCast<WifiNetDevice>(device.Get(0))->GetPhy(2));
1637 "Incorrect number of PHY interfaces added to PHY link ID 2");
1646 phyLink0 = DynamicCast<SpectrumWifiPhy>(DynamicCast<WifiNetDevice>(device.Get(0))->GetPhy(0));
1650 "Incorrect number of PHY interfaces added to PHY link ID 0");
1653 "Incorrect PHY interfaces added to PHY link ID 0");
1655 phyLink1 = DynamicCast<SpectrumWifiPhy>(DynamicCast<WifiNetDevice>(device.Get(0))->GetPhy(1));
1659 "Incorrect number of PHY interfaces added to PHY link ID 1");
1662 "Incorrect PHY interfaces added to PHY link ID 1");
1664 phyLink2 = DynamicCast<SpectrumWifiPhy>(DynamicCast<WifiNetDevice>(device.Get(0))->GetPhy(2));
1668 "Incorrect number of PHY interfaces added to PHY link ID 2");
1671 "Incorrect PHY interfaces added to PHY link ID 2");
1678 phyLink0 = DynamicCast<SpectrumWifiPhy>(DynamicCast<WifiNetDevice>(device.Get(0))->GetPhy(0));
1682 "Incorrect number of PHY interfaces added to PHY link ID 0");
1685 "Incorrect PHY interfaces added to PHY link ID 0");
1688 "Incorrect PHY interfaces added to PHY link ID 0");
1690 phyLink1 = DynamicCast<SpectrumWifiPhy>(DynamicCast<WifiNetDevice>(device.Get(0))->GetPhy(1));
1694 "Incorrect number of PHY interfaces added to PHY link ID 1");
1697 "Incorrect PHY interfaces added to PHY link ID 1");
1699 phyLink2 = DynamicCast<SpectrumWifiPhy>(DynamicCast<WifiNetDevice>(device.Get(0))->GetPhy(2));
1703 "Incorrect number of PHY interfaces added to PHY link ID 2");
1706 "Incorrect PHY interfaces added to PHY link ID 2");
1713 phyLink0 = DynamicCast<SpectrumWifiPhy>(DynamicCast<WifiNetDevice>(device.Get(0))->GetPhy(0));
1717 "Incorrect number of PHY interfaces added to PHY link ID 0");
1720 "Incorrect PHY interfaces added to PHY link ID 0");
1723 "Incorrect PHY interfaces added to PHY link ID 0");
1726 "Incorrect PHY interfaces added to PHY link ID 0");
1728 phyLink1 = DynamicCast<SpectrumWifiPhy>(DynamicCast<WifiNetDevice>(device.Get(0))->GetPhy(1));
1732 "Incorrect number of PHY interfaces added to PHY link ID 1");
1735 "Incorrect PHY interfaces added to PHY link ID 0");
1738 "Incorrect PHY interfaces added to PHY link ID 0");
1741 "Incorrect PHY interfaces added to PHY link ID 0");
1743 phyLink2 = DynamicCast<SpectrumWifiPhy>(DynamicCast<WifiNetDevice>(device.Get(0))->GetPhy(2));
1747 "Incorrect number of PHY interfaces added to PHY link ID 2");
1750 "Incorrect PHY interfaces added to PHY link ID 0");
1753 "Incorrect PHY interfaces added to PHY link ID 0");
1756 "Incorrect PHY interfaces added to PHY link ID 0");
Extended SpectrumWifiPhy class for the purpose of the tests.
Spectrum Wifi Phy Basic Test.
void SpectrumWifiPhyRxSuccess(Ptr< const WifiPsdu > psdu, RxSignalInfo rxSignalInfo, WifiTxVector txVector, std::vector< bool > statusPerMpdu)
Spectrum wifi receive success function.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
void DoRun() override
Implementation to actually run this TestCase.
~SpectrumWifiPhyBasicTest() override
SpectrumWifiPhyBasicTest()
Ptr< SpectrumSignalParameters > MakeSignal(double txPowerWatts, const WifiPhyOperatingChannel &channel)
Make signal function.
void SpectrumWifiPhyRxFailure(Ptr< const WifiPsdu > psdu)
Spectrum wifi receive failure function.
void SendSignal(double txPowerWatts)
Send signal function.
void DoTeardown() override
Implementation to do any local setup required for this TestCase.
uint64_t m_uid
the UID to use for the PPDU
Ptr< SpectrumWifiPhy > m_phy
Phy.
Spectrum Wifi Phy Filter Test.
void RxCallback(Ptr< const Packet > p, RxPowerWattPerChannelBand rxPowersW)
Callback triggered when a packet is received by the PHYs.
uint16_t m_txChannelWidth
TX channel width (MHz)
~SpectrumWifiPhyFilterTest() override
SpectrumWifiPhyFilterTest()
void DoRun() override
Implementation to actually run this TestCase.
void RunOne()
Run one function.
void SendPpdu()
Send PPDU function.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
void DoTeardown() override
Implementation to do any local setup required for this TestCase.
std::set< WifiSpectrumBandIndices > m_ruBands
spectrum bands associated to all the RUs
Ptr< ExtSpectrumWifiPhy > m_rxPhy
RX PHY.
uint16_t m_rxChannelWidth
RX channel width (MHz)
Ptr< ExtSpectrumWifiPhy > m_txPhy
TX PHY.
Spectrum Wifi Phy Interfaces Helper Test.
~SpectrumWifiPhyInterfacesHelperTest() override=default
SpectrumWifiPhyInterfacesHelperTest()
void DoRun() override
Implementation to actually run this TestCase.
Spectrum Wifi Phy Listener Test.
void DoRun() override
Implementation to actually run this TestCase.
~SpectrumWifiPhyListenerTest() override
void DoSetup() override
Implementation to do any local setup required for this TestCase.
SpectrumWifiPhyListenerTest()
std::shared_ptr< TestPhyListener > m_listener
listener
Spectrum Wifi Phy Multiple Spectrum Test.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
void CheckCcaIndication(std::size_t index, bool expectedCcaBusyIndication, Time switchingDelay)
Verify CCA indication reported by a given PHY.
std::vector< uint32_t > m_rxBytes
count number of received bytes
std::vector< Ptr< SpectrumWifiPhy > > m_rxPhys
RX PHYs.
std::vector< uint32_t > m_countRxSuccess
count number of packets successfully received by PHYs
void DoTeardown() override
Implementation to do any local setup required for this TestCase.
void DoRun() override
Implementation to actually run this TestCase.
void DoCheckInterferences(Ptr< SpectrumWifiPhy > phy, const WifiSpectrumBandInfo &band, bool interferencesExpected)
Check the interferences.
SpectrumWifiPhyMultipleInterfacesTest(bool trackSignalsInactiveInterfaces)
Constructor.
bool m_trackSignalsInactiveInterfaces
flag to indicate whether signals coming from inactive spectrum PHY interfaces are tracked during the ...
void RxSuccess(std::size_t index, Ptr< const WifiPsdu > psdu, RxSignalInfo rxSignalInfo, WifiTxVector txVector, std::vector< bool > statusPerMpdu)
Receive success function.
std::vector< std::shared_ptr< TestPhyListener > > m_listeners
listeners
Time m_lastTxEnd
hold the time at which the last transmission ended
void RxFailure(std::size_t index, Ptr< const WifiPsdu > psdu)
Receive failure function.
Time m_lastTxStart
hold the time at which the last transmission started
std::vector< uint32_t > m_counts
count number of packets received by PHYs
void SendPpdu(Ptr< SpectrumWifiPhy > phy, double txPowerDbm, uint32_t payloadSize)
Send PPDU function.
void SwitchChannel(std::size_t index, WifiPhyBand band, uint8_t channelNumber, uint16_t channelWidth)
Switch channel function.
void CheckResults(std::size_t index, uint32_t expectedNumRx, uint32_t expectedNumRxSuccess, uint32_t expectedRxBytes, FrequencyRange expectedFrequencyRangeActiveRfInterface, const std::vector< std::size_t > &expectedConnectedPhysPerChannel)
Verify results.
std::vector< Ptr< SpectrumWifiPhy > > m_txPhys
TX PHYs.
std::vector< Ptr< MultiModelSpectrumChannel > > m_spectrumChannels
Spectrum channels.
void CheckInterferences(Ptr< SpectrumWifiPhy > phy, const FrequencyRange &freqRange, const WifiSpectrumBandInfo &band, bool interferencesExpected)
Schedule now to check the interferences.
void RxCallback(std::size_t index, Ptr< const Packet > packet, RxPowerWattPerChannelBand rxPowersW)
Callback triggered when a packet is received by a PHY.
void Reset()
Reset function.
std::vector< uint32_t > m_countRxFailure
count number of packets unsuccessfully received by PHYs
Spectrum Wifi Phy Test Suite.
SpectrumWifiPhyTestSuite()
Time m_ccaBusyEnd
CCA_BUSY end time.
void Reset()
Reset function.
void NotifyWakeup() override
Notify listeners that we woke up.
Time m_ccaBusyStart
CCA_BUSY start time.
void NotifyRxEndOk() override
We have received the last bit of a packet for which NotifyRxStart was invoked first and,...
void NotifyOff() override
Notify listeners that we went to switch off.
TestPhyListener()=default
Create a test PhyListener.
void NotifySleep() override
Notify listeners that we went to sleep.
void NotifySwitchingStart(Time duration) override
uint32_t m_notifyMaybeCcaBusyStart
notify maybe CCA busy start
uint32_t m_notifyRxStart
notify receive start
void NotifyTxStart(Time duration, double txPowerDbm) override
void NotifyCcaBusyStart(Time duration, WifiChannelListType channelType, const std::vector< Time > &) override
void NotifyRxStart(Time duration) override
void NotifyOn() override
Notify listeners that we went to switch on.
uint32_t m_notifyRxEndOk
notify receive end OK
void NotifyRxEndError() override
We have received the last bit of a packet for which NotifyRxStart was invoked first and,...
uint32_t m_notifyRxEndError
notify receive end error
~TestPhyListener() override=default
AttributeValue implementation for Boolean.
static WifiMode GetHeMcs11()
Return MCS 11 from HE MCS values.
static WifiMode GetHeMcs0()
Return MCS 0 from HE MCS values.
static WifiSpectrumBandIndices ConvertHeRuSubcarriers(uint16_t bandWidth, uint16_t guardBandwidth, uint32_t subcarrierSpacing, HeRu::SubcarrierRange subcarrierRange, uint8_t bandIndex=0)
static SubcarrierGroup GetSubcarrierGroup(uint16_t bw, RuType ruType, std::size_t phyIndex)
Get the subcarrier group of the RU having the given PHY index among all the RUs of the given type (nu...
static std::size_t GetNRus(uint16_t bw, RuType ruType)
Get the number of distinct RUs of the given type (number of tones) available in a HE PPDU of the give...
std::vector< SubcarrierRange > SubcarrierGroup
a vector of subcarrier ranges defining a subcarrier group
std::pair< int16_t, int16_t > SubcarrierRange
(lowest index, highest index) pair defining a subcarrier range
RuType
The different HE Resource Unit (RU) types.
handles interference calculations
keep track of a set of node pointers.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
void Dispose()
Dispose of this Object.
static WifiMode GetOfdmRate6Mbps()
Return a WifiMode for OFDM at 6 Mbps.
AttributeValue implementation for Pointer.
Smart pointer class similar to boost::intrusive_ptr.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static Time Now()
Return the current simulation virtual time.
static void Run()
Run the simulation.
static EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Make it easy to create and manage PHY objects for the spectrum model.
void ResetPhyToFreqRangeMapping()
Reset mapping of the spectrum PHY interfaces added to the PHY instances.
void AddChannel(const Ptr< SpectrumChannel > channel, const FrequencyRange &freqRange=WHOLE_WIFI_SPECTRUM)
void AddPhyToFreqRangeMapping(uint8_t linkId, const FrequencyRange &freqRange)
Add a given spectrum PHY interface to the PHY instance corresponding of a given link.
void SetDevice(const Ptr< WifiNetDevice > device) override
Sets the device this PHY is associated with.
void StartRx(Ptr< SpectrumSignalParameters > rxParams, Ptr< const WifiSpectrumPhyInterface > interface)
Input method for delivering a signal from the spectrum channel and low-level PHY interface to this Sp...
void AddChannel(const Ptr< SpectrumChannel > channel, const FrequencyRange &freqRange=WHOLE_WIFI_SPECTRUM)
Attach a SpectrumChannel to use for a given frequency range.
uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const override
WifiSpectrumBandInfo GetBand(uint16_t bandWidth, uint8_t bandIndex=0) override
Get the info of a given band.
Hold variables of type string.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Simulation virtual time values and global simulation resolution.
bool IsStrictlyPositive() const
Exactly equivalent to t > 0.
helps to create WifiNetDevice objects
virtual void SetStandard(WifiStandard standard)
virtual NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &mac, NodeContainer::Iterator first, NodeContainer::Iterator last) const
create MAC layers for a ns3::WifiNetDevice.
void SetPcapDataLinkType(SupportedPcapDataLinkTypes dlt)
Set the data link type of PCAP traces to be used.
void Set(std::string name, const AttributeValue &v)
@ DLT_IEEE802_11_RADIO
Include Radiotap link layer information.
virtual void SetInterferenceHelper(const Ptr< InterferenceHelper > helper)
Sets the interference helper.
void Send(Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector)
This function is a wrapper for the Send variant that accepts a WifiConstPsduMap as first argument.
void SetErrorRateModel(const Ptr< ErrorRateModel > model)
Sets the error rate model.
uint32_t GetSubcarrierSpacing() const
void SetReceiveErrorCallback(RxErrorCallback callback)
virtual void ConfigureStandard(WifiStandard standard)
Configure the PHY-level parameters for different Wi-Fi standard.
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
void RegisterListener(const std::shared_ptr< WifiPhyListener > &listener)
void SetOperatingChannel(const ChannelTuple &channelTuple)
If the standard for this object has not been set yet, store the given channel settings.
WifiPhyBand GetPhyBand() const
Get the configured Wi-Fi band.
std::tuple< uint8_t, uint16_t, WifiPhyBand, uint8_t > ChannelTuple
Tuple identifying an operating channel.
virtual WifiSpectrumBandInfo GetBand(uint16_t bandWidth, uint8_t bandIndex=0)=0
Get the info of a given band.
void SetMobility(const Ptr< MobilityModel > mobility)
assign a mobility model to this device
void SetReceiveOkCallback(RxOkCallback callback)
const WifiPhyOperatingChannel & GetOperatingChannel() const
Get a const reference to the operating channel.
receive notifications about PHY events.
Class that keeps track of all information about the current PHY operating channel.
static ConstIterator FindFirst(uint8_t number, uint16_t frequency, uint16_t width, WifiStandard standard, WifiPhyBand band, ConstIterator start=m_frequencyChannels.begin())
Find the first channel matching the specified parameters.
static Ptr< SpectrumValue > CreateOfdmTxPowerSpectralDensity(uint32_t centerFrequency, uint16_t channelWidth, double txPowerW, uint16_t guardBandwidth, double minInnerBandDbr=-20, double minOuterbandDbr=-28, double lowestPointDbr=-40)
Create a transmit power spectral density corresponding to OFDM (802.11a/g).
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#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.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time Seconds(double value)
Construct a Time in the indicated unit.
WifiPhyBand
Identifies the PHY band.
WifiChannelListType
Enumeration of the possible channel-list parameter elements defined in Table 8-5 of IEEE 802....
@ WIFI_PHY_BAND_6GHZ
The 6 GHz band.
@ WIFI_PHY_BAND_2_4GHZ
The 2.4 GHz band.
@ WIFI_PHY_BAND_5GHZ
The 5 GHz band.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
constexpr FrequencyRange WIFI_SPECTRUM_6_GHZ
Identifier for the frequency range covering the wifi spectrum in the 6 GHz band.
double RatioToDb(double ratio)
Convert from ratio to dB.
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
double WToDbm(double w)
Convert from Watts to dBm.
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...
constexpr FrequencyRange WIFI_SPECTRUM_5_GHZ
Identifier for the frequency range covering the wifi spectrum in the 5 GHz band.
std::map< WifiSpectrumBandInfo, double > RxPowerWattPerChannelBand
A map of the received power (Watts) for each band.
static constexpr uint16_t SU_STA_ID
STA_ID to identify a single user (SU)
constexpr FrequencyRange WIFI_SPECTRUM_2_4_GHZ
Identifier for the frequency range covering the wifi spectrum in the 2.4 GHz band.
static const uint8_t CHANNEL_NUMBER
static SpectrumWifiPhyTestSuite spectrumWifiPhyTestSuite
the test suite
static const uint16_t GUARD_WIDTH
static const uint16_t CHANNEL_WIDTH
Struct defining a frequency range between minFrequency (MHz) and maxFrequency (MHz).
uint16_t maxFrequency
the maximum frequency in MHz
uint16_t minFrequency
the minimum frequency in MHz
RxSignalInfo structure containing info on the received signal.
WifiSpectrumBandInfo structure containing info about a spectrum band.