A Discrete-Event Network Simulator
API
wifi-phy.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2005,2006 INRIA
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  * S├ębastien Deronne <sebastien.deronne@gmail.com>
20  */
21 
22 #ifndef WIFI_PHY_H
23 #define WIFI_PHY_H
24 
25 #include "ns3/error-model.h"
26 #include "wifi-standards.h"
27 #include "interference-helper.h"
28 #include "wifi-phy-state-helper.h"
29 #include "phy-entity.h"
31 
32 namespace ns3 {
33 
34 class Channel;
35 class NetDevice;
36 class MobilityModel;
37 class WifiPhyStateHelper;
38 class FrameCaptureModel;
39 class PreambleDetectionModel;
40 class WifiRadioEnergyModel;
41 class UniformRandomVariable;
42 
48 class WifiPhy : public Object
49 {
50 public:
51  friend class PhyEntity;
56  static TypeId GetTypeId (void);
57 
58  WifiPhy ();
59  virtual ~WifiPhy ();
60 
61  static const std::set<FrequencyChannelInfo> m_frequencyChannels;
62 
68  Ptr<WifiPhyStateHelper> GetState (void) const;
69 
74  void SetReceiveOkCallback (RxOkCallback callback);
80 
87  void RegisterListener (WifiPhyListener *listener);
94  void UnregisterListener (WifiPhyListener *listener);
95 
100 
108  void StartReceivePreamble (Ptr<WifiPpdu> ppdu, RxPowerWattPerChannelBand rxPowersW, Time rxDuration);
109 
115  void ResetReceive (Ptr<Event> event);
116 
121  void EndReceiveInterBss (void);
122 
133 
145  void Send (Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector);
152  void Send (WifiConstPsduMap psdus, WifiTxVector txVector);
153 
157  virtual void StartTx (Ptr<WifiPpdu> ppdu) = 0;
158 
162  void SetSleepMode (void);
166  void ResumeFromSleep (void);
170  void SetOffMode (void);
174  void ResumeFromOff (void);
175 
179  bool IsStateIdle (void) const;
183  bool IsStateCcaBusy (void) const;
187  bool IsStateRx (void) const;
191  bool IsStateTx (void) const;
195  bool IsStateSwitching (void) const;
199  bool IsStateSleep (void) const;
203  bool IsStateOff (void) const;
204 
211  Time GetDelayUntilIdle (void);
212 
218  Time GetLastRxStartTime (void) const;
224  Time GetLastRxEndTime (void) const;
225 
234  static Time CalculateTxDuration (uint32_t size, const WifiTxVector& txVector, WifiPhyBand band,
235  uint16_t staId = SU_STA_ID);
250  static Time CalculateTxDuration (Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector, WifiPhyBand band);
258  static Time CalculateTxDuration (WifiConstPsduMap psduMap, const WifiTxVector& txVector, WifiPhyBand band);
259 
275  static Time GetPpduFieldDuration (WifiPpduField field, const WifiTxVector& txVector);
279  static Time GetPreambleDetectionDuration (void);
289  static Time GetPayloadDuration (uint32_t size, const WifiTxVector& txVector, WifiPhyBand band, MpduType mpdutype = NORMAL_MPDU,
290  uint16_t staId = SU_STA_ID);
307  static Time GetPayloadDuration (uint32_t size, const WifiTxVector& txVector, WifiPhyBand band, MpduType mpdutype,
308  bool incFlag, uint32_t &totalAmpduSize, double &totalAmpduNumSymbols,
309  uint16_t staId);
315  static Time GetStartOfPacketDuration (const WifiTxVector& txVector);
316 
331  std::list<WifiMode> GetModeList (void) const;
341  std::list<WifiMode> GetModeList (WifiModulationClass modulation) const;
350  bool IsModeSupported (WifiMode mode) const;
358  WifiMode GetDefaultMode (void) const;
368  bool IsMcsSupported (WifiModulationClass modulation, uint8_t mcs) const;
369 
377  double CalculateSnr (const WifiTxVector& txVector, double ber) const;
378 
384  void SetSifs (Time sifs);
390  Time GetSifs (void) const;
396  void SetSlot (Time slot);
402  Time GetSlot (void) const;
408  void SetPifs (Time pifs);
414  Time GetPifs (void) const;
420  Time GetAckTxTime (void) const;
426  Time GetBlockAckTxTime (void) const;
427 
434  static uint32_t GetMaxPsduSize (WifiModulationClass modulation);
435 
446  std::list<uint8_t> GetBssMembershipSelectorList (void) const;
452  uint16_t GetNMcs (void) const;
461  std::list<WifiMode> GetMcsList (void) const;
471  std::list<WifiMode> GetMcsList (WifiModulationClass modulation) const;
482  WifiMode GetMcs (WifiModulationClass modulation, uint8_t mcs) const;
483 
506  virtual void SetChannelNumber (uint8_t id);
512  uint8_t GetChannelNumber (void) const;
516  Time GetChannelSwitchDelay (void) const;
517 
524  virtual void ConfigureStandardAndBand (WifiPhyStandard standard, WifiPhyBand band);
525 
531  WifiPhyStandard GetPhyStandard (void) const;
532 
538  WifiPhyBand GetPhyBand (void) const;
539 
545  const WifiPhyOperatingChannel& GetOperatingChannel (void) const;
546 
552  virtual Ptr<Channel> GetChannel (void) const = 0;
553 
561  void NotifyTxBegin (WifiConstPsduMap psdus, double txPowerW);
568  void NotifyTxEnd (WifiConstPsduMap psdus);
575  void NotifyTxDrop (Ptr<const WifiPsdu> psdu);
590  void NotifyRxEnd (Ptr<const WifiPsdu> psdu);
599 
621  uint16_t channelFreqMhz,
622  WifiTxVector txVector,
623  SignalNoiseDbm signalNoise,
624  std::vector<bool> statusPerMpdu,
625  uint16_t staId = SU_STA_ID);
626 
648  uint16_t channelFreqMhz,
649  WifiTxVector txVector,
650  MpduInfo aMpdu,
651  SignalNoiseDbm signalNoise,
652  uint16_t staId);
653 
668  uint16_t channelFreqMhz,
669  WifiTxVector txVector,
670  uint16_t staId = SU_STA_ID);
671 
685  typedef void (* MonitorSnifferTxCallback)(const Ptr<const Packet> packet,
686  uint16_t channelFreqMhz,
687  WifiTxVector txVector,
688  MpduInfo aMpdu,
689  uint16_t staId);
690 
698  typedef void (* PsduTxBeginCallback)(WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW);
699 
706  typedef void (* PhyRxPayloadBeginTracedCallback)(WifiTxVector txVector, Time psduDuration);
707 
716  virtual int64_t AssignStreams (int64_t stream);
717 
725  void SetRxSensitivity (double threshold);
731  double GetRxSensitivity (void) const;
739  void SetCcaEdThreshold (double threshold);
745  double GetCcaEdThreshold (void) const;
751  void SetRxNoiseFigure (double noiseFigureDb);
757  void SetTxPowerStart (double start);
763  double GetTxPowerStart (void) const;
769  void SetTxPowerEnd (double end);
775  double GetTxPowerEnd (void) const;
783  void SetNTxPower (uint8_t n);
789  uint8_t GetNTxPower (void) const;
795  void SetTxGain (double gain);
801  double GetTxGain (void) const;
807  void SetRxGain (double gain);
813  double GetRxGain (void) const;
814 
820  void SetDevice (const Ptr<NetDevice> device);
826  Ptr<NetDevice> GetDevice (void) const;
847  Ptr<MobilityModel> GetMobility (void) const;
848 
859  void SetOperatingChannel (uint8_t number, uint16_t frequency, uint16_t width);
875  virtual void SetFrequency (uint16_t freq);
879  uint16_t GetFrequency (void) const;
886  void SetPrimary20Index (uint8_t index);
890  void SetNumberOfAntennas (uint8_t antennas);
894  uint8_t GetNumberOfAntennas (void) const;
898  void SetMaxSupportedTxSpatialStreams (uint8_t streams);
902  uint8_t GetMaxSupportedTxSpatialStreams (void) const;
906  void SetMaxSupportedRxSpatialStreams (uint8_t streams);
910  uint8_t GetMaxSupportedRxSpatialStreams (void) const;
916  void SetShortPhyPreambleSupported (bool preamble);
922  bool GetShortPhyPreambleSupported (void) const;
923 
929  void SetErrorRateModel (const Ptr<ErrorRateModel> rate);
947  void SetFrameCaptureModel (const Ptr<FrameCaptureModel> frameCaptureModel);
953  void SetPreambleDetectionModel (const Ptr<PreambleDetectionModel> preambleDetectionModel);
959  void SetWifiRadioEnergyModel (const Ptr<WifiRadioEnergyModel> wifiRadioEnergyModel);
960 
964  uint16_t GetChannelWidth (void) const;
979  virtual void SetChannelWidth (uint16_t channelWidth);
983  void AddSupportedChannelWidth (uint16_t width);
987  std::vector<uint16_t> GetSupportedChannelWidthSet (void) const;
988 
997  double GetPowerDbm (uint8_t power) const;
998 
1006  void ResetCca (bool powerRestricted, double txPowerMaxSiso = 0, double txPowerMaxMimo = 0);
1015  double GetTxPowerForTransmission (Ptr<const WifiPpdu> ppdu) const;
1023  void NotifyChannelAccessRequested (void);
1024 
1025 
1036  virtual WifiSpectrumBand ConvertHeRuSubcarriers (uint16_t bandWidth, uint16_t guardBandwidth,
1037  HeRu::SubcarrierRange range, uint8_t bandIndex = 0) const;
1038 
1048  static void AddStaticPhyEntity (WifiModulationClass modulation, Ptr<PhyEntity> phyEntity);
1049 
1059 
1067  Ptr<PhyEntity> GetPhyEntity (WifiModulationClass modulation) const;
1068 
1072  uint64_t GetPreviouslyRxPpduUid (void) const;
1073 
1087  virtual uint16_t GetGuardBandwidth (uint16_t currentChannelWidth) const = 0;
1096  virtual std::tuple<double, double, double> GetTxMaskRejectionParams (void) const = 0;
1097 
1098 protected:
1099  // Inherited
1100  virtual void DoDispose (void);
1101 
1102  /*
1103  * Reset data upon end of TX or RX
1104  */
1105  void Reset (void);
1106 
1116  Time DoChannelSwitch (void);
1117 
1126  void SwitchMaybeToCcaBusy (uint16_t channelWidth);
1127 
1136  uint16_t GetMeasurementChannelWidth (const Ptr<const WifiPpdu> ppdu) const;
1137 
1146  virtual WifiSpectrumBand GetBand (uint16_t bandWidth, uint8_t bandIndex = 0);
1147 
1159  WifiSpectrumBand GetPrimaryBand (uint16_t bandWidth);
1160 
1171  void AddPhyEntity (WifiModulationClass modulation, Ptr<PhyEntity> phyEntity);
1172 
1176 
1179 
1182 
1184  std::map <std::pair<uint64_t /* UID*/, WifiPreamble>, Ptr<Event> > m_currentPreambleEvents;
1185 
1187 
1205  std::map<WifiModulationClass, Ptr<PhyEntity> > m_phyEntities;
1206 
1207 
1208 private:
1213  void Configure80211a (void);
1218  void Configure80211b (void);
1223  void Configure80211g (void);
1228  void Configure80211p (void);
1233  void Configure80211n (void);
1238  void Configure80211ac (void);
1243  void Configure80211ax (void);
1248  void ConfigureHtDeviceMcsSet (void);
1254  void PushMcs (WifiMode mode);
1258  void RebuildMcsMap (void);
1259 
1266 
1271  void MaybeCcaBusyDuration (uint16_t channelWidth);
1272 
1280 
1295 
1303 
1311 
1319 
1335 
1343 
1350 
1363  TracedCallback<Ptr<const Packet>, uint16_t /* frequency (MHz) */, WifiTxVector, MpduInfo, SignalNoiseDbm, uint16_t /* STA-ID*/> m_phyMonitorSniffRxTrace;
1364 
1377  TracedCallback<Ptr<const Packet>, uint16_t /* frequency (MHz) */, WifiTxVector, MpduInfo, uint16_t /* STA-ID*/> m_phyMonitorSniffTxTrace;
1378 
1385  static std::map<WifiModulationClass, Ptr<PhyEntity> > m_staticPhyEntities;
1386 
1393 
1395  std::vector<uint16_t> m_supportedChannelWidthSet;
1396 
1402 
1405  double m_txGainDb;
1406  double m_rxGainDb;
1409  uint8_t m_nTxPower;
1411 
1416 
1421 
1423 
1426 
1432 
1434 };
1435 
1441 std::ostream& operator<< (std::ostream& os, RxSignalInfo rxSignalInfo);
1442 
1443 } //namespace ns3
1444 
1445 #endif /* WIFI_PHY_H */
WifiModulationClass
This enumeration defines the modulation classes per (Table 10-6 "Modulation classes"; IEEE 802...
MpduInfo structure.
Definition: phy-entity.h:59
void NotifyRxDrop(Ptr< const WifiPsdu > psdu, WifiPhyRxfailureReason reason)
Public method used to fire a PhyRxDrop trace.
Definition: wifi-phy.cc:1700
Ptr< NetDevice > m_device
Pointer to the device.
Definition: wifi-phy.h:1424
uint8_t GetNTxPower(void) const
Return the number of available transmission power levels.
Definition: wifi-phy.cc:732
uint32_t m_txMpduReferenceNumber
A-MPDU reference number to identify all transmitted subframes belonging to the same received A-MPDU...
Definition: wifi-phy.h:1177
bool IsStateSwitching(void) const
Definition: wifi-phy.cc:2115
void SetPifs(Time pifs)
Set the PCF Interframe Space (PIFS) for this PHY.
Definition: wifi-phy.cc:928
bool IsStateOff(void) const
Definition: wifi-phy.cc:2127
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:1318
static Time GetStartOfPacketDuration(const WifiTxVector &txVector)
Definition: wifi-phy.cc:1580
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
void NotifyTxBegin(WifiConstPsduMap psdus, double txPowerW)
Public method used to fire a PhyTxBegin trace.
Definition: wifi-phy.cc:1643
Ptr< PhyEntity > GetPhyEntity(WifiModulationClass modulation) const
Get the supported PHY entity corresponding to the modulation class, for the WifiPhy instance...
Definition: wifi-phy.cc:878
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
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:725
double m_rxGainDb
Reception gain (dB)
Definition: wifi-phy.h:1406
static std::map< WifiModulationClass, Ptr< PhyEntity > > m_staticPhyEntities
Map of implemented PHY entities.
Definition: wifi-phy.h:1385
double GetRxGain(void) const
Return the reception gain (dB).
Definition: wifi-phy.cc:758
bool IsModeSupported(WifiMode mode) const
Check if the given WifiMode is supported by the PHY.
Definition: wifi-phy.cc:1961
void AddSupportedChannelWidth(uint16_t width)
Definition: wifi-phy.cc:1442
double GetCcaEdThreshold(void) const
Return the CCA threshold (dBm).
Definition: wifi-phy.cc:685
void NotifyTxEnd(WifiConstPsduMap psdus)
Public method used to fire a PhyTxEnd trace.
Definition: wifi-phy.cc:1655
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
double m_txGainDb
Transmission gain (dB)
Definition: wifi-phy.h:1405
void AbortCurrentReception(WifiPhyRxfailureReason reason)
Due to newly arrived signal, the current reception cannot be continued and has to be aborted...
Definition: wifi-phy.cc:2167
virtual ~WifiPhy()
Definition: wifi-phy.cc:590
Time DoChannelSwitch(void)
Perform any actions necessary when user changes operating channel after initialization.
Definition: wifi-phy.cc:1299
void ResumeFromOff(void)
Resume from off mode.
Definition: wifi-phy.cc:1543
Ptr< WifiPhyStateHelper > GetState(void) const
Return the WifiPhyStateHelper of this PHY.
Definition: wifi-phy.cc:629
void ResumeFromSleep(void)
Resume from sleep mode.
Definition: wifi-phy.cc:1512
double m_rxSensitivityW
Receive sensitivity threshold in watts.
Definition: wifi-phy.h:1403
void SetOperatingChannel(uint8_t number, uint16_t frequency, uint16_t width)
Set the operating channel according to the specified parameters.
Definition: wifi-phy.cc:1256
802.11 PHY layer model
Definition: wifi-phy.h:48
WifiPhyBand GetPhyBand(void) const
Get the configured Wi-Fi band.
Definition: wifi-phy.cc:1124
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:2255
Time m_timeLastPreambleDetected
Record the time the last preamble was detected.
Definition: wifi-phy.h:1431
void SetTxGain(double gain)
Sets the transmission gain (dB).
Definition: wifi-phy.cc:738
void Configure80211ax(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11ax standard...
Definition: wifi-phy.cc:1054
handles interference calculations
void SetRxSensitivity(double threshold)
Sets the receive sensitivity threshold (dBm).
Definition: wifi-phy.cc:665
virtual void ConfigureStandardAndBand(WifiPhyStandard standard, WifiPhyBand band)
Configure the PHY-level parameters for different Wi-Fi standard.
Definition: wifi-phy.cc:1069
virtual void DoDispose(void)
Destructor implementation.
Definition: wifi-phy.cc:596
def start()
Definition: core.py:1855
Forward calls to a chain of Callback.
void RebuildMcsMap(void)
Rebuild the mapping of MCS values to indices in the device MCS set.
double m_powerDensityLimit
the power density limit (dBm/MHz)
Definition: wifi-phy.h:1410
std::list< WifiMode > GetModeList(void) const
The WifiPhy::GetModeList() method is used (e.g., by a WifiRemoteStationManager) to determine the set ...
Definition: wifi-phy.cc:2000
TracedCallback< Ptr< const Packet > > m_phyRxEndTrace
The trace source fired when a packet ends the reception process from the medium.
Definition: wifi-phy.h:1342
WifiSpectrumBand GetPrimaryBand(uint16_t bandWidth)
If the operating channel width is a multiple of 20 MHz, return the start band index and the stop band...
Definition: wifi-phy.cc:2283
bool IsStateCcaBusy(void) const
Definition: wifi-phy.cc:2091
void SetReceiveErrorCallback(RxErrorCallback callback)
Definition: wifi-phy.cc:641
WifiPhyRxfailureReason
Enumeration of the possible reception failure reasons.
void SetSlot(Time slot)
Set the slot duration for this PHY.
Definition: wifi-phy.cc:916
void SetShortPhyPreambleSupported(bool preamble)
Enable or disable short PHY preamble.
Definition: wifi-phy.cc:764
TracedCallback< WifiTxVector, Time > m_phyRxPayloadBeginTrace
The trace source fired when the reception of the PHY payload (PSDU) begins.
Definition: wifi-phy.h:1334
EventId m_endPhyRxEvent
the end of PHY receive event
Definition: wifi-phy.h:1180
void SetMobility(const Ptr< MobilityModel > mobility)
assign a mobility model to this device
Definition: wifi-phy.cc:789
void UnregisterListener(WifiPhyListener *listener)
Definition: wifi-phy.cc:653
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:691
bool IsStateIdle(void) const
Definition: wifi-phy.cc:2097
Class that keeps track of all information about the current PHY operating channel.
void Reset(void)
Definition: wifi-phy.cc:1878
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:1349
virtual WifiSpectrumBand ConvertHeRuSubcarriers(uint16_t bandWidth, uint16_t guardBandwidth, HeRu::SubcarrierRange range, uint8_t bandIndex=0) const
Definition: wifi-phy.cc:1924
uint8_t m_nTxPower
Number of available transmission power levels.
Definition: wifi-phy.h:1409
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:1363
std::list< WifiMode > GetMcsList(void) const
The WifiPhy::GetMcsList() method is used (e.g., by a WifiRemoteStationManager) to determine the set o...
Definition: wifi-phy.cc:2049
virtual void SetFrequency(uint16_t freq)
If the operating channel for this object has not been set yet, the given center frequency is saved an...
Definition: wifi-phy.cc:1143
double CalculateSnr(const WifiTxVector &txVector, double ber) const
Definition: wifi-phy.cc:864
void SetFrameCaptureModel(const Ptr< FrameCaptureModel > frameCaptureModel)
Sets the frame capture model.
Definition: wifi-phy.cc:822
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:2203
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:47
uint8_t m_initialChannelNumber
Store channel number until initialization.
Definition: wifi-phy.h:1390
void NotifyRxEnd(Ptr< const WifiPsdu > psdu)
Public method used to fire a PhyRxEnd trace.
Definition: wifi-phy.cc:1688
bool IsStateSleep(void) const
Definition: wifi-phy.cc:2121
Declaration of:
MpduType
The type of an MPDU.
std::pair< int16_t, int16_t > SubcarrierRange
(lowest index, highest index) pair defining a subcarrier range
Definition: he-ru.h:53
double GetRxSensitivity(void) const
Return the receive sensitivity threshold (dBm).
Definition: wifi-phy.cc:672
mobility
Definition: third.py:108
virtual Ptr< Channel > GetChannel(void) const =0
Return the Channel this WifiPhy is connected to.
void SetDevice(const Ptr< NetDevice > device)
Sets the device this PHY is associated with.
Definition: wifi-phy.cc:777
uint16_t GetChannelWidth(void) const
Definition: wifi-phy.cc:1233
bool m_powerRestricted
Flag whether transmit power is restricted by OBSS PD SR.
Definition: wifi-phy.h:1412
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:137
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
Definition: wifi-phy.cc:1616
void SwitchMaybeToCcaBusy(uint16_t channelWidth)
Check if PHY state should move to CCA busy state based on current state of interference tracker...
Definition: wifi-phy.cc:2151
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
WifiPhyStandard
Identifies the PHY specification that a Wifi device is configured to use.
The MPDU is not part of an A-MPDU.
RxSignalInfo structure containing info on the received signal.
Definition: phy-entity.h:66
static const Ptr< const PhyEntity > GetStaticPhyEntity(WifiModulationClass modulation)
Get the implemented PHY entity corresponding to the modulation class.
Definition: wifi-phy.cc:870
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:2084
Time m_slot
Slot duration.
Definition: wifi-phy.h:1398
Ptr< MobilityModel > m_mobility
Pointer to the mobility model.
Definition: wifi-phy.h:1425
void SetPrimary20Index(uint8_t index)
Set the index of the primary 20 MHz channel (0 indicates the 20 MHz subchannel with the lowest center...
Definition: wifi-phy.cc:1239
Time m_blockAckTxTime
estimated BlockAck TX time
Definition: wifi-phy.h:1401
receive notifications about PHY events.
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:1310
double m_txPowerMaxMimo
MIMO maximum transmit power due to OBSS PD SR power restriction (dBm)
Definition: wifi-phy.h:1414
bool m_shortPreamble
Flag if short PHY preamble is supported.
Definition: wifi-phy.h:1417
virtual std::tuple< double, double, double > GetTxMaskRejectionParams(void) const =0
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:1768
EventId m_endTxEvent
the end of transmit event
Definition: wifi-phy.h:1181
Ptr< WifiRadioEnergyModel > m_wifiRadioEnergyModel
Wifi radio energy model.
Definition: wifi-phy.h:1429
void SetTxPowerEnd(double end)
Sets the maximum available transmission power level (dBm).
Definition: wifi-phy.cc:712
void SetPreambleDetectionModel(const Ptr< PreambleDetectionModel > preambleDetectionModel)
Sets the preamble detection model.
Definition: wifi-phy.cc:828
void NotifyChannelAccessRequested(void)
Notify the PHY that an access to the channel was requested.
Definition: wifi-phy.cc:1954
uint64_t m_previouslyRxPpduUid
UID of the previously received PPDU, reset to UINT64_MAX upon transmission.
Definition: wifi-phy.h:1186
WifiPpduField
The type of PPDU field (grouped for convenience)
uint16_t GetMeasurementChannelWidth(const Ptr< const WifiPpdu > ppdu) const
Return the channel width used to measure the RSSI.
Definition: wifi-phy.cc:2262
Time GetDelayUntilIdle(void)
Definition: wifi-phy.cc:2133
uint8_t m_initialPrimary20Index
Store the index of primary20 until initialization.
Definition: wifi-phy.h:1392
uint32_t m_rxMpduReferenceNumber
A-MPDU reference number to identify all received subframes belonging to the same received A-MPDU...
Definition: wifi-phy.h:1178
std::list< uint8_t > GetBssMembershipSelectorList(void) const
The WifiPhy::BssMembershipSelector() method is used (e.g., by a WifiRemoteStationManager) to determin...
Definition: wifi-phy.cc:1427
std::pair< uint32_t, uint32_t > WifiSpectrumBand
typedef for a pair of start and stop sub-band indexes
Abstract class for PHY entitiesThis class enables to have a unique set of APIs to be used by each PHY...
Definition: phy-entity.h:93
void SetCapabilitiesChangedCallback(Callback< void > callback)
Definition: wifi-phy.cc:659
void SetOffMode(void)
Put in off mode.
Definition: wifi-phy.cc:1497
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:894
void(* PhyRxPayloadBeginTracedCallback)(WifiTxVector txVector, Time psduDuration)
TracedCallback signature for start of PSDU reception events.
Definition: wifi-phy.h:706
Ptr< PreambleDetectionModel > m_preambleDetectionModel
Preamble detection model.
Definition: wifi-phy.h:1428
double GetPowerDbm(uint8_t power) const
Get the power of the given power level in dBm.
Definition: wifi-phy.cc:840
WifiPhyStandard GetPhyStandard(void) const
Get the configured Wi-Fi standard.
Definition: wifi-phy.cc:1131
Time GetBlockAckTxTime(void) const
Return the estimated BlockAck TX time for this PHY.
Definition: wifi-phy.cc:946
void SetErrorRateModel(const Ptr< ErrorRateModel > rate)
Sets the error rate model.
Definition: wifi-phy.cc:808
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:1294
Ptr< MobilityModel > GetMobility(void) const
Return the mobility model this PHY is associated with.
Definition: wifi-phy.cc:795
static Time GetPreambleDetectionDuration(void)
Definition: wifi-phy.cc:1574
Time m_pifs
PCF Interframe Space (PIFS) duration.
Definition: wifi-phy.h:1399
void SetPostReceptionErrorModel(const Ptr< ErrorModel > em)
Attach a receive ErrorModel to the WifiPhy.
Definition: wifi-phy.cc:815
void(* PsduTxBeginCallback)(WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
TracedCallback signature for PSDU transmit events.
Definition: wifi-phy.h:698
static TypeId GetTypeId(void)
Get the type ID.
Definition: wifi-phy.cc:297
Time GetChannelSwitchDelay(void) const
Definition: wifi-phy.cc:858
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:647
Every class exported by the ns3 library is enclosed in the ns3 namespace.
WifiPhyBand m_band
WifiPhyBand.
Definition: wifi-phy.h:1388
static const std::set< FrequencyChannelInfo > m_frequencyChannels
Available frequency channels.
Definition: wifi-phy.h:61
void SetWifiRadioEnergyModel(const Ptr< WifiRadioEnergyModel > wifiRadioEnergyModel)
Sets the wifi radio energy model.
Definition: wifi-phy.cc:834
uint16_t GetFrequency(void) const
Definition: wifi-phy.cc:1168
uint8_t GetNumberOfAntennas(void) const
Definition: wifi-phy.cc:1372
static uint32_t GetMaxPsduSize(WifiModulationClass modulation)
Get the maximum PSDU size in bytes for the given modulation class.
Definition: wifi-phy.cc:1637
void NotifyTxDrop(Ptr< const WifiPsdu > psdu)
Public method used to fire a PhyTxDrop trace.
Definition: wifi-phy.cc:1667
Time m_sifs
Short Interframe Space (SIFS) duration.
Definition: wifi-phy.h:1397
virtual uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const =0
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:1287
virtual void StartTx(Ptr< WifiPpdu > ppdu)=0
void StartReceivePreamble(Ptr< WifiPpdu > ppdu, RxPowerWattPerChannelBand rxPowersW, Time rxDuration)
Start receiving the PHY preamble of a PPDU (i.e.
Definition: wifi-phy.cc:1890
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:1184
void SetMaxSupportedRxSpatialStreams(uint8_t streams)
Definition: wifi-phy.cc:1409
bool GetShortPhyPreambleSupported(void) const
Return whether short PHY preamble is supported.
Definition: wifi-phy.cc:771
double m_ccaEdThresholdW
Clear channel assessment (CCA) threshold in watts.
Definition: wifi-phy.h:1404
virtual void SetChannelNumber(uint8_t id)
Set channel number.
Definition: wifi-phy.cc:1174
Time GetPifs(void) const
Return the PCF Interframe Space (PIFS) for this PHY.
Definition: wifi-phy.cc:934
Time GetAckTxTime(void) const
Return the estimated Ack TX time for this PHY.
Definition: wifi-phy.cc:940
void Configure80211ac(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11ac standard...
Definition: wifi-phy.cc:1046
WifiMode GetDefaultMode(void) const
Get the default WifiMode supported by the PHY.
Definition: wifi-phy.cc:1974
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:886
uint8_t GetChannelNumber(void) const
Return current channel number.
Definition: wifi-phy.cc:1199
WifiPhyStandard m_standard
WifiPhyStandard.
Definition: wifi-phy.h:1387
bool m_channelAccessRequested
Flag if channels access has been requested (used for OBSS_PD SR)
Definition: wifi-phy.h:1415
Ptr< UniformRandomVariable > m_random
Provides uniform random variables.
Definition: wifi-phy.h:1174
uint64_t GetPreviouslyRxPpduUid(void) const
Definition: wifi-phy.cc:1872
uint8_t m_txSpatialStreams
Number of supported TX spatial streams.
Definition: wifi-phy.h:1419
double GetTxPowerStart(void) const
Return the minimum available transmission power level (dBm).
Definition: wifi-phy.cc:706
Time m_ackTxTime
estimated Ack TX time
Definition: wifi-phy.h:1400
Ptr< ErrorModel > m_postReceptionErrorModel
Error model for receive packet events.
Definition: wifi-phy.h:1430
std::vector< uint16_t > GetSupportedChannelWidthSet(void) const
Definition: wifi-phy.cc:1457
Ptr< FrameCaptureModel > m_frameCaptureModel
Frame capture model.
Definition: wifi-phy.h:1427
void SetRxGain(double gain)
Sets the reception gain (dB).
Definition: wifi-phy.cc:751
void Configure80211b(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11b standard...
Definition: wifi-phy.cc:967
WifiPhyBand
Identifies the PHY band.
Definition: wifi-phy-band.h:32
void SetSifs(Time sifs)
Set the Short Interframe Space (SIFS) for this PHY.
Definition: wifi-phy.cc:904
void SetReceiveOkCallback(RxOkCallback callback)
Definition: wifi-phy.cc:635
void RegisterListener(WifiPhyListener *listener)
Definition: wifi-phy.cc:647
bool IsStateTx(void) const
Definition: wifi-phy.cc:2109
void NotifyRxBegin(Ptr< const WifiPsdu > psdu, RxPowerWattPerChannelBand rxPowersW)
Public method used to fire a PhyRxBegin trace.
Definition: wifi-phy.cc:1676
void SetMaxSupportedTxSpatialStreams(uint8_t streams)
Definition: wifi-phy.cc:1378
Ptr< WifiPhyStateHelper > m_state
Pointer to WifiPhyStateHelper.
Definition: wifi-phy.h:1175
void Configure80211n(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11n standard...
Definition: wifi-phy.cc:1027
void SetTxPowerStart(double start)
Sets the minimum available transmission power level (dBm).
Definition: wifi-phy.cc:699
double m_txPowerBaseDbm
Minimum transmission power (dBm)
Definition: wifi-phy.h:1407
Time GetSifs(void) const
Return the Short Interframe Space (SIFS) for this PHY.
Definition: wifi-phy.cc:910
An identifier for simulation events.
Definition: event-id.h:53
void ResetReceive(Ptr< Event > event)
Reset PHY at the end of the packet under reception after it has failed the PHY header.
Definition: wifi-phy.cc:1943
double GetTxPowerForTransmission(Ptr< const WifiPpdu > ppdu) const
Compute the transmit power for the next transmission.
Definition: wifi-phy.cc:2222
SignalNoiseDbm structure.
Definition: phy-entity.h:52
InterferenceHelper m_interference
the class handling interference computations
Definition: wifi-phy.h:1173
virtual void SetChannelWidth(uint16_t channelWidth)
If the operating channel for this object has not been set yet, the given channel width is saved and w...
Definition: wifi-phy.cc:1205
void ConfigureHtDeviceMcsSet(void)
Configure the device MCS set with the appropriate HtMcs modes for the number of available transmit sp...
void PushMcs(WifiMode mode)
Add the given MCS to the device MCS set.
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:685
WifiPhyOperatingChannel m_operatingChannel
Operating channel.
Definition: wifi-phy.h:1394
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:1586
double GetTxPowerEnd(void) const
Return the maximum available transmission power level (dBm).
Definition: wifi-phy.cc:719
Time GetSlot(void) const
Return the slot duration for this PHY.
Definition: wifi-phy.cc:922
void EndReceiveInterBss(void)
For HE receptions only, check and possibly modify the transmit power restriction state at the end of ...
Definition: wifi-phy.cc:1933
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:1743
static Time CalculatePhyPreambleAndHeaderDuration(const WifiTxVector &txVector)
Definition: wifi-phy.cc:1604
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:1774
void Configure80211g(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11g standard...
Definition: wifi-phy.cc:984
Ptr< NetDevice > GetDevice(void) const
Return the device this PHY is associated with.
Definition: wifi-phy.cc:783
double GetTxGain(void) const
Return the transmission gain (dB).
Definition: wifi-phy.cc:745
void SetSleepMode(void)
Put in sleep mode.
Definition: wifi-phy.cc:1463
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:1712
void SetNumberOfAntennas(uint8_t antennas)
Definition: wifi-phy.cc:1364
uint16_t m_initialChannelWidth
Store channel width (MHz) until initialization.
Definition: wifi-phy.h:1391
const WifiPhyOperatingChannel & GetOperatingChannel(void) const
Get a const reference to the operating channel.
Definition: wifi-phy.cc:1137
A base class which provides memory management and object aggregation.
Definition: object.h:87
double m_txPowerEndDbm
Maximum transmission power (dBm)
Definition: wifi-phy.h:1408
void Configure80211p(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11p standard...
Definition: wifi-phy.cc:997
std::map< WifiModulationClass, Ptr< PhyEntity > > m_phyEntities
This map holds the supported PHY entities.
Definition: wifi-phy.h:1205
Time m_channelSwitchDelay
Time required to switch between channel.
Definition: wifi-phy.h:1422
Time GetLastRxEndTime(void) const
Return the end time of the last received packet.
Definition: wifi-phy.cc:2145
void MaybeCcaBusyDuration(uint16_t channelWidth)
Eventually switch to CCA busy.
Definition: wifi-phy.cc:1910
uint8_t m_numberOfAntennas
Number of transmitters.
Definition: wifi-phy.h:1418
uint8_t GetMaxSupportedTxSpatialStreams(void) const
Definition: wifi-phy.cc:1403
a unique identifier for an interface.
Definition: type-id.h:58
uint16_t GetNMcs(void) const
Definition: wifi-phy.cc:2035
Ptr< Event > m_currentEvent
Hold the current event.
Definition: wifi-phy.h:1183
Time GetLastRxStartTime(void) const
Return the start time of the last received packet.
Definition: wifi-phy.cc:2139
double m_txPowerMaxSiso
SISO maximum transmit power due to OBSS PD SR power restriction (dBm)
Definition: wifi-phy.h:1413
bool IsStateRx(void) const
Definition: wifi-phy.cc:2103
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:1989
uint8_t m_rxSpatialStreams
Number of supported RX spatial streams.
Definition: wifi-phy.h:1420
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
#define SU_STA_ID
Definition: wifi-mode.h:32
std::vector< uint16_t > m_supportedChannelWidthSet
Supported channel width set (MHz)
Definition: wifi-phy.h:1395
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:1377
void SetCcaEdThreshold(double threshold)
Sets the CCA threshold (dBm).
Definition: wifi-phy.cc:678
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:2294
std::map< WifiSpectrumBand, double > RxPowerWattPerChannelBand
A map of the received power (Watts) for each band.
Definition: phy-entity.h:75
static Time GetPpduFieldDuration(WifiPpduField field, const WifiTxVector &txVector)
Get the duration of the PPDU field (or group of fields) for the given transmission parameters...
Definition: wifi-phy.cc:1610
Callback< void > m_capabilitiesChangedCallback
Callback when PHY capabilities changed.
Definition: wifi-phy.h:1433
void Configure80211a(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11a standard...
Definition: wifi-phy.cc:952
uint8_t GetMaxSupportedRxSpatialStreams(void) const
Definition: wifi-phy.cc:1421
TracedCallback< Ptr< const Packet > > m_phyTxEndTrace
The trace source fired when a packet ends the transmission process on the medium. ...
Definition: wifi-phy.h:1302
uint16_t m_initialFrequency
Store frequency until initialization (MHz)
Definition: wifi-phy.h:1389
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:2274