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