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
33#define WIFI_PHY_NS_LOG_APPEND_CONTEXT(phy) \
34 { \
35 if (DynamicCast<const WifiPhy>(phy)) \
36 { \
37 std::clog << "[index=" << +phy->GetPhyId() << "][channel=" \
38 << (phy->GetOperatingChannel().IsSet() \
39 ? std::to_string(+phy->GetOperatingChannel().GetNumber()) \
40 : "UNKNOWN") \
41 << "][band=" << phy->GetPhyBand() << "] "; \
42 } \
43 }
44
45namespace ns3
46{
47
48class Channel;
49class WifiNetDevice;
50class MobilityModel;
51class WifiPhyStateHelper;
52class FrameCaptureModel;
53class PreambleDetectionModel;
54class WifiRadioEnergyModel;
55class UniformRandomVariable;
56class InterferenceHelper;
57class ErrorRateModel;
58
64class WifiPhy : public Object
65{
66 public:
67 friend class PhyEntity;
72 static TypeId GetTypeId();
73
74 WifiPhy();
75 ~WifiPhy() override;
76
83
94
101 void RegisterListener(const std::shared_ptr<WifiPhyListener>& listener);
108 void UnregisterListener(const std::shared_ptr<WifiPhyListener>& listener);
109
114
123 RxPowerWattPerChannelBand& rxPowersW,
124 Time rxDuration);
125
129 bool IsReceivingPhyHeader() const;
130
135 void EndReceiveInterBss();
136
147 const WifiTxVector& txVector);
148
161 void Send(Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector);
169 void Send(WifiConstPsduMap psdus, const WifiTxVector& txVector);
170
174 virtual void StartTx(Ptr<const WifiPpdu> ppdu) = 0;
175
179 void SetSleepMode();
183 void ResumeFromSleep();
187 void SetOffMode();
191 void ResumeFromOff();
192
196 bool IsStateIdle() const;
200 bool IsStateCcaBusy() const;
204 bool IsStateRx() const;
208 bool IsStateTx() const;
212 bool IsStateSwitching() const;
216 bool IsStateSleep() const;
220 bool IsStateOff() const;
221
229
235 Time GetLastRxStartTime() const;
241 Time GetLastRxEndTime() const;
242
252 const WifiTxVector& txVector,
253 WifiPhyBand band,
254 uint16_t staId = SU_STA_ID);
270 const WifiTxVector& txVector,
271 WifiPhyBand band);
280 const WifiTxVector& txVector,
281 WifiPhyBand band);
282
304 static Time GetPayloadDuration(uint32_t size,
305 const WifiTxVector& txVector,
306 WifiPhyBand band,
307 MpduType mpdutype = NORMAL_MPDU,
308 uint16_t staId = SU_STA_ID);
326 static Time GetPayloadDuration(uint32_t size,
327 const WifiTxVector& txVector,
328 WifiPhyBand band,
329 MpduType mpdutype,
330 bool incFlag,
331 uint32_t& totalAmpduSize,
332 double& totalAmpduNumSymbols,
333 uint16_t staId);
339 static Time GetStartOfPacketDuration(const WifiTxVector& txVector);
340
355 std::list<WifiMode> GetModeList() const;
365 std::list<WifiMode> GetModeList(WifiModulationClass modulation) const;
374 bool IsModeSupported(WifiMode mode) const;
382 WifiMode GetDefaultMode() const;
392 bool IsMcsSupported(WifiModulationClass modulation, uint8_t mcs) const;
393
401 double CalculateSnr(const WifiTxVector& txVector, double ber) const;
402
408 void SetSifs(Time sifs);
414 Time GetSifs() const;
420 void SetSlot(Time slot);
426 Time GetSlot() const;
432 void SetPifs(Time pifs);
438 Time GetPifs() const;
444 Time GetAckTxTime() const;
450 Time GetBlockAckTxTime() const;
451
459
470 std::list<uint8_t> GetBssMembershipSelectorList() const;
476 uint16_t GetNMcs() const;
485 std::list<WifiMode> GetMcsList() const;
495 std::list<WifiMode> GetMcsList(WifiModulationClass modulation) const;
506 WifiMode GetMcs(WifiModulationClass modulation, uint8_t mcs) const;
507
513 uint8_t GetChannelNumber() const;
518
526 virtual void ConfigureStandard(WifiStandard standard);
527
536
541
548
554 WifiPhyBand GetPhyBand() const;
555
562
568 virtual Ptr<Channel> GetChannel() const = 0;
569
577 void NotifyTxBegin(WifiConstPsduMap psdus, double txPowerW);
584 void NotifyTxEnd(WifiConstPsduMap psdus);
615
638 uint16_t channelFreqMhz,
639 WifiTxVector txVector,
640 SignalNoiseDbm signalNoise,
641 std::vector<bool> statusPerMpdu,
642 uint16_t staId = SU_STA_ID);
643
666 uint16_t channelFreqMhz,
667 WifiTxVector txVector,
668 MpduInfo aMpdu,
669 SignalNoiseDbm signalNoise,
670 uint16_t staId);
671
686 uint16_t channelFreqMhz,
687 WifiTxVector txVector,
688 uint16_t staId = SU_STA_ID);
689
704 typedef void (*MonitorSnifferTxCallback)(const Ptr<const Packet> packet,
705 uint16_t channelFreqMhz,
706 WifiTxVector txVector,
707 MpduInfo aMpdu,
708 uint16_t staId);
709
716 typedef void (*PhyTxBeginTracedCallback)(Ptr<const Packet> packet, double txPowerW);
717
725 typedef void (*PsduTxBeginCallback)(WifiConstPsduMap psduMap,
726 WifiTxVector txVector,
727 double txPowerW);
728
736 RxPowerWattPerChannelBand rxPowersW);
737
744 typedef void (*PhyRxPayloadBeginTracedCallback)(WifiTxVector txVector, Time psduDuration);
745
754 virtual int64_t AssignStreams(int64_t stream);
755
763 void SetRxSensitivity(double threshold);
769 double GetRxSensitivity() const;
776 void SetCcaEdThreshold(double threshold);
782 double GetCcaEdThreshold() const;
789 void SetCcaSensitivityThreshold(double threshold);
795 double GetCcaSensitivityThreshold() const;
801 void SetRxNoiseFigure(double noiseFigureDb);
807 void SetTxPowerStart(double start);
813 double GetTxPowerStart() const;
819 void SetTxPowerEnd(double end);
825 double GetTxPowerEnd() const;
833 void SetNTxPower(uint8_t n);
839 uint8_t GetNTxPower() const;
845 void SetTxGain(double gain);
851 double GetTxGain() const;
857 void SetRxGain(double gain);
863 double GetRxGain() const;
864
870 virtual void SetDevice(const Ptr<WifiNetDevice> device);
887 void SetMobility(const Ptr<MobilityModel> mobility);
898
900 std::tuple<uint8_t /* channel number */,
901 uint16_t /* channel width */,
902 WifiPhyBand /* WifiPhyBand */,
903 uint8_t /* primary20 index*/>;
904
918 void SetOperatingChannel(const ChannelTuple& channelTuple);
932 void SetOperatingChannel(const WifiPhyOperatingChannel& channel);
939 void SetFixedPhyBand(bool enable);
943 bool HasFixedPhyBand() const;
947 uint16_t GetFrequency() const;
951 uint8_t GetPrimary20Index() const;
961 uint16_t GetTxBandwidth(
962 WifiMode mode,
963 uint16_t maxAllowedBandWidth = std::numeric_limits<uint16_t>::max()) const;
967 void SetNumberOfAntennas(uint8_t antennas);
971 uint8_t GetNumberOfAntennas() const;
975 void SetMaxSupportedTxSpatialStreams(uint8_t streams);
979 uint8_t GetMaxSupportedTxSpatialStreams() const;
983 void SetMaxSupportedRxSpatialStreams(uint8_t streams);
987 uint8_t GetMaxSupportedRxSpatialStreams() const;
993 void SetShortPhyPreambleSupported(bool preamble);
999 bool GetShortPhyPreambleSupported() const;
1000
1006 void SetPhyId(uint8_t phyId);
1007
1013 uint8_t GetPhyId() const;
1014
1020 virtual void SetInterferenceHelper(const Ptr<InterferenceHelper> helper);
1021
1027 void SetErrorRateModel(const Ptr<ErrorRateModel> model);
1045 void SetFrameCaptureModel(const Ptr<FrameCaptureModel> frameCaptureModel);
1051 void SetPreambleDetectionModel(const Ptr<PreambleDetectionModel> preambleDetectionModel);
1057 void SetWifiRadioEnergyModel(const Ptr<WifiRadioEnergyModel> wifiRadioEnergyModel);
1058
1062 uint16_t GetChannelWidth() const;
1063
1072 double GetPowerDbm(uint8_t power) const;
1073
1082 void ResetCca(bool powerRestricted, double txPowerMaxSiso = 0, double txPowerMaxMimo = 0);
1100
1108 const WifiSpectrumBandIndices& indices) const = 0;
1109
1119 static void AddStaticPhyEntity(WifiModulationClass modulation, Ptr<PhyEntity> phyEntity);
1120
1130
1143
1164
1168 uint64_t GetPreviouslyRxPpduUid() const;
1169
1180 void SetPreviouslyRxPpduUid(uint64_t uid);
1181
1195 virtual uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const = 0;
1204 virtual std::tuple<double, double, double> GetTxMaskRejectionParams() const = 0;
1205
1212 uint8_t GetPrimaryChannelNumber(uint16_t primaryChannelWidth) const;
1213
1222 virtual WifiSpectrumBandInfo GetBand(uint16_t bandWidth, uint8_t bandIndex = 0) = 0;
1223
1230
1235
1236 protected:
1237 void DoInitialize() override;
1238 void DoDispose() override;
1239
1243 void Reset();
1244
1252 std::optional<Time> GetDelayUntilChannelSwitch();
1256 virtual void DoChannelSwitch();
1257
1264 void SwitchMaybeToCcaBusy(const Ptr<const WifiPpdu> ppdu = nullptr);
1271 void NotifyCcaBusy(const Ptr<const WifiPpdu> ppdu, Time duration);
1272
1283 void AddPhyEntity(WifiModulationClass modulation, Ptr<PhyEntity> phyEntity);
1284
1285 uint8_t m_phyId;
1286
1289
1292
1297
1300
1302 std::map<std::pair<uint64_t /* UID*/, WifiPreamble>, Ptr<Event>>
1305
1308
1326 std::map<WifiModulationClass, Ptr<PhyEntity>> m_phyEntities;
1327
1328 private:
1333 void Configure80211a();
1338 void Configure80211b();
1343 void Configure80211g();
1348 void Configure80211p();
1353 void Configure80211n();
1358 void Configure80211ac();
1363 void Configure80211ax();
1368 void Configure80211be();
1379 void PushMcs(WifiMode mode);
1384
1391
1399
1414
1422
1430
1438
1454
1462
1469
1483 uint16_t /* frequency (MHz) */,
1485 MpduInfo,
1487 uint16_t /* STA-ID*/>
1489
1503 uint16_t /* frequency (MHz) */,
1505 MpduInfo,
1506 uint16_t /* STA-ID*/>
1508
1516 static std::map<WifiModulationClass, Ptr<PhyEntity>>& GetStaticPhyEntities();
1517
1524
1530
1536
1537 double m_txGainDb;
1538 double m_rxGainDb;
1541 uint8_t m_nTxPower;
1543
1545 double
1547 double
1551
1556
1558
1560
1563
1569
1571};
1572
1578std::ostream& operator<<(std::ostream& os, RxSignalInfo rxSignalInfo);
1579
1580} // namespace ns3
1581
1582#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:96
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
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:65
static TypeId GetTypeId()
Get the type ID.
Definition: wifi-phy.cc:65
void SetNumberOfAntennas(uint8_t antennas)
Definition: wifi-phy.cc:1275
Ptr< WifiPhyStateHelper > m_state
Pointer to WifiPhyStateHelper.
Definition: wifi-phy.h:1291
Time GetBlockAckTxTime() const
Return the estimated BlockAck TX time for this PHY.
Definition: wifi-phy.cc:835
double GetCcaEdThreshold() const
Return the CCA energy detection threshold (dBm).
Definition: wifi-phy.cc:503
double m_rxGainDb
Reception gain (dB)
Definition: wifi-phy.h:1538
bool IsStateTx() const
Definition: wifi-phy.cc:2081
Ptr< MobilityModel > m_mobility
Pointer to the mobility model.
Definition: wifi-phy.h:1562
void(* PhyTxBeginTracedCallback)(Ptr< const Packet > packet, double txPowerW)
TracedCallback signature for Phy transmit events.
Definition: wifi-phy.h:716
WifiModulationClass GetMaxModulationClassSupported() const
Definition: wifi-phy.cc:973
bool IsStateIdle() const
Definition: wifi-phy.cc:2069
virtual void SetInterferenceHelper(const Ptr< InterferenceHelper > helper)
Sets the interference helper.
Definition: wifi-phy.cc:648
uint8_t m_txSpatialStreams
Number of supported TX spatial streams.
Definition: wifi-phy.h:1554
bool IsStateCcaBusy() const
Definition: wifi-phy.cc:2063
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:1738
Ptr< UniformRandomVariable > m_random
Provides uniform random variables.
Definition: wifi-phy.h:1290
Ptr< WifiRadioEnergyModel > m_wifiRadioEnergyModel
Wifi radio energy model.
Definition: wifi-phy.h:1566
void Configure80211ax()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11ax standard.
Definition: wifi-phy.cc:943
Time m_channelSwitchDelay
Time required to switch between channel.
Definition: wifi-phy.h:1559
void SetCcaEdThreshold(double threshold)
Sets the CCA energy detection threshold (dBm).
Definition: wifi-phy.cc:496
void NotifyCcaBusy(const Ptr< const WifiPpdu > ppdu, Time duration)
Notify PHY state helper to switch to CCA busy state,.
Definition: wifi-phy.cc:2130
WifiPhyOperatingChannel m_operatingChannel
Operating channel.
Definition: wifi-phy.h:1522
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:1429
void SetErrorRateModel(const Ptr< ErrorRateModel > model)
Sets the error rate model.
Definition: wifi-phy.cc:657
bool m_channelAccessRequested
Flag if channels access has been requested (used for OBSS_PD SR)
Definition: wifi-phy.h:1549
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:1478
Time GetSlot() const
Return the slot duration for this PHY.
Definition: wifi-phy.cc:811
uint32_t GetSubcarrierSpacing() const
Definition: wifi-phy.cc:2269
void SetMaxSupportedRxSpatialStreams(uint8_t streams)
Definition: wifi-phy.cc:1325
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:2238
void Configure80211g()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11g standard.
Definition: wifi-phy.cc:873
uint8_t GetPrimary20Index() const
Definition: wifi-phy.cc:1075
void NotifyTxEnd(WifiConstPsduMap psdus)
Public method used to fire a PhyTxEnd trace.
Definition: wifi-phy.cc:1575
uint16_t GetChannelWidth() const
Definition: wifi-phy.cc:1069
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:1303
uint8_t GetNumberOfAntennas() const
Definition: wifi-phy.cc:1287
Time m_slot
Slot duration.
Definition: wifi-phy.h:1526
double m_powerDensityLimit
the power density limit (dBm/MHz)
Definition: wifi-phy.h:1542
Time GetDelayUntilIdle()
Definition: wifi-phy.cc:2105
double GetRxSensitivity() const
Return the receive sensitivity threshold (dBm).
Definition: wifi-phy.cc:490
bool GetShortPhyPreambleSupported() const
Return whether short PHY preamble is supported.
Definition: wifi-phy.cc:605
void SetSifs(Time sifs)
Set the Short Interframe Space (SIFS) for this PHY.
Definition: wifi-phy.cc:793
std::list< uint8_t > GetBssMembershipSelectorList() const
The WifiPhy::BssMembershipSelector() method is used (e.g., by a WifiRemoteStationManager) to determin...
Definition: wifi-phy.cc:1343
void Configure80211n()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11n standard.
Definition: wifi-phy.cc:916
EventId m_endPhyRxEvent
the end of PHY receive event
Definition: wifi-phy.h:1298
double GetTxGain() const
Return the transmission gain (dB).
Definition: wifi-phy.cc:579
double m_txPowerBaseDbm
Minimum transmission power (dBm)
Definition: wifi-phy.h:1539
void Configure80211be()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11be standard.
Definition: wifi-phy.cc:958
void NotifyRxDrop(Ptr< const WifiPsdu > psdu, WifiPhyRxfailureReason reason)
Public method used to fire a PhyRxDrop trace.
Definition: wifi-phy.cc:1626
bool IsStateRx() const
Definition: wifi-phy.cc:2075
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:1961
Time GetSifs() const
Return the Short Interframe Space (SIFS) for this PHY.
Definition: wifi-phy.cc:799
uint16_t GetFrequency() const
Definition: wifi-phy.cc:1057
Ptr< MobilityModel > GetMobility() const
Return the mobility model this PHY is associated with.
Definition: wifi-phy.cc:629
uint16_t GetNMcs() const
Definition: wifi-phy.cc:2007
Time m_blockAckTxTime
estimated BlockAck TX time
Definition: wifi-phy.h:1529
uint8_t GetPrimaryChannelNumber(uint16_t primaryChannelWidth) const
Get channel number of the primary channel.
Definition: wifi-phy.cc:2263
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:2179
double m_txPowerMaxMimo
MIMO maximum transmit power due to OBSS PD SR power restriction (dBm)
Definition: wifi-phy.h:1548
void ResumeFromSleep()
Resume from sleep mode.
Definition: wifi-phy.cc:1411
static Time GetPreambleDetectionDuration()
Definition: wifi-phy.cc:1466
void Configure80211p()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11p standard.
Definition: wifi-phy.cc:886
void AbortCurrentReception(WifiPhyRxfailureReason reason)
Due to newly arrived signal, the current reception cannot be continued and has to be aborted.
Definition: wifi-phy.cc:2137
Ptr< FrameCaptureModel > m_frameCaptureModel
Frame capture model.
Definition: wifi-phy.h:1564
TracedCallback< Ptr< const Packet > > m_phyRxEndTrace
The trace source fired when a packet ends the reception process from the medium.
Definition: wifi-phy.h:1461
void NotifyRxBegin(Ptr< const WifiPsdu > psdu, const RxPowerWattPerChannelBand &rxPowersW)
Public method used to fire a PhyRxBegin trace.
Definition: wifi-phy.cc:1602
Time GetChannelSwitchDelay() const
Definition: wifi-phy.cc:709
void SetMaxSupportedTxSpatialStreams(uint8_t streams)
Definition: wifi-phy.cc:1293
Time m_sifs
Short Interframe Space (SIFS) duration.
Definition: wifi-phy.h:1525
void SetReceiveErrorCallback(RxErrorCallback callback)
Definition: wifi-phy.cc:459
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:2099
uint8_t GetMaxSupportedRxSpatialStreams() const
Definition: wifi-phy.cc:1337
void(* PsduTxBeginCallback)(WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
TracedCallback signature for PSDU transmit events.
Definition: wifi-phy.h:725
double GetTxPowerEnd() const
Return the maximum available transmission power level (dBm).
Definition: wifi-phy.cc:553
virtual void ConfigureStandard(WifiStandard standard)
Configure the PHY-level parameters for different Wi-Fi standard.
Definition: wifi-phy.cc:979
void SetPostReceptionErrorModel(const Ptr< ErrorModel > em)
Attach a receive ErrorModel to the WifiPhy.
Definition: wifi-phy.cc:665
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:2056
void PushMcs(WifiMode mode)
Add the given MCS to the device MCS set.
uint8_t m_numberOfAntennas
Number of transmitters.
Definition: wifi-phy.h:1553
ChannelTuple m_channelSettings
Store operating channel settings until initialization.
Definition: wifi-phy.h:1521
uint32_t m_txMpduReferenceNumber
A-MPDU reference number to identify all transmitted subframes belonging to the same received A-MPDU.
Definition: wifi-phy.h:1293
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
Definition: wifi-phy.cc:1525
static uint32_t GetMaxPsduSize(WifiModulationClass modulation)
Get the maximum PSDU size in bytes for the given modulation class.
Definition: wifi-phy.cc:1554
Ptr< WifiPhyStateHelper > GetState() const
Return the WifiPhyStateHelper of this PHY.
Definition: wifi-phy.cc:447
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:1560
void EndReceiveInterBss()
For HE receptions only, check and possibly modify the transmit power restriction state at the end of ...
Definition: wifi-phy.cc:1915
void SetSleepMode()
Put in sleep mode.
Definition: wifi-phy.cc:1358
void SetShortPhyPreambleSupported(bool preamble)
Enable or disable short PHY preamble.
Definition: wifi-phy.cc:598
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:559
WifiPhyBand m_band
WifiPhyBand.
Definition: wifi-phy.h:1520
void SetRxSensitivity(double threshold)
Sets the receive sensitivity threshold (dBm).
Definition: wifi-phy.cc:483
static const Ptr< const PhyEntity > GetStaticPhyEntity(WifiModulationClass modulation)
Get the implemented PHY entity corresponding to the modulation class.
Definition: wifi-phy.cc:721
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:704
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:1507
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:1546
std::map< WifiModulationClass, Ptr< PhyEntity > > m_phyEntities
This map holds the supported PHY entities.
Definition: wifi-phy.h:1326
virtual void StartTx(Ptr< const WifiPpdu > ppdu)=0
void SetMaxModulationClassSupported(WifiModulationClass modClass)
Set the maximum modulation class that has to be supported by this PHY object.
Definition: wifi-phy.cc:966
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:780
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:1488
Ptr< ErrorModel > m_postReceptionErrorModel
Error model for receive packet events.
Definition: wifi-phy.h:1567
EventId m_endTxEvent
the end of transmit event
Definition: wifi-phy.h:1299
double GetRxGain() const
Return the reception gain (dB).
Definition: wifi-phy.cc:592
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:1732
double m_rxSensitivityDbm
Receive sensitivity threshold in dBm.
Definition: wifi-phy.h:1531
void RegisterListener(const std::shared_ptr< WifiPhyListener > &listener)
Definition: wifi-phy.cc:465
static std::map< WifiModulationClass, Ptr< PhyEntity > > & GetStaticPhyEntities()
Definition: wifi-phy.cc:440
void SetSlot(Time slot)
Set the slot duration for this PHY.
Definition: wifi-phy.cc:805
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:1116
WifiPhyBand GetPhyBand() const
Get the configured Wi-Fi band.
Definition: wifi-phy.cc:1039
void SetPreviouslyRxPpduUid(uint64_t uid)
Set the UID of the previously received PPDU.
Definition: wifi-phy.cc:1865
bool IsReceivingPhyHeader() const
Definition: wifi-phy.cc:1909
double m_ccaSensitivityThresholdW
Clear channel assessment (CCA) modulation and coding rate sensitivity threshold in watts.
Definition: wifi-phy.h:1534
Ptr< Event > m_currentEvent
Hold the current event.
Definition: wifi-phy.h:1301
Time GetLastRxStartTime() const
Return the start time of the last received packet.
Definition: wifi-phy.cc:2111
WifiMode GetDefaultMode() const
Get the default WifiMode supported by the PHY.
Definition: wifi-phy.cc:1945
void SetCcaSensitivityThreshold(double threshold)
Sets the CCA sensitivity threshold (dBm).
Definition: wifi-phy.cc:509
double m_ccaEdThresholdW
Clear channel assessment (CCA) energy detection (ED) threshold in watts.
Definition: wifi-phy.h:1532
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:1692
Ptr< PhyEntity > GetPhyEntity(WifiModulationClass modulation) const
Get the supported PHY entity corresponding to the modulation class.
Definition: wifi-phy.cc:730
uint8_t GetChannelNumber() const
Return current channel number.
Definition: wifi-phy.cc:1063
TracedCallback< Ptr< const Packet > > m_phyTxEndTrace
The trace source fired when a packet ends the transmission process on the medium.
Definition: wifi-phy.h:1421
uint64_t m_previouslyRxPpduUid
UID of the previously received PPDU, reset to UINT64_MAX upon transmission.
Definition: wifi-phy.h:1306
std::optional< Time > GetDelayUntilChannelSwitch()
Perform any actions necessary when user changes operating channel after initialization.
Definition: wifi-phy.cc:1153
uint32_t m_rxMpduReferenceNumber
A-MPDU reference number to identify all received subframes belonging to the same received A-MPDU.
Definition: wifi-phy.h:1295
void SetWifiRadioEnergyModel(const Ptr< WifiRadioEnergyModel > wifiRadioEnergyModel)
Sets the wifi radio energy model.
Definition: wifi-phy.cc:684
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:1406
virtual void SetDevice(const Ptr< WifiNetDevice > device)
Sets the device this PHY is associated with.
Definition: wifi-phy.cc:611
Ptr< PreambleDetectionModel > m_preambleDetectionModel
Preamble detection model.
Definition: wifi-phy.h:1565
void SetTxPowerEnd(double end)
Sets the maximum available transmission power level (dBm).
Definition: wifi-phy.cc:546
Time GetPifs() const
Return the PCF Interframe Space (PIFS) for this PHY.
Definition: wifi-phy.cc:823
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:771
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:665
void NotifyRxEnd(Ptr< const WifiPsdu > psdu)
Public method used to fire a PhyRxEnd trace.
Definition: wifi-phy.cc:1614
void StartReceivePreamble(Ptr< const WifiPpdu > ppdu, RxPowerWattPerChannelBand &rxPowersW, Time rxDuration)
Start receiving the PHY preamble of a PPDU (i.e.
Definition: wifi-phy.cc:1886
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:1413
double m_txGainDb
Transmission gain (dB)
Definition: wifi-phy.h:1537
bool IsStateSleep() const
Definition: wifi-phy.cc:2093
Ptr< WifiNetDevice > GetDevice() const
Return the device this PHY is associated with.
Definition: wifi-phy.cc:617
WifiStandard m_standard
WifiStandard.
Definition: wifi-phy.h:1518
double GetPowerDbm(uint8_t power) const
Get the power of the given power level in dBm.
Definition: wifi-phy.cc:690
uint8_t m_nTxPower
Number of available transmission power levels.
Definition: wifi-phy.h:1541
void DoDispose() override
Destructor implementation.
Definition: wifi-phy.cc:412
bool IsStateSwitching() const
Definition: wifi-phy.cc:2087
void SetPhyId(uint8_t phyId)
Set the index allocated to this PHY.
Definition: wifi-phy.cc:635
virtual void DoChannelSwitch()
Actually switch channel based on the stored channel settings.
Definition: wifi-phy.cc:1192
void SetOffMode()
Put in off mode.
Definition: wifi-phy.cc:1401
double m_noiseFigureDb
The noise figure in dB.
Definition: wifi-phy.h:1557
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:1468
void SetPreambleDetectionModel(const Ptr< PreambleDetectionModel > preambleDetectionModel)
Sets the preamble detection model.
Definition: wifi-phy.cc:678
void RebuildMcsMap()
Rebuild the mapping of MCS values to indices in the device MCS set.
uint8_t m_phyId
the index of the PHY in the vector of PHYs held by the WifiNetDevice
Definition: wifi-phy.h:1285
std::tuple< uint8_t, uint16_t, WifiPhyBand, uint8_t > ChannelTuple
Tuple identifying an operating channel.
Definition: wifi-phy.h:903
void SetPifs(Time pifs)
Set the PCF Interframe Space (PIFS) for this PHY.
Definition: wifi-phy.cc:817
void Configure80211b()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11b standard.
Definition: wifi-phy.cc:856
static Time GetStartOfPacketDuration(const WifiTxVector &txVector)
Definition: wifi-phy.cc:1472
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:1093
virtual WifiSpectrumBandInfo GetBand(uint16_t bandWidth, uint8_t bandIndex=0)=0
Get the info of a given band.
void SetRxGain(double gain)
Sets the reception gain (dB).
Definition: wifi-phy.cc:585
void SwitchMaybeToCcaBusy(const Ptr< const WifiPpdu > ppdu=nullptr)
Check if PHY state should move to CCA busy state based on current state of interference tracker.
Definition: wifi-phy.cc:2123
void SetMobility(const Ptr< MobilityModel > mobility)
assign a mobility model to this device
Definition: wifi-phy.cc:623
void SetTxGain(double gain)
Sets the transmission gain (dB).
Definition: wifi-phy.cc:572
uint8_t m_rxSpatialStreams
Number of supported RX spatial streams.
Definition: wifi-phy.h:1555
double m_txPowerEndDbm
Maximum transmission power (dBm)
Definition: wifi-phy.h:1540
double CalculateSnr(const WifiTxVector &txVector, double ber) const
Definition: wifi-phy.cc:715
void SetFixedPhyBand(bool enable)
Configure whether it is prohibited to change PHY band after initialization.
Definition: wifi-phy.cc:1081
void(* PhyRxBeginTracedCallback)(Ptr< const Packet > packet, RxPowerWattPerChannelBand rxPowersW)
TracedCallback signature for PhyRxBegin trace source.
Definition: wifi-phy.h:735
~WifiPhy() override
Definition: wifi-phy.cc:381
void Configure80211ac()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11ac standard.
Definition: wifi-phy.cc:935
bool HasFixedPhyBand() const
Definition: wifi-phy.cc:1087
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:1437
Ptr< WifiNetDevice > m_device
Pointer to the device.
Definition: wifi-phy.h:1561
Ptr< InterferenceHelper > m_interference
Pointer to a helper responsible for interference computations.
Definition: wifi-phy.h:1288
void DoInitialize() override
Initialize() implementation.
Definition: wifi-phy.cc:387
bool m_shortPreamble
Flag if short PHY preamble is supported.
Definition: wifi-phy.h:1552
uint8_t GetPhyId() const
Get the index allocated to this PHY.
Definition: wifi-phy.cc:642
Time m_pifs
PCF Interframe Space (PIFS) duration.
Definition: wifi-phy.h:1527
WifiModulationClass m_maxModClassSupported
max modulation class supported
Definition: wifi-phy.h:1519
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:522
double GetTxPowerStart() const
Return the minimum available transmission power level (dBm).
Definition: wifi-phy.cc:540
double GetTxPowerForTransmission(Ptr< const WifiPpdu > ppdu) const
Compute the transmit power for the next transmission.
Definition: wifi-phy.cc:2202
void(* PhyRxPayloadBeginTracedCallback)(WifiTxVector txVector, Time psduDuration)
TracedCallback signature for start of PSDU reception events.
Definition: wifi-phy.h:744
WifiStandard GetStandard() const
Get the configured Wi-Fi standard.
Definition: wifi-phy.cc:1045
void SetCapabilitiesChangedCallback(Callback< void > callback)
Definition: wifi-phy.cc:477
void SetReceiveOkCallback(RxOkCallback callback)
Definition: wifi-phy.cc:453
void SetFrameCaptureModel(const Ptr< FrameCaptureModel > frameCaptureModel)
Sets the frame capture model.
Definition: wifi-phy.cc:672
void NotifyChannelAccessRequested()
Notify the PHY that an access to the channel was requested.
Definition: wifi-phy.cc:1925
void ResumeFromOff()
Resume from off mode.
Definition: wifi-phy.cc:1438
bool m_powerRestricted
Flag whether transmit power is restricted by OBSS PD SR.
Definition: wifi-phy.h:1544
virtual std::tuple< double, double, double > GetTxMaskRejectionParams() const =0
Callback< void > m_capabilitiesChangedCallback
Callback when PHY capabilities changed.
Definition: wifi-phy.h:1570
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:1638
Ptr< PhyEntity > GetPhyEntityForPpdu(const Ptr< const WifiPpdu > ppdu) const
Get the supported PHY entity to use for a received PPDU.
Definition: wifi-phy.cc:751
Time GetAckTxTime() const
Return the estimated Ack TX time for this PHY.
Definition: wifi-phy.cc:829
uint64_t GetPreviouslyRxPpduUid() const
Definition: wifi-phy.cc:1859
void Reset()
Reset data upon end of TX or RX.
Definition: wifi-phy.cc:1872
TracedCallback< WifiTxVector, Time > m_phyRxPayloadBeginTrace
The trace source fired when the reception of the PHY payload (PSDU) begins.
Definition: wifi-phy.h:1453
Time GetLastRxEndTime() const
Return the end time of the last received packet.
Definition: wifi-phy.cc:2117
Time m_timeLastPreambleDetected
Record the time the last preamble was detected.
Definition: wifi-phy.h:1568
uint8_t GetMaxSupportedTxSpatialStreams() const
Definition: wifi-phy.cc:1319
void Configure80211a()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11a standard.
Definition: wifi-phy.cc:841
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:2021
std::list< WifiMode > GetModeList() const
The WifiPhy::GetModeList() method is used (e.g., by a WifiRemoteStationManager) to determine the set ...
Definition: wifi-phy.cc:1972
const WifiPhyOperatingChannel & GetOperatingChannel() const
Get a const reference to the operating channel.
Definition: wifi-phy.cc:1051
double GetCcaSensitivityThreshold() const
Return the CCA sensitivity threshold (dBm).
Definition: wifi-phy.cc:516
bool m_fixedPhyBand
True to prohibit changing PHY band after initialization.
Definition: wifi-phy.h:1523
Ptr< PhyEntity > GetLatestPhyEntity() const
Get the latest PHY entity supported by this PHY instance.
Definition: wifi-phy.cc:745
void SetTxPowerStart(double start)
Sets the minimum available transmission power level (dBm).
Definition: wifi-phy.cc:533
uint8_t GetNTxPower() const
Return the number of available transmission power levels.
Definition: wifi-phy.cc:566
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:2245
static Time CalculatePhyPreambleAndHeaderDuration(const WifiTxVector &txVector)
Definition: wifi-phy.cc:1518
bool IsModeSupported(WifiMode mode) const
Check if the given WifiMode is supported by the PHY.
Definition: wifi-phy.cc:1932
Time m_ackTxTime
estimated Ack TX time
Definition: wifi-phy.h:1528
void UnregisterListener(const std::shared_ptr< WifiPhyListener > &listener)
Definition: wifi-phy.cc:471
void NotifyTxDrop(Ptr< const WifiPsdu > psdu)
Public method used to fire a PhyTxDrop trace.
Definition: wifi-phy.cc:1590
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:159
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:77
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:62
RxSignalInfo structure containing info on the received signal.
Definition: phy-entity.h:69
SignalNoiseDbm structure.
Definition: phy-entity.h:55
WifiSpectrumBandInfo structure containing info about a spectrum band.