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
922 using ChannelTuple = std::tuple<uint8_t /* channel number */,
923 ChannelWidthMhz /* channel width */,
924 WifiPhyBand /* WifiPhyBand */,
925 uint8_t /* primary20 index*/>; //!< Tuple identifying a segment
926 //!< of an operating channel
927
929 std::vector<ChannelTuple>; //!< segments identifying an operating channel
930
931 /**
932 * If the standard for this object has not been set yet, store the channel settings
933 * corresponding to the given operating channel. Otherwise, check if a channel switch
934 * can be performed now. If not, schedule another call to this method when channel switch
935 * can be performed. Otherwise, set the given operating channel and call ConfigureStandard
936 * if the PHY band has changed.
937 *
938 * Note that, in case a Spectrum PHY is used, a spectrum channel covering the
939 * operating channel bandwidth must have been already added when actually setting
940 * the operating channel.
941 *
942 * \param channel the given operating channel
943 */
944 void SetOperatingChannel(const WifiPhyOperatingChannel& channel);
945
946 /**
947 * This overloaded function is used to pass a list of segments
948 * from which the operating channel can be deduced.
949 *
950 * \param channelSegments the segments identifying the operating channel
951 */
952 void SetOperatingChannel(const ChannelSegments& channelSegments);
953
954 /**
955 * This overloaded function is used when the operating channel
956 * consists of a single segment, identified by a tuple.
957 *
958 * \param tuple the segment identifying the operating channel
959 */
960 void SetOperatingChannel(const ChannelTuple& tuple);
961
962 /**
963 * Configure whether it is prohibited to change PHY band after initialization.
964 *
965 * \param enable true to prohibit changing PHY band after initialization,
966 * false otherwise
967 */
968 void SetFixedPhyBand(bool enable);
969 /**
970 * \return whether it is prohibited to change PHY band after initialization
971 */
972 bool HasFixedPhyBand() const;
973 /**
974 * \return the operating center frequency (MHz)
975 */
976 uint16_t GetFrequency() const;
977 /**
978 * \return the index of the primary 20 MHz channel
979 */
980 uint8_t GetPrimary20Index() const;
981 /**
982 * Get the bandwidth for a transmission occurring on the current operating channel and
983 * using the given WifiMode, subject to the constraint that the TX bandwidth cannot exceed
984 * the given maximum allowed value.
985 *
986 * \param mode the given WifiMode
987 * \param maxAllowedBandWidth the maximum allowed TX bandwidth
988 * \return the bandwidth for the transmission
989 */
991 WifiMode mode,
992 ChannelWidthMhz maxAllowedBandWidth = std::numeric_limits<ChannelWidthMhz>::max()) const;
993 /**
994 * \param antennas the number of antennas on this node.
995 */
996 void SetNumberOfAntennas(uint8_t antennas);
997 /**
998 * \return the number of antennas on this device
999 */
1000 uint8_t GetNumberOfAntennas() const;
1001 /**
1002 * \param streams the maximum number of supported TX spatial streams.
1003 */
1004 void SetMaxSupportedTxSpatialStreams(uint8_t streams);
1005 /**
1006 * \return the maximum number of supported TX spatial streams
1007 */
1008 uint8_t GetMaxSupportedTxSpatialStreams() const;
1009 /**
1010 * \param streams the maximum number of supported RX spatial streams.
1011 */
1012 void SetMaxSupportedRxSpatialStreams(uint8_t streams);
1013 /**
1014 * \return the maximum number of supported RX spatial streams
1015 */
1016 uint8_t GetMaxSupportedRxSpatialStreams() const;
1017 /**
1018 * Enable or disable short PHY preamble.
1019 *
1020 * \param preamble sets whether short PHY preamble is supported or not
1021 */
1022 void SetShortPhyPreambleSupported(bool preamble);
1023 /**
1024 * Return whether short PHY preamble is supported.
1025 *
1026 * \returns if short PHY preamble is supported or not
1027 */
1028 bool GetShortPhyPreambleSupported() const;
1029
1030 /**
1031 * Set the index allocated to this PHY
1032 *
1033 * \param phyId the ID allocated to this PHY
1034 */
1035 void SetPhyId(uint8_t phyId);
1036
1037 /**
1038 * Get the index allocated to this PHY
1039 *
1040 * \return the ID allocated to this PHY
1041 */
1042 uint8_t GetPhyId() const;
1043
1044 /**
1045 * Sets the interference helper.
1046 *
1047 * \param helper the interference helper
1048 */
1049 virtual void SetInterferenceHelper(const Ptr<InterferenceHelper> helper);
1050
1051 /**
1052 * Sets the error rate model.
1053 *
1054 * \param model the error rate model
1055 */
1056 void SetErrorRateModel(const Ptr<ErrorRateModel> model);
1057 /**
1058 * Attach a receive ErrorModel to the WifiPhy.
1059 *
1060 * The WifiPhy may optionally include an ErrorModel in
1061 * the packet receive chain. The error model is additive
1062 * to any modulation-based error model based on SNR, and
1063 * is typically used to force specific packet losses or
1064 * for testing purposes.
1065 *
1066 * \param em Pointer to the ErrorModel.
1067 */
1069 /**
1070 * Sets the frame capture model.
1071 *
1072 * \param frameCaptureModel the frame capture model
1073 */
1074 void SetFrameCaptureModel(const Ptr<FrameCaptureModel> frameCaptureModel);
1075 /**
1076 * Sets the preamble detection model.
1077 *
1078 * \param preambleDetectionModel the preamble detection model
1079 */
1080 void SetPreambleDetectionModel(const Ptr<PreambleDetectionModel> preambleDetectionModel);
1081 /**
1082 * Sets the wifi radio energy model.
1083 *
1084 * \param wifiRadioEnergyModel the wifi radio energy model
1085 */
1086 void SetWifiRadioEnergyModel(const Ptr<WifiRadioEnergyModel> wifiRadioEnergyModel);
1087
1088 /**
1089 * \return the channel width in MHz
1090 */
1092
1093 /**
1094 * Get the power of the given power level in dBm.
1095 * In SpectrumWifiPhy implementation, the power levels are equally spaced (in dBm).
1096 *
1097 * \param power the power level
1098 *
1099 * \return the transmission power in dBm at the given power level
1100 */
1101 double GetPowerDbm(uint8_t power) const;
1102
1103 /**
1104 * Reset PHY to IDLE, with some potential TX power restrictions for the next transmission.
1105 *
1106 * \param powerRestricted flag whether the transmit power is restricted for the next
1107 * transmission
1108 * \param txPowerMaxSiso the SISO transmit power restriction for the next transmission in dBm
1109 * \param txPowerMaxMimo the MIMO transmit power restriction for the next transmission in dBm
1110 */
1111 void ResetCca(bool powerRestricted, double txPowerMaxSiso = 0, double txPowerMaxMimo = 0);
1112 /**
1113 * Compute the transmit power for the next transmission.
1114 * The returned power will satisfy the power density constraints
1115 * after addition of antenna gain.
1116 *
1117 * \param ppdu the PPDU to transmit
1118 * \return the transmit power in dBm for the next transmission
1119 */
1121 /**
1122 * Notify the PHY that an access to the channel was requested.
1123 * This is typically called by the channel access manager to
1124 * to notify the PHY about an ongoing transmission.
1125 * The PHY will use this information to determine whether
1126 * it should use power restriction as imposed by OBSS_PD SR.
1127 */
1129
1130 /**
1131 * This is a helper function to convert start and stop indices to start and stop frequencies.
1132 *
1133 * \param indices the start/stop indices to convert
1134 * \return the converted frequencies
1135 */
1137 const WifiSpectrumBandIndices& indices) const = 0;
1138
1139 /**
1140 * Add the PHY entity to the map of __implemented__ PHY entities for the
1141 * given modulation class.
1142 * Through this method, child classes can add their own PHY entities in
1143 * a static manner.
1144 *
1145 * \param modulation the modulation class
1146 * \param phyEntity the PHY entity
1147 */
1148 static void AddStaticPhyEntity(WifiModulationClass modulation, Ptr<PhyEntity> phyEntity);
1149
1150 /**
1151 * Get the __implemented__ PHY entity corresponding to the modulation class.
1152 * This is used to compute the different amendment-specific parameters within
1153 * calling static methods.
1154 *
1155 * \param modulation the modulation class
1156 * \return the pointer to the static implemented PHY entity
1157 */
1159
1160 /**
1161 * Get the supported PHY entity to use for a received PPDU.
1162 * This typically returns the entity corresponding to the modulation class used to transmit the
1163 * PPDU. If the modulation class used to transmit the PPDU is not supported by the PHY, the
1164 * latest PHY entity corresponding to the configured standard is returned. If the modulation
1165 * used to transmit the PPDU is non-HT (duplicate), the latest PHY entity corresponding to the
1166 * configured standard is also returned.
1167 *
1168 * \param ppdu the received PPDU
1169 * \return the pointer to the supported PHY entity
1170 */
1172
1173 /**
1174 * Get the supported PHY entity corresponding to the modulation class.
1175 *
1176 * \param modulation the modulation class
1177 * \return the pointer to the supported PHY entity
1178 */
1180 /**
1181 * Get the supported PHY entity corresponding to the wifi standard.
1182 *
1183 * \param standard the wifi standard
1184 * \return the pointer to the supported PHY entity
1185 */
1187 /**
1188 * Get the latest PHY entity supported by this PHY instance.
1189 *
1190 * \return the latest PHY entity supported by this PHY instance
1191 */
1193
1194 /**
1195 * \return the UID of the previously received PPDU (reset to UINT64_MAX upon transmission)
1196 */
1197 uint64_t GetPreviouslyRxPpduUid() const;
1198
1199 /**
1200 * Set the UID of the previously received PPDU.
1201 *
1202 * \param uid the value for the UID of the previously received PPDU
1203 *
1204 * \note This method shall only be used in exceptional circumstances, such as when a PHY
1205 * transmits a response to a Trigger Frame that was received by another PHY. This is the
1206 * case, e.g., when an aux PHY of an EMLSR client receives an ICF but it is the main PHY
1207 * that switches channel and transmits the response to the ICF.
1208 */
1209 void SetPreviouslyRxPpduUid(uint64_t uid);
1210
1211 /**
1212 * \param currentChannelWidth channel width of the current transmission (MHz)
1213 * \return the width of the guard band (MHz)
1214 *
1215 * Note: in order to properly model out of band transmissions for OFDM, the guard
1216 * band has been configured so as to expand the modeled spectrum up to the
1217 * outermost referenced point in "Transmit spectrum mask" sections' PSDs of
1218 * each PHY specification of 802.11-2016 standard. It thus ultimately corresponds
1219 * to the current channel bandwidth (which can be different from devices max
1220 * channel width).
1221 *
1222 * This method is only relevant for SpectrumWifiPhy.
1223 */
1224 virtual ChannelWidthMhz GetGuardBandwidth(ChannelWidthMhz currentChannelWidth) const = 0;
1225 /**
1226 * \return a tuple containing the minimum rejection (in dBr) for the inner band,
1227 * the minimum rejection (in dBr) for the outer band, and
1228 * the maximum rejection (in dBr) for the outer band
1229 * for the transmit spectrum mask.
1230 *
1231 * This method is only relevant for SpectrumWifiPhy.
1232 */
1233 virtual std::tuple<double, double, double> GetTxMaskRejectionParams() const = 0;
1234
1235 /**
1236 * Get channel number of the primary channel
1237 * \param primaryChannelWidth the width of the primary channel (MHz)
1238 *
1239 * \return channel number of the primary channel
1240 */
1241 uint8_t GetPrimaryChannelNumber(ChannelWidthMhz primaryChannelWidth) const;
1242
1243 /**
1244 * Get the info of a given band
1245 *
1246 * \param bandWidth the width of the band to be returned (MHz)
1247 * \param bandIndex the index of the band to be returned
1248 *
1249 * \return the info that defines the band
1250 */
1251 virtual WifiSpectrumBandInfo GetBand(ChannelWidthMhz bandWidth, uint8_t bandIndex = 0) = 0;
1252
1253 /**
1254 * Get the frequency range of the current RF interface.
1255 *
1256 * \return the frequency range of the current RF interface
1257 */
1259
1260 /**
1261 * \return the subcarrier spacing corresponding to the configure standard (Hz)
1262 */
1264
1265 /**
1266 * Callback invoked when the PHY model starts to transmit a signal
1267 *
1268 * \param ppdu The PPDU being transmitted
1269 * \param txVector txVector used for transmitting the PPDU
1270 */
1272 const WifiTxVector& txVector);
1273
1274 protected:
1275 void DoInitialize() override;
1276 void DoDispose() override;
1277
1278 /**
1279 * Reset data upon end of TX or RX
1280 */
1281 void Reset();
1282
1283 /**
1284 * Perform any actions necessary when user changes operating channel after
1285 * initialization.
1286 *
1287 * \return the amount of time to wait until the channel switch can be performed or
1288 * std::nullopt if channel switch is currently not possible (i.e., the radio is in sleep mode)
1289 */
1290 std::optional<Time> GetDelayUntilChannelSwitch();
1291 /**
1292 * Actually switch channel based on the stored channel settings.
1293 */
1294 virtual void DoChannelSwitch();
1295
1296 /**
1297 * Check if PHY state should move to CCA busy state based on current
1298 * state of interference tracker.
1299 *
1300 * \param ppdu the incoming PPDU or nullptr for any signal
1301 */
1302 void SwitchMaybeToCcaBusy(const Ptr<const WifiPpdu> ppdu = nullptr);
1303 /**
1304 * Notify PHY state helper to switch to CCA busy state,
1305 *
1306 * \param ppdu the incoming PPDU or nullptr for any signal
1307 * \param duration the duration of the CCA state
1308 */
1309 void NotifyCcaBusy(const Ptr<const WifiPpdu> ppdu, Time duration);
1310
1311 /**
1312 * Add the PHY entity to the map of supported PHY entities for the
1313 * given modulation class for the WifiPhy instance.
1314 * This is a wrapper method used to check that the PHY entity is
1315 * in the static map of implemented PHY entities (\see GetStaticPhyEntities).
1316 * In addition, child classes can add their own PHY entities.
1317 *
1318 * \param modulation the modulation class
1319 * \param phyEntity the PHY entity
1320 */
1321 void AddPhyEntity(WifiModulationClass modulation, Ptr<PhyEntity> phyEntity);
1322
1323 uint8_t m_phyId; //!< the index of the PHY in the vector of PHYs held by the WifiNetDevice
1324
1326 m_interference; //!< Pointer to a helper responsible for interference computations
1327
1328 Ptr<UniformRandomVariable> m_random; //!< Provides uniform random variables.
1329 Ptr<WifiPhyStateHelper> m_state; //!< Pointer to WifiPhyStateHelper
1330
1331 uint32_t m_txMpduReferenceNumber; //!< A-MPDU reference number to identify all transmitted
1332 //!< subframes belonging to the same received A-MPDU
1333 uint32_t m_rxMpduReferenceNumber; //!< A-MPDU reference number to identify all received
1334 //!< subframes belonging to the same received A-MPDU
1335
1336 EventId m_endPhyRxEvent; //!< the end of PHY receive event
1337 EventId m_endTxEvent; //!< the end of transmit event
1338
1339 Ptr<Event> m_currentEvent; //!< Hold the current event
1340 std::map<std::pair<uint64_t /* UID*/, WifiPreamble>, Ptr<Event>>
1341 m_currentPreambleEvents; //!< store event associated to a PPDU (that has a unique ID and
1342 //!< preamble combination) whose preamble is being received
1343
1344 uint64_t m_previouslyRxPpduUid; //!< UID of the previously received PPDU, reset to UINT64_MAX
1345 //!< upon transmission
1346
1347 /**
1348 * This map holds the supported PHY entities.
1349 *
1350 * The set of parameters (e.g. mode) that this WifiPhy(-derived class) can
1351 * support can be obtained through it.
1352 *
1353 * When it comes to modes, in conversation we call this set
1354 * the DeviceRateSet (not a term you'll find in the standard), and
1355 * it is a superset of standard-defined parameters such as the
1356 * OperationalRateSet, and the BSSBasicRateSet (which, themselves,
1357 * have a superset/subset relationship).
1358 *
1359 * Mandatory rates relevant to this WifiPhy can be found by
1360 * iterating over the elements of this map, for each modulation class,
1361 * looking for WifiMode objects for which
1362 * WifiMode::IsMandatory() is true.
1363 */
1364 std::map<WifiModulationClass, Ptr<PhyEntity>> m_phyEntities;
1365
1367 m_signalTransmissionCb; //!< Signal Transmission callback
1368
1369 private:
1370 /**
1371 * Configure WifiPhy with appropriate channel frequency and
1372 * supported rates for 802.11a standard.
1373 */
1374 void Configure80211a();
1375 /**
1376 * Configure WifiPhy with appropriate channel frequency and
1377 * supported rates for 802.11b standard.
1378 */
1379 void Configure80211b();
1380 /**
1381 * Configure WifiPhy with appropriate channel frequency and
1382 * supported rates for 802.11g standard.
1383 */
1384 void Configure80211g();
1385 /**
1386 * Configure WifiPhy with appropriate channel frequency and
1387 * supported rates for 802.11p standard.
1388 */
1389 void Configure80211p();
1390 /**
1391 * Configure WifiPhy with appropriate channel frequency and
1392 * supported rates for 802.11n standard.
1393 */
1394 void Configure80211n();
1395 /**
1396 * Configure WifiPhy with appropriate channel frequency and
1397 * supported rates for 802.11ac standard.
1398 */
1399 void Configure80211ac();
1400 /**
1401 * Configure WifiPhy with appropriate channel frequency and
1402 * supported rates for 802.11ax standard.
1403 */
1404 void Configure80211ax();
1405 /**
1406 * Configure WifiPhy with appropriate channel frequency and
1407 * supported rates for 802.11be standard.
1408 */
1409 void Configure80211be();
1410 /**
1411 * Configure the device MCS set with the appropriate HtMcs modes for
1412 * the number of available transmit spatial streams
1413 */
1415 /**
1416 * Add the given MCS to the device MCS set.
1417 *
1418 * \param mode the MCS to add to the device MCS set
1419 */
1420 void PushMcs(WifiMode mode);
1421 /**
1422 * Rebuild the mapping of MCS values to indices in the device MCS set.
1423 */
1425
1426 /**
1427 * Due to newly arrived signal, the current reception cannot be continued and has to be aborted
1428 * \param reason the reason the reception is aborted
1429 *
1430 */
1432
1433 /**
1434 * Callback function when a transmission is completed
1435 * \param psdus the PSDUs that have been sent
1436 */
1437 void TxDone(const WifiConstPsduMap& psdus);
1438
1439 /**
1440 * Get the PSDU addressed to that PHY in a PPDU (useful for MU PPDU).
1441 *
1442 * \param ppdu the PPDU to extract the PSDU from
1443 * \return the PSDU addressed to that PHY
1444 */
1446
1447 /**
1448 * The trace source fired when a packet begins the transmission process on
1449 * the medium.
1450 *
1451 * \see class CallBackTraceSource
1452 */
1454 /**
1455 * The trace source fired when a PSDU map begins the transmission process on
1456 * the medium.
1457 *
1458 * \see class CallBackTraceSource
1459 */
1461
1462 /**
1463 * The trace source fired when a packet ends the transmission process on
1464 * the medium.
1465 *
1466 * \see class CallBackTraceSource
1467 */
1469
1470 /**
1471 * The trace source fired when the PHY layer drops a packet as it tries
1472 * to transmit it.
1473 *
1474 * \see class CallBackTraceSource
1475 */
1477
1478 /**
1479 * The trace source fired when a packet begins the reception process from
1480 * the medium.
1481 *
1482 * \see class CallBackTraceSource
1483 */
1485
1486 /**
1487 * The trace source fired when the reception of the PHY payload (PSDU) begins.
1488 *
1489 * This traced callback models the behavior of the PHY-RXSTART
1490 * primitive which is launched upon correct decoding of
1491 * the PHY header and support of modes within.
1492 * We thus assume that it is sent just before starting
1493 * the decoding of the payload, since it's there that
1494 * support of the header's content is checked. In addition,
1495 * it's also at that point that the correct decoding of
1496 * HT-SIG, VHT-SIGs, and HE-SIGs are checked.
1497 *
1498 * \see class CallBackTraceSource
1499 */
1501
1502 /**
1503 * The trace source fired when a packet ends the reception process from
1504 * the medium.
1505 *
1506 * \see class CallBackTraceSource
1507 */
1509
1510 /**
1511 * The trace source fired when the PHY layer drops a packet it has received.
1512 *
1513 * \see class CallBackTraceSource
1514 */
1516
1517 /**
1518 * The trace source fired when the PHY layer drops a packet it has received.
1519 */
1521
1522 /**
1523 * A trace source that emulates a Wi-Fi device in monitor mode
1524 * sniffing a packet being received.
1525 *
1526 * As a reference with the real world, firing this trace
1527 * corresponds in the madwifi driver to calling the function
1528 * ieee80211_input_monitor()
1529 *
1530 * \see class CallBackTraceSource
1531 * \todo WifiTxVector and signalNoiseDbm should be passed as
1532 * const references because of their sizes.
1533 */
1535 uint16_t /* frequency (MHz) */,
1537 MpduInfo,
1539 uint16_t /* STA-ID*/>
1541
1542 /**
1543 * A trace source that emulates a Wi-Fi device in monitor mode
1544 * sniffing a packet being transmitted.
1545 *
1546 * As a reference with the real world, firing this trace
1547 * corresponds in the madwifi driver to calling the function
1548 * ieee80211_input_monitor()
1549 *
1550 * \see class CallBackTraceSource
1551 * \todo WifiTxVector should be passed by const reference because
1552 * of its size.
1553 */
1555 uint16_t /* frequency (MHz) */,
1557 MpduInfo,
1558 uint16_t /* STA-ID*/>
1560
1561 /**
1562 * \return the map of __implemented__ PHY entities.
1563 * This is used to compute the different
1564 * amendment-specific parameters in a static manner.
1565 * For PHY entities supported by a given WifiPhy instance,
1566 * \see m_phyEntities.
1567 */
1568 static std::map<WifiModulationClass, Ptr<PhyEntity>>& GetStaticPhyEntities();
1569
1570 WifiStandard m_standard; //!< WifiStandard
1571 WifiModulationClass m_maxModClassSupported; //!< max modulation class supported
1572 WifiPhyBand m_band; //!< WifiPhyBand
1573 ChannelSegments m_channelSettings; //!< Store operating channel settings until initialization
1575 bool m_fixedPhyBand; //!< True to prohibit changing PHY band after initialization
1576
1577 Time m_sifs; //!< Short Interframe Space (SIFS) duration
1578 Time m_slot; //!< Slot duration
1579 Time m_pifs; //!< PCF Interframe Space (PIFS) duration
1580 Time m_ackTxTime; //!< estimated Ack TX time
1581 Time m_blockAckTxTime; //!< estimated BlockAck TX time
1582
1583 double m_rxSensitivityDbm; //!< Receive sensitivity threshold in dBm
1584 double m_ccaEdThresholdW; //!< Clear channel assessment (CCA) energy detection (ED) threshold in
1585 //!< watts
1586 double m_ccaSensitivityThresholdW; //!< Clear channel assessment (CCA) modulation and coding
1587 //!< rate sensitivity threshold in watts
1588
1589 double m_txGainDb; //!< Transmission gain (dB)
1590 double m_rxGainDb; //!< Reception gain (dB)
1591 double m_txPowerBaseDbm; //!< Minimum transmission power (dBm)
1592 double m_txPowerEndDbm; //!< Maximum transmission power (dBm)
1593 uint8_t m_nTxPower; //!< Number of available transmission power levels
1594 double m_powerDensityLimit; //!< the power density limit (dBm/MHz)
1595
1596 bool m_powerRestricted; //!< Flag whether transmit power is restricted by OBSS PD SR
1597 double
1598 m_txPowerMaxSiso; //!< SISO maximum transmit power due to OBSS PD SR power restriction (dBm)
1599 double
1600 m_txPowerMaxMimo; //!< MIMO maximum transmit power due to OBSS PD SR power restriction (dBm)
1601 bool m_channelAccessRequested; //!< Flag if channels access has been requested (used for OBSS_PD
1602 //!< SR)
1603
1604 bool m_shortPreamble; //!< Flag if short PHY preamble is supported
1605 uint8_t m_numberOfAntennas; //!< Number of transmitters
1606 uint8_t m_txSpatialStreams; //!< Number of supported TX spatial streams
1607 uint8_t m_rxSpatialStreams; //!< Number of supported RX spatial streams
1608
1609 double m_noiseFigureDb; //!< The noise figure in dB
1610
1611 Time m_channelSwitchDelay; //!< Time required to switch between channel
1612
1613 Ptr<WifiNetDevice> m_device; //!< Pointer to the device
1614 Ptr<MobilityModel> m_mobility; //!< Pointer to the mobility model
1615
1619 Ptr<ErrorModel> m_postReceptionErrorModel; //!< Error model for receive packet events
1620 Time m_timeLastPreambleDetected; //!< Record the time the last preamble was detected
1621
1622 Callback<void> m_capabilitiesChangedCallback; //!< Callback when PHY capabilities changed
1623};
1624
1625/**
1626 * \param os output stream
1627 * \param rxSignalInfo received signal info to stringify
1628 * \return output stream
1629 */
1630std::ostream& operator<<(std::ostream& os, RxSignalInfo rxSignalInfo);
1631
1632} // namespace ns3
1633
1634#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:75
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:70
void SetNumberOfAntennas(uint8_t antennas)
Definition: wifi-phy.cc:1307
Ptr< WifiPhyStateHelper > m_state
Pointer to WifiPhyStateHelper.
Definition: wifi-phy.h:1329
Time GetBlockAckTxTime() const
Return the estimated BlockAck TX time for this PHY.
Definition: wifi-phy.cc:853
double GetCcaEdThreshold() const
Return the CCA energy detection threshold (dBm).
Definition: wifi-phy.cc:521
double m_rxGainDb
Reception gain (dB)
Definition: wifi-phy.h:1590
bool IsStateTx() const
Definition: wifi-phy.cc:2144
Ptr< MobilityModel > m_mobility
Pointer to the mobility model.
Definition: wifi-phy.h:1614
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:991
bool IsStateIdle() const
Definition: wifi-phy.cc:2132
virtual void SetInterferenceHelper(const Ptr< InterferenceHelper > helper)
Sets the interference helper.
Definition: wifi-phy.cc:666
uint8_t m_txSpatialStreams
Number of supported TX spatial streams.
Definition: wifi-phy.h:1606
bool IsStateCcaBusy() const
Definition: wifi-phy.cc:2126
ChannelWidthMhz GetChannelWidth() const
Definition: wifi-phy.cc:1087
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:1777
Ptr< UniformRandomVariable > m_random
Provides uniform random variables.
Definition: wifi-phy.h:1328
Ptr< WifiRadioEnergyModel > m_wifiRadioEnergyModel
Wifi radio energy model.
Definition: wifi-phy.h:1618
void Configure80211ax()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11ax standard.
Definition: wifi-phy.cc:961
Time m_channelSwitchDelay
Time required to switch between channel.
Definition: wifi-phy.h:1611
void SetCcaEdThreshold(double threshold)
Sets the CCA energy detection threshold (dBm).
Definition: wifi-phy.cc:514
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:2193
WifiPhyOperatingChannel m_operatingChannel
Operating channel.
Definition: wifi-phy.h:1574
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:1476
void SetErrorRateModel(const Ptr< ErrorRateModel > model)
Sets the error rate model.
Definition: wifi-phy.cc:675
bool m_channelAccessRequested
Flag if channels access has been requested (used for OBSS_PD SR)
Definition: wifi-phy.h:1601
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:1510
Time GetSlot() const
Return the slot duration for this PHY.
Definition: wifi-phy.cc:829
uint32_t GetSubcarrierSpacing() const
Definition: wifi-phy.cc:2340
void SetMaxSupportedRxSpatialStreams(uint8_t streams)
Definition: wifi-phy.cc:1357
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:2309
ChannelWidthMhz GetTxBandwidth(WifiMode mode, ChannelWidthMhz maxAllowedBandWidth=std::numeric_limits< ChannelWidthMhz >::max()) const
Get the bandwidth for a transmission occurring on the current operating channel and using the given W...
Definition: wifi-phy.cc:1111
void Configure80211g()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11g standard.
Definition: wifi-phy.cc:891
uint8_t GetPrimary20Index() const
Definition: wifi-phy.cc:1093
void NotifyTxEnd(WifiConstPsduMap psdus)
Public method used to fire a PhyTxEnd trace.
Definition: wifi-phy.cc:1607
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:1341
uint8_t GetNumberOfAntennas() const
Definition: wifi-phy.cc:1319
Time m_slot
Slot duration.
Definition: wifi-phy.h:1578
double m_powerDensityLimit
the power density limit (dBm/MHz)
Definition: wifi-phy.h:1594
Time GetDelayUntilIdle()
Definition: wifi-phy.cc:2168
double GetRxSensitivity() const
Return the receive sensitivity threshold (dBm).
Definition: wifi-phy.cc:508
bool GetShortPhyPreambleSupported() const
Return whether short PHY preamble is supported.
Definition: wifi-phy.cc:623
void SetSifs(Time sifs)
Set the Short Interframe Space (SIFS) for this PHY.
Definition: wifi-phy.cc:811
std::list< uint8_t > GetBssMembershipSelectorList() const
The WifiPhy::BssMembershipSelector() method is used (e.g., by a WifiRemoteStationManager) to determin...
Definition: wifi-phy.cc:1375
void Configure80211n()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11n standard.
Definition: wifi-phy.cc:934
EventId m_endPhyRxEvent
the end of PHY receive event
Definition: wifi-phy.h:1336
double GetTxGain() const
Return the transmission gain (dB).
Definition: wifi-phy.cc:597
double m_txPowerBaseDbm
Minimum transmission power (dBm)
Definition: wifi-phy.h:1591
void Configure80211be()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11be standard.
Definition: wifi-phy.cc:976
void NotifyRxDrop(Ptr< const WifiPsdu > psdu, WifiPhyRxfailureReason reason)
Public method used to fire a PhyRxDrop trace.
Definition: wifi-phy.cc:1658
bool IsStateRx() const
Definition: wifi-phy.cc:2138
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:2024
Time GetSifs() const
Return the Short Interframe Space (SIFS) for this PHY.
Definition: wifi-phy.cc:817
uint16_t GetFrequency() const
Definition: wifi-phy.cc:1075
Ptr< MobilityModel > GetMobility() const
Return the mobility model this PHY is associated with.
Definition: wifi-phy.cc:647
uint16_t GetNMcs() const
Definition: wifi-phy.cc:2070
Time m_blockAckTxTime
estimated BlockAck TX time
Definition: wifi-phy.h:1581
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:2250
double m_txPowerMaxMimo
MIMO maximum transmit power due to OBSS PD SR power restriction (dBm)
Definition: wifi-phy.h:1600
void ResumeFromSleep()
Resume from sleep mode.
Definition: wifi-phy.cc:1443
static Time GetPreambleDetectionDuration()
Definition: wifi-phy.cc:1498
void Configure80211p()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11p standard.
Definition: wifi-phy.cc:904
void AbortCurrentReception(WifiPhyRxfailureReason reason)
Due to newly arrived signal, the current reception cannot be continued and has to be aborted.
Definition: wifi-phy.cc:2200
uint8_t GetPrimaryChannelNumber(ChannelWidthMhz primaryChannelWidth) const
Get channel number of the primary channel.
Definition: wifi-phy.cc:2334
Ptr< FrameCaptureModel > m_frameCaptureModel
Frame capture model.
Definition: wifi-phy.h:1616
TracedCallback< Ptr< const Packet > > m_phyRxEndTrace
The trace source fired when a packet ends the reception process from the medium.
Definition: wifi-phy.h:1508
void NotifyRxBegin(Ptr< const WifiPsdu > psdu, const RxPowerWattPerChannelBand &rxPowersW)
Public method used to fire a PhyRxBegin trace.
Definition: wifi-phy.cc:1634
Time GetChannelSwitchDelay() const
Definition: wifi-phy.cc:727
void SetMaxSupportedTxSpatialStreams(uint8_t streams)
Definition: wifi-phy.cc:1325
Time m_sifs
Short Interframe Space (SIFS) duration.
Definition: wifi-phy.h:1577
void SetReceiveErrorCallback(RxErrorCallback callback)
Definition: wifi-phy.cc:477
TracedCallback< Ptr< const WifiPpdu >, const WifiTxVector & > m_signalTransmissionCb
Signal Transmission callback.
Definition: wifi-phy.h:1367
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:2162
uint8_t GetMaxSupportedRxSpatialStreams() const
Definition: wifi-phy.cc:1369
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:571
virtual void ConfigureStandard(WifiStandard standard)
Configure the PHY-level parameters for different Wi-Fi standard.
Definition: wifi-phy.cc:997
void SetPostReceptionErrorModel(const Ptr< ErrorModel > em)
Attach a receive ErrorModel to the WifiPhy.
Definition: wifi-phy.cc:683
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:2119
void PushMcs(WifiMode mode)
Add the given MCS to the device MCS set.
uint8_t m_numberOfAntennas
Number of transmitters.
Definition: wifi-phy.h:1605
uint32_t m_txMpduReferenceNumber
A-MPDU reference number to identify all transmitted subframes belonging to the same received A-MPDU.
Definition: wifi-phy.h:1331
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:1520
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
Definition: wifi-phy.cc:1557
static uint32_t GetMaxPsduSize(WifiModulationClass modulation)
Get the maximum PSDU size in bytes for the given modulation class.
Definition: wifi-phy.cc:1586
Ptr< WifiPhyStateHelper > GetState() const
Return the WifiPhyStateHelper of this PHY.
Definition: wifi-phy.cc:465
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:1592
void EndReceiveInterBss()
For HE receptions only, check and possibly modify the transmit power restriction state at the end of ...
Definition: wifi-phy.cc:1978
void SetSleepMode()
Put in sleep mode.
Definition: wifi-phy.cc:1390
void SetShortPhyPreambleSupported(bool preamble)
Enable or disable short PHY preamble.
Definition: wifi-phy.cc:616
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:577
WifiPhyBand m_band
WifiPhyBand.
Definition: wifi-phy.h:1572
void SetRxSensitivity(double threshold)
Sets the receive sensitivity threshold (dBm).
Definition: wifi-phy.cc:501
static const Ptr< const PhyEntity > GetStaticPhyEntity(WifiModulationClass modulation)
Get the implemented PHY entity corresponding to the modulation class.
Definition: wifi-phy.cc:739
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:1559
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:1598
std::map< WifiModulationClass, Ptr< PhyEntity > > m_phyEntities
This map holds the supported PHY entities.
Definition: wifi-phy.h:1364
void NotifyRxPpduDrop(Ptr< const WifiPpdu > ppdu, WifiPhyRxfailureReason reason)
Public method used to fire a PhyRxPpduDrop trace.
Definition: wifi-phy.cc:1670
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:984
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:798
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:1540
Ptr< ErrorModel > m_postReceptionErrorModel
Error model for receive packet events.
Definition: wifi-phy.h:1619
EventId m_endTxEvent
the end of transmit event
Definition: wifi-phy.h:1337
double GetRxGain() const
Return the reception gain (dB).
Definition: wifi-phy.cc:610
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:1771
double m_rxSensitivityDbm
Receive sensitivity threshold in dBm.
Definition: wifi-phy.h:1583
std::vector< ChannelTuple > ChannelSegments
segments identifying an operating channel
Definition: wifi-phy.h:929
void RegisterListener(const std::shared_ptr< WifiPhyListener > &listener)
Definition: wifi-phy.cc:483
static std::map< WifiModulationClass, Ptr< PhyEntity > > & GetStaticPhyEntities()
Definition: wifi-phy.cc:458
void SetSlot(Time slot)
Set the slot duration for this PHY.
Definition: wifi-phy.cc:823
WifiPhyBand GetPhyBand() const
Get the configured Wi-Fi band.
Definition: wifi-phy.cc:1057
void SetPreviouslyRxPpduUid(uint64_t uid)
Set the UID of the previously received PPDU.
Definition: wifi-phy.cc:1918
bool IsReceivingPhyHeader() const
Definition: wifi-phy.cc:1972
double m_ccaSensitivityThresholdW
Clear channel assessment (CCA) modulation and coding rate sensitivity threshold in watts.
Definition: wifi-phy.h:1586
Ptr< Event > m_currentEvent
Hold the current event.
Definition: wifi-phy.h:1339
Time GetLastRxStartTime() const
Return the start time of the last received packet.
Definition: wifi-phy.cc:2174
WifiMode GetDefaultMode() const
Get the default WifiMode supported by the PHY.
Definition: wifi-phy.cc:2008
void SetCcaSensitivityThreshold(double threshold)
Sets the CCA sensitivity threshold (dBm).
Definition: wifi-phy.cc:527
double m_ccaEdThresholdW
Clear channel assessment (CCA) energy detection (ED) threshold in watts.
Definition: wifi-phy.h:1584
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:1731
Ptr< PhyEntity > GetPhyEntity(WifiModulationClass modulation) const
Get the supported PHY entity corresponding to the modulation class.
Definition: wifi-phy.cc:748
uint8_t GetChannelNumber() const
Return current channel number.
Definition: wifi-phy.cc:1081
TracedCallback< Ptr< const Packet > > m_phyTxEndTrace
The trace source fired when a packet ends the transmission process on the medium.
Definition: wifi-phy.h:1468
uint64_t m_previouslyRxPpduUid
UID of the previously received PPDU, reset to UINT64_MAX upon transmission.
Definition: wifi-phy.h:1344
std::optional< Time > GetDelayUntilChannelSwitch()
Perform any actions necessary when user changes operating channel after initialization.
Definition: wifi-phy.cc:1183
uint32_t m_rxMpduReferenceNumber
A-MPDU reference number to identify all received subframes belonging to the same received A-MPDU.
Definition: wifi-phy.h:1333
void SetWifiRadioEnergyModel(const Ptr< WifiRadioEnergyModel > wifiRadioEnergyModel)
Sets the wifi radio energy model.
Definition: wifi-phy.cc:702
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:1453
virtual void SetDevice(const Ptr< WifiNetDevice > device)
Sets the device this PHY is associated with.
Definition: wifi-phy.cc:629
Ptr< PreambleDetectionModel > m_preambleDetectionModel
Preamble detection model.
Definition: wifi-phy.h:1617
void SetTxPowerEnd(double end)
Sets the maximum available transmission power level (dBm).
Definition: wifi-phy.cc:564
Time GetPifs() const
Return the PCF Interframe Space (PIFS) for this PHY.
Definition: wifi-phy.cc:841
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:789
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:1646
void StartReceivePreamble(Ptr< const WifiPpdu > ppdu, RxPowerWattPerChannelBand &rxPowersW, Time rxDuration)
Start receiving the PHY preamble of a PPDU (i.e.
Definition: wifi-phy.cc:1949
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:1460
double m_txGainDb
Transmission gain (dB)
Definition: wifi-phy.h:1589
bool IsStateSleep() const
Definition: wifi-phy.cc:2156
void SetOperatingChannel(const WifiPhyOperatingChannel &channel)
If the standard for this object has not been set yet, store the channel settings corresponding to the...
Definition: wifi-phy.cc:1123
Ptr< WifiNetDevice > GetDevice() const
Return the device this PHY is associated with.
Definition: wifi-phy.cc:635
WifiStandard m_standard
WifiStandard.
Definition: wifi-phy.h:1570
std::tuple< uint8_t, ChannelWidthMhz, WifiPhyBand, uint8_t > ChannelTuple
Tuple identifying a segment of an operating channel.
Definition: wifi-phy.h:926
double GetPowerDbm(uint8_t power) const
Get the power of the given power level in dBm.
Definition: wifi-phy.cc:708
uint8_t m_nTxPower
Number of available transmission power levels.
Definition: wifi-phy.h:1593
void DoDispose() override
Destructor implementation.
Definition: wifi-phy.cc:429
bool IsStateSwitching() const
Definition: wifi-phy.cc:2150
void SetPhyId(uint8_t phyId)
Set the index allocated to this PHY.
Definition: wifi-phy.cc:653
virtual void DoChannelSwitch()
Actually switch channel based on the stored channel settings.
Definition: wifi-phy.cc:1222
void SetOffMode()
Put in off mode.
Definition: wifi-phy.cc:1433
double m_noiseFigureDb
The noise figure in dB.
Definition: wifi-phy.h:1609
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:1515
void SetPreambleDetectionModel(const Ptr< PreambleDetectionModel > preambleDetectionModel)
Sets the preamble detection model.
Definition: wifi-phy.cc:696
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:1323
void SetPifs(Time pifs)
Set the PCF Interframe Space (PIFS) for this PHY.
Definition: wifi-phy.cc:835
void Configure80211b()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11b standard.
Definition: wifi-phy.cc:874
void(* SignalTransmissionCallback)(Ptr< const WifiPpdu > ppdu, const WifiTxVector &txVector)
Callback invoked when the PHY model starts to transmit a signal.
Definition: wifi-phy.h:1271
static Time GetStartOfPacketDuration(const WifiTxVector &txVector)
Definition: wifi-phy.cc:1504
virtual FrequencyRange GetCurrentFrequencyRange() const =0
Get the frequency range of the current RF interface.
void SetRxGain(double gain)
Sets the reception gain (dB).
Definition: wifi-phy.cc:603
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:2186
void SetMobility(const Ptr< MobilityModel > mobility)
assign a mobility model to this device
Definition: wifi-phy.cc:641
void SetTxGain(double gain)
Sets the transmission gain (dB).
Definition: wifi-phy.cc:590
uint8_t m_rxSpatialStreams
Number of supported RX spatial streams.
Definition: wifi-phy.h:1607
double m_txPowerEndDbm
Maximum transmission power (dBm)
Definition: wifi-phy.h:1592
double CalculateSnr(const WifiTxVector &txVector, double ber) const
Definition: wifi-phy.cc:733
void SetFixedPhyBand(bool enable)
Configure whether it is prohibited to change PHY band after initialization.
Definition: wifi-phy.cc:1099
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:398
void Configure80211ac()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11ac standard.
Definition: wifi-phy.cc:953
bool HasFixedPhyBand() const
Definition: wifi-phy.cc:1105
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:1484
Ptr< WifiNetDevice > m_device
Pointer to the device.
Definition: wifi-phy.h:1613
Ptr< InterferenceHelper > m_interference
Pointer to a helper responsible for interference computations.
Definition: wifi-phy.h:1326
void DoInitialize() override
Initialize() implementation.
Definition: wifi-phy.cc:404
virtual ChannelWidthMhz GetGuardBandwidth(ChannelWidthMhz currentChannelWidth) const =0
bool m_shortPreamble
Flag if short PHY preamble is supported.
Definition: wifi-phy.h:1604
uint8_t GetPhyId() const
Get the index allocated to this PHY.
Definition: wifi-phy.cc:660
Time m_pifs
PCF Interframe Space (PIFS) duration.
Definition: wifi-phy.h:1579
WifiModulationClass m_maxModClassSupported
max modulation class supported
Definition: wifi-phy.h:1571
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:540
double GetTxPowerStart() const
Return the minimum available transmission power level (dBm).
Definition: wifi-phy.cc:558
double GetTxPowerForTransmission(Ptr< const WifiPpdu > ppdu) const
Compute the transmit power for the next transmission.
Definition: wifi-phy.cc:2273
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:1063
void SetCapabilitiesChangedCallback(Callback< void > callback)
Definition: wifi-phy.cc:495
void SetReceiveOkCallback(RxOkCallback callback)
Definition: wifi-phy.cc:471
void SetFrameCaptureModel(const Ptr< FrameCaptureModel > frameCaptureModel)
Sets the frame capture model.
Definition: wifi-phy.cc:690
void NotifyChannelAccessRequested()
Notify the PHY that an access to the channel was requested.
Definition: wifi-phy.cc:1988
void ResumeFromOff()
Resume from off mode.
Definition: wifi-phy.cc:1470
bool m_powerRestricted
Flag whether transmit power is restricted by OBSS PD SR.
Definition: wifi-phy.h:1596
virtual std::tuple< double, double, double > GetTxMaskRejectionParams() const =0
Callback< void > m_capabilitiesChangedCallback
Callback when PHY capabilities changed.
Definition: wifi-phy.h:1622
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:1677
Ptr< PhyEntity > GetPhyEntityForPpdu(const Ptr< const WifiPpdu > ppdu) const
Get the supported PHY entity to use for a received PPDU.
Definition: wifi-phy.cc:769
Time GetAckTxTime() const
Return the estimated Ack TX time for this PHY.
Definition: wifi-phy.cc:847
uint64_t GetPreviouslyRxPpduUid() const
Definition: wifi-phy.cc:1912
void Reset()
Reset data upon end of TX or RX.
Definition: wifi-phy.cc:1925
TracedCallback< WifiTxVector, Time > m_phyRxPayloadBeginTrace
The trace source fired when the reception of the PHY payload (PSDU) begins.
Definition: wifi-phy.h:1500
Time GetLastRxEndTime() const
Return the end time of the last received packet.
Definition: wifi-phy.cc:2180
Time m_timeLastPreambleDetected
Record the time the last preamble was detected.
Definition: wifi-phy.h:1620
virtual WifiSpectrumBandInfo GetBand(ChannelWidthMhz bandWidth, uint8_t bandIndex=0)=0
Get the info of a given band.
uint8_t GetMaxSupportedTxSpatialStreams() const
Definition: wifi-phy.cc:1351
void Configure80211a()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11a standard.
Definition: wifi-phy.cc:859
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:2084
std::list< WifiMode > GetModeList() const
The WifiPhy::GetModeList() method is used (e.g., by a WifiRemoteStationManager) to determine the set ...
Definition: wifi-phy.cc:2035
ChannelSegments m_channelSettings
Store operating channel settings until initialization.
Definition: wifi-phy.h:1573
void TxDone(const WifiConstPsduMap &psdus)
Callback function when a transmission is completed.
Definition: wifi-phy.cc:1902
const WifiPhyOperatingChannel & GetOperatingChannel() const
Get a const reference to the operating channel.
Definition: wifi-phy.cc:1069
double GetCcaSensitivityThreshold() const
Return the CCA sensitivity threshold (dBm).
Definition: wifi-phy.cc:534
bool m_fixedPhyBand
True to prohibit changing PHY band after initialization.
Definition: wifi-phy.h:1575
Ptr< PhyEntity > GetLatestPhyEntity() const
Get the latest PHY entity supported by this PHY instance.
Definition: wifi-phy.cc:763
void SetTxPowerStart(double start)
Sets the minimum available transmission power level (dBm).
Definition: wifi-phy.cc:551
uint8_t GetNTxPower() const
Return the number of available transmission power levels.
Definition: wifi-phy.cc:584
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:2316
static Time CalculatePhyPreambleAndHeaderDuration(const WifiTxVector &txVector)
Definition: wifi-phy.cc:1550
bool IsModeSupported(WifiMode mode) const
Check if the given WifiMode is supported by the PHY.
Definition: wifi-phy.cc:1995
Time m_ackTxTime
estimated Ack TX time
Definition: wifi-phy.h:1580
void UnregisterListener(const std::shared_ptr< WifiPhyListener > &listener)
Definition: wifi-phy.cc:489
void NotifyTxDrop(Ptr< const WifiPsdu > psdu)
Public method used to fire a PhyTxDrop trace.
Definition: wifi-phy.cc:1622
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.
Definition: wifi-types.h:54
@ NORMAL_MPDU
The MPDU is not part of an A-MPDU.
Definition: wifi-types.h:56
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
uint16_t ChannelWidthMhz
channel width expressed in MHz
Definition: wifi-types.h:28
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:56
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: wifi-types.h:78
RxSignalInfo structure containing info on the received signal.
Definition: wifi-types.h:85
SignalNoiseDbm structure.
Definition: wifi-types.h:71
WifiSpectrumBandInfo structure containing info about a spectrum band.