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