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"
82 void DoSetup()
override;
83 void DoTeardown()
override;
97 void SendSignal(
double txPowerWatts);
108 std::vector<bool> statusPerMpdu);
117 void DoRun()
override;
159 Ptr<SpectrumValue> txPowerSpectrum = WifiSpectrumValueHelper::CreateOfdmTxPowerSpectralDensity(
165 txParams->psd = txPowerSpectrum;
166 txParams->txPhy =
nullptr;
167 txParams->duration = txDuration;
168 txParams->ppdu = ppdu;
184 std::vector<bool> statusPerMpdu)
209 m_phy = CreateObject<SpectrumWifiPhy>();
237 double txPowerWatts = 0.010;
253 Simulator::Destroy();
298 const std::vector<Time>& )
override
368 void DoRun()
override;
385 m_listener = std::make_shared<TestPhyListener>();
392 double txPowerWatts = 0.010;
400 "Didn't receive NotifyCcaBusyStart (once preamble is detected + prolonged by L-SIG "
401 "reception, then switched to Rx by at the beginning of data)");
405 Simulator::Destroy();
430 void DoRun()
override;
459 :
TestCase(
"SpectrumWifiPhy test RX filters"),
460 m_txChannelWidth(20),
502 for (
const auto& pair : rxPowersW)
504 NS_LOG_INFO(
"band: (" << pair.first <<
") -> powerW=" << pair.second <<
" ("
505 <<
WToDbm(pair.second) <<
" dBm)");
508 size_t numBands = rxPowersW.size();
517 "Total number of bands handled by the receiver is incorrect");
521 auto it = rxPowersW.find(band);
522 NS_LOG_INFO(
"powerW total band: " << it->second <<
" (" <<
WToDbm(it->second) <<
" dBm)");
523 int totalRxPower =
static_cast<int>(
WToDbm(it->second) + 0.5);
524 int expectedTotalRxPower;
529 expectedTotalRxPower = 16;
534 expectedTotalRxPower =
538 expectedTotalRxPower,
539 "Total received power is not correct");
544 it = rxPowersW.find(band);
545 NS_LOG_INFO(
"powerW in primary 20 MHz channel: " << it->second <<
" (" <<
WToDbm(it->second)
547 int rxPowerPrimaryChannel20 =
static_cast<int>(
WToDbm(it->second) + 0.5);
548 int expectedRxPowerPrimaryChannel20 = 16 -
static_cast<int>(
RatioToDb(channelWidth / 20));
550 expectedRxPowerPrimaryChannel20,
551 "Received power in the primary 20 MHz band is not correct");
563 lossModel->SetFrequency(5.180e9);
564 spectrumChannel->AddPropagationLossModel(lossModel);
566 CreateObject<ConstantSpeedPropagationDelayModel>();
567 spectrumChannel->SetPropagationDelayModel(delayModel);
571 m_txPhy = CreateObject<ExtSpectrumWifiPhy>();
587 m_rxPhy = CreateObject<ExtSpectrumWifiPhy>();
615 uint16_t txFrequency;
632 auto txChannelNum = std::get<0>(*WifiPhyOperatingChannel::FindFirst(0,
640 uint16_t rxFrequency;
657 auto rxChannelNum = std::get<0>(*WifiPhyOperatingChannel::FindFirst(0,
666 for (uint16_t bw = 160; bw >= 20; bw = bw / 2)
673 for (std::size_t index = 1; index <= HeRu::GetNRus(bw, ruType); index++)
676 HeRu::GetSubcarrierGroup(bw, ruType, index);
678 std::make_pair(subcarrierGroup.front().first,
679 subcarrierGroup.back().second);
681 HePhy::ConvertHeRuSubcarriers(bw,
764 Simulator::Destroy();
803 void DoRun()
override;
815 uint8_t channelNumber,
816 uint16_t channelWidth);
847 bool interferencesExpected);
857 bool interferencesExpected);
870 uint32_t expectedNumRx,
872 const std::vector<std::size_t>& expectedConnectedPhysPerChannel);
905 bool trackSignalsInactiveInterfaces)
906 :
TestCase{
"SpectrumWifiPhy test operation with multiple RF interfaces"},
907 m_trackSignalsInactiveInterfaces{trackSignalsInactiveInterfaces}
914 uint8_t channelNumber,
915 uint16_t channelWidth)
917 NS_LOG_FUNCTION(
this << index << band << +channelNumber << channelWidth);
919 listener->m_notifyMaybeCcaBusyStart = 0;
920 listener->m_ccaBusyStart =
Seconds(0);
921 listener->m_ccaBusyEnd =
Seconds(0);
930 <<
phy->GetChannelWidth() <<
phy->GetChannelNumber());
946 phy->SetTxPowerStart(txPowerDbm);
947 phy->SetTxPowerEnd(txPowerDbm);
958 <<
phy->GetChannelNumber());
966 bool interferencesExpected)
979 interferencesExpected);
985 bool interferencesExpected)
989 phy->GetAttribute(
"InterferenceHelper", ptr);
992 const auto energyDuration = interferenceHelper->GetEnergyDuration(0, band);
994 interferencesExpected,
995 "Incorrect interferences detection");
1001 uint32_t expectedNumRx,
1003 const std::vector<std::size_t>& expectedConnectedPhysPerChannel)
1005 NS_LOG_FUNCTION(
this << index << expectedNumRx << expectedFrequencyRangeActiveRfInterface);
1007 std::size_t numActiveInterfaces = 0;
1008 for (
const auto& [freqRange, interface] :
phy->GetSpectrumPhyInterfaces())
1010 const auto expectedActive = (freqRange == expectedFrequencyRangeActiveRfInterface);
1011 const auto isActive = (
interface ==
phy->GetCurrentInterface());
1015 numActiveInterfaces++;
1023 expectedConnectedPhysPerChannel.at(i),
1024 "Incorrect number of PHYs attached to the spectrum channel");
1028 "Didn't receive right number of packets");
1031 "Didn't receive NotifyRxStart");
1036 bool expectedCcaBusyIndication,
1037 Time switchingDelay)
1039 const auto expectedCcaBusyStart =
1041 const auto expectedCcaBusyEnd = expectedCcaBusyIndication ?
m_lastTxEnd :
Seconds(0);
1042 NS_LOG_FUNCTION(
this << index << expectedCcaBusyIndication << expectedCcaBusyStart
1043 << expectedCcaBusyEnd);
1045 const auto ccaBusyIndication = (listener->m_notifyMaybeCcaBusyStart > 0);
1046 const auto ccaBusyStart = listener->m_ccaBusyStart;
1047 const auto ccaBusyEnd = listener->m_ccaBusyEnd;
1049 expectedCcaBusyIndication,
1050 "CCA busy indication check failed");
1068 for (std::size_t rxPhyIndex = 0; rxPhyIndex <
m_rxPhys.size(); ++rxPhyIndex)
1070 auto txPhy =
m_txPhys.at(rxPhyIndex);
1072 txPhy->GetPhyBand(),
1073 txPhy->GetChannelNumber(),
1074 txPhy->GetChannelWidth());
1095 struct SpectrumPhyInterfaceInfo
1100 std::string bandName;
1112 const std::vector<SpectrumPhyInterfaceInfo>
interfaces{
1118 for (std::size_t i = 0; i <
interfaces.size(); ++i)
1120 auto spectrumChannel = CreateObject<MultiModelSpectrumChannel>();
1121 [[maybe_unused]]
const auto [
channel, frequency, channelWidth,
type, band] =
1122 (*WifiPhyOperatingChannel::FindFirst(
interfaces.at(i).number,
1128 std::ostringstream oss;
1137 mac.SetType(
"ns3::ApWifiMac",
"BeaconGeneration",
BooleanValue(
false));
1138 phyHelper.
Set(
"TrackSignalsFromInactiveInterfaces",
BooleanValue(
false));
1142 phyHelper.
Set(
"TrackSignalsFromInactiveInterfaces",
1144 auto staDevice =
wifi.Install(phyHelper,
mac, wifiStaNode.
Get(0));
1146 for (std::size_t i = 0; i <
interfaces.size(); ++i)
1149 DynamicCast<SpectrumWifiPhy>(DynamicCast<WifiNetDevice>(apDevice.Get(0))->GetPhy(i));
1152 const auto index =
m_rxPhys.size();
1154 DynamicCast<SpectrumWifiPhy>(DynamicCast<WifiNetDevice>(staDevice.Get(0))->GetPhy(i));
1155 rxPhy->TraceConnectWithoutContext(
1159 auto listener = std::make_shared<TestPhyListener>();
1160 rxPhy->RegisterListener(listener);
1182 Simulator::Destroy();
1190 const auto ccaEdThresholdDbm = -62.0;
1191 const auto txAfterChannelSwitchDelay =
1194 const auto checkResultsDelay =
1196 const auto flushResultsDelay =
1198 const auto txOngoingAfterTxStartedDelay =
1205 std::vector<std::size_t> expectedConnectedPhysPerChannel =
1209 std::vector<std::size_t>{2, 2, 2, 2};
1211 for (std::size_t i = 0; i < 4; ++i)
1215 Simulator::Schedule(delay,
1220 for (std::size_t j = 0; j < 4; ++j)
1224 const auto& expectedFreqRange = txPhy->GetCurrentFrequencyRange();
1225 Simulator::Schedule(delay + txOngoingAfterTxStartedDelay,
1229 txPpduPhy->GetCurrentFrequencyRange(),
1230 txPpduPhy->GetBand(txPpduPhy->GetChannelWidth(), 0),
1232 Simulator::Schedule(delay + checkResultsDelay,
1238 expectedConnectedPhysPerChannel);
1240 Simulator::Schedule(delay + flushResultsDelay,
1246 for (std::size_t i = 0; i < 4; ++i)
1250 Simulator::Schedule(delay + txAfterChannelSwitchDelay,
1255 const auto& expectedFreqRange = txPpduPhy->GetCurrentFrequencyRange();
1256 for (std::size_t j = 0; j < 4; ++j)
1260 for (std::size_t
k = 0;
k < expectedConnectedPhysPerChannel.size(); ++
k)
1262 expectedConnectedPhysPerChannel.at(
k) = (
k == i) ? 5 : 1;
1266 Simulator::Schedule(delay,
1270 txPpduPhy->GetPhyBand(),
1271 txPpduPhy->GetChannelNumber(),
1272 txPpduPhy->GetChannelWidth());
1273 Simulator::Schedule(delay + txAfterChannelSwitchDelay + txOngoingAfterTxStartedDelay,
1277 txPpduPhy->GetCurrentFrequencyRange(),
1278 txPpduPhy->GetBand(txPpduPhy->GetChannelWidth(), 0),
1280 Simulator::Schedule(delay + checkResultsDelay,
1286 expectedConnectedPhysPerChannel);
1288 Simulator::Schedule(delay + flushResultsDelay,
1295 const auto secondSpectrumChannelIndex = 1;
1296 auto channel36TxPhy =
m_txPhys.at(secondSpectrumChannelIndex);
1297 const auto& expectedFreqRange = channel36TxPhy->GetCurrentFrequencyRange();
1298 for (std::size_t i = 0; i < 4; ++i)
1302 Simulator::Schedule(delay + txAfterChannelSwitchDelay,
1307 for (std::size_t j = 0; j < 4; ++j)
1311 for (std::size_t
k = 0;
k < expectedConnectedPhysPerChannel.size(); ++
k)
1313 expectedConnectedPhysPerChannel.at(
k) =
1314 (
k == secondSpectrumChannelIndex) ? 5 : 1;
1317 Simulator::Schedule(delay,
1324 Simulator::Schedule(delay + checkResultsDelay,
1328 (i == secondSpectrumChannelIndex) ? 1 : 0,
1330 expectedConnectedPhysPerChannel);
1332 Simulator::Schedule(delay + flushResultsDelay,
1338 for (
const auto txPowerDbm : {-60.0 , -70.0 })
1340 for (std::size_t i = 0; i < 4; ++i)
1342 for (std::size_t j = 0; j < 4; ++j)
1345 const auto startChannel =
1346 WifiPhyOperatingChannel::FindFirst(txPpduPhy->GetPrimaryChannelNumber(20),
1350 txPpduPhy->GetPhyBand());
1351 for (uint16_t bw = txPpduPhy->GetChannelWidth(); bw >= 20; bw /= 2)
1353 [[maybe_unused]]
const auto [
channel, frequency, channelWidth,
type, band] =
1354 (*WifiPhyOperatingChannel::FindFirst(0,
1358 txPpduPhy->GetPhyBand(),
1361 Simulator::Schedule(delay,
1366 Simulator::Schedule(delay + txOngoingAfterTxStartedDelay,
1373 for (std::size_t
k = 0;
k < 4; ++
k)
1375 if ((i != j) && (
k == i))
1379 const auto expectCcaBusyIndication =
1380 (
k == i) ? (txPowerDbm >= ccaEdThresholdDbm)
1382 ? ((txPowerDbm >= ccaEdThresholdDbm) ? (j ==
k) :
false)
1384 Simulator::Schedule(
1385 delay + checkResultsDelay,
1389 expectCcaBusyIndication,
1390 txOngoingAfterTxStartedDelay);
1392 Simulator::Schedule(delay + flushResultsDelay,
1420 void DoRun()
override;
1424 :
TestCase(
"Check PHY interfaces added to PHY instances using helper")
1435 phyHelper.
Set(0,
"ChannelSettings",
StringValue(
"{2, 0, BAND_2_4GHZ, 0}"));
1436 phyHelper.
Set(1,
"ChannelSettings",
StringValue(
"{36, 0, BAND_5GHZ, 0}"));
1437 phyHelper.
Set(2,
"ChannelSettings",
StringValue(
"{1, 0, BAND_6GHZ, 0}"));
1451 DynamicCast<SpectrumWifiPhy>(DynamicCast<WifiNetDevice>(device.Get(0))->GetPhy(0));
1455 "Incorrect number of PHY interfaces added to PHY link ID 0");
1458 DynamicCast<SpectrumWifiPhy>(DynamicCast<WifiNetDevice>(device.Get(0))->GetPhy(1));
1462 "Incorrect number of PHY interfaces added to PHY link ID 1");
1465 DynamicCast<SpectrumWifiPhy>(DynamicCast<WifiNetDevice>(device.Get(0))->GetPhy(2));
1469 "Incorrect number of PHY interfaces added to PHY link ID 2");
1478 phyLink0 = DynamicCast<SpectrumWifiPhy>(DynamicCast<WifiNetDevice>(device.Get(0))->GetPhy(0));
1482 "Incorrect number of PHY interfaces added to PHY link ID 0");
1485 "Incorrect PHY interfaces added to PHY link ID 0");
1487 phyLink1 = DynamicCast<SpectrumWifiPhy>(DynamicCast<WifiNetDevice>(device.Get(0))->GetPhy(1));
1491 "Incorrect number of PHY interfaces added to PHY link ID 1");
1494 "Incorrect PHY interfaces added to PHY link ID 1");
1496 phyLink2 = DynamicCast<SpectrumWifiPhy>(DynamicCast<WifiNetDevice>(device.Get(0))->GetPhy(2));
1500 "Incorrect number of PHY interfaces added to PHY link ID 2");
1503 "Incorrect PHY interfaces added to PHY link ID 2");
1510 phyLink0 = DynamicCast<SpectrumWifiPhy>(DynamicCast<WifiNetDevice>(device.Get(0))->GetPhy(0));
1514 "Incorrect number of PHY interfaces added to PHY link ID 0");
1517 "Incorrect PHY interfaces added to PHY link ID 0");
1520 "Incorrect PHY interfaces added to PHY link ID 0");
1522 phyLink1 = DynamicCast<SpectrumWifiPhy>(DynamicCast<WifiNetDevice>(device.Get(0))->GetPhy(1));
1526 "Incorrect number of PHY interfaces added to PHY link ID 1");
1529 "Incorrect PHY interfaces added to PHY link ID 1");
1531 phyLink2 = DynamicCast<SpectrumWifiPhy>(DynamicCast<WifiNetDevice>(device.Get(0))->GetPhy(2));
1535 "Incorrect number of PHY interfaces added to PHY link ID 2");
1538 "Incorrect PHY interfaces added to PHY link ID 2");
1545 phyLink0 = DynamicCast<SpectrumWifiPhy>(DynamicCast<WifiNetDevice>(device.Get(0))->GetPhy(0));
1549 "Incorrect number of PHY interfaces added to PHY link ID 0");
1552 "Incorrect PHY interfaces added to PHY link ID 0");
1555 "Incorrect PHY interfaces added to PHY link ID 0");
1558 "Incorrect PHY interfaces added to PHY link ID 0");
1560 phyLink1 = DynamicCast<SpectrumWifiPhy>(DynamicCast<WifiNetDevice>(device.Get(0))->GetPhy(1));
1564 "Incorrect number of PHY interfaces added to PHY link ID 1");
1567 "Incorrect PHY interfaces added to PHY link ID 0");
1570 "Incorrect PHY interfaces added to PHY link ID 0");
1573 "Incorrect PHY interfaces added to PHY link ID 0");
1575 phyLink2 = DynamicCast<SpectrumWifiPhy>(DynamicCast<WifiNetDevice>(device.Get(0))->GetPhy(2));
1579 "Incorrect number of PHY interfaces added to PHY link ID 2");
1582 "Incorrect PHY interfaces added to PHY link ID 0");
1585 "Incorrect PHY interfaces added to PHY link ID 0");
1588 "Incorrect PHY interfaces added to PHY link ID 0");
1590 Simulator::Destroy();
1606 :
TestSuite(
"wifi-spectrum-wifi-phy", UNIT)
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< Ptr< SpectrumWifiPhy > > m_rxPhys
RX 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 ...
std::vector< std::shared_ptr< TestPhyListener > > m_listeners
listeners
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.
std::vector< Ptr< SpectrumWifiPhy > > m_txPhys
TX PHYs.
void SendPpdu(Ptr< SpectrumWifiPhy > phy, double txPowerDbm)
Send PPDU function.
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.
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
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.
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
void Dispose()
Dispose of this Object.
Hold objects of type Ptr<T>.
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, 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.
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 SetPhy(const Ptr< WifiPhy > phy)
void SetPcapDataLinkType(SupportedPcapDataLinkTypes dlt)
Set the data link type of PCAP traces to be used.
void Set(std::string name, const AttributeValue &v)
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.
uint32_t GetSize() const
Return the size of the PSDU in bytes.
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.
Time Now()
create an ns3::Time instance which contains the current simulation time.
#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.