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"
30 
31 namespace ns3 {
32 
33 class Channel;
34 class NetDevice;
35 class MobilityModel;
36 class WifiPhyStateHelper;
37 class FrameCaptureModel;
38 class PreambleDetectionModel;
39 class WifiRadioEnergyModel;
40 class UniformRandomVariable;
41 
47 class WifiPhy : public Object
48 {
49 public:
50  friend class PhyEntity;
55  static TypeId GetTypeId (void);
56 
57  WifiPhy ();
58  virtual ~WifiPhy ();
59 
63  typedef std::pair<uint8_t, WifiPhyBand> ChannelNumberBandPair;
67  typedef std::pair<ChannelNumberBandPair, WifiPhyStandard> ChannelNumberStandardPair;
71  typedef std::pair<uint16_t, uint16_t> FrequencyWidthPair;
72 
78  Ptr<WifiPhyStateHelper> GetState (void) const;
79 
84  void SetReceiveOkCallback (RxOkCallback callback);
90 
97  void RegisterListener (WifiPhyListener *listener);
104  void UnregisterListener (WifiPhyListener *listener);
105 
110 
118  void StartReceivePreamble (Ptr<WifiPpdu> ppdu, RxPowerWattPerChannelBand rxPowersW, Time rxDuration);
119 
125  void ResetReceive (Ptr<Event> event);
126 
131  void EndReceiveInterBss (void);
132 
139  void Send (Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector);
146  void Send (WifiConstPsduMap psdus, WifiTxVector txVector);
147 
151  virtual void StartTx (Ptr<WifiPpdu> ppdu) = 0;
152 
156  void SetSleepMode (void);
160  void ResumeFromSleep (void);
164  void SetOffMode (void);
168  void ResumeFromOff (void);
169 
173  bool IsStateIdle (void) const;
177  bool IsStateCcaBusy (void) const;
181  bool IsStateRx (void) const;
185  bool IsStateTx (void) const;
189  bool IsStateSwitching (void) const;
193  bool IsStateSleep (void) const;
197  bool IsStateOff (void) const;
198 
205  Time GetDelayUntilIdle (void);
206 
212  Time GetLastRxStartTime (void) const;
218  Time GetLastRxEndTime (void) const;
219 
228  static Time CalculateTxDuration (uint32_t size, const WifiTxVector& txVector, WifiPhyBand band,
229  uint16_t staId = SU_STA_ID);
237  static Time CalculateTxDuration (WifiConstPsduMap psduMap, const WifiTxVector& txVector, WifiPhyBand band);
238 
254  static Time GetPpduFieldDuration (WifiPpduField field, const WifiTxVector& txVector);
258  static Time GetPreambleDetectionDuration (void);
268  static Time GetPayloadDuration (uint32_t size, const WifiTxVector& txVector, WifiPhyBand band, MpduType mpdutype = NORMAL_MPDU,
269  uint16_t staId = SU_STA_ID);
286  static Time GetPayloadDuration (uint32_t size, const WifiTxVector& txVector, WifiPhyBand band, MpduType mpdutype,
287  bool incFlag, uint32_t &totalAmpduSize, double &totalAmpduNumSymbols,
288  uint16_t staId);
294  static Time GetStartOfPacketDuration (const WifiTxVector& txVector);
295 
310  std::list<WifiMode> GetModeList (void) const;
320  std::list<WifiMode> GetModeList (WifiModulationClass modulation) const;
329  bool IsModeSupported (WifiMode mode) const;
337  WifiMode GetDefaultMode (void) const;
347  bool IsMcsSupported (WifiModulationClass modulation, uint8_t mcs) const;
348 
356  double CalculateSnr (const WifiTxVector& txVector, double ber) const;
357 
363  void SetSifs (Time sifs);
369  Time GetSifs (void) const;
375  void SetSlot (Time slot);
381  Time GetSlot (void) const;
387  void SetPifs (Time pifs);
393  Time GetPifs (void) const;
399  Time GetAckTxTime (void) const;
405  Time GetBlockAckTxTime (void) const;
406 
417  std::list<uint8_t> GetBssMembershipSelectorList (void) const;
423  uint16_t GetNMcs (void) const;
432  std::list<WifiMode> GetMcsList (void) const;
442  std::list<WifiMode> GetMcsList (WifiModulationClass modulation) const;
453  WifiMode GetMcs (WifiModulationClass modulation, uint8_t mcs) const;
454 
467  virtual void SetChannelNumber (uint8_t id);
473  uint8_t GetChannelNumber (void) const;
477  Time GetChannelSwitchDelay (void) const;
478 
485  virtual void ConfigureStandardAndBand (WifiPhyStandard standard, WifiPhyBand band);
486 
492  WifiPhyStandard GetPhyStandard (void) const;
493 
499  WifiPhyBand GetPhyBand (void) const;
500 
517  bool DefineChannelNumber (uint8_t channelNumber, WifiPhyBand band, WifiPhyStandard standard, uint16_t frequency, uint16_t channelWidth);
518 
524  virtual Ptr<Channel> GetChannel (void) const = 0;
525 
533  void NotifyTxBegin (WifiConstPsduMap psdus, double txPowerW);
540  void NotifyTxEnd (WifiConstPsduMap psdus);
547  void NotifyTxDrop (Ptr<const WifiPsdu> psdu);
562  void NotifyRxEnd (Ptr<const WifiPsdu> psdu);
571 
593  uint16_t channelFreqMhz,
594  WifiTxVector txVector,
595  SignalNoiseDbm signalNoise,
596  std::vector<bool> statusPerMpdu,
597  uint16_t staId = SU_STA_ID);
598 
620  uint16_t channelFreqMhz,
621  WifiTxVector txVector,
622  MpduInfo aMpdu,
623  SignalNoiseDbm signalNoise,
624  uint16_t staId);
625 
640  uint16_t channelFreqMhz,
641  WifiTxVector txVector,
642  uint16_t staId = SU_STA_ID);
643 
657  typedef void (* MonitorSnifferTxCallback)(const Ptr<const Packet> packet,
658  uint16_t channelFreqMhz,
659  WifiTxVector txVector,
660  MpduInfo aMpdu,
661  uint16_t staId);
662 
670  typedef void (* PsduTxBeginCallback)(WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW);
671 
678  typedef void (* PhyRxPayloadBeginTracedCallback)(WifiTxVector txVector, Time psduDuration);
679 
688  virtual int64_t AssignStreams (int64_t stream);
689 
697  void SetRxSensitivity (double threshold);
703  double GetRxSensitivity (void) const;
711  void SetCcaEdThreshold (double threshold);
717  double GetCcaEdThreshold (void) const;
723  void SetRxNoiseFigure (double noiseFigureDb);
729  void SetTxPowerStart (double start);
735  double GetTxPowerStart (void) const;
741  void SetTxPowerEnd (double end);
747  double GetTxPowerEnd (void) const;
755  void SetNTxPower (uint8_t n);
761  uint8_t GetNTxPower (void) const;
767  void SetTxGain (double gain);
773  double GetTxGain (void) const;
779  void SetRxGain (double gain);
785  double GetRxGain (void) const;
786 
792  void SetDevice (const Ptr<NetDevice> device);
798  Ptr<NetDevice> GetDevice (void) const;
819  Ptr<MobilityModel> GetMobility (void) const;
820 
824  virtual void SetFrequency (uint16_t freq);
828  uint16_t GetFrequency (void) const;
832  void SetNumberOfAntennas (uint8_t antennas);
836  uint8_t GetNumberOfAntennas (void) const;
840  void SetMaxSupportedTxSpatialStreams (uint8_t streams);
844  uint8_t GetMaxSupportedTxSpatialStreams (void) const;
848  void SetMaxSupportedRxSpatialStreams (uint8_t streams);
852  uint8_t GetMaxSupportedRxSpatialStreams (void) const;
858  void SetShortPhyPreambleSupported (bool preamble);
864  bool GetShortPhyPreambleSupported (void) const;
865 
871  void SetErrorRateModel (const Ptr<ErrorRateModel> rate);
889  void SetFrameCaptureModel (const Ptr<FrameCaptureModel> frameCaptureModel);
895  void SetPreambleDetectionModel (const Ptr<PreambleDetectionModel> preambleDetectionModel);
901  void SetWifiRadioEnergyModel (const Ptr<WifiRadioEnergyModel> wifiRadioEnergyModel);
902 
906  uint16_t GetChannelWidth (void) const;
910  virtual void SetChannelWidth (uint16_t channelWidth);
914  void AddSupportedChannelWidth (uint16_t width);
918  std::vector<uint16_t> GetSupportedChannelWidthSet (void) const;
919 
928  double GetPowerDbm (uint8_t power) const;
929 
937  void ResetCca (bool powerRestricted, double txPowerMaxSiso = 0, double txPowerMaxMimo = 0);
954  void NotifyChannelAccessRequested (void);
955 
956 
964  virtual WifiSpectrumBand ConvertHeRuSubcarriers (uint16_t channelWidth, HeRu::SubcarrierRange range) const;
965 
975  static void AddStaticPhyEntity (WifiModulationClass modulation, Ptr<PhyEntity> phyEntity);
976 
986 
995 
999  uint64_t GetPreviouslyRxPpduUid (void) const;
1000 
1014  virtual uint16_t GetGuardBandwidth (uint16_t currentChannelWidth) const = 0;
1023  virtual std::tuple<double, double, double> GetTxMaskRejectionParams (void) const = 0;
1024 
1025 protected:
1026  // Inherited
1027  virtual void DoInitialize (void);
1028  virtual void DoDispose (void);
1029 
1030  /*
1031  * Reset data upon end of TX or RX
1032  */
1033  void Reset (void);
1034 
1044  bool DoChannelSwitch (uint8_t id);
1054  bool DoFrequencySwitch (uint16_t frequency);
1055 
1064  void SwitchMaybeToCcaBusy (uint16_t channelWidth);
1065 
1074  uint16_t GetMeasurementChannelWidth (const Ptr<const WifiPpdu> ppdu) const;
1075 
1084  virtual WifiSpectrumBand GetBand (uint16_t bandWidth, uint8_t bandIndex = 0);
1085 
1096  void AddPhyEntity (WifiModulationClass modulation, Ptr<PhyEntity> phyEntity);
1097 
1101 
1104 
1107 
1109  std::map <std::pair<uint64_t /* UID*/, WifiPreamble>, Ptr<Event> > m_currentPreambleEvents;
1110 
1112 
1130  std::map<WifiModulationClass, Ptr<PhyEntity> > m_phyEntities;
1131 
1132 
1133 private:
1149  void Configure80211a (void);
1154  void Configure80211b (void);
1159  void Configure80211g (void);
1164  void Configure80211p (void);
1169  void Configure80211n (void);
1174  void Configure80211ac (void);
1179  void Configure80211ax (void);
1184  void ConfigureHtDeviceMcsSet (void);
1190  void PushMcs (WifiMode mode);
1194  void RebuildMcsMap (void);
1200  void ConfigureDefaultsForStandard (void);
1207  void ConfigureChannelForStandard (void);
1208 
1215  uint8_t FindChannelNumberForFrequencyWidth (uint16_t frequency, uint16_t width) const;
1223  FrequencyWidthPair GetFrequencyWidthForChannelNumberStandard (uint8_t channelNumber, WifiPhyBand band, WifiPhyStandard standard) const;
1224 
1231 
1236  void MaybeCcaBusyDuration (uint16_t channelWidth);
1237 
1245 
1260 
1268 
1276 
1284 
1300 
1308 
1315 
1328  TracedCallback<Ptr<const Packet>, uint16_t /* frequency (MHz) */, WifiTxVector, MpduInfo, SignalNoiseDbm, uint16_t /* STA-ID*/> m_phyMonitorSniffRxTrace;
1329 
1342  TracedCallback<Ptr<const Packet>, uint16_t /* frequency (MHz) */, WifiTxVector, MpduInfo, uint16_t /* STA-ID*/> m_phyMonitorSniffTxTrace;
1343 
1350  static std::map<WifiModulationClass, Ptr<PhyEntity> > m_staticPhyEntities;
1351 
1358  uint16_t m_channelWidth;
1359 
1365 
1368  double m_txGainDb;
1369  double m_rxGainDb;
1372  uint8_t m_nTxPower;
1374 
1379 
1384 
1385  typedef std::map<ChannelNumberStandardPair, FrequencyWidthPair> ChannelToFrequencyWidthMap;
1387 
1388  std::vector<uint16_t> m_supportedChannelWidthSet;
1391 
1393 
1396 
1402 
1404 };
1405 
1411 std::ostream& operator<< (std::ostream& os, RxSignalInfo rxSignalInfo);
1412 
1413 } //namespace ns3
1414 
1415 #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:1918
Ptr< NetDevice > m_device
Pointer to the device.
Definition: wifi-phy.h:1394
uint8_t GetNTxPower(void) const
Return the number of available transmission power levels.
Definition: wifi-phy.cc:731
uint32_t m_txMpduReferenceNumber
A-MPDU reference number to identify all transmitted subframes belonging to the same received A-MPDU...
Definition: wifi-phy.h:1102
bool IsStateSwitching(void) const
Definition: wifi-phy.cc:2327
void SetPifs(Time pifs)
Set the PCF Interframe Space (PIFS) for this PHY.
Definition: wifi-phy.cc:1019
bool IsStateOff(void) const
Definition: wifi-phy.cc:2339
FrequencyWidthPair GetFrequencyWidthForChannelNumberStandard(uint8_t channelNumber, WifiPhyBand band, WifiPhyStandard standard) const
Lookup frequency/width pair for channelNumber/standard pair.
Definition: wifi-phy.cc:1500
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:1283
static Time GetStartOfPacketDuration(const WifiTxVector &txVector)
Definition: wifi-phy.cc:1810
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:1861
Ptr< PhyEntity > GetPhyEntity(WifiModulationClass modulation) const
Get the supported PHY entity corresponding to the modulation class, for the WifiPhy instance...
Definition: wifi-phy.cc:969
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:724
uint8_t m_channelNumber
Operating channel number.
Definition: wifi-phy.h:1389
double m_rxGainDb
Reception gain (dB)
Definition: wifi-phy.h:1369
static std::map< WifiModulationClass, Ptr< PhyEntity > > m_staticPhyEntities
Map of implemented PHY entities.
Definition: wifi-phy.h:1350
double GetRxGain(void) const
Return the reception gain (dB).
Definition: wifi-phy.cc:757
bool IsModeSupported(WifiMode mode) const
Check if the given WifiMode is supported by the PHY.
Definition: wifi-phy.cc:2173
void AddSupportedChannelWidth(uint16_t width)
Definition: wifi-phy.cc:1479
double GetCcaEdThreshold(void) const
Return the CCA threshold (dBm).
Definition: wifi-phy.cc:684
void NotifyTxEnd(WifiConstPsduMap psdus)
Public method used to fire a PhyTxEnd trace.
Definition: wifi-phy.cc:1873
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:1368
void AbortCurrentReception(WifiPhyRxfailureReason reason)
Due to newly arrived signal, the current reception cannot be continued and has to be aborted...
Definition: wifi-phy.cc:2379
virtual ~WifiPhy()
Definition: wifi-phy.cc:548
void ResumeFromOff(void)
Resume from off mode.
Definition: wifi-phy.cc:1773
Ptr< WifiPhyStateHelper > GetState(void) const
Return the WifiPhyStateHelper of this PHY.
Definition: wifi-phy.cc:600
void ResumeFromSleep(void)
Resume from sleep mode.
Definition: wifi-phy.cc:1742
double m_rxSensitivityW
Receive sensitivity threshold in watts.
Definition: wifi-phy.h:1366
virtual WifiSpectrumBand ConvertHeRuSubcarriers(uint16_t channelWidth, HeRu::SubcarrierRange range) const
Definition: wifi-phy.cc:2137
void ConfigureDefaultsForStandard(void)
Configure the PHY-level parameters for different Wi-Fi standard.
Definition: wifi-phy.cc:869
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
Definition: wifi-ppdu.h:38
802.11 PHY layer model
Definition: wifi-phy.h:47
WifiPhyBand GetPhyBand(void) const
Get the configured Wi-Fi band.
Definition: wifi-phy.cc:1305
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:2464
Time m_timeLastPreambleDetected
Record the time the last preamble was detected.
Definition: wifi-phy.h:1401
void SetTxGain(double gain)
Sets the transmission gain (dB).
Definition: wifi-phy.cc:737
void Configure80211ax(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11ax standard...
Definition: wifi-phy.cc:1145
handles interference calculations
void SetRxSensitivity(double threshold)
Sets the receive sensitivity threshold (dBm).
Definition: wifi-phy.cc:664
virtual void ConfigureStandardAndBand(WifiPhyStandard standard, WifiPhyBand band)
Configure the PHY-level parameters for different Wi-Fi standard.
Definition: wifi-phy.cc:1255
virtual void DoDispose(void)
Destructor implementation.
Definition: wifi-phy.cc:554
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:1373
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:2212
TracedCallback< Ptr< const Packet > > m_phyRxEndTrace
The trace source fired when a packet ends the reception process from the medium.
Definition: wifi-phy.h:1307
bool IsStateCcaBusy(void) const
Definition: wifi-phy.cc:2303
void SetReceiveErrorCallback(RxErrorCallback callback)
Definition: wifi-phy.cc:612
WifiPhyRxfailureReason
Enumeration of the possible reception failure reasons.
void SetSlot(Time slot)
Set the slot duration for this PHY.
Definition: wifi-phy.cc:1007
void SetShortPhyPreambleSupported(bool preamble)
Enable or disable short PHY preamble.
Definition: wifi-phy.cc:763
TracedCallback< WifiTxVector, Time > m_phyRxPayloadBeginTrace
The trace source fired when the reception of the PHY payload (PSDU) begins.
Definition: wifi-phy.h:1299
EventId m_endPhyRxEvent
the end of PHY receive event
Definition: wifi-phy.h:1105
void SetMobility(const Ptr< MobilityModel > mobility)
assign a mobility model to this device
Definition: wifi-phy.cc:788
void UnregisterListener(WifiPhyListener *listener)
Definition: wifi-phy.cc:624
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:690
bool IsStateIdle(void) const
Definition: wifi-phy.cc:2309
void Reset(void)
Definition: wifi-phy.cc:2091
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:1314
std::pair< uint16_t, uint16_t > FrequencyWidthPair
A pair of a center frequency (MHz) and a channel width (MHz)
Definition: wifi-phy.h:71
uint8_t m_nTxPower
Number of available transmission power levels.
Definition: wifi-phy.h:1372
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:1328
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:2261
virtual void SetFrequency(uint16_t freq)
Definition: wifi-phy.cc:1318
double CalculateSnr(const WifiTxVector &txVector, double ber) const
Definition: wifi-phy.cc:863
void SetFrameCaptureModel(const Ptr< FrameCaptureModel > frameCaptureModel)
Sets the frame capture model.
Definition: wifi-phy.cc:821
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:2419
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:68
uint8_t m_initialChannelNumber
Initial channel number.
Definition: wifi-phy.h:1390
void NotifyRxEnd(Ptr< const WifiPsdu > psdu)
Public method used to fire a PhyRxEnd trace.
Definition: wifi-phy.cc:1906
bool IsStateSleep(void) const
Definition: wifi-phy.cc:2333
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:671
mobility
Definition: third.py:108
virtual Ptr< Channel > GetChannel(void) const =0
Return the Channel this WifiPhy is connected to.
uint16_t m_channelCenterFrequency
Center frequency in MHz.
Definition: wifi-phy.h:1355
void SetDevice(const Ptr< NetDevice > device)
Sets the device this PHY is associated with.
Definition: wifi-phy.cc:776
uint16_t GetChannelWidth(void) const
Definition: wifi-phy.cc:1395
bool m_powerRestricted
Flag whether transmit power is restricted by OBSS PD SR.
Definition: wifi-phy.h:1375
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
Definition: wifi-phy.cc:1846
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:2363
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
static ChannelToFrequencyWidthMap m_channelToFrequencyWidth
the channel to frequency width map
Definition: wifi-phy.h:1386
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
bool DoFrequencySwitch(uint16_t frequency)
The default implementation does nothing and returns true.
Definition: wifi-phy.cc:1630
static const Ptr< const PhyEntity > GetStaticPhyEntity(WifiModulationClass modulation)
Get the implemented PHY entity corresponding to the modulation class.
Definition: wifi-phy.cc:961
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:2296
Time m_slot
Slot duration.
Definition: wifi-phy.h:1361
Ptr< MobilityModel > m_mobility
Pointer to the mobility model.
Definition: wifi-phy.h:1395
Time m_blockAckTxTime
estimated BlockAck TX time
Definition: wifi-phy.h:1364
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:1275
double m_txPowerMaxMimo
MIMO maximum transmit power due to OBSS PD SR power restriction (dBm)
Definition: wifi-phy.h:1377
bool m_shortPreamble
Flag if short PHY preamble is supported.
Definition: wifi-phy.h:1380
virtual std::tuple< double, double, double > GetTxMaskRejectionParams(void) const =0
EventId m_endTxEvent
the end of transmit event
Definition: wifi-phy.h:1106
Ptr< WifiRadioEnergyModel > m_wifiRadioEnergyModel
Wifi radio energy model.
Definition: wifi-phy.h:1399
void SetTxPowerEnd(double end)
Sets the maximum available transmission power level (dBm).
Definition: wifi-phy.cc:711
void SetPreambleDetectionModel(const Ptr< PreambleDetectionModel > preambleDetectionModel)
Sets the preamble detection model.
Definition: wifi-phy.cc:827
std::pair< ChannelNumberBandPair, WifiPhyStandard > ChannelNumberStandardPair
A pair of a ChannelNumberBandPair and a WifiPhyStandard.
Definition: wifi-phy.h:67
void NotifyChannelAccessRequested(void)
Notify the PHY that an access to the channel was requested.
Definition: wifi-phy.cc:2166
uint64_t m_previouslyRxPpduUid
UID of the previously received PPDU, reset to UINT64_MAX upon transmission.
Definition: wifi-phy.h:1111
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:2471
Time GetDelayUntilIdle(void)
Definition: wifi-phy.cc:2345
uint32_t m_rxMpduReferenceNumber
A-MPDU reference number to identify all received subframes belonging to the same received A-MPDU...
Definition: wifi-phy.h:1103
std::list< uint8_t > GetBssMembershipSelectorList(void) const
The WifiPhy::BssMembershipSelector() method is used (e.g., by a WifiRemoteStationManager) to determin...
Definition: wifi-phy.cc:1464
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:630
void SetOffMode(void)
Put in off mode.
Definition: wifi-phy.cc:1727
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:985
void(* PhyRxPayloadBeginTracedCallback)(WifiTxVector txVector, Time psduDuration)
TracedCallback signature for start of PSDU reception events.
Definition: wifi-phy.h:678
Ptr< PreambleDetectionModel > m_preambleDetectionModel
Preamble detection model.
Definition: wifi-phy.h:1398
double GetPowerDbm(uint8_t power) const
Get the power of the given power level in dBm.
Definition: wifi-phy.cc:839
WifiPhyStandard GetPhyStandard(void) const
Get the configured Wi-Fi standard.
Definition: wifi-phy.cc:1312
Time GetBlockAckTxTime(void) const
Return the estimated BlockAck TX time for this PHY.
Definition: wifi-phy.cc:1037
void SetErrorRateModel(const Ptr< ErrorRateModel > rate)
Sets the error rate model.
Definition: wifi-phy.cc:807
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
Definition: angles.cc:42
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:1259
Ptr< MobilityModel > GetMobility(void) const
Return the mobility model this PHY is associated with.
Definition: wifi-phy.cc:794
static Time GetPreambleDetectionDuration(void)
Definition: wifi-phy.cc:1804
Time m_pifs
PCF Interframe Space (PIFS) duration.
Definition: wifi-phy.h:1362
void SetPostReceptionErrorModel(const Ptr< ErrorModel > em)
Attach a receive ErrorModel to the WifiPhy.
Definition: wifi-phy.cc:814
void(* PsduTxBeginCallback)(WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
TracedCallback signature for PSDU transmit events.
Definition: wifi-phy.h:670
static TypeId GetTypeId(void)
Get the type ID.
Definition: wifi-phy.cc:295
Time GetChannelSwitchDelay(void) const
Definition: wifi-phy.cc:857
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:619
Every class exported by the ns3 library is enclosed in the ns3 namespace.
WifiPhyBand m_band
WifiPhyBand.
Definition: wifi-phy.h:1353
void SetWifiRadioEnergyModel(const Ptr< WifiRadioEnergyModel > wifiRadioEnergyModel)
Sets the wifi radio energy model.
Definition: wifi-phy.cc:833
uint16_t GetFrequency(void) const
Definition: wifi-phy.cc:1375
uint8_t GetNumberOfAntennas(void) const
Definition: wifi-phy.cc:1409
void NotifyTxDrop(Ptr< const WifiPsdu > psdu)
Public method used to fire a PhyTxDrop trace.
Definition: wifi-phy.cc:1885
Time m_sifs
Short Interframe Space (SIFS) duration.
Definition: wifi-phy.h:1360
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:1252
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:2103
std::map< ChannelNumberStandardPair, FrequencyWidthPair > ChannelToFrequencyWidthMap
channel to frequency width map typedef
Definition: wifi-phy.h:1385
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:1109
void SetMaxSupportedRxSpatialStreams(uint8_t streams)
Definition: wifi-phy.cc:1446
bool GetShortPhyPreambleSupported(void) const
Return whether short PHY preamble is supported.
Definition: wifi-phy.cc:770
double m_ccaEdThresholdW
Clear channel assessment (CCA) threshold in watts.
Definition: wifi-phy.h:1367
virtual void SetChannelNumber(uint8_t id)
Set channel number.
Definition: wifi-phy.cc:1508
Time GetPifs(void) const
Return the PCF Interframe Space (PIFS) for this PHY.
Definition: wifi-phy.cc:1025
Time GetAckTxTime(void) const
Return the estimated Ack TX time for this PHY.
Definition: wifi-phy.cc:1031
void Configure80211ac(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11ac standard...
Definition: wifi-phy.cc:1137
virtual void DoInitialize(void)
Initialize() implementation.
Definition: wifi-phy.cc:587
WifiMode GetDefaultMode(void) const
Get the default WifiMode supported by the PHY.
Definition: wifi-phy.cc:2186
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:977
uint8_t GetChannelNumber(void) const
Return current channel number.
Definition: wifi-phy.cc:1561
WifiPhyStandard m_standard
WifiPhyStandard.
Definition: wifi-phy.h:1352
uint8_t FindChannelNumberForFrequencyWidth(uint16_t frequency, uint16_t width) const
Look for channel number matching the frequency and width.
Definition: wifi-phy.cc:1177
bool m_channelAccessRequested
Flag if channels access has been requested (used for OBSS_PD SR)
Definition: wifi-phy.h:1378
Ptr< UniformRandomVariable > m_random
Provides uniform random variables.
Definition: wifi-phy.h:1099
uint64_t GetPreviouslyRxPpduUid(void) const
Definition: wifi-phy.cc:2085
uint8_t m_txSpatialStreams
Number of supported TX spatial streams.
Definition: wifi-phy.h:1382
double GetTxPowerStart(void) const
Return the minimum available transmission power level (dBm).
Definition: wifi-phy.cc:705
Time m_ackTxTime
estimated Ack TX time
Definition: wifi-phy.h:1363
Ptr< ErrorModel > m_postReceptionErrorModel
Error model for receive packet events.
Definition: wifi-phy.h:1400
void InitializeFrequencyChannelNumber(void)
post-construction setting of frequency and/or channel number
Definition: wifi-phy.cc:636
std::vector< uint16_t > GetSupportedChannelWidthSet(void) const
Definition: wifi-phy.cc:1494
Ptr< FrameCaptureModel > m_frameCaptureModel
Frame capture model.
Definition: wifi-phy.h:1397
void SetRxGain(double gain)
Sets the reception gain (dB).
Definition: wifi-phy.cc:750
void Configure80211b(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11b standard...
Definition: wifi-phy.cc:1058
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:995
void SetReceiveOkCallback(RxOkCallback callback)
Definition: wifi-phy.cc:606
uint16_t m_channelWidth
Channel width (MHz)
Definition: wifi-phy.h:1358
void RegisterListener(WifiPhyListener *listener)
Definition: wifi-phy.cc:618
bool IsStateTx(void) const
Definition: wifi-phy.cc:2321
void NotifyRxBegin(Ptr< const WifiPsdu > psdu, RxPowerWattPerChannelBand rxPowersW)
Public method used to fire a PhyRxBegin trace.
Definition: wifi-phy.cc:1894
void SetMaxSupportedTxSpatialStreams(uint8_t streams)
Definition: wifi-phy.cc:1415
Ptr< WifiPhyStateHelper > m_state
Pointer to WifiPhyStateHelper.
Definition: wifi-phy.h:1100
void Configure80211n(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11n standard...
Definition: wifi-phy.cc:1118
void SetTxPowerStart(double start)
Sets the minimum available transmission power level (dBm).
Definition: wifi-phy.cc:698
double m_txPowerBaseDbm
Minimum transmission power (dBm)
Definition: wifi-phy.h:1370
Time GetSifs(void) const
Return the Short Interframe Space (SIFS) for this PHY.
Definition: wifi-phy.cc:1001
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:2155
double GetTxPowerForTransmission(Ptr< const WifiPpdu > ppdu) const
Compute the transmit power for the next transmission.
Definition: wifi-phy.cc:2431
SignalNoiseDbm structure.
Definition: phy-entity.h:52
bool m_frequencyChannelNumberInitialized
Store initialization state.
Definition: wifi-phy.h:1357
InterferenceHelper m_interference
the class handling interference computations
Definition: wifi-phy.h:1098
virtual void SetChannelWidth(uint16_t channelWidth)
Definition: wifi-phy.cc:1381
bool m_isConstructed
true when ready to set frequency
Definition: wifi-phy.h:1354
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:657
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:1816
double GetTxPowerEnd(void) const
Return the maximum available transmission power level (dBm).
Definition: wifi-phy.cc:718
Time GetSlot(void) const
Return the slot duration for this PHY.
Definition: wifi-phy.cc:1013
void EndReceiveInterBss(void)
For HE receptions only, check and possibly modify the transmit power restriction state at the end of ...
Definition: wifi-phy.cc:2145
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:1961
static Time CalculatePhyPreambleAndHeaderDuration(const WifiTxVector &txVector)
Definition: wifi-phy.cc:1834
void Send(Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector)
Definition: wifi-phy.cc:1986
void Configure80211g(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11g standard...
Definition: wifi-phy.cc:1075
Ptr< NetDevice > GetDevice(void) const
Return the device this PHY is associated with.
Definition: wifi-phy.cc:782
double GetTxGain(void) const
Return the transmission gain (dB).
Definition: wifi-phy.cc:744
void SetSleepMode(void)
Put in sleep mode.
Definition: wifi-phy.cc:1693
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:1930
void SetNumberOfAntennas(uint8_t antennas)
Definition: wifi-phy.cc:1401
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:1371
std::pair< uint8_t, WifiPhyBand > ChannelNumberBandPair
A pair of a channel number and a WifiPhyBand.
Definition: wifi-phy.h:63
void Configure80211p(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11p standard...
Definition: wifi-phy.cc:1088
std::map< WifiModulationClass, Ptr< PhyEntity > > m_phyEntities
This map holds the supported PHY entities.
Definition: wifi-phy.h:1130
Time m_channelSwitchDelay
Time required to switch between channel.
Definition: wifi-phy.h:1392
Time GetLastRxEndTime(void) const
Return the end time of the last received packet.
Definition: wifi-phy.cc:2357
void MaybeCcaBusyDuration(uint16_t channelWidth)
Eventually switch to CCA busy.
Definition: wifi-phy.cc:2123
uint8_t m_numberOfAntennas
Number of transmitters.
Definition: wifi-phy.h:1381
uint8_t GetMaxSupportedTxSpatialStreams(void) const
Definition: wifi-phy.cc:1440
a unique identifier for an interface.
Definition: type-id.h:58
void ConfigureChannelForStandard(void)
Configure the PHY-level parameters for different Wi-Fi standard.
Definition: wifi-phy.cc:1205
uint16_t GetNMcs(void) const
Definition: wifi-phy.cc:2247
Ptr< Event > m_currentEvent
Hold the current event.
Definition: wifi-phy.h:1108
Time GetLastRxStartTime(void) const
Return the start time of the last received packet.
Definition: wifi-phy.cc:2351
double m_txPowerMaxSiso
SISO maximum transmit power due to OBSS PD SR power restriction (dBm)
Definition: wifi-phy.h:1376
bool IsStateRx(void) const
Definition: wifi-phy.cc:2315
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:2201
uint8_t m_rxSpatialStreams
Number of supported RX spatial streams.
Definition: wifi-phy.h:1383
#define SU_STA_ID
Definition: wifi-mode.h:32
std::vector< uint16_t > m_supportedChannelWidthSet
Supported channel width set (MHz)
Definition: wifi-phy.h:1388
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:1342
void SetCcaEdThreshold(double threshold)
Sets the CCA threshold (dBm).
Definition: wifi-phy.cc:677
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:2492
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:1840
Callback< void > m_capabilitiesChangedCallback
Callback when PHY capabilities changed.
Definition: wifi-phy.h:1403
void Configure80211a(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11a standard...
Definition: wifi-phy.cc:1043
uint8_t GetMaxSupportedRxSpatialStreams(void) const
Definition: wifi-phy.cc:1458
TracedCallback< Ptr< const Packet > > m_phyTxEndTrace
The trace source fired when a packet ends the transmission process on the medium. ...
Definition: wifi-phy.h:1267
uint16_t m_initialFrequency
Store frequency until initialization (MHz)
Definition: wifi-phy.h:1356
bool DefineChannelNumber(uint8_t channelNumber, WifiPhyBand band, WifiPhyStandard standard, uint16_t frequency, uint16_t channelWidth)
Add a channel definition to the WifiPhy.
Definition: wifi-phy.cc:1160
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:2483
bool DoChannelSwitch(uint8_t id)
The default implementation does nothing and returns true.
Definition: wifi-phy.cc:1567