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(WifiPhyListener* listener);
96  void UnregisterListener(WifiPhyListener* listener);
97 
102 
111  RxPowerWattPerChannelBand& rxPowersW,
112  Time rxDuration);
113 
118  void EndReceiveInterBss();
119 
130  const WifiTxVector& txVector);
131 
144  void Send(Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector);
152  void Send(WifiConstPsduMap psdus, const WifiTxVector& txVector);
153 
157  virtual void StartTx(Ptr<const WifiPpdu> ppdu) = 0;
158 
162  void SetSleepMode();
166  void ResumeFromSleep();
170  void SetOffMode();
174  void ResumeFromOff();
175 
179  bool IsStateIdle() const;
183  bool IsStateCcaBusy() const;
187  bool IsStateRx() const;
191  bool IsStateTx() const;
195  bool IsStateSwitching() const;
199  bool IsStateSleep() const;
203  bool IsStateOff() const;
204 
212 
218  Time GetLastRxStartTime() const;
224  Time GetLastRxEndTime() const;
225 
234  static Time CalculateTxDuration(uint32_t size,
235  const WifiTxVector& txVector,
236  WifiPhyBand band,
237  uint16_t staId = SU_STA_ID);
253  const WifiTxVector& txVector,
254  WifiPhyBand band);
263  const WifiTxVector& txVector,
264  WifiPhyBand band);
265 
287  static Time GetPayloadDuration(uint32_t size,
288  const WifiTxVector& txVector,
289  WifiPhyBand band,
290  MpduType mpdutype = NORMAL_MPDU,
291  uint16_t staId = SU_STA_ID);
309  static Time GetPayloadDuration(uint32_t size,
310  const WifiTxVector& txVector,
311  WifiPhyBand band,
312  MpduType mpdutype,
313  bool incFlag,
314  uint32_t& totalAmpduSize,
315  double& totalAmpduNumSymbols,
316  uint16_t staId);
322  static Time GetStartOfPacketDuration(const WifiTxVector& txVector);
323 
338  std::list<WifiMode> GetModeList() const;
348  std::list<WifiMode> GetModeList(WifiModulationClass modulation) const;
357  bool IsModeSupported(WifiMode mode) const;
365  WifiMode GetDefaultMode() const;
375  bool IsMcsSupported(WifiModulationClass modulation, uint8_t mcs) const;
376 
384  double CalculateSnr(const WifiTxVector& txVector, double ber) const;
385 
391  void SetSifs(Time sifs);
397  Time GetSifs() const;
403  void SetSlot(Time slot);
409  Time GetSlot() const;
415  void SetPifs(Time pifs);
421  Time GetPifs() const;
427  Time GetAckTxTime() const;
433  Time GetBlockAckTxTime() const;
434 
441  static uint32_t GetMaxPsduSize(WifiModulationClass modulation);
442 
453  std::list<uint8_t> GetBssMembershipSelectorList() const;
459  uint16_t GetNMcs() const;
468  std::list<WifiMode> GetMcsList() const;
478  std::list<WifiMode> GetMcsList(WifiModulationClass modulation) const;
489  WifiMode GetMcs(WifiModulationClass modulation, uint8_t mcs) const;
490 
496  uint8_t GetChannelNumber() const;
500  Time GetChannelSwitchDelay() const;
501 
507  virtual void ConfigureStandard(WifiStandard standard);
508 
514  WifiStandard GetStandard() const;
515 
521  WifiPhyBand GetPhyBand() const;
522 
529 
535  virtual Ptr<Channel> GetChannel() const = 0;
536 
544  void NotifyTxBegin(WifiConstPsduMap psdus, double txPowerW);
551  void NotifyTxEnd(WifiConstPsduMap psdus);
566  void NotifyRxBegin(Ptr<const WifiPsdu> psdu, const RxPowerWattPerChannelBand& rxPowersW);
573  void NotifyRxEnd(Ptr<const WifiPsdu> psdu);
582 
605  uint16_t channelFreqMhz,
606  WifiTxVector txVector,
607  SignalNoiseDbm signalNoise,
608  std::vector<bool> statusPerMpdu,
609  uint16_t staId = SU_STA_ID);
610 
633  uint16_t channelFreqMhz,
634  WifiTxVector txVector,
635  MpduInfo aMpdu,
636  SignalNoiseDbm signalNoise,
637  uint16_t staId);
638 
653  uint16_t channelFreqMhz,
654  WifiTxVector txVector,
655  uint16_t staId = SU_STA_ID);
656 
671  typedef void (*MonitorSnifferTxCallback)(const Ptr<const Packet> packet,
672  uint16_t channelFreqMhz,
673  WifiTxVector txVector,
674  MpduInfo aMpdu,
675  uint16_t staId);
676 
683  typedef void (*PhyTxBeginTracedCallback)(Ptr<const Packet> packet, double txPowerW);
684 
692  typedef void (*PsduTxBeginCallback)(WifiConstPsduMap psduMap,
693  WifiTxVector txVector,
694  double txPowerW);
695 
703  RxPowerWattPerChannelBand rxPowersW);
704 
711  typedef void (*PhyRxPayloadBeginTracedCallback)(WifiTxVector txVector, Time psduDuration);
712 
721  virtual int64_t AssignStreams(int64_t stream);
722 
730  void SetRxSensitivity(double threshold);
736  double GetRxSensitivity() const;
743  void SetCcaEdThreshold(double threshold);
749  double GetCcaEdThreshold() const;
756  void SetCcaSensitivityThreshold(double threshold);
762  double GetCcaSensitivityThreshold() const;
768  void SetRxNoiseFigure(double noiseFigureDb);
774  void SetTxPowerStart(double start);
780  double GetTxPowerStart() const;
786  void SetTxPowerEnd(double end);
792  double GetTxPowerEnd() const;
800  void SetNTxPower(uint8_t n);
806  uint8_t GetNTxPower() const;
812  void SetTxGain(double gain);
818  double GetTxGain() const;
824  void SetRxGain(double gain);
830  double GetRxGain() const;
831 
837  void SetDevice(const Ptr<WifiNetDevice> device);
865 
866  using ChannelTuple =
867  std::tuple<uint8_t /* channel number */,
868  uint16_t /* channel width */,
869  int /* WifiPhyBand */,
870  uint8_t /* primary20 index*/>;
871 
881  void SetOperatingChannel(const ChannelTuple& channelTuple);
888  void SetFixedPhyBand(bool enable);
892  bool HasFixedPhyBand() const;
896  uint16_t GetFrequency() const;
900  uint8_t GetPrimary20Index() const;
910  uint16_t GetTxBandwidth(
911  WifiMode mode,
912  uint16_t maxAllowedBandWidth = std::numeric_limits<uint16_t>::max()) const;
916  void SetNumberOfAntennas(uint8_t antennas);
920  uint8_t GetNumberOfAntennas() const;
924  void SetMaxSupportedTxSpatialStreams(uint8_t streams);
928  uint8_t GetMaxSupportedTxSpatialStreams() const;
932  void SetMaxSupportedRxSpatialStreams(uint8_t streams);
936  uint8_t GetMaxSupportedRxSpatialStreams() const;
942  void SetShortPhyPreambleSupported(bool preamble);
948  bool GetShortPhyPreambleSupported() const;
949 
955  virtual void SetInterferenceHelper(const Ptr<InterferenceHelper> helper);
956 
962  void SetErrorRateModel(const Ptr<ErrorRateModel> model);
980  void SetFrameCaptureModel(const Ptr<FrameCaptureModel> frameCaptureModel);
986  void SetPreambleDetectionModel(const Ptr<PreambleDetectionModel> preambleDetectionModel);
992  void SetWifiRadioEnergyModel(const Ptr<WifiRadioEnergyModel> wifiRadioEnergyModel);
993 
997  uint16_t GetChannelWidth() const;
998 
1007  double GetPowerDbm(uint8_t power) const;
1008 
1017  void ResetCca(bool powerRestricted, double txPowerMaxSiso = 0, double txPowerMaxMimo = 0);
1035 
1047  virtual WifiSpectrumBand ConvertHeRuSubcarriers(uint16_t bandWidth,
1048  uint16_t guardBandwidth,
1049  HeRu::SubcarrierRange range,
1050  uint8_t bandIndex = 0) const;
1051 
1061  static void AddStaticPhyEntity(WifiModulationClass modulation, Ptr<PhyEntity> phyEntity);
1062 
1072 
1085 
1099  Ptr<PhyEntity> GetPhyEntity(WifiStandard standard) const;
1106 
1110  uint64_t GetPreviouslyRxPpduUid() const;
1111 
1125  virtual uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const = 0;
1134  virtual std::tuple<double, double, double> GetTxMaskRejectionParams() const = 0;
1135 
1142  uint8_t GetPrimaryChannelNumber(uint16_t primaryChannelWidth) const;
1143 
1152  virtual WifiSpectrumBand GetBand(uint16_t bandWidth, uint8_t bandIndex = 0);
1153 
1154  protected:
1155  void DoInitialize() override;
1156  void DoDispose() override;
1157 
1161  void Reset();
1162 
1176  virtual void DoChannelSwitch();
1177 
1184  void SwitchMaybeToCcaBusy(const Ptr<const WifiPpdu> ppdu);
1191  void NotifyCcaBusy(const Ptr<const WifiPpdu> ppdu, Time duration);
1192 
1203  void AddPhyEntity(WifiModulationClass modulation, Ptr<PhyEntity> phyEntity);
1204 
1207 
1210 
1215 
1218 
1220  std::map<std::pair<uint64_t /* UID*/, WifiPreamble>, Ptr<Event>>
1223 
1226 
1244  std::map<WifiModulationClass, Ptr<PhyEntity>> m_phyEntities;
1245 
1246  private:
1251  void Configure80211a();
1256  void Configure80211b();
1261  void Configure80211g();
1266  void Configure80211p();
1271  void Configure80211n();
1276  void Configure80211ac();
1281  void Configure80211ax();
1286  void Configure80211be();
1297  void PushMcs(WifiMode mode);
1302 
1309 
1317 
1332 
1340 
1348 
1356 
1372 
1380 
1387 
1401  uint16_t /* frequency (MHz) */,
1402  WifiTxVector,
1403  MpduInfo,
1405  uint16_t /* STA-ID*/>
1407 
1421  uint16_t /* frequency (MHz) */,
1422  WifiTxVector,
1423  MpduInfo,
1424  uint16_t /* STA-ID*/>
1426 
1434  static std::map<WifiModulationClass, Ptr<PhyEntity>>& GetStaticPhyEntities();
1435 
1441 
1447 
1453 
1454  double m_txGainDb;
1455  double m_rxGainDb;
1458  uint8_t m_nTxPower;
1460 
1462  double
1464  double
1468 
1473 
1475 
1477 
1480 
1486 
1488 };
1489 
1495 std::ostream& operator<<(std::ostream& os, RxSignalInfo rxSignalInfo);
1496 
1497 } // namespace ns3
1498 
1499 #endif /* WIFI_PHY_H */
#define max(a, b)
Definition: 80211b.c:43
An identifier for simulation events.
Definition: event-id.h:55
std::pair< int16_t, int16_t > SubcarrierRange
(lowest index, highest index) pair defining a subcarrier range
Definition: he-ru.h:52
A base class which provides memory management and object aggregation.
Definition: object.h:89
Abstract class for PHY entities.
Definition: phy-entity.h:97
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
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:60
represent a single transmission mode
Definition: wifi-mode.h:50
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:1233
Ptr< WifiPhyStateHelper > m_state
Pointer to WifiPhyStateHelper.
Definition: wifi-phy.h:1209
Time GetBlockAckTxTime() const
Return the estimated BlockAck TX time for this PHY.
Definition: wifi-phy.cc:810
double GetCcaEdThreshold() const
Return the CCA energy detection threshold (dBm).
Definition: wifi-phy.cc:492
double m_rxGainDb
Reception gain (dB)
Definition: wifi-phy.h:1455
bool IsStateTx() const
Definition: wifi-phy.cc:2016
Ptr< MobilityModel > m_mobility
Pointer to the mobility model.
Definition: wifi-phy.h:1479
void(* PhyTxBeginTracedCallback)(Ptr< const Packet > packet, double txPowerW)
TracedCallback signature for Phy transmit events.
Definition: wifi-phy.h:683
bool IsStateIdle() const
Definition: wifi-phy.cc:2004
virtual void SetInterferenceHelper(const Ptr< InterferenceHelper > helper)
Sets the interference helper.
Definition: wifi-phy.cc:624
uint8_t m_txSpatialStreams
Number of supported TX spatial streams.
Definition: wifi-phy.h:1471
bool IsStateCcaBusy() const
Definition: wifi-phy.cc:1998
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:1693
Ptr< UniformRandomVariable > m_random
Provides uniform random variables.
Definition: wifi-phy.h:1208
Ptr< WifiRadioEnergyModel > m_wifiRadioEnergyModel
Wifi radio energy model.
Definition: wifi-phy.h:1483
void Configure80211ax()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11ax standard.
Definition: wifi-phy.cc:918
Time m_channelSwitchDelay
Time required to switch between channel.
Definition: wifi-phy.h:1476
void SetCcaEdThreshold(double threshold)
Sets the CCA energy detection threshold (dBm).
Definition: wifi-phy.cc:485
void NotifyCcaBusy(const Ptr< const WifiPpdu > ppdu, Time duration)
Notify PHY state helper to switch to CCA busy state,.
Definition: wifi-phy.cc:2065
WifiPhyOperatingChannel m_operatingChannel
Operating channel.
Definition: wifi-phy.h:1439
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:1347
void SetErrorRateModel(const Ptr< ErrorRateModel > model)
Sets the error rate model.
Definition: wifi-phy.cc:632
bool m_channelAccessRequested
Flag if channels access has been requested (used for OBSS_PD SR)
Definition: wifi-phy.h:1466
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:1433
Time GetSlot() const
Return the slot duration for this PHY.
Definition: wifi-phy.cc:786
void SetMaxSupportedRxSpatialStreams(uint8_t streams)
Definition: wifi-phy.cc:1283
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:2168
void Configure80211g()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11g standard.
Definition: wifi-phy.cc:848
uint8_t GetPrimary20Index() const
Definition: wifi-phy.cc:1032
void NotifyTxEnd(WifiConstPsduMap psdus)
Public method used to fire a PhyTxEnd trace.
Definition: wifi-phy.cc:1530
uint16_t GetChannelWidth() const
Definition: wifi-phy.cc:1026
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:1221
uint8_t GetNumberOfAntennas() const
Definition: wifi-phy.cc:1245
Time m_slot
Slot duration.
Definition: wifi-phy.h:1443
double m_powerDensityLimit
the power density limit (dBm/MHz)
Definition: wifi-phy.h:1459
Time GetDelayUntilIdle()
Definition: wifi-phy.cc:2040
double GetRxSensitivity() const
Return the receive sensitivity threshold (dBm).
Definition: wifi-phy.cc:479
bool GetShortPhyPreambleSupported() const
Return whether short PHY preamble is supported.
Definition: wifi-phy.cc:594
void SetSifs(Time sifs)
Set the Short Interframe Space (SIFS) for this PHY.
Definition: wifi-phy.cc:768
std::list< uint8_t > GetBssMembershipSelectorList() const
The WifiPhy::BssMembershipSelector() method is used (e.g., by a WifiRemoteStationManager) to determin...
Definition: wifi-phy.cc:1301
void Configure80211n()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11n standard.
Definition: wifi-phy.cc:891
EventId m_endPhyRxEvent
the end of PHY receive event
Definition: wifi-phy.h:1216
double GetTxGain() const
Return the transmission gain (dB).
Definition: wifi-phy.cc:568
double m_txPowerBaseDbm
Minimum transmission power (dBm)
Definition: wifi-phy.h:1456
Time GetDelayUntilChannelSwitch()
Perform any actions necessary when user changes operating channel after initialization.
Definition: wifi-phy.cc:1101
void Configure80211be()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11be standard.
Definition: wifi-phy.cc:933
void NotifyRxDrop(Ptr< const WifiPsdu > psdu, WifiPhyRxfailureReason reason)
Public method used to fire a PhyRxDrop trace.
Definition: wifi-phy.cc:1581
bool IsStateRx() const
Definition: wifi-phy.cc:2010
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:1896
Time GetSifs() const
Return the Short Interframe Space (SIFS) for this PHY.
Definition: wifi-phy.cc:774
uint16_t GetFrequency() const
Definition: wifi-phy.cc:1014
Ptr< MobilityModel > GetMobility() const
Return the mobility model this PHY is associated with.
Definition: wifi-phy.cc:618
uint16_t GetNMcs() const
Definition: wifi-phy.cc:1942
Time m_blockAckTxTime
estimated BlockAck TX time
Definition: wifi-phy.h:1446
uint8_t GetPrimaryChannelNumber(uint16_t primaryChannelWidth) const
Get channel number of the primary channel.
Definition: wifi-phy.cc:2202
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:2109
double m_txPowerMaxMimo
MIMO maximum transmit power due to OBSS PD SR power restriction (dBm)
Definition: wifi-phy.h:1465
void ResumeFromSleep()
Resume from sleep mode.
Definition: wifi-phy.cc:1365
static Time GetPreambleDetectionDuration()
Definition: wifi-phy.cc:1421
void Configure80211p()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11p standard.
Definition: wifi-phy.cc:861
void AbortCurrentReception(WifiPhyRxfailureReason reason)
Due to newly arrived signal, the current reception cannot be continued and has to be aborted.
Definition: wifi-phy.cc:2072
Ptr< FrameCaptureModel > m_frameCaptureModel
Frame capture model.
Definition: wifi-phy.h:1481
TracedCallback< Ptr< const Packet > > m_phyRxEndTrace
The trace source fired when a packet ends the reception process from the medium.
Definition: wifi-phy.h:1379
void NotifyRxBegin(Ptr< const WifiPsdu > psdu, const RxPowerWattPerChannelBand &rxPowersW)
Public method used to fire a PhyRxBegin trace.
Definition: wifi-phy.cc:1557
Time GetChannelSwitchDelay() const
Definition: wifi-phy.cc:683
virtual std::tuple< double, double, double > GetTxMaskRejectionParams() const =0
void SetMaxSupportedTxSpatialStreams(uint8_t streams)
Definition: wifi-phy.cc:1251
Time m_sifs
Short Interframe Space (SIFS) duration.
Definition: wifi-phy.h:1442
void SetReceiveErrorCallback(RxErrorCallback callback)
Definition: wifi-phy.cc:448
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:2034
uint8_t GetMaxSupportedRxSpatialStreams() const
Definition: wifi-phy.cc:1295
void(* PsduTxBeginCallback)(WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
TracedCallback signature for PSDU transmit events.
Definition: wifi-phy.h:692
double GetTxPowerEnd() const
Return the maximum available transmission power level (dBm).
Definition: wifi-phy.cc:542
virtual void ConfigureStandard(WifiStandard standard)
Configure the PHY-level parameters for different Wi-Fi standard.
Definition: wifi-phy.cc:941
void SetPostReceptionErrorModel(const Ptr< ErrorModel > em)
Attach a receive ErrorModel to the WifiPhy.
Definition: wifi-phy.cc:639
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:1991
void PushMcs(WifiMode mode)
Add the given MCS to the device MCS set.
uint8_t m_numberOfAntennas
Number of transmitters.
Definition: wifi-phy.h:1470
ChannelTuple m_channelSettings
Store operating channel settings until initialization.
Definition: wifi-phy.h:1438
uint32_t m_txMpduReferenceNumber
A-MPDU reference number to identify all transmitted subframes belonging to the same received A-MPDU.
Definition: wifi-phy.h:1211
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
Definition: wifi-phy.cc:1480
static uint32_t GetMaxPsduSize(WifiModulationClass modulation)
Get the maximum PSDU size in bytes for the given modulation class.
Definition: wifi-phy.cc:1509
Ptr< WifiPhyStateHelper > GetState() const
Return the WifiPhyStateHelper of this PHY.
Definition: wifi-phy.cc:436
void NotifyTxBegin(WifiConstPsduMap psdus, double txPowerW)
Public method used to fire a PhyTxBegin trace.
Definition: wifi-phy.cc:1515
void EndReceiveInterBss()
For HE receptions only, check and possibly modify the transmit power restriction state at the end of ...
Definition: wifi-phy.cc:1850
void SetSleepMode()
Put in sleep mode.
Definition: wifi-phy.cc:1316
void SetShortPhyPreambleSupported(bool preamble)
Enable or disable short PHY preamble.
Definition: wifi-phy.cc:587
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:548
WifiPhyBand m_band
WifiPhyBand.
Definition: wifi-phy.h:1437
void SetRxSensitivity(double threshold)
Sets the receive sensitivity threshold (dBm).
Definition: wifi-phy.cc:472
static const Ptr< const PhyEntity > GetStaticPhyEntity(WifiModulationClass modulation)
Get the implemented PHY entity corresponding to the modulation class.
Definition: wifi-phy.cc:695
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:671
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:1425
virtual WifiSpectrumBand ConvertHeRuSubcarriers(uint16_t bandWidth, uint16_t guardBandwidth, HeRu::SubcarrierRange range, uint8_t bandIndex=0) const
Definition: wifi-phy.cc:1839
double m_txPowerMaxSiso
SISO maximum transmit power due to OBSS PD SR power restriction (dBm)
Definition: wifi-phy.h:1463
std::map< WifiModulationClass, Ptr< PhyEntity > > m_phyEntities
This map holds the supported PHY entities.
Definition: wifi-phy.h:1244
virtual void StartTx(Ptr< const WifiPpdu > ppdu)=0
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:755
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:1406
Ptr< ErrorModel > m_postReceptionErrorModel
Error model for receive packet events.
Definition: wifi-phy.h:1484
EventId m_endTxEvent
the end of transmit event
Definition: wifi-phy.h:1217
double GetRxGain() const
Return the reception gain (dB).
Definition: wifi-phy.cc:581
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:1687
static std::map< WifiModulationClass, Ptr< PhyEntity > > & GetStaticPhyEntities()
Definition: wifi-phy.cc:429
void SetSlot(Time slot)
Set the slot duration for this PHY.
Definition: wifi-phy.cc:780
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:1062
WifiPhyBand GetPhyBand() const
Get the configured Wi-Fi band.
Definition: wifi-phy.cc:996
double m_ccaSensitivityThresholdW
Clear channel assessment (CCA) modulation and coding rate sensitivity threshold in watts.
Definition: wifi-phy.h:1451
Ptr< Event > m_currentEvent
Hold the current event.
Definition: wifi-phy.h:1219
Time GetLastRxStartTime() const
Return the start time of the last received packet.
Definition: wifi-phy.cc:2046
WifiMode GetDefaultMode() const
Get the default WifiMode supported by the PHY.
Definition: wifi-phy.cc:1880
void SetCcaSensitivityThreshold(double threshold)
Sets the CCA sensitivity threshold (dBm).
Definition: wifi-phy.cc:498
double m_ccaEdThresholdW
Clear channel assessment (CCA) energy detection (ED) threshold in watts.
Definition: wifi-phy.h:1449
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:1647
Ptr< PhyEntity > GetPhyEntity(WifiModulationClass modulation) const
Get the supported PHY entity corresponding to the modulation class.
Definition: wifi-phy.cc:704
virtual WifiSpectrumBand GetBand(uint16_t bandWidth, uint8_t bandIndex=0)
Get the start band index and the stop band index for a given band.
Definition: wifi-phy.cc:2175
uint8_t GetChannelNumber() const
Return current channel number.
Definition: wifi-phy.cc:1020
TracedCallback< Ptr< const Packet > > m_phyTxEndTrace
The trace source fired when a packet ends the transmission process on the medium.
Definition: wifi-phy.h:1339
uint64_t m_previouslyRxPpduUid
UID of the previously received PPDU, reset to UINT64_MAX upon transmission.
Definition: wifi-phy.h:1224
uint32_t m_rxMpduReferenceNumber
A-MPDU reference number to identify all received subframes belonging to the same received A-MPDU.
Definition: wifi-phy.h:1213
void SetWifiRadioEnergyModel(const Ptr< WifiRadioEnergyModel > wifiRadioEnergyModel)
Sets the wifi radio energy model.
Definition: wifi-phy.cc:658
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:1324
void SetDevice(const Ptr< WifiNetDevice > device)
Sets the device this PHY is associated with.
Definition: wifi-phy.cc:600
Ptr< PreambleDetectionModel > m_preambleDetectionModel
Preamble detection model.
Definition: wifi-phy.h:1482
void SetTxPowerEnd(double end)
Sets the maximum available transmission power level (dBm).
Definition: wifi-phy.cc:535
Time GetPifs() const
Return the PCF Interframe Space (PIFS) for this PHY.
Definition: wifi-phy.cc:798
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:745
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:632
void NotifyRxEnd(Ptr< const WifiPsdu > psdu)
Public method used to fire a PhyRxEnd trace.
Definition: wifi-phy.cc:1569
void StartReceivePreamble(Ptr< const WifiPpdu > ppdu, RxPowerWattPerChannelBand &rxPowersW, Time rxDuration)
Start receiving the PHY preamble of a PPDU (i.e.
Definition: wifi-phy.cc:1817
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:1331
double m_txGainDb
Transmission gain (dB)
Definition: wifi-phy.h:1454
bool IsStateSleep() const
Definition: wifi-phy.cc:2028
Ptr< WifiNetDevice > GetDevice() const
Return the device this PHY is associated with.
Definition: wifi-phy.cc:606
WifiStandard m_standard
WifiStandard.
Definition: wifi-phy.h:1436
double GetPowerDbm(uint8_t power) const
Get the power of the given power level in dBm.
Definition: wifi-phy.cc:664
uint8_t m_nTxPower
Number of available transmission power levels.
Definition: wifi-phy.h:1458
void DoDispose() override
Destructor implementation.
Definition: wifi-phy.cc:392
bool IsStateSwitching() const
Definition: wifi-phy.cc:2022
virtual void DoChannelSwitch()
Actually switch channel based on the stored channel settings.
Definition: wifi-phy.cc:1152
void SetOffMode()
Put in off mode.
Definition: wifi-phy.cc:1350
double m_noiseFigureDb
The noise figure in dB.
Definition: wifi-phy.h:1474
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:1386
void SetPreambleDetectionModel(const Ptr< PreambleDetectionModel > preambleDetectionModel)
Sets the preamble detection model.
Definition: wifi-phy.cc:652
void RebuildMcsMap()
Rebuild the mapping of MCS values to indices in the device MCS set.
void SetPifs(Time pifs)
Set the PCF Interframe Space (PIFS) for this PHY.
Definition: wifi-phy.cc:792
void Configure80211b()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11b standard.
Definition: wifi-phy.cc:831
static Time GetStartOfPacketDuration(const WifiTxVector &txVector)
Definition: wifi-phy.cc:1427
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:1050
void UnregisterListener(WifiPhyListener *listener)
Definition: wifi-phy.cc:460
void SetRxGain(double gain)
Sets the reception gain (dB).
Definition: wifi-phy.cc:574
void SetMobility(const Ptr< MobilityModel > mobility)
assign a mobility model to this device
Definition: wifi-phy.cc:612
void SetTxGain(double gain)
Sets the transmission gain (dB).
Definition: wifi-phy.cc:561
uint8_t m_rxSpatialStreams
Number of supported RX spatial streams.
Definition: wifi-phy.h:1472
double m_txPowerEndDbm
Maximum transmission power (dBm)
Definition: wifi-phy.h:1457
double CalculateSnr(const WifiTxVector &txVector, double ber) const
Definition: wifi-phy.cc:689
void SetFixedPhyBand(bool enable)
Configure whether it is prohibited to change PHY band after initialization.
Definition: wifi-phy.cc:1038
void(* PhyRxBeginTracedCallback)(Ptr< const Packet > packet, RxPowerWattPerChannelBand rxPowersW)
TracedCallback signature for PhyRxBegin trace source.
Definition: wifi-phy.h:702
~WifiPhy() override
Definition: wifi-phy.cc:361
void Configure80211ac()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11ac standard.
Definition: wifi-phy.cc:910
bool HasFixedPhyBand() const
Definition: wifi-phy.cc:1044
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:1355
void RegisterListener(WifiPhyListener *listener)
Definition: wifi-phy.cc:454
Ptr< WifiNetDevice > m_device
Pointer to the device.
Definition: wifi-phy.h:1478
Ptr< InterferenceHelper > m_interference
Pointer to a helper responsible for interference computations.
Definition: wifi-phy.h:1206
void DoInitialize() override
Initialize() implementation.
Definition: wifi-phy.cc:367
bool m_shortPreamble
Flag if short PHY preamble is supported.
Definition: wifi-phy.h:1469
Time m_pifs
PCF Interframe Space (PIFS) duration.
Definition: wifi-phy.h:1444
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:511
double GetTxPowerStart() const
Return the minimum available transmission power level (dBm).
Definition: wifi-phy.cc:529
double GetTxPowerForTransmission(Ptr< const WifiPpdu > ppdu) const
Compute the transmit power for the next transmission.
Definition: wifi-phy.cc:2132
void(* PhyRxPayloadBeginTracedCallback)(WifiTxVector txVector, Time psduDuration)
TracedCallback signature for start of PSDU reception events.
Definition: wifi-phy.h:711
WifiStandard GetStandard() const
Get the configured Wi-Fi standard.
Definition: wifi-phy.cc:1002
void SetCapabilitiesChangedCallback(Callback< void > callback)
Definition: wifi-phy.cc:466
void SetReceiveOkCallback(RxOkCallback callback)
Definition: wifi-phy.cc:442
void SetFrameCaptureModel(const Ptr< FrameCaptureModel > frameCaptureModel)
Sets the frame capture model.
Definition: wifi-phy.cc:646
void NotifyChannelAccessRequested()
Notify the PHY that an access to the channel was requested.
Definition: wifi-phy.cc:1860
void ResumeFromOff()
Resume from off mode.
Definition: wifi-phy.cc:1393
bool m_powerRestricted
Flag whether transmit power is restricted by OBSS PD SR.
Definition: wifi-phy.h:1461
Callback< void > m_capabilitiesChangedCallback
Callback when PHY capabilities changed.
Definition: wifi-phy.h:1487
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:1593
Ptr< PhyEntity > GetPhyEntityForPpdu(const Ptr< const WifiPpdu > ppdu) const
Get the supported PHY entity to use for a received PPDU.
Definition: wifi-phy.cc:725
Time GetAckTxTime() const
Return the estimated Ack TX time for this PHY.
Definition: wifi-phy.cc:804
uint64_t GetPreviouslyRxPpduUid() const
Definition: wifi-phy.cc:1798
void Reset()
Reset data upon end of TX or RX.
Definition: wifi-phy.cc:1804
TracedCallback< WifiTxVector, Time > m_phyRxPayloadBeginTrace
The trace source fired when the reception of the PHY payload (PSDU) begins.
Definition: wifi-phy.h:1371
Time GetLastRxEndTime() const
Return the end time of the last received packet.
Definition: wifi-phy.cc:2052
std::tuple< uint8_t, uint16_t, int, uint8_t > ChannelTuple
Tuple identifying an operating channel.
Definition: wifi-phy.h:870
Time m_timeLastPreambleDetected
Record the time the last preamble was detected.
Definition: wifi-phy.h:1485
uint8_t GetMaxSupportedTxSpatialStreams() const
Definition: wifi-phy.cc:1277
void Configure80211a()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11a standard.
Definition: wifi-phy.cc:816
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:1956
std::list< WifiMode > GetModeList() const
The WifiPhy::GetModeList() method is used (e.g., by a WifiRemoteStationManager) to determine the set ...
Definition: wifi-phy.cc:1907
void SwitchMaybeToCcaBusy(const Ptr< const WifiPpdu > ppdu)
Check if PHY state should move to CCA busy state based on current state of interference tracker.
Definition: wifi-phy.cc:2058
double m_rxSensitivityW
Receive sensitivity threshold in watts.
Definition: wifi-phy.h:1448
const WifiPhyOperatingChannel & GetOperatingChannel() const
Get a const reference to the operating channel.
Definition: wifi-phy.cc:1008
double GetCcaSensitivityThreshold() const
Return the CCA sensitivity threshold (dBm).
Definition: wifi-phy.cc:505
bool m_fixedPhyBand
True to prohibit changing PHY band after initialization.
Definition: wifi-phy.h:1440
Ptr< PhyEntity > GetLatestPhyEntity() const
Get the latest PHY entity supported by this PHY instance.
Definition: wifi-phy.cc:719
void SetTxPowerStart(double start)
Sets the minimum available transmission power level (dBm).
Definition: wifi-phy.cc:522
uint8_t GetNTxPower() const
Return the number of available transmission power levels.
Definition: wifi-phy.cc:555
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:2184
static Time CalculatePhyPreambleAndHeaderDuration(const WifiTxVector &txVector)
Definition: wifi-phy.cc:1473
bool IsModeSupported(WifiMode mode) const
Check if the given WifiMode is supported by the PHY.
Definition: wifi-phy.cc:1867
Time m_ackTxTime
estimated Ack TX time
Definition: wifi-phy.h:1445
void NotifyTxDrop(Ptr< const WifiPsdu > psdu)
Public method used to fire a PhyTxDrop trace.
Definition: wifi-phy.cc:1545
receive notifications about PHY events.
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< uint32_t, uint32_t > WifiSpectrumBand
typedef for a pair of start and stop sub-band indexes
std::map< WifiSpectrumBand, double > RxPowerWattPerChannelBand
A map of the received power (Watts) for each band.
Definition: phy-entity.h:78
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:129
mobility
Definition: third.py:96
Declaration of:
MpduInfo structure.
Definition: phy-entity.h:63
RxSignalInfo structure containing info on the received signal.
Definition: phy-entity.h:70
SignalNoiseDbm structure.
Definition: phy-entity.h:56
#define SU_STA_ID
Definition: wifi-mode.h:34