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