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