23 #include "ns3/simulator.h" 25 #include "ns3/pointer.h" 26 #include "ns3/mobility-model.h" 27 #include "ns3/random-variable-stream.h" 28 #include "ns3/error-model.h" 292 .SetGroupName (
"Wifi")
293 .AddAttribute (
"Frequency",
294 "The operating center frequency (MHz)",
298 MakeUintegerChecker<uint16_t> ())
299 .AddAttribute (
"ChannelWidth",
300 "Whether 5MHz, 10MHz, 20MHz, 22MHz, 40MHz, 80 MHz or 160 MHz.",
304 MakeUintegerChecker<uint16_t> (5, 160))
305 .AddAttribute (
"ChannelNumber",
306 "If set to non-zero defined value, will control Frequency and ChannelWidth assignment",
310 MakeUintegerChecker<uint8_t> (0, 233))
311 .AddAttribute (
"RxSensitivity",
312 "The energy of a received signal should be higher than " 313 "this threshold (dBm) for the PHY to detect the signal.",
317 MakeDoubleChecker<double> ())
318 .AddAttribute (
"CcaEdThreshold",
319 "The energy of a non Wi-Fi received signal should be higher than " 320 "this threshold (dBm) to allow the PHY layer to declare CCA BUSY state. " 321 "This check is performed on the 20 MHz primary channel only.",
325 MakeDoubleChecker<double> ())
326 .AddAttribute (
"TxGain",
327 "Transmission gain (dB).",
331 MakeDoubleChecker<double> ())
332 .AddAttribute (
"RxGain",
333 "Reception gain (dB).",
337 MakeDoubleChecker<double> ())
338 .AddAttribute (
"TxPowerLevels",
339 "Number of transmission power levels available between " 340 "TxPowerStart and TxPowerEnd included.",
343 MakeUintegerChecker<uint8_t> ())
344 .AddAttribute (
"TxPowerEnd",
345 "Maximum available transmission level (dBm).",
349 MakeDoubleChecker<double> ())
350 .AddAttribute (
"TxPowerStart",
351 "Minimum available transmission level (dBm).",
355 MakeDoubleChecker<double> ())
356 .AddAttribute (
"RxNoiseFigure",
357 "Loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in the receiver." 358 " According to Wikipedia (http://en.wikipedia.org/wiki/Noise_figure), this is " 359 "\"the difference in decibels (dB) between" 360 " the noise output of the actual receiver to the noise output of an " 361 " ideal receiver with the same overall gain and bandwidth when the receivers " 362 " are connected to sources at the standard noise temperature T0 (usually 290 K)\".",
365 MakeDoubleChecker<double> ())
366 .AddAttribute (
"State",
367 "The state of the PHY layer.",
370 MakePointerChecker<WifiPhyStateHelper> ())
371 .AddAttribute (
"ChannelSwitchDelay",
372 "Delay between two short frames transmitted on different frequencies.",
376 .AddAttribute (
"Antennas",
377 "The number of antennas on the device.",
381 MakeUintegerChecker<uint8_t> (1, 8))
382 .AddAttribute (
"MaxSupportedTxSpatialStreams",
383 "The maximum number of supported TX spatial streams." 384 "This parameter is only valuable for 802.11n/ac/ax STAs and APs.",
388 MakeUintegerChecker<uint8_t> (1, 8))
389 .AddAttribute (
"MaxSupportedRxSpatialStreams",
390 "The maximum number of supported RX spatial streams." 391 "This parameter is only valuable for 802.11n/ac/ax STAs and APs.",
395 MakeUintegerChecker<uint8_t> (1, 8))
396 .AddAttribute (
"ShortPlcpPreambleSupported",
397 "Whether or not short PHY preamble is supported." 398 "This parameter is only valuable for 802.11b STAs and APs." 399 "Note: 802.11g APs and STAs always support short PHY preamble.",
404 .AddAttribute (
"FrameCaptureModel",
405 "Ptr to an object that implements the frame capture model",
408 MakePointerChecker <FrameCaptureModel> ())
409 .AddAttribute (
"PreambleDetectionModel",
410 "Ptr to an object that implements the preamble detection model",
413 MakePointerChecker <PreambleDetectionModel> ())
414 .AddAttribute (
"PostReceptionErrorModel",
415 "An optional packet error model can be added to the receive " 416 "packet process after any propagation-based (SNR-based) error " 417 "models have been applied. Typically this is used to force " 418 "specific packet drops, for testing purposes.",
421 MakePointerChecker<ErrorModel> ())
422 .AddAttribute (
"Sifs",
423 "The duration of the Short Interframe Space. " 424 "NOTE that the default value is overwritten by the value defined " 425 "by the standard; if you want to set this attribute, you have to " 426 "do it after that the PHY object is initialized.",
430 .AddAttribute (
"Slot",
431 "The duration of a slot. " 432 "NOTE that the default value is overwritten by the value defined " 433 "by the standard; if you want to set this attribute, you have to " 434 "do it after that the PHY object is initialized.",
438 .AddAttribute (
"Pifs",
439 "The duration of the PCF Interframe Space. " 440 "NOTE that the default value is overwritten by the value defined " 441 "by the standard; if you want to set this attribute, you have to " 442 "do it after that the PHY object is initialized.",
446 .AddTraceSource (
"PhyTxBegin",
447 "Trace source indicating a packet " 448 "has begun transmitting over the channel medium",
450 "ns3::Packet::TracedCallback")
451 .AddTraceSource (
"PhyTxPsduBegin",
452 "Trace source indicating a PSDU " 453 "has begun transmitting over the channel medium",
455 "ns3::WifiPhy::PsduTxBeginCallback")
456 .AddTraceSource (
"PhyTxEnd",
457 "Trace source indicating a packet " 458 "has been completely transmitted over the channel.",
460 "ns3::Packet::TracedCallback")
461 .AddTraceSource (
"PhyTxDrop",
462 "Trace source indicating a packet " 463 "has been dropped by the device during transmission",
465 "ns3::Packet::TracedCallback")
466 .AddTraceSource (
"PhyRxBegin",
467 "Trace source indicating a packet " 468 "has begun being received from the channel medium " 471 "ns3::Packet::TracedCallback")
472 .AddTraceSource (
"PhyRxPayloadBegin",
473 "Trace source indicating the reception of the " 474 "payload of a PPDU has begun",
476 "ns3::WifiPhy::PhyRxPayloadBeginTracedCallback")
477 .AddTraceSource (
"PhyRxEnd",
478 "Trace source indicating a packet " 479 "has been completely received from the channel medium " 482 "ns3::Packet::TracedCallback")
483 .AddTraceSource (
"PhyRxDrop",
484 "Trace source indicating a packet " 485 "has been dropped by the device during reception",
487 "ns3::Packet::TracedCallback")
488 .AddTraceSource (
"MonitorSnifferRx",
489 "Trace source simulating a wifi device in monitor mode " 490 "sniffing all received frames",
492 "ns3::WifiPhy::MonitorSnifferRxTracedCallback")
493 .AddTraceSource (
"MonitorSnifferTx",
494 "Trace source simulating the capability of a wifi device " 495 "in monitor mode to sniff all frames being transmitted",
497 "ns3::WifiPhy::MonitorSnifferTxTracedCallback")
498 .AddTraceSource (
"EndOfHePreamble",
499 "Trace source indicating the end of the 802.11ax preamble (after training fields)",
501 "ns3::WifiPhy::EndOfHePreambleTracedCallback")
507 : m_txMpduReferenceNumber (0xffffffff),
508 m_rxMpduReferenceNumber (0xffffffff),
511 m_endPreambleDetectionEvent (),
515 m_isConstructed (false),
516 m_channelCenterFrequency (0),
517 m_initialFrequency (0),
518 m_frequencyChannelNumberInitialized (false),
524 m_blockAckTxTime (
Seconds (0)),
525 m_powerRestricted (false),
526 m_channelAccessRequested (false),
527 m_txSpatialStreams (0),
528 m_rxSpatialStreams (0),
530 m_initialChannelNumber (0),
532 m_wifiRadioEnergyModel (0),
533 m_timeLastPreambleDetected (
Seconds (0))
536 m_random = CreateObject<UniformRandomVariable> ();
537 m_state = CreateObject<WifiPhyStateHelper> ();
585 m_state->SetReceiveOkCallback (callback);
591 m_state->SetReceiveErrorCallback (callback);
597 m_state->RegisterListener (listener);
603 m_state->UnregisterListener (listener);
938 NS_LOG_WARN (
"Configuring unspecified standard; performing no action");
1094 NS_FATAL_ERROR (
"802.11p configured with a wrong channel width!");
1135 m_mcsIndexMap[mode.GetModulationClass ()][mode.GetMcsValue ()] = index++;
1144 bool htFound =
false;
1280 NS_LOG_FUNCTION (
this << +channelNumber << band << standard << frequency << channelWidth);
1282 ChannelToFrequencyWidthMap::const_iterator it;
1286 NS_LOG_DEBUG (
"channel number/standard already defined; returning false");
1303 if (it->second ==
f)
1312 NS_LOG_DEBUG (
"Found, returning " << +it->first.first.first);
1313 return (it->first.first.first);
1333 NS_LOG_DEBUG (
"Frequency set; checking whether a channel number corresponds");
1335 if (channelNumberSearched)
1337 NS_LOG_DEBUG (
"Channel number found; setting to " << +channelNumberSearched);
1342 NS_LOG_DEBUG (
"Channel number not found; setting to zero");
1356 NS_LOG_DEBUG (
"Falling back to check WIFI_PHY_STANDARD_UNSPECIFIED");
1365 NS_LOG_DEBUG (
"Setting frequency to " <<
f.first <<
"; width to " << +
f.second);
1444 NS_LOG_DEBUG (
"Saving frequency configuration for initialization");
1456 NS_LOG_DEBUG (
"Setting frequency and channel number to zero");
1467 NS_LOG_DEBUG (
"Setting frequency " << frequency <<
" corresponds to channel " << +nch);
1470 NS_LOG_DEBUG (
"Channel frequency switched to " << frequency <<
"; channel number to " << +nch);
1476 NS_LOG_DEBUG (
"Suppressing reassignment of frequency");
1481 NS_LOG_DEBUG (
"Channel number is unknown for frequency " << frequency);
1484 NS_LOG_DEBUG (
"Channel frequency switched to " << frequency <<
"; channel number to " << 0);
1490 NS_LOG_DEBUG (
"Suppressing reassignment of frequency");
1505 NS_ASSERT_MSG (channelWidth == 5 || channelWidth == 10 || channelWidth == 20 || channelWidth == 22 || channelWidth == 40 || channelWidth == 80 || channelWidth == 160,
"wrong channel width value");
1524 NS_ASSERT_MSG (antennas > 0 && antennas <= 4,
"unsupported number of antennas");
1595 NS_LOG_FUNCTION (
"Adding " << width <<
" to supported channel width set");
1599 std::vector<uint16_t>
1619 NS_LOG_DEBUG (
"Saving channel number configuration for initialization");
1649 NS_LOG_DEBUG (
"Setting frequency to " <<
f.first <<
"; width to " << +
f.second);
1662 NS_FATAL_ERROR (
"Frequency not found for channel number " << +nch);
1688 NS_LOG_DEBUG (
"drop packet because of channel switching while reception");
1695 NS_LOG_DEBUG (
"channel switching postponed until end of current transmission");
1708 NS_LOG_DEBUG (
"channel switching ignored in sleep mode");
1748 NS_LOG_DEBUG (
"drop packet because of channel/frequency switching while reception");
1752 goto switchFrequency;
1755 NS_LOG_DEBUG (
"channel/frequency switching postponed until end of current transmission");
1765 goto switchFrequency;
1768 NS_LOG_DEBUG (
"frequency switching ignored in sleep mode");
1801 NS_LOG_DEBUG (
"setting sleep mode postponed until end of current transmission");
1805 NS_LOG_DEBUG (
"setting sleep mode postponed until end of current reception");
1809 NS_LOG_DEBUG (
"setting sleep mode postponed until end of channel switching");
1851 NS_LOG_DEBUG (
"not in sleep mode, there is nothing to resume");
1859 m_state->SwitchFromSleep (delayUntilCcaEnd);
1883 NS_LOG_DEBUG (
"not in off mode, there is nothing to resume");
1891 m_state->SwitchFromOff (delayUntilCcaEnd);
1929 uint8_t Ndltf, Neltf;
2154 NS_FATAL_ERROR (
"modulation class is not matching the preamble type");
2230 NS_FATAL_ERROR (
"modulation class is not matching the preamble type");
2255 uint32_t totalAmpduSize;
2256 double totalAmpduNumSymbols;
2257 return GetPayloadDuration (size, txVector, band, mpdutype,
false, totalAmpduSize, totalAmpduNumSymbols, staId);
2262 bool incFlag, uint32_t &totalAmpduSize,
double &totalAmpduNumSymbols,
2292 && txVector.
GetNss (staId) == 3
2298 && txVector.
GetNss (staId) == 2
2304 && txVector.
GetNss (staId) == 3
2310 && txVector.
GetNss (staId) == 3
2316 && txVector.
GetNss (staId) == 4
2322 && txVector.
GetNss (staId) == 4
2333 && txVector.
GetNss (staId) == 2
2339 && txVector.
GetNss (staId) == 2
2345 && txVector.
GetNss (staId) == 3
2351 && txVector.
GetNss (staId) == 3
2357 && txVector.
GetNss (staId) == 3
2363 && txVector.
GetNss (staId) == 4
2369 && txVector.
GetNss (staId) == 4
2375 && txVector.
GetNss (staId) == 4
2381 && txVector.
GetNss (staId) == 4
2426 NS_ASSERT (gi == 800 || gi == 1600 || gi == 3200);
2436 double numSymbols = 0;
2440 numSymbols = (stbc * (16 + size * 8.0 + 6 * Nes) / (stbc * numDataBitsPerSymbol));
2443 totalAmpduSize += size;
2444 totalAmpduNumSymbols += numSymbols;
2450 numSymbols = (stbc * size * 8.0) / (stbc * numDataBitsPerSymbol);
2453 totalAmpduSize += size;
2454 totalAmpduNumSymbols += numSymbols;
2460 uint32_t totalSize = totalAmpduSize + size;
2461 numSymbols = lrint (stbc * ceil ((16 + totalSize * 8.0 + 6 * Nes) / (stbc * numDataBitsPerSymbol)));
2462 NS_ASSERT (totalAmpduNumSymbols <= numSymbols);
2463 numSymbols -= totalAmpduNumSymbols;
2467 totalAmpduNumSymbols = 0;
2475 numSymbols = lrint (stbc * ceil ((16 + size * 8.0 + 6.0 * Nes) / (stbc * numDataBitsPerSymbol)));
2558 for (
auto & staIdPsdu : psduMap)
2563 NS_ABORT_MSG_IF (userInfoMap.find (staIdPsdu.first) == userInfoMap.end (),
"STA-ID in psduMap (" << staIdPsdu.first <<
") should be referenced in txVector");
2566 if (current > maxDuration)
2568 maxDuration = current;
2578 for (
auto const& psdu : psdus)
2590 for (
auto const& psdu : psdus)
2646 SignalNoiseDbm signalNoise, std::vector<bool> statusPerMpdu, uint16_t staId)
2655 NS_ASSERT_MSG (statusPerMpdu.size () == nMpdus,
"Should have one reception status per MPDU");
2657 for (
size_t i = 0; i < nMpdus;)
2659 if (statusPerMpdu.at (i))
2670 NS_ASSERT_MSG (statusPerMpdu.size () == 1,
"Should have one reception status for normal MPDU");
2686 for (
size_t i = 0; i < nMpdus;)
2711 psdus.insert (std::make_pair (
SU_STA_ID, psdu));
2712 Send (psdus, txVector);
2735 NS_LOG_DEBUG (
"Dropping packet because in sleep mode");
2736 for (
auto const& psdu : psdus)
2762 NS_LOG_DEBUG (
"Transmitting without power restriction");
2767 NS_LOG_DEBUG (
"Transmission canceled because device is OFF");
2774 for (
auto const& psdu : psdus)
2784 ppdu->SetTruncatedTx ();
2805 uint16_t channelWidth;
2806 if (event->GetTxVector ().GetChannelWidth () >= 40)
2812 channelWidth =
event->GetTxVector ().GetChannelWidth ();
2814 auto band =
GetBand (channelWidth);
2816 double snr = snrPer.
snr;
2830 m_state->SwitchMaybeToCcaBusy (remainingPreambleHeaderDuration);
2837 m_state->SwitchMaybeToCcaBusy (remainingPreambleAndNonHtHeaderDuration);
2843 NS_LOG_DEBUG (
"Drop packet because PHY preamble detection failed");
2863 uint16_t channelWidth;
2864 if (event->GetTxVector ().GetChannelWidth () >= 40)
2870 channelWidth =
event->GetTxVector ().GetChannelWidth ();
2880 m_state->SwitchMaybeToCcaBusy (remainingRxDuration);
2886 NS_LOG_DEBUG (
"Abort reception because non-HT PHY header reception failed");
2899 auto it = std::max_element (rxPowersW.begin (), rxPowersW.end (),
2900 [] (
const std::pair<WifiSpectrumBand, double>& p1,
const std::pair<WifiSpectrumBand, double>& p2) {
2901 return p1.second < p2.second;
2905 Time rxDuration = ppdu->GetTxDuration ();
2911 NS_LOG_DEBUG (
"Cannot start RX because device is OFF");
2919 if (ppdu->IsTruncatedTx ())
2921 NS_LOG_DEBUG (
"Packet reception stopped because transmitter has been switched off");
2932 NS_LOG_DEBUG (
"drop packet because of unsupported RX mode");
2944 NS_LOG_DEBUG (
"drop packet because of channel switching");
3044 if (!delayUntilCcaEnd.
IsZero ())
3046 m_state->SwitchMaybeToCcaBusy (delayUntilCcaEnd);
3056 bool canReceivePayload =
false;
3060 uint16_t primaryChannelWidth =
std::min (event->GetTxVector ().GetChannelWidth (),
static_cast<uint16_t
> (20));
3061 auto primaryBand =
GetBand (primaryChannelWidth);
3071 canReceivePayload =
true;
3075 bool success =
false;
3076 if (canReceivePayload)
3088 if (info.first == staId)
3090 nss = info.second.nss;
3097 NS_LOG_DEBUG (
"Packet reception could not be started because not enough RX antennas");
3102 NS_LOG_DEBUG (
"Packet reception could not be started because not enough channel width");
3112 m_state->SwitchToRx (payloadDuration);
3120 NS_LOG_DEBUG (
"Drop packet because it was sent using an unsupported mode (" << txMode <<
")");
3127 NS_LOG_DEBUG (
"No PSDU addressed to that PHY in the received MU PPDU. The PPDU is filtered.");
3134 params.
rssiW =
event->GetRxPowerW (primaryBand);
3135 params.
bssColor =
event->GetTxVector ().GetBssColor ();
3141 NS_LOG_DEBUG (
"Drop packet because HT PHY header reception failed");
3170 Time remainingAmpduDuration = psduDuration;
3172 uint32_t totalAmpduSize = 0;
3173 double totalAmpduNumSymbols = 0.0;
3177 auto mpdu = psdu->
begin ();
3178 for (
size_t i = 0; i < nMpdus && mpdu != psdu->
end (); ++mpdu)
3182 totalAmpduSize, totalAmpduNumSymbols,
3185 remainingAmpduDuration -= mpduDuration;
3186 if (i == (nMpdus - 1) && !remainingAmpduDuration.IsZero ())
3188 mpduDuration += remainingAmpduDuration;
3191 endOfMpduDuration += mpduDuration;
3196 relativeStart += mpduDuration;
3204 NS_LOG_FUNCTION (
this << *event << mpduIndex << relativeStart << mpduDuration);
3211 std::pair<bool, SignalNoiseDbm> rxInfo =
GetReceptionStatus (psdu, event, staId, relativeStart, mpduDuration);
3213 ", correct reception: " << rxInfo.first <<
", Signal/Noise: " << rxInfo.second.signal <<
"/" << rxInfo.second.noise <<
"dBm");
3220 m_state->ContinueRxNextMpdu (
Copy (psdu), snr, event->GetTxVector ());
3227 Time psduDuration =
event->GetEndTime () -
event->GetStartTime ();
3253 band =
GetBand (channelWidth);
3273 std::pair<bool, SignalNoiseDbm>
3275 Time relativeMpduStart,
Time mpduDuration)
3277 NS_LOG_FUNCTION (
this << *psdu << *event << staId << relativeMpduStart << mpduDuration);
3288 band =
GetBand (channelWidth);
3292 WifiMode mode =
event->GetTxVector ().GetMode (staId);
3295 ", relativeStart = " << relativeMpduStart.
As (
Time::NS) <<
", duration = " << mpduDuration.
As (
Time::NS));
3302 signalNoise.
signal =
WToDbm (event->GetRxPowerW (band));
3303 signalNoise.noise =
WToDbm (event->GetRxPowerW (band) / snrPer.
snr);
3308 return std::make_pair (
true, signalNoise);
3313 return std::make_pair (
false, signalNoise);
3334 NS_ASSERT_MSG (
false,
"802.11ax can only be used with SpectrumWifiPhy");
3336 return convertedSubcarriers;
4259 for (uint8_t i = 0; i <
GetNModes (); i++)
4326 NS_ASSERT (mode.GetModulationClass () == modulation);
4535 return m_state->IsStateCcaBusy ();
4541 return m_state->IsStateIdle ();
4559 return m_state->IsStateSwitching ();
4565 return m_state->IsStateSleep ();
4571 return m_state->IsStateOff ();
4577 return m_state->GetDelayUntilIdle ();
4583 return m_state->GetLastRxStartTime ();
4589 return m_state->GetLastRxEndTime ();
4603 if (!delayUntilCcaEnd.
IsZero ())
4606 m_state->SwitchMaybeToCcaBusy (delayUntilCcaEnd);
4630 m_state->SwitchFromRxAbort ();
4638 NS_LOG_FUNCTION (
this << powerRestricted << txPowerMaxSiso << txPowerMaxMimo);
4672 auto primaryBand =
GetBand (primaryChannelWidth);
4673 double rxPowerW =
event->GetRxPowerW (primaryBand);
4676 NS_LOG_DEBUG (
"sync to signal (power=" << rxPowerW <<
"W)");
4682 Time remainingRxDuration =
event->GetDuration () - startOfPreambleDuration;
4687 NS_LOG_DEBUG (
"Received a stronger signal during preamble detection: drop current packet and switch to new packet");
4693 Time remainingRxDuration =
event->GetDuration () - startOfPreambleDuration;
4698 NS_LOG_DEBUG (
"Drop packet because RX is already decoding preamble");
4711 psdu = ppdu->GetPsdu ();
4715 uint8_t bssColor = 0;
4720 if (heConfiguration)
4723 heConfiguration->GetAttribute (
"BssColor", bssColorAttribute);
4724 bssColor = bssColorAttribute.
Get ();
4728 psdu = ppdu->GetPsdu (bssColor, staId);
4740 if (
mac &&
mac->IsAssociated ())
4742 return mac->GetAssociationId ();
static class anonymous_namespace{wifi-phy.cc}::Constructor g_constructor
the constructor
ERP-OFDM PHY (Clause 19, Section 19.5)
static WifiMode GetVhtMcs6()
Return MCS 6 from VHT MCS values.
void NotifyRxDrop(Ptr< const WifiPsdu > psdu, WifiPhyRxfailureReason reason)
Public method used to fire a PhyRxDrop trace.
static WifiMode GetOfdmRate9MbpsBW5MHz()
Return a WifiMode for OFDM at 9Mbps with 5MHz channel spacing.
Ptr< NetDevice > m_device
Pointer to the device.
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static WifiMode GetErpOfdmRate24Mbps()
Return a WifiMode for ERP-OFDM at 24Mbps.
uint8_t GetNTxPower(void) const
Return the number of available transmission power levels.
bool IsStateSwitching(void) const
static WifiMode GetDsssRate11Mbps()
Return a WifiMode for DSSS at 11Mbps.
void SetPifs(Time pifs)
Set the PCF Interframe Space (PIFS) for this PHY.
TimeWithUnit As(const enum Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
bool IsStateOff(void) const
FrequencyWidthPair GetFrequencyWidthForChannelNumberStandard(uint8_t channelNumber, WifiPhyBand band, WifiPhyStandard standard) const
Lookup frequency/width pair for channelNumber/standard pair.
TracedCallback< Ptr< const Packet >, RxPowerWattPerChannelBand > m_phyRxBeginTrace
The trace source fired when a packet begins the reception process from the medium.
uint8_t GetNssMax(void) const
bool IsAggregation(void) const
Checks whether the PSDU contains A-MPDU.
bool IsSingle(void) const
Return true if the PSDU is an S-MPDU.
Simulation virtual time values and global simulation resolution.
static WifiMode GetHeMcs7()
Return MCS 7 from HE MCS values.
void NotifyTxBegin(WifiConstPsduMap psdus, double txPowerW)
Public method used to fire a PhyTxBegin trace.
static WifiMode GetErpOfdmRate36Mbps()
Return a WifiMode for ERP-OFDM at 36Mbps.
std::vector< SubcarrierRange > SubcarrierGroup
a vector of subcarrier ranges defining a subcarrier group
Ptr< Packet > GetAmpduSubframe(std::size_t i) const
Get a copy of the i-th A-MPDU subframe (includes subframe header, MPDU, and possibly padding) ...
Smart pointer class similar to boost::intrusive_ptr.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
void SetNTxPower(uint8_t n)
Sets the number of transmission power levels available between the minimum level and the maximum leve...
Time GetEnergyDuration(double energyW, WifiSpectrumBand band) const
uint8_t m_channelNumber
Operating channel number.
double m_rxGainDb
Reception gain (dB)
static WifiMode GetVhtMcs8()
Return MCS 8 from VHT MCS values.
AttributeValue implementation for Boolean.
void SetNumberOfReceiveAntennas(uint8_t rx)
Set the number of RX antennas in the receiver corresponding to this interference helper.
Ptr< HeConfiguration > GetHeConfiguration(void) const
double GetRxGain(void) const
Return the reception gain (dB).
bool IsModeSupported(WifiMode mode) const
Check if the given WifiMode is supported by the PHY.
void AddSupportedChannelWidth(uint16_t width)
static WifiMode GetOfdmRate9Mbps()
Return a WifiMode for OFDM at 9Mbps.
double GetCcaEdThreshold(void) const
Return the CCA threshold (dBm).
Ptr< ErrorRateModel > GetErrorRateModel(void) const
Return the error rate model.
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
void NotifyTxEnd(WifiConstPsduMap psdus)
Public method used to fire a PhyTxEnd trace.
static WifiMode GetOfdmRate18MbpsBW10MHz()
Return a WifiMode for OFDM at 18Mbps with 10MHz channel spacing.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
static WifiMode GetOfdmRate27MbpsBW10MHz()
Return a WifiMode for OFDM at 27Mbps with 10MHz channel spacing.
double m_txGainDb
Transmission gain (dB)
WifiMode GetMcs(uint8_t mcs) const
The WifiPhy::GetMcs() method is used (e.g., by a WifiRemoteStationManager) to determine the set of tr...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
static WifiMode GetOfdmRate3MbpsBW5MHz()
Return a WifiMode for OFDM at 3Mbps with 5MHz channel spacing.
static WifiMode GetVhtMcs0()
Return MCS 0 from VHT MCS values.
void AbortCurrentReception(WifiPhyRxfailureReason reason)
Due to newly arrived signal, the current reception cannot be continued and has to be aborted...
void MaybeCcaBusyDuration(void)
Eventually switch to CCA busy.
struct InterferenceHelper::SnrPer CalculateNonHtPhyHeaderSnrPer(Ptr< Event > event, WifiSpectrumBand band) const
Calculate the SNIR at the start of the non-HT PHY header and accumulate all SNIR changes in the SNIR ...
static WifiMode GetDsssRate1Mbps()
Return a WifiMode for DSSS at 1Mbps.
void StartReceivePreamble(Ptr< WifiPpdu > ppdu, RxPowerWattPerChannelBand rxPowersW)
Start receiving the PHY preamble of a PPDU (i.e.
void ResumeFromOff(void)
Resume from off mode.
Ptr< WifiPhyStateHelper > GetState(void) const
Return the WifiPhyStateHelper of this PHY.
void ResumeFromSleep(void)
Resume from sleep mode.
std::size_t GetAmpduSubframeSize(std::size_t i) const
Return the size of the i-th A-MPDU subframe.
double m_rxSensitivityW
Receive sensitivity threshold in watts.
virtual WifiSpectrumBand ConvertHeRuSubcarriers(uint16_t channelWidth, HeRu::SubcarrierRange range) const
void ConfigureDefaultsForStandard(void)
Configure the PHY-level parameters for different Wi-Fi standard.
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
virtual uint16_t GetStaId(void) const
Return the STA ID that has been assigned to the station this PHY belongs to.
static WifiMode GetHeMcs5()
Return MCS 5 from HE MCS values.
WifiPhyBand GetPhyBand(void) const
Get the configured Wi-Fi band.
Ptr< const WifiPsdu > GetAddressedPsduInPpdu(Ptr< const WifiPpdu > ppdu) const
Get the PSDU addressed to that PHY in a PPDU (useful for MU PPDU).
Time m_timeLastPreambleDetected
Record the time the last preamble was detected.
static WifiMode GetErpOfdmRate18Mbps()
Return a WifiMode for ERP-OFDM at 18Mbps.
void SetTxGain(double gain)
Sets the transmission gain (dB).
void Configure80211ax(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11ax standard...
double DbmToW(double dBm)
Convert from dBm to Watts.
std::map< uint16_t, HeMuUserInfo > HeMuUserInfoMap
map of HE MU specific user info paramters indexed by STA-ID
static WifiMode GetHtMcs7()
Return MCS 7 from HT MCS values.
void SetRxSensitivity(double threshold)
Sets the receive sensitivity threshold (dBm).
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
virtual void ConfigureStandardAndBand(WifiPhyStandard standard, WifiPhyBand band)
Configure the PHY-level parameters for different Wi-Fi standard.
virtual void DoDispose(void)
Destructor implementation.
static WifiMode GetHePhyHeaderMode()
void RebuildMcsMap(void)
Rebuild the mapping of MCS values to indices in the device MCS set.
static WifiMode GetVhtMcs5()
Return MCS 5 from VHT MCS values.
uint8_t GetNBssMembershipSelectors(void) const
The WifiPhy::NBssMembershipSelectors() method is used (e.g., by a WifiRemoteStationManager) to determ...
The PHY layer is sleeping.
static WifiMode GetHtMcs22()
Return MCS 22 from HT MCS values.
static WifiMode GetHtMcs14()
Return MCS 14 from HT MCS values.
static WifiMode GetOfdmRate12Mbps()
Return a WifiMode for OFDM at 12Mbps.
TracedCallback< Ptr< const Packet > > m_phyRxEndTrace
The trace source fired when a packet ends the reception process from the medium.
bool IsStateCcaBusy(void) const
void SetReceiveErrorCallback(RxErrorCallback callback)
void EndOfMpdu(Ptr< Event > event, Ptr< const WifiPsdu > psdu, size_t mpduIndex, Time relativeStart, Time mpduDuration)
The last symbol of an MPDU in an A-MPDU has arrived.
static WifiMode GetHtMcs31()
Return MCS 31 from HT MCS values.
static WifiMode GetHtMcs21()
Return MCS 21 from HT MCS values.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
bool IsInitialized(void) const
Check if the object has been initialized.
U * PeekPointer(const Ptr< U > &p)
static WifiMode GetHtMcs30()
Return MCS 30 from HT MCS values.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
void SetErrorRateModel(const Ptr< ErrorRateModel > rate)
Set the error rate model for this interference helper.
void SetSlot(Time slot)
Set the slot duration for this PHY.
std::vector< uint8_t > m_bssMembershipSelectorSet
the BSS membership selector set
static WifiMode GetHtMcs10()
Return MCS 10 from HT MCS values.
static Time GetPhyPreambleDuration(WifiTxVector txVector)
void SetShortPhyPreambleSupported(bool preamble)
Enable or disable short PHY preamble.
static WifiMode GetHtMcs26()
Return MCS 26 from HT MCS values.
TracedCallback< WifiTxVector, Time > m_phyRxPayloadBeginTrace
The trace source fired when the reception of the PHY payload (PSDU) begins.
static WifiMode GetOfdmRate1_5MbpsBW5MHz()
Return a WifiMode for OFDM at 1.5Mbps with 5MHz channel spacing.
static WifiMode GetHtMcs17()
Return MCS 17 from HT MCS values.
static WifiMode GetHtMcs24()
Return MCS 24 from HT MCS values.
EventId m_endPhyRxEvent
the end of PHY receive event
bool IsStbc(void) const
Check if STBC is used or not.
static WifiMode GetOfdmRate4_5MbpsBW10MHz()
Return a WifiMode for OFDM at 4.5Mbps with 10MHz channel spacing.
bool GetModeInitialized(void) const
static WifiMode GetOfdmRate54Mbps()
Return a WifiMode for OFDM at 54Mbps.
void SetMobility(const Ptr< MobilityModel > mobility)
assign a mobility model to this device
void UnregisterListener(WifiPhyListener *listener)
void SetRxNoiseFigure(double noiseFigureDb)
Sets the RX loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in the receiver.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
bool IsStrictlyPositive(void) const
Exactly equivalent to t > 0.
static WifiMode GetHeMcs4()
Return MCS 4 from HE MCS values.
uint8_t GetNess(void) const
void ConfigureHolland(void)
Configure WifiPhy with appropriate channel frequency and supported rates for Holland.
bool IsStateIdle(void) const
uint16_t GetGuardInterval(void) const
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.
TracedCallback< Ptr< const Packet >, WifiPhyRxfailureReason > m_phyRxDropTrace
The trace source fired when the PHY layer drops a packet it has received.
std::pair< uint16_t, uint16_t > FrequencyWidthPair
A pair of a center frequency (MHz) and a channel width (MHz)
static WifiMode GetHtMcs8()
Return MCS 8 from HT MCS values.
uint8_t m_nTxPower
Number of available transmission power levels.
static WifiMode GetHtMcs18()
Return MCS 18 from HT MCS values.
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...
double GetTxPowerForTransmission(WifiTxVector txVector) const
Compute the transmit power (in dBm) for the next transmission.
virtual void SetFrequency(uint16_t freq)
static WifiMode GetVhtMcs4()
Return MCS 4 from VHT MCS values.
Ptr< Event > Add(Ptr< const WifiPpdu > ppdu, WifiTxVector txVector, Time duration, RxPowerWattPerChannelBand rxPower)
Add the PPDU-related signal to interference helper.
static WifiMode GetHtMcs27()
Return MCS 27 from HT MCS values.
WifiSpectrumBand GetRuBand(WifiTxVector txVector, uint16_t staId)
Get the RU band used to transmit a PSDU to a given STA in a HE MU PPDU.
void SetFrameCaptureModel(const Ptr< FrameCaptureModel > frameCaptureModel)
Sets the frame capture model.
void ResetCca(bool powerRestricted, double txPowerMaxSiso=0, double txPowerMaxMimo=0)
Reset PHY to IDLE, with some potential TX power restrictions for the next transmission.
std::vector< Ptr< WifiMacQueueItem > >::const_iterator end(void) const
Return a const iterator to past-the-last MPDU.
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
static WifiMode GetOfdmRate36Mbps()
Return a WifiMode for OFDM at 36Mbps.
uint8_t m_initialChannelNumber
Initial channel number.
void NotifyRxEnd(Ptr< const WifiPsdu > psdu)
Public method used to fire a PhyRxEnd trace.
static WifiMode GetVhtMcs7()
Return MCS 7 from VHT MCS values.
static WifiMode GetOfdmRate6MbpsBW5MHz()
Return a WifiMode for OFDM at 6Mbps with 5MHz channel spacing.
bool IsStateSleep(void) const
void NotifyEndOfHePreamble(HePreambleParameters params)
Public method used to fire a EndOfHePreamble trace once both HE SIG fields have been received...
double snr
SNR in linear scale.
bool IsExpired(void) const
This method is syntactic sugar for the ns3::Simulator::IsExpired method.
static WifiMode GetVhtMcs3()
Return MCS 3 from VHT MCS values.
MpduType
The type of an MPDU.
std::pair< int16_t, int16_t > SubcarrierRange
(lowest index, highest index) pair defining a subcarrier range
double GetRxSensitivity(void) const
Return the receive sensitivity threshold (dBm).
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
WifiModeList m_deviceMcsSet
the device MCS set
uint32_t GetSize(void) const
Return the size of the PSDU in bytes.
HeRu::RuSpec GetRu(uint16_t staId) const
Get the RU specification for the STA-ID.
uint16_t m_channelCenterFrequency
Center frequency in MHz.
void SetDevice(const Ptr< NetDevice > device)
Sets the device this PHY is associated with.
WifiMode GetMode(uint16_t staId=SU_STA_ID) const
If this TX vector is associated with an SU PPDU, return the selected payload transmission mode...
static WifiMode GetHtMcs16()
Return MCS 16 from HT MCS values.
uint16_t GetChannelWidth(void) const
bool m_powerRestricted
Flag whether transmit power is restricted by OBSS PD SR.
static WifiMode GetErpOfdmRate54Mbps()
Return a WifiMode for ERP-OFDM at 54Mbps.
WifiPreamble GetPreambleType(void) const
static Time GetPhyHtSigHeaderDuration(WifiPreamble preamble)
static WifiMode GetHtMcs29()
Return MCS 29 from HT MCS values.
void ScheduleEndOfMpdus(Ptr< Event > event)
Schedule end of MPDUs events.
static WifiMode GetHtMcs11()
Return MCS 11 from HT MCS values.
uint8_t GetNMcs(void) const
The WifiPhy::GetNMcs() method is used (e.g., by a WifiRemoteStationManager) to determine the set of t...
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
Keep track of the current position and velocity of an object.
static ChannelToFrequencyWidthMap m_channelToFrequencyWidth
the channel to frequency width map
Definition: <