A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wifi-phy.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2005,2006 INRIA
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7 * Sébastien Deronne <sebastien.deronne@gmail.com>
8 */
9
10#ifndef WIFI_PHY_H
11#define WIFI_PHY_H
12
13#include "phy-entity.h"
16#include "wifi-standards.h"
17
18#include "ns3/error-model.h"
19
20#include <limits>
21
22#define WIFI_PHY_NS_LOG_APPEND_CONTEXT(phy) \
23 { \
24 if (DynamicCast<const WifiPhy>(phy)) \
25 { \
26 std::clog << "[index=" << +phy->GetPhyId() << "][channel=" \
27 << (phy->GetOperatingChannel().IsSet() \
28 ? std::to_string(+phy->GetOperatingChannel().GetNumber()) \
29 : "UNKNOWN") \
30 << "][band=" << phy->GetPhyBand() << "] "; \
31 } \
32 }
33
34namespace ns3
35{
36
37class Channel;
38class WifiNetDevice;
39class MobilityModel;
40class WifiPhyStateHelper;
41class FrameCaptureModel;
42class PreambleDetectionModel;
43class WifiRadioEnergyModel;
44class UniformRandomVariable;
45class InterferenceHelper;
46class ErrorRateModel;
47class WifiMacHeader;
48
49/**
50 * @brief 802.11 PHY layer model
51 * @ingroup wifi
52 *
53 */
54class WifiPhy : public Object
55{
56 public:
57 friend class PhyEntity;
58 /**
59 * @brief Get the type ID.
60 * @return the object TypeId
61 */
62 static TypeId GetTypeId();
63
64 WifiPhy();
65 ~WifiPhy() override;
66
67 /**
68 * Return the WifiPhyStateHelper of this PHY
69 *
70 * @return the WifiPhyStateHelper of this PHY
71 */
73
74 /**
75 * @param callback the callback to invoke
76 * upon successful packet reception.
77 */
79 /**
80 * @param callback the callback to invoke
81 * upon erroneous packet reception.
82 */
84
85 /**
86 * @param listener the new listener
87 *
88 * Add the input listener to the list of objects to be notified of
89 * PHY-level events. The input listener is notified of CCA busy information.
90 */
91 void RegisterListener(const std::shared_ptr<WifiPhyListener>& listener);
92 /**
93 * @param listener the listener to be unregistered
94 *
95 * Remove the input listener from the list of objects to be notified of
96 * PHY-level events.
97 */
98 void UnregisterListener(const std::shared_ptr<WifiPhyListener>& listener);
99
100 /**
101 * @param callback the callback to invoke when PHY capabilities have changed.
102 */
104
105 /**
106 * Start receiving the PHY preamble of a PPDU (i.e. the first bit of the preamble has arrived).
107 *
108 * @param ppdu the arriving PPDU
109 * @param rxPowersW the receive power in W per band
110 * @param rxDuration the duration of the PPDU
111 */
113 RxPowerWattPerChannelBand& rxPowersW,
114 Time rxDuration);
115
116 /**
117 * @return if the PHY is busy decoding the PHY header fields of a PPDU, return the TXVECTOR
118 * used to transmit the PPDU; otherwise, return a null optional value
119 */
120 std::optional<std::reference_wrapper<const WifiTxVector>> GetInfoIfRxingPhyHeader() const;
121
122 /**
123 * For HE receptions only, check and possibly modify the transmit power restriction state at
124 * the end of PPDU reception.
125 */
126 void EndReceiveInterBss();
127
128 /**
129 * Get a WifiConstPsduMap from a PSDU and the TXVECTOR to use to send the PSDU.
130 * The STA-ID value is properly determined based on whether the given PSDU has
131 * to be transmitted as a DL or UL frame.
132 *
133 * @param psdu the given PSDU
134 * @param txVector the TXVECTOR to use to send the PSDU
135 * @return a WifiConstPsduMap built from the given PSDU and the given TXVECTOR
136 */
138 const WifiTxVector& txVector);
139
140 /**
141 * This function is a wrapper for the Send variant that accepts a WifiConstPsduMap
142 * as first argument. This function inserts the given PSDU in a WifiConstPsduMap
143 * along with a STA-ID value that is determined based on whether the given PSDU has
144 * to be transmitted as a DL or UL frame.
145 *
146 * @param psdu the PSDU to send (in a SU PPDU)
147 * @param txVector the TXVECTOR that has TX parameters such as mode, the transmission mode to
148 * use to send this PSDU, and txPowerLevel, a power level to use to send the whole PPDU. The
149 * real transmission power is calculated as txPowerMin + txPowerLevel * (txPowerMax -
150 * txPowerMin) / nTxLevels
151 */
152 void Send(Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector);
153 /**
154 * @param psdus the PSDUs to send
155 * @param txVector the TXVECTOR that has tx parameters such as mode, the transmission mode to
156 * use to send this PSDU, and txPowerLevel, a power level to use to send the whole PPDU. The
157 * real transmission power is calculated as txPowerMin + txPowerLevel * (txPowerMax -
158 * txPowerMin) / nTxLevels
159 */
160 void Send(const WifiConstPsduMap& psdus, const WifiTxVector& txVector);
161
162 /**
163 * @param ppdu the PPDU to send
164 */
165 virtual void StartTx(Ptr<const WifiPpdu> ppdu) = 0;
166
167 /**
168 * Put in sleep mode.
169 *
170 * @param forceSleepWhileInRx force setting sleep mode if state is RX
171 */
172 void SetSleepMode(bool forceSleepWhileInRx = false);
173 /**
174 * Resume from sleep mode.
175 */
176 void ResumeFromSleep();
177 /**
178 * Put in off mode.
179 */
180 void SetOffMode();
181 /**
182 * Resume from off mode.
183 */
184 void ResumeFromOff();
185
186 /**
187 * @return true of the current state of the PHY layer is WifiPhy::IDLE, false otherwise.
188 */
189 bool IsStateIdle() const;
190 /**
191 * @return true of the current state of the PHY layer is WifiPhy::CCA_BUSY, false otherwise.
192 */
193 bool IsStateCcaBusy() const;
194 /**
195 * @return true of the current state of the PHY layer is WifiPhy::RX, false otherwise.
196 */
197 bool IsStateRx() const;
198 /**
199 * @return true of the current state of the PHY layer is WifiPhy::TX, false otherwise.
200 */
201 bool IsStateTx() const;
202 /**
203 * @return true of the current state of the PHY layer is WifiPhy::SWITCHING, false otherwise.
204 */
205 bool IsStateSwitching() const;
206 /**
207 * @return true if the current state of the PHY layer is WifiPhy::SLEEP, false otherwise.
208 */
209 bool IsStateSleep() const;
210 /**
211 * @return true if the current state of the PHY layer is WifiPhy::OFF, false otherwise.
212 */
213 bool IsStateOff() const;
214
215 /**
216 * @return the predicted delay until this PHY can become WifiPhy::IDLE.
217 *
218 * The PHY will never become WifiPhy::IDLE _before_ the delay returned by
219 * this method but it could become really idle later.
220 */
222
223 /**
224 * Return the start time of the last received packet.
225 *
226 * @return the start time of the last received packet
227 */
228 Time GetLastRxStartTime() const;
229 /**
230 * Return the end time of the last received packet.
231 *
232 * @return the end time of the last received packet
233 */
234 Time GetLastRxEndTime() const;
235
236 /**
237 * @param size the number of bytes in the packet to send
238 * @param txVector the TXVECTOR used for the transmission of this packet
239 * @param band the frequency band being used
240 * @param staId the STA-ID of the recipient (only used for MU)
241 *
242 * @return the total amount of time this PHY will stay busy for the transmission of these bytes.
243 */
245 const WifiTxVector& txVector,
246 WifiPhyBand band,
247 uint16_t staId = SU_STA_ID);
248 /**
249 * This function is a wrapper for the CalculateTxDuration variant that accepts a
250 * WifiConstPsduMap as first argument. This function inserts the given PSDU in a
251 * WifiConstPsduMap along with a STA-ID value that is determined based on whether
252 * the given PSDU has to be transmitted as a DL or UL frame, thus allowing to
253 * properly calculate the TX duration in case the PSDU has to be transmitted as
254 * an UL frame.
255 *
256 * @param psdu the PSDU to transmit
257 * @param txVector the TXVECTOR used for the transmission of the PSDU
258 * @param band the frequency band
259 *
260 * @return the total amount of time this PHY will stay busy for the transmission of the PPDU
261 */
263 const WifiTxVector& txVector,
264 WifiPhyBand band);
265 /**
266 * @param psduMap the PSDU(s) to transmit indexed by STA-ID
267 * @param txVector the TXVECTOR used for the transmission of the PPDU
268 * @param band the frequency band being used
269 *
270 * @return the total amount of time this PHY will stay busy for the transmission of the PPDU
271 */
272 static Time CalculateTxDuration(const WifiConstPsduMap& psduMap,
273 const WifiTxVector& txVector,
274 WifiPhyBand band);
275
276 /**
277 * @param txVector the transmission parameters used for this packet
278 *
279 * @return the total amount of time this PHY will stay busy for the transmission of the PHY
280 * preamble and PHY header.
281 */
283 /**
284 * @return the preamble detection duration, which is the time correlation needs to detect the
285 * start of an incoming frame.
286 */
288 /**
289 * @param size the number of bytes in the packet to send
290 * @param txVector the TXVECTOR used for the transmission of this packet
291 * @param band the frequency band
292 * @param mpdutype the type of the MPDU as defined in WifiPhy::MpduType.
293 * @param staId the STA-ID of the PSDU (only used for MU PPDUs)
294 *
295 * @return the duration of the PSDU
296 */
297 static Time GetPayloadDuration(uint32_t size,
298 const WifiTxVector& txVector,
299 WifiPhyBand band,
300 MpduType mpdutype = NORMAL_MPDU,
301 uint16_t staId = SU_STA_ID);
302 /**
303 * @param size the number of bytes in the packet to send
304 * @param txVector the TXVECTOR used for the transmission of this packet
305 * @param band the frequency band
306 * @param mpdutype the type of the MPDU as defined in WifiPhy::MpduType.
307 * @param incFlag this flag is used to indicate that the variables need to be update or not
308 * This function is called a couple of times for the same packet so variables should not be
309 * increased each time.
310 * @param totalAmpduSize the total size of the previously transmitted MPDUs for the concerned
311 * A-MPDU. If incFlag is set, this parameter will be updated.
312 * @param totalAmpduNumSymbols the number of symbols previously transmitted for the MPDUs in the
313 * concerned A-MPDU, used for the computation of the number of symbols needed for the last MPDU.
314 * If incFlag is set, this parameter will be updated.
315 * @param staId the STA-ID of the PSDU (only used for MU PPDUs)
316 *
317 * @return the duration of the PSDU
318 */
319 static Time GetPayloadDuration(uint32_t size,
320 const WifiTxVector& txVector,
321 WifiPhyBand band,
322 MpduType mpdutype,
323 bool incFlag,
324 uint32_t& totalAmpduSize,
325 double& totalAmpduNumSymbols,
326 uint16_t staId);
327 /**
328 * @param txVector the transmission parameters used for this packet
329 *
330 * @return the duration until the start of the packet
331 */
332 static Time GetStartOfPacketDuration(const WifiTxVector& txVector);
333
334 /**
335 * The WifiPhy::GetModeList() method is used
336 * (e.g., by a WifiRemoteStationManager) to determine the set of
337 * transmission/reception (non-MCS) modes that this WifiPhy(-derived class)
338 * can support - a set of modes which is stored by each non-HT PHY.
339 *
340 * It is important to note that this list is a superset (not
341 * necessarily proper) of the OperationalRateSet (which is
342 * logically, if not actually, a property of the associated
343 * WifiRemoteStationManager), which itself is a superset (again, not
344 * necessarily proper) of the BSSBasicRateSet.
345 *
346 * @return the list of supported (non-MCS) modes.
347 */
348 std::list<WifiMode> GetModeList() const;
349 /**
350 * Get the list of supported (non-MCS) modes for the given modulation class (i.e.
351 * corresponding to a given PHY entity).
352 *
353 * @param modulation the modulation class
354 * @return the list of supported (non-MCS) modes for the given modulation class.
355 *
356 * @see GetModeList ()
357 */
358 std::list<WifiMode> GetModeList(WifiModulationClass modulation) const;
359 /**
360 * Check if the given WifiMode is supported by the PHY.
361 *
362 * @param mode the wifi mode to check
363 *
364 * @return true if the given mode is supported,
365 * false otherwise
366 */
367 bool IsModeSupported(WifiMode mode) const;
368 /**
369 * Get the default WifiMode supported by the PHY.
370 * This is the first mode to be added (i.e. the lowest one
371 * over all supported PHY entities).
372 *
373 * @return the default WifiMode
374 */
375 WifiMode GetDefaultMode() const;
376 /**
377 * Check if the given MCS of the given modulation class is supported by the PHY.
378 *
379 * @param modulation the modulation class
380 * @param mcs the MCS value
381 *
382 * @return true if the given mode is supported,
383 * false otherwise
384 */
385 bool IsMcsSupported(WifiModulationClass modulation, uint8_t mcs) const;
386
387 /**
388 * @param txVector the transmission vector
389 * @param ber the probability of bit error rate
390 *
391 * @return the minimum SNR which is required to achieve
392 * the requested BER for the specified transmission vector. (W/W)
393 */
394 double CalculateSnr(const WifiTxVector& txVector, double ber) const;
395
396 /**
397 * Set the Short Interframe Space (SIFS) for this PHY.
398 *
399 * @param sifs the SIFS duration
400 */
401 void SetSifs(Time sifs);
402 /**
403 * Return the Short Interframe Space (SIFS) for this PHY.
404 *
405 * @return the SIFS duration
406 */
407 Time GetSifs() const;
408 /**
409 * Set the slot duration for this PHY.
410 *
411 * @param slot the slot duration
412 */
413 void SetSlot(Time slot);
414 /**
415 * Return the slot duration for this PHY.
416 *
417 * @return the slot duration
418 */
419 Time GetSlot() const;
420 /**
421 * Set the PCF Interframe Space (PIFS) for this PHY.
422 *
423 * @param pifs the PIFS duration
424 */
425 void SetPifs(Time pifs);
426 /**
427 * Return the PCF Interframe Space (PIFS) for this PHY.
428 *
429 * @return the PIFS duration
430 */
431 Time GetPifs() const;
432 /**
433 * Return the estimated Ack TX time for this PHY.
434 *
435 * @return the estimated Ack TX time
436 */
437 Time GetAckTxTime() const;
438 /**
439 * Return the estimated BlockAck TX time for this PHY.
440 *
441 * @return the estimated BlockAck TX time
442 */
443 Time GetBlockAckTxTime() 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 the end of the MAC header reception of the next MPDU being
899 * received from the given STA, if any.
900 *
901 * @param staId the STA-ID of the transmitter; equals SU_STA_ID for SU PPDUs
902 * @return the remaining time to the end of the MAC header reception of the next MPDU, if any
903 */
904 std::optional<Time> GetTimeToMacHdrEnd(uint16_t staId) const;
905
906 /**
907 * Sets the device this PHY is associated with.
908 *
909 * @param device the device this PHY is associated with
910 */
911 virtual void SetDevice(const Ptr<WifiNetDevice> device);
912 /**
913 * Return the device this PHY is associated with
914 *
915 * @return the device this PHY is associated with
916 */
918 /**
919 * @brief assign a mobility model to this device
920 *
921 * This method allows a user to specify a mobility model that should be
922 * associated with this physical layer. Calling this method is optional
923 * and only necessary if the user wants to override the mobility model
924 * that is aggregated to the node.
925 *
926 * @param mobility the mobility model this PHY is associated with
927 */
928 void SetMobility(const Ptr<MobilityModel> mobility);
929 /**
930 * Return the mobility model this PHY is associated with.
931 * This method will return either the mobility model that has been
932 * explicitly set by a call to YansWifiPhy::SetMobility(), or else
933 * will return the mobility model (if any) that has been aggregated
934 * to the node.
935 *
936 * @return the mobility model this PHY is associated with
937 */
939
940 using ChannelTuple = std::tuple<uint8_t /* channel number */,
941 MHz_u /* channel width */,
942 WifiPhyBand /* WifiPhyBand */,
943 uint8_t /* primary20 index*/>; //!< Tuple identifying a segment
944 //!< of an operating channel
945
947 std::vector<ChannelTuple>; //!< segments identifying an operating channel
948
949 /**
950 * If the standard for this object has not been set yet, store the channel settings
951 * corresponding to the given operating channel. Otherwise, check if a channel switch
952 * can be performed now. If not, schedule another call to this method when channel switch
953 * can be performed. Otherwise, set the given operating channel and call ConfigureStandard
954 * if the PHY band has changed.
955 *
956 * Note that, in case a Spectrum PHY is used, a spectrum channel covering the
957 * operating channel bandwidth must have been already added when actually setting
958 * the operating channel.
959 *
960 * @param channel the given operating channel
961 */
962 void SetOperatingChannel(const WifiPhyOperatingChannel& channel);
963
964 /**
965 * This overloaded function is used to pass a list of segments
966 * from which the operating channel can be deduced.
967 *
968 * @param channelSegments the segments identifying the operating channel
969 */
970 void SetOperatingChannel(const ChannelSegments& channelSegments);
971
972 /**
973 * This overloaded function is used when the operating channel
974 * consists of a single segment, identified by a tuple.
975 *
976 * @param tuple the segment identifying the operating channel
977 */
978 void SetOperatingChannel(const ChannelTuple& tuple);
979
980 /**
981 * Configure whether it is prohibited to change PHY band after initialization.
982 *
983 * @param enable true to prohibit changing PHY band after initialization,
984 * false otherwise
985 */
986 void SetFixedPhyBand(bool enable);
987 /**
988 * @return whether it is prohibited to change PHY band after initialization
989 */
990 bool HasFixedPhyBand() const;
991 /**
992 * @return the operating center frequency
993 */
994 MHz_u GetFrequency() const;
995 /**
996 * @return the index of the primary 20 MHz channel
997 */
998 uint8_t GetPrimary20Index() const;
999 /**
1000 * Get the bandwidth for a transmission occurring on the current operating channel and
1001 * using the given WifiMode, subject to the constraint that the TX bandwidth cannot exceed
1002 * the given maximum allowed value.
1003 *
1004 * @param mode the given WifiMode
1005 * @param maxAllowedBandWidth the maximum allowed TX bandwidth
1006 * @return the bandwidth for the transmission
1007 */
1009 MHz_u maxAllowedBandWidth = MHz_u{
1010 std::numeric_limits<double>::max()}) const;
1011 /**
1012 * @param antennas the number of antennas on this node.
1013 */
1014 void SetNumberOfAntennas(uint8_t antennas);
1015 /**
1016 * @return the number of antennas on this device
1017 */
1018 uint8_t GetNumberOfAntennas() const;
1019 /**
1020 * @param streams the maximum number of supported TX spatial streams.
1021 */
1022 void SetMaxSupportedTxSpatialStreams(uint8_t streams);
1023 /**
1024 * @return the maximum number of supported TX spatial streams
1025 */
1026 uint8_t GetMaxSupportedTxSpatialStreams() const;
1027 /**
1028 * @param streams the maximum number of supported RX spatial streams.
1029 */
1030 void SetMaxSupportedRxSpatialStreams(uint8_t streams);
1031 /**
1032 * @return the maximum number of supported RX spatial streams
1033 */
1034 uint8_t GetMaxSupportedRxSpatialStreams() const;
1035 /**
1036 * Enable or disable short PHY preamble.
1037 *
1038 * @param preamble sets whether short PHY preamble is supported or not
1039 */
1040 void SetShortPhyPreambleSupported(bool preamble);
1041 /**
1042 * Return whether short PHY preamble is supported.
1043 *
1044 * @returns if short PHY preamble is supported or not
1045 */
1046 bool GetShortPhyPreambleSupported() const;
1047
1048 /**
1049 * Set the index allocated to this PHY
1050 *
1051 * @param phyId the ID allocated to this PHY
1052 */
1053 void SetPhyId(uint8_t phyId);
1054
1055 /**
1056 * Get the index allocated to this PHY
1057 *
1058 * @return the ID allocated to this PHY
1059 */
1060 uint8_t GetPhyId() const;
1061
1062 /**
1063 * Sets the interference helper.
1064 *
1065 * @param helper the interference helper
1066 */
1067 virtual void SetInterferenceHelper(const Ptr<InterferenceHelper> helper);
1068
1069 /**
1070 * Sets the error rate model.
1071 *
1072 * @param model the error rate model
1073 */
1074 void SetErrorRateModel(const Ptr<ErrorRateModel> model);
1075 /**
1076 * Attach a receive ErrorModel to the WifiPhy.
1077 *
1078 * The WifiPhy may optionally include an ErrorModel in
1079 * the packet receive chain. The error model is additive
1080 * to any modulation-based error model based on SNR, and
1081 * is typically used to force specific packet losses or
1082 * for testing purposes.
1083 *
1084 * @param em Pointer to the ErrorModel.
1085 */
1087 /**
1088 * Sets the frame capture model.
1089 *
1090 * @param frameCaptureModel the frame capture model
1091 */
1092 void SetFrameCaptureModel(const Ptr<FrameCaptureModel> frameCaptureModel);
1093 /**
1094 * Sets the preamble detection model.
1095 *
1096 * @param preambleDetectionModel the preamble detection model
1097 */
1098 void SetPreambleDetectionModel(const Ptr<PreambleDetectionModel> preambleDetectionModel);
1099 /**
1100 * Sets the wifi radio energy model.
1101 *
1102 * @param wifiRadioEnergyModel the wifi radio energy model
1103 */
1104 void SetWifiRadioEnergyModel(const Ptr<WifiRadioEnergyModel> wifiRadioEnergyModel);
1105
1106 /**
1107 * @return the channel width
1108 */
1109 MHz_u GetChannelWidth() const;
1110
1111 /**
1112 * Get the power of the given power level.
1113 * In current implementation, the power levels are equally spaced (in dBm).
1114 *
1115 * @param powerLevel the power level
1116 *
1117 * @return the transmission power at the given power level
1118 */
1119 dBm_u GetPower(uint8_t powerLevel) const;
1120
1121 /**
1122 * Reset PHY to IDLE, with some potential TX power restrictions for the next transmission.
1123 *
1124 * @param powerRestricted flag whether the transmit power is restricted for the next
1125 * transmission
1126 * @param txPowerMaxSiso the SISO transmit power restriction for the next transmission
1127 * @param txPowerMaxMimo the MIMO transmit power restriction for the next transmission
1128 */
1129 void ResetCca(bool powerRestricted,
1130 dBm_u txPowerMaxSiso = dBm_u{0},
1131 dBm_u txPowerMaxMimo = dBm_u{0});
1132 /**
1133 * Compute the transmit power for the next transmission.
1134 * The returned power will satisfy the power density constraints
1135 * after addition of antenna gain.
1136 *
1137 * @param ppdu the PPDU to transmit
1138 * @return the transmit power for the next transmission
1139 */
1140 dBm_u GetTxPowerForTransmission(Ptr<const WifiPpdu> ppdu) const;
1141 /**
1142 * Notify the PHY that an access to the channel was requested.
1143 * This is typically called by the channel access manager to
1144 * to notify the PHY about an ongoing transmission.
1145 * The PHY will use this information to determine whether
1146 * it should use power restriction as imposed by OBSS_PD SR.
1147 */
1149
1150 /**
1151 * This is a helper function to convert start and stop indices to start and stop frequencies.
1152 *
1153 * @param indices the start/stop indices to convert
1154 * @return the converted frequencies
1155 */
1157 const WifiSpectrumBandIndices& indices) const = 0;
1158
1159 /**
1160 * Add the PHY entity to the map of __implemented__ PHY entities for the
1161 * given modulation class.
1162 * Through this method, child classes can add their own PHY entities in
1163 * a static manner.
1164 *
1165 * @param modulation the modulation class
1166 * @param phyEntity the PHY entity
1167 */
1168 static void AddStaticPhyEntity(WifiModulationClass modulation, Ptr<PhyEntity> phyEntity);
1169
1170 /**
1171 * Get the __implemented__ PHY entity corresponding to the modulation class.
1172 * This is used to compute the different amendment-specific parameters within
1173 * calling static methods.
1174 *
1175 * @param modulation the modulation class
1176 * @return the pointer to the static implemented PHY entity
1177 */
1179
1180 /**
1181 * Get the supported PHY entity to use for a received PPDU.
1182 * This typically returns the entity corresponding to the modulation class used to transmit the
1183 * PPDU. If the modulation class used to transmit the PPDU is not supported by the PHY, the
1184 * latest PHY entity corresponding to the configured standard is returned. If the modulation
1185 * used to transmit the PPDU is non-HT (duplicate), the latest PHY entity corresponding to the
1186 * configured standard is also returned.
1187 *
1188 * @param ppdu the received PPDU
1189 * @return the pointer to the supported PHY entity
1190 */
1192
1193 /**
1194 * Get the supported PHY entity corresponding to the modulation class.
1195 *
1196 * @param modulation the modulation class
1197 * @return the pointer to the supported PHY entity
1198 */
1200 /**
1201 * Get the supported PHY entity corresponding to the wifi standard.
1202 *
1203 * @param standard the wifi standard
1204 * @return the pointer to the supported PHY entity
1205 */
1207 /**
1208 * Get the latest PHY entity supported by this PHY instance.
1209 *
1210 * @return the latest PHY entity supported by this PHY instance
1211 */
1213
1214 /**
1215 * @return the UID of the previously received PPDU (reset to UINT64_MAX upon transmission)
1216 */
1217 uint64_t GetPreviouslyRxPpduUid() const;
1218
1219 /**
1220 * Set the UID of the previously received PPDU.
1221 *
1222 * @param uid the value for the UID of the previously received PPDU
1223 *
1224 * @note This method shall only be used in exceptional circumstances, such as when a PHY
1225 * transmits a response to a Trigger Frame that was received by another PHY. This is the
1226 * case, e.g., when an aux PHY of an EMLSR client receives an ICF but it is the main PHY
1227 * that switches channel and transmits the response to the ICF.
1228 */
1229 void SetPreviouslyRxPpduUid(uint64_t uid);
1230
1231 /**
1232 * @param currentChannelWidth channel width of the current transmission
1233 * @return the width of the guard band
1234 *
1235 * Note: in order to properly model out of band transmissions for OFDM, the guard
1236 * band has been configured so as to expand the modeled spectrum up to the
1237 * outermost referenced point in "Transmit spectrum mask" sections' PSDs of
1238 * each PHY specification of 802.11-2016 standard. It thus ultimately corresponds
1239 * to the current channel bandwidth (which can be different from devices max
1240 * channel width).
1241 *
1242 * This method is only relevant for SpectrumWifiPhy.
1243 */
1244 virtual MHz_u GetGuardBandwidth(MHz_u currentChannelWidth) const = 0;
1245 /**
1246 * @return a tuple containing the minimum rejection for the inner band,
1247 * the minimum rejection for the outer band, and
1248 * the maximum rejection for the outer band
1249 * for the transmit spectrum mask.
1250 *
1251 * This method is only relevant for SpectrumWifiPhy.
1252 */
1253 virtual std::tuple<dBr_u, dBr_u, dBr_u> GetTxMaskRejectionParams() const = 0;
1254
1255 /**
1256 * Get channel number of the primary channel
1257 * @param primaryChannelWidth the width of the primary channel
1258 *
1259 * @return channel number of the primary channel
1260 */
1261 uint8_t GetPrimaryChannelNumber(MHz_u primaryChannelWidth) const;
1262
1263 /**
1264 * Get the info of a given band
1265 *
1266 * @param bandWidth the width of the band to be returned
1267 * @param bandIndex the index of the band to be returned
1268 *
1269 * @return the info that defines the band
1270 */
1271 virtual WifiSpectrumBandInfo GetBand(MHz_u bandWidth, uint8_t bandIndex = 0) = 0;
1272
1273 /**
1274 * Get the frequency range of the current RF interface.
1275 *
1276 * @return the frequency range of the current RF interface
1277 */
1279
1280 /**
1281 * @return the subcarrier spacing corresponding to the configure standard
1282 */
1283 Hz_u GetSubcarrierSpacing() const;
1284
1285 /**
1286 * Callback invoked when the PHY model starts to transmit a signal
1287 *
1288 * @param ppdu The PPDU being transmitted
1289 * @param txVector txVector used for transmitting the PPDU
1290 */
1292 const WifiTxVector& txVector);
1293
1294 protected:
1295 void DoInitialize() override;
1296 void DoDispose() override;
1297
1298 /**
1299 * Reset data upon end of TX or RX
1300 */
1301 void Reset();
1302
1303 /**
1304 * Perform any actions necessary when user changes operating channel after
1305 * initialization.
1306 *
1307 * @return the amount of time to wait until the channel switch can be performed or
1308 * std::nullopt if channel switch is currently not possible (i.e., the radio is in sleep mode)
1309 */
1310 std::optional<Time> GetDelayUntilChannelSwitch();
1311 /**
1312 * Actually switch channel based on the stored channel settings.
1313 */
1314 virtual void DoChannelSwitch();
1315
1316 /**
1317 * Check if PHY state should move to CCA busy state based on current
1318 * state of interference tracker.
1319 *
1320 * @param ppdu the incoming PPDU or nullptr for any signal
1321 */
1322 void SwitchMaybeToCcaBusy(const Ptr<const WifiPpdu> ppdu = nullptr);
1323 /**
1324 * Notify PHY state helper to switch to CCA busy state,
1325 *
1326 * @param ppdu the incoming PPDU or nullptr for any signal
1327 * @param duration the duration of the CCA state
1328 */
1329 void NotifyCcaBusy(const Ptr<const WifiPpdu> ppdu, Time duration);
1330
1331 /**
1332 * Add the PHY entity to the map of supported PHY entities for the
1333 * given modulation class for the WifiPhy instance.
1334 * This is a wrapper method used to check that the PHY entity is
1335 * in the static map of implemented PHY entities (\see GetStaticPhyEntities).
1336 * In addition, child classes can add their own PHY entities.
1337 *
1338 * @param modulation the modulation class
1339 * @param phyEntity the PHY entity
1340 */
1341 void AddPhyEntity(WifiModulationClass modulation, Ptr<PhyEntity> phyEntity);
1342
1343 uint8_t m_phyId; //!< the index of the PHY in the vector of PHYs held by the WifiNetDevice
1344
1346 m_interference; //!< Pointer to a helper responsible for interference computations
1347
1348 Ptr<UniformRandomVariable> m_random; //!< Provides uniform random variables.
1349 Ptr<WifiPhyStateHelper> m_state; //!< Pointer to WifiPhyStateHelper
1350
1351 uint32_t m_txMpduReferenceNumber; //!< A-MPDU reference number to identify all transmitted
1352 //!< subframes belonging to the same received A-MPDU
1353 uint32_t m_rxMpduReferenceNumber; //!< A-MPDU reference number to identify all received
1354 //!< subframes belonging to the same received A-MPDU
1355
1356 EventId m_endPhyRxEvent; //!< the end of PHY receive event
1357 EventId m_endTxEvent; //!< the end of transmit event
1358
1359 Ptr<Event> m_currentEvent; //!< Hold the current event
1360 std::map<std::pair<uint64_t /* UID*/, WifiPreamble>, Ptr<Event>>
1361 m_currentPreambleEvents; //!< store event associated to a PPDU (that has a unique ID and
1362 //!< preamble combination) whose preamble is being received
1363
1364 uint64_t m_previouslyRxPpduUid; //!< UID of the previously received PPDU, reset to UINT64_MAX
1365 //!< upon transmission
1366
1367 /**
1368 * This map holds the supported PHY entities.
1369 *
1370 * The set of parameters (e.g. mode) that this WifiPhy(-derived class) can
1371 * support can be obtained through it.
1372 *
1373 * When it comes to modes, in conversation we call this set
1374 * the DeviceRateSet (not a term you'll find in the standard), and
1375 * it is a superset of standard-defined parameters such as the
1376 * OperationalRateSet, and the BSSBasicRateSet (which, themselves,
1377 * have a superset/subset relationship).
1378 *
1379 * Mandatory rates relevant to this WifiPhy can be found by
1380 * iterating over the elements of this map, for each modulation class,
1381 * looking for WifiMode objects for which
1382 * WifiMode::IsMandatory() is true.
1383 */
1384 std::map<WifiModulationClass, Ptr<PhyEntity>> m_phyEntities;
1385
1387 m_signalTransmissionCb; //!< Signal Transmission callback
1388
1389 private:
1390 /**
1391 * Configure WifiPhy with appropriate channel frequency and
1392 * supported rates for 802.11a standard.
1393 */
1394 void Configure80211a();
1395 /**
1396 * Configure WifiPhy with appropriate channel frequency and
1397 * supported rates for 802.11b standard.
1398 */
1399 void Configure80211b();
1400 /**
1401 * Configure WifiPhy with appropriate channel frequency and
1402 * supported rates for 802.11g standard.
1403 */
1404 void Configure80211g();
1405 /**
1406 * Configure WifiPhy with appropriate channel frequency and
1407 * supported rates for 802.11p standard.
1408 */
1409 void Configure80211p();
1410 /**
1411 * Configure WifiPhy with appropriate channel frequency and
1412 * supported rates for 802.11n standard.
1413 */
1414 void Configure80211n();
1415 /**
1416 * Configure WifiPhy with appropriate channel frequency and
1417 * supported rates for 802.11ac standard.
1418 */
1419 void Configure80211ac();
1420 /**
1421 * Configure WifiPhy with appropriate channel frequency and
1422 * supported rates for 802.11ax standard.
1423 */
1424 void Configure80211ax();
1425 /**
1426 * Configure WifiPhy with appropriate channel frequency and
1427 * supported rates for 802.11be standard.
1428 */
1429 void Configure80211be();
1430 /**
1431 * Configure the device MCS set with the appropriate HtMcs modes for
1432 * the number of available transmit spatial streams
1433 */
1435 /**
1436 * Add the given MCS to the device MCS set.
1437 *
1438 * @param mode the MCS to add to the device MCS set
1439 */
1440 void PushMcs(WifiMode mode);
1441 /**
1442 * Rebuild the mapping of MCS values to indices in the device MCS set.
1443 */
1445
1446 /**
1447 * Due to newly arrived signal, the current reception cannot be continued and has to be aborted
1448 * @param reason the reason the reception is aborted
1449 *
1450 */
1452
1453 /**
1454 * Callback function when a transmission is completed
1455 * @param psdus the PSDUs that have been sent
1456 */
1457 void TxDone(const WifiConstPsduMap& psdus);
1458
1459 /**
1460 * Get the PSDU addressed to that PHY in a PPDU (useful for MU PPDU).
1461 *
1462 * @param ppdu the PPDU to extract the PSDU from
1463 * @return the PSDU addressed to that PHY
1464 */
1466
1467 /**
1468 * Method that can be overridden by subclasses to perform operations after the channel is
1469 * actually switched but before the MAC is notified of the channel switch.
1470 */
1471 virtual void FinalizeChannelSwitch() = 0;
1472
1473 /**
1474 * The trace source fired when a packet begins the transmission process on
1475 * the medium.
1476 *
1477 * @see class CallBackTraceSource
1478 */
1480 /**
1481 * The trace source fired when a PSDU map begins the transmission process on
1482 * the medium.
1483 *
1484 * @see class CallBackTraceSource
1485 */
1487
1488 /**
1489 * The trace source fired when a packet ends the transmission process on
1490 * the medium.
1491 *
1492 * @see class CallBackTraceSource
1493 */
1495
1496 /**
1497 * The trace source fired when the PHY layer drops a packet as it tries
1498 * to transmit it.
1499 *
1500 * @see class CallBackTraceSource
1501 */
1503
1504 /**
1505 * The trace source fired when a packet begins the reception process from
1506 * the medium.
1507 *
1508 * @see class CallBackTraceSource
1509 */
1511
1512 /**
1513 * The trace source fired when the reception of the PHY payload (PSDU) begins.
1514 *
1515 * This traced callback models the behavior of the PHY-RXSTART
1516 * primitive which is launched upon correct decoding of
1517 * the PHY header and support of modes within.
1518 * We thus assume that it is sent just before starting
1519 * the decoding of the payload, since it's there that
1520 * support of the header's content is checked. In addition,
1521 * it's also at that point that the correct decoding of
1522 * HT-SIG, VHT-SIGs, and HE-SIGs are checked.
1523 *
1524 * @see class CallBackTraceSource
1525 */
1527
1528 /**
1529 * The trace source fired when the reception of a MAC header ends.
1530 *
1531 * This traced callback models the behavior of real PHYs that are able to decode the MAC
1532 * header of an MPDU being received and make the information therein available to the MAC
1533 * as soon as the reception of the MAC header ends.
1534 *
1535 * @see class CallBackTraceSource
1536 */
1538
1539 /**
1540 * The trace source fired when a packet ends the reception process from
1541 * the medium.
1542 *
1543 * @see class CallBackTraceSource
1544 */
1546
1547 /**
1548 * The trace source fired when the PHY layer drops a packet it has received.
1549 *
1550 * @see class CallBackTraceSource
1551 */
1553
1554 /**
1555 * The trace source fired when the PHY layer drops a packet it has received.
1556 */
1558
1559 /**
1560 * A trace source that emulates a Wi-Fi device in monitor mode
1561 * sniffing a packet being received.
1562 *
1563 * As a reference with the real world, firing this trace
1564 * corresponds in the madwifi driver to calling the function
1565 * ieee80211_input_monitor()
1566 *
1567 * @see class CallBackTraceSource
1568 * @todo WifiTxVector and signalNoiseDbm should be passed as
1569 * const references because of their sizes.
1570 */
1572 uint16_t /* frequency (MHz) */,
1574 MpduInfo,
1576 uint16_t /* STA-ID*/>
1578
1579 /**
1580 * A trace source that emulates a Wi-Fi device in monitor mode
1581 * sniffing a packet being transmitted.
1582 *
1583 * As a reference with the real world, firing this trace
1584 * corresponds in the madwifi driver to calling the function
1585 * ieee80211_input_monitor()
1586 *
1587 * @see class CallBackTraceSource
1588 * @todo WifiTxVector should be passed by const reference because
1589 * of its size.
1590 */
1592 uint16_t /* frequency (MHz) */,
1594 MpduInfo,
1595 uint16_t /* STA-ID*/>
1597
1598 /**
1599 * @return the map of __implemented__ PHY entities.
1600 * This is used to compute the different
1601 * amendment-specific parameters in a static manner.
1602 * For PHY entities supported by a given WifiPhy instance,
1603 * @see m_phyEntities.
1604 */
1605 static std::map<WifiModulationClass, Ptr<PhyEntity>>& GetStaticPhyEntities();
1606
1607 WifiStandard m_standard; //!< WifiStandard
1608 WifiModulationClass m_maxModClassSupported; //!< max modulation class supported
1609 WifiPhyBand m_band; //!< WifiPhyBand
1610 ChannelSegments m_channelSettings; //!< Store operating channel settings until initialization
1612 bool m_fixedPhyBand; //!< True to prohibit changing PHY band after initialization
1613
1614 Time m_sifs; //!< Short Interframe Space (SIFS) duration
1615 Time m_slot; //!< Slot duration
1616 Time m_pifs; //!< PCF Interframe Space (PIFS) duration
1617 Time m_ackTxTime; //!< estimated Ack TX time
1618 Time m_blockAckTxTime; //!< estimated BlockAck TX time
1619
1620 dBm_u m_rxSensitivity; //!< Receive sensitivity threshold
1621 dBm_u m_ccaEdThreshold; //!< Clear channel assessment (CCA) energy detection (ED) threshold
1622 dBm_u m_ccaSensitivityThreshold; //!< Clear channel assessment (CCA) modulation and coding rate
1623 //!< sensitivity threshold
1624
1625 dB_u m_txGain; //!< Transmission gain
1626 dB_u m_rxGain; //!< Reception gain
1627 dBm_u m_txPowerBase; //!< Minimum transmission power
1628 dBm_u m_txPowerEnd; //!< Maximum transmission power
1629 uint8_t m_nTxPower; //!< Number of available transmission power levels
1630 dBm_per_MHz_u m_powerDensityLimit; //!< the power density limit
1631
1632 bool m_powerRestricted; //!< Flag whether transmit power is restricted by OBSS PD SR
1633 dBm_u m_txPowerMaxSiso; //!< SISO maximum transmit power due to OBSS PD SR power restriction
1634 dBm_u m_txPowerMaxMimo; //!< MIMO maximum transmit power due to OBSS PD SR power restriction
1635 bool m_channelAccessRequested; //!< Flag if channels access has been requested (used for OBSS_PD
1636 //!< SR)
1637
1638 bool m_shortPreamble; //!< Flag if short PHY preamble is supported
1639 uint8_t m_numberOfAntennas; //!< Number of transmitters
1640 uint8_t m_txSpatialStreams; //!< Number of supported TX spatial streams
1641 uint8_t m_rxSpatialStreams; //!< Number of supported RX spatial streams
1642
1643 dB_u m_noiseFigure; //!< The noise figure
1644
1645 Time m_channelSwitchDelay; //!< Time required to switch between channel
1646
1647 Ptr<WifiNetDevice> m_device; //!< Pointer to the device
1648 Ptr<MobilityModel> m_mobility; //!< Pointer to the mobility model
1649
1653 Ptr<ErrorModel> m_postReceptionErrorModel; //!< Error model for receive packet events
1654 Time m_timeLastPreambleDetected; //!< Record the time the last preamble was detected
1655 bool m_notifyRxMacHeaderEnd; //!< whether the PHY is capable of notifying MAC header RX end
1656
1657 Callback<void> m_capabilitiesChangedCallback; //!< Callback when PHY capabilities changed
1658};
1659
1660/**
1661 * @param os output stream
1662 * @param rxSignalInfo received signal info to stringify
1663 * @return output stream
1664 */
1665std::ostream& operator<<(std::ostream& os, RxSignalInfo rxSignalInfo);
1666
1667} // namespace ns3
1668
1669#endif /* WIFI_PHY_H */
An identifier for simulation events.
Definition event-id.h:45
A base class which provides memory management and object aggregation.
Definition object.h:78
Abstract class for PHY entities.
Definition phy-entity.h:64
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition type-id.h:49
Implements the IEEE 802.11 MAC header.
represent a single transmission mode
Definition wifi-mode.h:40
802.11 PHY layer model
Definition wifi-phy.h:55
static TypeId GetTypeId()
Get the type ID.
Definition wifi-phy.cc:60
void SetNumberOfAntennas(uint8_t antennas)
Definition wifi-phy.cc:1334
Ptr< WifiPhyStateHelper > m_state
Pointer to WifiPhyStateHelper.
Definition wifi-phy.h:1349
Time GetBlockAckTxTime() const
Return the estimated BlockAck TX time for this PHY.
Definition wifi-phy.cc:865
bool IsStateTx() const
Definition wifi-phy.cc:2191
Ptr< MobilityModel > m_mobility
Pointer to the mobility model.
Definition wifi-phy.h:1648
dBm_u m_ccaEdThreshold
Clear channel assessment (CCA) energy detection (ED) threshold.
Definition wifi-phy.h:1621
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:570
WifiModulationClass GetMaxModulationClassSupported() const
Definition wifi-phy.cc:1003
bool IsStateIdle() const
Definition wifi-phy.cc:2179
void SetRxGain(dB_u gain)
Sets the reception gain.
Definition wifi-phy.cc:615
virtual void SetInterferenceHelper(const Ptr< InterferenceHelper > helper)
Sets the interference helper.
Definition wifi-phy.cc:678
uint8_t m_txSpatialStreams
Number of supported TX spatial streams.
Definition wifi-phy.h:1640
bool IsStateCcaBusy() const
Definition wifi-phy.cc:2173
void Send(Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector)
This function is a wrapper for the Send variant that accepts a WifiConstPsduMap as first argument.
Definition wifi-phy.cc:1820
Ptr< UniformRandomVariable > m_random
Provides uniform random variables.
Definition wifi-phy.h:1348
Ptr< WifiRadioEnergyModel > m_wifiRadioEnergyModel
Wifi radio energy model.
Definition wifi-phy.h:1652
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:552
void Configure80211ax()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11ax standard.
Definition wifi-phy.cc:973
void SetRxSensitivity(dBm_u threshold)
Sets the receive sensitivity threshold.
Definition wifi-phy.cc:513
Time m_channelSwitchDelay
Time required to switch between channel.
Definition wifi-phy.h:1645
dB_u GetTxGain() const
Return the transmission gain.
Definition wifi-phy.cc:609
void SetTxPowerEnd(dBm_u end)
Sets the maximum available transmission power level.
Definition wifi-phy.cc:576
void(* PhyRxPpduDropTracedCallback)(Ptr< const WifiPpdu > ppdu, WifiPhyRxfailureReason reason)
TracedCallback signature for PhyRxPpduDrop trace source.
Definition wifi-phy.h:755
dBm_per_MHz_u m_powerDensityLimit
the power density limit
Definition wifi-phy.h:1630
void NotifyCcaBusy(const Ptr< const WifiPpdu > ppdu, Time duration)
Notify PHY state helper to switch to CCA busy state,.
Definition wifi-phy.cc:2240
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:1761
WifiPhyOperatingChannel m_operatingChannel
Operating channel.
Definition wifi-phy.h:1611
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:1502
void SetErrorRateModel(const Ptr< ErrorRateModel > model)
Sets the error rate model.
Definition wifi-phy.cc:687
bool m_channelAccessRequested
Flag if channels access has been requested (used for OBSS_PD SR)
Definition wifi-phy.h:1635
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:1540
Time GetSlot() const
Return the slot duration for this PHY.
Definition wifi-phy.cc:841
void SetMaxSupportedRxSpatialStreams(uint8_t streams)
Definition wifi-phy.cc:1384
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:2356
void Configure80211g()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11g standard.
Definition wifi-phy.cc:903
uint8_t GetPrimary20Index() const
Definition wifi-phy.cc:1105
dBm_u m_rxSensitivity
Receive sensitivity threshold.
Definition wifi-phy.h:1620
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:1361
uint8_t GetNumberOfAntennas() const
Definition wifi-phy.cc:1346
Time m_slot
Slot duration.
Definition wifi-phy.h:1615
dBm_u GetRxSensitivity() const
Return the receive sensitivity threshold.
Definition wifi-phy.cc:520
Time GetDelayUntilIdle()
Definition wifi-phy.cc:2215
bool GetShortPhyPreambleSupported() const
Return whether short PHY preamble is supported.
Definition wifi-phy.cc:635
void SetSifs(Time sifs)
Set the Short Interframe Space (SIFS) for this PHY.
Definition wifi-phy.cc:823
std::list< uint8_t > GetBssMembershipSelectorList() const
The WifiPhy::BssMembershipSelector() method is used (e.g., by a WifiRemoteStationManager) to determin...
Definition wifi-phy.cc:1402
void Configure80211n()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11n standard.
Definition wifi-phy.cc:946
EventId m_endPhyRxEvent
the end of PHY receive event
Definition wifi-phy.h:1356
dBm_u m_ccaSensitivityThreshold
Clear channel assessment (CCA) modulation and coding rate sensitivity threshold.
Definition wifi-phy.h:1622
void Configure80211be()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11be standard.
Definition wifi-phy.cc:988
void NotifyRxDrop(Ptr< const WifiPsdu > psdu, WifiPhyRxfailureReason reason)
Public method used to fire a PhyRxDrop trace.
Definition wifi-phy.cc:1688
bool IsStateRx() const
Definition wifi-phy.cc:2185
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:2071
Time GetSifs() const
Return the Short Interframe Space (SIFS) for this PHY.
Definition wifi-phy.cc:829
dBm_u m_txPowerMaxMimo
MIMO maximum transmit power due to OBSS PD SR power restriction.
Definition wifi-phy.h:1634
bool m_notifyRxMacHeaderEnd
whether the PHY is capable of notifying MAC header RX end
Definition wifi-phy.h:1655
Hz_u GetSubcarrierSpacing() const
Definition wifi-phy.cc:2387
std::tuple< uint8_t, MHz_u, WifiPhyBand, uint8_t > ChannelTuple
Tuple identifying a segment of an operating channel.
Definition wifi-phy.h:940
MHz_u GetFrequency() const
Definition wifi-phy.cc:1087
Ptr< MobilityModel > GetMobility() const
Return the mobility model this PHY is associated with.
Definition wifi-phy.cc:659
uint16_t GetNMcs() const
Definition wifi-phy.cc:2117
Time m_blockAckTxTime
estimated BlockAck TX time
Definition wifi-phy.h:1618
void SetSleepMode(bool forceSleepWhileInRx=false)
Put in sleep mode.
Definition wifi-phy.cc:1417
void ResumeFromSleep()
Resume from sleep mode.
Definition wifi-phy.cc:1473
void SetTxPowerStart(dBm_u start)
Sets the minimum available transmission power level.
Definition wifi-phy.cc:563
static Time GetPreambleDetectionDuration()
Definition wifi-phy.cc:1528
void Configure80211p()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11p standard.
Definition wifi-phy.cc:916
dBm_u m_txPowerEnd
Maximum transmission power.
Definition wifi-phy.h:1628
void AbortCurrentReception(WifiPhyRxfailureReason reason)
Due to newly arrived signal, the current reception cannot be continued and has to be aborted.
Definition wifi-phy.cc:2247
Ptr< FrameCaptureModel > m_frameCaptureModel
Frame capture model.
Definition wifi-phy.h:1650
TracedCallback< Ptr< const Packet > > m_phyRxEndTrace
The trace source fired when a packet ends the reception process from the medium.
Definition wifi-phy.h:1545
void NotifyRxBegin(Ptr< const WifiPsdu > psdu, const RxPowerWattPerChannelBand &rxPowersW)
Public method used to fire a PhyRxBegin trace.
Definition wifi-phy.cc:1664
Time GetChannelSwitchDelay() const
Definition wifi-phy.cc:739
void SetTxGain(dB_u gain)
Sets the transmission gain.
Definition wifi-phy.cc:602
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 SetMaxSupportedTxSpatialStreams(uint8_t streams)
Definition wifi-phy.cc:1352
void NotifyTxBegin(const WifiConstPsduMap &psdus, Watt_u txPower)
Public method used to fire a PhyTxBegin trace.
Definition wifi-phy.cc:1622
Time m_sifs
Short Interframe Space (SIFS) duration.
Definition wifi-phy.h:1614
void SetReceiveErrorCallback(RxErrorCallback callback)
Definition wifi-phy.cc:484
TracedCallback< Ptr< const WifiPpdu >, const WifiTxVector & > m_signalTransmissionCb
Signal Transmission callback.
Definition wifi-phy.h:1387
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:1707
dBm_u GetTxPowerEnd() const
Return the maximum available transmission power level.
Definition wifi-phy.cc:583
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:2209
uint8_t GetMaxSupportedRxSpatialStreams() const
Definition wifi-phy.cc:1396
virtual void ConfigureStandard(WifiStandard standard)
Configure the PHY-level parameters for different Wi-Fi standard.
Definition wifi-phy.cc:1009
void SetPostReceptionErrorModel(const Ptr< ErrorModel > em)
Attach a receive ErrorModel to the WifiPhy.
Definition wifi-phy.cc:695
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:2166
void PushMcs(WifiMode mode)
Add the given MCS to the device MCS set.
uint8_t m_numberOfAntennas
Number of transmitters.
Definition wifi-phy.h:1639
uint32_t m_txMpduReferenceNumber
A-MPDU reference number to identify all transmitted subframes belonging to the same received A-MPDU.
Definition wifi-phy.h:1351
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:1557
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
Definition wifi-phy.cc:1587
static uint32_t GetMaxPsduSize(WifiModulationClass modulation)
Get the maximum PSDU size in bytes for the given modulation class.
Definition wifi-phy.cc:1616
dBm_u GetCcaEdThreshold() const
Return the CCA energy detection threshold.
Definition wifi-phy.cc:533
Ptr< WifiPhyStateHelper > GetState() const
Return the WifiPhyStateHelper of this PHY.
Definition wifi-phy.cc:472
dBm_u m_txPowerBase
Minimum transmission power.
Definition wifi-phy.h:1627
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:1637
void EndReceiveInterBss()
For HE receptions only, check and possibly modify the transmit power restriction state at the end of ...
Definition wifi-phy.cc:2025
void SetShortPhyPreambleSupported(bool preamble)
Enable or disable short PHY preamble.
Definition wifi-phy.cc:628
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:589
void SetCcaSensitivityThreshold(dBm_u threshold)
Sets the CCA sensitivity threshold.
Definition wifi-phy.cc:539
WifiPhyBand m_band
WifiPhyBand.
Definition wifi-phy.h:1609
dBm_u m_txPowerMaxSiso
SISO maximum transmit power due to OBSS PD SR power restriction.
Definition wifi-phy.h:1633
virtual MHz_u GetGuardBandwidth(MHz_u currentChannelWidth) const =0
static const Ptr< const PhyEntity > GetStaticPhyEntity(WifiModulationClass modulation)
Get the implemented PHY entity corresponding to the modulation class.
Definition wifi-phy.cc:751
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:1596
virtual WifiSpectrumBandFrequencies ConvertIndicesToFrequencies(const WifiSpectrumBandIndices &indices) const =0
This is a helper function to convert start and stop indices to start and stop frequencies.
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:1801
std::map< WifiModulationClass, Ptr< PhyEntity > > m_phyEntities
This map holds the supported PHY entities.
Definition wifi-phy.h:1384
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:1123
void NotifyRxPpduDrop(Ptr< const WifiPpdu > ppdu, WifiPhyRxfailureReason reason)
Public method used to fire a PhyRxPpduDrop trace.
Definition wifi-phy.cc:1700
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:996
void AddPhyEntity(WifiModulationClass modulation, Ptr< PhyEntity > phyEntity)
Add the PHY entity to the map of supported PHY entities for the given modulation class for the WifiPh...
Definition wifi-phy.cc:810
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:1577
Ptr< ErrorModel > m_postReceptionErrorModel
Error model for receive packet events.
Definition wifi-phy.h:1653
EventId m_endTxEvent
the end of transmit event
Definition wifi-phy.h:1357
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:1814
void RegisterListener(const std::shared_ptr< WifiPhyListener > &listener)
Definition wifi-phy.cc:490
static std::map< WifiModulationClass, Ptr< PhyEntity > > & GetStaticPhyEntities()
Definition wifi-phy.cc:465
void SetSlot(Time slot)
Set the slot duration for this PHY.
Definition wifi-phy.cc:835
WifiPhyBand GetPhyBand() const
Get the configured Wi-Fi band.
Definition wifi-phy.cc:1069
void SetPreviouslyRxPpduUid(uint64_t uid)
Set the UID of the previously received PPDU.
Definition wifi-phy.cc:1960
Ptr< Event > m_currentEvent
Hold the current event.
Definition wifi-phy.h:1359
Time GetLastRxStartTime() const
Return the start time of the last received packet.
Definition wifi-phy.cc:2221
WifiMode GetDefaultMode() const
Get the default WifiMode supported by the PHY.
Definition wifi-phy.cc:2055
Ptr< PhyEntity > GetPhyEntity(WifiModulationClass modulation) const
Get the supported PHY entity corresponding to the modulation class.
Definition wifi-phy.cc:760
uint8_t GetChannelNumber() const
Return current channel number.
Definition wifi-phy.cc:1093
TracedCallback< Ptr< const Packet > > m_phyTxEndTrace
The trace source fired when a packet ends the transmission process on the medium.
Definition wifi-phy.h:1494
uint64_t m_previouslyRxPpduUid
UID of the previously received PPDU, reset to UINT64_MAX upon transmission.
Definition wifi-phy.h:1364
std::optional< Time > GetDelayUntilChannelSwitch()
Perform any actions necessary when user changes operating channel after initialization.
Definition wifi-phy.cc:1193
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:1353
void SetWifiRadioEnergyModel(const Ptr< WifiRadioEnergyModel > wifiRadioEnergyModel)
Sets the wifi radio energy model.
Definition wifi-phy.cc:714
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:1479
virtual void SetDevice(const Ptr< WifiNetDevice > device)
Sets the device this PHY is associated with.
Definition wifi-phy.cc:641
Ptr< PreambleDetectionModel > m_preambleDetectionModel
Preamble detection model.
Definition wifi-phy.h:1651
std::optional< std::reference_wrapper< const WifiTxVector > > GetInfoIfRxingPhyHeader() const
Definition wifi-phy.cc:2014
Time GetPifs() const
Return the PCF Interframe Space (PIFS) for this PHY.
Definition wifi-phy.cc:853
static void AddStaticPhyEntity(WifiModulationClass modulation, Ptr< PhyEntity > phyEntity)
Add the PHY entity to the map of implemented PHY entities for the given modulation class.
Definition wifi-phy.cc:801
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:1676
void StartReceivePreamble(Ptr< const WifiPpdu > ppdu, RxPowerWattPerChannelBand &rxPowersW, Time rxDuration)
Start receiving the PHY preamble of a PPDU (i.e.
Definition wifi-phy.cc:1991
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:1486
std::vector< ChannelTuple > ChannelSegments
segments identifying an operating channel
Definition wifi-phy.h:946
dB_u m_txGain
Transmission gain.
Definition wifi-phy.h:1625
MHz_u GetChannelWidth() const
Definition wifi-phy.cc:1099
bool IsStateSleep() const
Definition wifi-phy.cc:2203
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:1135
Ptr< WifiNetDevice > GetDevice() const
Return the device this PHY is associated with.
Definition wifi-phy.cc:647
WifiStandard m_standard
WifiStandard.
Definition wifi-phy.h:1607
uint8_t m_nTxPower
Number of available transmission power levels.
Definition wifi-phy.h:1629
void DoDispose() override
Destructor implementation.
Definition wifi-phy.cc:436
void ResetCca(bool powerRestricted, dBm_u txPowerMaxSiso=dBm_u{0}, dBm_u txPowerMaxMimo=dBm_u{0})
Reset PHY to IDLE, with some potential TX power restrictions for the next transmission.
Definition wifi-phy.cc:2297
dB_u GetRxGain() const
Return the reception gain.
Definition wifi-phy.cc:622
bool IsStateSwitching() const
Definition wifi-phy.cc:2197
void SetPhyId(uint8_t phyId)
Set the index allocated to this PHY.
Definition wifi-phy.cc:665
virtual void DoChannelSwitch()
Actually switch channel based on the stored channel settings.
Definition wifi-phy.cc:1234
void SetOffMode()
Put in off mode.
Definition wifi-phy.cc:1463
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:1552
void SetPreambleDetectionModel(const Ptr< PreambleDetectionModel > preambleDetectionModel)
Sets the preamble detection model.
Definition wifi-phy.cc:708
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:1343
void SetPifs(Time pifs)
Set the PCF Interframe Space (PIFS) for this PHY.
Definition wifi-phy.cc:847
void Configure80211b()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11b standard.
Definition wifi-phy.cc:886
void SetCcaEdThreshold(dBm_u threshold)
Sets the CCA energy detection threshold.
Definition wifi-phy.cc:526
dB_u m_noiseFigure
The noise figure.
Definition wifi-phy.h:1643
void(* SignalTransmissionCallback)(Ptr< const WifiPpdu > ppdu, const WifiTxVector &txVector)
Callback invoked when the PHY model starts to transmit a signal.
Definition wifi-phy.h:1291
static Time GetStartOfPacketDuration(const WifiTxVector &txVector)
Definition wifi-phy.cc:1534
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:2233
void SetMobility(const Ptr< MobilityModel > mobility)
assign a mobility model to this device
Definition wifi-phy.cc:653
uint8_t m_rxSpatialStreams
Number of supported RX spatial streams.
Definition wifi-phy.h:1641
dB_u m_rxGain
Reception gain.
Definition wifi-phy.h:1626
double CalculateSnr(const WifiTxVector &txVector, double ber) const
Definition wifi-phy.cc:745
void SetFixedPhyBand(bool enable)
Configure whether it is prohibited to change PHY band after initialization.
Definition wifi-phy.cc:1111
void(* PhyRxBeginTracedCallback)(Ptr< const Packet > packet, RxPowerWattPerChannelBand rxPowersW)
TracedCallback signature for PhyRxBegin trace source.
Definition wifi-phy.h:738
~WifiPhy() override
Definition wifi-phy.cc:405
void Configure80211ac()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11ac standard.
Definition wifi-phy.cc:965
bool HasFixedPhyBand() const
Definition wifi-phy.cc:1117
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:1510
Ptr< WifiNetDevice > m_device
Pointer to the device.
Definition wifi-phy.h:1647
Ptr< InterferenceHelper > m_interference
Pointer to a helper responsible for interference computations.
Definition wifi-phy.h:1346
void DoInitialize() override
Initialize() implementation.
Definition wifi-phy.cc:411
bool m_shortPreamble
Flag if short PHY preamble is supported.
Definition wifi-phy.h:1638
uint8_t GetPhyId() const
Get the index allocated to this PHY.
Definition wifi-phy.cc:672
Time m_pifs
PCF Interframe Space (PIFS) duration.
Definition wifi-phy.h:1616
WifiModulationClass m_maxModClassSupported
max modulation class supported
Definition wifi-phy.h:1608
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:1075
void SetCapabilitiesChangedCallback(Callback< void > callback)
Definition wifi-phy.cc:507
void SetReceiveOkCallback(RxOkCallback callback)
Definition wifi-phy.cc:478
void SetFrameCaptureModel(const Ptr< FrameCaptureModel > frameCaptureModel)
Sets the frame capture model.
Definition wifi-phy.cc:702
void NotifyChannelAccessRequested()
Notify the PHY that an access to the channel was requested.
Definition wifi-phy.cc:2035
dBm_u GetTxPowerForTransmission(Ptr< const WifiPpdu > ppdu) const
Compute the transmit power for the next transmission.
Definition wifi-phy.cc:2320
void ResumeFromOff()
Resume from off mode.
Definition wifi-phy.cc:1500
bool m_powerRestricted
Flag whether transmit power is restricted by OBSS PD SR.
Definition wifi-phy.h:1632
Callback< void > m_capabilitiesChangedCallback
Callback when PHY capabilities changed.
Definition wifi-phy.h:1657
Ptr< PhyEntity > GetPhyEntityForPpdu(const Ptr< const WifiPpdu > ppdu) const
Get the supported PHY entity to use for a received PPDU.
Definition wifi-phy.cc:781
Time GetAckTxTime() const
Return the estimated Ack TX time for this PHY.
Definition wifi-phy.cc:859
uint64_t GetPreviouslyRxPpduUid() const
Definition wifi-phy.cc:1954
void Reset()
Reset data upon end of TX or RX.
Definition wifi-phy.cc:1967
TracedCallback< WifiTxVector, Time > m_phyRxPayloadBeginTrace
The trace source fired when the reception of the PHY payload (PSDU) begins.
Definition wifi-phy.h:1526
Time GetLastRxEndTime() const
Return the end time of the last received packet.
Definition wifi-phy.cc:2227
TracedCallback< const WifiMacHeader &, const WifiTxVector &, Time > m_phyRxMacHeaderEndTrace
The trace source fired when the reception of a MAC header ends.
Definition wifi-phy.h:1537
Time m_timeLastPreambleDetected
Record the time the last preamble was detected.
Definition wifi-phy.h:1654
uint8_t GetMaxSupportedTxSpatialStreams() const
Definition wifi-phy.cc:1378
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:2131
std::list< WifiMode > GetModeList() const
The WifiPhy::GetModeList() method is used (e.g., by a WifiRemoteStationManager) to determine the set ...
Definition wifi-phy.cc:2082
ChannelSegments m_channelSettings
Store operating channel settings until initialization.
Definition wifi-phy.h:1610
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:1944
const WifiPhyOperatingChannel & GetOperatingChannel() const
Get a const reference to the operating channel.
Definition wifi-phy.cc:1081
uint8_t GetPrimaryChannelNumber(MHz_u primaryChannelWidth) const
Get channel number of the primary channel.
Definition wifi-phy.cc:2381
dBm_u GetPower(uint8_t powerLevel) const
Get the power of the given power level.
Definition wifi-phy.cc:720
bool m_fixedPhyBand
True to prohibit changing PHY band after initialization.
Definition wifi-phy.h:1612
Ptr< PhyEntity > GetLatestPhyEntity() const
Get the latest PHY entity supported by this PHY instance.
Definition wifi-phy.cc:775
uint8_t GetNTxPower() const
Return the number of available transmission power levels.
Definition wifi-phy.cc:596
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:2363
static Time CalculatePhyPreambleAndHeaderDuration(const WifiTxVector &txVector)
Definition wifi-phy.cc:1580
bool IsModeSupported(WifiMode mode) const
Check if the given WifiMode is supported by the PHY.
Definition wifi-phy.cc:2042
Time m_ackTxTime
estimated Ack TX time
Definition wifi-phy.h:1617
void UnregisterListener(const std::shared_ptr< WifiPhyListener > &listener)
Definition wifi-phy.cc:501
dBm_u GetCcaSensitivityThreshold() const
Return the CCA sensitivity threshold.
Definition wifi-phy.cc:546
void NotifyTxDrop(Ptr< const WifiPsdu > psdu)
Public method used to fire a PhyTxDrop trace.
Definition wifi-phy.cc:1652
Class that keeps track of all information about the current PHY operating channel.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
WifiStandard
Identifies the IEEE 802.11 specifications that a Wifi device can be configured to use.
WifiPhyRxfailureReason
Enumeration of the possible reception failure reasons.
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
WifiPhyBand
Identifies the PHY band.
WifiModulationClass
This enumeration defines the modulation classes per (Table 10-6 "Modulation classes"; IEEE 802....
MpduType
The type of an MPDU.
Definition wifi-types.h:41
@ NORMAL_MPDU
The MPDU is not part of an A-MPDU.
Definition wifi-types.h:43
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition angles.cc:148
double MHz_u
MHz weak type.
Definition wifi-units.h:31
std::pair< Hz_u, Hz_u > WifiSpectrumBandFrequencies
typedef for a pair of start and stop frequencies to represent a band
std::map< WifiSpectrumBandInfo, Watt_u > RxPowerWattPerChannelBand
A map of the received power for each band.
Definition phy-entity.h:45
double dBm_u
dBm weak type
Definition wifi-units.h:27
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
Definition wifi-ppdu.h:38
static constexpr uint16_t SU_STA_ID
STA_ID to identify a single user (SU)
Definition wifi-mode.h:24
std::pair< uint32_t, uint32_t > WifiSpectrumBandIndices
typedef for a pair of start and stop sub-band indices
Declaration of:
Struct defining a frequency range between minFrequency and maxFrequency.
MpduInfo structure.
Definition wifi-types.h:65
RxSignalInfo structure containing info on the received signal.
Definition wifi-types.h:72
SignalNoiseDbm structure.
Definition wifi-types.h:58
WifiSpectrumBandInfo structure containing info about a spectrum band.