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 
269  static Time GetPreambleDetectionDuration (void);
279  static Time GetPayloadDuration (uint32_t size, const WifiTxVector& txVector, WifiPhyBand band, MpduType mpdutype = NORMAL_MPDU,
280  uint16_t staId = SU_STA_ID);
297  static Time GetPayloadDuration (uint32_t size, const WifiTxVector& txVector, WifiPhyBand band, MpduType mpdutype,
298  bool incFlag, uint32_t &totalAmpduSize, double &totalAmpduNumSymbols,
299  uint16_t staId);
305  static Time GetStartOfPacketDuration (const WifiTxVector& txVector);
306 
321  std::list<WifiMode> GetModeList (void) const;
331  std::list<WifiMode> GetModeList (WifiModulationClass modulation) const;
340  bool IsModeSupported (WifiMode mode) const;
348  WifiMode GetDefaultMode (void) const;
358  bool IsMcsSupported (WifiModulationClass modulation, uint8_t mcs) const;
359 
367  double CalculateSnr (const WifiTxVector& txVector, double ber) const;
368 
374  void SetSifs (Time sifs);
380  Time GetSifs (void) const;
386  void SetSlot (Time slot);
392  Time GetSlot (void) const;
398  void SetPifs (Time pifs);
404  Time GetPifs (void) const;
410  Time GetAckTxTime (void) const;
416  Time GetBlockAckTxTime (void) const;
417 
424  static uint32_t GetMaxPsduSize (WifiModulationClass modulation);
425 
436  std::list<uint8_t> GetBssMembershipSelectorList (void) const;
442  uint16_t GetNMcs (void) const;
451  std::list<WifiMode> GetMcsList (void) const;
461  std::list<WifiMode> GetMcsList (WifiModulationClass modulation) const;
472  WifiMode GetMcs (WifiModulationClass modulation, uint8_t mcs) const;
473 
496  virtual void SetChannelNumber (uint8_t id);
502  uint8_t GetChannelNumber (void) const;
506  Time GetChannelSwitchDelay (void) const;
507 
514  virtual void ConfigureStandardAndBand (WifiPhyStandard standard, WifiPhyBand band);
515 
521  WifiPhyStandard GetPhyStandard (void) const;
522 
528  WifiPhyBand GetPhyBand (void) const;
529 
535  const WifiPhyOperatingChannel& GetOperatingChannel (void) const;
536 
542  virtual Ptr<Channel> GetChannel (void) const = 0;
543 
551  void NotifyTxBegin (WifiConstPsduMap psdus, double txPowerW);
558  void NotifyTxEnd (WifiConstPsduMap psdus);
565  void NotifyTxDrop (Ptr<const WifiPsdu> psdu);
580  void NotifyRxEnd (Ptr<const WifiPsdu> psdu);
589 
611  uint16_t channelFreqMhz,
612  WifiTxVector txVector,
613  SignalNoiseDbm signalNoise,
614  std::vector<bool> statusPerMpdu,
615  uint16_t staId = SU_STA_ID);
616 
638  uint16_t channelFreqMhz,
639  WifiTxVector txVector,
640  MpduInfo aMpdu,
641  SignalNoiseDbm signalNoise,
642  uint16_t staId);
643 
658  uint16_t channelFreqMhz,
659  WifiTxVector txVector,
660  uint16_t staId = SU_STA_ID);
661 
675  typedef void (* MonitorSnifferTxCallback)(const Ptr<const Packet> packet,
676  uint16_t channelFreqMhz,
677  WifiTxVector txVector,
678  MpduInfo aMpdu,
679  uint16_t staId);
680 
688  typedef void (* PsduTxBeginCallback)(WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW);
689 
696  typedef void (* PhyRxPayloadBeginTracedCallback)(WifiTxVector txVector, Time psduDuration);
697 
706  virtual int64_t AssignStreams (int64_t stream);
707 
715  void SetRxSensitivity (double threshold);
721  double GetRxSensitivity (void) const;
729  void SetCcaEdThreshold (double threshold);
735  double GetCcaEdThreshold (void) const;
741  void SetRxNoiseFigure (double noiseFigureDb);
747  void SetTxPowerStart (double start);
753  double GetTxPowerStart (void) const;
759  void SetTxPowerEnd (double end);
765  double GetTxPowerEnd (void) const;
773  void SetNTxPower (uint8_t n);
779  uint8_t GetNTxPower (void) const;
785  void SetTxGain (double gain);
791  double GetTxGain (void) const;
797  void SetRxGain (double gain);
803  double GetRxGain (void) const;
804 
810  void SetDevice (const Ptr<NetDevice> device);
816  Ptr<NetDevice> GetDevice (void) const;
837  Ptr<MobilityModel> GetMobility (void) const;
838 
849  void SetOperatingChannel (uint8_t number, uint16_t frequency, uint16_t width);
865  virtual void SetFrequency (uint16_t freq);
869  uint16_t GetFrequency (void) const;
876  void SetPrimary20Index (uint8_t index);
880  void SetNumberOfAntennas (uint8_t antennas);
884  uint8_t GetNumberOfAntennas (void) const;
888  void SetMaxSupportedTxSpatialStreams (uint8_t streams);
892  uint8_t GetMaxSupportedTxSpatialStreams (void) const;
896  void SetMaxSupportedRxSpatialStreams (uint8_t streams);
900  uint8_t GetMaxSupportedRxSpatialStreams (void) const;
906  void SetShortPhyPreambleSupported (bool preamble);
912  bool GetShortPhyPreambleSupported (void) const;
913 
919  void SetErrorRateModel (const Ptr<ErrorRateModel> rate);
937  void SetFrameCaptureModel (const Ptr<FrameCaptureModel> frameCaptureModel);
943  void SetPreambleDetectionModel (const Ptr<PreambleDetectionModel> preambleDetectionModel);
949  void SetWifiRadioEnergyModel (const Ptr<WifiRadioEnergyModel> wifiRadioEnergyModel);
950 
954  uint16_t GetChannelWidth (void) const;
969  virtual void SetChannelWidth (uint16_t channelWidth);
973  void AddSupportedChannelWidth (uint16_t width);
977  std::vector<uint16_t> GetSupportedChannelWidthSet (void) const;
978 
987  double GetPowerDbm (uint8_t power) const;
988 
996  void ResetCca (bool powerRestricted, double txPowerMaxSiso = 0, double txPowerMaxMimo = 0);
1005  double GetTxPowerForTransmission (Ptr<const WifiPpdu> ppdu) const;
1013  void NotifyChannelAccessRequested (void);
1014 
1015 
1026  virtual WifiSpectrumBand ConvertHeRuSubcarriers (uint16_t bandWidth, uint16_t guardBandwidth,
1027  HeRu::SubcarrierRange range, uint8_t bandIndex = 0) const;
1028 
1038  static void AddStaticPhyEntity (WifiModulationClass modulation, Ptr<PhyEntity> phyEntity);
1039 
1049 
1057  Ptr<PhyEntity> GetPhyEntity (WifiModulationClass modulation) const;
1058 
1062  uint64_t GetPreviouslyRxPpduUid (void) const;
1063 
1077  virtual uint16_t GetGuardBandwidth (uint16_t currentChannelWidth) const = 0;
1086  virtual std::tuple<double, double, double> GetTxMaskRejectionParams (void) const = 0;
1087 
1088 protected:
1089  virtual void DoDispose (void);
1090 
1094  void Reset (void);
1095 
1105  Time DoChannelSwitch (void);
1106 
1115  void SwitchMaybeToCcaBusy (uint16_t channelWidth);
1116 
1125  uint16_t GetMeasurementChannelWidth (const Ptr<const WifiPpdu> ppdu) const;
1126 
1135  virtual WifiSpectrumBand GetBand (uint16_t bandWidth, uint8_t bandIndex = 0);
1136 
1148  WifiSpectrumBand GetPrimaryBand (uint16_t bandWidth);
1149 
1160  void AddPhyEntity (WifiModulationClass modulation, Ptr<PhyEntity> phyEntity);
1161 
1165 
1168 
1171 
1173  std::map <std::pair<uint64_t /* UID*/, WifiPreamble>, Ptr<Event> > m_currentPreambleEvents;
1174 
1176 
1194  std::map<WifiModulationClass, Ptr<PhyEntity> > m_phyEntities;
1195 
1196 
1197 private:
1202  void Configure80211a (void);
1207  void Configure80211b (void);
1212  void Configure80211g (void);
1217  void Configure80211p (void);
1222  void Configure80211n (void);
1227  void Configure80211ac (void);
1232  void Configure80211ax (void);
1243  void PushMcs (WifiMode mode);
1247  void RebuildMcsMap (void);
1248 
1255 
1260  void MaybeCcaBusyDuration (uint16_t channelWidth);
1261 
1269 
1284 
1292 
1300 
1308 
1324 
1332 
1339 
1352  TracedCallback<Ptr<const Packet>, uint16_t /* frequency (MHz) */, WifiTxVector, MpduInfo, SignalNoiseDbm, uint16_t /* STA-ID*/> m_phyMonitorSniffRxTrace;
1353 
1366  TracedCallback<Ptr<const Packet>, uint16_t /* frequency (MHz) */, WifiTxVector, MpduInfo, uint16_t /* STA-ID*/> m_phyMonitorSniffTxTrace;
1367 
1374  static std::map<WifiModulationClass, Ptr<PhyEntity> > m_staticPhyEntities;
1375 
1382 
1384  std::vector<uint16_t> m_supportedChannelWidthSet;
1385 
1391 
1394  double m_txGainDb;
1395  double m_rxGainDb;
1398  uint8_t m_nTxPower;
1400 
1405 
1410 
1412 
1415 
1421 
1423 };
1424 
1430 std::ostream& operator<< (std::ostream& os, RxSignalInfo rxSignalInfo);
1431 
1432 } //namespace ns3
1433 
1434 #endif /* WIFI_PHY_H */
An identifier for simulation events.
Definition: event-id.h:54
std::pair< int16_t, int16_t > SubcarrierRange
(lowest index, highest index) pair defining a subcarrier range
Definition: he-ru.h:53
handles interference calculations
A base class which provides memory management and object aggregation.
Definition: object.h:88
Abstract class for PHY entities.
Definition: phy-entity.h:94
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition: type-id.h:59
represent a single transmission mode
Definition: wifi-mode.h:48
802.11 PHY layer model
Definition: wifi-phy.h:49
void SetNumberOfAntennas(uint8_t antennas)
Definition: wifi-phy.cc:1364
Ptr< WifiPhyStateHelper > m_state
Pointer to WifiPhyStateHelper.
Definition: wifi-phy.h:1164
double m_rxGainDb
Reception gain (dB)
Definition: wifi-phy.h:1395
Ptr< MobilityModel > m_mobility
Pointer to the mobility model.
Definition: wifi-phy.h:1414
bool IsStateIdle(void) const
Definition: wifi-phy.cc:2101
uint8_t m_txSpatialStreams
Number of supported TX spatial streams.
Definition: wifi-phy.h:1408
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:1768
bool IsStateTx(void) const
Definition: wifi-phy.cc:2113
Ptr< UniformRandomVariable > m_random
Provides uniform random variables.
Definition: wifi-phy.h:1163
uint8_t GetChannelNumber(void) const
Return current channel number.
Definition: wifi-phy.cc:1199
Ptr< WifiRadioEnergyModel > m_wifiRadioEnergyModel
Wifi radio energy model.
Definition: wifi-phy.h:1418
Time DoChannelSwitch(void)
Perform any actions necessary when user changes operating channel after initialization.
Definition: wifi-phy.cc:1299
virtual ~WifiPhy()
Definition: wifi-phy.cc:590
Time m_channelSwitchDelay
Time required to switch between channel.
Definition: wifi-phy.h:1411
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:2053
void SetCcaEdThreshold(double threshold)
Sets the CCA threshold (dBm).
Definition: wifi-phy.cc:678
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:1338
WifiPhyOperatingChannel m_operatingChannel
Operating channel.
Definition: wifi-phy.h:1383
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:1299
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:1307
bool m_channelAccessRequested
Flag if channels access has been requested (used for OBSS_PD SR)
Definition: wifi-phy.h:1404
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
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:1276
static std::map< WifiModulationClass, Ptr< PhyEntity > > m_staticPhyEntities
Map of implemented PHY entities.
Definition: wifi-phy.h:1374
void MaybeCcaBusyDuration(uint16_t channelWidth)
Eventually switch to CCA busy.
Definition: wifi-phy.cc:1914
Ptr< MobilityModel > GetMobility(void) const
Return the mobility model this PHY is associated with.
Definition: wifi-phy.cc:795
void SetMaxSupportedRxSpatialStreams(uint8_t streams)
Definition: wifi-phy.cc:1409
const WifiPhyOperatingChannel & GetOperatingChannel(void) const
Get a const reference to the operating channel.
Definition: wifi-phy.cc:1137
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:2259
bool GetShortPhyPreambleSupported(void) const
Return whether short PHY preamble is supported.
Definition: wifi-phy.cc:771
void NotifyTxEnd(WifiConstPsduMap psdus)
Public method used to fire a PhyTxEnd trace.
Definition: wifi-phy.cc:1649
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:1173
Time m_slot
Slot duration.
Definition: wifi-phy.h:1387
double m_powerDensityLimit
the power density limit (dBm/MHz)
Definition: wifi-phy.h:1399
WifiMode GetDefaultMode(void) const
Get the default WifiMode supported by the PHY.
Definition: wifi-phy.cc:1978
std::vector< uint16_t > GetSupportedChannelWidthSet(void) const
Definition: wifi-phy.cc:1457
bool IsStateRx(void) const
Definition: wifi-phy.cc:2107
void SetSifs(Time sifs)
Set the Short Interframe Space (SIFS) for this PHY.
Definition: wifi-phy.cc:904
WifiPhyBand GetPhyBand(void) const
Get the configured Wi-Fi band.
Definition: wifi-phy.cc:1124
EventId m_endPhyRxEvent
the end of PHY receive event
Definition: wifi-phy.h:1169
double m_txPowerBaseDbm
Minimum transmission power (dBm)
Definition: wifi-phy.h:1396
virtual void SetChannelNumber(uint8_t id)
Set channel number.
Definition: wifi-phy.cc:1174
Ptr< WifiPhyStateHelper > GetState(void) const
Return the WifiPhyStateHelper of this PHY.
Definition: wifi-phy.cc:629
uint8_t m_initialChannelNumber
Store channel number until initialization.
Definition: wifi-phy.h:1379
void NotifyRxDrop(Ptr< const WifiPsdu > psdu, WifiPhyRxfailureReason reason)
Public method used to fire a PhyRxDrop trace.
Definition: wifi-phy.cc:1694
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:1993
virtual void DoDispose(void)
Destructor implementation.
Definition: wifi-phy.cc:596
Time m_blockAckTxTime
estimated BlockAck TX time
Definition: wifi-phy.h:1390
void Configure80211a(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11a standard.
Definition: wifi-phy.cc:952
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
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:2207
double m_txPowerMaxMimo
MIMO maximum transmit power due to OBSS PD SR power restriction (dBm)
Definition: wifi-phy.h:1403
Time GetSlot(void) const
Return the slot duration for this PHY.
Definition: wifi-phy.cc:922
void AbortCurrentReception(WifiPhyRxfailureReason reason)
Due to newly arrived signal, the current reception cannot be continued and has to be aborted.
Definition: wifi-phy.cc:2171
Ptr< FrameCaptureModel > m_frameCaptureModel
Frame capture model.
Definition: wifi-phy.h:1416
TracedCallback< Ptr< const Packet > > m_phyRxEndTrace
The trace source fired when a packet ends the reception process from the medium.
Definition: wifi-phy.h:1331
Ptr< NetDevice > m_device
Pointer to the device.
Definition: wifi-phy.h:1413
void SetMaxSupportedTxSpatialStreams(uint8_t streams)
Definition: wifi-phy.cc:1378
uint16_t GetMeasurementChannelWidth(const Ptr< const WifiPpdu > ppdu) const
Return the channel width used to measure the RSSI.
Definition: wifi-phy.cc:2266
double GetTxPowerEnd(void) const
Return the maximum available transmission power level (dBm).
Definition: wifi-phy.cc:719
Time m_sifs
Short Interframe Space (SIFS) duration.
Definition: wifi-phy.h:1386
void SetReceiveErrorCallback(RxErrorCallback callback)
Definition: wifi-phy.cc:641
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:1947
virtual uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const =0
InterferenceHelper m_interference
the class handling interference computations
Definition: wifi-phy.h:1162
void(* PsduTxBeginCallback)(WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
TracedCallback signature for PSDU transmit events.
Definition: wifi-phy.h:688
uint8_t GetMaxSupportedRxSpatialStreams(void) const
Definition: wifi-phy.cc:1421
void SetPostReceptionErrorModel(const Ptr< ErrorModel > em)
Attach a receive ErrorModel to the WifiPhy.
Definition: wifi-phy.cc:815
uint16_t m_initialFrequency
Store frequency until initialization (MHz)
Definition: wifi-phy.h:1378
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:2088
void PushMcs(WifiMode mode)
Add the given MCS to the device MCS set.
uint8_t m_numberOfAntennas
Number of transmitters.
Definition: wifi-phy.h:1407
uint32_t m_txMpduReferenceNumber
A-MPDU reference number to identify all transmitted subframes belonging to the same received A-MPDU.
Definition: wifi-phy.h:1166
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
Definition: wifi-phy.cc:1610
Time GetLastRxStartTime(void) const
Return the start time of the last received packet.
Definition: wifi-phy.cc:2143
Time GetBlockAckTxTime(void) const
Return the estimated BlockAck TX time for this PHY.
Definition: wifi-phy.cc:946
void Configure80211p(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11p standard.
Definition: wifi-phy.cc:997
Time GetPifs(void) const
Return the PCF Interframe Space (PIFS) for this PHY.
Definition: wifi-phy.cc:934
static uint32_t GetMaxPsduSize(WifiModulationClass modulation)
Get the maximum PSDU size in bytes for the given modulation class.
Definition: wifi-phy.cc:1631
void NotifyTxBegin(WifiConstPsduMap psdus, double txPowerW)
Public method used to fire a PhyTxBegin trace.
Definition: wifi-phy.cc:1637
void Reset(void)
Reset data upon end of TX or RX.
Definition: wifi-phy.cc:1882
void SetShortPhyPreambleSupported(bool preamble)
Enable or disable short PHY preamble.
Definition: wifi-phy.cc:764
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
uint8_t m_initialPrimary20Index
Store the index of primary20 until initialization.
Definition: wifi-phy.h:1381
static TypeId GetTypeId(void)
Get the type ID.
Definition: wifi-phy.cc:297
WifiPhyBand m_band
WifiPhyBand.
Definition: wifi-phy.h:1377
void Configure80211b(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11b standard.
Definition: wifi-phy.cc:967
void SetSleepMode(void)
Put in sleep mode.
Definition: wifi-phy.cc:1463
void SetRxSensitivity(double threshold)
Sets the receive sensitivity threshold (dBm).
Definition: wifi-phy.cc:665
static const Ptr< const PhyEntity > GetStaticPhyEntity(WifiModulationClass modulation)
Get the implemented PHY entity corresponding to the modulation class.
Definition: wifi-phy.cc:870
uint8_t GetMaxSupportedTxSpatialStreams(void) const
Definition: wifi-phy.cc:1403
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:675
void Configure80211g(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11g standard.
Definition: wifi-phy.cc:984
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:1366
Time GetChannelSwitchDelay(void) const
Definition: wifi-phy.cc:858
virtual WifiSpectrumBand ConvertHeRuSubcarriers(uint16_t bandWidth, uint16_t guardBandwidth, HeRu::SubcarrierRange range, uint8_t bandIndex=0) const
Definition: wifi-phy.cc:1928
double m_txPowerMaxSiso
SISO maximum transmit power due to OBSS PD SR power restriction (dBm)
Definition: wifi-phy.h:1402
WifiPhyStandard GetPhyStandard(void) const
Get the configured Wi-Fi standard.
Definition: wifi-phy.cc:1131
std::map< WifiModulationClass, Ptr< PhyEntity > > m_phyEntities
This map holds the supported PHY entities.
Definition: wifi-phy.h:1194
void RebuildMcsMap(void)
Rebuild the mapping of MCS values to indices in the device MCS set.
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
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:1352
Ptr< ErrorModel > m_postReceptionErrorModel
Error model for receive packet events.
Definition: wifi-phy.h:1419
double GetTxPowerStart(void) const
Return the minimum available transmission power level (dBm).
Definition: wifi-phy.cc:706
WifiPhyStandard m_standard
WifiPhyStandard.
Definition: wifi-phy.h:1376
EventId m_endTxEvent
the end of transmit event
Definition: wifi-phy.h:1170
void ConfigureHtDeviceMcsSet(void)
Configure the device MCS set with the appropriate HtMcs modes for the number of available transmit sp...
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:1762
uint16_t GetNMcs(void) const
Definition: wifi-phy.cc:2039
void SetSlot(Time slot)
Set the slot duration for this PHY.
Definition: wifi-phy.cc:916
virtual void ConfigureStandardAndBand(WifiPhyStandard standard, WifiPhyBand band)
Configure the PHY-level parameters for different Wi-Fi standard.
Definition: wifi-phy.cc:1069
void StartReceivePreamble(Ptr< WifiPpdu > ppdu, RxPowerWattPerChannelBand rxPowersW, Time rxDuration)
Start receiving the PHY preamble of a PPDU (i.e.
Definition: wifi-phy.cc:1894
Ptr< Event > m_currentEvent
Hold the current event.
Definition: wifi-phy.h:1172
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
virtual std::tuple< double, double, double > GetTxMaskRejectionParams(void) const =0
double m_ccaEdThresholdW
Clear channel assessment (CCA) threshold in watts.
Definition: wifi-phy.h:1393
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:1737
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
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:2278
TracedCallback< Ptr< const Packet > > m_phyTxEndTrace
The trace source fired when a packet ends the transmission process on the medium.
Definition: wifi-phy.h:1291
void ResumeFromSleep(void)
Resume from sleep mode.
Definition: wifi-phy.cc:1512
uint64_t m_previouslyRxPpduUid
UID of the previously received PPDU, reset to UINT64_MAX upon transmission.
Definition: wifi-phy.h:1175
void Configure80211ac(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11ac standard.
Definition: wifi-phy.cc:1046
uint32_t m_rxMpduReferenceNumber
A-MPDU reference number to identify all received subframes belonging to the same received A-MPDU.
Definition: wifi-phy.h:1167
void SetWifiRadioEnergyModel(const Ptr< WifiRadioEnergyModel > wifiRadioEnergyModel)
Sets the wifi radio energy model.
Definition: wifi-phy.cc:834
void NotifyChannelAccessRequested(void)
Notify the PHY that an access to the channel was requested.
Definition: wifi-phy.cc:1958
Ptr< PreambleDetectionModel > m_preambleDetectionModel
Preamble detection model.
Definition: wifi-phy.h:1417
uint8_t GetNumberOfAntennas(void) const
Definition: wifi-phy.cc:1372
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:2155
void SetTxPowerEnd(double end)
Sets the maximum available transmission power level (dBm).
Definition: wifi-phy.cc:712
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
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:637
void NotifyRxEnd(Ptr< const WifiPsdu > psdu)
Public method used to fire a PhyRxEnd trace.
Definition: wifi-phy.cc:1682
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:2004
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:1283
double m_txGainDb
Transmission gain (dB)
Definition: wifi-phy.h:1394
std::vector< uint16_t > m_supportedChannelWidthSet
Supported channel width set (MHz)
Definition: wifi-phy.h:1384
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:2287
Time GetDelayUntilIdle(void)
Definition: wifi-phy.cc:2137
uint64_t GetPreviouslyRxPpduUid(void) const
Definition: wifi-phy.cc:1876
double GetPowerDbm(uint8_t power) const
Get the power of the given power level in dBm.
Definition: wifi-phy.cc:840
uint8_t m_nTxPower
Number of available transmission power levels.
Definition: wifi-phy.h:1398
void SetPreambleDetectionModel(const Ptr< PreambleDetectionModel > preambleDetectionModel)
Sets the preamble detection model.
Definition: wifi-phy.cc:828
void SetPifs(Time pifs)
Set the PCF Interframe Space (PIFS) for this PHY.
Definition: wifi-phy.cc:928
Time GetSifs(void) const
Return the Short Interframe Space (SIFS) for this PHY.
Definition: wifi-phy.cc:910
static Time GetStartOfPacketDuration(const WifiTxVector &txVector)
Definition: wifi-phy.cc:1580
virtual void StartTx(Ptr< WifiPpdu > ppdu)=0
Time GetAckTxTime(void) const
Return the estimated Ack TX time for this PHY.
Definition: wifi-phy.cc:940
void UnregisterListener(WifiPhyListener *listener)
Definition: wifi-phy.cc:653
void SetRxGain(double gain)
Sets the reception gain (dB).
Definition: wifi-phy.cc:751
void SetMobility(const Ptr< MobilityModel > mobility)
assign a mobility model to this device
Definition: wifi-phy.cc:789
double GetRxGain(void) const
Return the reception gain (dB).
Definition: wifi-phy.cc:758
void SetTxGain(double gain)
Sets the transmission gain (dB).
Definition: wifi-phy.cc:738
uint8_t m_rxSpatialStreams
Number of supported RX spatial streams.
Definition: wifi-phy.h:1409
void NotifyRxBegin(Ptr< const WifiPsdu > psdu, RxPowerWattPerChannelBand rxPowersW)
Public method used to fire a PhyRxBegin trace.
Definition: wifi-phy.cc:1670
double m_txPowerEndDbm
Maximum transmission power (dBm)
Definition: wifi-phy.h:1397
void SetOffMode(void)
Put in off mode.
Definition: wifi-phy.cc:1497
double CalculateSnr(const WifiTxVector &txVector, double ber) const
Definition: wifi-phy.cc:864
void Configure80211n(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11n standard.
Definition: wifi-phy.cc:1027
bool IsStateSwitching(void) const
Definition: wifi-phy.cc:2119
double GetTxGain(void) const
Return the transmission gain (dB).
Definition: wifi-phy.cc:745
uint8_t GetNTxPower(void) const
Return the number of available transmission power levels.
Definition: wifi-phy.cc:732
void EndReceiveInterBss(void)
For HE receptions only, check and possibly modify the transmit power restriction state at the end of ...
Definition: wifi-phy.cc:1937
double GetCcaEdThreshold(void) const
Return the CCA threshold (dBm).
Definition: wifi-phy.cc:685
double GetRxSensitivity(void) const
Return the receive sensitivity threshold (dBm).
Definition: wifi-phy.cc:672
void RegisterListener(WifiPhyListener *listener)
Definition: wifi-phy.cc:647
void SetDevice(const Ptr< NetDevice > device)
Sets the device this PHY is associated with.
Definition: wifi-phy.cc:777
bool IsStateSleep(void) const
Definition: wifi-phy.cc:2125
bool IsStateCcaBusy(void) const
Definition: wifi-phy.cc:2095
bool m_shortPreamble
Flag if short PHY preamble is supported.
Definition: wifi-phy.h:1406
Time m_pifs
PCF Interframe Space (PIFS) duration.
Definition: wifi-phy.h:1388
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
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
double GetTxPowerForTransmission(Ptr< const WifiPpdu > ppdu) const
Compute the transmit power for the next transmission.
Definition: wifi-phy.cc:2226
void(* PhyRxPayloadBeginTracedCallback)(WifiTxVector txVector, Time psduDuration)
TracedCallback signature for start of PSDU reception events.
Definition: wifi-phy.h:696
void SetCapabilitiesChangedCallback(Callback< void > callback)
Definition: wifi-phy.cc:659
void SetReceiveOkCallback(RxOkCallback callback)
Definition: wifi-phy.cc:635
void SetFrameCaptureModel(const Ptr< FrameCaptureModel > frameCaptureModel)
Sets the frame capture model.
Definition: wifi-phy.cc:822
void ResumeFromOff(void)
Resume from off mode.
Definition: wifi-phy.cc:1543
void Configure80211ax(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11ax standard.
Definition: wifi-phy.cc:1054
bool m_powerRestricted
Flag whether transmit power is restricted by OBSS PD SR.
Definition: wifi-phy.h:1401
Callback< void > m_capabilitiesChangedCallback
Callback when PHY capabilities changed.
Definition: wifi-phy.h:1422
void AddSupportedChannelWidth(uint16_t width)
Definition: wifi-phy.cc:1442
Ptr< NetDevice > GetDevice(void) const
Return the device this PHY is associated with.
Definition: wifi-phy.cc:783
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:1706
TracedCallback< WifiTxVector, Time > m_phyRxPayloadBeginTrace
The trace source fired when the reception of the PHY payload (PSDU) begins.
Definition: wifi-phy.h:1323
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
static Time GetPreambleDetectionDuration(void)
Definition: wifi-phy.cc:1574
Time m_timeLastPreambleDetected
Record the time the last preamble was detected.
Definition: wifi-phy.h:1420
double m_rxSensitivityW
Receive sensitivity threshold in watts.
Definition: wifi-phy.h:1392
static const std::set< FrequencyChannelInfo > m_frequencyChannels
Available frequency channels.
Definition: wifi-phy.h:61
uint16_t m_initialChannelWidth
Store channel width (MHz) until initialization.
Definition: wifi-phy.h:1380
Time GetLastRxEndTime(void) const
Return the end time of the last received packet.
Definition: wifi-phy.cc:2149
uint16_t GetChannelWidth(void) const
Definition: wifi-phy.cc:1233
bool IsStateOff(void) const
Definition: wifi-phy.cc:2131
void SetTxPowerStart(double start)
Sets the minimum available transmission power level (dBm).
Definition: wifi-phy.cc:699
virtual Ptr< Channel > GetChannel(void) const =0
Return the Channel this WifiPhy is connected to.
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:2298
static Time CalculatePhyPreambleAndHeaderDuration(const WifiTxVector &txVector)
Definition: wifi-phy.cc:1604
bool IsModeSupported(WifiMode mode) const
Check if the given WifiMode is supported by the PHY.
Definition: wifi-phy.cc:1965
uint16_t GetFrequency(void) const
Definition: wifi-phy.cc:1168
Time m_ackTxTime
estimated Ack TX time
Definition: wifi-phy.h:1389
void NotifyTxDrop(Ptr< const WifiPsdu > psdu)
Public method used to fire a PhyTxDrop trace.
Definition: wifi-phy.cc:1661
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
void SetErrorRateModel(const Ptr< ErrorRateModel > rate)
Sets the error rate model.
Definition: wifi-phy.cc:808
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...
WifiPhyStandard
Identifies the PHY specification that a Wifi device is 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:75
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:137
mobility
Definition: third.py:108
def start()
Definition: core.py:1855
Declaration of:
MpduInfo structure.
Definition: phy-entity.h:60
RxSignalInfo structure containing info on the received signal.
Definition: phy-entity.h:67
SignalNoiseDbm structure.
Definition: phy-entity.h:53
#define SU_STA_ID
Definition: wifi-mode.h:32