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"
30#include "ns3/wifi-mac-header.h"
31#include "ns3/wifi-net-device.h"
32#include "ns3/wifi-phy-listener.h"
33#include "ns3/wifi-psdu.h"
34#include "ns3/wifi-spectrum-phy-interface.h"
35#include "ns3/wifi-spectrum-signal-parameters.h"
36#include "ns3/wifi-spectrum-value-helper.h"
37#include "ns3/wifi-utils.h"
92 uint16_t channelWidth)
95 auto numBandsInChannel =
static_cast<size_t>(channelWidth * 1e6 / subcarrierSpacing);
96 auto numBandsInBand =
static_cast<size_t>(bandWidth * 1e6 / subcarrierSpacing);
98 size_t totalNumBands = rxSpectrumModel->GetNumBands();
99 auto startIndex = ((totalNumBands - numBandsInChannel) / 2) + (bandIndex * numBandsInBand);
100 auto stopIndex = startIndex + numBandsInBand - 1;
101 auto startGuardBand = rxSpectrumModel->Begin();
102 auto startChannel = startGuardBand + startIndex;
103 auto endChannel = startGuardBand + stopIndex + 1;
104 auto lowFreq =
static_cast<uint64_t
>(startChannel->fc);
105 auto highFreq =
static_cast<uint64_t
>(endChannel->fc);
106 return {{startIndex, stopIndex}, {lowFreq, highFreq}};
155 std::vector<bool> statusPerMpdu);
164 void DoRun()
override;
212 txParams->psd = txPowerSpectrum;
213 txParams->txPhy =
nullptr;
214 txParams->duration = txDuration;
215 txParams->ppdu = ppdu;
232 std::vector<bool> statusPerMpdu)
257 m_phy = CreateObject<SpectrumWifiPhy>();
271 node->AddDevice(dev);
285 double txPowerWatts = 0.010;
346 const std::vector<Time>& )
override
416 void DoRun()
override;
440 double txPowerWatts = 0.010;
448 "Didn't receive NotifyCcaBusyStart (once preamble is detected + prolonged by L-SIG "
449 "reception, then switched to Rx by at the beginning of data)");
478 void DoRun()
override;
507 :
TestCase(
"SpectrumWifiPhy test RX filters"),
508 m_txChannelWidth(20),
550 for (
const auto& pair : rxPowersW)
552 NS_LOG_INFO(
"band: (" << pair.first <<
") -> powerW=" << pair.second <<
" ("
553 <<
WToDbm(pair.second) <<
" dBm)");
556 size_t numBands = rxPowersW.size();
565 "Total number of bands handled by the receiver is incorrect");
569 auto it = rxPowersW.find(band);
570 NS_LOG_INFO(
"powerW total band: " << it->second <<
" (" <<
WToDbm(it->second) <<
" dBm)");
571 int totalRxPower =
static_cast<int>(
WToDbm(it->second) + 0.5);
572 int expectedTotalRxPower;
577 expectedTotalRxPower = 16;
582 expectedTotalRxPower =
586 expectedTotalRxPower,
587 "Total received power is not correct");
592 it = rxPowersW.find(band);
593 NS_LOG_INFO(
"powerW in primary 20 MHz channel: " << it->second <<
" (" <<
WToDbm(it->second)
595 int rxPowerPrimaryChannel20 =
static_cast<int>(
WToDbm(it->second) + 0.5);
596 int expectedRxPowerPrimaryChannel20 = 16 -
static_cast<int>(
RatioToDb(channelWidth / 20));
598 expectedRxPowerPrimaryChannel20,
599 "Received power in the primary 20 MHz band is not correct");
611 lossModel->SetFrequency(5.180e9);
612 spectrumChannel->AddPropagationLossModel(lossModel);
614 CreateObject<ConstantSpeedPropagationDelayModel>();
615 spectrumChannel->SetPropagationDelayModel(delayModel);
619 m_txPhy = CreateObject<ExtSpectrumWifiPhy>();
630 txNode->AggregateObject(apMobility);
631 txNode->AddDevice(txDev);
635 m_rxPhy = CreateObject<ExtSpectrumWifiPhy>();
645 rxNode->AggregateObject(sta1Mobility);
646 rxNode->AddDevice(rxDev);
663 uint16_t txFrequency;
688 uint16_t rxFrequency;
714 for (uint16_t bw = 160; bw >= 20; bw = bw / 2)
718 for (
unsigned int type = 0; type < 7; type++)
721 for (std::size_t index = 1; index <=
HeRu::GetNRus(bw, ruType); index++)
726 std::make_pair(subcarrierGroup.front().first,
727 subcarrierGroup.back().second);
851 void DoRun()
override;
863 uint8_t channelNumber,
864 uint16_t channelWidth);
894 uint16_t channelWidth,
895 bool interferencesExpected);
906 uint16_t channelWidth,
907 bool interferencesExpected);
922 const std::vector<std::size_t>& expectedConnectedPhysPerChannel);
958 bool trackSignalsInactiveInterfaces)
959 :
TestCase{
"SpectrumWifiPhy test operation with multiple RF interfaces"},
960 m_trackSignalsInactiveInterfaces{trackSignalsInactiveInterfaces}
967 uint8_t channelNumber,
968 uint16_t channelWidth)
970 NS_LOG_FUNCTION(
this << index << band << +channelNumber << channelWidth);
972 listener->m_notifyMaybeCcaBusyStart = 0;
973 listener->m_ccaBusyStart =
Seconds(0);
974 listener->m_ccaBusyEnd =
Seconds(0);
982 NS_LOG_FUNCTION(
this << phy << txPowerDbm << phy->GetCurrentFrequencyRange()
983 << phy->GetChannelWidth() << phy->GetChannelNumber());
999 phy->SetTxPowerStart(txPowerDbm);
1000 phy->SetTxPowerEnd(txPowerDbm);
1010 NS_LOG_FUNCTION(
this << index << phy->GetCurrentFrequencyRange() << phy->GetChannelWidth()
1011 << phy->GetChannelNumber());
1018 uint16_t channelWidth,
1019 bool interferencesExpected)
1033 interferencesExpected);
1039 uint16_t channelWidth,
1040 bool interferencesExpected)
1044 phy->GetAttribute(
"InterferenceHelper", ptr);
1047 const auto band = phy->GetBandForInterface(channelWidth, 0, freqRange, channelWidth);
1048 const auto energyDuration = interferenceHelper->GetEnergyDuration(0, band);
1050 interferencesExpected,
1051 "Incorrect interferences detection");
1059 const std::vector<std::size_t>& expectedConnectedPhysPerChannel)
1061 NS_LOG_FUNCTION(
this << index << expectedNumRx << expectedFrequencyRangeActiveRfInterface);
1062 const auto phy =
m_rxPhys.at(index);
1063 std::size_t numActiveInterfaces = 0;
1064 for (
const auto& [freqRange, interface] : phy->GetSpectrumPhyInterfaces())
1066 const auto expectedActive = (freqRange == expectedFrequencyRangeActiveRfInterface);
1067 const auto isActive = (
interface == phy->GetCurrentSpectrumPhyInterface());
1071 numActiveInterfaces++;
1080 expectedConnectedPhysPerChannel.at(i),
1081 "Incorrect number of PHYs attached to the spectrum channel");
1085 "Didn't receive right number of packets");
1088 "Didn't receive NotifyRxStart");
1093 bool expectedCcaBusyIndication,
1094 Time switchingDelay)
1096 const auto expectedCcaBusyStart =
1098 const auto expectedCcaBusyEnd = expectedCcaBusyIndication ?
m_lastTxEnd :
Seconds(0);
1099 NS_LOG_FUNCTION(
this << index << expectedCcaBusyIndication << expectedCcaBusyStart
1100 << expectedCcaBusyEnd);
1102 const auto ccaBusyIndication = (listener->m_notifyMaybeCcaBusyStart > 0);
1103 const auto ccaBusyStart = listener->m_ccaBusyStart;
1104 const auto ccaBusyEnd = listener->m_ccaBusyEnd;
1106 expectedCcaBusyIndication,
1107 "CCA busy indication check failed");
1125 for (std::size_t rxPhyIndex = 0; rxPhyIndex <
m_rxPhys.size(); ++rxPhyIndex)
1127 auto txPhy =
m_txPhys.at(rxPhyIndex);
1129 txPhy->GetPhyBand(),
1130 txPhy->GetChannelNumber(),
1131 txPhy->GetChannelWidth());
1149 for (std::size_t i = 0; i < channels.size(); ++i)
1151 auto spectrumChannel = CreateObject<MultiModelSpectrumChannel>();
1152 [[maybe_unused]]
const auto [channel, frequency, channelWidth, type, band] =
1157 channels.at(i).first));
1163 for (std::size_t i = 0; i < channels.size(); ++i)
1165 auto txNode = CreateObject<Node>();
1166 auto txDev = CreateObject<WifiNetDevice>();
1167 auto txPhy = CreateObject<ExtSpectrumWifiPhy>();
1169 txPhy->SetAttribute(
"TrackSignalsFromInactiveInterfaces",
1171 auto txInterferenceHelper = CreateObject<InterferenceHelper>();
1172 txPhy->SetInterferenceHelper(txInterferenceHelper);
1173 auto txError = CreateObject<NistErrorRateModel>();
1174 txPhy->SetErrorRateModel(txError);
1175 txPhy->SetDevice(txDev);
1178 const uint16_t minFreq = freq - width / 2;
1179 const uint16_t maxFreq = freq + width / 2;
1180 txPhy->AddChannel(spectrumChannel, {minFreq, maxFreq});
1182 txPhy->SetOperatingChannel(
1185 txDev->SetPhy(txPhy);
1186 txNode->AddDevice(txDev);
1190 auto rxNode = CreateObject<Node>();
1191 auto rxDev = CreateObject<WifiNetDevice>();
1192 auto rxPhy = CreateObject<ExtSpectrumWifiPhy>();
1194 rxPhy->SetAttribute(
"TrackSignalsFromInactiveInterfaces",
1196 auto rxInterferenceHelper = CreateObject<InterferenceHelper>();
1197 rxPhy->SetInterferenceHelper(rxInterferenceHelper);
1198 auto rxError = CreateObject<NistErrorRateModel>();
1199 rxPhy->SetErrorRateModel(rxError);
1200 rxPhy->SetDevice(rxDev);
1203 const uint16_t minFreq = freq - width / 2;
1204 const uint16_t maxFreq = freq + width / 2;
1205 rxPhy->AddChannel(spectrumChannel, {minFreq, maxFreq});
1207 rxPhy->SetOperatingChannel(
1210 rxDev->SetPhy(rxPhy);
1211 rxNode->AddDevice(rxDev);
1213 const auto index =
m_rxPhys.size();
1214 rxPhy->TraceConnectWithoutContext(
1218 auto listener = std::make_unique<TestPhyListener>();
1219 rxPhy->RegisterListener(listener.get());
1249 const auto ccaEdThresholdDbm = -62.0;
1250 const auto txAfterChannelSwitchDelay =
1253 const auto checkResultsDelay =
1255 const auto flushResultsDelay =
1257 const auto txOngoingAfterTxStartedDelay =
1263 for (std::size_t rxPhyIndex = 0; rxPhyIndex <
m_rxPhys.size(); ++rxPhyIndex)
1265 for (std::size_t txPhyIndex = 0; txPhyIndex <
m_txPhys.size(); ++txPhyIndex)
1267 if (txPhyIndex == rxPhyIndex)
1272 auto txPhy =
m_txPhys.at(txPhyIndex);
1277 txPhy->GetPhyBand(),
1278 txPhy->GetChannelNumber(),
1279 txPhy->GetChannelWidth());
1287 std::vector<std::size_t> expectedConnectedPhysPerChannel =
1291 std::vector<std::size_t>{2, 2, 2, 2};
1293 for (std::size_t i = 0; i < 4; ++i)
1302 for (std::size_t j = 0; j < 4; ++j)
1306 const uint16_t minExpectedFreq = txPhy->GetFrequency() - (txPhy->GetChannelWidth() / 2);
1307 const uint16_t maxExpectedFreq = txPhy->GetFrequency() + (txPhy->GetChannelWidth() / 2);
1308 const FrequencyRange expectedFreqRange = {minExpectedFreq, maxExpectedFreq};
1313 txPpduPhy->GetCurrentFrequencyRange(),
1314 txPpduPhy->GetChannelWidth(),
1322 expectedConnectedPhysPerChannel);
1330 for (std::size_t i = 0; i < 4; ++i)
1339 const uint16_t minExpectedFreq =
1340 txPpduPhy->GetFrequency() - (txPpduPhy->GetChannelWidth() / 2);
1341 const uint16_t maxExpectedFreq =
1342 txPpduPhy->GetFrequency() + (txPpduPhy->GetChannelWidth() / 2);
1343 const FrequencyRange expectedFreqRange = {minExpectedFreq, maxExpectedFreq};
1344 for (std::size_t j = 0; j < 4; ++j)
1348 for (std::size_t k = 0; k < expectedConnectedPhysPerChannel.size(); ++k)
1350 expectedConnectedPhysPerChannel.at(k) = (k == i) ? 5 : 1;
1358 txPpduPhy->GetPhyBand(),
1359 txPpduPhy->GetChannelNumber(),
1360 txPpduPhy->GetChannelWidth());
1365 txPpduPhy->GetCurrentFrequencyRange(),
1366 txPpduPhy->GetChannelWidth(),
1374 expectedConnectedPhysPerChannel);
1383 const auto secondSpectrumChannelIndex = 1;
1384 auto channel36TxPhy =
m_txPhys.at(secondSpectrumChannelIndex);
1385 const uint16_t minExpectedFreq =
1386 channel36TxPhy->GetFrequency() - (channel36TxPhy->GetChannelWidth() / 2);
1387 const uint16_t maxExpectedFreq =
1388 channel36TxPhy->GetFrequency() + (channel36TxPhy->GetChannelWidth() / 2);
1389 FrequencyRange expectedFreqRange = {minExpectedFreq, maxExpectedFreq};
1390 for (std::size_t i = 0; i < 4; ++i)
1399 for (std::size_t j = 0; j < 4; ++j)
1403 for (std::size_t k = 0; k < expectedConnectedPhysPerChannel.size(); ++k)
1405 expectedConnectedPhysPerChannel.at(k) =
1406 (k == secondSpectrumChannelIndex) ? 5 : 1;
1420 (i == secondSpectrumChannelIndex) ? 1 : 0,
1422 expectedConnectedPhysPerChannel);
1430 for (
const auto txPowerDbm : {-60.0 , -70.0 })
1432 for (std::size_t i = 0; i < 4; ++i)
1434 for (std::size_t j = 0; j < 4; ++j)
1437 const auto startChannel =
1442 txPpduPhy->GetPhyBand());
1443 for (uint16_t bw = txPpduPhy->GetChannelWidth(); bw >= 20; bw /= 2)
1445 [[maybe_unused]]
const auto [channel, frequency, channelWidth, type, band] =
1450 txPpduPhy->GetPhyBand(),
1465 for (std::size_t k = 0; k < 4; ++k)
1470 if ((i != j) && (k == i))
1474 const auto expectCcaBusyIndication =
1475 (k == i) ? (txPowerDbm >= ccaEdThresholdDbm)
1477 ? ((txPowerDbm >= ccaEdThresholdDbm) ? (j == k) :
false)
1480 delay + checkResultsDelay,
1484 expectCcaBusyIndication,
1485 txOngoingAfterTxStartedDelay);
1508 :
TestSuite(
"wifi-spectrum-wifi-phy", UNIT)
Extended SpectrumWifiPhy class for the purpose of the tests.
Ptr< WifiSpectrumPhyInterface > GetCurrentSpectrumPhyInterface() const
WifiSpectrumBandInfo GetBandForInterface(uint16_t bandWidth, uint8_t bandIndex, const FrequencyRange &freqRange, uint16_t channelWidth)
Get the info of a given band for a given spectrum PHY interface.
const std::map< FrequencyRange, Ptr< WifiSpectrumPhyInterface > > & GetSpectrumPhyInterfaces() const
Get the spectrum PHY interfaces.
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 Listener Test.
TestPhyListener * m_listener
listener
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()
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< Ptr< ExtSpectrumWifiPhy > > m_txPhys
TX PHYs.
void DoTeardown() override
Implementation to do any local setup required for this TestCase.
std::vector< SpectrumChannelInfos > m_spectrumChannelInfos
Spectrum channels infos.
void DoRun() override
Implementation to actually run this TestCase.
void DoCheckInterferences(Ptr< ExtSpectrumWifiPhy > phy, const FrequencyRange &freqRange, uint16_t channelWidth, bool interferencesExpected)
Check the interferences.
SpectrumWifiPhyMultipleInterfacesTest(bool trackSignalsInactiveInterfaces)
Constructor.
std::vector< Ptr< ExtSpectrumWifiPhy > > m_rxPhys
RX PHYs.
std::tuple< Ptr< MultiModelSpectrumChannel >, uint16_t, uint16_t > SpectrumChannelInfos
typedef for spectrum channel infos
bool m_trackSignalsInactiveInterfaces
flag to indicate whether signals coming from inactive spectrum PHY interfaces are tracked during the ...
Time m_lastTxEnd
hold the time at which the last transmission ended
void CheckResults(std::size_t index, uint32_t expectedNumRx, FrequencyRange expectedFrequencyRangeActiveRfInterface, const std::vector< std::size_t > &expectedConnectedPhysPerChannel)
Verify results.
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 SwitchChannel(std::size_t index, WifiPhyBand band, uint8_t channelNumber, uint16_t channelWidth)
Switch channel function.
void SendPpdu(Ptr< SpectrumWifiPhy > phy, double txPowerDbm)
Send PPDU function.
void CheckInterferences(Ptr< ExtSpectrumWifiPhy > phy, const FrequencyRange &freqRange, uint16_t channelWidth, 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< std::unique_ptr< TestPhyListener > > m_listeners
listeners
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 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
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.
Hold objects of type Ptr<T>.
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.
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...
std::map< FrequencyRange, Ptr< WifiSpectrumPhyInterface > > m_spectrumPhyInterfaces
Spectrum PHY interfaces.
void AddChannel(const Ptr< SpectrumChannel > channel, const FrequencyRange &freqRange=WHOLE_WIFI_SPECTRUM)
Attach a SpectrumChannel to use for a given frequency range.
Ptr< WifiSpectrumPhyInterface > m_currentSpectrumPhyInterface
The current Spectrum PHY interface (held for performance reasons)
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.
void AddTestCase(TestCase *testCase, TestDuration 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.
AttributeValue implementation for Time.
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 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.
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 RegisterListener(WifiPhyListener *listener)
void SetReceiveOkCallback(RxOkCallback callback)
std::tuple< uint8_t, uint16_t, int, uint8_t > ChannelTuple
Tuple identifying an operating channel.
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.
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...
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)
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).
RxSignalInfo structure containing info on the received signal.
WifiSpectrumBandInfo structure containing info about a spectrum band.