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
WifiPhyStandard
Identifies the PHY specification that a Wifi device is configured to use.
The MPDU is not part of an A-MPDU.
Ptr< const Packet > GetPacket(void) const
Get the PSDU as a single packet.
uint8_t bssColor
BSS color.
static uint16_t GetBandwidth(RuType ruType)
Get the approximate bandwidth occupied by a RU.
The MPDU is the first aggregate in an A-MPDU with multiple MPDUs, but is not the last aggregate...
bool DoFrequencySwitch(uint16_t frequency)
The default implementation does nothing and returns true.
static WifiMode GetHtMcs2()
Return MCS 2 from HT MCS values.
std::vector< bool > m_statusPerMpdu
current reception status per MPDU that is filled in as long as MPDUs are being processed by the PHY i...
void StartReceiveHeader(Ptr< Event > event)
Start receiving the PHY header of a PPDU (i.e.
static WifiMode GetHtPhyHeaderMode()
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Time m_slot
Slot duration.
Ptr< MobilityModel > m_mobility
Pointer to the mobility model.
bool IsZero(void) const
Exactly equivalent to t == 0.
AttributeValue implementation for Time.
Time m_blockAckTxTime
estimated BlockAck TX time
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
receive notifications about PHY events.
TracedCallback< Ptr< const Packet > > m_phyTxDropTrace
The trace source fired when the PHY layer drops a packet as it tries to transmit it.
double m_txPowerMaxMimo
MIMO maximum transmit power due to OBSS PD SR power restriction (dBm)
bool m_shortPreamble
Flag if short PHY preamble is supported.
static WifiMode GetHeMcs3()
Return MCS 3 from HE MCS values.
Hold an unsigned integer type.
static Time GetPayloadDuration(uint32_t size, WifiTxVector txVector, WifiPhyBand band, MpduType mpdutype=NORMAL_MPDU, uint16_t staId=SU_STA_ID)
static WifiMode CreateWifiMode(std::string uniqueName, WifiModulationClass modClass, bool isMandatory, WifiCodeRate codingRate, uint16_t constellationSize)
EventId m_endTxEvent
the end of transmit event
static WifiMode GetHtMcs12()
Return MCS 12 from HT MCS values.
Ptr< WifiRadioEnergyModel > m_wifiRadioEnergyModel
Wifi radio energy model.
static WifiMode GetErpOfdmRate48Mbps()
Return a WifiMode for ERP-OFDM at 48Mbps.
void SetTxPowerEnd(double end)
Sets the maximum available transmission power level (dBm).
void SetPreambleDetectionModel(const Ptr< PreambleDetectionModel > preambleDetectionModel)
Sets the preamble detection model.
The MPDU is part of an A-MPDU with multiple MPDUs, but is neither the first nor the last aggregate...
std::pair< ChannelNumberBandPair, WifiPhyStandard > ChannelNumberStandardPair
A pair of a ChannelNumberBandPair and a WifiPhyStandard.
static WifiMode GetOfdmRate12MbpsBW10MHz()
Return a WifiMode for OFDM at 12Mbps with 10MHz channel spacing.
void NotifyChannelAccessRequested(void)
Notify the PHY that an access to the channel was requested.
static WifiMode GetHeMcs11()
Return MCS 11 from HE MCS values.
The PHY layer has sense the medium busy through the CCA mechanism.
static WifiMode GetHeMcs(uint8_t mcs)
Get the WifiMode object corresponding to the given MCS of the HE modulation class.
Time GetDelayUntilIdle(void)
OFDM PHY (Clause 17 - amendment for 10 MHz and 5 MHz channels)
uint32_t m_rxMpduReferenceNumber
A-MPDU reference number to identify all received subframes belonging to the same received A-MPDU...
TracedCallback< HePreambleParameters > m_phyEndOfHePreambleTrace
A trace source that indicates the end of both HE SIG fields as well as training fields for received 8...
std::pair< uint32_t, uint32_t > WifiSpectrumBand
typedef for a pair of start and stop sub-band indexes
double CalculateSnr(WifiTxVector txVector, double ber) const
static WifiMode GetOfdmRate18Mbps()
Return a WifiMode for OFDM at 18Mbps.
void SetCapabilitiesChangedCallback(Callback< void > callback)
void SetOffMode(void)
Put in off mode.
static WifiMode GetOfdmRate9MbpsBW10MHz()
Return a WifiMode for OFDM at 9Mbps with 10MHz channel spacing.
static WifiMode GetOfdmRate12MbpsBW5MHz()
Return a WifiMode for OFDM at 12Mbps with 5MHz channel spacing.
WifiModulationClass GetModulationClass() const
Ptr< PreambleDetectionModel > m_preambleDetectionModel
Preamble detection model.
double GetPowerDbm(uint8_t power) const
Get the power of the given power level in dBm.
static WifiMode GetVhtMcs1()
Return MCS 1 from VHT MCS values.
WifiPhyStandard GetPhyStandard(void) const
Get the configured Wi-Fi standard.
EventId m_endPreambleDetectionEvent
the end of preamble detection event
This is intended to be the configuration used in this paper: Gavin Holland, Nitin Vaidya and Paramvir...
static WifiMode GetOfdmRate48Mbps()
Return a WifiMode for OFDM at 48Mbps.
Time GetBlockAckTxTime(void) const
Return the estimated BlockAck TX time for this PHY.
void SetErrorRateModel(const Ptr< ErrorRateModel > rate)
Sets the error rate model.
static WifiMode GetVhtPhyHeaderMode()
static WifiMode GetHeMcs9()
Return MCS 9 from HE MCS values.
double f(double x, void *params)
static WifiMode GetHtMcs0()
Return MCS 0 from HT MCS values.
TracedCallback< WifiConstPsduMap, WifiTxVector, double > m_phyTxPsduBeginTrace
The trace source fired when a PSDU map begins the transmission process on the medium.
Ptr< MobilityModel > GetMobility(void) const
Return the mobility model this PHY is associated with.
static Time GetPreambleDetectionDuration(void)
Time m_pifs
PCF Interframe Space (PIFS) duration.
static Time GetPhySigA1Duration(WifiPreamble preamble)
void SetPostReceptionErrorModel(const Ptr< ErrorModel > em)
Attach a receive ErrorModel to the WifiPhy.
static TypeId GetTypeId(void)
Get the type ID.
std::size_t GetNMpdus(void) const
Return the number of MPDUs constituting the PSDU.
Time GetChannelSwitchDelay(void) const
void ContinueReceiveHeader(Ptr< Event > event)
Continue receiving the PHY header of a PPDU (i.e.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
WifiPhyBand m_band
WifiPhyBand.
void NotifyRxStart()
Notify that RX has started.
Hold objects of type Ptr<T>.
void SetWifiRadioEnergyModel(const Ptr< WifiRadioEnergyModel > wifiRadioEnergyModel)
Sets the wifi radio energy model.
int64_t GetNanoSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
void EraseEvents(void)
Erase all events.
uint16_t GetFrequency(void) const
uint8_t GetNumberOfAntennas(void) const
static WifiMode GetOfdmRate24Mbps()
Return a WifiMode for OFDM at 24Mbps.
void NotifyTxDrop(Ptr< const WifiPsdu > psdu)
Public method used to fire a PhyTxDrop trace.
Time m_sifs
Short Interframe Space (SIFS) duration.
static WifiMode GetHeMcs1()
Return MCS 1 from HE MCS values.
TracedCallback< Ptr< const Packet >, double > m_phyTxBeginTrace
The trace source fired when a packet begins the transmission process on the medium.
DSSS PHY (Clause 15) and HR/DSSS PHY (Clause 18)
virtual void StartTx(Ptr< WifiPpdu > ppdu)=0
static WifiMode GetHtMcs13()
Return MCS 13 from HT MCS values.
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
static WifiMode GetHeMcs0()
Return MCS 0 from HE MCS values.
std::map< ChannelNumberStandardPair, FrequencyWidthPair > ChannelToFrequencyWidthMap
channel to frequency width map typedef
static WifiMode GetHeMcs10()
Return MCS 10 from HE MCS values.
static WifiMode GetHtMcs20()
Return MCS 20 from HT MCS values.
static WifiMode GetHeMcs2()
Return MCS 2 from HE MCS values.
static Time GetPhyTrainingSymbolDuration(WifiTxVector txVector)
static WifiMode GetHtMcs5()
Return MCS 5 from HT MCS values.
void SetMaxSupportedRxSpatialStreams(uint8_t streams)
bool GetShortPhyPreambleSupported(void) const
Return whether short PHY preamble is supported.
double m_ccaEdThresholdW
Clear channel assessment (CCA) threshold in watts.
static WifiMode GetVhtMcs2()
Return MCS 2 from VHT MCS values.
virtual void SetChannelNumber(uint8_t id)
Set channel number.
Time GetPifs(void) const
Return the PCF Interframe Space (PIFS) for this PHY.
static WifiMode GetDsssRate5_5Mbps()
Return a WifiMode for DSSS at 5.5Mbps.
static SubcarrierGroup GetSubcarrierGroup(uint8_t bw, RuType ruType, std::size_t index)
Get the subcarrier group of the RU having the given index among all the RUs of the given type (number...
Time GetAckTxTime(void) const
Return the estimated Ack TX time for this PHY.
void Configure80211ac(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11ac standard...
virtual void DoInitialize(void)
Initialize() implementation.
static WifiMode GetOfdmRate2_25MbpsBW5MHz()
Return a WifiMode for OFDM at 2.25Mbps with 5MHz channel spacing.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
double WToDbm(double w)
Convert from Watts to dBm.
uint8_t GetChannelNumber(void) const
Return current channel number.
WifiPhyStandard m_standard
WifiPhyStandard.
static Time Now(void)
Return the current simulation virtual time.
uint8_t FindChannelNumberForFrequencyWidth(uint16_t frequency, uint16_t width) const
Look for channel number matching the frequency and width.
bool m_channelAccessRequested
Flag if channels access has been requested (used for OBSS_PD SR)
static WifiMode GetErpOfdmRate9Mbps()
Return a WifiMode for ERP-OFDM at 9Mbps.
void EndReceive(Ptr< Event > event)
The last symbol of the PPDU has arrived.
Ptr< UniformRandomVariable > m_random
Provides uniform random variables.
double DbToRatio(double dB)
Convert from dB to ratio.
uint8_t m_txSpatialStreams
Number of supported TX spatial streams.
double GetTxPowerStart(void) const
Return the minimum available transmission power level (dBm).
Time m_ackTxTime
estimated Ack TX time
double RatioToDb(double ratio)
Convert from ratio to dB.
Ptr< ErrorModel > m_postReceptionErrorModel
Error model for receive packet events.
static WifiMode GetPhyHeaderMode(WifiTxVector txVector)
void InitializeFrequencyChannelNumber(void)
post-construction setting of frequency and/or channel number
std::vector< uint16_t > GetSupportedChannelWidthSet(void) const
uint8_t GetNModes(void) const
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
Ptr< FrameCaptureModel > m_frameCaptureModel
Frame capture model.
#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< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
void SetRxGain(double gain)
Sets the reception gain (dB).
void Configure80211b(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11b standard...
WifiPhyBand
Identifies the PHY band.
No explicit coding (e.g., DSSS rates)
void SetSifs(Time sifs)
Set the Short Interframe Space (SIFS) for this PHY.
void SetReceiveOkCallback(RxOkCallback callback)
WifiMode GetMode(uint8_t mode) const
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
uint16_t m_channelWidth
Channel width (MHz)
uint8_t GetBssMembershipSelector(uint8_t selector) const
The WifiPhy::BssMembershipSelector() method is used (e.g., by a WifiRemoteStationManager) to determin...
static WifiMode GetErpOfdmRate6Mbps()
Return a WifiMode for ERP-OFDM at 6Mbps.
void RegisterListener(WifiPhyListener *listener)
bool IsStateTx(void) const
std::pair< bool, SignalNoiseDbm > GetReceptionStatus(Ptr< const WifiPsdu > psdu, Ptr< Event > event, uint16_t staId, Time relativeMpduStart, Time mpduDuration)
Get the reception status for the provided MPDU and notify.
Ptr< WifiMac > GetMac(void) const
void NotifyRxBegin(Ptr< const WifiPsdu > psdu, RxPowerWattPerChannelBand rxPowersW)
Public method used to fire a PhyRxBegin trace.
void SetMaxSupportedTxSpatialStreams(uint8_t streams)
The PHY layer is sending a packet.
static WifiMode GetErpOfdmRate12Mbps()
Return a WifiMode for ERP-OFDM at 12Mbps.
WifiModulationClass
This enumeration defines the modulation classes per (Table 9-4 "Modulation classes"; IEEE 802...
EventId m_endRxEvent
the end of receive event
Ptr< WifiPhyStateHelper > m_state
Pointer to WifiPhyStateHelper.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
void Configure80211n(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11n standard...
void SetTxPowerStart(double start)
Sets the minimum available transmission power level (dBm).
double m_txPowerBaseDbm
Minimum transmission power (dBm)
bool IsMcsSupported(WifiMode mcs) const
Check if the given WifiMode is supported by the PHY.
struct InterferenceHelper::SnrPer CalculateHtPhyHeaderSnrPer(Ptr< Event > event, WifiSpectrumBand band) const
Calculate the SNIR at the start of the HT PHY header and accumulate all SNIR changes in the SNIR vect...
Time GetSifs(void) const
Return the Short Interframe Space (SIFS) for this PHY.
void NotifyRxEnd()
Notify that RX has ended.
void SetNoiseFigure(double value)
Set the noise figure.
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
void ResetReceive(Ptr< Event > event)
Reset PHY at the end of the packet under reception after it has failed the PHY header.
SignalNoiseDbm structure.
uint32_t mpduRefNumber
MPDU ref number.
bool m_frequencyChannelNumberInitialized
Store initialization state.
static WifiMode GetHtMcs19()
Return MCS 19 from HT MCS values.
InterferenceHelper m_interference
Pointer to InterferenceHelper.
virtual void SetChannelWidth(uint16_t channelWidth)
static WifiMode GetHtMcs6()
Return MCS 6 from HT MCS values.
bool m_isConstructed
true when ready to set frequency
The MPDU is the last aggregate in an A-MPDU with multiple MPDUs.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
void ConfigureHtDeviceMcsSet(void)
Configure the device MCS set with the appropriate HtMcs modes for the number of available transmit sp...
void PushMcs(WifiMode mode)
Add the given MCS to the device MCS set.
Time Seconds(double value)
Construct a Time in the indicated unit.
WifiPhyRxfailureReason
Enumeration of the possible reception failure reasons.
The PHY layer is receiving a packet.
SignalNoiseDbm m_signalNoise
latest signal power and noise power in dBm (noise power includes the noise figure) ...
Ptr< const AttributeChecker > MakeBooleanChecker(void)
static Time GetPhySigA2Duration(WifiPreamble preamble)
std::size_t index
index (starting at 1)
static WifiMode GetHtMcs28()
Return MCS 28 from HT MCS values.
bool IsRunning(void) const
This method is syntactic sugar for !IsExpired().
double GetTxPowerEnd(void) const
Return the maximum available transmission power level (dBm).
static WifiMode GetHtMcs9()
Return MCS 9 from HT MCS values.
Time GetSlot(void) const
Return the slot duration for this PHY.
void EndReceiveInterBss(void)
For HE receptions only, check and possibly modify the transmit power restriction state at the end of ...
std::vector< Ptr< WifiMacQueueItem > >::const_iterator begin(void) const
Return a const iterator to the first MPDU.
void StartRx(Ptr< Event > event)
Starting receiving the PPDU after having detected the medium is idle or after a reception switch...
void NotifyMonitorSniffTx(Ptr< const WifiPsdu > psdu, uint16_t channelFreqMhz, WifiTxVector txVector, uint16_t staId=SU_STA_ID)
Public method used to fire a MonitorSniffer trace for a wifi PSDU being transmitted.
static WifiMode GetHtMcs4()
Return MCS 4 from HT MCS values.
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
void StartReceivePayload(Ptr< Event > event)
Start receiving the PSDU (i.e.
static WifiMode GetHtMcs25()
Return MCS 25 from HT MCS values.
static WifiMode GetHeMcs8()
Return MCS 8 from HE MCS values.
The PHY layer is switched off.
void Send(Ptr< const WifiPsdu > psdu, WifiTxVector txVector)
void Configure80211g(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11g standard...
Ptr< NetDevice > GetDevice(void) const
Return the device this PHY is associated with.
uint8_t GetTxPowerLevel(void) const
double GetTxGain(void) const
Return the transmission gain (dB).
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
struct InterferenceHelper::SnrPer CalculatePayloadSnrPer(Ptr< Event > event, uint16_t channelWidth, WifiSpectrumBand band, uint16_t staId, std::pair< Time, Time > relativeMpduStartStop) const
Calculate the SNIR at the start of the payload and accumulate all SNIR changes in the SNIR vector for...
The PHY layer is switching to other channel.
double CalculateSnr(Ptr< Event > event, uint16_t channelWidth, uint8_t nss, WifiSpectrumBand band) const
Calculate the SNIR for the event (starting from now until the event end).
void SetSleepMode(void)
Put in sleep mode.
void NotifyMonitorSniffRx(Ptr< const WifiPsdu > psdu, uint16_t channelFreqMhz, WifiTxVector txVector, SignalNoiseDbm signalNoise, std::vector< bool > statusPerMpdu, uint16_t staId=SU_STA_ID)
Public method used to fire a MonitorSniffer trace for a wifi PSDU being received. ...
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
WifiModeList m_deviceRateSet
This vector holds the set of transmission modes that this WifiPhy(-derived class) can support...
void SetNumberOfAntennas(uint8_t antennas)
uint16_t GetChannelWidth(void) const
static WifiMode GetHtMcs1()
Return MCS 1 from HT MCS values.
std::map< WifiModulationClass, std::map< uint8_t, uint8_t > > m_mcsIndexMap
Maps MCS values to indices in m_deviceMcsSet, for HT, VHT and HE modulation classes.
static WifiMode GetHtMcs23()
Return MCS 23 from HT MCS values.
static Time GetPhyHeaderDuration(WifiTxVector txVector)
A base class which provides memory management and object aggregation.
Time FemtoSeconds(uint64_t value)
Construct a Time in the indicated unit.
static WifiMode GetDsssRate2Mbps()
Return a WifiMode for DSSS at 2Mbps.
static WifiMode GetVhtMcs9()
Return MCS 9 from VHT MCS values.
static Time GetStartOfPacketDuration(WifiTxVector txVector)
static WifiMode GetOfdmRate6MbpsBW10MHz()
Return a WifiMode for OFDM at 6Mbps with 10MHz channel spacing.
int64_t GetFemtoSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
static Time CalculateTxDuration(uint32_t size, WifiTxVector txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
double m_txPowerEndDbm
Maximum transmission power (dBm)
bool IsNull(void) const
Check for null implementation.
const HeMuUserInfoMap & GetHeMuUserInfoMap(void) const
Get the map HE MU user-specific transmission information indexed by STA-ID.
void Configure80211p(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11p standard...
This class can be used to hold variables of floating point type such as 'double' or 'float'...
static WifiMode GetOfdmRate24MbpsBW10MHz()
Return a WifiMode for OFDM at 24Mbps with 10MHz channel spacing.
The MPDU is a single MPDU.
Time m_channelSwitchDelay
Time required to switch between channel.
static WifiMode GetOfdmRate13_5MbpsBW5MHz()
Return a WifiMode for OFDM at 13.5Mbps with 5MHz channel spacing.
Time GetLastRxEndTime(void) const
Return the end time of the last received packet.
uint8_t GetMcsValue(void) const
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
static WifiMode CreateWifiMcs(std::string uniqueName, uint8_t mcsValue, WifiModulationClass modClass)
uint8_t m_numberOfAntennas
Number of transmitters.
uint8_t GetMaxSupportedTxSpatialStreams(void) const
a unique identifier for an interface.
void ConfigureChannelForStandard(void)
Configure the PHY-level parameters for different Wi-Fi standard.
static WifiMode GetHtMcs15()
Return MCS 15 from HT MCS values.
Ptr< Event > m_currentEvent
Hold the current event.
static Time GetPhySigBDuration(WifiPreamble preamble)
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Time GetLastRxStartTime(void) const
Return the start time of the last received packet.
double m_txPowerMaxSiso
SISO maximum transmit power due to OBSS PD SR power restriction (dBm)
bool IsStateRx(void) const
static WifiMode GetHtMcs3()
Return MCS 3 from HT MCS values.
uint8_t m_rxSpatialStreams
Number of supported RX spatial streams.
Ptr< T > Copy(Ptr< T > object)
Return a deep copy of a Ptr.
std::vector< uint16_t > m_supportedChannelWidthSet
Supported channel width set (MHz)
static WifiMode GetOfdmRate6Mbps()
Return a WifiMode for OFDM at 6Mbps.
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...
void SwitchMaybeToCcaBusy(void)
Check if PHY state should move to CCA busy state based on current state of interference tracker...
void SetCcaEdThreshold(double threshold)
Sets the CCA threshold (dBm).
static WifiMode GetVhtMcs(uint8_t mcs)
Get the WifiMode object corresponding to the given MCS of the VHT modulation class.
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
virtual int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
std::map< WifiSpectrumBand, double > RxPowerWattPerChannelBand
A map of the received power (Watts) for each band.
static WifiMode GetHeMcs6()
Return MCS 6 from HE MCS values.
static WifiMode GetOfdmRate4_5MbpsBW5MHz()
Return a WifiMode for OFDM at 4.5Mbps with 5MHz channel spacing.
Callback< void > m_capabilitiesChangedCallback
Callback when PHY capabilities changed.
void Configure80211a(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11a standard...
uint8_t GetMaxSupportedRxSpatialStreams(void) const
static WifiMode GetHtMcs(uint8_t mcs)
Get the WifiMode object corresponding to the given MCS of the HT modulation class.
static WifiMode GetOfdmRate3MbpsBW10MHz()
Return a WifiMode for OFDM at 3Mbps with 10MHz channel spacing.
TracedCallback< Ptr< const Packet > > m_phyTxEndTrace
The trace source fired when a packet ends the transmission process on the medium. ...
uint16_t m_initialFrequency
Store frequency until initialization (MHz)
Parameters for receive HE preamble.
bool DefineChannelNumber(uint8_t channelNumber, WifiPhyBand band, WifiPhyStandard standard, uint16_t frequency, uint16_t channelWidth)
Add a channel definition to the WifiPhy.
bool IsAggregate(void) const
Return true if the PSDU is an S-MPDU or A-MPDU.
static Time CalculatePhyPreambleAndHeaderDuration(WifiTxVector txVector)
virtual WifiSpectrumBand GetBand(uint16_t bandWidth, uint8_t bandIndex=0)
Get the start band index and the stop band index for a given band.
bool DoChannelSwitch(uint8_t id)
The default implementation does nothing and returns true.