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