22#include "ns3/attribute-container.h"
23#include "ns3/channel.h"
24#include "ns3/dsss-phy.h"
25#include "ns3/eht-phy.h"
26#include "ns3/erp-ofdm-phy.h"
27#include "ns3/error-model.h"
28#include "ns3/ht-configuration.h"
30#include "ns3/mobility-model.h"
31#include "ns3/pointer.h"
32#include "ns3/random-variable-stream.h"
33#include "ns3/simulator.h"
34#include "ns3/string.h"
36#include "ns3/vht-configuration.h"
41#undef NS_LOG_APPEND_CONTEXT
42#define NS_LOG_APPEND_CONTEXT \
43 WIFI_PHY_NS_LOG_APPEND_CONTEXT( \
44 (m_device && (m_device->GetNPhys() > m_phyId) && m_device->GetPhy(m_phyId) \
45 ? m_device->GetPhy(m_phyId) \
66 .AddAttribute(
"Channel",
67 "The channel attached to this PHY",
74 "A vector of tuple {channel number, channel width (MHz), PHY band, primary20 "
76 "describing the settings of the operating channel for each segment. "
77 "The primary20 index (only the value set for the first segment is used) "
78 "is the index of the primary 20 MHz channel within the operating channel "
79 "(0 indicates the 20 MHz subchannel with the lowest center frequency) and "
80 "is only valid if the width of the operating channel is a multiple of 20 MHz. "
81 "If the standard for this object has not been set yet, the value of this "
82 "attribute is saved and will be used to set the operating channel when the "
83 "standard is configured. If the PHY band is left unspecified, the default "
84 "band for the configured standard is used. If the channel width and the "
85 "channel number are both 0, the default channel width for the configured "
86 "standard and band are used. If the channel number is 0, the default "
87 "channel number for the configured standard, band and channel width is used. "
88 "Note that the channel width can be left unspecified (0) if the channel "
89 "number uniquely identify a frequency channel for the given standard and band.",
112 .AddAttribute(
"Frequency",
113 "The center frequency (MHz) of the current operating channel.",
118 .AddAttribute(
"ChannelNumber",
119 "The channel number of the current operating channel.",
126 "The width in MHz of the current operating channel (5, 10, 20, 22, 40, 80 or 160). "
127 "If 80+80MHz is used, this corresponds to the total channel width, hence 160 MHz.",
134 "The index of the primary 20 MHz channel within the current operating channel "
135 "(0 indicates the 20 MHz subchannel with the lowest center frequency).",
139 .AddAttribute(
"FixedPhyBand",
140 "If set to true, changing PHY band is prohibited after initialization.",
146 "The energy of a received signal should be higher than "
147 "this threshold (dBm) for the PHY to detect the signal. "
148 "This threshold refers to a width of 20 MHz and will be "
149 "scaled to match the width of the received signal.",
155 "The energy of all received signals should be higher than "
156 "this threshold (dBm) in the primary channel to allow the PHY layer "
157 "to declare CCA BUSY state.",
161 .AddAttribute(
"CcaSensitivity",
162 "The energy of a received wifi signal should be higher than "
163 "this threshold (dBm) in the primary channel to allow the PHY layer "
164 "to declare CCA BUSY state.",
169 .AddAttribute(
"TxGain",
170 "Transmission gain (dB).",
174 .AddAttribute(
"RxGain",
175 "Reception gain (dB).",
179 .AddAttribute(
"TxPowerLevels",
180 "Number of transmission power levels available between "
181 "TxPowerStart and TxPowerEnd included.",
185 .AddAttribute(
"TxPowerEnd",
186 "Maximum available transmission level (dBm).",
190 .AddAttribute(
"TxPowerStart",
191 "Minimum available transmission level (dBm).",
197 "Loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in the receiver."
198 " According to Wikipedia (http://en.wikipedia.org/wiki/Noise_figure), this is "
199 "\"the difference in decibels (dB) between"
200 " the noise output of the actual receiver to the noise output of an "
201 " ideal receiver with the same overall gain and bandwidth when the receivers "
202 " are connected to sources at the standard noise temperature T0 (usually 290 K)\".",
206 .AddAttribute(
"State",
207 "The state of the PHY layer.",
211 .AddAttribute(
"ChannelSwitchDelay",
212 "Delay between two short frames transmitted on different frequencies.",
218 "The number of antennas on the device.",
222 .AddAttribute(
"MaxSupportedTxSpatialStreams",
223 "The maximum number of supported TX spatial streams."
224 "This parameter is only valuable for 802.11n/ac/ax STAs and APs.",
229 .AddAttribute(
"MaxSupportedRxSpatialStreams",
230 "The maximum number of supported RX spatial streams."
231 "This parameter is only valuable for 802.11n/ac/ax STAs and APs.",
236 .AddAttribute(
"ShortPlcpPreambleSupported",
237 "Whether or not short PHY preamble is supported."
238 "This parameter is only valuable for 802.11b STAs and APs."
239 "Note: 802.11g APs and STAs always support short PHY preamble.",
244 .AddAttribute(
"FrameCaptureModel",
245 "Ptr to an object that implements the frame capture model",
249 .AddAttribute(
"PreambleDetectionModel",
250 "Ptr to an object that implements the preamble detection model",
254 .AddAttribute(
"PostReceptionErrorModel",
255 "An optional packet error model can be added to the receive "
256 "packet process after any propagation-based (SNR-based) error "
257 "models have been applied. Typically this is used to force "
258 "specific packet drops, for testing purposes.",
262 .AddAttribute(
"InterferenceHelper",
263 "Ptr to an object that implements the interference helper",
267 .AddAttribute(
"Sifs",
268 "The duration of the Short Interframe Space. "
269 "NOTE that the default value is overwritten by the value defined "
270 "by the standard; if you want to set this attribute, you have to "
271 "do it after that the PHY object is initialized.",
275 .AddAttribute(
"Slot",
276 "The duration of a slot. "
277 "NOTE that the default value is overwritten by the value defined "
278 "by the standard; if you want to set this attribute, you have to "
279 "do it after that the PHY object is initialized.",
283 .AddAttribute(
"Pifs",
284 "The duration of the PCF Interframe Space. "
285 "NOTE that the default value is overwritten by the value defined "
286 "by the standard; if you want to set this attribute, you have to "
287 "do it after that the PHY object is initialized.",
291 .AddAttribute(
"PowerDensityLimit",
292 "The mean equivalent isotropically radiated power density"
293 "limit (in dBm/MHz) set by regulators.",
297 .AddAttribute(
"NotifyMacHdrRxEnd",
298 "Whether the PHY is capable of notifying the MAC about the end of "
299 "the reception of the MAC header of every MPDU.",
305 "Trace source indicating a packet has begun transmitting over the medium; "
306 "the packet holds a single MPDU even if the MPDU is transmitted within an A-MPDU "
307 "(in which case this trace fires for each MPDU in the "
310 "ns3::WifiPhy::PhyTxBeginTracedCallback")
313 "Trace source indicating a PSDU has begun transmitting over the channel medium; "
314 "this trace returns a WifiConstPsduMap with a single element (in the case of SU "
316 "or multiple elements (in the case of MU PPDU)",
318 "ns3::WifiPhy::PsduTxBeginCallback")
319 .AddTraceSource(
"PhyTxEnd",
320 "Trace source indicating a packet "
321 "has been completely transmitted over the channel.",
323 "ns3::Packet::TracedCallback")
324 .AddTraceSource(
"PhyTxDrop",
325 "Trace source indicating a packet "
326 "has been dropped by the device during transmission",
328 "ns3::Packet::TracedCallback")
329 .AddTraceSource(
"PhyRxBegin",
330 "Trace source indicating a packet "
331 "has begun being received from the channel medium "
334 "ns3::WifiPhy::PhyRxBeginTracedCallback")
335 .AddTraceSource(
"PhyRxPayloadBegin",
336 "Trace source indicating the reception of the "
337 "payload of a PPDU has begun",
339 "ns3::WifiPhy::PhyRxPayloadBeginTracedCallback")
340 .AddTraceSource(
"PhyRxMacHeaderEnd",
341 "Trace source indicating the MAC header of an MPDU has been "
342 "completely received.",
344 "ns3::WifiPhy::PhyRxMacHeaderEndTracedCallback")
345 .AddTraceSource(
"PhyRxEnd",
346 "Trace source indicating a packet "
347 "has been completely received from the channel medium "
350 "ns3::Packet::TracedCallback")
351 .AddTraceSource(
"PhyRxDrop",
352 "Trace source indicating a packet "
353 "has been dropped by the device during reception",
355 "ns3::WifiPhy::PhyRxDropTracedCallback")
356 .AddTraceSource(
"PhyRxPpduDrop",
357 "Trace source indicating a ppdu "
358 "has been dropped by the device during reception",
360 "ns3::WifiPhy::PhyRxPpduDropTracedCallback")
361 .AddTraceSource(
"MonitorSnifferRx",
362 "Trace source simulating a wifi device in monitor mode "
363 "sniffing all received frames",
365 "ns3::WifiPhy::MonitorSnifferRxTracedCallback")
366 .AddTraceSource(
"MonitorSnifferTx",
367 "Trace source simulating the capability of a wifi device "
368 "in monitor mode to sniff all frames being transmitted",
370 "ns3::WifiPhy::MonitorSnifferTxTracedCallback")
371 .AddTraceSource(
"SignalTransmission",
372 "Trace start of signal transmission",
374 "ns3::SpectrumWifiPhy::SignalTransmissionCallback");
380 m_txMpduReferenceNumber(0xffffffff),
381 m_rxMpduReferenceNumber(0xffffffff),
384 m_currentEvent(nullptr),
385 m_previouslyRxPpduUid(UINT64_MAX),
394 m_powerRestricted(false),
395 m_channelAccessRequested(false),
396 m_txSpatialStreams(1),
397 m_rxSpatialStreams(1),
398 m_wifiRadioEnergyModel(nullptr),
399 m_timeLastPreambleDetected()
426 "Either install a MobilityModel on this object or ensure that this "
427 "object is part of a Node and NetDevice");
431 NS_LOG_WARN(
"Mobility not found, propagation models might not work properly");
460 phyEntity.second =
nullptr;
465std::map<WifiModulationClass, Ptr<PhyEntity>>&
468 static std::map<WifiModulationClass, Ptr<PhyEntity>> g_staticPhyEntities;
469 return g_staticPhyEntities;
481 m_state->SetReceiveOkCallback(callback);
487 m_state->SetReceiveErrorCallback(callback);
493 m_state->RegisterListener(listener);
504 m_state->UnregisterListener(listener);
733 "cannot have TxPowerEnd != TxPowerStart with TxPowerLevels == 1");
748 return m_interference->GetErrorRateModel()->CalculateSnr(txVector, ber);
756 "Unimplemented Wi-Fi modulation class " << modulation);
765 "Unsupported Wi-Fi modulation class " << modulation);
785 const auto modulation = ppdu->GetModulation();
805 "The PHY entity has already been added. The setting should only be done once per "
815 "Cannot add an unimplemented PHY to supported list. Update the former first.");
817 "The PHY entity has already been added. The setting should only be done once per "
819 phyEntity->SetOwner(
this);
1015 "Cannot change standard");
1140 for (std::size_t segmentId = 0; segmentId < channel.GetNSegments(); ++segmentId)
1142 segments.emplace_back(channel.GetNumber(segmentId),
1143 channel.GetWidth(segmentId),
1144 channel.GetPhyBand(),
1145 channel.GetPrimaryChannelIndex(
MHz_u{20}));
1160 << std::get<1>(channelSegments.front())
1161 <<
static_cast<WifiPhyBand>(std::get<2>(channelSegments.front()))
1162 << +std::get<3>(channelSegments.front()));
1168 NS_LOG_DEBUG(
"Channel information will be applied when a standard is configured");
1175 if (!delay.has_value())
1180 if (delay.value().IsStrictlyPositive())
1203 std::optional<Time> delay;
1207 NS_LOG_DEBUG(
"drop packet because of channel switching while reception");
1212 NS_LOG_DEBUG(
"channel switching postponed until end of current transmission");
1224 NS_LOG_DEBUG(
"channel switching ignored in sleep mode");
1243 std::optional<uint8_t> prevChannelNumber{};
1250 if (width ==
MHz_u{0} && number == 0)
1262 prevChannelNumber = number;
1268 bool changingPhyBand =
1272 "Trying to change PHY band while prohibited.");
1277 std::vector<FrequencyChannelInfo> segments{};
1280 std::back_inserter(segments),
1281 [
this](
const auto& channelTuple) {
1282 return FrequencyChannelInfo{std::get<0>(channelTuple),
1284 std::get<1>(channelTuple),
1287 m_operatingChannel.Set(segments, m_standard);
1288 m_operatingChannel.SetPrimary20Index(std::get<3>(m_channelSettings.front()));
1291 const auto chWidth = GetChannelWidth();
1295 if (
auto htConfig = m_device->GetHtConfiguration();
1296 htConfig && !htConfig->m_40MHzSupported && chWidth >
MHz_u{20})
1299 <<
" MHz channel on"
1300 "a station only supporting 20 MHz operation");
1303 if (
auto vhtConfig = m_device->GetVhtConfiguration();
1304 vhtConfig && !vhtConfig->m_160MHzSupported && chWidth >
MHz_u{80})
1307 <<
" MHz channel on"
1308 "a station supporting up to 80 MHz operation");
1312 if (changingPhyBand)
1314 ConfigureStandard(m_standard);
1317 FinalizeChannelSwitch();
1319 if (IsInitialized())
1322 m_state->SwitchToChannelSwitching(GetChannelSwitchDelay());
1330 SwitchMaybeToCcaBusy(
nullptr);
1335WifiPhy::SetNumberOfAntennas(uint8_t antennas)
1338 NS_ASSERT_MSG(antennas > 0 && antennas <= 8,
"unsupported number of antennas");
1339 m_numberOfAntennas = antennas;
1342 m_interference->SetNumberOfReceiveAntennas(antennas);
1347WifiPhy::GetNumberOfAntennas()
const
1349 return m_numberOfAntennas;
1353WifiPhy::SetMaxSupportedTxSpatialStreams(uint8_t streams)
1355 NS_ASSERT(streams <= GetNumberOfAntennas());
1356 bool changed = (m_txSpatialStreams != streams);
1357 m_txSpatialStreams = streams;
1361 if (phyEntity != m_phyEntities.end())
1363 Ptr<HtPhy> htPhy = DynamicCast<HtPhy>(phyEntity->second);
1366 htPhy->SetMaxSupportedNss(
1367 m_txSpatialStreams);
1370 if (!m_capabilitiesChangedCallback.IsNull())
1372 m_capabilitiesChangedCallback();
1379WifiPhy::GetMaxSupportedTxSpatialStreams()
const
1381 return m_txSpatialStreams;
1385WifiPhy::SetMaxSupportedRxSpatialStreams(uint8_t streams)
1387 NS_ASSERT(streams <= GetNumberOfAntennas());
1388 bool changed = (m_rxSpatialStreams != streams);
1389 m_rxSpatialStreams = streams;
1390 if (changed && !m_capabilitiesChangedCallback.IsNull())
1392 m_capabilitiesChangedCallback();
1397WifiPhy::GetMaxSupportedRxSpatialStreams()
const
1399 return m_rxSpatialStreams;
1403WifiPhy::GetBssMembershipSelectorList()
const
1405 std::list<uint8_t>
list;
1406 for (
const auto& phyEntity : m_phyEntities)
1408 Ptr<HtPhy> htPhy = DynamicCast<HtPhy>(phyEntity.second);
1411 list.emplace_back(htPhy->GetBssMembershipSelector());
1418WifiPhy::SetSleepMode(
bool forceSleepInRx)
1421 m_powerRestricted =
false;
1422 m_channelAccessRequested =
false;
1423 switch (m_state->GetState())
1425 case WifiPhyState::TX:
1426 NS_LOG_DEBUG(
"setting sleep mode postponed until end of current transmission");
1427 Simulator::Schedule(GetDelayUntilIdle(), &WifiPhy::SetSleepMode,
this, forceSleepInRx);
1429 case WifiPhyState::RX:
1431 << (forceSleepInRx ?
"" :
"postponed until end of current reception"));
1434 AbortCurrentReception(WifiPhyRxfailureReason::SLEEPING);
1435 m_state->SwitchToSleep();
1439 Simulator::Schedule(GetDelayUntilIdle(), &WifiPhy::SetSleepMode,
this, forceSleepInRx);
1442 case WifiPhyState::SWITCHING:
1443 NS_LOG_DEBUG(
"setting sleep mode postponed until end of channel switching");
1444 Simulator::Schedule(GetDelayUntilIdle(), &WifiPhy::SetSleepMode,
this, forceSleepInRx);
1446 case WifiPhyState::CCA_BUSY:
1447 case WifiPhyState::IDLE:
1452 m_state->SwitchToSleep();
1454 case WifiPhyState::SLEEP:
1464WifiPhy::SetOffMode()
1467 m_powerRestricted =
false;
1468 m_channelAccessRequested =
false;
1470 m_state->SwitchToOff();
1474WifiPhy::ResumeFromSleep()
1477 switch (m_state->GetState())
1479 case WifiPhyState::TX:
1480 case WifiPhyState::RX:
1481 case WifiPhyState::IDLE:
1482 case WifiPhyState::CCA_BUSY:
1483 case WifiPhyState::SWITCHING: {
1484 NS_LOG_DEBUG(
"not in sleep mode, there is nothing to resume");
1487 case WifiPhyState::SLEEP: {
1489 m_state->SwitchFromSleep();
1490 SwitchMaybeToCcaBusy();
1501WifiPhy::ResumeFromOff()
1504 switch (m_state->GetState())
1506 case WifiPhyState::TX:
1507 case WifiPhyState::RX:
1508 case WifiPhyState::IDLE:
1509 case WifiPhyState::CCA_BUSY:
1510 case WifiPhyState::SWITCHING:
1511 case WifiPhyState::SLEEP: {
1512 NS_LOG_DEBUG(
"not in off mode, there is nothing to resume");
1515 case WifiPhyState::OFF: {
1517 m_state->SwitchFromOff();
1518 SwitchMaybeToCcaBusy();
1529WifiPhy::GetPreambleDetectionDuration()
1548 double totalAmpduNumSymbols;
1549 return GetPayloadDuration(size,
1555 totalAmpduNumSymbols,
1566 double& totalAmpduNumSymbols,
1570 ->GetPayloadDuration(size,
1576 totalAmpduNumSymbols,
1581WifiPhy::CalculatePhyPreambleAndHeaderDuration(
const WifiTxVector& txVector)
1584 ->CalculatePhyPreambleAndHeaderDuration(txVector);
1593 Time duration = CalculatePhyPreambleAndHeaderDuration(txVector) +
1594 GetPayloadDuration(size, txVector, band,
NORMAL_MPDU, staId);
1604 return CalculateTxDuration(GetWifiConstPsduMap(psdu, txVector), txVector, band);
1613 ->CalculateTxDuration(psduMap, txVector, band);
1619 return GetStaticPhyEntity(modulation)->GetMaxPsduSize();
1625 if (!m_phyTxBeginTrace.IsEmpty())
1627 for (
const auto& psdu : psdus)
1631 m_phyTxBeginTrace(mpdu->GetProtocolDataUnit(), txPower);
1640 if (!m_phyTxEndTrace.IsEmpty())
1642 for (
const auto& psdu : psdus)
1646 m_phyTxEndTrace(mpdu->GetProtocolDataUnit());
1655 if (!m_phyTxDropTrace.IsEmpty())
1659 m_phyTxDropTrace(mpdu->GetProtocolDataUnit());
1667 if (psdu && !m_phyRxBeginTrace.IsEmpty())
1671 m_phyRxBeginTrace(mpdu->GetProtocolDataUnit(), rxPowersW);
1679 if (psdu && !m_phyRxEndTrace.IsEmpty())
1683 m_phyRxEndTrace(mpdu->GetProtocolDataUnit());
1691 if (psdu && !m_phyRxDropTrace.IsEmpty())
1695 m_phyRxDropTrace(mpdu->GetProtocolDataUnit(), reason);
1703 NotifyRxDrop(GetAddressedPsduInPpdu(ppdu), reason);
1704 m_phyRxPpduDropTrace(ppdu, reason);
1712 const std::vector<bool>& statusPerMpdu,
1716 if (psdu->IsAggregate())
1720 "TxVector with aggregate flag expected here according to PSDU");
1722 size_t nMpdus = psdu->GetNMpdus();
1723 NS_ASSERT_MSG(statusPerMpdu.size() == nMpdus,
"Should have one reception status per MPDU");
1724 if (!m_phyMonitorSniffRxTrace.IsEmpty())
1727 for (
size_t i = 0; i < nMpdus;)
1729 if (statusPerMpdu.at(i))
1731 m_phyMonitorSniffRxTrace(psdu->GetAmpduSubframe(i),
1732 static_cast<uint16_t
>(channelFreq),
1747 "Should have one reception status for normal MPDU");
1748 if (!m_phyMonitorSniffRxTrace.IsEmpty())
1751 m_phyMonitorSniffRxTrace(psdu->GetPacket(),
1752 static_cast<uint16_t
>(channelFreq),
1768 if (psdu->IsAggregate())
1772 "TxVector with aggregate flag expected here according to PSDU");
1774 if (!m_phyMonitorSniffTxTrace.IsEmpty())
1776 size_t nMpdus = psdu->GetNMpdus();
1778 for (
size_t i = 0; i < nMpdus;)
1780 m_phyMonitorSniffTxTrace(psdu->GetAmpduSubframe(i),
1793 if (!m_phyMonitorSniffTxTrace.IsEmpty())
1796 m_phyMonitorSniffTxTrace(psdu->GetPacket(), channelFreq, txVector, aMpdu, staId);
1802WifiPhy::GetTimeToMacHdrEnd(uint16_t staId)
const
1804 for (
auto& [modClass, phyEntity] : m_phyEntities)
1806 if (
auto remTime = phyEntity->GetTimeToMacHdrEnd(staId))
1811 return std::nullopt;
1817 return GetStaticPhyEntity(txVector.
GetModulationClass())->GetWifiConstPsduMap(psdu, txVector);
1824 Send(GetWifiConstPsduMap(psdu, txVector), txVector);
1837 NS_ASSERT(!m_state->IsStateTx() && !m_state->IsStateSwitching());
1840 if (!txVector.
IsValid(m_band))
1846 if (txVector.
IsMu())
1863 if (nss > GetMaxSupportedTxSpatialStreams())
1868 if (m_state->IsStateSleep())
1871 for (
const auto& psdu : psdus)
1873 NotifyTxDrop(psdu.second);
1878 const auto txDuration = CalculateTxDuration(psdus, txVector, GetPhyBand());
1880 auto noEndPreambleDetectionEvent =
true;
1881 for (
const auto& [mc, entity] : m_phyEntities)
1883 noEndPreambleDetectionEvent =
1884 noEndPreambleDetectionEvent && entity->NoEndPreambleDetectionEvents();
1886 if (!noEndPreambleDetectionEvent && !m_currentEvent)
1893 else if (!noEndPreambleDetectionEvent || m_currentEvent)
1898 if (m_powerRestricted)
1900 NS_LOG_DEBUG(
"Transmitting with power restriction for " << txDuration.As(Time::NS));
1904 NS_LOG_DEBUG(
"Transmitting without power restriction for " << txDuration.As(Time::NS));
1907 if (m_state->GetState() == WifiPhyState::OFF)
1909 NS_LOG_DEBUG(
"Transmission canceled because device is OFF");
1913 auto ppdu = GetPhyEntity(txVector.
GetModulationClass())->BuildPpdu(psdus, txVector, txDuration);
1914 m_previouslyRxPpduUid = UINT64_MAX;
1916 const auto txPower =
DbmToW(GetTxPowerForTransmission(ppdu) + GetTxGain());
1917 NotifyTxBegin(psdus, txPower);
1918 if (!m_phyTxPsduBeginTrace.IsEmpty())
1920 m_phyTxPsduBeginTrace(psdus, txVector, txPower);
1922 for (
const auto& psdu : psdus)
1924 NotifyMonitorSniffTx(psdu.second, GetFrequency(), txVector, psdu.first);
1926 m_state->SwitchToTx(txDuration, psdus, GetPower(txVector.
GetTxPowerLevel()), txVector);
1928 if (m_wifiRadioEnergyModel &&
1929 m_wifiRadioEnergyModel->GetMaximumTimeInState(WifiPhyState::TX) < txDuration)
1931 ppdu->SetTruncatedTx();
1935 Simulator::Schedule(txDuration, &WifiPhy::TxDone,
this, psdus);
1938 ppdu->ResetTxVector();
1940 m_channelAccessRequested =
false;
1941 m_powerRestricted =
false;
1951 SwitchMaybeToCcaBusy();
1955WifiPhy::GetPreviouslyRxPpduUid()
const
1957 return m_previouslyRxPpduUid;
1961WifiPhy::SetPreviouslyRxPpduUid(uint64_t uid)
1964 m_previouslyRxPpduUid = uid;
1971 m_currentPreambleEvents.clear();
1972 bool noEndPreambleDetectionEvent =
true;
1973 for (
const auto& [mc, entity] : m_phyEntities)
1975 noEndPreambleDetectionEvent =
1976 noEndPreambleDetectionEvent && entity->NoEndPreambleDetectionEvents();
1978 if (m_interference && (m_currentEvent || !noEndPreambleDetectionEvent))
1980 m_interference->NotifyRxEnd(Simulator::Now(), GetCurrentFrequencyRange());
1982 m_currentEvent =
nullptr;
1983 for (
auto& phyEntity : m_phyEntities)
1985 phyEntity.second->CancelAllEvents();
1987 m_endPhyRxEvent.Cancel();
1988 m_endTxEvent.Cancel();
1999 if (
auto it = m_phyEntities.find(modulation);
2000 it != m_phyEntities.end() && modulation <= m_maxModClassSupported)
2002 it->second->StartReceivePreamble(ppdu, rxPowersW, rxDuration);
2008 NS_LOG_DEBUG(
"Unsupported modulation received (" << modulation <<
"), consider as noise");
2009 m_interference->Add(ppdu, rxDuration, rxPowersW, GetCurrentFrequencyRange());
2010 SwitchMaybeToCcaBusy();
2014std::optional<std::reference_wrapper<const WifiTxVector>>
2015WifiPhy::GetInfoIfRxingPhyHeader()
const
2017 if (m_endPhyRxEvent.IsPending())
2019 NS_ASSERT_MSG(m_currentEvent,
"No current event while receiving PHY header");
2020 return std::cref(m_currentEvent->GetPpdu()->GetTxVector());
2022 return std::nullopt;
2026WifiPhy::EndReceiveInterBss()
2029 if (!m_channelAccessRequested)
2031 m_powerRestricted =
false;
2036WifiPhy::NotifyChannelAccessRequested()
2039 m_channelAccessRequested =
true;
2045 for (
const auto& phyEntity : m_phyEntities)
2047 if (phyEntity.second->IsModeSupported(mode))
2056WifiPhy::GetDefaultMode()
const
2060 for (
const auto& phyEntity : m_phyEntities)
2062 for (
const auto& mode : *(phyEntity.second))
2067 NS_ASSERT_MSG(
false,
"Should have found at least one default mode");
2074 const auto phyEntity = m_phyEntities.find(modulation);
2075 if (phyEntity == m_phyEntities.end())
2079 return phyEntity->second->IsMcsSupported(mcs);
2083WifiPhy::GetModeList()
const
2085 std::list<WifiMode>
list;
2086 for (
const auto& phyEntity : m_phyEntities)
2088 if (!phyEntity.second->HandlesMcsModes())
2090 for (
const auto& mode : *(phyEntity.second))
2092 list.emplace_back(mode);
2102 std::list<WifiMode>
list;
2103 const auto phyEntity = m_phyEntities.find(modulation);
2104 if (phyEntity != m_phyEntities.end())
2106 if (!phyEntity->second->HandlesMcsModes())
2108 for (
const auto& mode : *(phyEntity->second))
2110 list.emplace_back(mode);
2118WifiPhy::GetNMcs()
const
2120 uint16_t numMcs = 0;
2121 for (
const auto& phyEntity : m_phyEntities)
2123 if (phyEntity.second->HandlesMcsModes())
2125 numMcs += phyEntity.second->GetNumModes();
2132WifiPhy::GetMcsList()
const
2134 std::list<WifiMode>
list;
2135 for (
const auto& phyEntity : m_phyEntities)
2137 if (phyEntity.second->HandlesMcsModes())
2139 for (
const auto& mode : *(phyEntity.second))
2141 list.emplace_back(mode);
2151 std::list<WifiMode>
list;
2152 auto phyEntity = m_phyEntities.find(modulation);
2153 if (phyEntity != m_phyEntities.end())
2155 if (phyEntity->second->HandlesMcsModes())
2157 for (
const auto& mode : *(phyEntity->second))
2159 list.emplace_back(mode);
2169 NS_ASSERT_MSG(IsMcsSupported(modulation, mcs),
"Unsupported MCS");
2170 return m_phyEntities.at(modulation)->GetMcs(mcs);
2174WifiPhy::IsStateCcaBusy()
const
2176 return m_state->IsStateCcaBusy();
2180WifiPhy::IsStateIdle()
const
2182 return m_state->IsStateIdle();
2186WifiPhy::IsStateRx()
const
2188 return m_state->IsStateRx();
2192WifiPhy::IsStateTx()
const
2194 return m_state->IsStateTx();
2198WifiPhy::IsStateSwitching()
const
2200 return m_state->IsStateSwitching();
2204WifiPhy::IsStateSleep()
const
2206 return m_state->IsStateSleep();
2210WifiPhy::IsStateOff()
const
2212 return m_state->IsStateOff();
2216WifiPhy::GetDelayUntilIdle()
2218 return m_state->GetDelayUntilIdle();
2222WifiPhy::GetLastRxStartTime()
const
2224 return m_state->GetLastRxStartTime();
2228WifiPhy::GetLastRxEndTime()
const
2230 return m_state->GetLastRxEndTime();
2237 GetLatestPhyEntity()->SwitchMaybeToCcaBusy(ppdu);
2256 for (
auto signalDetectEvent : m_currentPreambleEvents)
2258 NotifyRxPpduDrop(signalDetectEvent.second->GetPpdu(),
2262 for (
auto& phyEntity : m_phyEntities)
2264 phyEntity.second->CancelAllEvents();
2266 m_endPhyRxEvent.Cancel();
2267 m_interference->NotifyRxEnd(Simulator::Now(), GetCurrentFrequencyRange());
2268 if (!m_currentEvent)
2272 NotifyRxPpduDrop(m_currentEvent->GetPpdu(), reason);
2275 m_state->SwitchFromRxAbort(GetChannelWidth());
2283 for (
auto it = m_currentPreambleEvents.begin(); it != m_currentPreambleEvents.end();
2286 if (it->second == m_currentEvent)
2288 it = m_currentPreambleEvents.erase(it);
2292 m_currentEvent =
nullptr;
2298WifiPhy::ResetCca(
bool powerRestricted,
dBm_u txPowerMaxSiso,
dBm_u txPowerMaxMimo)
2300 NS_LOG_FUNCTION(
this << powerRestricted << txPowerMaxSiso << txPowerMaxMimo);
2307 m_powerRestricted = powerRestricted;
2308 m_txPowerMaxSiso = txPowerMaxSiso;
2309 m_txPowerMaxMimo = txPowerMaxMimo;
2310 NS_ASSERT((m_currentEvent->GetEndTime() - Simulator::Now()).IsPositive());
2311 Simulator::Schedule(m_currentEvent->GetEndTime() - Simulator::Now(),
2312 &WifiPhy::EndReceiveInterBss,
2314 Simulator::ScheduleNow(&WifiPhy::AbortCurrentReception,
2324 const auto& txVector = ppdu->GetTxVector();
2327 if (!m_powerRestricted)
2329 txPower = GetPower(txVector.GetTxPowerLevel());
2333 if (txVector.GetNssMax() > 1 || txVector.GetNssTotal() > 1)
2335 txPower = std::min(m_txPowerMaxMimo, GetPower(txVector.GetTxPowerLevel()));
2339 txPower = std::min(m_txPowerMaxSiso, GetPower(txVector.GetTxPowerLevel()));
2344 const auto channelWidth = ppdu->GetTxChannelWidth();
2346 (txPower + GetTxGain()) -
RatioToDb(channelWidth);
2347 NS_LOG_INFO(
"txPower=" << txPower <<
"dBm with txPowerDbmPerMhz=" << txPowerDbmPerMhz
2348 <<
" over " << channelWidth <<
" MHz");
2349 txPower = std::min(txPowerDbmPerMhz, m_powerDensityLimit) +
RatioToDb(channelWidth);
2350 txPower -= GetTxGain();
2352 <<
"dBm after applying m_powerDensityLimit=" << m_powerDensityLimit);
2360 return GetPhyEntityForPpdu(ppdu)->GetAddressedPsduInPpdu(ppdu);
2364WifiPhy::AssignStreams(int64_t stream)
2367 int64_t currentStream = stream;
2368 m_random->SetStream(currentStream++);
2369 currentStream += m_interference->GetErrorRateModel()->AssignStreams(currentStream);
2370 return (currentStream - stream);
2377 <<
", RSSI:" << rxSignalInfo.
rssi <<
" dBm";
2382WifiPhy::GetPrimaryChannelNumber(
MHz_u primaryChannelWidth)
const
2384 return m_operatingChannel.GetPrimaryChannelNumber(primaryChannelWidth, m_standard);
2388WifiPhy::GetSubcarrierSpacing()
const
2390 Hz_u subcarrierSpacing{0};
2391 switch (GetStandard())
2398 subcarrierSpacing =
Hz_u{312500};
2401 if (GetChannelWidth() ==
MHz_u{5})
2403 subcarrierSpacing =
Hz_u{78125};
2407 subcarrierSpacing =
Hz_u{156250};
2412 subcarrierSpacing =
Hz_u{78125};
2418 return subcarrierSpacing;
AttributeValue implementation for Boolean.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Hold variables of type enum.
Keep track of the current position and velocity of an object.
A base class which provides memory management and object aggregation.
bool IsInitialized() const
Check if the object has been initialized.
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.
Hold variables of type string.
Simulation virtual time values and global simulation resolution.
bool IsStrictlyPositive() const
Exactly equivalent to t > 0.
AttributeValue implementation for Time.
AttributeValue implementation for Tuple.
a unique identifier for an interface.
@ ATTR_GET
The attribute can be read.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Hold an unsigned integer type.
represent a single transmission mode
WifiModulationClass GetModulationClass() const
static TypeId GetTypeId()
Get the type ID.
void SetNumberOfAntennas(uint8_t antennas)
Ptr< WifiPhyStateHelper > m_state
Pointer to WifiPhyStateHelper.
Time GetBlockAckTxTime() const
Return the estimated BlockAck TX time for this PHY.
Ptr< MobilityModel > m_mobility
Pointer to the mobility model.
dBm_u m_ccaEdThreshold
Clear channel assessment (CCA) energy detection (ED) threshold.
dBm_u GetTxPowerStart() const
Return the minimum available transmission power level.
WifiModulationClass GetMaxModulationClassSupported() const
void SetRxGain(dB_u gain)
Sets the reception gain.
virtual void SetInterferenceHelper(const Ptr< InterferenceHelper > helper)
Sets the interference helper.
uint8_t m_txSpatialStreams
Number of supported TX spatial streams.
Ptr< UniformRandomVariable > m_random
Provides uniform random variables.
Ptr< WifiRadioEnergyModel > m_wifiRadioEnergyModel
Wifi radio energy model.
void SetRxNoiseFigure(dB_u noiseFigure)
Sets the RX loss in the Signal-to-Noise-Ratio due to non-idealities in the receiver.
void Configure80211ax()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11ax standard.
void SetRxSensitivity(dBm_u threshold)
Sets the receive sensitivity threshold.
Time m_channelSwitchDelay
Time required to switch between channel.
dB_u GetTxGain() const
Return the transmission gain.
void SetTxPowerEnd(dBm_u end)
Sets the maximum available transmission power level.
dBm_per_MHz_u m_powerDensityLimit
the power density limit
WifiPhyOperatingChannel m_operatingChannel
Operating channel.
TracedCallback< Ptr< const Packet > > m_phyTxDropTrace
The trace source fired when the PHY layer drops a packet as it tries to transmit it.
void SetErrorRateModel(const Ptr< ErrorRateModel > model)
Sets the error rate model.
bool m_channelAccessRequested
Flag if channels access has been requested (used for OBSS_PD SR)
Time GetSlot() const
Return the slot duration for this PHY.
void SetMaxSupportedRxSpatialStreams(uint8_t streams)
void Configure80211g()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11g standard.
uint8_t GetPrimary20Index() const
dBm_u m_rxSensitivity
Receive sensitivity threshold.
uint8_t GetNumberOfAntennas() const
Time m_slot
Slot duration.
dBm_u GetRxSensitivity() const
Return the receive sensitivity threshold.
bool GetShortPhyPreambleSupported() const
Return whether short PHY preamble is supported.
void SetSifs(Time sifs)
Set the Short Interframe Space (SIFS) for this PHY.
void Configure80211n()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11n standard.
dBm_u m_ccaSensitivityThreshold
Clear channel assessment (CCA) modulation and coding rate sensitivity threshold.
void Configure80211be()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11be standard.
Time GetSifs() const
Return the Short Interframe Space (SIFS) for this PHY.
bool m_notifyRxMacHeaderEnd
whether the PHY is capable of notifying MAC header RX end
std::tuple< uint8_t, MHz_u, WifiPhyBand, uint8_t > ChannelTuple
Tuple identifying a segment of an operating channel.
MHz_u GetFrequency() const
Ptr< MobilityModel > GetMobility() const
Return the mobility model this PHY is associated with.
Time m_blockAckTxTime
estimated BlockAck TX time
void SetTxPowerStart(dBm_u start)
Sets the minimum available transmission power level.
void Configure80211p()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11p standard.
dBm_u m_txPowerEnd
Maximum transmission power.
void AbortCurrentReception(WifiPhyRxfailureReason reason)
Due to newly arrived signal, the current reception cannot be continued and has to be aborted.
Ptr< FrameCaptureModel > m_frameCaptureModel
Frame capture model.
TracedCallback< Ptr< const Packet > > m_phyRxEndTrace
The trace source fired when a packet ends the reception process from the medium.
Time GetChannelSwitchDelay() const
void SetTxGain(dB_u gain)
Sets the transmission gain.
void SetMaxSupportedTxSpatialStreams(uint8_t streams)
Time m_sifs
Short Interframe Space (SIFS) duration.
void SetReceiveErrorCallback(RxErrorCallback callback)
TracedCallback< Ptr< const WifiPpdu >, const WifiTxVector & > m_signalTransmissionCb
Signal Transmission callback.
dBm_u GetTxPowerEnd() const
Return the maximum available transmission power level.
uint8_t GetMaxSupportedRxSpatialStreams() const
virtual void ConfigureStandard(WifiStandard standard)
Configure the PHY-level parameters for different Wi-Fi standard.
void SetPostReceptionErrorModel(const Ptr< ErrorModel > em)
Attach a receive ErrorModel to the WifiPhy.
uint8_t m_numberOfAntennas
Number of transmitters.
TracedCallback< Ptr< const WifiPpdu >, WifiPhyRxfailureReason > m_phyRxPpduDropTrace
The trace source fired when the PHY layer drops a packet it has received.
dBm_u GetCcaEdThreshold() const
Return the CCA energy detection threshold.
Ptr< WifiPhyStateHelper > GetState() const
Return the WifiPhyStateHelper of this PHY.
dBm_u m_txPowerBase
Minimum transmission power.
virtual Ptr< Channel > GetChannel() const =0
Return the Channel this WifiPhy is connected to.
void SetShortPhyPreambleSupported(bool preamble)
Enable or disable short PHY preamble.
void SetNTxPower(uint8_t n)
Sets the number of transmission power levels available between the minimum level and the maximum leve...
void SetCcaSensitivityThreshold(dBm_u threshold)
Sets the CCA sensitivity threshold.
WifiPhyBand m_band
WifiPhyBand.
static const Ptr< const PhyEntity > GetStaticPhyEntity(WifiModulationClass modulation)
Get the implemented PHY entity corresponding to the modulation class.
TracedCallback< Ptr< const Packet >, uint16_t, WifiTxVector, MpduInfo, uint16_t > m_phyMonitorSniffTxTrace
A trace source that emulates a Wi-Fi device in monitor mode sniffing a packet being transmitted.
std::map< WifiModulationClass, Ptr< PhyEntity > > m_phyEntities
This map holds the supported PHY entities.
MHz_u GetTxBandwidth(WifiMode mode, MHz_u maxAllowedBandWidth=MHz_u{ std::numeric_limits< double >::max()}) const
Get the bandwidth for a transmission occurring on the current operating channel and using the given W...
void SetMaxModulationClassSupported(WifiModulationClass modClass)
Set the maximum modulation class that has to be supported by this PHY object.
void AddPhyEntity(WifiModulationClass modulation, Ptr< PhyEntity > phyEntity)
Add the PHY entity to the map of supported PHY entities for the given modulation class for the WifiPh...
TracedCallback< Ptr< const Packet >, uint16_t, WifiTxVector, MpduInfo, SignalNoiseDbm, uint16_t > m_phyMonitorSniffRxTrace
A trace source that emulates a Wi-Fi device in monitor mode sniffing a packet being received.
Ptr< ErrorModel > m_postReceptionErrorModel
Error model for receive packet events.
void RegisterListener(const std::shared_ptr< WifiPhyListener > &listener)
static std::map< WifiModulationClass, Ptr< PhyEntity > > & GetStaticPhyEntities()
void SetSlot(Time slot)
Set the slot duration for this PHY.
WifiPhyBand GetPhyBand() const
Get the configured Wi-Fi band.
Ptr< PhyEntity > GetPhyEntity(WifiModulationClass modulation) const
Get the supported PHY entity corresponding to the modulation class.
uint8_t GetChannelNumber() const
Return current channel number.
TracedCallback< Ptr< const Packet > > m_phyTxEndTrace
The trace source fired when a packet ends the transmission process on the medium.
std::optional< Time > GetDelayUntilChannelSwitch()
Perform any actions necessary when user changes operating channel after initialization.
void SetWifiRadioEnergyModel(const Ptr< WifiRadioEnergyModel > wifiRadioEnergyModel)
Sets the wifi radio energy model.
TracedCallback< Ptr< const Packet >, double > m_phyTxBeginTrace
The trace source fired when a packet begins the transmission process on the medium.
virtual void SetDevice(const Ptr< WifiNetDevice > device)
Sets the device this PHY is associated with.
Ptr< PreambleDetectionModel > m_preambleDetectionModel
Preamble detection model.
Time GetPifs() const
Return the PCF Interframe Space (PIFS) for this PHY.
static void AddStaticPhyEntity(WifiModulationClass modulation, Ptr< PhyEntity > phyEntity)
Add the PHY entity to the map of implemented PHY entities for the given modulation class.
TracedCallback< WifiConstPsduMap, WifiTxVector, double > m_phyTxPsduBeginTrace
The trace source fired when a PSDU map begins the transmission process on the medium.
std::vector< ChannelTuple > ChannelSegments
segments identifying an operating channel
dB_u m_txGain
Transmission gain.
MHz_u GetChannelWidth() const
void SetOperatingChannel(const WifiPhyOperatingChannel &channel)
If the standard for this object has not been set yet, store the channel settings corresponding to the...
Ptr< WifiNetDevice > GetDevice() const
Return the device this PHY is associated with.
WifiStandard m_standard
WifiStandard.
uint8_t m_nTxPower
Number of available transmission power levels.
void DoDispose() override
Destructor implementation.
dB_u GetRxGain() const
Return the reception gain.
void SetPhyId(uint8_t phyId)
Set the index allocated to this PHY.
virtual void DoChannelSwitch()
Actually switch channel based on the stored channel settings.
TracedCallback< Ptr< const Packet >, WifiPhyRxfailureReason > m_phyRxDropTrace
The trace source fired when the PHY layer drops a packet it has received.
void SetPreambleDetectionModel(const Ptr< PreambleDetectionModel > preambleDetectionModel)
Sets the preamble detection model.
uint8_t m_phyId
the index of the PHY in the vector of PHYs held by the WifiNetDevice
void SetPifs(Time pifs)
Set the PCF Interframe Space (PIFS) for this PHY.
void Configure80211b()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11b standard.
void SetCcaEdThreshold(dBm_u threshold)
Sets the CCA energy detection threshold.
dB_u m_noiseFigure
The noise figure.
void SwitchMaybeToCcaBusy(const Ptr< const WifiPpdu > ppdu=nullptr)
Check if PHY state should move to CCA busy state based on current state of interference tracker.
void SetMobility(const Ptr< MobilityModel > mobility)
assign a mobility model to this device
dB_u m_rxGain
Reception gain.
double CalculateSnr(const WifiTxVector &txVector, double ber) const
void SetFixedPhyBand(bool enable)
Configure whether it is prohibited to change PHY band after initialization.
void Configure80211ac()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11ac standard.
bool HasFixedPhyBand() const
TracedCallback< Ptr< const Packet >, RxPowerWattPerChannelBand > m_phyRxBeginTrace
The trace source fired when a packet begins the reception process from the medium.
Ptr< WifiNetDevice > m_device
Pointer to the device.
Ptr< InterferenceHelper > m_interference
Pointer to a helper responsible for interference computations.
void DoInitialize() override
Initialize() implementation.
bool m_shortPreamble
Flag if short PHY preamble is supported.
uint8_t GetPhyId() const
Get the index allocated to this PHY.
Time m_pifs
PCF Interframe Space (PIFS) duration.
WifiModulationClass m_maxModClassSupported
max modulation class supported
WifiStandard GetStandard() const
Get the configured Wi-Fi standard.
void SetCapabilitiesChangedCallback(Callback< void > callback)
void SetReceiveOkCallback(RxOkCallback callback)
void SetFrameCaptureModel(const Ptr< FrameCaptureModel > frameCaptureModel)
Sets the frame capture model.
bool m_powerRestricted
Flag whether transmit power is restricted by OBSS PD SR.
Callback< void > m_capabilitiesChangedCallback
Callback when PHY capabilities changed.
Ptr< PhyEntity > GetPhyEntityForPpdu(const Ptr< const WifiPpdu > ppdu) const
Get the supported PHY entity to use for a received PPDU.
Time GetAckTxTime() const
Return the estimated Ack TX time for this PHY.
void Reset()
Reset data upon end of TX or RX.
TracedCallback< WifiTxVector, Time > m_phyRxPayloadBeginTrace
The trace source fired when the reception of the PHY payload (PSDU) begins.
TracedCallback< const WifiMacHeader &, const WifiTxVector &, Time > m_phyRxMacHeaderEndTrace
The trace source fired when the reception of a MAC header ends.
uint8_t GetMaxSupportedTxSpatialStreams() const
void Configure80211a()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11a standard.
ChannelSegments m_channelSettings
Store operating channel settings until initialization.
const WifiPhyOperatingChannel & GetOperatingChannel() const
Get a const reference to the operating channel.
dBm_u GetPower(uint8_t powerLevel) const
Get the power of the given power level.
bool m_fixedPhyBand
True to prohibit changing PHY band after initialization.
Ptr< PhyEntity > GetLatestPhyEntity() const
Get the latest PHY entity supported by this PHY instance.
uint8_t GetNTxPower() const
Return the number of available transmission power levels.
Time m_ackTxTime
estimated Ack TX time
void UnregisterListener(const std::shared_ptr< WifiPhyListener > &listener)
dBm_u GetCcaSensitivityThreshold() const
Return the CCA sensitivity threshold.
Class that keeps track of all information about the current PHY operating channel.
MHz_u GetTotalWidth() const
Return the width of the whole operating channel.
bool IsSet() const
Return true if a valid channel has been set, false otherwise.
uint8_t GetNumber(std::size_t segment=0) const
Return the channel number for a given frequency segment.
static uint8_t GetDefaultChannelNumber(MHz_u width, WifiStandard standard, WifiPhyBand band, std::optional< uint8_t > previousChannelNumber=std::nullopt)
Get the default channel number for a given segment of the given width and for the given standard and ...
uint8_t GetPrimaryChannelIndex(MHz_u primaryChannelWidth) const
If the operating channel width is a multiple of 20 MHz, return the index of the primary channel of th...
MHz_u GetFrequency(std::size_t segment=0) const
Return the center frequency for a given frequency segment.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
bool IsValid(WifiPhyBand band=WIFI_PHY_BAND_UNSPECIFIED) const
The standard disallows certain combinations of WifiMode, number of spatial streams,...
uint8_t GetNssTotal() const
WifiModulationClass GetModulationClass() const
Get the modulation class specified by this TXVECTOR.
uint8_t GetNss(uint16_t staId=SU_STA_ID) const
If this TX vector is associated with an SU PPDU, return the number of spatial streams.
uint8_t GetNssMax() const
uint8_t GetTxPowerLevel() const
bool IsAggregation() const
Checks whether the PSDU contains A-MPDU.
bool IsDlMuMimo() const
Return true if this TX vector is used for a downlink multi-user transmission using MU-MIMO.
static void Send(Ptr< NetDevice > dev, int level, std::string emuMode)
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Ptr< AttributeChecker > MakeAttributeContainerChecker()
Make uninitialized AttributeContainerChecker using explicit types.
Ptr< const AttributeAccessor > MakeAttributeContainerAccessor(T1 a1)
Make AttributeContainerAccessor using explicit types.
Ptr< const AttributeChecker > MakeBooleanChecker()
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeChecker > MakeDoubleChecker()
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< AttributeChecker > MakePointerChecker()
Create a PointerChecker for a type.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.
Ptr< const AttributeChecker > MakeTupleChecker(Ts... checkers)
Create a TupleChecker from AttributeCheckers associated with TupleValue elements.
Ptr< const AttributeChecker > MakeUintegerChecker()
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
#define NS_ABORT_MSG_UNLESS(cond, msg)
Abnormal program termination if a condition is false, with a message.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#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_ABORT_IF(cond)
Abnormal program termination if a condition is true.
#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(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time Seconds(double value)
Construct a Time in the indicated unit.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
WifiStandard
Identifies the IEEE 802.11 specifications that a Wifi device can be configured to use.
WifiPhyRxfailureReason
Enumeration of the possible reception failure reasons.
WifiPhyBand
Identifies the PHY band.
WifiModulationClass
This enumeration defines the modulation classes per (Table 10-6 "Modulation classes"; IEEE 802....
MpduType
The type of an MPDU.
@ WIFI_STANDARD_UNSPECIFIED
@ SIGNAL_DETECTION_ABORTED_BY_TX
@ RECEPTION_ABORTED_BY_TX
@ WIFI_PHY_BAND_6GHZ
The 6 GHz band.
@ WIFI_PHY_BAND_UNSPECIFIED
Unspecified.
@ WIFI_PHY_BAND_2_4GHZ
The 2.4 GHz band.
@ WIFI_PHY_BAND_5GHZ
The 5 GHz band.
@ WIFI_MOD_CLASS_OFDM
OFDM (Clause 17)
@ WIFI_MOD_CLASS_HR_DSSS
HR/DSSS (Clause 16)
@ WIFI_MOD_CLASS_UNKNOWN
Modulation class unknown or unspecified.
@ WIFI_MOD_CLASS_HT
HT (Clause 19)
@ WIFI_MOD_CLASS_EHT
EHT (Clause 36)
@ WIFI_MOD_CLASS_VHT
VHT (Clause 22)
@ WIFI_MOD_CLASS_HE
HE (Clause 27)
@ WIFI_MOD_CLASS_DSSS
DSSS (Clause 15)
@ WIFI_MOD_CLASS_ERP_OFDM
ERP-OFDM (18.4)
@ LAST_MPDU_IN_AGGREGATE
The MPDU is the last aggregate in an A-MPDU with multiple MPDUs.
@ NORMAL_MPDU
The MPDU is not part of an A-MPDU.
@ FIRST_MPDU_IN_AGGREGATE
The MPDU is the first aggregate in an A-MPDU with multiple MPDUs, but is not the last aggregate.
@ SINGLE_MPDU
The MPDU is a single MPDU.
@ MIDDLE_MPDU_IN_AGGREGATE
The MPDU is part of an A-MPDU with multiple MPDUs, but is neither the first nor the last aggregate.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
U * PeekPointer(const Ptr< U > &p)
@ SWITCHING
The PHY layer is switching to other channel.
@ TX
The PHY layer is sending a packet.
@ IDLE
The PHY layer is IDLE.
@ CCA_BUSY
The PHY layer has sense the medium busy through the CCA mechanism.
@ SLEEP
The PHY layer is sleeping.
@ RX
The PHY layer is receiving a packet.
dB_u RatioToDb(double ratio)
Convert from ratio to dB.
double MHz_u
MHz weak type.
Ptr< const AttributeChecker > MakeEnumChecker(T v, std::string n, Ts... args)
Make an EnumChecker pre-configured with a set of allowed values by name.
MHz_u GetDefaultChannelWidth(WifiStandard standard, WifiPhyBand band)
Get the default channel width for the given PHY standard and band.
std::map< WifiSpectrumBandInfo, Watt_u > RxPowerWattPerChannelBand
A map of the received power for each band.
MHz_u GetMaximumChannelWidth(WifiModulationClass modulation)
Get the maximum channel width allowed for the given modulation class.
double dBm_u
dBm weak type
double DbToRatio(dB_u val)
Convert from dB to ratio.
Watt_u DbmToW(dBm_u val)
Convert from dBm to Watts.
WifiPhyBand GetDefaultPhyBand(WifiStandard standard)
Get the default PHY band for the given standard.
WifiModulationClass GetModulationClassForStandard(WifiStandard standard)
Return the modulation class corresponding to a given standard.
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
std::ostream & operator<<(std::ostream &os, const PairObject &obj)
Stream insertion operator.
MpduType type
type of MPDU
uint32_t mpduRefNumber
MPDU ref number.
RxSignalInfo structure containing info on the received signal.
double snr
SNR in linear scale.
SignalNoiseDbm structure.
Declaration of ns3::WifiPpdu class and ns3::WifiConstPsduMap.