A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wifi-phy.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2005,2006 INRIA
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7 * Sébastien Deronne <sebastien.deronne@gmail.com>
8 */
9
10#ifndef WIFI_PHY_H
11#define WIFI_PHY_H
12
13#include "phy-entity.h"
16#include "wifi-standards.h"
17
18#include "ns3/error-model.h"
19
20#include <limits>
21
22#define WIFI_PHY_NS_LOG_APPEND_CONTEXT(phy) \
23 { \
24 if (DynamicCast<const WifiPhy>(phy)) \
25 { \
26 std::clog << "[index=" << +phy->GetPhyId() << "][channel=" \
27 << (phy->GetOperatingChannel().IsSet() \
28 ? std::to_string(+phy->GetOperatingChannel().GetNumber()) \
29 : "UNKNOWN") \
30 << "][band=" << phy->GetPhyBand() << "] "; \
31 } \
32 }
33
34namespace ns3
35{
36
37class Channel;
38class WifiNetDevice;
39class MobilityModel;
40class WifiPhyStateHelper;
41class FrameCaptureModel;
42class PreambleDetectionModel;
43class WifiRadioEnergyModel;
44class UniformRandomVariable;
45class InterferenceHelper;
46class ErrorRateModel;
47class WifiMacHeader;
48
49/**
50 * @brief 802.11 PHY layer model
51 * @ingroup wifi
52 *
53 */
54class WifiPhy : public Object
55{
56 public:
57 friend class PhyEntity;
58 /**
59 * @brief Get the type ID.
60 * @return the object TypeId
61 */
62 static TypeId GetTypeId();
63
64 WifiPhy();
65 ~WifiPhy() override;
66
67 /**
68 * Return the WifiPhyStateHelper of this PHY
69 *
70 * @return the WifiPhyStateHelper of this PHY
71 */
73
74 /**
75 * @param callback the callback to invoke
76 * upon successful packet reception.
77 */
79 /**
80 * @param callback the callback to invoke
81 * upon erroneous packet reception.
82 */
84
85 /**
86 * @param listener the new listener
87 *
88 * Add the input listener to the list of objects to be notified of
89 * PHY-level events. The input listener is notified of CCA busy information.
90 */
91 void RegisterListener(const std::shared_ptr<WifiPhyListener>& listener);
92 /**
93 * @param listener the listener to be unregistered
94 *
95 * Remove the input listener from the list of objects to be notified of
96 * PHY-level events.
97 */
98 void UnregisterListener(const std::shared_ptr<WifiPhyListener>& listener);
99
100 /**
101 * @param callback the callback to invoke when PHY capabilities have changed.
102 */
104
105 /**
106 * Start receiving the PHY preamble of a PPDU (i.e. the first bit of the preamble has arrived).
107 *
108 * @param ppdu the arriving PPDU
109 * @param rxPowersW the receive power in W per band
110 * @param rxDuration the duration of the PPDU
111 */
113 RxPowerWattPerChannelBand& rxPowersW,
114 Time rxDuration);
115
116 /**
117 * @return if the PHY is busy decoding the PHY header fields of a PPDU, return the TXVECTOR
118 * used to transmit the PPDU; otherwise, return a null optional value
119 */
120 virtual std::optional<std::reference_wrapper<const WifiTxVector>> GetInfoIfRxingPhyHeader()
121 const;
122
123 /**
124 * For HE receptions only, check and possibly modify the transmit power restriction state at
125 * the end of PPDU reception.
126 */
127 void EndReceiveInterBss();
128
129 /**
130 * Get a WifiConstPsduMap from a PSDU and the TXVECTOR to use to send the PSDU.
131 * The STA-ID value is properly determined based on whether the given PSDU has
132 * to be transmitted as a DL or UL frame.
133 *
134 * @param psdu the given PSDU
135 * @param txVector the TXVECTOR to use to send the PSDU
136 * @return a WifiConstPsduMap built from the given PSDU and the given TXVECTOR
137 */
139 const WifiTxVector& txVector);
140
141 /**
142 * This function is a wrapper for the Send variant that accepts a WifiConstPsduMap
143 * as first argument. This function inserts the given PSDU in a WifiConstPsduMap
144 * along with a STA-ID value that is determined based on whether the given PSDU has
145 * to be transmitted as a DL or UL frame.
146 *
147 * @param psdu the PSDU to send (in a SU PPDU)
148 * @param txVector the TXVECTOR that has TX parameters such as mode, the transmission mode to
149 * use to send this PSDU, and txPowerLevel, a power level to use to send the whole PPDU. The
150 * real transmission power is calculated as txPowerMin + txPowerLevel * (txPowerMax -
151 * txPowerMin) / nTxLevels
152 */
153 void Send(Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector);
154 /**
155 * @param psdus the PSDUs to send
156 * @param txVector the TXVECTOR that has tx parameters such as mode, the transmission mode to
157 * use to send this PSDU, and txPowerLevel, a power level to use to send the whole PPDU. The
158 * real transmission power is calculated as txPowerMin + txPowerLevel * (txPowerMax -
159 * txPowerMin) / nTxLevels
160 */
161 void Send(const WifiConstPsduMap& psdus, const WifiTxVector& txVector);
162
163 /**
164 * @param ppdu the PPDU to send
165 */
166 virtual void StartTx(Ptr<const WifiPpdu> ppdu) = 0;
167
168 /**
169 * Put in sleep mode.
170 *
171 * @param forceSleepWhileInRx force setting sleep mode if state is RX
172 */
173 void SetSleepMode(bool forceSleepWhileInRx = false);
174 /**
175 * Resume from sleep mode.
176 */
177 void ResumeFromSleep();
178 /**
179 * Put in off mode.
180 */
181 void SetOffMode();
182 /**
183 * Resume from off mode.
184 */
185 void ResumeFromOff();
186
187 /**
188 * @return true of the current state of the PHY layer is WifiPhy::IDLE, false otherwise.
189 */
190 bool IsStateIdle() const;
191 /**
192 * @return true of the current state of the PHY layer is WifiPhy::CCA_BUSY, false otherwise.
193 */
194 bool IsStateCcaBusy() const;
195 /**
196 * @return true of the current state of the PHY layer is WifiPhy::RX, false otherwise.
197 */
198 bool IsStateRx() const;
199 /**
200 * @return true of the current state of the PHY layer is WifiPhy::TX, false otherwise.
201 */
202 bool IsStateTx() const;
203 /**
204 * @return true of the current state of the PHY layer is WifiPhy::SWITCHING, false otherwise.
205 */
206 bool IsStateSwitching() const;
207 /**
208 * @return true if the current state of the PHY layer is WifiPhy::SLEEP, false otherwise.
209 */
210 bool IsStateSleep() const;
211 /**
212 * @return true if the current state of the PHY layer is WifiPhy::OFF, false otherwise.
213 */
214 bool IsStateOff() const;
215
216 /**
217 * @return the predicted delay until this PHY can become WifiPhy::IDLE.
218 *
219 * The PHY will never become WifiPhy::IDLE _before_ the delay returned by
220 * this method but it could become really idle later.
221 */
223
224 /**
225 * Return the start time of the last received packet.
226 *
227 * @return the start time of the last received packet
228 */
229 Time GetLastRxStartTime() const;
230 /**
231 * Return the end time of the last received packet.
232 *
233 * @return the end time of the last received packet
234 */
235 Time GetLastRxEndTime() const;
236
237 /**
238 * @param size the number of bytes in the packet to send
239 * @param txVector the TXVECTOR used for the transmission of this packet
240 * @param band the frequency band being used
241 * @param staId the STA-ID of the recipient (only used for MU)
242 *
243 * @return the total amount of time this PHY will stay busy for the transmission of these bytes.
244 */
246 const WifiTxVector& txVector,
247 WifiPhyBand band,
248 uint16_t staId = SU_STA_ID);
249 /**
250 * This function is a wrapper for the CalculateTxDuration variant that accepts a
251 * WifiConstPsduMap as first argument. This function inserts the given PSDU in a
252 * WifiConstPsduMap along with a STA-ID value that is determined based on whether
253 * the given PSDU has to be transmitted as a DL or UL frame, thus allowing to
254 * properly calculate the TX duration in case the PSDU has to be transmitted as
255 * an UL frame.
256 *
257 * @param psdu the PSDU to transmit
258 * @param txVector the TXVECTOR used for the transmission of the PSDU
259 * @param band the frequency band
260 *
261 * @return the total amount of time this PHY will stay busy for the transmission of the PPDU
262 */
264 const WifiTxVector& txVector,
265 WifiPhyBand band);
266 /**
267 * @param psduMap the PSDU(s) to transmit indexed by STA-ID
268 * @param txVector the TXVECTOR used for the transmission of the PPDU
269 * @param band the frequency band being used
270 *
271 * @return the total amount of time this PHY will stay busy for the transmission of the PPDU
272 */
273 static Time CalculateTxDuration(const WifiConstPsduMap& psduMap,
274 const WifiTxVector& txVector,
275 WifiPhyBand band);
276
277 /**
278 * @param txVector the transmission parameters used for this packet
279 *
280 * @return the total amount of time this PHY will stay busy for the transmission of the PHY
281 * preamble and PHY header.
282 */
284 /**
285 * @return the preamble detection duration, which is the time correlation needs to detect the
286 * start of an incoming frame.
287 */
289 /**
290 * @param size the number of bytes in the packet to send
291 * @param txVector the TXVECTOR used for the transmission of this packet
292 * @param band the frequency band
293 * @param mpdutype the type of the MPDU as defined in WifiPhy::MpduType.
294 * @param staId the STA-ID of the PSDU (only used for MU PPDUs)
295 *
296 * @return the duration of the PSDU
297 */
298 static Time GetPayloadDuration(uint32_t size,
299 const WifiTxVector& txVector,
300 WifiPhyBand band,
301 MpduType mpdutype = NORMAL_MPDU,
302 uint16_t staId = SU_STA_ID);
303 /**
304 * @param size the number of bytes in the packet to send
305 * @param txVector the TXVECTOR used for the transmission of this packet
306 * @param band the frequency band
307 * @param mpdutype the type of the MPDU as defined in WifiPhy::MpduType.
308 * @param incFlag this flag is used to indicate that the variables need to be update or not
309 * This function is called a couple of times for the same packet so variables should not be
310 * increased each time.
311 * @param totalAmpduSize the total size of the previously transmitted MPDUs for the concerned
312 * A-MPDU. If incFlag is set, this parameter will be updated.
313 * @param totalAmpduNumSymbols the number of symbols previously transmitted for the MPDUs in the
314 * concerned A-MPDU, used for the computation of the number of symbols needed for the last MPDU.
315 * If incFlag is set, this parameter will be updated.
316 * @param staId the STA-ID of the PSDU (only used for MU PPDUs)
317 *
318 * @return the duration of the PSDU
319 */
320 static Time GetPayloadDuration(uint32_t size,
321 const WifiTxVector& txVector,
322 WifiPhyBand band,
323 MpduType mpdutype,
324 bool incFlag,
325 uint32_t& totalAmpduSize,
326 double& totalAmpduNumSymbols,
327 uint16_t staId);
328 /**
329 * @param txVector the transmission parameters used for this packet
330 *
331 * @return the duration until the start of the packet
332 */
333 static Time GetStartOfPacketDuration(const WifiTxVector& txVector);
334
335 /**
336 * The WifiPhy::GetModeList() method is used
337 * (e.g., by a WifiRemoteStationManager) to determine the set of
338 * transmission/reception (non-MCS) modes that this WifiPhy(-derived class)
339 * can support - a set of modes which is stored by each non-HT PHY.
340 *
341 * It is important to note that this list is a superset (not
342 * necessarily proper) of the OperationalRateSet (which is
343 * logically, if not actually, a property of the associated
344 * WifiRemoteStationManager), which itself is a superset (again, not
345 * necessarily proper) of the BSSBasicRateSet.
346 *
347 * @return the list of supported (non-MCS) modes.
348 */
349 std::list<WifiMode> GetModeList() const;
350 /**
351 * Get the list of supported (non-MCS) modes for the given modulation class (i.e.
352 * corresponding to a given PHY entity).
353 *
354 * @param modulation the modulation class
355 * @return the list of supported (non-MCS) modes for the given modulation class.
356 *
357 * @see GetModeList ()
358 */
359 std::list<WifiMode> GetModeList(WifiModulationClass modulation) const;
360 /**
361 * Check if the given WifiMode is supported by the PHY.
362 *
363 * @param mode the wifi mode to check
364 *
365 * @return true if the given mode is supported,
366 * false otherwise
367 */
368 bool IsModeSupported(WifiMode mode) const;
369 /**
370 * Get the default WifiMode supported by the PHY.
371 * This is the first mode to be added (i.e. the lowest one
372 * over all supported PHY entities).
373 *
374 * @return the default WifiMode
375 */
376 WifiMode GetDefaultMode() const;
377 /**
378 * Check if the given MCS of the given modulation class is supported by the PHY.
379 *
380 * @param modulation the modulation class
381 * @param mcs the MCS value
382 *
383 * @return true if the given mode is supported,
384 * false otherwise
385 */
386 bool IsMcsSupported(WifiModulationClass modulation, uint8_t mcs) const;
387
388 /**
389 * @param txVector the transmission vector
390 * @param ber the probability of bit error rate
391 *
392 * @return the minimum SNR which is required to achieve
393 * the requested BER for the specified transmission vector. (W/W)
394 */
395 double CalculateSnr(const WifiTxVector& txVector, double ber) const;
396
397 /**
398 * Set the Short Interframe Space (SIFS) for this PHY.
399 *
400 * @param sifs the SIFS duration
401 */
402 void SetSifs(Time sifs);
403 /**
404 * Return the Short Interframe Space (SIFS) for this PHY.
405 *
406 * @return the SIFS duration
407 */
408 Time GetSifs() const;
409 /**
410 * Set the slot duration for this PHY.
411 *
412 * @param slot the slot duration
413 */
414 void SetSlot(Time slot);
415 /**
416 * Return the slot duration for this PHY.
417 *
418 * @return the slot duration
419 */
420 Time GetSlot() const;
421 /**
422 * Set the PCF Interframe Space (PIFS) for this PHY.
423 *
424 * @param pifs the PIFS duration
425 */
426 void SetPifs(Time pifs);
427 /**
428 * Return the PCF Interframe Space (PIFS) for this PHY.
429 *
430 * @return the PIFS duration
431 */
432 Time GetPifs() const;
433
434 /**
435 * Get the maximum PSDU size in bytes for the given modulation class.
436 *
437 * @param modulation the modulation class
438 * @return the maximum PSDU size in bytes for the given modulation class
439 */
441
442 /**
443 * The WifiPhy::BssMembershipSelector() method is used
444 * (e.g., by a WifiRemoteStationManager) to determine the set of
445 * transmission/reception modes that this WifiPhy(-derived class)
446 * can support - a set of WifiMode objects which we call the
447 * BssMembershipSelectorSet, and which is stored inside HT PHY (and above)
448 * instances.
449 *
450 * @return the list of BSS membership selectors.
451 */
452 std::list<uint8_t> GetBssMembershipSelectorList() const;
453 /**
454 * @return the number of supported MCSs.
455 *
456 * @see GetMcsList ()
457 */
458 uint16_t GetNMcs() const;
459 /**
460 * The WifiPhy::GetMcsList() method is used
461 * (e.g., by a WifiRemoteStationManager) to determine the set of
462 * transmission/reception MCS indices that this WifiPhy(-derived class)
463 * can support - a set of MCS indices which is stored by each HT PHY (and above).
464 *
465 * @return the list of supported MCSs.
466 */
467 std::list<WifiMode> GetMcsList() const;
468 /**
469 * Get the list of supported MCSs for the given modulation class (i.e.
470 * corresponding to a given PHY entity).
471 *
472 * @param modulation the modulation class
473 * @return the list of supported MCSs for the given modulation class.
474 *
475 * @see GetMcsList ()
476 */
477 std::list<WifiMode> GetMcsList(WifiModulationClass modulation) const;
478 /**
479 * Get the WifiMode object corresponding to the given MCS of the given
480 * modulation class.
481 *
482 * @param modulation the modulation class
483 * @param mcs the MCS value
484 *
485 * @return the WifiMode object corresponding to the given MCS of the given
486 * modulation class
487 */
488 WifiMode GetMcs(WifiModulationClass modulation, uint8_t mcs) const;
489
490 /**
491 * Return current channel number.
492 *
493 * @return the current channel number
494 */
495 uint8_t GetChannelNumber() const;
496 /**
497 * @return the required time for channel switch operation of this WifiPhy
498 */
500
501 /**
502 * Configure the PHY-level parameters for different Wi-Fi standard.
503 * Note that, in case a Spectrum PHY is used, this method must be called after adding
504 * a spectrum channel covering the operating channel bandwidth.
505 *
506 * @param standard the Wi-Fi standard
507 */
508 virtual void ConfigureStandard(WifiStandard standard);
509
510 /**
511 * Set the maximum modulation class that has to be supported by this PHY object.
512 * The maximum modulation class supported will be the minimum between the given modulation
513 * class and the maximum modulation class supported based on the configured standard.
514 *
515 * @param modClass the given modulation class
516 */
518
519 /**
520 * @return the maximum modulation class that has to be supported by this PHY object.
521 */
523
524 /**
525 * Get the configured Wi-Fi standard
526 *
527 * @return the Wi-Fi standard that has been configured
528 */
530
531 /**
532 * Get the configured Wi-Fi band
533 *
534 * @return the Wi-Fi band that has been configured
535 */
536 WifiPhyBand GetPhyBand() const;
537
538 /**
539 * Get a const reference to the operating channel
540 *
541 * @return a const reference to the operating channel
542 */
544
545 /**
546 * Return the Channel this WifiPhy is connected to.
547 *
548 * @return the Channel this WifiPhy is connected to
549 */
550 virtual Ptr<Channel> GetChannel() const = 0;
551
552 /**
553 * Public method used to fire a PhyTxBegin trace.
554 * Implemented for encapsulation purposes.
555 *
556 * @param psdus the PSDUs being transmitted (only one unless DL MU transmission)
557 * @param txPower the transmit power
558 */
559 void NotifyTxBegin(const WifiConstPsduMap& psdus, Watt_u txPower);
560 /**
561 * Public method used to fire a PhyTxEnd trace.
562 * Implemented for encapsulation purposes.
563 *
564 * @param psdus the PSDUs being transmitted (only one unless DL MU transmission)
565 */
566 void NotifyTxEnd(const WifiConstPsduMap& psdus);
567 /**
568 * Public method used to fire a PhyTxDrop trace.
569 * Implemented for encapsulation purposes.
570 *
571 * @param psdu the PSDU being transmitted
572 */
574 /**
575 * Public method used to fire a PhyRxBegin trace.
576 * Implemented for encapsulation purposes.
577 *
578 * @param psdu the PSDU being transmitted
579 * @param rxPowersW the receive power per channel band in Watts
580 */
582 /**
583 * Public method used to fire a PhyRxEnd trace.
584 * Implemented for encapsulation purposes.
585 *
586 * @param psdu the PSDU being transmitted
587 */
589 /**
590 * Public method used to fire a PhyRxDrop trace.
591 * Implemented for encapsulation purposes.
592 *
593 * @note This method is called also by NotifyRxPpduDrop and is left
594 * in the public API for backward compatibility reasons. Do not
595 * call both this method and the newer NotifyRxPpduDrop(). Instead,
596 * call NotifyRxPpduDrop() and it will call this method also.
597 *
598 * @param psdu the PSDU being transmitted
599 * @param reason the reason the packet was dropped
600 */
602
603 /**
604 * Public method used to fire a PhyRxPpduDrop trace.
605 * Implemented for encapsulation purposes. This method also
606 * calls the PhyRxDrop trace.
607 *
608 * @param ppdu the PSDU being transmitted
609 * @param reason the reason the packet was dropped
610 */
612 /**
613 * Public method used to fire a MonitorSniffer trace for a wifi PSDU being received.
614 * Implemented for encapsulation purposes.
615 * This method will extract all MPDUs if packet is an A-MPDU and will fire tracedCallback.
616 * The A-MPDU reference number (RX side) is set within the method. It must be a different value
617 * for each A-MPDU but the same for each subframe within one A-MPDU.
618 *
619 * @param psdu the PSDU being received
620 * @param channelFreq the frequency at which the packet is received. Note that in real devices
621 * this is normally the frequency to which the receiver is tuned, and this can be different than
622 * the frequency at which the packet was originally transmitted. This is because it is possible
623 * to have the receiver tuned on a given channel and still to be able to receive packets on a
624 * nearby channel.
625 * @param txVector the TXVECTOR that holds RX parameters
626 * @param signalNoise signal power and noise power in dBm (noise power includes the noise
627 * figure)
628 * @param statusPerMpdu reception status per MPDU
629 * @param staId the STA-ID
630 */
632 MHz_u channelFreq,
633 const WifiTxVector& txVector,
634 SignalNoiseDbm signalNoise,
635 const std::vector<bool>& statusPerMpdu,
636 uint16_t staId = SU_STA_ID);
637
638 /**
639 * TracedCallback signature for monitor mode receive events.
640 *
641 *
642 * @param packet the packet being received
643 * @param channelFreq the frequency at which the packet is received. Note that in real devices
644 * this is normally the frequency to which the receiver is tuned, and this can be different
645 * than the frequency at which the packet was originally transmitted. This is because it is
646 * possible to have the receiver tuned on a given channel and still to be able to receive
647 * packets on a nearby channel.
648 * @param txVector the TXVECTOR that holds RX parameters
649 * @param aMpdu the type of the packet (0 is not A-MPDU, 1 is a MPDU that is part of an A-MPDU
650 * and 2 is the last MPDU in an A-MPDU) and the A-MPDU reference number (must be a different
651 * value for each A-MPDU but the same for each subframe within one A-MPDU)
652 * @param signalNoise signal power and noise power in dBm
653 * @param staId the STA-ID
654 *
655 * @todo WifiTxVector should be passed by const reference because of its size.
656 */
658 uint16_t channelFreqMhz,
659 WifiTxVector txVector,
660 MpduInfo aMpdu,
661 SignalNoiseDbm signalNoise,
662 uint16_t staId);
663
664 /**
665 * Public method used to fire a MonitorSniffer trace for a wifi PSDU being transmitted.
666 * Implemented for encapsulation purposes.
667 * This method will extract all MPDUs if packet is an A-MPDU and will fire tracedCallback.
668 * The A-MPDU reference number (RX side) is set within the method. It must be a different value
669 * for each A-MPDU but the same for each subframe within one A-MPDU.
670 *
671 * @param psdu the PSDU being received
672 * @param channelFreq the frequency at which the packet is
673 * transmitted.
674 * @param txVector the TXVECTOR that holds TX parameters
675 * @param staId the STA-ID
676 */
678 MHz_u channelFreq,
679 const WifiTxVector& txVector,
680 uint16_t staId = SU_STA_ID);
681
682 /**
683 * TracedCallback signature for monitor mode transmit events.
684 *
685 * @param packet the packet being transmitted
686 * @param channelFreqMhz the frequency in MHz at which the packet is
687 * transmitted.
688 * @param txVector the TXVECTOR that holds TX parameters
689 * @param aMpdu the type of the packet (0 is not A-MPDU, 1 is a MPDU that is part of an A-MPDU
690 * and 2 is the last MPDU in an A-MPDU) and the A-MPDU reference number (must be a different
691 * value for each A-MPDU but the same for each subframe within one A-MPDU)
692 * @param staId the STA-ID
693 *
694 * @todo WifiTxVector should be passed by const reference because of its size.
695 */
696 typedef void (*MonitorSnifferTxCallback)(const Ptr<const Packet> packet,
697 uint16_t channelFreqMhz,
698 WifiTxVector txVector,
699 MpduInfo aMpdu,
700 uint16_t staId);
701
702 /**
703 * TracedCallback signature for Phy transmit events.
704 *
705 * @param packet the packet being transmitted
706 * @param txPowerW the transmit power in Watts
707 */
708 typedef void (*PhyTxBeginTracedCallback)(Ptr<const Packet> packet, double txPowerW);
709
710 /**
711 * TracedCallback signature for PSDU transmit events.
712 *
713 * @param psduMap the PSDU map being transmitted
714 * @param txVector the TXVECTOR holding the TX parameters
715 * @param txPowerW the transmit power in Watts
716 */
717 typedef void (*PsduTxBeginCallback)(WifiConstPsduMap psduMap,
718 const WifiTxVector& txVector,
719 double txPowerW);
720
721 /**
722 * TracedCallback signature for PhyRxBegin trace source.
723 *
724 * @param packet the packet being received
725 * @param rxPowersW the receive power per channel band in Watts
726 */
728 RxPowerWattPerChannelBand rxPowersW);
729
730 /**
731 * TracedCallback signature for start of PSDU reception events.
732 *
733 * @param txVector the TXVECTOR decoded from the PHY header
734 * @param psduDuration the duration of the PSDU
735 */
736 typedef void (*PhyRxPayloadBeginTracedCallback)(WifiTxVector txVector, Time psduDuration);
737
738 /**
739 * TracedCallback signature for PhyRxPpduDrop trace source.
740 *
741 * @param ppdu the ppdu being received
742 * @param reason the reason the ppdu was dropped
743 */
746
747 /**
748 * TracedCallback signature for PhyRxDrop trace source.
749 *
750 * @param packet the packet being received
751 * @param reason the reason the packet was dropped
752 */
755
756 /**
757 * TracedCallback signature for end of MAC header reception events.
758 *
759 * @param macHdr the MAC header of the MPDU being received
760 * @param txVector the TXVECTOR used to transmit the PSDU
761 * @param psduDuration the remaining duration of the PSDU
762 */
763 typedef void (*PhyRxMacHeaderEndTracedCallback)(const WifiMacHeader& macHdr,
764 const WifiTxVector& txVector,
765 Time psduDuration);
766
767 /**
768 * Assign a fixed random variable stream number to the random variables
769 * used by this model. Return the number of streams (possibly zero) that
770 * have been assigned.
771 *
772 * @param stream first stream index to use
773 * @return the number of stream indices assigned by this model
774 */
775 virtual int64_t AssignStreams(int64_t stream);
776
777 /**
778 * Sets the receive sensitivity threshold.
779 * The energy of a received signal should be higher than
780 * this threshold to allow the PHY layer to detect the signal.
781 *
782 * @param threshold the receive sensitivity threshold
783 */
784 void SetRxSensitivity(dBm_u threshold);
785 /**
786 * Return the receive sensitivity threshold.
787 *
788 * @return the receive sensitivity threshold
789 */
790 dBm_u GetRxSensitivity() const;
791 /**
792 * Sets the CCA energy detection threshold. The energy of a all received signals
793 * should be higher than this threshold to allow the PHY layer to declare CCA BUSY state.
794 *
795 * @param threshold the CCA threshold
796 */
797 void SetCcaEdThreshold(dBm_u threshold);
798 /**
799 * Return the CCA energy detection threshold.
800 *
801 * @return the CCA energy detection threshold
802 */
803 dBm_u GetCcaEdThreshold() const;
804 /**
805 * Sets the CCA sensitivity threshold. The energy of a received wifi signal
806 * should be higher than this threshold to allow the PHY layer to declare CCA BUSY state.
807 *
808 * @param threshold the CCA sensitivity threshold
809 */
810 void SetCcaSensitivityThreshold(dBm_u threshold);
811 /**
812 * Return the CCA sensitivity threshold.
813 *
814 * @return the CCA sensitivity threshold
815 */
817 /**
818 * Sets the RX loss in the Signal-to-Noise-Ratio due to non-idealities in the receiver.
819 *
820 * @param noiseFigure noise figure
821 */
822 void SetRxNoiseFigure(dB_u noiseFigure);
823 /**
824 * Sets the minimum available transmission power level.
825 *
826 * @param start the minimum transmission power level
827 */
828 void SetTxPowerStart(dBm_u start);
829 /**
830 * Return the minimum available transmission power level.
831 *
832 * @return the minimum available transmission power level
833 */
834 dBm_u GetTxPowerStart() const;
835 /**
836 * Sets the maximum available transmission power level.
837 *
838 * @param end the maximum transmission power level
839 */
840 void SetTxPowerEnd(dBm_u end);
841 /**
842 * Return the maximum available transmission power level.
843 *
844 * @return the maximum available transmission power level
845 */
846 dBm_u GetTxPowerEnd() const;
847 /**
848 * Sets the number of transmission power levels available between the
849 * minimum level and the maximum level. Transmission power levels are
850 * equally separated (in dBm) with the minimum and the maximum included.
851 *
852 * @param n the number of available levels
853 */
854 void SetNTxPower(uint8_t n);
855 /**
856 * Return the number of available transmission power levels.
857 *
858 * @return the number of available transmission power levels
859 */
860 uint8_t GetNTxPower() const;
861 /**
862 * Sets the transmission gain.
863 *
864 * @param gain the transmission gain
865 */
866 void SetTxGain(dB_u gain);
867 /**
868 * Return the transmission gain.
869 *
870 * @return the transmission gain
871 */
872 dB_u GetTxGain() const;
873 /**
874 * Sets the reception gain.
875 *
876 * @param gain the reception gain
877 */
878 void SetRxGain(dB_u gain);
879 /**
880 * Return the reception gain.
881 *
882 * @return the reception gain
883 */
884 dB_u GetRxGain() const;
885
886 /**
887 * Get the remaining time to preamble detection period to elapse, if preamble detection is
888 * ongoing.
889 *
890 * @return the remaining time to the end of the preamble detection detection period, if ongoing
891 */
892 virtual std::optional<Time> GetTimeToPreambleDetectionEnd() const;
893
894 /**
895 * Get the remaining time to the end of the MAC header reception of the next MPDU being
896 * received from the given STA, if any.
897 *
898 * @param staId the STA-ID of the transmitter; equals SU_STA_ID for SU PPDUs
899 * @return the remaining time to the end of the MAC header reception of the next MPDU, if any
900 */
901 virtual std::optional<Time> GetTimeToMacHdrEnd(uint16_t staId) const;
902
903 /**
904 * Sets the device this PHY is associated with.
905 *
906 * @param device the device this PHY is associated with
907 */
908 virtual void SetDevice(const Ptr<WifiNetDevice> device);
909 /**
910 * Return the device this PHY is associated with
911 *
912 * @return the device this PHY is associated with
913 */
915 /**
916 * @brief assign a mobility model to this device
917 *
918 * This method allows a user to specify a mobility model that should be
919 * associated with this physical layer. Calling this method is optional
920 * and only necessary if the user wants to override the mobility model
921 * that is aggregated to the node.
922 *
923 * @param mobility the mobility model this PHY is associated with
924 */
925 void SetMobility(const Ptr<MobilityModel> mobility);
926 /**
927 * Return the mobility model this PHY is associated with.
928 * This method will return either the mobility model that has been
929 * explicitly set by a call to YansWifiPhy::SetMobility(), or else
930 * will return the mobility model (if any) that has been aggregated
931 * to the node.
932 *
933 * @return the mobility model this PHY is associated with
934 */
936
937 using ChannelTuple = std::tuple<uint8_t /* channel number */,
938 MHz_u /* channel width */,
939 WifiPhyBand /* WifiPhyBand */,
940 uint8_t /* primary20 index*/>; //!< Tuple identifying a segment
941 //!< of an operating channel
942
944 std::vector<ChannelTuple>; //!< segments identifying an operating channel
945
946 /**
947 * If the standard for this object has not been set yet, store the channel settings
948 * corresponding to the given operating channel. Otherwise, check if a channel switch
949 * can be performed now. If not, schedule another call to this method when channel switch
950 * can be performed. Otherwise, set the given operating channel and call ConfigureStandard
951 * if the PHY band has changed.
952 *
953 * Note that, in case a Spectrum PHY is used, a spectrum channel covering the
954 * operating channel bandwidth must have been already added when actually setting
955 * the operating channel.
956 *
957 * @param channel the given operating channel
958 */
959 void SetOperatingChannel(const WifiPhyOperatingChannel& channel);
960
961 /**
962 * This overloaded function is used to pass a list of segments
963 * from which the operating channel can be deduced.
964 *
965 * @param channelSegments the segments identifying the operating channel
966 */
967 void SetOperatingChannel(const ChannelSegments& channelSegments);
968
969 /**
970 * This overloaded function is used when the operating channel
971 * consists of a single segment, identified by a tuple.
972 *
973 * @param tuple the segment identifying the operating channel
974 */
975 void SetOperatingChannel(const ChannelTuple& tuple);
976
977 /**
978 * Configure whether it is prohibited to change PHY band after initialization.
979 *
980 * @param enable true to prohibit changing PHY band after initialization,
981 * false otherwise
982 */
983 void SetFixedPhyBand(bool enable);
984 /**
985 * @return whether it is prohibited to change PHY band after initialization
986 */
987 bool HasFixedPhyBand() const;
988 /**
989 * @return the operating center frequency
990 */
991 MHz_u GetFrequency() const;
992 /**
993 * @return the index of the primary 20 MHz channel
994 */
995 uint8_t GetPrimary20Index() const;
996 /**
997 * Get the bandwidth for a transmission occurring on the current operating channel and
998 * using the given WifiMode, subject to the constraint that the TX bandwidth cannot exceed
999 * the given maximum allowed value.
1000 *
1001 * @param mode the given WifiMode
1002 * @param maxAllowedBandWidth the maximum allowed TX bandwidth
1003 * @return the bandwidth for the transmission
1004 */
1006 MHz_u maxAllowedBandWidth = MHz_u{
1007 std::numeric_limits<double>::max()}) const;
1008 /**
1009 * @param antennas the number of antennas on this node.
1010 */
1011 void SetNumberOfAntennas(uint8_t antennas);
1012 /**
1013 * @return the number of antennas on this device
1014 */
1015 uint8_t GetNumberOfAntennas() const;
1016 /**
1017 * @param streams the maximum number of supported TX spatial streams.
1018 */
1019 void SetMaxSupportedTxSpatialStreams(uint8_t streams);
1020 /**
1021 * @return the maximum number of supported TX spatial streams
1022 */
1023 uint8_t GetMaxSupportedTxSpatialStreams() const;
1024 /**
1025 * @param streams the maximum number of supported RX spatial streams.
1026 */
1027 void SetMaxSupportedRxSpatialStreams(uint8_t streams);
1028 /**
1029 * @return the maximum number of supported RX spatial streams
1030 */
1031 uint8_t GetMaxSupportedRxSpatialStreams() const;
1032 /**
1033 * Enable or disable short PHY preamble.
1034 *
1035 * @param preamble sets whether short PHY preamble is supported or not
1036 */
1037 void SetShortPhyPreambleSupported(bool preamble);
1038 /**
1039 * Return whether short PHY preamble is supported.
1040 *
1041 * @returns if short PHY preamble is supported or not
1042 */
1043 bool GetShortPhyPreambleSupported() const;
1044
1045 /**
1046 * Set the index allocated to this PHY
1047 *
1048 * @param phyId the ID allocated to this PHY
1049 */
1050 void SetPhyId(uint8_t phyId);
1051
1052 /**
1053 * Get the index allocated to this PHY
1054 *
1055 * @return the ID allocated to this PHY
1056 */
1057 uint8_t GetPhyId() const;
1058
1059 /**
1060 * Sets the interference helper.
1061 *
1062 * @param helper the interference helper
1063 */
1064 virtual void SetInterferenceHelper(const Ptr<InterferenceHelper> helper);
1065
1066 /**
1067 * Sets the error rate model.
1068 *
1069 * @param model the error rate model
1070 */
1071 void SetErrorRateModel(const Ptr<ErrorRateModel> model);
1072 /**
1073 * Attach a receive ErrorModel to the WifiPhy.
1074 *
1075 * The WifiPhy may optionally include an ErrorModel in
1076 * the packet receive chain. The error model is additive
1077 * to any modulation-based error model based on SNR, and
1078 * is typically used to force specific packet losses or
1079 * for testing purposes.
1080 *
1081 * @param em Pointer to the ErrorModel.
1082 */
1084 /**
1085 * Sets the frame capture model.
1086 *
1087 * @param frameCaptureModel the frame capture model
1088 */
1089 void SetFrameCaptureModel(const Ptr<FrameCaptureModel> frameCaptureModel);
1090 /**
1091 * Sets the preamble detection model.
1092 *
1093 * @param preambleDetectionModel the preamble detection model
1094 */
1095 void SetPreambleDetectionModel(const Ptr<PreambleDetectionModel> preambleDetectionModel);
1096 /**
1097 * Sets the wifi radio energy model.
1098 *
1099 * @param wifiRadioEnergyModel the wifi radio energy model
1100 */
1101 void SetWifiRadioEnergyModel(const Ptr<WifiRadioEnergyModel> wifiRadioEnergyModel);
1102
1103 /**
1104 * @return the channel width
1105 */
1106 MHz_u GetChannelWidth() const;
1107
1108 /**
1109 * Get the power of the given power level.
1110 * In current implementation, the power levels are equally spaced (in dBm).
1111 *
1112 * @param powerLevel the power level
1113 *
1114 * @return the transmission power at the given power level
1115 */
1116 dBm_u GetPower(uint8_t powerLevel) const;
1117
1118 /**
1119 * Reset PHY to IDLE, with some potential TX power restrictions for the next transmission.
1120 *
1121 * @param powerRestricted flag whether the transmit power is restricted for the next
1122 * transmission
1123 * @param txPowerMaxSiso the SISO transmit power restriction for the next transmission
1124 * @param txPowerMaxMimo the MIMO transmit power restriction for the next transmission
1125 */
1126 void ResetCca(bool powerRestricted,
1127 dBm_u txPowerMaxSiso = dBm_u{0},
1128 dBm_u txPowerMaxMimo = dBm_u{0});
1129 /**
1130 * Compute the transmit power for the next transmission.
1131 * The returned power will satisfy the power density constraints
1132 * after addition of antenna gain.
1133 *
1134 * @param ppdu the PPDU to transmit
1135 * @return the transmit power for the next transmission
1136 */
1137 dBm_u GetTxPowerForTransmission(Ptr<const WifiPpdu> ppdu) const;
1138 /**
1139 * Notify the PHY that an access to the channel was requested.
1140 * This is typically called by the channel access manager to
1141 * to notify the PHY about an ongoing transmission.
1142 * The PHY will use this information to determine whether
1143 * it should use power restriction as imposed by OBSS_PD SR.
1144 */
1146
1147 /**
1148 * This is a helper function to convert start and stop indices to start and stop frequencies.
1149 *
1150 * @param indices the start/stop indices to convert
1151 * @return the converted frequencies
1152 */
1154 const WifiSpectrumBandIndices& indices) const = 0;
1155
1156 /**
1157 * Add the PHY entity to the map of __implemented__ PHY entities for the
1158 * given modulation class.
1159 * Through this method, child classes can add their own PHY entities in
1160 * a static manner.
1161 *
1162 * @param modulation the modulation class
1163 * @param phyEntity the PHY entity
1164 */
1165 static void AddStaticPhyEntity(WifiModulationClass modulation, Ptr<PhyEntity> phyEntity);
1166
1167 /**
1168 * Get the __implemented__ PHY entity corresponding to the modulation class.
1169 * This is used to compute the different amendment-specific parameters within
1170 * calling static methods.
1171 *
1172 * @param modulation the modulation class
1173 * @return the pointer to the static implemented PHY entity
1174 */
1176
1177 /**
1178 * Get the supported PHY entity to use for a received PPDU.
1179 * This typically returns the entity corresponding to the modulation class used to transmit the
1180 * PPDU. If the modulation class used to transmit the PPDU is not supported by the PHY, the
1181 * latest PHY entity corresponding to the configured standard is returned. If the modulation
1182 * used to transmit the PPDU is non-HT (duplicate), the latest PHY entity corresponding to the
1183 * configured standard is also returned.
1184 *
1185 * @param ppdu the received PPDU
1186 * @return the pointer to the supported PHY entity
1187 */
1189
1190 /**
1191 * Get the supported PHY entity corresponding to the modulation class.
1192 *
1193 * @param modulation the modulation class
1194 * @return the pointer to the supported PHY entity
1195 */
1197 /**
1198 * Get the supported PHY entity corresponding to the wifi standard.
1199 *
1200 * @param standard the wifi standard
1201 * @return the pointer to the supported PHY entity
1202 */
1204 /**
1205 * Get the latest PHY entity supported by this PHY instance.
1206 *
1207 * @return the latest PHY entity supported by this PHY instance
1208 */
1210
1211 /**
1212 * @return the UID of the previously received PPDU (reset to UINT64_MAX upon transmission)
1213 */
1214 uint64_t GetPreviouslyRxPpduUid() const;
1215
1216 /**
1217 * Set the UID of the previously received PPDU.
1218 *
1219 * @param uid the value for the UID of the previously received PPDU
1220 *
1221 * @note This method shall only be used in exceptional circumstances, such as when a PHY
1222 * transmits a response to a Trigger Frame that was received by another PHY. This is the
1223 * case, e.g., when an aux PHY of an EMLSR client receives an ICF but it is the main PHY
1224 * that switches channel and transmits the response to the ICF.
1225 */
1226 void SetPreviouslyRxPpduUid(uint64_t uid);
1227
1228 /**
1229 * @param currentChannelWidth channel width of the current transmission
1230 * @return the width of the guard band
1231 *
1232 * Note: in order to properly model out of band transmissions for OFDM, the guard
1233 * band has been configured so as to expand the modeled spectrum up to the
1234 * outermost referenced point in "Transmit spectrum mask" sections' PSDs of
1235 * each PHY specification of 802.11-2016 standard. It thus ultimately corresponds
1236 * to the current channel bandwidth (which can be different from devices max
1237 * channel width).
1238 *
1239 * This method is only relevant for SpectrumWifiPhy.
1240 */
1241 virtual MHz_u GetGuardBandwidth(MHz_u currentChannelWidth) const = 0;
1242 /**
1243 * @return a tuple containing the minimum rejection for the inner band,
1244 * the minimum rejection for the outer band, and
1245 * the maximum rejection for the outer band
1246 * for the transmit spectrum mask.
1247 *
1248 * This method is only relevant for SpectrumWifiPhy.
1249 */
1250 virtual std::tuple<dBr_u, dBr_u, dBr_u> GetTxMaskRejectionParams() const = 0;
1251
1252 /**
1253 * Get channel number of the primary channel
1254 * @param primaryChannelWidth the width of the primary channel
1255 *
1256 * @return channel number of the primary channel
1257 */
1258 uint8_t GetPrimaryChannelNumber(MHz_u primaryChannelWidth) const;
1259
1260 /**
1261 * Get the info of a given band
1262 *
1263 * @param bandWidth the width of the band to be returned
1264 * @param bandIndex the index of the band to be returned
1265 *
1266 * @return the info that defines the band
1267 */
1268 virtual WifiSpectrumBandInfo GetBand(MHz_u bandWidth, uint8_t bandIndex = 0) = 0;
1269
1270 /**
1271 * Get the frequency range of the current RF interface.
1272 *
1273 * @return the frequency range of the current RF interface
1274 */
1276
1277 /**
1278 * @return the subcarrier spacing corresponding to the configure standard
1279 */
1280 Hz_u GetSubcarrierSpacing() const;
1281
1282 /**
1283 * Callback invoked when the PHY model starts to transmit a signal
1284 *
1285 * @param ppdu The PPDU being transmitted
1286 * @param txVector txVector used for transmitting the PPDU
1287 */
1289 const WifiTxVector& txVector);
1290
1291 protected:
1292 void DoInitialize() override;
1293 void DoDispose() override;
1294
1295 /**
1296 * Reset data upon end of TX or RX
1297 */
1298 void Reset();
1299
1300 /**
1301 * Perform any actions necessary when user changes operating channel after
1302 * initialization.
1303 *
1304 * @return the amount of time to wait until the channel switch can be performed or
1305 * std::nullopt if channel switch is currently not possible (i.e., the radio is in sleep mode)
1306 */
1307 std::optional<Time> GetDelayUntilChannelSwitch();
1308 /**
1309 * Actually switch channel based on the stored channel settings.
1310 */
1311 virtual void DoChannelSwitch();
1312
1313 /**
1314 * Check if PHY state should move to CCA busy state based on current
1315 * state of interference tracker.
1316 *
1317 * @param ppdu the incoming PPDU or nullptr for any signal
1318 */
1319 void SwitchMaybeToCcaBusy(const Ptr<const WifiPpdu> ppdu = nullptr);
1320 /**
1321 * Notify PHY state helper to switch to CCA busy state,
1322 *
1323 * @param ppdu the incoming PPDU or nullptr for any signal
1324 * @param duration the duration of the CCA state
1325 */
1326 void NotifyCcaBusy(const Ptr<const WifiPpdu> ppdu, Time duration);
1327
1328 /**
1329 * Add the PHY entity to the map of supported PHY entities for the
1330 * given modulation class for the WifiPhy instance.
1331 * This is a wrapper method used to check that the PHY entity is
1332 * in the static map of implemented PHY entities (\see GetStaticPhyEntities).
1333 * In addition, child classes can add their own PHY entities.
1334 *
1335 * @param modulation the modulation class
1336 * @param phyEntity the PHY entity
1337 */
1338 void AddPhyEntity(WifiModulationClass modulation, Ptr<PhyEntity> phyEntity);
1339
1340 uint8_t m_phyId; //!< the index of the PHY in the vector of PHYs held by the WifiNetDevice
1341
1343 m_interference; //!< Pointer to a helper responsible for interference computations
1344
1345 Ptr<UniformRandomVariable> m_random; //!< Provides uniform random variables.
1346 Ptr<WifiPhyStateHelper> m_state; //!< Pointer to WifiPhyStateHelper
1347
1348 uint32_t m_txMpduReferenceNumber; //!< A-MPDU reference number to identify all transmitted
1349 //!< subframes belonging to the same received A-MPDU
1350 uint32_t m_rxMpduReferenceNumber; //!< A-MPDU reference number to identify all received
1351 //!< subframes belonging to the same received A-MPDU
1352
1353 EventId m_endPhyRxEvent; //!< the end of PHY receive event
1354 EventId m_endTxEvent; //!< the end of transmit event
1355
1356 Ptr<Event> m_currentEvent; //!< Hold the current event
1357 std::map<std::pair<uint64_t /* UID*/, WifiPreamble>, Ptr<Event>>
1358 m_currentPreambleEvents; //!< store event associated to a PPDU (that has a unique ID and
1359 //!< preamble combination) whose preamble is being received
1360
1361 uint64_t m_previouslyRxPpduUid; //!< UID of the previously received PPDU, reset to UINT64_MAX
1362 //!< upon transmission
1363
1364 /**
1365 * This map holds the supported PHY entities.
1366 *
1367 * The set of parameters (e.g. mode) that this WifiPhy(-derived class) can
1368 * support can be obtained through it.
1369 *
1370 * When it comes to modes, in conversation we call this set
1371 * the DeviceRateSet (not a term you'll find in the standard), and
1372 * it is a superset of standard-defined parameters such as the
1373 * OperationalRateSet, and the BSSBasicRateSet (which, themselves,
1374 * have a superset/subset relationship).
1375 *
1376 * Mandatory rates relevant to this WifiPhy can be found by
1377 * iterating over the elements of this map, for each modulation class,
1378 * looking for WifiMode objects for which
1379 * WifiMode::IsMandatory() is true.
1380 */
1381 std::map<WifiModulationClass, Ptr<PhyEntity>> m_phyEntities;
1382
1384 m_signalTransmissionCb; //!< Signal Transmission callback
1385
1386 private:
1387 /**
1388 * Configure WifiPhy with appropriate channel frequency and
1389 * supported rates for 802.11a standard.
1390 */
1391 void Configure80211a();
1392 /**
1393 * Configure WifiPhy with appropriate channel frequency and
1394 * supported rates for 802.11b standard.
1395 */
1396 void Configure80211b();
1397 /**
1398 * Configure WifiPhy with appropriate channel frequency and
1399 * supported rates for 802.11g standard.
1400 */
1401 void Configure80211g();
1402 /**
1403 * Configure WifiPhy with appropriate channel frequency and
1404 * supported rates for 802.11p standard.
1405 */
1406 void Configure80211p();
1407 /**
1408 * Configure WifiPhy with appropriate channel frequency and
1409 * supported rates for 802.11n standard.
1410 */
1411 void Configure80211n();
1412 /**
1413 * Configure WifiPhy with appropriate channel frequency and
1414 * supported rates for 802.11ac standard.
1415 */
1416 void Configure80211ac();
1417 /**
1418 * Configure WifiPhy with appropriate channel frequency and
1419 * supported rates for 802.11ax standard.
1420 */
1421 void Configure80211ax();
1422 /**
1423 * Configure WifiPhy with appropriate channel frequency and
1424 * supported rates for 802.11be standard.
1425 */
1426 void Configure80211be();
1427 /**
1428 * Configure the device MCS set with the appropriate HtMcs modes for
1429 * the number of available transmit spatial streams
1430 */
1432 /**
1433 * Add the given MCS to the device MCS set.
1434 *
1435 * @param mode the MCS to add to the device MCS set
1436 */
1437 void PushMcs(WifiMode mode);
1438 /**
1439 * Rebuild the mapping of MCS values to indices in the device MCS set.
1440 */
1442
1443 /**
1444 * Due to newly arrived signal, the current reception cannot be continued and has to be aborted
1445 * @param reason the reason the reception is aborted
1446 *
1447 */
1449
1450 /**
1451 * Callback function when a transmission is completed
1452 * @param psdus the PSDUs that have been sent
1453 */
1454 void TxDone(const WifiConstPsduMap& psdus);
1455
1456 /**
1457 * Get the PSDU addressed to that PHY in a PPDU (useful for MU PPDU).
1458 *
1459 * @param ppdu the PPDU to extract the PSDU from
1460 * @return the PSDU addressed to that PHY
1461 */
1463
1464 /**
1465 * Method that can be overridden by subclasses to perform operations after the channel is
1466 * actually switched but before the MAC is notified of the channel switch.
1467 */
1468 virtual void FinalizeChannelSwitch() = 0;
1469
1470 /**
1471 * The trace source fired when a packet begins the transmission process on
1472 * the medium.
1473 *
1474 * @see class CallBackTraceSource
1475 */
1477 /**
1478 * The trace source fired when a PSDU map begins the transmission process on
1479 * the medium.
1480 *
1481 * @see class CallBackTraceSource
1482 */
1484
1485 /**
1486 * The trace source fired when a packet ends the transmission process on
1487 * the medium.
1488 *
1489 * @see class CallBackTraceSource
1490 */
1492
1493 /**
1494 * The trace source fired when the PHY layer drops a packet as it tries
1495 * to transmit it.
1496 *
1497 * @see class CallBackTraceSource
1498 */
1500
1501 /**
1502 * The trace source fired when a packet begins the reception process from
1503 * the medium.
1504 *
1505 * @see class CallBackTraceSource
1506 */
1508
1509 /**
1510 * The trace source fired when the reception of the PHY payload (PSDU) begins.
1511 *
1512 * This traced callback models the behavior of the PHY-RXSTART
1513 * primitive which is launched upon correct decoding of
1514 * the PHY header and support of modes within.
1515 * We thus assume that it is sent just before starting
1516 * the decoding of the payload, since it's there that
1517 * support of the header's content is checked. In addition,
1518 * it's also at that point that the correct decoding of
1519 * HT-SIG, VHT-SIGs, and HE-SIGs are checked.
1520 *
1521 * @see class CallBackTraceSource
1522 */
1524
1525 /**
1526 * The trace source fired when the reception of a MAC header ends.
1527 *
1528 * This traced callback models the behavior of real PHYs that are able to decode the MAC
1529 * header of an MPDU being received and make the information therein available to the MAC
1530 * as soon as the reception of the MAC header ends.
1531 *
1532 * @see class CallBackTraceSource
1533 */
1535
1536 /**
1537 * The trace source fired when a packet ends the reception process from
1538 * the medium.
1539 *
1540 * @see class CallBackTraceSource
1541 */
1543
1544 /**
1545 * The trace source fired when the PHY layer drops a packet it has received.
1546 *
1547 * @see class CallBackTraceSource
1548 */
1550
1551 /**
1552 * The trace source fired when the PHY layer drops a packet it has received.
1553 */
1555
1556 /**
1557 * A trace source that emulates a Wi-Fi device in monitor mode
1558 * sniffing a packet being received.
1559 *
1560 * As a reference with the real world, firing this trace
1561 * corresponds in the madwifi driver to calling the function
1562 * ieee80211_input_monitor()
1563 *
1564 * @see class CallBackTraceSource
1565 * @todo WifiTxVector and signalNoiseDbm should be passed as
1566 * const references because of their sizes.
1567 */
1569 uint16_t /* frequency (MHz) */,
1571 MpduInfo,
1573 uint16_t /* STA-ID*/>
1575
1576 /**
1577 * A trace source that emulates a Wi-Fi device in monitor mode
1578 * sniffing a packet being transmitted.
1579 *
1580 * As a reference with the real world, firing this trace
1581 * corresponds in the madwifi driver to calling the function
1582 * ieee80211_input_monitor()
1583 *
1584 * @see class CallBackTraceSource
1585 * @todo WifiTxVector should be passed by const reference because
1586 * of its size.
1587 */
1589 uint16_t /* frequency (MHz) */,
1591 MpduInfo,
1592 uint16_t /* STA-ID*/>
1594
1595 /**
1596 * @return the map of __implemented__ PHY entities.
1597 * This is used to compute the different
1598 * amendment-specific parameters in a static manner.
1599 * For PHY entities supported by a given WifiPhy instance,
1600 * @see m_phyEntities.
1601 */
1602 static std::map<WifiModulationClass, Ptr<PhyEntity>>& GetStaticPhyEntities();
1603
1604 WifiStandard m_standard; //!< WifiStandard
1605 WifiModulationClass m_maxModClassSupported; //!< max modulation class supported
1606 WifiPhyBand m_band; //!< WifiPhyBand
1607 ChannelSegments m_channelSettings; //!< Store operating channel settings until initialization
1609 bool m_fixedPhyBand; //!< True to prohibit changing PHY band after initialization
1610
1611 Time m_sifs; //!< Short Interframe Space (SIFS) duration
1612 Time m_slot; //!< Slot duration
1613 Time m_pifs; //!< PCF Interframe Space (PIFS) duration
1614
1615 dBm_u m_rxSensitivity; //!< Receive sensitivity threshold
1616 dBm_u m_ccaEdThreshold; //!< Clear channel assessment (CCA) energy detection (ED) threshold
1617 dBm_u m_ccaSensitivityThreshold; //!< Clear channel assessment (CCA) modulation and coding rate
1618 //!< sensitivity threshold
1619
1620 dB_u m_txGain; //!< Transmission gain
1621 dB_u m_rxGain; //!< Reception gain
1622 dBm_u m_txPowerBase; //!< Minimum transmission power
1623 dBm_u m_txPowerEnd; //!< Maximum transmission power
1624 uint8_t m_nTxPower; //!< Number of available transmission power levels
1625 dBm_per_MHz_u m_powerDensityLimit; //!< the power density limit
1626
1627 bool m_powerRestricted; //!< Flag whether transmit power is restricted by OBSS PD SR
1628 dBm_u m_txPowerMaxSiso; //!< SISO maximum transmit power due to OBSS PD SR power restriction
1629 dBm_u m_txPowerMaxMimo; //!< MIMO maximum transmit power due to OBSS PD SR power restriction
1630 bool m_channelAccessRequested; //!< Flag if channels access has been requested (used for OBSS_PD
1631 //!< SR)
1632
1633 bool m_shortPreamble; //!< Flag if short PHY preamble is supported
1634 uint8_t m_numberOfAntennas; //!< Number of transmitters
1635 uint8_t m_txSpatialStreams; //!< Number of supported TX spatial streams
1636 uint8_t m_rxSpatialStreams; //!< Number of supported RX spatial streams
1637
1638 dB_u m_noiseFigure; //!< The noise figure
1639
1640 Time m_channelSwitchDelay; //!< Time required to switch between channel
1641
1642 MHz_u m_maxRadioBw; //!< Maximum radio bandwidth
1643
1644 Ptr<WifiNetDevice> m_device; //!< Pointer to the device
1645 Ptr<MobilityModel> m_mobility; //!< Pointer to the mobility model
1646
1650 Ptr<ErrorModel> m_postReceptionErrorModel; //!< Error model for receive packet events
1651 Time m_timeLastPreambleDetected; //!< Record the time the last preamble was detected
1652 bool m_notifyRxMacHeaderEnd; //!< whether the PHY is capable of notifying MAC header RX end
1653
1654 Callback<void> m_capabilitiesChangedCallback; //!< Callback when PHY capabilities changed
1655};
1656
1657/**
1658 * @param os output stream
1659 * @param rxSignalInfo received signal info to stringify
1660 * @return output stream
1661 */
1662std::ostream& operator<<(std::ostream& os, RxSignalInfo rxSignalInfo);
1663
1664} // namespace ns3
1665
1666#endif /* WIFI_PHY_H */
An identifier for simulation events.
Definition event-id.h:45
A base class which provides memory management and object aggregation.
Definition object.h:78
Abstract class for PHY entities.
Definition phy-entity.h:64
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition type-id.h:49
Implements the IEEE 802.11 MAC header.
represent a single transmission mode
Definition wifi-mode.h:40
802.11 PHY layer model
Definition wifi-phy.h:55
static TypeId GetTypeId()
Get the type ID.
Definition wifi-phy.cc:60
void SetNumberOfAntennas(uint8_t antennas)
Definition wifi-phy.cc:1310
Ptr< WifiPhyStateHelper > m_state
Pointer to WifiPhyStateHelper.
Definition wifi-phy.h:1346
bool IsStateTx() const
Definition wifi-phy.cc:2169
Ptr< MobilityModel > m_mobility
Pointer to the mobility model.
Definition wifi-phy.h:1645
dBm_u m_ccaEdThreshold
Clear channel assessment (CCA) energy detection (ED) threshold.
Definition wifi-phy.h:1616
void(* PhyTxBeginTracedCallback)(Ptr< const Packet > packet, double txPowerW)
TracedCallback signature for Phy transmit events.
Definition wifi-phy.h:708
dBm_u GetTxPowerStart() const
Return the minimum available transmission power level.
Definition wifi-phy.cc:578
WifiModulationClass GetMaxModulationClassSupported() const
Definition wifi-phy.cc:991
bool IsStateIdle() const
Definition wifi-phy.cc:2157
void SetRxGain(dB_u gain)
Sets the reception gain.
Definition wifi-phy.cc:623
virtual void SetInterferenceHelper(const Ptr< InterferenceHelper > helper)
Sets the interference helper.
Definition wifi-phy.cc:686
uint8_t m_txSpatialStreams
Number of supported TX spatial streams.
Definition wifi-phy.h:1635
bool IsStateCcaBusy() const
Definition wifi-phy.cc:2151
void Send(Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector)
This function is a wrapper for the Send variant that accepts a WifiConstPsduMap as first argument.
Definition wifi-phy.cc:1809
Ptr< UniformRandomVariable > m_random
Provides uniform random variables.
Definition wifi-phy.h:1345
Ptr< WifiRadioEnergyModel > m_wifiRadioEnergyModel
Wifi radio energy model.
Definition wifi-phy.h:1649
void SetRxNoiseFigure(dB_u noiseFigure)
Sets the RX loss in the Signal-to-Noise-Ratio due to non-idealities in the receiver.
Definition wifi-phy.cc:560
void Configure80211ax()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11ax standard.
Definition wifi-phy.cc:961
void SetRxSensitivity(dBm_u threshold)
Sets the receive sensitivity threshold.
Definition wifi-phy.cc:521
Time m_channelSwitchDelay
Time required to switch between channel.
Definition wifi-phy.h:1640
dB_u GetTxGain() const
Return the transmission gain.
Definition wifi-phy.cc:617
void SetTxPowerEnd(dBm_u end)
Sets the maximum available transmission power level.
Definition wifi-phy.cc:584
void(* PhyRxPpduDropTracedCallback)(Ptr< const WifiPpdu > ppdu, WifiPhyRxfailureReason reason)
TracedCallback signature for PhyRxPpduDrop trace source.
Definition wifi-phy.h:744
dBm_per_MHz_u m_powerDensityLimit
the power density limit
Definition wifi-phy.h:1625
void NotifyCcaBusy(const Ptr< const WifiPpdu > ppdu, Time duration)
Notify PHY state helper to switch to CCA busy state,.
Definition wifi-phy.cc:2218
void NotifyMonitorSniffTx(Ptr< const WifiPsdu > psdu, MHz_u channelFreq, const WifiTxVector &txVector, uint16_t staId=SU_STA_ID)
Public method used to fire a MonitorSniffer trace for a wifi PSDU being transmitted.
Definition wifi-phy.cc:1737
WifiPhyOperatingChannel m_operatingChannel
Operating channel.
Definition wifi-phy.h:1608
void(* PsduTxBeginCallback)(WifiConstPsduMap psduMap, const WifiTxVector &txVector, double txPowerW)
TracedCallback signature for PSDU transmit events.
Definition wifi-phy.h:717
TracedCallback< Ptr< const Packet > > m_phyTxDropTrace
The trace source fired when the PHY layer drops a packet as it tries to transmit it.
Definition wifi-phy.h:1499
void SetErrorRateModel(const Ptr< ErrorRateModel > model)
Sets the error rate model.
Definition wifi-phy.cc:695
bool m_channelAccessRequested
Flag if channels access has been requested (used for OBSS_PD SR)
Definition wifi-phy.h:1630
static Time GetPayloadDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, MpduType mpdutype=NORMAL_MPDU, uint16_t staId=SU_STA_ID)
Definition wifi-phy.cc:1516
Time GetSlot() const
Return the slot duration for this PHY.
Definition wifi-phy.cc:849
void SetMaxSupportedRxSpatialStreams(uint8_t streams)
Definition wifi-phy.cc:1360
Ptr< const WifiPsdu > GetAddressedPsduInPpdu(Ptr< const WifiPpdu > ppdu) const
Get the PSDU addressed to that PHY in a PPDU (useful for MU PPDU).
Definition wifi-phy.cc:2334
void Configure80211g()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11g standard.
Definition wifi-phy.cc:897
uint8_t GetPrimary20Index() const
Definition wifi-phy.cc:1093
dBm_u m_rxSensitivity
Receive sensitivity threshold.
Definition wifi-phy.h:1615
std::map< std::pair< uint64_t, WifiPreamble >, Ptr< Event > > m_currentPreambleEvents
store event associated to a PPDU (that has a unique ID and preamble combination) whose preamble is be...
Definition wifi-phy.h:1358
uint8_t GetNumberOfAntennas() const
Definition wifi-phy.cc:1322
Time m_slot
Slot duration.
Definition wifi-phy.h:1612
dBm_u GetRxSensitivity() const
Return the receive sensitivity threshold.
Definition wifi-phy.cc:528
Time GetDelayUntilIdle()
Definition wifi-phy.cc:2193
MHz_u m_maxRadioBw
Maximum radio bandwidth.
Definition wifi-phy.h:1642
bool GetShortPhyPreambleSupported() const
Return whether short PHY preamble is supported.
Definition wifi-phy.cc:643
void SetSifs(Time sifs)
Set the Short Interframe Space (SIFS) for this PHY.
Definition wifi-phy.cc:831
std::list< uint8_t > GetBssMembershipSelectorList() const
The WifiPhy::BssMembershipSelector() method is used (e.g., by a WifiRemoteStationManager) to determin...
Definition wifi-phy.cc:1378
void Configure80211n()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11n standard.
Definition wifi-phy.cc:938
EventId m_endPhyRxEvent
the end of PHY receive event
Definition wifi-phy.h:1353
dBm_u m_ccaSensitivityThreshold
Clear channel assessment (CCA) modulation and coding rate sensitivity threshold.
Definition wifi-phy.h:1617
void Configure80211be()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11be standard.
Definition wifi-phy.cc:976
void NotifyRxDrop(Ptr< const WifiPsdu > psdu, WifiPhyRxfailureReason reason)
Public method used to fire a PhyRxDrop trace.
Definition wifi-phy.cc:1664
bool IsStateRx() const
Definition wifi-phy.cc:2163
bool IsMcsSupported(WifiModulationClass modulation, uint8_t mcs) const
Check if the given MCS of the given modulation class is supported by the PHY.
Definition wifi-phy.cc:2049
Time GetSifs() const
Return the Short Interframe Space (SIFS) for this PHY.
Definition wifi-phy.cc:837
dBm_u m_txPowerMaxMimo
MIMO maximum transmit power due to OBSS PD SR power restriction.
Definition wifi-phy.h:1629
bool m_notifyRxMacHeaderEnd
whether the PHY is capable of notifying MAC header RX end
Definition wifi-phy.h:1652
Hz_u GetSubcarrierSpacing() const
Definition wifi-phy.cc:2365
std::tuple< uint8_t, MHz_u, WifiPhyBand, uint8_t > ChannelTuple
Tuple identifying a segment of an operating channel.
Definition wifi-phy.h:937
MHz_u GetFrequency() const
Definition wifi-phy.cc:1075
Ptr< MobilityModel > GetMobility() const
Return the mobility model this PHY is associated with.
Definition wifi-phy.cc:667
uint16_t GetNMcs() const
Definition wifi-phy.cc:2095
void SetSleepMode(bool forceSleepWhileInRx=false)
Put in sleep mode.
Definition wifi-phy.cc:1393
void ResumeFromSleep()
Resume from sleep mode.
Definition wifi-phy.cc:1449
void SetTxPowerStart(dBm_u start)
Sets the minimum available transmission power level.
Definition wifi-phy.cc:571
static Time GetPreambleDetectionDuration()
Definition wifi-phy.cc:1504
void Configure80211p()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11p standard.
Definition wifi-phy.cc:910
dBm_u m_txPowerEnd
Maximum transmission power.
Definition wifi-phy.h:1623
void AbortCurrentReception(WifiPhyRxfailureReason reason)
Due to newly arrived signal, the current reception cannot be continued and has to be aborted.
Definition wifi-phy.cc:2225
Ptr< FrameCaptureModel > m_frameCaptureModel
Frame capture model.
Definition wifi-phy.h:1647
TracedCallback< Ptr< const Packet > > m_phyRxEndTrace
The trace source fired when a packet ends the reception process from the medium.
Definition wifi-phy.h:1542
void NotifyRxBegin(Ptr< const WifiPsdu > psdu, const RxPowerWattPerChannelBand &rxPowersW)
Public method used to fire a PhyRxBegin trace.
Definition wifi-phy.cc:1640
Time GetChannelSwitchDelay() const
Definition wifi-phy.cc:747
void SetTxGain(dB_u gain)
Sets the transmission gain.
Definition wifi-phy.cc:610
void(* PhyRxMacHeaderEndTracedCallback)(const WifiMacHeader &macHdr, const WifiTxVector &txVector, Time psduDuration)
TracedCallback signature for end of MAC header reception events.
Definition wifi-phy.h:763
void SetMaxSupportedTxSpatialStreams(uint8_t streams)
Definition wifi-phy.cc:1328
void NotifyTxBegin(const WifiConstPsduMap &psdus, Watt_u txPower)
Public method used to fire a PhyTxBegin trace.
Definition wifi-phy.cc:1598
Time m_sifs
Short Interframe Space (SIFS) duration.
Definition wifi-phy.h:1611
void SetReceiveErrorCallback(RxErrorCallback callback)
Definition wifi-phy.cc:492
TracedCallback< Ptr< const WifiPpdu >, const WifiTxVector & > m_signalTransmissionCb
Signal Transmission callback.
Definition wifi-phy.h:1384
void NotifyMonitorSniffRx(Ptr< const WifiPsdu > psdu, MHz_u channelFreq, const WifiTxVector &txVector, SignalNoiseDbm signalNoise, const std::vector< bool > &statusPerMpdu, uint16_t staId=SU_STA_ID)
Public method used to fire a MonitorSniffer trace for a wifi PSDU being received.
Definition wifi-phy.cc:1683
dBm_u GetTxPowerEnd() const
Return the maximum available transmission power level.
Definition wifi-phy.cc:591
void ConfigureHtDeviceMcsSet()
Configure the device MCS set with the appropriate HtMcs modes for the number of available transmit sp...
bool IsStateOff() const
Definition wifi-phy.cc:2187
uint8_t GetMaxSupportedRxSpatialStreams() const
Definition wifi-phy.cc:1372
virtual void ConfigureStandard(WifiStandard standard)
Configure the PHY-level parameters for different Wi-Fi standard.
Definition wifi-phy.cc:997
void SetPostReceptionErrorModel(const Ptr< ErrorModel > em)
Attach a receive ErrorModel to the WifiPhy.
Definition wifi-phy.cc:703
WifiMode GetMcs(WifiModulationClass modulation, uint8_t mcs) const
Get the WifiMode object corresponding to the given MCS of the given modulation class.
Definition wifi-phy.cc:2144
void PushMcs(WifiMode mode)
Add the given MCS to the device MCS set.
uint8_t m_numberOfAntennas
Number of transmitters.
Definition wifi-phy.h:1634
uint32_t m_txMpduReferenceNumber
A-MPDU reference number to identify all transmitted subframes belonging to the same received A-MPDU.
Definition wifi-phy.h:1348
TracedCallback< Ptr< const WifiPpdu >, WifiPhyRxfailureReason > m_phyRxPpduDropTrace
The trace source fired when the PHY layer drops a packet it has received.
Definition wifi-phy.h:1554
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
Definition wifi-phy.cc:1563
static uint32_t GetMaxPsduSize(WifiModulationClass modulation)
Get the maximum PSDU size in bytes for the given modulation class.
Definition wifi-phy.cc:1592
dBm_u GetCcaEdThreshold() const
Return the CCA energy detection threshold.
Definition wifi-phy.cc:541
Ptr< WifiPhyStateHelper > GetState() const
Return the WifiPhyStateHelper of this PHY.
Definition wifi-phy.cc:480
dBm_u m_txPowerBase
Minimum transmission power.
Definition wifi-phy.h:1622
virtual Ptr< Channel > GetChannel() const =0
Return the Channel this WifiPhy is connected to.
void NotifyTxEnd(const WifiConstPsduMap &psdus)
Public method used to fire a PhyTxEnd trace.
Definition wifi-phy.cc:1613
void EndReceiveInterBss()
For HE receptions only, check and possibly modify the transmit power restriction state at the end of ...
Definition wifi-phy.cc:2003
void SetShortPhyPreambleSupported(bool preamble)
Enable or disable short PHY preamble.
Definition wifi-phy.cc:636
void SetNTxPower(uint8_t n)
Sets the number of transmission power levels available between the minimum level and the maximum leve...
Definition wifi-phy.cc:597
void SetCcaSensitivityThreshold(dBm_u threshold)
Sets the CCA sensitivity threshold.
Definition wifi-phy.cc:547
WifiPhyBand m_band
WifiPhyBand.
Definition wifi-phy.h:1606
dBm_u m_txPowerMaxSiso
SISO maximum transmit power due to OBSS PD SR power restriction.
Definition wifi-phy.h:1628
virtual MHz_u GetGuardBandwidth(MHz_u currentChannelWidth) const =0
static const Ptr< const PhyEntity > GetStaticPhyEntity(WifiModulationClass modulation)
Get the implemented PHY entity corresponding to the modulation class.
Definition wifi-phy.cc:759
void(* MonitorSnifferTxCallback)(const Ptr< const Packet > packet, uint16_t channelFreqMhz, WifiTxVector txVector, MpduInfo aMpdu, uint16_t staId)
TracedCallback signature for monitor mode transmit events.
Definition wifi-phy.h:696
virtual std::tuple< dBr_u, dBr_u, dBr_u > GetTxMaskRejectionParams() const =0
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.
Definition wifi-phy.h:1593
virtual WifiSpectrumBandFrequencies ConvertIndicesToFrequencies(const WifiSpectrumBandIndices &indices) const =0
This is a helper function to convert start and stop indices to start and stop frequencies.
virtual std::optional< Time > GetTimeToMacHdrEnd(uint16_t staId) const
Get the remaining time to the end of the MAC header reception of the next MPDU being received from th...
Definition wifi-phy.cc:1790
std::map< WifiModulationClass, Ptr< PhyEntity > > m_phyEntities
This map holds the supported PHY entities.
Definition wifi-phy.h:1381
MHz_u GetTxBandwidth(WifiMode mode, MHz_u maxAllowedBandWidth=MHz_u{ std::numeric_limits< double >::max()}) const
Get the bandwidth for a transmission occurring on the current operating channel and using the given W...
Definition wifi-phy.cc:1111
void NotifyRxPpduDrop(Ptr< const WifiPpdu > ppdu, WifiPhyRxfailureReason reason)
Public method used to fire a PhyRxPpduDrop trace.
Definition wifi-phy.cc:1676
virtual void StartTx(Ptr< const WifiPpdu > ppdu)=0
void SetMaxModulationClassSupported(WifiModulationClass modClass)
Set the maximum modulation class that has to be supported by this PHY object.
Definition wifi-phy.cc:984
void AddPhyEntity(WifiModulationClass modulation, Ptr< PhyEntity > phyEntity)
Add the PHY entity to the map of supported PHY entities for the given modulation class for the WifiPh...
Definition wifi-phy.cc:818
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.
Definition wifi-phy.h:1574
Ptr< ErrorModel > m_postReceptionErrorModel
Error model for receive packet events.
Definition wifi-phy.h:1650
EventId m_endTxEvent
the end of transmit event
Definition wifi-phy.h:1354
static WifiConstPsduMap GetWifiConstPsduMap(Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector)
Get a WifiConstPsduMap from a PSDU and the TXVECTOR to use to send the PSDU.
Definition wifi-phy.cc:1803
void RegisterListener(const std::shared_ptr< WifiPhyListener > &listener)
Definition wifi-phy.cc:498
static std::map< WifiModulationClass, Ptr< PhyEntity > > & GetStaticPhyEntities()
Definition wifi-phy.cc:473
void SetSlot(Time slot)
Set the slot duration for this PHY.
Definition wifi-phy.cc:843
WifiPhyBand GetPhyBand() const
Get the configured Wi-Fi band.
Definition wifi-phy.cc:1057
void SetPreviouslyRxPpduUid(uint64_t uid)
Set the UID of the previously received PPDU.
Definition wifi-phy.cc:1944
Ptr< Event > m_currentEvent
Hold the current event.
Definition wifi-phy.h:1356
Time GetLastRxStartTime() const
Return the start time of the last received packet.
Definition wifi-phy.cc:2199
WifiMode GetDefaultMode() const
Get the default WifiMode supported by the PHY.
Definition wifi-phy.cc:2033
Ptr< PhyEntity > GetPhyEntity(WifiModulationClass modulation) const
Get the supported PHY entity corresponding to the modulation class.
Definition wifi-phy.cc:768
uint8_t GetChannelNumber() const
Return current channel number.
Definition wifi-phy.cc:1081
TracedCallback< Ptr< const Packet > > m_phyTxEndTrace
The trace source fired when a packet ends the transmission process on the medium.
Definition wifi-phy.h:1491
uint64_t m_previouslyRxPpduUid
UID of the previously received PPDU, reset to UINT64_MAX upon transmission.
Definition wifi-phy.h:1361
std::optional< Time > GetDelayUntilChannelSwitch()
Perform any actions necessary when user changes operating channel after initialization.
Definition wifi-phy.cc:1181
virtual void FinalizeChannelSwitch()=0
Method that can be overridden by subclasses to perform operations after the channel is actually switc...
uint32_t m_rxMpduReferenceNumber
A-MPDU reference number to identify all received subframes belonging to the same received A-MPDU.
Definition wifi-phy.h:1350
void SetWifiRadioEnergyModel(const Ptr< WifiRadioEnergyModel > wifiRadioEnergyModel)
Sets the wifi radio energy model.
Definition wifi-phy.cc:722
TracedCallback< Ptr< const Packet >, double > m_phyTxBeginTrace
The trace source fired when a packet begins the transmission process on the medium.
Definition wifi-phy.h:1476
virtual void SetDevice(const Ptr< WifiNetDevice > device)
Sets the device this PHY is associated with.
Definition wifi-phy.cc:649
Ptr< PreambleDetectionModel > m_preambleDetectionModel
Preamble detection model.
Definition wifi-phy.h:1648
virtual std::optional< std::reference_wrapper< const WifiTxVector > > GetInfoIfRxingPhyHeader() const
Definition wifi-phy.cc:1992
Time GetPifs() const
Return the PCF Interframe Space (PIFS) for this PHY.
Definition wifi-phy.cc:861
static void AddStaticPhyEntity(WifiModulationClass modulation, Ptr< PhyEntity > phyEntity)
Add the PHY entity to the map of implemented PHY entities for the given modulation class.
Definition wifi-phy.cc:809
void(* MonitorSnifferRxCallback)(Ptr< const Packet > packet, uint16_t channelFreqMhz, WifiTxVector txVector, MpduInfo aMpdu, SignalNoiseDbm signalNoise, uint16_t staId)
TracedCallback signature for monitor mode receive events.
Definition wifi-phy.h:657
void NotifyRxEnd(Ptr< const WifiPsdu > psdu)
Public method used to fire a PhyRxEnd trace.
Definition wifi-phy.cc:1652
void StartReceivePreamble(Ptr< const WifiPpdu > ppdu, RxPowerWattPerChannelBand &rxPowersW, Time rxDuration)
Start receiving the PHY preamble of a PPDU (i.e.
Definition wifi-phy.cc:1969
TracedCallback< WifiConstPsduMap, WifiTxVector, double > m_phyTxPsduBeginTrace
The trace source fired when a PSDU map begins the transmission process on the medium.
Definition wifi-phy.h:1483
std::vector< ChannelTuple > ChannelSegments
segments identifying an operating channel
Definition wifi-phy.h:943
dB_u m_txGain
Transmission gain.
Definition wifi-phy.h:1620
MHz_u GetChannelWidth() const
Definition wifi-phy.cc:1087
bool IsStateSleep() const
Definition wifi-phy.cc:2181
void SetOperatingChannel(const WifiPhyOperatingChannel &channel)
If the standard for this object has not been set yet, store the channel settings corresponding to the...
Definition wifi-phy.cc:1123
Ptr< WifiNetDevice > GetDevice() const
Return the device this PHY is associated with.
Definition wifi-phy.cc:655
WifiStandard m_standard
WifiStandard.
Definition wifi-phy.h:1604
uint8_t m_nTxPower
Number of available transmission power levels.
Definition wifi-phy.h:1624
void DoDispose() override
Destructor implementation.
Definition wifi-phy.cc:444
void ResetCca(bool powerRestricted, dBm_u txPowerMaxSiso=dBm_u{0}, dBm_u txPowerMaxMimo=dBm_u{0})
Reset PHY to IDLE, with some potential TX power restrictions for the next transmission.
Definition wifi-phy.cc:2275
dB_u GetRxGain() const
Return the reception gain.
Definition wifi-phy.cc:630
bool IsStateSwitching() const
Definition wifi-phy.cc:2175
void SetPhyId(uint8_t phyId)
Set the index allocated to this PHY.
Definition wifi-phy.cc:673
virtual void DoChannelSwitch()
Actually switch channel based on the stored channel settings.
Definition wifi-phy.cc:1222
void SetOffMode()
Put in off mode.
Definition wifi-phy.cc:1439
TracedCallback< Ptr< const Packet >, WifiPhyRxfailureReason > m_phyRxDropTrace
The trace source fired when the PHY layer drops a packet it has received.
Definition wifi-phy.h:1549
void SetPreambleDetectionModel(const Ptr< PreambleDetectionModel > preambleDetectionModel)
Sets the preamble detection model.
Definition wifi-phy.cc:716
void RebuildMcsMap()
Rebuild the mapping of MCS values to indices in the device MCS set.
uint8_t m_phyId
the index of the PHY in the vector of PHYs held by the WifiNetDevice
Definition wifi-phy.h:1340
void SetPifs(Time pifs)
Set the PCF Interframe Space (PIFS) for this PHY.
Definition wifi-phy.cc:855
void Configure80211b()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11b standard.
Definition wifi-phy.cc:881
void SetCcaEdThreshold(dBm_u threshold)
Sets the CCA energy detection threshold.
Definition wifi-phy.cc:534
dB_u m_noiseFigure
The noise figure.
Definition wifi-phy.h:1638
void(* SignalTransmissionCallback)(Ptr< const WifiPpdu > ppdu, const WifiTxVector &txVector)
Callback invoked when the PHY model starts to transmit a signal.
Definition wifi-phy.h:1288
static Time GetStartOfPacketDuration(const WifiTxVector &txVector)
Definition wifi-phy.cc:1510
virtual FrequencyRange GetCurrentFrequencyRange() const =0
Get the frequency range of the current RF interface.
void SwitchMaybeToCcaBusy(const Ptr< const WifiPpdu > ppdu=nullptr)
Check if PHY state should move to CCA busy state based on current state of interference tracker.
Definition wifi-phy.cc:2211
void SetMobility(const Ptr< MobilityModel > mobility)
assign a mobility model to this device
Definition wifi-phy.cc:661
uint8_t m_rxSpatialStreams
Number of supported RX spatial streams.
Definition wifi-phy.h:1636
dB_u m_rxGain
Reception gain.
Definition wifi-phy.h:1621
double CalculateSnr(const WifiTxVector &txVector, double ber) const
Definition wifi-phy.cc:753
void SetFixedPhyBand(bool enable)
Configure whether it is prohibited to change PHY band after initialization.
Definition wifi-phy.cc:1099
void(* PhyRxBeginTracedCallback)(Ptr< const Packet > packet, RxPowerWattPerChannelBand rxPowersW)
TracedCallback signature for PhyRxBegin trace source.
Definition wifi-phy.h:727
~WifiPhy() override
Definition wifi-phy.cc:413
void Configure80211ac()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11ac standard.
Definition wifi-phy.cc:953
bool HasFixedPhyBand() const
Definition wifi-phy.cc:1105
TracedCallback< Ptr< const Packet >, RxPowerWattPerChannelBand > m_phyRxBeginTrace
The trace source fired when a packet begins the reception process from the medium.
Definition wifi-phy.h:1507
Ptr< WifiNetDevice > m_device
Pointer to the device.
Definition wifi-phy.h:1644
Ptr< InterferenceHelper > m_interference
Pointer to a helper responsible for interference computations.
Definition wifi-phy.h:1343
void DoInitialize() override
Initialize() implementation.
Definition wifi-phy.cc:419
bool m_shortPreamble
Flag if short PHY preamble is supported.
Definition wifi-phy.h:1633
uint8_t GetPhyId() const
Get the index allocated to this PHY.
Definition wifi-phy.cc:680
Time m_pifs
PCF Interframe Space (PIFS) duration.
Definition wifi-phy.h:1613
WifiModulationClass m_maxModClassSupported
max modulation class supported
Definition wifi-phy.h:1605
void(* PhyRxDropTracedCallback)(Ptr< const Packet > packet, WifiPhyRxfailureReason reason)
TracedCallback signature for PhyRxDrop trace source.
Definition wifi-phy.h:753
void(* PhyRxPayloadBeginTracedCallback)(WifiTxVector txVector, Time psduDuration)
TracedCallback signature for start of PSDU reception events.
Definition wifi-phy.h:736
WifiStandard GetStandard() const
Get the configured Wi-Fi standard.
Definition wifi-phy.cc:1063
void SetCapabilitiesChangedCallback(Callback< void > callback)
Definition wifi-phy.cc:515
void SetReceiveOkCallback(RxOkCallback callback)
Definition wifi-phy.cc:486
void SetFrameCaptureModel(const Ptr< FrameCaptureModel > frameCaptureModel)
Sets the frame capture model.
Definition wifi-phy.cc:710
void NotifyChannelAccessRequested()
Notify the PHY that an access to the channel was requested.
Definition wifi-phy.cc:2013
dBm_u GetTxPowerForTransmission(Ptr< const WifiPpdu > ppdu) const
Compute the transmit power for the next transmission.
Definition wifi-phy.cc:2298
void ResumeFromOff()
Resume from off mode.
Definition wifi-phy.cc:1476
bool m_powerRestricted
Flag whether transmit power is restricted by OBSS PD SR.
Definition wifi-phy.h:1627
Callback< void > m_capabilitiesChangedCallback
Callback when PHY capabilities changed.
Definition wifi-phy.h:1654
Ptr< PhyEntity > GetPhyEntityForPpdu(const Ptr< const WifiPpdu > ppdu) const
Get the supported PHY entity to use for a received PPDU.
Definition wifi-phy.cc:789
uint64_t GetPreviouslyRxPpduUid() const
Definition wifi-phy.cc:1938
void Reset()
Reset data upon end of TX or RX.
Definition wifi-phy.cc:1951
TracedCallback< WifiTxVector, Time > m_phyRxPayloadBeginTrace
The trace source fired when the reception of the PHY payload (PSDU) begins.
Definition wifi-phy.h:1523
Time GetLastRxEndTime() const
Return the end time of the last received packet.
Definition wifi-phy.cc:2205
TracedCallback< const WifiMacHeader &, const WifiTxVector &, Time > m_phyRxMacHeaderEndTrace
The trace source fired when the reception of a MAC header ends.
Definition wifi-phy.h:1534
Time m_timeLastPreambleDetected
Record the time the last preamble was detected.
Definition wifi-phy.h:1651
uint8_t GetMaxSupportedTxSpatialStreams() const
Definition wifi-phy.cc:1354
void Configure80211a()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11a standard.
Definition wifi-phy.cc:867
std::list< WifiMode > GetMcsList() const
The WifiPhy::GetMcsList() method is used (e.g., by a WifiRemoteStationManager) to determine the set o...
Definition wifi-phy.cc:2109
std::list< WifiMode > GetModeList() const
The WifiPhy::GetModeList() method is used (e.g., by a WifiRemoteStationManager) to determine the set ...
Definition wifi-phy.cc:2060
ChannelSegments m_channelSettings
Store operating channel settings until initialization.
Definition wifi-phy.h:1607
virtual WifiSpectrumBandInfo GetBand(MHz_u bandWidth, uint8_t bandIndex=0)=0
Get the info of a given band.
void TxDone(const WifiConstPsduMap &psdus)
Callback function when a transmission is completed.
Definition wifi-phy.cc:1928
const WifiPhyOperatingChannel & GetOperatingChannel() const
Get a const reference to the operating channel.
Definition wifi-phy.cc:1069
virtual std::optional< Time > GetTimeToPreambleDetectionEnd() const
Get the remaining time to preamble detection period to elapse, if preamble detection is ongoing.
Definition wifi-phy.cc:1777
uint8_t GetPrimaryChannelNumber(MHz_u primaryChannelWidth) const
Get channel number of the primary channel.
Definition wifi-phy.cc:2359
dBm_u GetPower(uint8_t powerLevel) const
Get the power of the given power level.
Definition wifi-phy.cc:728
bool m_fixedPhyBand
True to prohibit changing PHY band after initialization.
Definition wifi-phy.h:1609
Ptr< PhyEntity > GetLatestPhyEntity() const
Get the latest PHY entity supported by this PHY instance.
Definition wifi-phy.cc:783
uint8_t GetNTxPower() const
Return the number of available transmission power levels.
Definition wifi-phy.cc:604
virtual int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Definition wifi-phy.cc:2341
static Time CalculatePhyPreambleAndHeaderDuration(const WifiTxVector &txVector)
Definition wifi-phy.cc:1556
bool IsModeSupported(WifiMode mode) const
Check if the given WifiMode is supported by the PHY.
Definition wifi-phy.cc:2020
void UnregisterListener(const std::shared_ptr< WifiPhyListener > &listener)
Definition wifi-phy.cc:509
dBm_u GetCcaSensitivityThreshold() const
Return the CCA sensitivity threshold.
Definition wifi-phy.cc:554
void NotifyTxDrop(Ptr< const WifiPsdu > psdu)
Public method used to fire a PhyTxDrop trace.
Definition wifi-phy.cc:1628
Class that keeps track of all information about the current PHY operating channel.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
WifiStandard
Identifies the IEEE 802.11 specifications that a Wifi device can be configured to use.
WifiPhyRxfailureReason
Enumeration of the possible reception failure reasons.
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
WifiPhyBand
Identifies the PHY band.
WifiModulationClass
This enumeration defines the modulation classes per (Table 10-6 "Modulation classes"; IEEE 802....
MpduType
The type of an MPDU.
Definition wifi-types.h:47
@ NORMAL_MPDU
The MPDU is not part of an A-MPDU.
Definition wifi-types.h:49
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition angles.cc:148
double MHz_u
MHz weak type.
Definition wifi-units.h:31
std::pair< Hz_u, Hz_u > WifiSpectrumBandFrequencies
typedef for a pair of start and stop frequencies to represent a band
std::map< WifiSpectrumBandInfo, Watt_u > RxPowerWattPerChannelBand
A map of the received power for each band.
Definition phy-entity.h:45
double dBm_u
dBm weak type
Definition wifi-units.h:27
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
Definition wifi-ppdu.h:38
static constexpr uint16_t SU_STA_ID
STA_ID to identify a single user (SU)
Definition wifi-mode.h:24
std::pair< uint32_t, uint32_t > WifiSpectrumBandIndices
typedef for a pair of start and stop sub-band indices
Declaration of:
Struct defining a frequency range between minFrequency and maxFrequency.
MpduInfo structure.
Definition wifi-types.h:71
RxSignalInfo structure containing info on the received signal.
Definition wifi-types.h:78
SignalNoiseDbm structure.
Definition wifi-types.h:64
WifiSpectrumBandInfo structure containing info about a spectrum band.