22 #include "ns3/simulator.h" 24 #include "ns3/pointer.h" 25 #include "ns3/mobility-model.h" 26 #include "ns3/random-variable-stream.h" 27 #include "ns3/error-model.h" 166 .SetGroupName (
"Wifi")
167 .AddAttribute (
"Frequency",
168 "The operating center frequency (MHz)",
172 MakeUintegerChecker<uint16_t> ())
173 .AddAttribute (
"ChannelWidth",
174 "Whether 5MHz, 10MHz, 20MHz, 22MHz, 40MHz, 80 MHz or 160 MHz.",
178 MakeUintegerChecker<uint16_t> (5, 160))
179 .AddAttribute (
"ChannelNumber",
180 "If set to non-zero defined value, will control Frequency and ChannelWidth assignment",
184 MakeUintegerChecker<uint8_t> (0, 196))
185 .AddAttribute (
"EnergyDetectionThreshold",
186 "The energy of a received signal should be higher than " 187 "this threshold (dbm) to allow the PHY layer to detect the signal.",
190 MakeDoubleChecker<double> (),
192 .AddAttribute (
"RxSensitivity",
193 "The energy of a received signal should be higher than " 194 "this threshold (dBm) for the PHY to detect the signal.",
198 MakeDoubleChecker<double> ())
199 .AddAttribute (
"CcaEdThreshold",
200 "The energy of a non Wi-Fi received signal should be higher than " 201 "this threshold (dbm) to allow the PHY layer to declare CCA BUSY state. " 202 "This check is performed on the 20 MHz primary channel only.",
206 MakeDoubleChecker<double> ())
207 .AddAttribute (
"TxGain",
208 "Transmission gain (dB).",
212 MakeDoubleChecker<double> ())
213 .AddAttribute (
"RxGain",
214 "Reception gain (dB).",
218 MakeDoubleChecker<double> ())
219 .AddAttribute (
"TxPowerLevels",
220 "Number of transmission power levels available between " 221 "TxPowerStart and TxPowerEnd included.",
224 MakeUintegerChecker<uint8_t> ())
225 .AddAttribute (
"TxPowerEnd",
226 "Maximum available transmission level (dbm).",
230 MakeDoubleChecker<double> ())
231 .AddAttribute (
"TxPowerStart",
232 "Minimum available transmission level (dbm).",
236 MakeDoubleChecker<double> ())
237 .AddAttribute (
"RxNoiseFigure",
238 "Loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in the receiver." 239 " According to Wikipedia (http://en.wikipedia.org/wiki/Noise_figure), this is " 240 "\"the difference in decibels (dB) between" 241 " the noise output of the actual receiver to the noise output of an " 242 " ideal receiver with the same overall gain and bandwidth when the receivers " 243 " are connected to sources at the standard noise temperature T0 (usually 290 K)\".",
246 MakeDoubleChecker<double> ())
247 .AddAttribute (
"State",
248 "The state of the PHY layer.",
251 MakePointerChecker<WifiPhyStateHelper> ())
252 .AddAttribute (
"ChannelSwitchDelay",
253 "Delay between two short frames transmitted on different frequencies.",
257 .AddAttribute (
"Antennas",
258 "The number of antennas on the device.",
262 MakeUintegerChecker<uint8_t> (1, 8))
263 .AddAttribute (
"MaxSupportedTxSpatialStreams",
264 "The maximum number of supported TX spatial streams." 265 "This parameter is only valuable for 802.11n/ac/ax STAs and APs.",
269 MakeUintegerChecker<uint8_t> (1, 8))
270 .AddAttribute (
"MaxSupportedRxSpatialStreams",
271 "The maximum number of supported RX spatial streams." 272 "This parameter is only valuable for 802.11n/ac/ax STAs and APs.",
276 MakeUintegerChecker<uint8_t> (1, 8))
277 .AddAttribute (
"ShortGuardEnabled",
278 "Whether or not short guard interval is enabled for HT/VHT transmissions." 279 "This parameter is only valuable for 802.11n/ac/ax STAs and APs.",
285 .AddAttribute (
"GuardInterval",
286 "Whether 800ns, 1600ns or 3200ns guard interval is used for HE transmissions." 287 "This parameter is only valuable for 802.11ax STAs and APs.",
293 .AddAttribute (
"GreenfieldEnabled",
294 "Whether or not Greenfield is enabled." 295 "This parameter is only valuable for 802.11n STAs and APs.",
301 .AddAttribute (
"ShortPlcpPreambleSupported",
302 "Whether or not short PLCP preamble is supported." 303 "This parameter is only valuable for 802.11b STAs and APs." 304 "Note: 802.11g APs and STAs always support short PLCP preamble.",
309 .AddAttribute (
"FrameCaptureModel",
310 "Ptr to an object that implements the frame capture model",
313 MakePointerChecker <FrameCaptureModel> ())
314 .AddAttribute (
"PreambleDetectionModel",
315 "Ptr to an object that implements the preamble detection model",
318 MakePointerChecker <PreambleDetectionModel> ())
319 .AddAttribute (
"PostReceptionErrorModel",
320 "An optional packet error model can be added to the receive " 321 "packet process after any propagation-based (SNR-based) error " 322 "models have been applied. Typically this is used to force " 323 "specific packet drops, for testing purposes.",
326 MakePointerChecker<ErrorModel> ())
327 .AddTraceSource (
"PhyTxBegin",
328 "Trace source indicating a packet " 329 "has begun transmitting over the channel medium",
331 "ns3::Packet::TracedCallback")
332 .AddTraceSource (
"PhyTxEnd",
333 "Trace source indicating a packet " 334 "has been completely transmitted over the channel. " 335 "NOTE: the only official WifiPhy implementation " 336 "available to this date never fires " 337 "this trace source.",
339 "ns3::Packet::TracedCallback")
340 .AddTraceSource (
"PhyTxDrop",
341 "Trace source indicating a packet " 342 "has been dropped by the device during transmission",
344 "ns3::Packet::TracedCallback")
345 .AddTraceSource (
"PhyRxBegin",
346 "Trace source indicating a packet " 347 "has begun being received from the channel medium " 350 "ns3::Packet::TracedCallback")
351 .AddTraceSource (
"PhyRxEnd",
352 "Trace source indicating a packet " 353 "has been completely received from the channel medium " 356 "ns3::Packet::TracedCallback")
357 .AddTraceSource (
"PhyRxDrop",
358 "Trace source indicating a packet " 359 "has been dropped by the device during reception",
361 "ns3::Packet::TracedCallback")
362 .AddTraceSource (
"MonitorSnifferRx",
363 "Trace source simulating a wifi device in monitor mode " 364 "sniffing all received frames",
366 "ns3::WifiPhy::MonitorSnifferRxTracedCallback")
367 .AddTraceSource (
"MonitorSnifferTx",
368 "Trace source simulating the capability of a wifi device " 369 "in monitor mode to sniff all frames being transmitted",
371 "ns3::WifiPhy::MonitorSnifferTxTracedCallback")
372 .AddTraceSource (
"EndOfHePreamble",
373 "Trace source indicating the end of the 802.11ax preamble (after training fields)",
375 "ns3::WifiPhy::EndOfHePreambleTracedCallback")
381 : m_txMpduReferenceNumber (0xffffffff),
382 m_rxMpduReferenceNumber (0xffffffff),
385 m_endPreambleDetectionEvent (),
387 m_isConstructed (false),
388 m_channelCenterFrequency (0),
389 m_initialFrequency (0),
390 m_frequencyChannelNumberInitialized (false),
392 m_channelAccessRequested (false),
393 m_txSpatialStreams (0),
394 m_rxSpatialStreams (0),
396 m_initialChannelNumber (0),
397 m_totalAmpduSize (0),
398 m_totalAmpduNumSymbols (0),
400 m_wifiRadioEnergyModel (0),
401 m_timeLastPreambleDetected (
Seconds (0))
404 m_random = CreateObject<UniformRandomVariable> ();
405 m_state = CreateObject<WifiPhyStateHelper> ();
451 m_state->SetReceiveOkCallback (callback);
457 m_state->SetReceiveErrorCallback (callback);
463 m_state->RegisterListener (listener);
469 m_state->UnregisterListener (listener);
621 htConfiguration->SetGreenfieldSupported (greenfield);
636 return htConfiguration->GetGreenfieldSupported ();
652 htConfiguration->SetShortGuardIntervalSupported (shortGuardInterval);
667 return htConfiguration->GetShortGuardIntervalSupported ();
684 heConfiguration->SetGuardInterval (guardInterval);
699 return heConfiguration->GetGuardInterval ();
723 Ptr<HtConfiguration> htConfiguration = DynamicCast<WifiNetDevice> (device)->GetHtConfiguration ();
729 Ptr<HeConfiguration> heConfiguration = DynamicCast<WifiNetDevice> (device)->GetHeConfiguration ();
897 NS_LOG_WARN (
"Configuring unspecified standard; performing no action");
991 bool htFound =
false;
1124 NS_LOG_FUNCTION (
this << +channelNumber << standard << frequency << channelWidth);
1126 ChannelToFrequencyWidthMap::const_iterator it;
1130 NS_LOG_DEBUG (
"channel number/standard already defined; returning false");
1147 if (it->second ==
f)
1156 NS_LOG_DEBUG (
"Found, returning " << +it->first.first);
1157 return (it->first.first);
1177 NS_LOG_DEBUG (
"Frequency set; checking whether a channel number corresponds");
1179 if (channelNumberSearched)
1181 NS_LOG_DEBUG (
"Channel number found; setting to " << +channelNumberSearched);
1186 NS_LOG_DEBUG (
"Channel number not found; setting to zero");
1200 NS_LOG_DEBUG (
"Falling back to check WIFI_PHY_STANDARD_UNSPECIFIED");
1209 NS_LOG_DEBUG (
"Setting frequency to " <<
f.first <<
"; width to " << +
f.second);
1285 NS_LOG_DEBUG (
"Saving frequency configuration for initialization");
1297 NS_LOG_DEBUG (
"Setting frequency and channel number to zero");
1308 NS_LOG_DEBUG (
"Setting frequency " << frequency <<
" corresponds to channel " << +nch);
1311 NS_LOG_DEBUG (
"Channel frequency switched to " << frequency <<
"; channel number to " << +nch);
1317 NS_LOG_DEBUG (
"Suppressing reassignment of frequency");
1322 NS_LOG_DEBUG (
"Channel number is unknown for frequency " << frequency);
1325 NS_LOG_DEBUG (
"Channel frequency switched to " << frequency <<
"; channel number to " << 0);
1331 NS_LOG_DEBUG (
"Suppressing reassignment of frequency");
1346 NS_ASSERT_MSG (channelwidth == 5 || channelwidth == 10 || channelwidth == 20 || channelwidth == 22 || channelwidth == 40 || channelwidth == 80 || channelwidth == 160,
"wrong channel width value");
1365 NS_ASSERT_MSG (antennas > 0 && antennas <= 4,
"unsupported number of antennas");
1436 NS_LOG_FUNCTION (
"Adding " << width <<
" to supported channel width set");
1440 std::vector<uint16_t>
1460 NS_LOG_DEBUG (
"Saving channel number configuration for initialization");
1491 NS_LOG_DEBUG (
"Setting frequency to " <<
f.first <<
"; width to " << +
f.second);
1504 NS_FATAL_ERROR (
"Frequency not found for channel number " << +nch);
1530 NS_LOG_DEBUG (
"drop packet because of channel switching while reception");
1537 NS_LOG_DEBUG (
"channel switching postponed until end of current transmission");
1550 NS_LOG_DEBUG (
"channel switching ignored in sleep mode");
1590 NS_LOG_DEBUG (
"drop packet because of channel/frequency switching while reception");
1594 goto switchFrequency;
1597 NS_LOG_DEBUG (
"channel/frequency switching postponed until end of current transmission");
1607 goto switchFrequency;
1610 NS_LOG_DEBUG (
"frequency switching ignored in sleep mode");
1643 NS_LOG_DEBUG (
"setting sleep mode postponed until end of current transmission");
1647 NS_LOG_DEBUG (
"setting sleep mode postponed until end of current reception");
1651 NS_LOG_DEBUG (
"setting sleep mode postponed until end of channel switching");
1692 NS_LOG_DEBUG (
"not in sleep mode, there is nothing to resume");
1699 m_state->SwitchFromSleep (delayUntilCcaEnd);
1723 NS_LOG_DEBUG (
"not in off mode, there is nothing to resume");
1730 m_state->SwitchFromOff (delayUntilCcaEnd);
1768 uint8_t Ndltf, Neltf;
1771 if (txVector.
GetNss () < 3)
1773 Ndltf = txVector.
GetNss ();
1775 else if (txVector.
GetNss () < 5)
1779 else if (txVector.
GetNss () < 7)
2052 MpduType mpdutype, uint8_t incFlag)
2081 && txVector.
GetNss () == 3
2087 && txVector.
GetNss () == 2
2093 && txVector.
GetNss () == 3
2099 && txVector.
GetNss () == 3
2105 && txVector.
GetNss () == 4
2111 && txVector.
GetNss () == 4
2122 && txVector.
GetNss () == 2
2128 && txVector.
GetNss () == 2
2134 && txVector.
GetNss () == 3
2140 && txVector.
GetNss () == 3
2146 && txVector.
GetNss () == 3
2152 && txVector.
GetNss () == 4
2158 && txVector.
GetNss () == 4
2164 && txVector.
GetNss () == 4
2170 && txVector.
GetNss () == 4
2215 NS_ASSERT (gi == 800 || gi == 1600 || gi == 3200);
2225 double numSymbols = 0;
2229 numSymbols = (stbc * (16 + size * 8.0 + 6 * Nes) / (stbc * numDataBitsPerSymbol));
2239 numSymbols = (stbc * size * 8.0) / (stbc * numDataBitsPerSymbol);
2250 numSymbols = lrint (stbc * ceil ((16 + totalAmpduSize * 8.0 + 6 * Nes) / (stbc * numDataBitsPerSymbol)));
2264 numSymbols = lrint (stbc * ceil ((16 + size * 8.0 + 6.0 * Nes) / (stbc * numDataBitsPerSymbol)));
2336 MpduType mpdutype, uint8_t incFlag)
2355 for (
auto & mpdu : mpdus)
2372 for (
auto & mpdu : mpdus)
2389 for (
auto & mpdu : mpdus)
2406 for (
auto & mpdu : mpdus)
2423 for (
auto & mpdu : mpdus)
2440 for (
auto & mpdu : mpdus)
2461 size_t numberOfMpdus = ampduSubframes.size ();
2462 NS_ABORT_MSG_IF (statusPerMpdu.size () != numberOfMpdus,
"Should have one reception status per MPDU");
2465 for (
const auto & subframe : ampduSubframes)
2467 if (statusPerMpdu.at (i))
2478 NS_ABORT_MSG_IF (statusPerMpdu.size () != 1,
"Should have one reception status for normal MPDU");
2492 size_t numberOfMpdus = ampduSubframes.size ();
2495 for (
const auto & subframe : ampduSubframes)
2534 NS_LOG_DEBUG (
"Dropping packet because in sleep mode");
2565 NS_LOG_DEBUG (
"Transmitting without power restriction");
2577 NS_LOG_DEBUG (
"Transmission canceled because device is OFF");
2632 uint8_t sigExtention = 0;
2647 uint16_t length = ((ceil ((static_cast<double> (txDuration.
GetNanoSeconds () - (20 * 1000) - (sigExtention * 1000)) / 1000) / 4.0) * 3) - 3 - m);
2653 uint8_t isFrameComplete = 1;
2656 isFrameComplete = 0;
2661 StartTx (newPacket, txVector, txDuration);
2670 NS_LOG_FUNCTION (
this << event->GetPacket () <<
event->GetTxVector () <<
event << rxDuration);
2675 double snr = snrPer.
snr;
2680 m_state->SwitchToRx (rxDuration);
2689 NS_LOG_DEBUG (
"Packet reception could not be started because not enough RX antennas");
2710 NS_LOG_DEBUG (
"Drop packet because PHY preamble detection failed");
2722 NS_LOG_FUNCTION (
this << event->GetPacket () <<
event->GetTxVector () << event);
2738 NS_LOG_DEBUG (
"Abort reception because legacy PHY header reception failed");
2769 for (uint8_t i = 0; i <
GetNModes (); i++)
2786 NS_FATAL_ERROR (
"Received OFDM 802.11 signal with no SIG field");
2791 for (uint8_t i = 0; i <
GetNModes (); i++)
2811 for (uint8_t i = 0; i <
GetNMcs (); i++)
2831 NS_FATAL_ERROR (
"Received 802.11ac signal with no VHT-SIG field");
2836 for (uint8_t i = 0; i <
GetNMcs (); i++)
2858 NS_FATAL_ERROR (
"Received 802.11ax signal with no HE-SIG field");
2863 for (uint8_t i = 0; i <
GetNMcs (); i++)
2888 NS_LOG_DEBUG (
"Cannot start RX because device is OFF");
2894 NS_LOG_DEBUG (
"Packet reception stopped because transmitter has been switched off");
2901 NS_LOG_DEBUG (
"drop packet because of unsupported RX mode");
2910 NS_LOG_DEBUG (
"drop packet because of channel switching");
2935 StartRx (event, rxPowerW, rxDuration);
2939 NS_LOG_DEBUG (
"Drop packet because already in Rx (power=" <<
2951 NS_LOG_DEBUG (
"Drop packet because already in Tx (power=" <<
2963 StartRx (event, rxPowerW, rxDuration);
2984 if (!delayUntilCcaEnd.
IsZero ())
2986 m_state->SwitchMaybeToCcaBusy (delayUntilCcaEnd);
2993 NS_LOG_FUNCTION (
this << event->GetPacket () <<
event->GetTxVector ());
2998 WifiMode txMode = txVector.GetMode ();
2999 bool canReceivePayload;
3009 canReceivePayload =
true;
3011 if (canReceivePayload)
3021 params.
rssiW =
event->GetRxPowerW ();
3022 params.
bssColor =
event->GetTxVector ().GetBssColor ();
3028 NS_LOG_DEBUG (
"Drop packet because it was sent using an unsupported mode (" << txMode <<
")");
3034 NS_LOG_DEBUG (
"Drop packet because non-legacy PHY header reception failed");
3042 Time psduDuration =
event->GetEndTime () -
event->GetStartTime ();
3043 NS_LOG_FUNCTION (
this << event->GetPacket () <<
event->GetTxVector () <<
event << psduDuration);
3047 std::vector<bool> statusPerMpdu;
3052 bool receptionOkAtLeastForOneMpdu =
true;
3053 std::pair<bool, SignalNoiseDbm> rxInfo;
3060 size_t nbOfRemainingMpdus = ampduSubframes.size ();
3061 Time remainingAmpduDuration =
event->GetEndTime () -
event->GetStartTime ();
3063 for (
const auto & subframe : ampduSubframes)
3066 remainingAmpduDuration -= mpduDuration;
3067 --nbOfRemainingMpdus;
3068 if (nbOfRemainingMpdus == 0 && !remainingAmpduDuration.IsZero ())
3070 mpduDuration += remainingAmpduDuration;
3073 NS_LOG_DEBUG (
"Extracted MPDU #" << ampduSubframes.size () - nbOfRemainingMpdus - 1 <<
": duration: " << mpduDuration.
GetNanoSeconds () <<
"ns" <<
3074 ", correct reception: " << rxInfo.first <<
3075 ", Signal/Noise: " << rxInfo.second.signal <<
"/" << rxInfo.second.noise <<
"dBm");
3076 signalNoise = rxInfo.second;
3077 statusPerMpdu.push_back (rxInfo.first);
3078 receptionOkAtLeastForOneMpdu |= rxInfo.first;
3079 relativeStart += mpduDuration;
3087 signalNoise = rxInfo.second;
3088 statusPerMpdu.push_back (rxInfo.first);
3089 receptionOkAtLeastForOneMpdu = rxInfo.first;
3092 if (receptionOkAtLeastForOneMpdu)
3095 m_state->SwitchFromRxEndOk (packet->
Copy (), snr, txVector, statusPerMpdu);
3099 m_state->SwitchFromRxEndError (packet->
Copy (), snr);
3106 std::pair<bool, SignalNoiseDbm>
3109 NS_LOG_FUNCTION (
this << mpdu << event->GetTxVector () <<
event << relativeMpduStart << mpduDuration);
3113 NS_LOG_DEBUG (
"mode=" << (event->GetTxVector ().GetMode ().GetDataRate (event->GetTxVector ())) <<
3114 ", snr(dB)=" <<
RatioToDb (snrPer.snr) <<
", per=" << snrPer.per <<
", size=" << mpdu->
GetSize () <<
3123 signalNoise.noise =
WToDbm (event->GetRxPowerW () / snrPer.snr);
3129 return std::make_pair (
true, signalNoise);
3135 return std::make_pair (
false, signalNoise);
4048 for (uint8_t i = 0; i <
GetNModes (); i++)
4061 for (uint8_t i = 0; i <
GetNMcs (); i++)
4098 return m_state->IsStateCcaBusy ();
4104 return m_state->IsStateIdle ();
4122 return m_state->IsStateSwitching ();
4128 return m_state->IsStateSleep ();
4134 return m_state->IsStateOff ();
4140 return m_state->GetDelayUntilIdle ();
4146 return m_state->GetLastRxStartTime ();
4159 if (!delayUntilCcaEnd.
IsZero ())
4162 m_state->SwitchMaybeToCcaBusy (delayUntilCcaEnd);
4185 m_state->SwitchFromRxAbort (is_failure);
4192 NS_LOG_FUNCTION (
this << powerRestricted << txPowerMaxSiso << txPowerMaxMimo);
4211 if (txVector.
GetNss () > 1)
4225 NS_LOG_FUNCTION (
this << event->GetPacket () <<
event->GetTxVector () <<
event << rxPowerW << rxDuration);
4227 NS_LOG_DEBUG (
"sync to signal (power=" << rxPowerW <<
"W)");
4233 Time remainingRxDuration = rxDuration - startOfPreambleDuration;
4235 event, remainingRxDuration);
4239 NS_LOG_DEBUG (
"Received a stronger signal during preamble detection: drop current packet and switch to new packet");
4245 Time remainingRxDuration = rxDuration - startOfPreambleDuration;
4247 event, remainingRxDuration);
4251 NS_LOG_DEBUG (
"Drop packet because RX is already decoding preamble");
4271 return (os <<
"IDLE");
4273 return (os <<
"CCA_BUSY");
4275 return (os <<
"TX");
4277 return (os <<
"RX");
4279 return (os <<
"SWITCHING");
4281 return (os <<
"SLEEP");
4283 return (os <<
"OFF");
4286 return (os <<
"INVALID");
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.
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
static WifiMode GetOfdmRate9MbpsBW5MHz()
Return a WifiMode for OFDM at 9Mbps with 5MHz channel spacing.
TracedCallback< Ptr< const Packet > > m_phyRxBeginTrace
The trace source fired when a packet begins the reception process from the medium.
Ptr< NetDevice > m_device
Pointer to the device.
static WifiMode GetErpOfdmRate24Mbps()
Return a WifiMode for ERP-OFDM at 24Mbps.
uint8_t GetNTxPower(void) const
Return the number of available transmission power levels.
uint32_t m_txMpduReferenceNumber
A-MPDU reference number to identify all transmitted subframes belonging to the same received A-MPDU...
bool IsStateSwitching(void) const
static WifiMode GetDsssRate11Mbps()
Return a WifiMode for DSSS at 11Mbps.
bool IsStateOff(void) const
struct InterferenceHelper::SnrPer CalculateNonLegacyPhyHeaderSnrPer(Ptr< Event > event) const
Calculate the SNIR at the start of the non-legacy PHY header and accumulate all SNIR changes in the s...
bool IsAggregation(void) const
Checks whether the PSDU contains A-MPDU.
Simulation virtual time values and global simulation resolution.
static WifiMode GetHeMcs7()
Return MCS 7 from HE MCS values.
std::pair< uint8_t, WifiPhyStandard > ChannelNumberStandardPair
A pair of a ChannelNumber and WifiPhyStandard.
static WifiMode GetErpOfdmRate36Mbps()
Return a WifiMode for ERP-OFDM at 36Mbps.
Signal event for a packet.
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 "...
OFDM PHY for the 5 GHz band (Clause 17 with 5 MHz channel bandwidth)
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...
uint8_t m_channelNumber
Operating channel number.
double m_rxGainDb
Reception gain (dB)
bool DefineChannelNumber(uint8_t channelNumber, WifiPhyStandard standard, uint16_t frequency, uint16_t channelWidth)
Add a channel definition to the WifiPhy.
static WifiMode GetVhtMcs8()
Return MCS 8 from VHT MCS values.
void SetShortPlcpPreambleSupported(bool preamble)
Enable or disable short PLCP preamble.
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 SendPacket(Ptr< const Packet > packet, WifiTxVector txVector)
static WifiMode GetOfdmRate9Mbps()
Return a WifiMode for OFDM at 9Mbps.
double GetCcaEdThreshold(void) const
Return the CCA threshold (dBm).
void StartReceiveHeader(Ptr< Event > event, Time rxDuration)
Start receiving the PHY header of a packet (i.e.
HT PHY for the 5 GHz band (clause 20)
Ptr< ErrorRateModel > GetErrorRateModel(void) const
Return the error rate model.
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.
TracedCallback< Ptr< const Packet >, uint16_t, WifiTxVector, MpduInfo, SignalNoiseDbm > m_phyMonitorSniffRxTrace
A trace source that emulates a wifi device in monitor mode sniffing a packet being received...
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.
void SetChannelWidth(uint16_t channelWidth)
Sets the selected channelWidth (in MHz)
WifiPhyStandard GetStandard(void) const
Get the configured Wi-Fi standard.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
static WifiMode GetDsssRate1Mbps()
Return a WifiMode for DSSS at 1Mbps.
NS_ASSERT_MSG(false, "Ipv4AddressGenerator::MaskToIndex(): Impossible")
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.
double m_rxSensitivityW
Receive sensitivity threshold in watts.
bool GetShortGuardInterval(void) const
Return whether short guard interval is supported.
void SetBssColor(uint8_t color)
Set the BSS color.
bool GetGreenfield(void) const
Return whether Greenfield is supported.
static WifiMode GetHeMcs5()
Return MCS 5 from HE MCS values.
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.
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 DoDispose(void)
Destructor implementation.
static Ptr< const Packet > PeekMpduInAmpduSubframe(Ptr< const Packet > ampduSubframe)
Peeks the MPDU contained in the A-MPDU subframe.
bool Is2_4Ghz(double frequency)
static Time GetPlcpHtSigHeaderDuration(WifiPreamble preamble)
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)
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.
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.
std::vector< uint8_t > m_bssMembershipSelectorSet
the BSS membership selector set
HE PHY for the 2.4 GHz band (clause 26)
static WifiMode GetHtMcs10()
Return MCS 10 from HT MCS values.
static WifiMode GetHtMcs26()
Return MCS 26 from HT MCS values.
static WifiMode GetOfdmRate1_5MbpsBW5MHz()
Return a WifiMode for OFDM at 1.5Mbps with 5MHz channel spacing.
void StartRx(Ptr< Event > event, double rxPowerW, Time rxDuration)
Starting receiving the packet after having detected the medium is idle or after a reception switch...
OFDM PHY for the 5 GHz band (Clause 17 with 10 MHz channel bandwidth)
static WifiMode GetHtMcs17()
Return MCS 17 from HT MCS values.
static WifiMode GetHtMcs24()
Return MCS 24 from HT MCS values.
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
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
bool Is5Ghz(double frequency)
void NotifyTxDrop(Ptr< const Packet > packet)
Public method used to fire a PhyTxDrop trace.
HT PHY for the 2.4 GHz band (clause 20)
void SetGreenfield(bool greenfield)
Enable or disable Greenfield support.
void Configure80211_10Mhz(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11a standard with 10...
TimeWithUnit As(const enum Unit unit) const
Attach a unit to a Time, to facilitate output in a specific unit.
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 and a ChannelWidth.
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.
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.
static WifiMode GetHtMcs27()
Return MCS 27 from HT MCS values.
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.
TracedCallback< Ptr< const Packet >, uint16_t, WifiTxVector, MpduInfo > m_phyMonitorSniffTxTrace
A trace source that emulates a wifi device in monitor mode sniffing a packet being transmitted...
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.
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...
void NotifyRxDrop(Ptr< const Packet > packet, WifiPhyRxfailureReason reason)
Public method used to fire a PhyRxDrop trace.
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.
void ConfigureDefaultsForStandard(WifiPhyStandard standard)
Configure the PHY-level parameters for different Wi-Fi standard.
static Time GetPlcpSigA1Duration(WifiPreamble preamble)
MpduType
The type of an MPDU.
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
void NotifyMonitorSniffRx(Ptr< const Packet > packet, uint16_t channelFreqMhz, WifiTxVector txVector, SignalNoiseDbm signalNoise, std::vector< bool > statusPerMpdu)
Public method used to fire a MonitorSniffer trace for a wifi packet being received.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
uint16_t m_channelCenterFrequency
Center frequency in MHz.
void SetDevice(const Ptr< NetDevice > device)
Sets the device this PHY is associated with.
bool GetShortPlcpPreambleSupported(void) const
Return whether short PLCP preamble is supported.
static WifiMode GetHtMcs16()
Return MCS 16 from HT MCS values.
uint16_t GetChannelWidth(void) const
bool m_powerRestricted
Flag whether transmit power is retricted by OBSS PD SR.
static WifiMode GetErpOfdmRate54Mbps()
Return a WifiMode for ERP-OFDM at 54Mbps.
WifiPreamble GetPreambleType(void) const
void AddSupportedChannelWidth(uint16_t channelwidth)
static WifiMode GetHtMcs29()
Return MCS 29 from HT MCS values.
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...
Time CalculateTxDuration(uint32_t size, WifiTxVector txVector, uint16_t frequency)
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.
uint8_t bssColor
BSS color.
The MPDU is the first aggregate in an A-MPDU with multiple MPDUs, but is not the last aggregate...
static Time GetPlcpSigA2Duration(WifiPreamble preamble)
HE PHY for the 5 GHz band (clause 26)
bool DoFrequencySwitch(uint16_t frequency)
The default implementation does nothing and returns true.
static WifiMode GetHtMcs2()
Return MCS 2 from HT MCS values.
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
static EventId Schedule(Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event to expire after delay.
Ptr< MobilityModel > m_mobility
Pointer to the mobility model.
virtual void StartTx(Ptr< Packet > packet, WifiTxVector txVector, Time txDuration)=0
AttributeValue implementation for Time.
static std::list< Ptr< const Packet > > PeekMpdus(Ptr< const Packet > aggregatedPacket)
Peeks the MPDUs of the provided A-MPDU.
static Time GetPlcpPreambleDuration(WifiTxVector txVector)
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
receive notifications about phy events.
std::pair< bool, SignalNoiseDbm > GetReceptionStatus(Ptr< const Packet > mpdu, Ptr< Event > event, Time relativeMpduStart, Time mpduDuration)
Get the reception status for the provided MPDU and notify.
TracedCallback< Ptr< const Packet > > m_phyTxDropTrace
The trace source fired when the phy layer drops a packet as it tries to transmit it.
void SetGuardInterval(uint16_t guardInterval)
Sets the guard interval duration (in nanoseconds)
Time GetEnergyDuration(double energyW) const
double m_txPowerMaxMimo
MIMO maximum transmit power due to OBSS PD SR power restriction.
bool m_shortPreamble
Flag if short PLCP preamble is supported.
Ptr< Event > Add(Ptr< const Packet > packet, WifiTxVector txVector, Time duration, double rxPower)
Add the packet-related signal to interference helper.
static WifiMode GetHeMcs3()
Return MCS 3 from HE MCS values.
void NotifyMonitorSniffTx(Ptr< const Packet > packet, uint16_t channelFreqMhz, WifiTxVector txVector)
Public method used to fire a MonitorSniffer trace for a wifi packet being transmitted.
static Time GetPlcpSigBDuration(WifiPreamble preamble)
Hold an unsigned integer type.
static WifiMode CreateWifiMode(std::string uniqueName, WifiModulationClass modClass, bool isMandatory, WifiCodeRate codingRate, uint16_t constellationSize)
EventId m_endPlcpRxEvent
the end of PLCP receive 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.
static Time CalculatePlcpPreambleAndHeaderDuration(WifiTxVector txVector)
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...
static WifiMode GetOfdmRate12MbpsBW10MHz()
Return a WifiMode for OFDM at 12Mbps with 10MHz channel spacing.
std::string ToString(void) const
Return a string representation of the packet.
void NotifyChannelAccessRequested(void)
Notify the PHY that an access to the channel was requested.
WifiMode GetMode(void) const
static WifiMode GetHeMcs11()
Return MCS 11 from HE MCS values.
The PHY layer has sense the medium busy through the CCA mechanism.
Time GetDelayUntilIdle(void)
uint32_t m_rxMpduReferenceNumber
A-MPDU reference number to identify all received subframes belonging to the same received A-MPDU...
WifiPreamble GetPreambleType(void) const
Getter for preamble parameter.
void Configure80211_5Mhz()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11a standard with 5M...
FrequencyWidthPair GetFrequencyWidthForChannelNumberStandard(uint8_t channelNumber, WifiPhyStandard standard) const
Lookup frequency/width pair for channelNumber/standard pair.
TracedCallback< HePreambleParameters > m_phyEndOfHePreambleTrace
A trace source that indiates the end of both HE SIG fields as well as training fields for received 80...
struct InterferenceHelper::SnrPer CalculateLegacyPhyHeaderSnrPer(Ptr< Event > event) const
Calculate the SNIR at the start of the legacy PHY header and accumulate all SNIR changes in the snir ...
double CalculateSnr(WifiTxVector txVector, double ber) const
void NotifyRxBegin(Ptr< const Packet > packet)
Public method used to fire a PhyRxBegin trace.
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.
void SetNss(uint8_t nss)
Sets the number of Nss refer to IEEE 802.11n Table 20-28 for explanation and range.
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.
void SetErrorRateModel(const Ptr< ErrorRateModel > rate)
Sets the error rate model.
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
static WifiMode GetHeMcs9()
Return MCS 9 from HE MCS values.
int64_t GetMicroSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
double f(double x, void *params)
static WifiMode GetHtMcs0()
Return MCS 0 from HT MCS values.
Ptr< MobilityModel > GetMobility(void) const
Return the mobility model this PHY is associated with.
static Time GetPreambleDetectionDuration(void)
void SetPostReceptionErrorModel(const Ptr< ErrorModel > em)
Attach a receive ErrorModel to the WifiPhy.
static TypeId GetTypeId(void)
Get the type ID.
bool IsAmpdu(Ptr< const Packet > packet)
Time GetChannelSwitchDelay(void) const
OFDM PHY for the 5 GHz band (Clause 17)
void ContinueReceiveHeader(Ptr< Event > event)
Continue receiving the PHY header of a packet (i.e.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
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.
Time m_guardInterval
Supported HE guard interval (deprecated)
void SetAggregation(bool aggregation)
Sets if PSDU contains A-MPDU.
void EraseEvents(void)
Erase all events.
uint16_t GetFrequency(void) const
void SetPreambleType(WifiPreamble preamble)
Sets the preamble type.
uint8_t GetNumberOfAntennas(void) const
static WifiMode GetOfdmRate24Mbps()
Return a WifiMode for OFDM at 24Mbps.
Ptr< const AttributeChecker > MakeBooleanChecker(void)
virtual void SetChannelWidth(uint16_t channelwidth)
WifiPhyState
The state of the PHY layer.
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)
void StartReceivePreamble(Ptr< Packet > packet, double rxPowerW, Time rxDuration)
Start receiving the PHY preamble of a packet (i.e.
static WifiMode GetHtMcs13()
Return MCS 13 from HT MCS values.
void SetShortGuardInterval(bool shortGuardInterval)
Enable or disable support for HT/VHT short guard interval.
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
static WifiMode GetHeMcs0()
Return MCS 0 from HE MCS values.
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 WifiMode GetHtMcs5()
Return MCS 5 from HT MCS values.
void SetMaxSupportedRxSpatialStreams(uint8_t streams)
double CalculateSnr(Ptr< Event > event) const
Calculate the SNIR for the event (starting from now until the event end).
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.
static WifiMode GetDsssRate5_5Mbps()
Return a WifiMode for DSSS at 5.5Mbps.
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.
void SetGuardInterval(Time guardInterval)
uint8_t FindChannelNumberForFrequencyWidth(uint16_t frequency, uint16_t width) const
Look for channel number matching the frequency and width.
bool m_channelAccessRequested
void NotifyTxBegin(Ptr< const Packet > packet, double txPowerW)
Public method used to fire a PhyTxBegin trace.
static WifiMode GetErpOfdmRate9Mbps()
Return a WifiMode for ERP-OFDM at 9Mbps.
void EndReceive(Ptr< Event > event)
The last bit of the packet has arrived.
void NotifyTxEnd(Ptr< const Packet > packet)
Public method used to fire a PhyTxEnd trace.
Ptr< UniformRandomVariable > m_random
Provides uniform random variables.
struct InterferenceHelper::SnrPer CalculatePayloadSnrPer(Ptr< Event > event, 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...
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).
double RatioToDb(double ratio)
Convert from ratio to dB.
Ptr< ErrorModel > m_postReceptionErrorModel
Error model for receive packet events.
void SetMode(WifiMode mode)
Sets the selected payload transmission mode.
void InitializeFrequencyChannelNumber(void)
post-construction setting of frequency and/or channel number
WifiModulationClass GetModulation(void) const
Getter for modulation parameter.
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.
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...
No explicit coding (e.g., DSSS rates)
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.
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.
uint8_t GetFrameComplete(void) const
Getter for frameComplete parameter.
void RegisterListener(WifiPhyListener *listener)
bool IsStateTx(void) const
void ConfigureChannelForStandard(WifiPhyStandard standard)
Configure the PHY-level parameters for different Wi-Fi standard.
void SetMaxSupportedTxSpatialStreams(uint8_t streams)
The PHY layer is sending a packet.
static WifiMode GetErpOfdmRate12Mbps()
Return a WifiMode for ERP-OFDM at 12Mbps.
bool m_greenfield
Flag if GreenField format is supported (deprecated)
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.
void SetEdThreshold(double threshold)
Sets the energy detection threshold (dBm).
void NotifyRxEnd(Ptr< const Packet > packet)
Public method used to fire a PhyRxEnd trace.
#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.
void NotifyRxEnd()
Notify that RX has ended.
void AddPacketTag(const Tag &tag) const
Add a packet tag.
void SetNoiseFigure(double value)
Set the noise figure.
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
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.
bool RemovePacketTag(Tag &tag)
Remove a packet tag.
uint8_t GetBssColor(void) const
Get the BSS color.
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 muliple 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...
Time Seconds(double value)
Construct a Time in the indicated unit.
The PHY layer is receiving a packet.
static WifiMode GetVhtPlcpHeaderMode()
double m_totalAmpduNumSymbols
Number of symbols previously transmitted for the MPDUs in an A-MPDU, used for the computation of the ...
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.
void EndReceiveInterBss(void)
For HE receptions only, check and possibly modify the transmit power restriction state at the end of ...
Attribute or trace source is deprecated; user is warned.
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 payload of a packet (i.e.
static WifiMode GetHtMcs25()
Return MCS 25 from HT MCS values.
static WifiMode GetHeMcs8()
Return MCS 8 from HE MCS values.
Tag for WifiTxVector and WifiPreamble information to be embedded in outgoing transmissions as a Packe...
The PHY layer is switched off.
void Configure80211g(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11g standard...
static WifiMode GetHePlcpHeaderMode()
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).
The PHY layer is switching to other channel.
void SetSleepMode(void)
Put in sleep mode.
uint32_t m_totalAmpduSize
Total size of the previously transmitted MPDUs in an A-MPDU, used for the computation of the number o...
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...
static std::list< Ptr< const Packet > > PeekAmpduSubframes(Ptr< const Packet > aggregatedPacket)
Peeks the A-MPDU subframes of the provided A-MPDU.
Time GetPayloadDuration(uint32_t size, WifiTxVector txVector, uint16_t frequency)
void SetNumberOfAntennas(uint8_t antennas)
uint16_t GetChannelWidth(void) const
static WifiMode GetHtMcs1()
Return MCS 1 from HT MCS values.
static WifiMode GetHtMcs23()
Return MCS 23 from HT MCS values.
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.
virtual void ConfigureStandard(WifiPhyStandard standard)
Configure the PHY-level parameters for different Wi-Fi standard.
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.
double m_txPowerEndDbm
Maximum transmission power (dBm)
bool IsNull(void) const
Check for null implementation.
static WifiMode GetPlcpHeaderMode(WifiTxVector txVector)
static Time GetPlcpTrainingSymbolDuration(WifiTxVector txVector)
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.
uint8_t GetMcsValue(void) const
Ptr< HtConfiguration > GetHtConfiguration(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.
static Time GetPlcpHeaderDuration(WifiTxVector txVector)
uint8_t GetMaxSupportedTxSpatialStreams(void) const
a unique identifier for an interface.
static WifiMode GetHtMcs15()
Return MCS 15 from HT MCS values.
Ptr< Event > m_currentEvent
Hold the current event.
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.
bool IsStateRx(void) const
static WifiMode GetHtMcs3()
Return MCS 3 from HT MCS values.
uint8_t m_rxSpatialStreams
Number of supported RX spatial streams.
std::vector< uint16_t > m_supportedChannelWidthSet
Supported channel width.
static WifiMode GetOfdmRate6Mbps()
Return a WifiMode for OFDM at 6Mbps.
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).
bool m_shortGuardInterval
Flag if HT/VHT short guard interval is supported (deprecated)
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...
void AddHeader(const Header &header)
Add header to this packet.
static WifiMode GetHeMcs6()
Return MCS 6 from HE MCS values.
static WifiMode GetHtPlcpHeaderMode()
static WifiMode GetOfdmRate4_5MbpsBW5MHz()
Return a WifiMode for OFDM at 4.5Mbps with 5MHz channel spacing.
uint8_t GetNss(void) const
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
std::map< ChannelNumberStandardPair, FrequencyWidthPair > ChannelToFrequencyWidthMap
channel to frequency width map typedef
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.
bool DoChannelSwitch(uint8_t id)
The default implementation does nothing and returns true.
Time GetGuardInterval(void) const