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 * \note This method is called also by NotifyRxPpduDrop and is left
612 * in the public API for backward compatibility reasons. Do not
613 * call both this method and the newer NotifyRxPpduDrop(). Instead,
614 * call NotifyRxPpduDrop() and it will call this method also.
615 *
616 * \param psdu the PSDU being transmitted
617 * \param reason the reason the packet was dropped
618 */
620
621 /**
622 * Public method used to fire a PhyRxPpduDrop trace.
623 * Implemented for encapsulation purposes. This method also
624 * calls the PhyRxDrop trace.
625 *
626 * \param ppdu the PSDU being transmitted
627 * \param reason the reason the packet was dropped
628 */
630 /**
631 * Public method used to fire a MonitorSniffer trace for a wifi PSDU being received.
632 * Implemented for encapsulation purposes.
633 * This method will extract all MPDUs if packet is an A-MPDU and will fire tracedCallback.
634 * The A-MPDU reference number (RX side) is set within the method. It must be a different value
635 * for each A-MPDU but the same for each subframe within one A-MPDU.
636 *
637 * \param psdu the PSDU being received
638 * \param channelFreqMhz the frequency in MHz at which the packet is
639 * received. Note that in real devices this is normally the
640 * frequency to which the receiver is tuned, and this can be
641 * different than the frequency at which the packet was originally
642 * transmitted. This is because it is possible to have the receiver
643 * tuned on a given channel and still to be able to receive packets
644 * on a nearby channel.
645 * \param txVector the TXVECTOR that holds RX parameters
646 * \param signalNoise signal power and noise power in dBm (noise power includes the noise
647 * figure)
648 * \param statusPerMpdu reception status per MPDU
649 * \param staId the STA-ID
650 */
652 uint16_t channelFreqMhz,
653 WifiTxVector txVector,
654 SignalNoiseDbm signalNoise,
655 std::vector<bool> statusPerMpdu,
656 uint16_t staId = SU_STA_ID);
657
658 /**
659 * TracedCallback signature for monitor mode receive events.
660 *
661 *
662 * \param packet the packet being received
663 * \param channelFreqMhz the frequency in MHz at which the packet is
664 * received. Note that in real devices this is normally the
665 * frequency to which the receiver is tuned, and this can be
666 * different than the frequency at which the packet was originally
667 * transmitted. This is because it is possible to have the receiver
668 * tuned on a given channel and still to be able to receive packets
669 * on a nearby channel.
670 * \param txVector the TXVECTOR that holds RX parameters
671 * \param aMpdu the type of the packet (0 is not A-MPDU, 1 is a MPDU that is part of an A-MPDU
672 * and 2 is the last MPDU in an A-MPDU) and the A-MPDU reference number (must be a different
673 * value for each A-MPDU but the same for each subframe within one A-MPDU)
674 * \param signalNoise signal power and noise power in dBm
675 * \param staId the STA-ID
676 *
677 * \todo WifiTxVector should be passed by const reference because of its size.
678 */
680 uint16_t channelFreqMhz,
681 WifiTxVector txVector,
682 MpduInfo aMpdu,
683 SignalNoiseDbm signalNoise,
684 uint16_t staId);
685
686 /**
687 * Public method used to fire a MonitorSniffer trace for a wifi PSDU being transmitted.
688 * Implemented for encapsulation purposes.
689 * This method will extract all MPDUs if packet is an A-MPDU and will fire tracedCallback.
690 * The A-MPDU reference number (RX side) is set within the method. It must be a different value
691 * for each A-MPDU but the same for each subframe within one A-MPDU.
692 *
693 * \param psdu the PSDU being received
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 staId the STA-ID
698 */
700 uint16_t channelFreqMhz,
701 WifiTxVector txVector,
702 uint16_t staId = SU_STA_ID);
703
704 /**
705 * TracedCallback signature for monitor mode transmit events.
706 *
707 * \param packet the packet being transmitted
708 * \param channelFreqMhz the frequency in MHz at which the packet is
709 * transmitted.
710 * \param txVector the TXVECTOR that holds TX parameters
711 * \param aMpdu the type of the packet (0 is not A-MPDU, 1 is a MPDU that is part of an A-MPDU
712 * and 2 is the last MPDU in an A-MPDU) and the A-MPDU reference number (must be a different
713 * value for each A-MPDU but the same for each subframe within one A-MPDU)
714 * \param staId the STA-ID
715 *
716 * \todo WifiTxVector should be passed by const reference because of its size.
717 */
718 typedef void (*MonitorSnifferTxCallback)(const Ptr<const Packet> packet,
719 uint16_t channelFreqMhz,
720 WifiTxVector txVector,
721 MpduInfo aMpdu,
722 uint16_t staId);
723
724 /**
725 * TracedCallback signature for Phy transmit events.
726 *
727 * \param packet the packet being transmitted
728 * \param txPowerW the transmit power in Watts
729 */
730 typedef void (*PhyTxBeginTracedCallback)(Ptr<const Packet> packet, double txPowerW);
731
732 /**
733 * TracedCallback signature for PSDU transmit events.
734 *
735 * \param psduMap the PSDU map being transmitted
736 * \param txVector the TXVECTOR holding the TX parameters
737 * \param txPowerW the transmit power in Watts
738 */
739 typedef void (*PsduTxBeginCallback)(WifiConstPsduMap psduMap,
740 WifiTxVector txVector,
741 double txPowerW);
742
743 /**
744 * TracedCallback signature for PhyRxBegin trace source.
745 *
746 * \param packet the packet being received
747 * \param rxPowersW the receive power per channel band in Watts
748 */
750 RxPowerWattPerChannelBand rxPowersW);
751
752 /**
753 * TracedCallback signature for start of PSDU reception events.
754 *
755 * \param txVector the TXVECTOR decoded from the PHY header
756 * \param psduDuration the duration of the PSDU
757 */
758 typedef void (*PhyRxPayloadBeginTracedCallback)(WifiTxVector txVector, Time psduDuration);
759
760 /**
761 * TracedCallback signature for start of PSDU reception events.
762 *
763 * \param txVector the TXVECTOR decoded from the PHY header
764 * \param psduDuration the duration of the PSDU
765 */
768
769 /**
770 * Assign a fixed random variable stream number to the random variables
771 * used by this model. Return the number of streams (possibly zero) that
772 * have been assigned.
773 *
774 * \param stream first stream index to use
775 * \return the number of stream indices assigned by this model
776 */
777 virtual int64_t AssignStreams(int64_t stream);
778
779 /**
780 * Sets the receive sensitivity threshold (dBm).
781 * The energy of a received signal should be higher than
782 * this threshold to allow the PHY layer to detect the signal.
783 *
784 * \param threshold the receive sensitivity threshold in dBm
785 */
786 void SetRxSensitivity(double threshold);
787 /**
788 * Return the receive sensitivity threshold (dBm).
789 *
790 * \return the receive sensitivity threshold in dBm
791 */
792 double GetRxSensitivity() const;
793 /**
794 * Sets the CCA energy detection threshold (dBm). The energy of a all received signals
795 * should be higher than this threshold to allow the PHY layer to declare CCA BUSY state.
796 *
797 * \param threshold the CCA threshold in dBm
798 */
799 void SetCcaEdThreshold(double threshold);
800 /**
801 * Return the CCA energy detection threshold (dBm).
802 *
803 * \return the CCA energy detection threshold in dBm
804 */
805 double GetCcaEdThreshold() const;
806 /**
807 * Sets the CCA sensitivity threshold (dBm). The energy of a received wifi signal
808 * should be higher than this threshold to allow the PHY layer to declare CCA BUSY state.
809 *
810 * \param threshold the CCA sensitivity threshold in dBm
811 */
812 void SetCcaSensitivityThreshold(double threshold);
813 /**
814 * Return the CCA sensitivity threshold (dBm).
815 *
816 * \return the CCA sensitivity threshold in dBm
817 */
818 double GetCcaSensitivityThreshold() const;
819 /**
820 * Sets the RX loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in the receiver.
821 *
822 * \param noiseFigureDb noise figure in dB
823 */
824 void SetRxNoiseFigure(double noiseFigureDb);
825 /**
826 * Sets the minimum available transmission power level (dBm).
827 *
828 * \param start the minimum transmission power level (dBm)
829 */
830 void SetTxPowerStart(double start);
831 /**
832 * Return the minimum available transmission power level (dBm).
833 *
834 * \return the minimum available transmission power level (dBm)
835 */
836 double GetTxPowerStart() const;
837 /**
838 * Sets the maximum available transmission power level (dBm).
839 *
840 * \param end the maximum transmission power level (dBm)
841 */
842 void SetTxPowerEnd(double end);
843 /**
844 * Return the maximum available transmission power level (dBm).
845 *
846 * \return the maximum available transmission power level (dBm)
847 */
848 double GetTxPowerEnd() const;
849 /**
850 * Sets the number of transmission power levels available between the
851 * minimum level and the maximum level. Transmission power levels are
852 * equally separated (in dBm) with the minimum and the maximum included.
853 *
854 * \param n the number of available levels
855 */
856 void SetNTxPower(uint8_t n);
857 /**
858 * Return the number of available transmission power levels.
859 *
860 * \return the number of available transmission power levels
861 */
862 uint8_t GetNTxPower() const;
863 /**
864 * Sets the transmission gain (dB).
865 *
866 * \param gain the transmission gain in dB
867 */
868 void SetTxGain(double gain);
869 /**
870 * Return the transmission gain (dB).
871 *
872 * \return the transmission gain in dB
873 */
874 double GetTxGain() const;
875 /**
876 * Sets the reception gain (dB).
877 *
878 * \param gain the reception gain in dB
879 */
880 void SetRxGain(double gain);
881 /**
882 * Return the reception gain (dB).
883 *
884 * \return the reception gain in dB
885 */
886 double GetRxGain() const;
887
888 /**
889 * Sets the device this PHY is associated with.
890 *
891 * \param device the device this PHY is associated with
892 */
893 virtual void SetDevice(const Ptr<WifiNetDevice> device);
894 /**
895 * Return the device this PHY is associated with
896 *
897 * \return the device this PHY is associated with
898 */
900 /**
901 * \brief assign a mobility model to this device
902 *
903 * This method allows a user to specify a mobility model that should be
904 * associated with this physical layer. Calling this method is optional
905 * and only necessary if the user wants to override the mobility model
906 * that is aggregated to the node.
907 *
908 * \param mobility the mobility model this PHY is associated with
909 */
910 void SetMobility(const Ptr<MobilityModel> mobility);
911 /**
912 * Return the mobility model this PHY is associated with.
913 * This method will return either the mobility model that has been
914 * explicitly set by a call to YansWifiPhy::SetMobility(), or else
915 * will return the mobility model (if any) that has been aggregated
916 * to the node.
917 *
918 * \return the mobility model this PHY is associated with
919 */
921
923 std::tuple<uint8_t /* channel number */,
924 uint16_t /* channel width */,
925 WifiPhyBand /* WifiPhyBand */,
926 uint8_t /* primary20 index*/>; //!< Tuple identifying an operating channel
927
928 /**
929 * If the standard for this object has not been set yet, store the given channel
930 * settings. Otherwise, check if a channel switch can be performed now. If not,
931 * schedule another call to this method when channel switch can be performed.
932 * Otherwise, set the operating channel based on the given channel settings and
933 * call ConfigureStandard if the PHY band has changed.
934 *
935 * Note that, in case a Spectrum PHY is used, a spectrum channel covering the
936 * operating channel bandwidth must have been already added when actually setting
937 * the operating channel.
938 *
939 * \param channelTuple the given channel settings
940 */
941 void SetOperatingChannel(const ChannelTuple& channelTuple);
942 /**
943 * If the standard for this object has not been set yet, store the channel settings
944 * corresponding to the given operating channel. Otherwise, check if a channel switch
945 * can be performed now. If not, schedule another call to this method when channel switch
946 * can be performed. Otherwise, set the given operating channel and call ConfigureStandard
947 * if the PHY band has changed.
948 *
949 * Note that, in case a Spectrum PHY is used, a spectrum channel covering the
950 * operating channel bandwidth must have been already added when actually setting
951 * the operating channel.
952 *
953 * \param channel the given operating channel
954 */
955 void SetOperatingChannel(const WifiPhyOperatingChannel& channel);
956 /**
957 * Configure whether it is prohibited to change PHY band after initialization.
958 *
959 * \param enable true to prohibit changing PHY band after initialization,
960 * false otherwise
961 */
962 void SetFixedPhyBand(bool enable);
963 /**
964 * \return whether it is prohibited to change PHY band after initialization
965 */
966 bool HasFixedPhyBand() const;
967 /**
968 * \return the operating center frequency (MHz)
969 */
970 uint16_t GetFrequency() const;
971 /**
972 * \return the index of the primary 20 MHz channel
973 */
974 uint8_t GetPrimary20Index() const;
975 /**
976 * Get the bandwidth for a transmission occurring on the current operating channel and
977 * using the given WifiMode, subject to the constraint that the TX bandwidth cannot exceed
978 * the given maximum allowed value.
979 *
980 * \param mode the given WifiMode
981 * \param maxAllowedBandWidth the maximum allowed TX bandwidth
982 * \return the bandwidth for the transmission
983 */
984 uint16_t GetTxBandwidth(
985 WifiMode mode,
986 uint16_t maxAllowedBandWidth = std::numeric_limits<uint16_t>::max()) const;
987 /**
988 * \param antennas the number of antennas on this node.
989 */
990 void SetNumberOfAntennas(uint8_t antennas);
991 /**
992 * \return the number of antennas on this device
993 */
994 uint8_t GetNumberOfAntennas() const;
995 /**
996 * \param streams the maximum number of supported TX spatial streams.
997 */
998 void SetMaxSupportedTxSpatialStreams(uint8_t streams);
999 /**
1000 * \return the maximum number of supported TX spatial streams
1001 */
1002 uint8_t GetMaxSupportedTxSpatialStreams() const;
1003 /**
1004 * \param streams the maximum number of supported RX spatial streams.
1005 */
1006 void SetMaxSupportedRxSpatialStreams(uint8_t streams);
1007 /**
1008 * \return the maximum number of supported RX spatial streams
1009 */
1010 uint8_t GetMaxSupportedRxSpatialStreams() const;
1011 /**
1012 * Enable or disable short PHY preamble.
1013 *
1014 * \param preamble sets whether short PHY preamble is supported or not
1015 */
1016 void SetShortPhyPreambleSupported(bool preamble);
1017 /**
1018 * Return whether short PHY preamble is supported.
1019 *
1020 * \returns if short PHY preamble is supported or not
1021 */
1022 bool GetShortPhyPreambleSupported() const;
1023
1024 /**
1025 * Set the index allocated to this PHY
1026 *
1027 * \param phyId the ID allocated to this PHY
1028 */
1029 void SetPhyId(uint8_t phyId);
1030
1031 /**
1032 * Get the index allocated to this PHY
1033 *
1034 * \return the ID allocated to this PHY
1035 */
1036 uint8_t GetPhyId() const;
1037
1038 /**
1039 * Sets the interference helper.
1040 *
1041 * \param helper the interference helper
1042 */
1043 virtual void SetInterferenceHelper(const Ptr<InterferenceHelper> helper);
1044
1045 /**
1046 * Sets the error rate model.
1047 *
1048 * \param model the error rate model
1049 */
1050 void SetErrorRateModel(const Ptr<ErrorRateModel> model);
1051 /**
1052 * Attach a receive ErrorModel to the WifiPhy.
1053 *
1054 * The WifiPhy may optionally include an ErrorModel in
1055 * the packet receive chain. The error model is additive
1056 * to any modulation-based error model based on SNR, and
1057 * is typically used to force specific packet losses or
1058 * for testing purposes.
1059 *
1060 * \param em Pointer to the ErrorModel.
1061 */
1063 /**
1064 * Sets the frame capture model.
1065 *
1066 * \param frameCaptureModel the frame capture model
1067 */
1068 void SetFrameCaptureModel(const Ptr<FrameCaptureModel> frameCaptureModel);
1069 /**
1070 * Sets the preamble detection model.
1071 *
1072 * \param preambleDetectionModel the preamble detection model
1073 */
1074 void SetPreambleDetectionModel(const Ptr<PreambleDetectionModel> preambleDetectionModel);
1075 /**
1076 * Sets the wifi radio energy model.
1077 *
1078 * \param wifiRadioEnergyModel the wifi radio energy model
1079 */
1080 void SetWifiRadioEnergyModel(const Ptr<WifiRadioEnergyModel> wifiRadioEnergyModel);
1081
1082 /**
1083 * \return the channel width in MHz
1084 */
1085 uint16_t GetChannelWidth() const;
1086
1087 /**
1088 * Get the power of the given power level in dBm.
1089 * In SpectrumWifiPhy implementation, the power levels are equally spaced (in dBm).
1090 *
1091 * \param power the power level
1092 *
1093 * \return the transmission power in dBm at the given power level
1094 */
1095 double GetPowerDbm(uint8_t power) const;
1096
1097 /**
1098 * Reset PHY to IDLE, with some potential TX power restrictions for the next transmission.
1099 *
1100 * \param powerRestricted flag whether the transmit power is restricted for the next
1101 * transmission
1102 * \param txPowerMaxSiso the SISO transmit power restriction for the next transmission in dBm
1103 * \param txPowerMaxMimo the MIMO transmit power restriction for the next transmission in dBm
1104 */
1105 void ResetCca(bool powerRestricted, double txPowerMaxSiso = 0, double txPowerMaxMimo = 0);
1106 /**
1107 * Compute the transmit power for the next transmission.
1108 * The returned power will satisfy the power density constraints
1109 * after addition of antenna gain.
1110 *
1111 * \param ppdu the PPDU to transmit
1112 * \return the transmit power in dBm for the next transmission
1113 */
1115 /**
1116 * Notify the PHY that an access to the channel was requested.
1117 * This is typically called by the channel access manager to
1118 * to notify the PHY about an ongoing transmission.
1119 * The PHY will use this information to determine whether
1120 * it should use power restriction as imposed by OBSS_PD SR.
1121 */
1123
1124 /**
1125 * This is a helper function to convert start and stop indices to start and stop frequencies.
1126 *
1127 * \param indices the start/stop indices to convert
1128 * \return the converted frequencies
1129 */
1131 const WifiSpectrumBandIndices& indices) const = 0;
1132
1133 /**
1134 * Add the PHY entity to the map of __implemented__ PHY entities for the
1135 * given modulation class.
1136 * Through this method, child classes can add their own PHY entities in
1137 * a static manner.
1138 *
1139 * \param modulation the modulation class
1140 * \param phyEntity the PHY entity
1141 */
1142 static void AddStaticPhyEntity(WifiModulationClass modulation, Ptr<PhyEntity> phyEntity);
1143
1144 /**
1145 * Get the __implemented__ PHY entity corresponding to the modulation class.
1146 * This is used to compute the different amendment-specific parameters within
1147 * calling static methods.
1148 *
1149 * \param modulation the modulation class
1150 * \return the pointer to the static implemented PHY entity
1151 */
1153
1154 /**
1155 * Get the supported PHY entity to use for a received PPDU.
1156 * This typically returns the entity corresponding to the modulation class used to transmit the
1157 * PPDU. If the modulation class used to transmit the PPDU is not supported by the PHY, the
1158 * latest PHY entity corresponding to the configured standard is returned. If the modulation
1159 * used to transmit the PPDU is non-HT (duplicate), the latest PHY entity corresponding to the
1160 * configured standard is also returned.
1161 *
1162 * \param ppdu the received PPDU
1163 * \return the pointer to the supported PHY entity
1164 */
1166
1167 /**
1168 * Get the supported PHY entity corresponding to the modulation class.
1169 *
1170 * \param modulation the modulation class
1171 * \return the pointer to the supported PHY entity
1172 */
1174 /**
1175 * Get the supported PHY entity corresponding to the wifi standard.
1176 *
1177 * \param standard the wifi standard
1178 * \return the pointer to the supported PHY entity
1179 */
1181 /**
1182 * Get the latest PHY entity supported by this PHY instance.
1183 *
1184 * \return the latest PHY entity supported by this PHY instance
1185 */
1187
1188 /**
1189 * \return the UID of the previously received PPDU (reset to UINT64_MAX upon transmission)
1190 */
1191 uint64_t GetPreviouslyRxPpduUid() const;
1192
1193 /**
1194 * Set the UID of the previously received PPDU.
1195 *
1196 * \param uid the value for the UID of the previously received PPDU
1197 *
1198 * \note This method shall only be used in exceptional circumstances, such as when a PHY
1199 * transmits a response to a Trigger Frame that was received by another PHY. This is the
1200 * case, e.g., when an aux PHY of an EMLSR client receives an ICF but it is the main PHY
1201 * that switches channel and transmits the response to the ICF.
1202 */
1203 void SetPreviouslyRxPpduUid(uint64_t uid);
1204
1205 /**
1206 * \param currentChannelWidth channel width of the current transmission (MHz)
1207 * \return the width of the guard band (MHz)
1208 *
1209 * Note: in order to properly model out of band transmissions for OFDM, the guard
1210 * band has been configured so as to expand the modeled spectrum up to the
1211 * outermost referenced point in "Transmit spectrum mask" sections' PSDs of
1212 * each PHY specification of 802.11-2016 standard. It thus ultimately corresponds
1213 * to the current channel bandwidth (which can be different from devices max
1214 * channel width).
1215 *
1216 * This method is only relevant for SpectrumWifiPhy.
1217 */
1218 virtual uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const = 0;
1219 /**
1220 * \return a tuple containing the minimum rejection (in dBr) for the inner band,
1221 * the minimum rejection (in dBr) for the outer band, and
1222 * the maximum rejection (in dBr) for the outer band
1223 * for the transmit spectrum mask.
1224 *
1225 * This method is only relevant for SpectrumWifiPhy.
1226 */
1227 virtual std::tuple<double, double, double> GetTxMaskRejectionParams() const = 0;
1228
1229 /**
1230 * Get channel number of the primary channel
1231 * \param primaryChannelWidth the width of the primary channel (MHz)
1232 *
1233 * \return channel number of the primary channel
1234 */
1235 uint8_t GetPrimaryChannelNumber(uint16_t primaryChannelWidth) const;
1236
1237 /**
1238 * Get the info of a given band
1239 *
1240 * \param bandWidth the width of the band to be returned (MHz)
1241 * \param bandIndex the index of the band to be returned
1242 *
1243 * \return the info that defines the band
1244 */
1245 virtual WifiSpectrumBandInfo GetBand(uint16_t bandWidth, uint8_t bandIndex = 0) = 0;
1246
1247 /**
1248 * Get the frequency range of the current RF interface.
1249 *
1250 * \return the frequency range of the current RF interface
1251 */
1253
1254 /**
1255 * \return the subcarrier spacing corresponding to the configure standard (Hz)
1256 */
1258
1259 /**
1260 * Callback invoked when the PHY model starts to transmit a signal
1261 *
1262 * \param ppdu The PPDU being transmitted
1263 * \param txVector txVector used for transmitting the PPDU
1264 */
1266 const WifiTxVector& txVector);
1267
1268 protected:
1269 void DoInitialize() override;
1270 void DoDispose() override;
1271
1272 /**
1273 * Reset data upon end of TX or RX
1274 */
1275 void Reset();
1276
1277 /**
1278 * Perform any actions necessary when user changes operating channel after
1279 * initialization.
1280 *
1281 * \return the amount of time to wait until the channel switch can be performed or
1282 * std::nullopt if channel switch is currently not possible (i.e., the radio is in sleep mode)
1283 */
1284 std::optional<Time> GetDelayUntilChannelSwitch();
1285 /**
1286 * Actually switch channel based on the stored channel settings.
1287 */
1288 virtual void DoChannelSwitch();
1289
1290 /**
1291 * Check if PHY state should move to CCA busy state based on current
1292 * state of interference tracker.
1293 *
1294 * \param ppdu the incoming PPDU or nullptr for any signal
1295 */
1296 void SwitchMaybeToCcaBusy(const Ptr<const WifiPpdu> ppdu = nullptr);
1297 /**
1298 * Notify PHY state helper to switch to CCA busy state,
1299 *
1300 * \param ppdu the incoming PPDU or nullptr for any signal
1301 * \param duration the duration of the CCA state
1302 */
1303 void NotifyCcaBusy(const Ptr<const WifiPpdu> ppdu, Time duration);
1304
1305 /**
1306 * Add the PHY entity to the map of supported PHY entities for the
1307 * given modulation class for the WifiPhy instance.
1308 * This is a wrapper method used to check that the PHY entity is
1309 * in the static map of implemented PHY entities (\see GetStaticPhyEntities).
1310 * In addition, child classes can add their own PHY entities.
1311 *
1312 * \param modulation the modulation class
1313 * \param phyEntity the PHY entity
1314 */
1315 void AddPhyEntity(WifiModulationClass modulation, Ptr<PhyEntity> phyEntity);
1316
1317 uint8_t m_phyId; //!< the index of the PHY in the vector of PHYs held by the WifiNetDevice
1318
1320 m_interference; //!< Pointer to a helper responsible for interference computations
1321
1322 Ptr<UniformRandomVariable> m_random; //!< Provides uniform random variables.
1323 Ptr<WifiPhyStateHelper> m_state; //!< Pointer to WifiPhyStateHelper
1324
1325 uint32_t m_txMpduReferenceNumber; //!< A-MPDU reference number to identify all transmitted
1326 //!< subframes belonging to the same received A-MPDU
1327 uint32_t m_rxMpduReferenceNumber; //!< A-MPDU reference number to identify all received
1328 //!< subframes belonging to the same received A-MPDU
1329
1330 EventId m_endPhyRxEvent; //!< the end of PHY receive event
1331 EventId m_endTxEvent; //!< the end of transmit event
1332
1333 Ptr<Event> m_currentEvent; //!< Hold the current event
1334 std::map<std::pair<uint64_t /* UID*/, WifiPreamble>, Ptr<Event>>
1335 m_currentPreambleEvents; //!< store event associated to a PPDU (that has a unique ID and
1336 //!< preamble combination) whose preamble is being received
1337
1338 uint64_t m_previouslyRxPpduUid; //!< UID of the previously received PPDU, reset to UINT64_MAX
1339 //!< upon transmission
1340
1341 /**
1342 * This map holds the supported PHY entities.
1343 *
1344 * The set of parameters (e.g. mode) that this WifiPhy(-derived class) can
1345 * support can be obtained through it.
1346 *
1347 * When it comes to modes, in conversation we call this set
1348 * the DeviceRateSet (not a term you'll find in the standard), and
1349 * it is a superset of standard-defined parameters such as the
1350 * OperationalRateSet, and the BSSBasicRateSet (which, themselves,
1351 * have a superset/subset relationship).
1352 *
1353 * Mandatory rates relevant to this WifiPhy can be found by
1354 * iterating over the elements of this map, for each modulation class,
1355 * looking for WifiMode objects for which
1356 * WifiMode::IsMandatory() is true.
1357 */
1358 std::map<WifiModulationClass, Ptr<PhyEntity>> m_phyEntities;
1359
1361 m_signalTransmissionCb; //!< Signal Transmission callback
1362
1363 private:
1364 /**
1365 * Configure WifiPhy with appropriate channel frequency and
1366 * supported rates for 802.11a standard.
1367 */
1368 void Configure80211a();
1369 /**
1370 * Configure WifiPhy with appropriate channel frequency and
1371 * supported rates for 802.11b standard.
1372 */
1373 void Configure80211b();
1374 /**
1375 * Configure WifiPhy with appropriate channel frequency and
1376 * supported rates for 802.11g standard.
1377 */
1378 void Configure80211g();
1379 /**
1380 * Configure WifiPhy with appropriate channel frequency and
1381 * supported rates for 802.11p standard.
1382 */
1383 void Configure80211p();
1384 /**
1385 * Configure WifiPhy with appropriate channel frequency and
1386 * supported rates for 802.11n standard.
1387 */
1388 void Configure80211n();
1389 /**
1390 * Configure WifiPhy with appropriate channel frequency and
1391 * supported rates for 802.11ac standard.
1392 */
1393 void Configure80211ac();
1394 /**
1395 * Configure WifiPhy with appropriate channel frequency and
1396 * supported rates for 802.11ax standard.
1397 */
1398 void Configure80211ax();
1399 /**
1400 * Configure WifiPhy with appropriate channel frequency and
1401 * supported rates for 802.11be standard.
1402 */
1403 void Configure80211be();
1404 /**
1405 * Configure the device MCS set with the appropriate HtMcs modes for
1406 * the number of available transmit spatial streams
1407 */
1409 /**
1410 * Add the given MCS to the device MCS set.
1411 *
1412 * \param mode the MCS to add to the device MCS set
1413 */
1414 void PushMcs(WifiMode mode);
1415 /**
1416 * Rebuild the mapping of MCS values to indices in the device MCS set.
1417 */
1419
1420 /**
1421 * Due to newly arrived signal, the current reception cannot be continued and has to be aborted
1422 * \param reason the reason the reception is aborted
1423 *
1424 */
1426
1427 /**
1428 * Callback function when a transmission is completed
1429 * \param psdus the PSDUs that have been sent
1430 */
1431 void TxDone(const WifiConstPsduMap& psdus);
1432
1433 /**
1434 * Get the PSDU addressed to that PHY in a PPDU (useful for MU PPDU).
1435 *
1436 * \param ppdu the PPDU to extract the PSDU from
1437 * \return the PSDU addressed to that PHY
1438 */
1440
1441 /**
1442 * The trace source fired when a packet begins the transmission process on
1443 * the medium.
1444 *
1445 * \see class CallBackTraceSource
1446 */
1448 /**
1449 * The trace source fired when a PSDU map begins the transmission process on
1450 * the medium.
1451 *
1452 * \see class CallBackTraceSource
1453 */
1455
1456 /**
1457 * The trace source fired when a packet ends the transmission process on
1458 * the medium.
1459 *
1460 * \see class CallBackTraceSource
1461 */
1463
1464 /**
1465 * The trace source fired when the PHY layer drops a packet as it tries
1466 * to transmit it.
1467 *
1468 * \see class CallBackTraceSource
1469 */
1471
1472 /**
1473 * The trace source fired when a packet begins the reception process from
1474 * the medium.
1475 *
1476 * \see class CallBackTraceSource
1477 */
1479
1480 /**
1481 * The trace source fired when the reception of the PHY payload (PSDU) begins.
1482 *
1483 * This traced callback models the behavior of the PHY-RXSTART
1484 * primitive which is launched upon correct decoding of
1485 * the PHY header and support of modes within.
1486 * We thus assume that it is sent just before starting
1487 * the decoding of the payload, since it's there that
1488 * support of the header's content is checked. In addition,
1489 * it's also at that point that the correct decoding of
1490 * HT-SIG, VHT-SIGs, and HE-SIGs are checked.
1491 *
1492 * \see class CallBackTraceSource
1493 */
1495
1496 /**
1497 * The trace source fired when a packet ends the reception process from
1498 * the medium.
1499 *
1500 * \see class CallBackTraceSource
1501 */
1503
1504 /**
1505 * The trace source fired when the PHY layer drops a packet it has received.
1506 *
1507 * \see class CallBackTraceSource
1508 */
1510
1511 /**
1512 * The trace source fired when the PHY layer drops a packet it has received.
1513 */
1515
1516 /**
1517 * A trace source that emulates a Wi-Fi device in monitor mode
1518 * sniffing a packet being received.
1519 *
1520 * As a reference with the real world, firing this trace
1521 * corresponds in the madwifi driver to calling the function
1522 * ieee80211_input_monitor()
1523 *
1524 * \see class CallBackTraceSource
1525 * \todo WifiTxVector and signalNoiseDbm should be passed as
1526 * const references because of their sizes.
1527 */
1529 uint16_t /* frequency (MHz) */,
1531 MpduInfo,
1533 uint16_t /* STA-ID*/>
1535
1536 /**
1537 * A trace source that emulates a Wi-Fi device in monitor mode
1538 * sniffing a packet being transmitted.
1539 *
1540 * As a reference with the real world, firing this trace
1541 * corresponds in the madwifi driver to calling the function
1542 * ieee80211_input_monitor()
1543 *
1544 * \see class CallBackTraceSource
1545 * \todo WifiTxVector should be passed by const reference because
1546 * of its size.
1547 */
1549 uint16_t /* frequency (MHz) */,
1551 MpduInfo,
1552 uint16_t /* STA-ID*/>
1554
1555 /**
1556 * \return the map of __implemented__ PHY entities.
1557 * This is used to compute the different
1558 * amendment-specific parameters in a static manner.
1559 * For PHY entities supported by a given WifiPhy instance,
1560 * \see m_phyEntities.
1561 */
1562 static std::map<WifiModulationClass, Ptr<PhyEntity>>& GetStaticPhyEntities();
1563
1564 WifiStandard m_standard; //!< WifiStandard
1565 WifiModulationClass m_maxModClassSupported; //!< max modulation class supported
1566 WifiPhyBand m_band; //!< WifiPhyBand
1567 ChannelTuple m_channelSettings; //!< Store operating channel settings until initialization
1569 bool m_fixedPhyBand; //!< True to prohibit changing PHY band after initialization
1570
1571 Time m_sifs; //!< Short Interframe Space (SIFS) duration
1572 Time m_slot; //!< Slot duration
1573 Time m_pifs; //!< PCF Interframe Space (PIFS) duration
1574 Time m_ackTxTime; //!< estimated Ack TX time
1575 Time m_blockAckTxTime; //!< estimated BlockAck TX time
1576
1577 double m_rxSensitivityDbm; //!< Receive sensitivity threshold in dBm
1578 double m_ccaEdThresholdW; //!< Clear channel assessment (CCA) energy detection (ED) threshold in
1579 //!< watts
1580 double m_ccaSensitivityThresholdW; //!< Clear channel assessment (CCA) modulation and coding
1581 //!< rate sensitivity threshold in watts
1582
1583 double m_txGainDb; //!< Transmission gain (dB)
1584 double m_rxGainDb; //!< Reception gain (dB)
1585 double m_txPowerBaseDbm; //!< Minimum transmission power (dBm)
1586 double m_txPowerEndDbm; //!< Maximum transmission power (dBm)
1587 uint8_t m_nTxPower; //!< Number of available transmission power levels
1588 double m_powerDensityLimit; //!< the power density limit (dBm/MHz)
1589
1590 bool m_powerRestricted; //!< Flag whether transmit power is restricted by OBSS PD SR
1591 double
1592 m_txPowerMaxSiso; //!< SISO maximum transmit power due to OBSS PD SR power restriction (dBm)
1593 double
1594 m_txPowerMaxMimo; //!< MIMO maximum transmit power due to OBSS PD SR power restriction (dBm)
1595 bool m_channelAccessRequested; //!< Flag if channels access has been requested (used for OBSS_PD
1596 //!< SR)
1597
1598 bool m_shortPreamble; //!< Flag if short PHY preamble is supported
1599 uint8_t m_numberOfAntennas; //!< Number of transmitters
1600 uint8_t m_txSpatialStreams; //!< Number of supported TX spatial streams
1601 uint8_t m_rxSpatialStreams; //!< Number of supported RX spatial streams
1602
1603 double m_noiseFigureDb; //!< The noise figure in dB
1604
1605 Time m_channelSwitchDelay; //!< Time required to switch between channel
1606
1607 Ptr<WifiNetDevice> m_device; //!< Pointer to the device
1608 Ptr<MobilityModel> m_mobility; //!< Pointer to the mobility model
1609
1613 Ptr<ErrorModel> m_postReceptionErrorModel; //!< Error model for receive packet events
1614 Time m_timeLastPreambleDetected; //!< Record the time the last preamble was detected
1615
1616 Callback<void> m_capabilitiesChangedCallback; //!< Callback when PHY capabilities changed
1617};
1618
1619/**
1620 * \param os output stream
1621 * \param rxSignalInfo received signal info to stringify
1622 * \return output stream
1623 */
1624std::ostream& operator<<(std::ostream& os, RxSignalInfo rxSignalInfo);
1625
1626} // namespace ns3
1627
1628#endif /* WIFI_PHY_H */
An identifier for simulation events.
Definition: event-id.h:56
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:69
void SetNumberOfAntennas(uint8_t antennas)
Definition: wifi-phy.cc:1289
Ptr< WifiPhyStateHelper > m_state
Pointer to WifiPhyStateHelper.
Definition: wifi-phy.h:1323
Time GetBlockAckTxTime() const
Return the estimated BlockAck TX time for this PHY.
Definition: wifi-phy.cc:849
double GetCcaEdThreshold() const
Return the CCA energy detection threshold (dBm).
Definition: wifi-phy.cc:517
double m_rxGainDb
Reception gain (dB)
Definition: wifi-phy.h:1584
bool IsStateTx() const
Definition: wifi-phy.cc:2126
Ptr< MobilityModel > m_mobility
Pointer to the mobility model.
Definition: wifi-phy.h:1608
void(* PhyTxBeginTracedCallback)(Ptr< const Packet > packet, double txPowerW)
TracedCallback signature for Phy transmit events.
Definition: wifi-phy.h:730
WifiModulationClass GetMaxModulationClassSupported() const
Definition: wifi-phy.cc:987
bool IsStateIdle() const
Definition: wifi-phy.cc:2114
virtual void SetInterferenceHelper(const Ptr< InterferenceHelper > helper)
Sets the interference helper.
Definition: wifi-phy.cc:662
uint8_t m_txSpatialStreams
Number of supported TX spatial streams.
Definition: wifi-phy.h:1600
bool IsStateCcaBusy() const
Definition: wifi-phy.cc:2108
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:1759
Ptr< UniformRandomVariable > m_random
Provides uniform random variables.
Definition: wifi-phy.h:1322
Ptr< WifiRadioEnergyModel > m_wifiRadioEnergyModel
Wifi radio energy model.
Definition: wifi-phy.h:1612
void Configure80211ax()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11ax standard.
Definition: wifi-phy.cc:957
Time m_channelSwitchDelay
Time required to switch between channel.
Definition: wifi-phy.h:1605
void SetCcaEdThreshold(double threshold)
Sets the CCA energy detection threshold (dBm).
Definition: wifi-phy.cc:510
void(* PhyRxPpduDropTracedCallback)(Ptr< const WifiPpdu > ppdu, WifiPhyRxfailureReason reason)
TracedCallback signature for start of PSDU reception events.
Definition: wifi-phy.h:766
void NotifyCcaBusy(const Ptr< const WifiPpdu > ppdu, Time duration)
Notify PHY state helper to switch to CCA busy state,.
Definition: wifi-phy.cc:2175
WifiPhyOperatingChannel m_operatingChannel
Operating channel.
Definition: wifi-phy.h:1568
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:1470
void SetErrorRateModel(const Ptr< ErrorRateModel > model)
Sets the error rate model.
Definition: wifi-phy.cc:671
bool m_channelAccessRequested
Flag if channels access has been requested (used for OBSS_PD SR)
Definition: wifi-phy.h:1595
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:1492
Time GetSlot() const
Return the slot duration for this PHY.
Definition: wifi-phy.cc:825
uint32_t GetSubcarrierSpacing() const
Definition: wifi-phy.cc:2322
void SetMaxSupportedRxSpatialStreams(uint8_t streams)
Definition: wifi-phy.cc:1339
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:2291
void Configure80211g()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11g standard.
Definition: wifi-phy.cc:887
uint8_t GetPrimary20Index() const
Definition: wifi-phy.cc:1089
void NotifyTxEnd(WifiConstPsduMap psdus)
Public method used to fire a PhyTxEnd trace.
Definition: wifi-phy.cc:1589
uint16_t GetChannelWidth() const
Definition: wifi-phy.cc:1083
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:1335
uint8_t GetNumberOfAntennas() const
Definition: wifi-phy.cc:1301
Time m_slot
Slot duration.
Definition: wifi-phy.h:1572
double m_powerDensityLimit
the power density limit (dBm/MHz)
Definition: wifi-phy.h:1588
Time GetDelayUntilIdle()
Definition: wifi-phy.cc:2150
double GetRxSensitivity() const
Return the receive sensitivity threshold (dBm).
Definition: wifi-phy.cc:504
bool GetShortPhyPreambleSupported() const
Return whether short PHY preamble is supported.
Definition: wifi-phy.cc:619
void SetSifs(Time sifs)
Set the Short Interframe Space (SIFS) for this PHY.
Definition: wifi-phy.cc:807
std::list< uint8_t > GetBssMembershipSelectorList() const
The WifiPhy::BssMembershipSelector() method is used (e.g., by a WifiRemoteStationManager) to determin...
Definition: wifi-phy.cc:1357
void Configure80211n()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11n standard.
Definition: wifi-phy.cc:930
EventId m_endPhyRxEvent
the end of PHY receive event
Definition: wifi-phy.h:1330
double GetTxGain() const
Return the transmission gain (dB).
Definition: wifi-phy.cc:593
double m_txPowerBaseDbm
Minimum transmission power (dBm)
Definition: wifi-phy.h:1585
void Configure80211be()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11be standard.
Definition: wifi-phy.cc:972
void NotifyRxDrop(Ptr< const WifiPsdu > psdu, WifiPhyRxfailureReason reason)
Public method used to fire a PhyRxDrop trace.
Definition: wifi-phy.cc:1640
bool IsStateRx() const
Definition: wifi-phy.cc:2120
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:2006
Time GetSifs() const
Return the Short Interframe Space (SIFS) for this PHY.
Definition: wifi-phy.cc:813
uint16_t GetFrequency() const
Definition: wifi-phy.cc:1071
Ptr< MobilityModel > GetMobility() const
Return the mobility model this PHY is associated with.
Definition: wifi-phy.cc:643
uint16_t GetNMcs() const
Definition: wifi-phy.cc:2052
Time m_blockAckTxTime
estimated BlockAck TX time
Definition: wifi-phy.h:1575
uint8_t GetPrimaryChannelNumber(uint16_t primaryChannelWidth) const
Get channel number of the primary channel.
Definition: wifi-phy.cc:2316
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:2232
double m_txPowerMaxMimo
MIMO maximum transmit power due to OBSS PD SR power restriction (dBm)
Definition: wifi-phy.h:1594
void ResumeFromSleep()
Resume from sleep mode.
Definition: wifi-phy.cc:1425
static Time GetPreambleDetectionDuration()
Definition: wifi-phy.cc:1480
void Configure80211p()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11p standard.
Definition: wifi-phy.cc:900
void AbortCurrentReception(WifiPhyRxfailureReason reason)
Due to newly arrived signal, the current reception cannot be continued and has to be aborted.
Definition: wifi-phy.cc:2182
Ptr< FrameCaptureModel > m_frameCaptureModel
Frame capture model.
Definition: wifi-phy.h:1610
TracedCallback< Ptr< const Packet > > m_phyRxEndTrace
The trace source fired when a packet ends the reception process from the medium.
Definition: wifi-phy.h:1502
void NotifyRxBegin(Ptr< const WifiPsdu > psdu, const RxPowerWattPerChannelBand &rxPowersW)
Public method used to fire a PhyRxBegin trace.
Definition: wifi-phy.cc:1616
Time GetChannelSwitchDelay() const
Definition: wifi-phy.cc:723
void SetMaxSupportedTxSpatialStreams(uint8_t streams)
Definition: wifi-phy.cc:1307
Time m_sifs
Short Interframe Space (SIFS) duration.
Definition: wifi-phy.h:1571
void SetReceiveErrorCallback(RxErrorCallback callback)
Definition: wifi-phy.cc:473
virtual uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const =0
TracedCallback< Ptr< const WifiPpdu >, const WifiTxVector & > m_signalTransmissionCb
Signal Transmission callback.
Definition: wifi-phy.h:1361
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:2144
uint8_t GetMaxSupportedRxSpatialStreams() const
Definition: wifi-phy.cc:1351
void(* PsduTxBeginCallback)(WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
TracedCallback signature for PSDU transmit events.
Definition: wifi-phy.h:739
double GetTxPowerEnd() const
Return the maximum available transmission power level (dBm).
Definition: wifi-phy.cc:567
virtual void ConfigureStandard(WifiStandard standard)
Configure the PHY-level parameters for different Wi-Fi standard.
Definition: wifi-phy.cc:993
void SetPostReceptionErrorModel(const Ptr< ErrorModel > em)
Attach a receive ErrorModel to the WifiPhy.
Definition: wifi-phy.cc:679
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:2101
void PushMcs(WifiMode mode)
Add the given MCS to the device MCS set.
uint8_t m_numberOfAntennas
Number of transmitters.
Definition: wifi-phy.h:1599
ChannelTuple m_channelSettings
Store operating channel settings until initialization.
Definition: wifi-phy.h:1567
uint32_t m_txMpduReferenceNumber
A-MPDU reference number to identify all transmitted subframes belonging to the same received A-MPDU.
Definition: wifi-phy.h:1325
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:1514
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
Definition: wifi-phy.cc:1539
static uint32_t GetMaxPsduSize(WifiModulationClass modulation)
Get the maximum PSDU size in bytes for the given modulation class.
Definition: wifi-phy.cc:1568
Ptr< WifiPhyStateHelper > GetState() const
Return the WifiPhyStateHelper of this PHY.
Definition: wifi-phy.cc:461
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:1574
void EndReceiveInterBss()
For HE receptions only, check and possibly modify the transmit power restriction state at the end of ...
Definition: wifi-phy.cc:1960
void SetSleepMode()
Put in sleep mode.
Definition: wifi-phy.cc:1372
void SetShortPhyPreambleSupported(bool preamble)
Enable or disable short PHY preamble.
Definition: wifi-phy.cc:612
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:573
WifiPhyBand m_band
WifiPhyBand.
Definition: wifi-phy.h:1566
void SetRxSensitivity(double threshold)
Sets the receive sensitivity threshold (dBm).
Definition: wifi-phy.cc:497
static const Ptr< const PhyEntity > GetStaticPhyEntity(WifiModulationClass modulation)
Get the implemented PHY entity corresponding to the modulation class.
Definition: wifi-phy.cc:735
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:718
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:1553
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:1592
std::map< WifiModulationClass, Ptr< PhyEntity > > m_phyEntities
This map holds the supported PHY entities.
Definition: wifi-phy.h:1358
void NotifyRxPpduDrop(Ptr< const WifiPpdu > ppdu, WifiPhyRxfailureReason reason)
Public method used to fire a PhyRxPpduDrop trace.
Definition: wifi-phy.cc:1652
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:980
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:794
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:1534
Ptr< ErrorModel > m_postReceptionErrorModel
Error model for receive packet events.
Definition: wifi-phy.h:1613
EventId m_endTxEvent
the end of transmit event
Definition: wifi-phy.h:1331
double GetRxGain() const
Return the reception gain (dB).
Definition: wifi-phy.cc:606
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:1753
double m_rxSensitivityDbm
Receive sensitivity threshold in dBm.
Definition: wifi-phy.h:1577
void RegisterListener(const std::shared_ptr< WifiPhyListener > &listener)
Definition: wifi-phy.cc:479
static std::map< WifiModulationClass, Ptr< PhyEntity > > & GetStaticPhyEntities()
Definition: wifi-phy.cc:454
void SetSlot(Time slot)
Set the slot duration for this PHY.
Definition: wifi-phy.cc:819
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:1130
WifiPhyBand GetPhyBand() const
Get the configured Wi-Fi band.
Definition: wifi-phy.cc:1053
void SetPreviouslyRxPpduUid(uint64_t uid)
Set the UID of the previously received PPDU.
Definition: wifi-phy.cc:1900
bool IsReceivingPhyHeader() const
Definition: wifi-phy.cc:1954
double m_ccaSensitivityThresholdW
Clear channel assessment (CCA) modulation and coding rate sensitivity threshold in watts.
Definition: wifi-phy.h:1580
Ptr< Event > m_currentEvent
Hold the current event.
Definition: wifi-phy.h:1333
Time GetLastRxStartTime() const
Return the start time of the last received packet.
Definition: wifi-phy.cc:2156
WifiMode GetDefaultMode() const
Get the default WifiMode supported by the PHY.
Definition: wifi-phy.cc:1990
void SetCcaSensitivityThreshold(double threshold)
Sets the CCA sensitivity threshold (dBm).
Definition: wifi-phy.cc:523
double m_ccaEdThresholdW
Clear channel assessment (CCA) energy detection (ED) threshold in watts.
Definition: wifi-phy.h:1578
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:1713
Ptr< PhyEntity > GetPhyEntity(WifiModulationClass modulation) const
Get the supported PHY entity corresponding to the modulation class.
Definition: wifi-phy.cc:744
uint8_t GetChannelNumber() const
Return current channel number.
Definition: wifi-phy.cc:1077
TracedCallback< Ptr< const Packet > > m_phyTxEndTrace
The trace source fired when a packet ends the transmission process on the medium.
Definition: wifi-phy.h:1462
uint64_t m_previouslyRxPpduUid
UID of the previously received PPDU, reset to UINT64_MAX upon transmission.
Definition: wifi-phy.h:1338
std::optional< Time > GetDelayUntilChannelSwitch()
Perform any actions necessary when user changes operating channel after initialization.
Definition: wifi-phy.cc:1167
uint32_t m_rxMpduReferenceNumber
A-MPDU reference number to identify all received subframes belonging to the same received A-MPDU.
Definition: wifi-phy.h:1327
void SetWifiRadioEnergyModel(const Ptr< WifiRadioEnergyModel > wifiRadioEnergyModel)
Sets the wifi radio energy model.
Definition: wifi-phy.cc:698
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:1447
virtual void SetDevice(const Ptr< WifiNetDevice > device)
Sets the device this PHY is associated with.
Definition: wifi-phy.cc:625
Ptr< PreambleDetectionModel > m_preambleDetectionModel
Preamble detection model.
Definition: wifi-phy.h:1611
void SetTxPowerEnd(double end)
Sets the maximum available transmission power level (dBm).
Definition: wifi-phy.cc:560
Time GetPifs() const
Return the PCF Interframe Space (PIFS) for this PHY.
Definition: wifi-phy.cc:837
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:785
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:679
void NotifyRxEnd(Ptr< const WifiPsdu > psdu)
Public method used to fire a PhyRxEnd trace.
Definition: wifi-phy.cc:1628
void StartReceivePreamble(Ptr< const WifiPpdu > ppdu, RxPowerWattPerChannelBand &rxPowersW, Time rxDuration)
Start receiving the PHY preamble of a PPDU (i.e.
Definition: wifi-phy.cc:1931
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:1454
double m_txGainDb
Transmission gain (dB)
Definition: wifi-phy.h:1583
bool IsStateSleep() const
Definition: wifi-phy.cc:2138
Ptr< WifiNetDevice > GetDevice() const
Return the device this PHY is associated with.
Definition: wifi-phy.cc:631
WifiStandard m_standard
WifiStandard.
Definition: wifi-phy.h:1564
double GetPowerDbm(uint8_t power) const
Get the power of the given power level in dBm.
Definition: wifi-phy.cc:704
uint8_t m_nTxPower
Number of available transmission power levels.
Definition: wifi-phy.h:1587
void DoDispose() override
Destructor implementation.
Definition: wifi-phy.cc:425
bool IsStateSwitching() const
Definition: wifi-phy.cc:2132
void SetPhyId(uint8_t phyId)
Set the index allocated to this PHY.
Definition: wifi-phy.cc:649
virtual void DoChannelSwitch()
Actually switch channel based on the stored channel settings.
Definition: wifi-phy.cc:1206
void SetOffMode()
Put in off mode.
Definition: wifi-phy.cc:1415
double m_noiseFigureDb
The noise figure in dB.
Definition: wifi-phy.h:1603
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:1509
void SetPreambleDetectionModel(const Ptr< PreambleDetectionModel > preambleDetectionModel)
Sets the preamble detection model.
Definition: wifi-phy.cc:692
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:1317
std::tuple< uint8_t, uint16_t, WifiPhyBand, uint8_t > ChannelTuple
Tuple identifying an operating channel.
Definition: wifi-phy.h:926
void SetPifs(Time pifs)
Set the PCF Interframe Space (PIFS) for this PHY.
Definition: wifi-phy.cc:831
void Configure80211b()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11b standard.
Definition: wifi-phy.cc:870
void(* SignalTransmissionCallback)(Ptr< const WifiPpdu > ppdu, const WifiTxVector &txVector)
Callback invoked when the PHY model starts to transmit a signal.
Definition: wifi-phy.h:1265
static Time GetStartOfPacketDuration(const WifiTxVector &txVector)
Definition: wifi-phy.cc:1486
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:1107
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:599
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:2168
void SetMobility(const Ptr< MobilityModel > mobility)
assign a mobility model to this device
Definition: wifi-phy.cc:637
void SetTxGain(double gain)
Sets the transmission gain (dB).
Definition: wifi-phy.cc:586
uint8_t m_rxSpatialStreams
Number of supported RX spatial streams.
Definition: wifi-phy.h:1601
double m_txPowerEndDbm
Maximum transmission power (dBm)
Definition: wifi-phy.h:1586
double CalculateSnr(const WifiTxVector &txVector, double ber) const
Definition: wifi-phy.cc:729
void SetFixedPhyBand(bool enable)
Configure whether it is prohibited to change PHY band after initialization.
Definition: wifi-phy.cc:1095
void(* PhyRxBeginTracedCallback)(Ptr< const Packet > packet, RxPowerWattPerChannelBand rxPowersW)
TracedCallback signature for PhyRxBegin trace source.
Definition: wifi-phy.h:749
~WifiPhy() override
Definition: wifi-phy.cc:394
void Configure80211ac()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11ac standard.
Definition: wifi-phy.cc:949
bool HasFixedPhyBand() const
Definition: wifi-phy.cc:1101
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:1478
Ptr< WifiNetDevice > m_device
Pointer to the device.
Definition: wifi-phy.h:1607
Ptr< InterferenceHelper > m_interference
Pointer to a helper responsible for interference computations.
Definition: wifi-phy.h:1320
void DoInitialize() override
Initialize() implementation.
Definition: wifi-phy.cc:400
bool m_shortPreamble
Flag if short PHY preamble is supported.
Definition: wifi-phy.h:1598
uint8_t GetPhyId() const
Get the index allocated to this PHY.
Definition: wifi-phy.cc:656
Time m_pifs
PCF Interframe Space (PIFS) duration.
Definition: wifi-phy.h:1573
WifiModulationClass m_maxModClassSupported
max modulation class supported
Definition: wifi-phy.h:1565
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:536
double GetTxPowerStart() const
Return the minimum available transmission power level (dBm).
Definition: wifi-phy.cc:554
double GetTxPowerForTransmission(Ptr< const WifiPpdu > ppdu) const
Compute the transmit power for the next transmission.
Definition: wifi-phy.cc:2255
void(* PhyRxPayloadBeginTracedCallback)(WifiTxVector txVector, Time psduDuration)
TracedCallback signature for start of PSDU reception events.
Definition: wifi-phy.h:758
WifiStandard GetStandard() const
Get the configured Wi-Fi standard.
Definition: wifi-phy.cc:1059
void SetCapabilitiesChangedCallback(Callback< void > callback)
Definition: wifi-phy.cc:491
void SetReceiveOkCallback(RxOkCallback callback)
Definition: wifi-phy.cc:467
void SetFrameCaptureModel(const Ptr< FrameCaptureModel > frameCaptureModel)
Sets the frame capture model.
Definition: wifi-phy.cc:686
void NotifyChannelAccessRequested()
Notify the PHY that an access to the channel was requested.
Definition: wifi-phy.cc:1970
void ResumeFromOff()
Resume from off mode.
Definition: wifi-phy.cc:1452
bool m_powerRestricted
Flag whether transmit power is restricted by OBSS PD SR.
Definition: wifi-phy.h:1590
virtual std::tuple< double, double, double > GetTxMaskRejectionParams() const =0
Callback< void > m_capabilitiesChangedCallback
Callback when PHY capabilities changed.
Definition: wifi-phy.h:1616
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:1659
Ptr< PhyEntity > GetPhyEntityForPpdu(const Ptr< const WifiPpdu > ppdu) const
Get the supported PHY entity to use for a received PPDU.
Definition: wifi-phy.cc:765
Time GetAckTxTime() const
Return the estimated Ack TX time for this PHY.
Definition: wifi-phy.cc:843
uint64_t GetPreviouslyRxPpduUid() const
Definition: wifi-phy.cc:1894
void Reset()
Reset data upon end of TX or RX.
Definition: wifi-phy.cc:1907
TracedCallback< WifiTxVector, Time > m_phyRxPayloadBeginTrace
The trace source fired when the reception of the PHY payload (PSDU) begins.
Definition: wifi-phy.h:1494
Time GetLastRxEndTime() const
Return the end time of the last received packet.
Definition: wifi-phy.cc:2162
Time m_timeLastPreambleDetected
Record the time the last preamble was detected.
Definition: wifi-phy.h:1614
uint8_t GetMaxSupportedTxSpatialStreams() const
Definition: wifi-phy.cc:1333
void Configure80211a()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11a standard.
Definition: wifi-phy.cc:855
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:2066
std::list< WifiMode > GetModeList() const
The WifiPhy::GetModeList() method is used (e.g., by a WifiRemoteStationManager) to determine the set ...
Definition: wifi-phy.cc:2017
void TxDone(const WifiConstPsduMap &psdus)
Callback function when a transmission is completed.
Definition: wifi-phy.cc:1884
const WifiPhyOperatingChannel & GetOperatingChannel() const
Get a const reference to the operating channel.
Definition: wifi-phy.cc:1065
double GetCcaSensitivityThreshold() const
Return the CCA sensitivity threshold (dBm).
Definition: wifi-phy.cc:530
bool m_fixedPhyBand
True to prohibit changing PHY band after initialization.
Definition: wifi-phy.h:1569
Ptr< PhyEntity > GetLatestPhyEntity() const
Get the latest PHY entity supported by this PHY instance.
Definition: wifi-phy.cc:759
void SetTxPowerStart(double start)
Sets the minimum available transmission power level (dBm).
Definition: wifi-phy.cc:547
uint8_t GetNTxPower() const
Return the number of available transmission power levels.
Definition: wifi-phy.cc:580
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:2298
static Time CalculatePhyPreambleAndHeaderDuration(const WifiTxVector &txVector)
Definition: wifi-phy.cc:1532
bool IsModeSupported(WifiMode mode) const
Check if the given WifiMode is supported by the PHY.
Definition: wifi-phy.cc:1977
Time m_ackTxTime
estimated Ack TX time
Definition: wifi-phy.h:1574
void UnregisterListener(const std::shared_ptr< WifiPhyListener > &listener)
Definition: wifi-phy.cc:485
void NotifyTxDrop(Ptr< const WifiPsdu > psdu)
Public method used to fire a PhyTxDrop trace.
Definition: wifi-phy.cc:1604
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.