A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wifi-phy.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2005,2006 INRIA
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18 * Sébastien Deronne <sebastien.deronne@gmail.com>
19 */
20
21#ifndef WIFI_PHY_H
22#define WIFI_PHY_H
23
24#include "phy-entity.h"
27#include "wifi-standards.h"
28
29#include "ns3/error-model.h"
30
31#include <limits>
32
33namespace ns3
34{
35
36class Channel;
37class WifiNetDevice;
38class MobilityModel;
39class WifiPhyStateHelper;
40class FrameCaptureModel;
41class PreambleDetectionModel;
42class WifiRadioEnergyModel;
43class UniformRandomVariable;
44class InterferenceHelper;
45class ErrorRateModel;
46
52class WifiPhy : public Object
53{
54 public:
55 friend class PhyEntity;
60 static TypeId GetTypeId();
61
62 WifiPhy();
63 ~WifiPhy() override;
64
71
82
89 void RegisterListener(WifiPhyListener* listener);
96 void UnregisterListener(WifiPhyListener* listener);
97
102
111 RxPowerWattPerChannelBand& rxPowersW,
112 Time rxDuration);
113
118 void EndReceiveInterBss();
119
130 const WifiTxVector& txVector);
131
144 void Send(Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector);
152 void Send(WifiConstPsduMap psdus, const WifiTxVector& txVector);
153
157 virtual void StartTx(Ptr<const WifiPpdu> ppdu) = 0;
158
162 void SetSleepMode();
166 void ResumeFromSleep();
170 void SetOffMode();
174 void ResumeFromOff();
175
179 bool IsStateIdle() const;
183 bool IsStateCcaBusy() const;
187 bool IsStateRx() const;
191 bool IsStateTx() const;
195 bool IsStateSwitching() const;
199 bool IsStateSleep() const;
203 bool IsStateOff() const;
204
212
218 Time GetLastRxStartTime() const;
224 Time GetLastRxEndTime() const;
225
235 const WifiTxVector& txVector,
236 WifiPhyBand band,
237 uint16_t staId = SU_STA_ID);
253 const WifiTxVector& txVector,
254 WifiPhyBand band);
263 const WifiTxVector& txVector,
264 WifiPhyBand band);
265
287 static Time GetPayloadDuration(uint32_t size,
288 const WifiTxVector& txVector,
289 WifiPhyBand band,
290 MpduType mpdutype = NORMAL_MPDU,
291 uint16_t staId = SU_STA_ID);
309 static Time GetPayloadDuration(uint32_t size,
310 const WifiTxVector& txVector,
311 WifiPhyBand band,
312 MpduType mpdutype,
313 bool incFlag,
314 uint32_t& totalAmpduSize,
315 double& totalAmpduNumSymbols,
316 uint16_t staId);
322 static Time GetStartOfPacketDuration(const WifiTxVector& txVector);
323
338 std::list<WifiMode> GetModeList() const;
348 std::list<WifiMode> GetModeList(WifiModulationClass modulation) const;
357 bool IsModeSupported(WifiMode mode) const;
365 WifiMode GetDefaultMode() const;
375 bool IsMcsSupported(WifiModulationClass modulation, uint8_t mcs) const;
376
384 double CalculateSnr(const WifiTxVector& txVector, double ber) const;
385
391 void SetSifs(Time sifs);
397 Time GetSifs() const;
403 void SetSlot(Time slot);
409 Time GetSlot() const;
415 void SetPifs(Time pifs);
421 Time GetPifs() const;
427 Time GetAckTxTime() const;
433 Time GetBlockAckTxTime() const;
434
442
453 std::list<uint8_t> GetBssMembershipSelectorList() const;
459 uint16_t GetNMcs() const;
468 std::list<WifiMode> GetMcsList() const;
478 std::list<WifiMode> GetMcsList(WifiModulationClass modulation) const;
489 WifiMode GetMcs(WifiModulationClass modulation, uint8_t mcs) const;
490
496 uint8_t GetChannelNumber() const;
501
509 virtual void ConfigureStandard(WifiStandard standard);
510
517
523 WifiPhyBand GetPhyBand() const;
524
531
537 virtual Ptr<Channel> GetChannel() const = 0;
538
546 void NotifyTxBegin(WifiConstPsduMap psdus, double txPowerW);
553 void NotifyTxEnd(WifiConstPsduMap psdus);
584
607 uint16_t channelFreqMhz,
608 WifiTxVector txVector,
609 SignalNoiseDbm signalNoise,
610 std::vector<bool> statusPerMpdu,
611 uint16_t staId = SU_STA_ID);
612
635 uint16_t channelFreqMhz,
636 WifiTxVector txVector,
637 MpduInfo aMpdu,
638 SignalNoiseDbm signalNoise,
639 uint16_t staId);
640
655 uint16_t channelFreqMhz,
656 WifiTxVector txVector,
657 uint16_t staId = SU_STA_ID);
658
673 typedef void (*MonitorSnifferTxCallback)(const Ptr<const Packet> packet,
674 uint16_t channelFreqMhz,
675 WifiTxVector txVector,
676 MpduInfo aMpdu,
677 uint16_t staId);
678
685 typedef void (*PhyTxBeginTracedCallback)(Ptr<const Packet> packet, double txPowerW);
686
694 typedef void (*PsduTxBeginCallback)(WifiConstPsduMap psduMap,
695 WifiTxVector txVector,
696 double txPowerW);
697
705 RxPowerWattPerChannelBand rxPowersW);
706
713 typedef void (*PhyRxPayloadBeginTracedCallback)(WifiTxVector txVector, Time psduDuration);
714
723 virtual int64_t AssignStreams(int64_t stream);
724
732 void SetRxSensitivity(double threshold);
738 double GetRxSensitivity() const;
745 void SetCcaEdThreshold(double threshold);
751 double GetCcaEdThreshold() const;
758 void SetCcaSensitivityThreshold(double threshold);
764 double GetCcaSensitivityThreshold() const;
770 void SetRxNoiseFigure(double noiseFigureDb);
776 void SetTxPowerStart(double start);
782 double GetTxPowerStart() const;
788 void SetTxPowerEnd(double end);
794 double GetTxPowerEnd() const;
802 void SetNTxPower(uint8_t n);
808 uint8_t GetNTxPower() const;
814 void SetTxGain(double gain);
820 double GetTxGain() const;
826 void SetRxGain(double gain);
832 double GetRxGain() const;
833
839 virtual void SetDevice(const Ptr<WifiNetDevice> device);
856 void SetMobility(const Ptr<MobilityModel> mobility);
867
869 std::tuple<uint8_t /* channel number */,
870 uint16_t /* channel width */,
871 int /* WifiPhyBand */,
872 uint8_t /* primary20 index*/>;
873
887 void SetOperatingChannel(const ChannelTuple& channelTuple);
901 void SetOperatingChannel(const WifiPhyOperatingChannel& channel);
908 void SetFixedPhyBand(bool enable);
912 bool HasFixedPhyBand() const;
916 uint16_t GetFrequency() const;
920 uint8_t GetPrimary20Index() const;
930 uint16_t GetTxBandwidth(
931 WifiMode mode,
932 uint16_t maxAllowedBandWidth = std::numeric_limits<uint16_t>::max()) const;
936 void SetNumberOfAntennas(uint8_t antennas);
940 uint8_t GetNumberOfAntennas() const;
944 void SetMaxSupportedTxSpatialStreams(uint8_t streams);
948 uint8_t GetMaxSupportedTxSpatialStreams() const;
952 void SetMaxSupportedRxSpatialStreams(uint8_t streams);
956 uint8_t GetMaxSupportedRxSpatialStreams() const;
962 void SetShortPhyPreambleSupported(bool preamble);
968 bool GetShortPhyPreambleSupported() const;
969
975 virtual void SetInterferenceHelper(const Ptr<InterferenceHelper> helper);
976
982 void SetErrorRateModel(const Ptr<ErrorRateModel> model);
1000 void SetFrameCaptureModel(const Ptr<FrameCaptureModel> frameCaptureModel);
1006 void SetPreambleDetectionModel(const Ptr<PreambleDetectionModel> preambleDetectionModel);
1012 void SetWifiRadioEnergyModel(const Ptr<WifiRadioEnergyModel> wifiRadioEnergyModel);
1013
1017 uint16_t GetChannelWidth() const;
1018
1027 double GetPowerDbm(uint8_t power) const;
1028
1037 void ResetCca(bool powerRestricted, double txPowerMaxSiso = 0, double txPowerMaxMimo = 0);
1055
1063 const WifiSpectrumBandIndices& indices) const = 0;
1064
1074 static void AddStaticPhyEntity(WifiModulationClass modulation, Ptr<PhyEntity> phyEntity);
1075
1085
1098
1119
1123 uint64_t GetPreviouslyRxPpduUid() const;
1124
1138 virtual uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const = 0;
1147 virtual std::tuple<double, double, double> GetTxMaskRejectionParams() const = 0;
1148
1155 uint8_t GetPrimaryChannelNumber(uint16_t primaryChannelWidth) const;
1156
1165 virtual WifiSpectrumBandInfo GetBand(uint16_t bandWidth, uint8_t bandIndex = 0) = 0;
1166
1173
1178
1179 protected:
1180 void DoInitialize() override;
1181 void DoDispose() override;
1182
1186 void Reset();
1187
1201 virtual void DoChannelSwitch();
1202
1216 void NotifyCcaBusy(const Ptr<const WifiPpdu> ppdu, Time duration);
1217
1228 void AddPhyEntity(WifiModulationClass modulation, Ptr<PhyEntity> phyEntity);
1229
1232
1235
1240
1243
1245 std::map<std::pair<uint64_t /* UID*/, WifiPreamble>, Ptr<Event>>
1248
1251
1269 std::map<WifiModulationClass, Ptr<PhyEntity>> m_phyEntities;
1270
1271 private:
1276 void Configure80211a();
1281 void Configure80211b();
1286 void Configure80211g();
1291 void Configure80211p();
1296 void Configure80211n();
1301 void Configure80211ac();
1306 void Configure80211ax();
1311 void Configure80211be();
1322 void PushMcs(WifiMode mode);
1327
1334
1342
1357
1365
1373
1381
1397
1405
1412
1426 uint16_t /* frequency (MHz) */,
1428 MpduInfo,
1430 uint16_t /* STA-ID*/>
1432
1446 uint16_t /* frequency (MHz) */,
1448 MpduInfo,
1449 uint16_t /* STA-ID*/>
1451
1459 static std::map<WifiModulationClass, Ptr<PhyEntity>>& GetStaticPhyEntities();
1460
1466
1472
1478
1479 double m_txGainDb;
1480 double m_rxGainDb;
1483 uint8_t m_nTxPower;
1485
1487 double
1489 double
1493
1498
1500
1502
1505
1511
1513};
1514
1520std::ostream& operator<<(std::ostream& os, RxSignalInfo rxSignalInfo);
1521
1522} // namespace ns3
1523
1524#endif /* WIFI_PHY_H */
An identifier for simulation events.
Definition: event-id.h:55
A base class which provides memory management and object aggregation.
Definition: object.h:89
Abstract class for PHY entities.
Definition: phy-entity.h:97
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition: type-id.h:59
represent a single transmission mode
Definition: wifi-mode.h:51
802.11 PHY layer model
Definition: wifi-phy.h:53
static TypeId GetTypeId()
Get the type ID.
Definition: wifi-phy.cc:62
void SetNumberOfAntennas(uint8_t antennas)
Definition: wifi-phy.cc:1249
Ptr< WifiPhyStateHelper > m_state
Pointer to WifiPhyStateHelper.
Definition: wifi-phy.h:1234
Time GetBlockAckTxTime() const
Return the estimated BlockAck TX time for this PHY.
Definition: wifi-phy.cc:819
double GetCcaEdThreshold() const
Return the CCA energy detection threshold (dBm).
Definition: wifi-phy.cc:501
double m_rxGainDb
Reception gain (dB)
Definition: wifi-phy.h:1480
bool IsStateTx() const
Definition: wifi-phy.cc:2021
Ptr< MobilityModel > m_mobility
Pointer to the mobility model.
Definition: wifi-phy.h:1504
void(* PhyTxBeginTracedCallback)(Ptr< const Packet > packet, double txPowerW)
TracedCallback signature for Phy transmit events.
Definition: wifi-phy.h:685
bool IsStateIdle() const
Definition: wifi-phy.cc:2009
virtual void SetInterferenceHelper(const Ptr< InterferenceHelper > helper)
Sets the interference helper.
Definition: wifi-phy.cc:633
uint8_t m_txSpatialStreams
Number of supported TX spatial streams.
Definition: wifi-phy.h:1496
bool IsStateCcaBusy() const
Definition: wifi-phy.cc:2003
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:1709
Ptr< UniformRandomVariable > m_random
Provides uniform random variables.
Definition: wifi-phy.h:1233
Ptr< WifiRadioEnergyModel > m_wifiRadioEnergyModel
Wifi radio energy model.
Definition: wifi-phy.h:1508
void Configure80211ax()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11ax standard.
Definition: wifi-phy.cc:927
Time m_channelSwitchDelay
Time required to switch between channel.
Definition: wifi-phy.h:1501
void SetCcaEdThreshold(double threshold)
Sets the CCA energy detection threshold (dBm).
Definition: wifi-phy.cc:494
void NotifyCcaBusy(const Ptr< const WifiPpdu > ppdu, Time duration)
Notify PHY state helper to switch to CCA busy state,.
Definition: wifi-phy.cc:2070
WifiPhyOperatingChannel m_operatingChannel
Operating channel.
Definition: wifi-phy.h:1464
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:1372
void SetErrorRateModel(const Ptr< ErrorRateModel > model)
Sets the error rate model.
Definition: wifi-phy.cc:641
bool m_channelAccessRequested
Flag if channels access has been requested (used for OBSS_PD SR)
Definition: wifi-phy.h:1491
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:1449
Time GetSlot() const
Return the slot duration for this PHY.
Definition: wifi-phy.cc:795
uint32_t GetSubcarrierSpacing() const
Definition: wifi-phy.cc:2204
void SetMaxSupportedRxSpatialStreams(uint8_t streams)
Definition: wifi-phy.cc:1299
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:2173
void Configure80211g()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11g standard.
Definition: wifi-phy.cc:857
uint8_t GetPrimary20Index() const
Definition: wifi-phy.cc:1041
void NotifyTxEnd(WifiConstPsduMap psdus)
Public method used to fire a PhyTxEnd trace.
Definition: wifi-phy.cc:1546
uint16_t GetChannelWidth() const
Definition: wifi-phy.cc:1035
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:1246
uint8_t GetNumberOfAntennas() const
Definition: wifi-phy.cc:1261
Time m_slot
Slot duration.
Definition: wifi-phy.h:1468
double m_powerDensityLimit
the power density limit (dBm/MHz)
Definition: wifi-phy.h:1484
Time GetDelayUntilIdle()
Definition: wifi-phy.cc:2045
double GetRxSensitivity() const
Return the receive sensitivity threshold (dBm).
Definition: wifi-phy.cc:488
bool GetShortPhyPreambleSupported() const
Return whether short PHY preamble is supported.
Definition: wifi-phy.cc:603
void SetSifs(Time sifs)
Set the Short Interframe Space (SIFS) for this PHY.
Definition: wifi-phy.cc:777
std::list< uint8_t > GetBssMembershipSelectorList() const
The WifiPhy::BssMembershipSelector() method is used (e.g., by a WifiRemoteStationManager) to determin...
Definition: wifi-phy.cc:1317
void Configure80211n()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11n standard.
Definition: wifi-phy.cc:900
EventId m_endPhyRxEvent
the end of PHY receive event
Definition: wifi-phy.h:1241
double GetTxGain() const
Return the transmission gain (dB).
Definition: wifi-phy.cc:577
double m_txPowerBaseDbm
Minimum transmission power (dBm)
Definition: wifi-phy.h:1481
Time GetDelayUntilChannelSwitch()
Perform any actions necessary when user changes operating channel after initialization.
Definition: wifi-phy.cc:1122
void Configure80211be()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11be standard.
Definition: wifi-phy.cc:942
void NotifyRxDrop(Ptr< const WifiPsdu > psdu, WifiPhyRxfailureReason reason)
Public method used to fire a PhyRxDrop trace.
Definition: wifi-phy.cc:1597
bool IsStateRx() const
Definition: wifi-phy.cc:2015
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:1901
Time GetSifs() const
Return the Short Interframe Space (SIFS) for this PHY.
Definition: wifi-phy.cc:783
uint16_t GetFrequency() const
Definition: wifi-phy.cc:1023
Ptr< MobilityModel > GetMobility() const
Return the mobility model this PHY is associated with.
Definition: wifi-phy.cc:627
uint16_t GetNMcs() const
Definition: wifi-phy.cc:1947
Time m_blockAckTxTime
estimated BlockAck TX time
Definition: wifi-phy.h:1471
uint8_t GetPrimaryChannelNumber(uint16_t primaryChannelWidth) const
Get channel number of the primary channel.
Definition: wifi-phy.cc:2198
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:2114
double m_txPowerMaxMimo
MIMO maximum transmit power due to OBSS PD SR power restriction (dBm)
Definition: wifi-phy.h:1490
void ResumeFromSleep()
Resume from sleep mode.
Definition: wifi-phy.cc:1381
static Time GetPreambleDetectionDuration()
Definition: wifi-phy.cc:1437
void Configure80211p()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11p standard.
Definition: wifi-phy.cc:870
void AbortCurrentReception(WifiPhyRxfailureReason reason)
Due to newly arrived signal, the current reception cannot be continued and has to be aborted.
Definition: wifi-phy.cc:2077
Ptr< FrameCaptureModel > m_frameCaptureModel
Frame capture model.
Definition: wifi-phy.h:1506
TracedCallback< Ptr< const Packet > > m_phyRxEndTrace
The trace source fired when a packet ends the reception process from the medium.
Definition: wifi-phy.h:1404
void NotifyRxBegin(Ptr< const WifiPsdu > psdu, const RxPowerWattPerChannelBand &rxPowersW)
Public method used to fire a PhyRxBegin trace.
Definition: wifi-phy.cc:1573
Time GetChannelSwitchDelay() const
Definition: wifi-phy.cc:692
void SetMaxSupportedTxSpatialStreams(uint8_t streams)
Definition: wifi-phy.cc:1267
Time m_sifs
Short Interframe Space (SIFS) duration.
Definition: wifi-phy.h:1467
void SetReceiveErrorCallback(RxErrorCallback callback)
Definition: wifi-phy.cc:457
virtual uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const =0
void ConfigureHtDeviceMcsSet()
Configure the device MCS set with the appropriate HtMcs modes for the number of available transmit sp...
bool IsStateOff() const
Definition: wifi-phy.cc:2039
uint8_t GetMaxSupportedRxSpatialStreams() const
Definition: wifi-phy.cc:1311
void(* PsduTxBeginCallback)(WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
TracedCallback signature for PSDU transmit events.
Definition: wifi-phy.h:694
double GetTxPowerEnd() const
Return the maximum available transmission power level (dBm).
Definition: wifi-phy.cc:551
virtual void ConfigureStandard(WifiStandard standard)
Configure the PHY-level parameters for different Wi-Fi standard.
Definition: wifi-phy.cc:950
void SetPostReceptionErrorModel(const Ptr< ErrorModel > em)
Attach a receive ErrorModel to the WifiPhy.
Definition: wifi-phy.cc:648
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:1996
void PushMcs(WifiMode mode)
Add the given MCS to the device MCS set.
uint8_t m_numberOfAntennas
Number of transmitters.
Definition: wifi-phy.h:1495
ChannelTuple m_channelSettings
Store operating channel settings until initialization.
Definition: wifi-phy.h:1463
uint32_t m_txMpduReferenceNumber
A-MPDU reference number to identify all transmitted subframes belonging to the same received A-MPDU.
Definition: wifi-phy.h:1236
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
Definition: wifi-phy.cc:1496
static uint32_t GetMaxPsduSize(WifiModulationClass modulation)
Get the maximum PSDU size in bytes for the given modulation class.
Definition: wifi-phy.cc:1525
Ptr< WifiPhyStateHelper > GetState() const
Return the WifiPhyStateHelper of this PHY.
Definition: wifi-phy.cc:445
virtual Ptr< Channel > GetChannel() const =0
Return the Channel this WifiPhy is connected to.
void NotifyTxBegin(WifiConstPsduMap psdus, double txPowerW)
Public method used to fire a PhyTxBegin trace.
Definition: wifi-phy.cc:1531
void EndReceiveInterBss()
For HE receptions only, check and possibly modify the transmit power restriction state at the end of ...
Definition: wifi-phy.cc:1855
void SetSleepMode()
Put in sleep mode.
Definition: wifi-phy.cc:1332
void SetShortPhyPreambleSupported(bool preamble)
Enable or disable short PHY preamble.
Definition: wifi-phy.cc:596
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:557
WifiPhyBand m_band
WifiPhyBand.
Definition: wifi-phy.h:1462
void SetRxSensitivity(double threshold)
Sets the receive sensitivity threshold (dBm).
Definition: wifi-phy.cc:481
static const Ptr< const PhyEntity > GetStaticPhyEntity(WifiModulationClass modulation)
Get the implemented PHY entity corresponding to the modulation class.
Definition: wifi-phy.cc:704
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:673
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:1450
virtual WifiSpectrumBandFrequencies ConvertIndicesToFrequencies(const WifiSpectrumBandIndices &indices) const =0
This is a helper function to convert start and stop indices to start and stop frequencies.
double m_txPowerMaxSiso
SISO maximum transmit power due to OBSS PD SR power restriction (dBm)
Definition: wifi-phy.h:1488
std::map< WifiModulationClass, Ptr< PhyEntity > > m_phyEntities
This map holds the supported PHY entities.
Definition: wifi-phy.h:1269
virtual void StartTx(Ptr< const WifiPpdu > ppdu)=0
void AddPhyEntity(WifiModulationClass modulation, Ptr< PhyEntity > phyEntity)
Add the PHY entity to the map of supported PHY entities for the given modulation class for the WifiPh...
Definition: wifi-phy.cc:764
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:1431
Ptr< ErrorModel > m_postReceptionErrorModel
Error model for receive packet events.
Definition: wifi-phy.h:1509
EventId m_endTxEvent
the end of transmit event
Definition: wifi-phy.h:1242
double GetRxGain() const
Return the reception gain (dB).
Definition: wifi-phy.cc:590
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:1703
static std::map< WifiModulationClass, Ptr< PhyEntity > > & GetStaticPhyEntities()
Definition: wifi-phy.cc:438
void SetSlot(Time slot)
Set the slot duration for this PHY.
Definition: wifi-phy.cc:789
void SetOperatingChannel(const ChannelTuple &channelTuple)
If the standard for this object has not been set yet, store the given channel settings.
Definition: wifi-phy.cc:1082
WifiPhyBand GetPhyBand() const
Get the configured Wi-Fi band.
Definition: wifi-phy.cc:1005
double m_ccaSensitivityThresholdW
Clear channel assessment (CCA) modulation and coding rate sensitivity threshold in watts.
Definition: wifi-phy.h:1476
Ptr< Event > m_currentEvent
Hold the current event.
Definition: wifi-phy.h:1244
Time GetLastRxStartTime() const
Return the start time of the last received packet.
Definition: wifi-phy.cc:2051
WifiMode GetDefaultMode() const
Get the default WifiMode supported by the PHY.
Definition: wifi-phy.cc:1885
void SetCcaSensitivityThreshold(double threshold)
Sets the CCA sensitivity threshold (dBm).
Definition: wifi-phy.cc:507
double m_ccaEdThresholdW
Clear channel assessment (CCA) energy detection (ED) threshold in watts.
Definition: wifi-phy.h:1474
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:1663
Ptr< PhyEntity > GetPhyEntity(WifiModulationClass modulation) const
Get the supported PHY entity corresponding to the modulation class.
Definition: wifi-phy.cc:713
uint8_t GetChannelNumber() const
Return current channel number.
Definition: wifi-phy.cc:1029
TracedCallback< Ptr< const Packet > > m_phyTxEndTrace
The trace source fired when a packet ends the transmission process on the medium.
Definition: wifi-phy.h:1364
uint64_t m_previouslyRxPpduUid
UID of the previously received PPDU, reset to UINT64_MAX upon transmission.
Definition: wifi-phy.h:1249
uint32_t m_rxMpduReferenceNumber
A-MPDU reference number to identify all received subframes belonging to the same received A-MPDU.
Definition: wifi-phy.h:1238
void SetWifiRadioEnergyModel(const Ptr< WifiRadioEnergyModel > wifiRadioEnergyModel)
Sets the wifi radio energy model.
Definition: wifi-phy.cc:667
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:1349
virtual void SetDevice(const Ptr< WifiNetDevice > device)
Sets the device this PHY is associated with.
Definition: wifi-phy.cc:609
Ptr< PreambleDetectionModel > m_preambleDetectionModel
Preamble detection model.
Definition: wifi-phy.h:1507
void SetTxPowerEnd(double end)
Sets the maximum available transmission power level (dBm).
Definition: wifi-phy.cc:544
Time GetPifs() const
Return the PCF Interframe Space (PIFS) for this PHY.
Definition: wifi-phy.cc:807
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:754
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:634
void NotifyRxEnd(Ptr< const WifiPsdu > psdu)
Public method used to fire a PhyRxEnd trace.
Definition: wifi-phy.cc:1585
void StartReceivePreamble(Ptr< const WifiPpdu > ppdu, RxPowerWattPerChannelBand &rxPowersW, Time rxDuration)
Start receiving the PHY preamble of a PPDU (i.e.
Definition: wifi-phy.cc:1833
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:1356
double m_txGainDb
Transmission gain (dB)
Definition: wifi-phy.h:1479
bool IsStateSleep() const
Definition: wifi-phy.cc:2033
Ptr< WifiNetDevice > GetDevice() const
Return the device this PHY is associated with.
Definition: wifi-phy.cc:615
WifiStandard m_standard
WifiStandard.
Definition: wifi-phy.h:1461
double GetPowerDbm(uint8_t power) const
Get the power of the given power level in dBm.
Definition: wifi-phy.cc:673
uint8_t m_nTxPower
Number of available transmission power levels.
Definition: wifi-phy.h:1483
void DoDispose() override
Destructor implementation.
Definition: wifi-phy.cc:401
bool IsStateSwitching() const
Definition: wifi-phy.cc:2027
virtual void DoChannelSwitch()
Actually switch channel based on the stored channel settings.
Definition: wifi-phy.cc:1169
void SetOffMode()
Put in off mode.
Definition: wifi-phy.cc:1366
double m_noiseFigureDb
The noise figure in dB.
Definition: wifi-phy.h:1499
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:1411
void SetPreambleDetectionModel(const Ptr< PreambleDetectionModel > preambleDetectionModel)
Sets the preamble detection model.
Definition: wifi-phy.cc:661
void RebuildMcsMap()
Rebuild the mapping of MCS values to indices in the device MCS set.
void SetPifs(Time pifs)
Set the PCF Interframe Space (PIFS) for this PHY.
Definition: wifi-phy.cc:801
void Configure80211b()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11b standard.
Definition: wifi-phy.cc:840
static Time GetStartOfPacketDuration(const WifiTxVector &txVector)
Definition: wifi-phy.cc:1443
virtual FrequencyRange GetCurrentFrequencyRange() const =0
Get the frequency range of the current RF interface.
uint16_t GetTxBandwidth(WifiMode mode, uint16_t maxAllowedBandWidth=std::numeric_limits< uint16_t >::max()) const
Get the bandwidth for a transmission occurring on the current operating channel and using the given W...
Definition: wifi-phy.cc:1059
virtual WifiSpectrumBandInfo GetBand(uint16_t bandWidth, uint8_t bandIndex=0)=0
Get the info of a given band.
void UnregisterListener(WifiPhyListener *listener)
Definition: wifi-phy.cc:469
void SetRxGain(double gain)
Sets the reception gain (dB).
Definition: wifi-phy.cc:583
void SetMobility(const Ptr< MobilityModel > mobility)
assign a mobility model to this device
Definition: wifi-phy.cc:621
void SetTxGain(double gain)
Sets the transmission gain (dB).
Definition: wifi-phy.cc:570
uint8_t m_rxSpatialStreams
Number of supported RX spatial streams.
Definition: wifi-phy.h:1497
double m_txPowerEndDbm
Maximum transmission power (dBm)
Definition: wifi-phy.h:1482
double CalculateSnr(const WifiTxVector &txVector, double ber) const
Definition: wifi-phy.cc:698
void SetFixedPhyBand(bool enable)
Configure whether it is prohibited to change PHY band after initialization.
Definition: wifi-phy.cc:1047
void(* PhyRxBeginTracedCallback)(Ptr< const Packet > packet, RxPowerWattPerChannelBand rxPowersW)
TracedCallback signature for PhyRxBegin trace source.
Definition: wifi-phy.h:704
~WifiPhy() override
Definition: wifi-phy.cc:370
void Configure80211ac()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11ac standard.
Definition: wifi-phy.cc:919
bool HasFixedPhyBand() const
Definition: wifi-phy.cc:1053
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:1380
void RegisterListener(WifiPhyListener *listener)
Definition: wifi-phy.cc:463
Ptr< WifiNetDevice > m_device
Pointer to the device.
Definition: wifi-phy.h:1503
Ptr< InterferenceHelper > m_interference
Pointer to a helper responsible for interference computations.
Definition: wifi-phy.h:1231
void DoInitialize() override
Initialize() implementation.
Definition: wifi-phy.cc:376
bool m_shortPreamble
Flag if short PHY preamble is supported.
Definition: wifi-phy.h:1494
Time m_pifs
PCF Interframe Space (PIFS) duration.
Definition: wifi-phy.h:1469
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:520
double GetTxPowerStart() const
Return the minimum available transmission power level (dBm).
Definition: wifi-phy.cc:538
double GetTxPowerForTransmission(Ptr< const WifiPpdu > ppdu) const
Compute the transmit power for the next transmission.
Definition: wifi-phy.cc:2137
void(* PhyRxPayloadBeginTracedCallback)(WifiTxVector txVector, Time psduDuration)
TracedCallback signature for start of PSDU reception events.
Definition: wifi-phy.h:713
WifiStandard GetStandard() const
Get the configured Wi-Fi standard.
Definition: wifi-phy.cc:1011
void SetCapabilitiesChangedCallback(Callback< void > callback)
Definition: wifi-phy.cc:475
void SetReceiveOkCallback(RxOkCallback callback)
Definition: wifi-phy.cc:451
void SetFrameCaptureModel(const Ptr< FrameCaptureModel > frameCaptureModel)
Sets the frame capture model.
Definition: wifi-phy.cc:655
void NotifyChannelAccessRequested()
Notify the PHY that an access to the channel was requested.
Definition: wifi-phy.cc:1865
void ResumeFromOff()
Resume from off mode.
Definition: wifi-phy.cc:1409
bool m_powerRestricted
Flag whether transmit power is restricted by OBSS PD SR.
Definition: wifi-phy.h:1486
virtual std::tuple< double, double, double > GetTxMaskRejectionParams() const =0
Callback< void > m_capabilitiesChangedCallback
Callback when PHY capabilities changed.
Definition: wifi-phy.h:1512
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:1609
Ptr< PhyEntity > GetPhyEntityForPpdu(const Ptr< const WifiPpdu > ppdu) const
Get the supported PHY entity to use for a received PPDU.
Definition: wifi-phy.cc:734
Time GetAckTxTime() const
Return the estimated Ack TX time for this PHY.
Definition: wifi-phy.cc:813
uint64_t GetPreviouslyRxPpduUid() const
Definition: wifi-phy.cc:1814
void Reset()
Reset data upon end of TX or RX.
Definition: wifi-phy.cc:1820
TracedCallback< WifiTxVector, Time > m_phyRxPayloadBeginTrace
The trace source fired when the reception of the PHY payload (PSDU) begins.
Definition: wifi-phy.h:1396
Time GetLastRxEndTime() const
Return the end time of the last received packet.
Definition: wifi-phy.cc:2057
std::tuple< uint8_t, uint16_t, int, uint8_t > ChannelTuple
Tuple identifying an operating channel.
Definition: wifi-phy.h:872
Time m_timeLastPreambleDetected
Record the time the last preamble was detected.
Definition: wifi-phy.h:1510
uint8_t GetMaxSupportedTxSpatialStreams() const
Definition: wifi-phy.cc:1293
void Configure80211a()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11a standard.
Definition: wifi-phy.cc:825
std::list< WifiMode > GetMcsList() const
The WifiPhy::GetMcsList() method is used (e.g., by a WifiRemoteStationManager) to determine the set o...
Definition: wifi-phy.cc:1961
std::list< WifiMode > GetModeList() const
The WifiPhy::GetModeList() method is used (e.g., by a WifiRemoteStationManager) to determine the set ...
Definition: wifi-phy.cc:1912
void SwitchMaybeToCcaBusy(const Ptr< const WifiPpdu > ppdu)
Check if PHY state should move to CCA busy state based on current state of interference tracker.
Definition: wifi-phy.cc:2063
double m_rxSensitivityW
Receive sensitivity threshold in watts.
Definition: wifi-phy.h:1473
const WifiPhyOperatingChannel & GetOperatingChannel() const
Get a const reference to the operating channel.
Definition: wifi-phy.cc:1017
double GetCcaSensitivityThreshold() const
Return the CCA sensitivity threshold (dBm).
Definition: wifi-phy.cc:514
bool m_fixedPhyBand
True to prohibit changing PHY band after initialization.
Definition: wifi-phy.h:1465
Ptr< PhyEntity > GetLatestPhyEntity() const
Get the latest PHY entity supported by this PHY instance.
Definition: wifi-phy.cc:728
void SetTxPowerStart(double start)
Sets the minimum available transmission power level (dBm).
Definition: wifi-phy.cc:531
uint8_t GetNTxPower() const
Return the number of available transmission power levels.
Definition: wifi-phy.cc:564
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:2180
static Time CalculatePhyPreambleAndHeaderDuration(const WifiTxVector &txVector)
Definition: wifi-phy.cc:1489
bool IsModeSupported(WifiMode mode) const
Check if the given WifiMode is supported by the PHY.
Definition: wifi-phy.cc:1872
Time m_ackTxTime
estimated Ack TX time
Definition: wifi-phy.h:1470
void NotifyTxDrop(Ptr< const WifiPsdu > psdu)
Public method used to fire a PhyTxDrop trace.
Definition: wifi-phy.cc:1561
receive notifications about PHY events.
Class that keeps track of all information about the current PHY operating channel.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
WifiStandard
Identifies the IEEE 802.11 specifications that a Wifi device can be configured to use.
WifiPhyRxfailureReason
Enumeration of the possible reception failure reasons.
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
WifiPhyBand
Identifies the PHY band.
Definition: wifi-phy-band.h:33
WifiModulationClass
This enumeration defines the modulation classes per (Table 10-6 "Modulation classes"; IEEE 802....
MpduType
The type of an MPDU.
@ NORMAL_MPDU
The MPDU is not part of an A-MPDU.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
std::pair< uint64_t, uint64_t > WifiSpectrumBandFrequencies
typedef for a pair of start and stop frequencies in Hz to represent a band
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:129
std::pair< uint32_t, uint32_t > WifiSpectrumBandIndices
typedef for a pair of start and stop sub-band indices
std::map< WifiSpectrumBandInfo, double > RxPowerWattPerChannelBand
A map of the received power (Watts) for each band.
Definition: phy-entity.h:78
static constexpr uint16_t SU_STA_ID
STA_ID to identify a single user (SU)
Definition: wifi-mode.h:35
Declaration of:
Struct defining a frequency range between minFrequency (MHz) and maxFrequency (MHz).
MpduInfo structure.
Definition: phy-entity.h:63
RxSignalInfo structure containing info on the received signal.
Definition: phy-entity.h:70
SignalNoiseDbm structure.
Definition: phy-entity.h:56
WifiSpectrumBandInfo structure containing info about a spectrum band.