A Discrete-Event Network Simulator
API
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"
26 #include "wifi-phy-state-helper.h"
27 #include "wifi-standards.h"
28 
29 #include "ns3/error-model.h"
30 
31 #include <limits>
32 
33 namespace ns3
34 {
35 
36 class Channel;
37 class WifiNetDevice;
38 class MobilityModel;
39 class WifiPhyStateHelper;
40 class FrameCaptureModel;
41 class PreambleDetectionModel;
42 class WifiRadioEnergyModel;
43 class UniformRandomVariable;
44 class InterferenceHelper;
45 class ErrorRateModel;
46 
52 class WifiPhy : public Object
53 {
54  public:
55  friend class PhyEntity;
60  static TypeId GetTypeId();
61 
62  WifiPhy();
63  ~WifiPhy() override;
64 
71 
76  void SetReceiveOkCallback(RxOkCallback callback);
82 
89  void RegisterListener(const std::shared_ptr<WifiPhyListener>& listener);
96  void UnregisterListener(const std::shared_ptr<WifiPhyListener>& listener);
97 
102 
111  RxPowerWattPerChannelBand& rxPowersW,
112  Time rxDuration);
113 
117  bool IsReceivingPhyHeader() const;
118 
123  void EndReceiveInterBss();
124 
135  const WifiTxVector& txVector);
136 
149  void Send(Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector);
157  void Send(WifiConstPsduMap psdus, const WifiTxVector& txVector);
158 
162  virtual void StartTx(Ptr<const WifiPpdu> ppdu) = 0;
163 
167  void SetSleepMode();
171  void ResumeFromSleep();
175  void SetOffMode();
179  void ResumeFromOff();
180 
184  bool IsStateIdle() const;
188  bool IsStateCcaBusy() const;
192  bool IsStateRx() const;
196  bool IsStateTx() const;
200  bool IsStateSwitching() const;
204  bool IsStateSleep() const;
208  bool IsStateOff() const;
209 
217 
223  Time GetLastRxStartTime() const;
229  Time GetLastRxEndTime() const;
230 
239  static Time CalculateTxDuration(uint32_t size,
240  const WifiTxVector& txVector,
241  WifiPhyBand band,
242  uint16_t staId = SU_STA_ID);
258  const WifiTxVector& txVector,
259  WifiPhyBand band);
268  const WifiTxVector& txVector,
269  WifiPhyBand band);
270 
292  static Time GetPayloadDuration(uint32_t size,
293  const WifiTxVector& txVector,
294  WifiPhyBand band,
295  MpduType mpdutype = NORMAL_MPDU,
296  uint16_t staId = SU_STA_ID);
314  static Time GetPayloadDuration(uint32_t size,
315  const WifiTxVector& txVector,
316  WifiPhyBand band,
317  MpduType mpdutype,
318  bool incFlag,
319  uint32_t& totalAmpduSize,
320  double& totalAmpduNumSymbols,
321  uint16_t staId);
327  static Time GetStartOfPacketDuration(const WifiTxVector& txVector);
328 
343  std::list<WifiMode> GetModeList() const;
353  std::list<WifiMode> GetModeList(WifiModulationClass modulation) const;
362  bool IsModeSupported(WifiMode mode) const;
370  WifiMode GetDefaultMode() const;
380  bool IsMcsSupported(WifiModulationClass modulation, uint8_t mcs) const;
381 
389  double CalculateSnr(const WifiTxVector& txVector, double ber) const;
390 
396  void SetSifs(Time sifs);
402  Time GetSifs() const;
408  void SetSlot(Time slot);
414  Time GetSlot() const;
420  void SetPifs(Time pifs);
426  Time GetPifs() const;
432  Time GetAckTxTime() const;
438  Time GetBlockAckTxTime() const;
439 
446  static uint32_t GetMaxPsduSize(WifiModulationClass modulation);
447 
458  std::list<uint8_t> GetBssMembershipSelectorList() const;
464  uint16_t GetNMcs() const;
473  std::list<WifiMode> GetMcsList() const;
483  std::list<WifiMode> GetMcsList(WifiModulationClass modulation) const;
494  WifiMode GetMcs(WifiModulationClass modulation, uint8_t mcs) const;
495 
501  uint8_t GetChannelNumber() const;
505  Time GetChannelSwitchDelay() const;
506 
514  virtual void ConfigureStandard(WifiStandard standard);
515 
524 
529 
535  WifiStandard GetStandard() const;
536 
542  WifiPhyBand GetPhyBand() const;
543 
550 
556  virtual Ptr<Channel> GetChannel() const = 0;
557 
565  void NotifyTxBegin(WifiConstPsduMap psdus, double txPowerW);
572  void NotifyTxEnd(WifiConstPsduMap psdus);
587  void NotifyRxBegin(Ptr<const WifiPsdu> psdu, const RxPowerWattPerChannelBand& rxPowersW);
594  void NotifyRxEnd(Ptr<const WifiPsdu> psdu);
603 
626  uint16_t channelFreqMhz,
627  WifiTxVector txVector,
628  SignalNoiseDbm signalNoise,
629  std::vector<bool> statusPerMpdu,
630  uint16_t staId = SU_STA_ID);
631 
654  uint16_t channelFreqMhz,
655  WifiTxVector txVector,
656  MpduInfo aMpdu,
657  SignalNoiseDbm signalNoise,
658  uint16_t staId);
659 
674  uint16_t channelFreqMhz,
675  WifiTxVector txVector,
676  uint16_t staId = SU_STA_ID);
677 
692  typedef void (*MonitorSnifferTxCallback)(const Ptr<const Packet> packet,
693  uint16_t channelFreqMhz,
694  WifiTxVector txVector,
695  MpduInfo aMpdu,
696  uint16_t staId);
697 
704  typedef void (*PhyTxBeginTracedCallback)(Ptr<const Packet> packet, double txPowerW);
705 
713  typedef void (*PsduTxBeginCallback)(WifiConstPsduMap psduMap,
714  WifiTxVector txVector,
715  double txPowerW);
716 
724  RxPowerWattPerChannelBand rxPowersW);
725 
732  typedef void (*PhyRxPayloadBeginTracedCallback)(WifiTxVector txVector, Time psduDuration);
733 
742  virtual int64_t AssignStreams(int64_t stream);
743 
751  void SetRxSensitivity(double threshold);
757  double GetRxSensitivity() const;
764  void SetCcaEdThreshold(double threshold);
770  double GetCcaEdThreshold() const;
777  void SetCcaSensitivityThreshold(double threshold);
783  double GetCcaSensitivityThreshold() const;
789  void SetRxNoiseFigure(double noiseFigureDb);
795  void SetTxPowerStart(double start);
801  double GetTxPowerStart() const;
807  void SetTxPowerEnd(double end);
813  double GetTxPowerEnd() const;
821  void SetNTxPower(uint8_t n);
827  uint8_t GetNTxPower() const;
833  void SetTxGain(double gain);
839  double GetTxGain() const;
845  void SetRxGain(double gain);
851  double GetRxGain() const;
852 
858  virtual void SetDevice(const Ptr<WifiNetDevice> device);
886 
887  using ChannelTuple =
888  std::tuple<uint8_t /* channel number */,
889  uint16_t /* channel width */,
890  WifiPhyBand /* WifiPhyBand */,
891  uint8_t /* primary20 index*/>;
892 
906  void SetOperatingChannel(const ChannelTuple& channelTuple);
927  void SetFixedPhyBand(bool enable);
931  bool HasFixedPhyBand() const;
935  uint16_t GetFrequency() const;
939  uint8_t GetPrimary20Index() const;
949  uint16_t GetTxBandwidth(
950  WifiMode mode,
951  uint16_t maxAllowedBandWidth = std::numeric_limits<uint16_t>::max()) const;
955  void SetNumberOfAntennas(uint8_t antennas);
959  uint8_t GetNumberOfAntennas() const;
963  void SetMaxSupportedTxSpatialStreams(uint8_t streams);
967  uint8_t GetMaxSupportedTxSpatialStreams() const;
971  void SetMaxSupportedRxSpatialStreams(uint8_t streams);
975  uint8_t GetMaxSupportedRxSpatialStreams() const;
981  void SetShortPhyPreambleSupported(bool preamble);
987  bool GetShortPhyPreambleSupported() const;
988 
994  virtual void SetInterferenceHelper(const Ptr<InterferenceHelper> helper);
995 
1001  void SetErrorRateModel(const Ptr<ErrorRateModel> model);
1019  void SetFrameCaptureModel(const Ptr<FrameCaptureModel> frameCaptureModel);
1025  void SetPreambleDetectionModel(const Ptr<PreambleDetectionModel> preambleDetectionModel);
1031  void SetWifiRadioEnergyModel(const Ptr<WifiRadioEnergyModel> wifiRadioEnergyModel);
1032 
1036  uint16_t GetChannelWidth() const;
1037 
1046  double GetPowerDbm(uint8_t power) const;
1047 
1056  void ResetCca(bool powerRestricted, double txPowerMaxSiso = 0, double txPowerMaxMimo = 0);
1074 
1082  const WifiSpectrumBandIndices& indices) const = 0;
1083 
1093  static void AddStaticPhyEntity(WifiModulationClass modulation, Ptr<PhyEntity> phyEntity);
1094 
1104 
1117 
1131  Ptr<PhyEntity> GetPhyEntity(WifiStandard standard) const;
1138 
1142  uint64_t GetPreviouslyRxPpduUid() const;
1143 
1154  void SetPreviouslyRxPpduUid(uint64_t uid);
1155 
1169  virtual uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const = 0;
1178  virtual std::tuple<double, double, double> GetTxMaskRejectionParams() const = 0;
1179 
1186  uint8_t GetPrimaryChannelNumber(uint16_t primaryChannelWidth) const;
1187 
1196  virtual WifiSpectrumBandInfo GetBand(uint16_t bandWidth, uint8_t bandIndex = 0) = 0;
1197 
1204 
1208  uint32_t GetSubcarrierSpacing() const;
1209 
1210  protected:
1211  void DoInitialize() override;
1212  void DoDispose() override;
1213 
1217  void Reset();
1218 
1226  std::optional<Time> GetDelayUntilChannelSwitch();
1230  virtual void DoChannelSwitch();
1231 
1238  void SwitchMaybeToCcaBusy(const Ptr<const WifiPpdu> ppdu = nullptr);
1245  void NotifyCcaBusy(const Ptr<const WifiPpdu> ppdu, Time duration);
1246 
1257  void AddPhyEntity(WifiModulationClass modulation, Ptr<PhyEntity> phyEntity);
1258 
1261 
1264 
1269 
1272 
1274  std::map<std::pair<uint64_t /* UID*/, WifiPreamble>, Ptr<Event>>
1277 
1280 
1298  std::map<WifiModulationClass, Ptr<PhyEntity>> m_phyEntities;
1299 
1300  private:
1305  void Configure80211a();
1310  void Configure80211b();
1315  void Configure80211g();
1320  void Configure80211p();
1325  void Configure80211n();
1330  void Configure80211ac();
1335  void Configure80211ax();
1340  void Configure80211be();
1351  void PushMcs(WifiMode mode);
1356 
1363 
1371 
1386 
1394 
1402 
1410 
1426 
1434 
1441 
1455  uint16_t /* frequency (MHz) */,
1456  WifiTxVector,
1457  MpduInfo,
1459  uint16_t /* STA-ID*/>
1461 
1475  uint16_t /* frequency (MHz) */,
1476  WifiTxVector,
1477  MpduInfo,
1478  uint16_t /* STA-ID*/>
1480 
1488  static std::map<WifiModulationClass, Ptr<PhyEntity>>& GetStaticPhyEntities();
1489 
1496 
1502 
1508 
1509  double m_txGainDb;
1510  double m_rxGainDb;
1513  uint8_t m_nTxPower;
1515 
1517  double
1519  double
1523 
1528 
1530 
1532 
1535 
1541 
1543 };
1544 
1550 std::ostream& operator<<(std::ostream& os, RxSignalInfo rxSignalInfo);
1551 
1552 } // namespace ns3
1553 
1554 #endif /* WIFI_PHY_H */
#define max(a, b)
Definition: 80211b.c:42
An identifier for simulation events.
Definition: event-id.h:55
A base class which provides memory management and object aggregation.
Definition: object.h:89
Abstract class for PHY entities.
Definition: phy-entity.h:96
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition: type-id.h:59
represent a single transmission mode
Definition: wifi-mode.h:51
802.11 PHY layer model
Definition: wifi-phy.h:53
static TypeId GetTypeId()
Get the type ID.
Definition: wifi-phy.cc:62
void SetNumberOfAntennas(uint8_t antennas)
Definition: wifi-phy.cc:1257
Ptr< WifiPhyStateHelper > m_state
Pointer to WifiPhyStateHelper.
Definition: wifi-phy.h:1263
Time GetBlockAckTxTime() const
Return the estimated BlockAck TX time for this PHY.
Definition: wifi-phy.cc:817
double GetCcaEdThreshold() const
Return the CCA energy detection threshold (dBm).
Definition: wifi-phy.cc:499
double m_rxGainDb
Reception gain (dB)
Definition: wifi-phy.h:1510
bool IsStateTx() const
Definition: wifi-phy.cc:2063
Ptr< MobilityModel > m_mobility
Pointer to the mobility model.
Definition: wifi-phy.h:1534
void(* PhyTxBeginTracedCallback)(Ptr< const Packet > packet, double txPowerW)
TracedCallback signature for Phy transmit events.
Definition: wifi-phy.h:704
WifiModulationClass GetMaxModulationClassSupported() const
Definition: wifi-phy.cc:955
bool IsStateIdle() const
Definition: wifi-phy.cc:2051
virtual void SetInterferenceHelper(const Ptr< InterferenceHelper > helper)
Sets the interference helper.
Definition: wifi-phy.cc:631
uint8_t m_txSpatialStreams
Number of supported TX spatial streams.
Definition: wifi-phy.h:1526
bool IsStateCcaBusy() const
Definition: wifi-phy.cc:2045
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:1720
Ptr< UniformRandomVariable > m_random
Provides uniform random variables.
Definition: wifi-phy.h:1262
Ptr< WifiRadioEnergyModel > m_wifiRadioEnergyModel
Wifi radio energy model.
Definition: wifi-phy.h:1538
void Configure80211ax()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11ax standard.
Definition: wifi-phy.cc:925
Time m_channelSwitchDelay
Time required to switch between channel.
Definition: wifi-phy.h:1531
void SetCcaEdThreshold(double threshold)
Sets the CCA energy detection threshold (dBm).
Definition: wifi-phy.cc:492
void NotifyCcaBusy(const Ptr< const WifiPpdu > ppdu, Time duration)
Notify PHY state helper to switch to CCA busy state,.
Definition: wifi-phy.cc:2112
WifiPhyOperatingChannel m_operatingChannel
Operating channel.
Definition: wifi-phy.h:1494
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:1401
void SetErrorRateModel(const Ptr< ErrorRateModel > model)
Sets the error rate model.
Definition: wifi-phy.cc:639
bool m_channelAccessRequested
Flag if channels access has been requested (used for OBSS_PD SR)
Definition: wifi-phy.h:1521
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:1460
Time GetSlot() const
Return the slot duration for this PHY.
Definition: wifi-phy.cc:793
uint32_t GetSubcarrierSpacing() const
Definition: wifi-phy.cc:2251
void SetMaxSupportedRxSpatialStreams(uint8_t streams)
Definition: wifi-phy.cc:1307
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:2220
void Configure80211g()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11g standard.
Definition: wifi-phy.cc:855
uint8_t GetPrimary20Index() const
Definition: wifi-phy.cc:1057
void NotifyTxEnd(WifiConstPsduMap psdus)
Public method used to fire a PhyTxEnd trace.
Definition: wifi-phy.cc:1557
uint16_t GetChannelWidth() const
Definition: wifi-phy.cc:1051
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:1275
uint8_t GetNumberOfAntennas() const
Definition: wifi-phy.cc:1269
Time m_slot
Slot duration.
Definition: wifi-phy.h:1498
double m_powerDensityLimit
the power density limit (dBm/MHz)
Definition: wifi-phy.h:1514
Time GetDelayUntilIdle()
Definition: wifi-phy.cc:2087
double GetRxSensitivity() const
Return the receive sensitivity threshold (dBm).
Definition: wifi-phy.cc:486
bool GetShortPhyPreambleSupported() const
Return whether short PHY preamble is supported.
Definition: wifi-phy.cc:601
void SetSifs(Time sifs)
Set the Short Interframe Space (SIFS) for this PHY.
Definition: wifi-phy.cc:775
std::list< uint8_t > GetBssMembershipSelectorList() const
The WifiPhy::BssMembershipSelector() method is used (e.g., by a WifiRemoteStationManager) to determin...
Definition: wifi-phy.cc:1325
void Configure80211n()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11n standard.
Definition: wifi-phy.cc:898
EventId m_endPhyRxEvent
the end of PHY receive event
Definition: wifi-phy.h:1270
double GetTxGain() const
Return the transmission gain (dB).
Definition: wifi-phy.cc:575
double m_txPowerBaseDbm
Minimum transmission power (dBm)
Definition: wifi-phy.h:1511
void Configure80211be()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11be standard.
Definition: wifi-phy.cc:940
void NotifyRxDrop(Ptr< const WifiPsdu > psdu, WifiPhyRxfailureReason reason)
Public method used to fire a PhyRxDrop trace.
Definition: wifi-phy.cc:1608
bool IsStateRx() const
Definition: wifi-phy.cc:2057
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:1943
Time GetSifs() const
Return the Short Interframe Space (SIFS) for this PHY.
Definition: wifi-phy.cc:781
uint16_t GetFrequency() const
Definition: wifi-phy.cc:1039
Ptr< MobilityModel > GetMobility() const
Return the mobility model this PHY is associated with.
Definition: wifi-phy.cc:625
uint16_t GetNMcs() const
Definition: wifi-phy.cc:1989
Time m_blockAckTxTime
estimated BlockAck TX time
Definition: wifi-phy.h:1501
uint8_t GetPrimaryChannelNumber(uint16_t primaryChannelWidth) const
Get channel number of the primary channel.
Definition: wifi-phy.cc:2245
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:2161
double m_txPowerMaxMimo
MIMO maximum transmit power due to OBSS PD SR power restriction (dBm)
Definition: wifi-phy.h:1520
void ResumeFromSleep()
Resume from sleep mode.
Definition: wifi-phy.cc:1393
static Time GetPreambleDetectionDuration()
Definition: wifi-phy.cc:1448
void Configure80211p()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11p standard.
Definition: wifi-phy.cc:868
void AbortCurrentReception(WifiPhyRxfailureReason reason)
Due to newly arrived signal, the current reception cannot be continued and has to be aborted.
Definition: wifi-phy.cc:2119
Ptr< FrameCaptureModel > m_frameCaptureModel
Frame capture model.
Definition: wifi-phy.h:1536
TracedCallback< Ptr< const Packet > > m_phyRxEndTrace
The trace source fired when a packet ends the reception process from the medium.
Definition: wifi-phy.h:1433
void NotifyRxBegin(Ptr< const WifiPsdu > psdu, const RxPowerWattPerChannelBand &rxPowersW)
Public method used to fire a PhyRxBegin trace.
Definition: wifi-phy.cc:1584
Time GetChannelSwitchDelay() const
Definition: wifi-phy.cc:690
virtual std::tuple< double, double, double > GetTxMaskRejectionParams() const =0
void SetMaxSupportedTxSpatialStreams(uint8_t streams)
Definition: wifi-phy.cc:1275
Time m_sifs
Short Interframe Space (SIFS) duration.
Definition: wifi-phy.h:1497
void SetReceiveErrorCallback(RxErrorCallback callback)
Definition: wifi-phy.cc:455
virtual uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const =0
void ConfigureHtDeviceMcsSet()
Configure the device MCS set with the appropriate HtMcs modes for the number of available transmit sp...
bool IsStateOff() const
Definition: wifi-phy.cc:2081
uint8_t GetMaxSupportedRxSpatialStreams() const
Definition: wifi-phy.cc:1319
void(* PsduTxBeginCallback)(WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
TracedCallback signature for PSDU transmit events.
Definition: wifi-phy.h:713
double GetTxPowerEnd() const
Return the maximum available transmission power level (dBm).
Definition: wifi-phy.cc:549
virtual void ConfigureStandard(WifiStandard standard)
Configure the PHY-level parameters for different Wi-Fi standard.
Definition: wifi-phy.cc:961
void SetPostReceptionErrorModel(const Ptr< ErrorModel > em)
Attach a receive ErrorModel to the WifiPhy.
Definition: wifi-phy.cc:646
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:2038
void PushMcs(WifiMode mode)
Add the given MCS to the device MCS set.
uint8_t m_numberOfAntennas
Number of transmitters.
Definition: wifi-phy.h:1525
ChannelTuple m_channelSettings
Store operating channel settings until initialization.
Definition: wifi-phy.h:1493
uint32_t m_txMpduReferenceNumber
A-MPDU reference number to identify all transmitted subframes belonging to the same received A-MPDU.
Definition: wifi-phy.h:1265
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
Definition: wifi-phy.cc:1507
static uint32_t GetMaxPsduSize(WifiModulationClass modulation)
Get the maximum PSDU size in bytes for the given modulation class.
Definition: wifi-phy.cc:1536
Ptr< WifiPhyStateHelper > GetState() const
Return the WifiPhyStateHelper of this PHY.
Definition: wifi-phy.cc:443
void NotifyTxBegin(WifiConstPsduMap psdus, double txPowerW)
Public method used to fire a PhyTxBegin trace.
Definition: wifi-phy.cc:1542
void EndReceiveInterBss()
For HE receptions only, check and possibly modify the transmit power restriction state at the end of ...
Definition: wifi-phy.cc:1897
void SetSleepMode()
Put in sleep mode.
Definition: wifi-phy.cc:1340
void SetShortPhyPreambleSupported(bool preamble)
Enable or disable short PHY preamble.
Definition: wifi-phy.cc:594
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:555
WifiPhyBand m_band
WifiPhyBand.
Definition: wifi-phy.h:1492
void SetRxSensitivity(double threshold)
Sets the receive sensitivity threshold (dBm).
Definition: wifi-phy.cc:479
static const Ptr< const PhyEntity > GetStaticPhyEntity(WifiModulationClass modulation)
Get the implemented PHY entity corresponding to the modulation class.
Definition: wifi-phy.cc:702
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:692
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:1479
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:1518
std::map< WifiModulationClass, Ptr< PhyEntity > > m_phyEntities
This map holds the supported PHY entities.
Definition: wifi-phy.h:1298
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:948
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:762
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:1460
Ptr< ErrorModel > m_postReceptionErrorModel
Error model for receive packet events.
Definition: wifi-phy.h:1539
EventId m_endTxEvent
the end of transmit event
Definition: wifi-phy.h:1271
double GetRxGain() const
Return the reception gain (dB).
Definition: wifi-phy.cc:588
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:1714
void RegisterListener(const std::shared_ptr< WifiPhyListener > &listener)
Definition: wifi-phy.cc:461
static std::map< WifiModulationClass, Ptr< PhyEntity > > & GetStaticPhyEntities()
Definition: wifi-phy.cc:436
void SetSlot(Time slot)
Set the slot duration for this PHY.
Definition: wifi-phy.cc:787
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:1098
WifiPhyBand GetPhyBand() const
Get the configured Wi-Fi band.
Definition: wifi-phy.cc:1021
void SetPreviouslyRxPpduUid(uint64_t uid)
Set the UID of the previously received PPDU.
Definition: wifi-phy.cc:1847
bool IsReceivingPhyHeader() const
Definition: wifi-phy.cc:1891
double m_ccaSensitivityThresholdW
Clear channel assessment (CCA) modulation and coding rate sensitivity threshold in watts.
Definition: wifi-phy.h:1506
Ptr< Event > m_currentEvent
Hold the current event.
Definition: wifi-phy.h:1273
Time GetLastRxStartTime() const
Return the start time of the last received packet.
Definition: wifi-phy.cc:2093
WifiMode GetDefaultMode() const
Get the default WifiMode supported by the PHY.
Definition: wifi-phy.cc:1927
void SetCcaSensitivityThreshold(double threshold)
Sets the CCA sensitivity threshold (dBm).
Definition: wifi-phy.cc:505
double m_ccaEdThresholdW
Clear channel assessment (CCA) energy detection (ED) threshold in watts.
Definition: wifi-phy.h:1504
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:1674
Ptr< PhyEntity > GetPhyEntity(WifiModulationClass modulation) const
Get the supported PHY entity corresponding to the modulation class.
Definition: wifi-phy.cc:711
uint8_t GetChannelNumber() const
Return current channel number.
Definition: wifi-phy.cc:1045
TracedCallback< Ptr< const Packet > > m_phyTxEndTrace
The trace source fired when a packet ends the transmission process on the medium.
Definition: wifi-phy.h:1393
uint64_t m_previouslyRxPpduUid
UID of the previously received PPDU, reset to UINT64_MAX upon transmission.
Definition: wifi-phy.h:1278
std::optional< Time > GetDelayUntilChannelSwitch()
Perform any actions necessary when user changes operating channel after initialization.
Definition: wifi-phy.cc:1135
uint32_t m_rxMpduReferenceNumber
A-MPDU reference number to identify all received subframes belonging to the same received A-MPDU.
Definition: wifi-phy.h:1267
void SetWifiRadioEnergyModel(const Ptr< WifiRadioEnergyModel > wifiRadioEnergyModel)
Sets the wifi radio energy model.
Definition: wifi-phy.cc:665
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:1378
virtual void SetDevice(const Ptr< WifiNetDevice > device)
Sets the device this PHY is associated with.
Definition: wifi-phy.cc:607
Ptr< PreambleDetectionModel > m_preambleDetectionModel
Preamble detection model.
Definition: wifi-phy.h:1537
void SetTxPowerEnd(double end)
Sets the maximum available transmission power level (dBm).
Definition: wifi-phy.cc:542
Time GetPifs() const
Return the PCF Interframe Space (PIFS) for this PHY.
Definition: wifi-phy.cc:805
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:752
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:653
void NotifyRxEnd(Ptr< const WifiPsdu > psdu)
Public method used to fire a PhyRxEnd trace.
Definition: wifi-phy.cc:1596
void StartReceivePreamble(Ptr< const WifiPpdu > ppdu, RxPowerWattPerChannelBand &rxPowersW, Time rxDuration)
Start receiving the PHY preamble of a PPDU (i.e.
Definition: wifi-phy.cc:1868
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:1385
double m_txGainDb
Transmission gain (dB)
Definition: wifi-phy.h:1509
bool IsStateSleep() const
Definition: wifi-phy.cc:2075
Ptr< WifiNetDevice > GetDevice() const
Return the device this PHY is associated with.
Definition: wifi-phy.cc:613
WifiStandard m_standard
WifiStandard.
Definition: wifi-phy.h:1490
double GetPowerDbm(uint8_t power) const
Get the power of the given power level in dBm.
Definition: wifi-phy.cc:671
uint8_t m_nTxPower
Number of available transmission power levels.
Definition: wifi-phy.h:1513
void DoDispose() override
Destructor implementation.
Definition: wifi-phy.cc:408
bool IsStateSwitching() const
Definition: wifi-phy.cc:2069
virtual void DoChannelSwitch()
Actually switch channel based on the stored channel settings.
Definition: wifi-phy.cc:1174
void SetOffMode()
Put in off mode.
Definition: wifi-phy.cc:1383
double m_noiseFigureDb
The noise figure in dB.
Definition: wifi-phy.h:1529
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:1440
void SetPreambleDetectionModel(const Ptr< PreambleDetectionModel > preambleDetectionModel)
Sets the preamble detection model.
Definition: wifi-phy.cc:659
void RebuildMcsMap()
Rebuild the mapping of MCS values to indices in the device MCS set.
std::tuple< uint8_t, uint16_t, WifiPhyBand, uint8_t > ChannelTuple
Tuple identifying an operating channel.
Definition: wifi-phy.h:891
void SetPifs(Time pifs)
Set the PCF Interframe Space (PIFS) for this PHY.
Definition: wifi-phy.cc:799
void Configure80211b()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11b standard.
Definition: wifi-phy.cc:838
static Time GetStartOfPacketDuration(const WifiTxVector &txVector)
Definition: wifi-phy.cc:1454
virtual FrequencyRange GetCurrentFrequencyRange() const =0
Get the frequency range of the current RF interface.
virtual Ptr< Channel > GetChannel() const =0
Return the Channel this WifiPhy is connected to.
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:1075
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:581
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:2105
void SetMobility(const Ptr< MobilityModel > mobility)
assign a mobility model to this device
Definition: wifi-phy.cc:619
void SetTxGain(double gain)
Sets the transmission gain (dB).
Definition: wifi-phy.cc:568
uint8_t m_rxSpatialStreams
Number of supported RX spatial streams.
Definition: wifi-phy.h:1527
double m_txPowerEndDbm
Maximum transmission power (dBm)
Definition: wifi-phy.h:1512
double CalculateSnr(const WifiTxVector &txVector, double ber) const
Definition: wifi-phy.cc:696
void SetFixedPhyBand(bool enable)
Configure whether it is prohibited to change PHY band after initialization.
Definition: wifi-phy.cc:1063
void(* PhyRxBeginTracedCallback)(Ptr< const Packet > packet, RxPowerWattPerChannelBand rxPowersW)
TracedCallback signature for PhyRxBegin trace source.
Definition: wifi-phy.h:723
~WifiPhy() override
Definition: wifi-phy.cc:377
void Configure80211ac()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11ac standard.
Definition: wifi-phy.cc:917
bool HasFixedPhyBand() const
Definition: wifi-phy.cc:1069
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:1409
Ptr< WifiNetDevice > m_device
Pointer to the device.
Definition: wifi-phy.h:1533
Ptr< InterferenceHelper > m_interference
Pointer to a helper responsible for interference computations.
Definition: wifi-phy.h:1260
void DoInitialize() override
Initialize() implementation.
Definition: wifi-phy.cc:383
bool m_shortPreamble
Flag if short PHY preamble is supported.
Definition: wifi-phy.h:1524
Time m_pifs
PCF Interframe Space (PIFS) duration.
Definition: wifi-phy.h:1499
WifiModulationClass m_maxModClassSupported
max modulation class supported
Definition: wifi-phy.h:1491
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:518
double GetTxPowerStart() const
Return the minimum available transmission power level (dBm).
Definition: wifi-phy.cc:536
double GetTxPowerForTransmission(Ptr< const WifiPpdu > ppdu) const
Compute the transmit power for the next transmission.
Definition: wifi-phy.cc:2184
void(* PhyRxPayloadBeginTracedCallback)(WifiTxVector txVector, Time psduDuration)
TracedCallback signature for start of PSDU reception events.
Definition: wifi-phy.h:732
WifiStandard GetStandard() const
Get the configured Wi-Fi standard.
Definition: wifi-phy.cc:1027
void SetCapabilitiesChangedCallback(Callback< void > callback)
Definition: wifi-phy.cc:473
void SetReceiveOkCallback(RxOkCallback callback)
Definition: wifi-phy.cc:449
void SetFrameCaptureModel(const Ptr< FrameCaptureModel > frameCaptureModel)
Sets the frame capture model.
Definition: wifi-phy.cc:653
void NotifyChannelAccessRequested()
Notify the PHY that an access to the channel was requested.
Definition: wifi-phy.cc:1907
void ResumeFromOff()
Resume from off mode.
Definition: wifi-phy.cc:1420
bool m_powerRestricted
Flag whether transmit power is restricted by OBSS PD SR.
Definition: wifi-phy.h:1516
Callback< void > m_capabilitiesChangedCallback
Callback when PHY capabilities changed.
Definition: wifi-phy.h:1542
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:1620
Ptr< PhyEntity > GetPhyEntityForPpdu(const Ptr< const WifiPpdu > ppdu) const
Get the supported PHY entity to use for a received PPDU.
Definition: wifi-phy.cc:732
Time GetAckTxTime() const
Return the estimated Ack TX time for this PHY.
Definition: wifi-phy.cc:811
uint64_t GetPreviouslyRxPpduUid() const
Definition: wifi-phy.cc:1841
void Reset()
Reset data upon end of TX or RX.
Definition: wifi-phy.cc:1854
TracedCallback< WifiTxVector, Time > m_phyRxPayloadBeginTrace
The trace source fired when the reception of the PHY payload (PSDU) begins.
Definition: wifi-phy.h:1425
Time GetLastRxEndTime() const
Return the end time of the last received packet.
Definition: wifi-phy.cc:2099
Time m_timeLastPreambleDetected
Record the time the last preamble was detected.
Definition: wifi-phy.h:1540
uint8_t GetMaxSupportedTxSpatialStreams() const
Definition: wifi-phy.cc:1301
void Configure80211a()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11a standard.
Definition: wifi-phy.cc:823
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:2003
std::list< WifiMode > GetModeList() const
The WifiPhy::GetModeList() method is used (e.g., by a WifiRemoteStationManager) to determine the set ...
Definition: wifi-phy.cc:1954
double m_rxSensitivityW
Receive sensitivity threshold in watts.
Definition: wifi-phy.h:1503
const WifiPhyOperatingChannel & GetOperatingChannel() const
Get a const reference to the operating channel.
Definition: wifi-phy.cc:1033
double GetCcaSensitivityThreshold() const
Return the CCA sensitivity threshold (dBm).
Definition: wifi-phy.cc:512
bool m_fixedPhyBand
True to prohibit changing PHY band after initialization.
Definition: wifi-phy.h:1495
Ptr< PhyEntity > GetLatestPhyEntity() const
Get the latest PHY entity supported by this PHY instance.
Definition: wifi-phy.cc:726
void SetTxPowerStart(double start)
Sets the minimum available transmission power level (dBm).
Definition: wifi-phy.cc:529
uint8_t GetNTxPower() const
Return the number of available transmission power levels.
Definition: wifi-phy.cc:562
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:2227
static Time CalculatePhyPreambleAndHeaderDuration(const WifiTxVector &txVector)
Definition: wifi-phy.cc:1500
bool IsModeSupported(WifiMode mode) const
Check if the given WifiMode is supported by the PHY.
Definition: wifi-phy.cc:1914
Time m_ackTxTime
estimated Ack TX time
Definition: wifi-phy.h:1500
void UnregisterListener(const std::shared_ptr< WifiPhyListener > &listener)
Definition: wifi-phy.cc:467
void NotifyTxDrop(Ptr< const WifiPsdu > psdu)
Public method used to fire a PhyTxDrop trace.
Definition: wifi-phy.cc:1572
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::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
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:159
static constexpr uint16_t SU_STA_ID
STA_ID to identify a single user (SU)
Definition: wifi-mode.h:35
channel
Definition: third.py:88
mobility
Definition: third.py:105
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.