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