29 #include "ns3/error-model.h"
39 class WifiPhyStateHelper;
40 class FrameCaptureModel;
41 class PreambleDetectionModel;
42 class WifiRadioEnergyModel;
43 class UniformRandomVariable;
44 class InterferenceHelper;
319 uint32_t& totalAmpduSize,
320 double& totalAmpduNumSymbols,
626 uint16_t channelFreqMhz,
629 std::vector<bool> statusPerMpdu,
654 uint16_t channelFreqMhz,
674 uint16_t channelFreqMhz,
693 uint16_t channelFreqMhz,
1056 void ResetCca(
bool powerRestricted,
double txPowerMaxSiso = 0,
double txPowerMaxMimo = 0);
An identifier for simulation events.
A base class which provides memory management and object aggregation.
Abstract class for PHY entities.
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
Forward calls to a chain of Callback.
a unique identifier for an interface.
represent a single transmission mode
static TypeId GetTypeId()
Get the type ID.
void SetNumberOfAntennas(uint8_t antennas)
Ptr< WifiPhyStateHelper > m_state
Pointer to WifiPhyStateHelper.
Time GetBlockAckTxTime() const
Return the estimated BlockAck TX time for this PHY.
double GetCcaEdThreshold() const
Return the CCA energy detection threshold (dBm).
double m_rxGainDb
Reception gain (dB)
Ptr< MobilityModel > m_mobility
Pointer to the mobility model.
void(* PhyTxBeginTracedCallback)(Ptr< const Packet > packet, double txPowerW)
TracedCallback signature for Phy transmit events.
WifiModulationClass GetMaxModulationClassSupported() const
virtual void SetInterferenceHelper(const Ptr< InterferenceHelper > helper)
Sets the interference helper.
uint8_t m_txSpatialStreams
Number of supported TX spatial streams.
bool IsStateCcaBusy() const
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.
Ptr< UniformRandomVariable > m_random
Provides uniform random variables.
Ptr< WifiRadioEnergyModel > m_wifiRadioEnergyModel
Wifi radio energy model.
void Configure80211ax()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11ax standard.
Time m_channelSwitchDelay
Time required to switch between channel.
void SetCcaEdThreshold(double threshold)
Sets the CCA energy detection threshold (dBm).
void NotifyCcaBusy(const Ptr< const WifiPpdu > ppdu, Time duration)
Notify PHY state helper to switch to CCA busy state,.
WifiPhyOperatingChannel m_operatingChannel
Operating channel.
TracedCallback< Ptr< const Packet > > m_phyTxDropTrace
The trace source fired when the PHY layer drops a packet as it tries to transmit it.
void SetErrorRateModel(const Ptr< ErrorRateModel > model)
Sets the error rate model.
bool m_channelAccessRequested
Flag if channels access has been requested (used for OBSS_PD SR)
static Time GetPayloadDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, MpduType mpdutype=NORMAL_MPDU, uint16_t staId=SU_STA_ID)
Time GetSlot() const
Return the slot duration for this PHY.
uint32_t GetSubcarrierSpacing() const
void SetMaxSupportedRxSpatialStreams(uint8_t streams)
Ptr< const WifiPsdu > GetAddressedPsduInPpdu(Ptr< const WifiPpdu > ppdu) const
Get the PSDU addressed to that PHY in a PPDU (useful for MU PPDU).
void Configure80211g()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11g standard.
uint8_t GetPrimary20Index() const
void NotifyTxEnd(WifiConstPsduMap psdus)
Public method used to fire a PhyTxEnd trace.
uint16_t GetChannelWidth() const
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...
uint8_t GetNumberOfAntennas() const
Time m_slot
Slot duration.
double m_powerDensityLimit
the power density limit (dBm/MHz)
double GetRxSensitivity() const
Return the receive sensitivity threshold (dBm).
bool GetShortPhyPreambleSupported() const
Return whether short PHY preamble is supported.
void SetSifs(Time sifs)
Set the Short Interframe Space (SIFS) for this PHY.
std::list< uint8_t > GetBssMembershipSelectorList() const
The WifiPhy::BssMembershipSelector() method is used (e.g., by a WifiRemoteStationManager) to determin...
void Configure80211n()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11n standard.
EventId m_endPhyRxEvent
the end of PHY receive event
double GetTxGain() const
Return the transmission gain (dB).
double m_txPowerBaseDbm
Minimum transmission power (dBm)
void Configure80211be()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11be standard.
void NotifyRxDrop(Ptr< const WifiPsdu > psdu, WifiPhyRxfailureReason reason)
Public method used to fire a PhyRxDrop trace.
bool IsMcsSupported(WifiModulationClass modulation, uint8_t mcs) const
Check if the given MCS of the given modulation class is supported by the PHY.
Time GetSifs() const
Return the Short Interframe Space (SIFS) for this PHY.
uint16_t GetFrequency() const
Ptr< MobilityModel > GetMobility() const
Return the mobility model this PHY is associated with.
Time m_blockAckTxTime
estimated BlockAck TX time
uint8_t GetPrimaryChannelNumber(uint16_t primaryChannelWidth) const
Get channel number of the primary channel.
void ResetCca(bool powerRestricted, double txPowerMaxSiso=0, double txPowerMaxMimo=0)
Reset PHY to IDLE, with some potential TX power restrictions for the next transmission.
double m_txPowerMaxMimo
MIMO maximum transmit power due to OBSS PD SR power restriction (dBm)
void ResumeFromSleep()
Resume from sleep mode.
static Time GetPreambleDetectionDuration()
void Configure80211p()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11p standard.
void AbortCurrentReception(WifiPhyRxfailureReason reason)
Due to newly arrived signal, the current reception cannot be continued and has to be aborted.
Ptr< FrameCaptureModel > m_frameCaptureModel
Frame capture model.
TracedCallback< Ptr< const Packet > > m_phyRxEndTrace
The trace source fired when a packet ends the reception process from the medium.
void NotifyRxBegin(Ptr< const WifiPsdu > psdu, const RxPowerWattPerChannelBand &rxPowersW)
Public method used to fire a PhyRxBegin trace.
Time GetChannelSwitchDelay() const
virtual std::tuple< double, double, double > GetTxMaskRejectionParams() const =0
void SetMaxSupportedTxSpatialStreams(uint8_t streams)
Time m_sifs
Short Interframe Space (SIFS) duration.
void SetReceiveErrorCallback(RxErrorCallback callback)
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...
uint8_t GetMaxSupportedRxSpatialStreams() const
void(* PsduTxBeginCallback)(WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
TracedCallback signature for PSDU transmit events.
double GetTxPowerEnd() const
Return the maximum available transmission power level (dBm).
virtual void ConfigureStandard(WifiStandard standard)
Configure the PHY-level parameters for different Wi-Fi standard.
void SetPostReceptionErrorModel(const Ptr< ErrorModel > em)
Attach a receive ErrorModel to the WifiPhy.
WifiMode GetMcs(WifiModulationClass modulation, uint8_t mcs) const
Get the WifiMode object corresponding to the given MCS of the given modulation class.
void PushMcs(WifiMode mode)
Add the given MCS to the device MCS set.
uint8_t m_numberOfAntennas
Number of transmitters.
ChannelTuple m_channelSettings
Store operating channel settings until initialization.
uint32_t m_txMpduReferenceNumber
A-MPDU reference number to identify all transmitted subframes belonging to the same received A-MPDU.
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
static uint32_t GetMaxPsduSize(WifiModulationClass modulation)
Get the maximum PSDU size in bytes for the given modulation class.
Ptr< WifiPhyStateHelper > GetState() const
Return the WifiPhyStateHelper of this PHY.
void NotifyTxBegin(WifiConstPsduMap psdus, double txPowerW)
Public method used to fire a PhyTxBegin trace.
void EndReceiveInterBss()
For HE receptions only, check and possibly modify the transmit power restriction state at the end of ...
void SetSleepMode()
Put in sleep mode.
void SetShortPhyPreambleSupported(bool preamble)
Enable or disable short PHY preamble.
void SetNTxPower(uint8_t n)
Sets the number of transmission power levels available between the minimum level and the maximum leve...
WifiPhyBand m_band
WifiPhyBand.
void SetRxSensitivity(double threshold)
Sets the receive sensitivity threshold (dBm).
static const Ptr< const PhyEntity > GetStaticPhyEntity(WifiModulationClass modulation)
Get the implemented PHY entity corresponding to the modulation class.
void(* MonitorSnifferTxCallback)(const Ptr< const Packet > packet, uint16_t channelFreqMhz, WifiTxVector txVector, MpduInfo aMpdu, uint16_t staId)
TracedCallback signature for monitor mode transmit events.
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.
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)
std::map< WifiModulationClass, Ptr< PhyEntity > > m_phyEntities
This map holds the supported PHY entities.
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.
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...
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.
Ptr< ErrorModel > m_postReceptionErrorModel
Error model for receive packet events.
EventId m_endTxEvent
the end of transmit event
double GetRxGain() const
Return the reception gain (dB).
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.
void RegisterListener(const std::shared_ptr< WifiPhyListener > &listener)
static std::map< WifiModulationClass, Ptr< PhyEntity > > & GetStaticPhyEntities()
void SetSlot(Time slot)
Set the slot duration for this PHY.
void SetOperatingChannel(const ChannelTuple &channelTuple)
If the standard for this object has not been set yet, store the given channel settings.
WifiPhyBand GetPhyBand() const
Get the configured Wi-Fi band.
void SetPreviouslyRxPpduUid(uint64_t uid)
Set the UID of the previously received PPDU.
bool IsReceivingPhyHeader() const
double m_ccaSensitivityThresholdW
Clear channel assessment (CCA) modulation and coding rate sensitivity threshold in watts.
Ptr< Event > m_currentEvent
Hold the current event.
Time GetLastRxStartTime() const
Return the start time of the last received packet.
WifiMode GetDefaultMode() const
Get the default WifiMode supported by the PHY.
void SetCcaSensitivityThreshold(double threshold)
Sets the CCA sensitivity threshold (dBm).
double m_ccaEdThresholdW
Clear channel assessment (CCA) energy detection (ED) threshold in watts.
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.
Ptr< PhyEntity > GetPhyEntity(WifiModulationClass modulation) const
Get the supported PHY entity corresponding to the modulation class.
uint8_t GetChannelNumber() const
Return current channel number.
TracedCallback< Ptr< const Packet > > m_phyTxEndTrace
The trace source fired when a packet ends the transmission process on the medium.
uint64_t m_previouslyRxPpduUid
UID of the previously received PPDU, reset to UINT64_MAX upon transmission.
std::optional< Time > GetDelayUntilChannelSwitch()
Perform any actions necessary when user changes operating channel after initialization.
uint32_t m_rxMpduReferenceNumber
A-MPDU reference number to identify all received subframes belonging to the same received A-MPDU.
void SetWifiRadioEnergyModel(const Ptr< WifiRadioEnergyModel > wifiRadioEnergyModel)
Sets the wifi radio energy model.
TracedCallback< Ptr< const Packet >, double > m_phyTxBeginTrace
The trace source fired when a packet begins the transmission process on the medium.
virtual void SetDevice(const Ptr< WifiNetDevice > device)
Sets the device this PHY is associated with.
Ptr< PreambleDetectionModel > m_preambleDetectionModel
Preamble detection model.
void SetTxPowerEnd(double end)
Sets the maximum available transmission power level (dBm).
Time GetPifs() const
Return the PCF Interframe Space (PIFS) for this PHY.
static void AddStaticPhyEntity(WifiModulationClass modulation, Ptr< PhyEntity > phyEntity)
Add the PHY entity to the map of implemented PHY entities for the given modulation class.
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.
void NotifyRxEnd(Ptr< const WifiPsdu > psdu)
Public method used to fire a PhyRxEnd trace.
void StartReceivePreamble(Ptr< const WifiPpdu > ppdu, RxPowerWattPerChannelBand &rxPowersW, Time rxDuration)
Start receiving the PHY preamble of a PPDU (i.e.
TracedCallback< WifiConstPsduMap, WifiTxVector, double > m_phyTxPsduBeginTrace
The trace source fired when a PSDU map begins the transmission process on the medium.
double m_txGainDb
Transmission gain (dB)
bool IsStateSleep() const
Ptr< WifiNetDevice > GetDevice() const
Return the device this PHY is associated with.
WifiStandard m_standard
WifiStandard.
double GetPowerDbm(uint8_t power) const
Get the power of the given power level in dBm.
uint8_t m_nTxPower
Number of available transmission power levels.
void DoDispose() override
Destructor implementation.
bool IsStateSwitching() const
virtual void DoChannelSwitch()
Actually switch channel based on the stored channel settings.
void SetOffMode()
Put in off mode.
double m_noiseFigureDb
The noise figure in dB.
TracedCallback< Ptr< const Packet >, WifiPhyRxfailureReason > m_phyRxDropTrace
The trace source fired when the PHY layer drops a packet it has received.
void SetPreambleDetectionModel(const Ptr< PreambleDetectionModel > preambleDetectionModel)
Sets the preamble detection model.
void RebuildMcsMap()
Rebuild the mapping of MCS values to indices in the device MCS set.
std::tuple< uint8_t, uint16_t, WifiPhyBand, uint8_t > ChannelTuple
Tuple identifying an operating channel.
void SetPifs(Time pifs)
Set the PCF Interframe Space (PIFS) for this PHY.
void Configure80211b()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11b standard.
static Time GetStartOfPacketDuration(const WifiTxVector &txVector)
virtual FrequencyRange GetCurrentFrequencyRange() const =0
Get the frequency range of the current RF interface.
virtual Ptr< Channel > GetChannel() const =0
Return the Channel this WifiPhy is connected to.
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...
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).
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.
void SetMobility(const Ptr< MobilityModel > mobility)
assign a mobility model to this device
void SetTxGain(double gain)
Sets the transmission gain (dB).
uint8_t m_rxSpatialStreams
Number of supported RX spatial streams.
double m_txPowerEndDbm
Maximum transmission power (dBm)
double CalculateSnr(const WifiTxVector &txVector, double ber) const
void SetFixedPhyBand(bool enable)
Configure whether it is prohibited to change PHY band after initialization.
void(* PhyRxBeginTracedCallback)(Ptr< const Packet > packet, RxPowerWattPerChannelBand rxPowersW)
TracedCallback signature for PhyRxBegin trace source.
void Configure80211ac()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11ac standard.
bool HasFixedPhyBand() const
TracedCallback< Ptr< const Packet >, RxPowerWattPerChannelBand > m_phyRxBeginTrace
The trace source fired when a packet begins the reception process from the medium.
Ptr< WifiNetDevice > m_device
Pointer to the device.
Ptr< InterferenceHelper > m_interference
Pointer to a helper responsible for interference computations.
void DoInitialize() override
Initialize() implementation.
bool m_shortPreamble
Flag if short PHY preamble is supported.
Time m_pifs
PCF Interframe Space (PIFS) duration.
WifiModulationClass m_maxModClassSupported
max modulation class supported
void SetRxNoiseFigure(double noiseFigureDb)
Sets the RX loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in the receiver.
double GetTxPowerStart() const
Return the minimum available transmission power level (dBm).
double GetTxPowerForTransmission(Ptr< const WifiPpdu > ppdu) const
Compute the transmit power for the next transmission.
void(* PhyRxPayloadBeginTracedCallback)(WifiTxVector txVector, Time psduDuration)
TracedCallback signature for start of PSDU reception events.
WifiStandard GetStandard() const
Get the configured Wi-Fi standard.
void SetCapabilitiesChangedCallback(Callback< void > callback)
void SetReceiveOkCallback(RxOkCallback callback)
void SetFrameCaptureModel(const Ptr< FrameCaptureModel > frameCaptureModel)
Sets the frame capture model.
void NotifyChannelAccessRequested()
Notify the PHY that an access to the channel was requested.
void ResumeFromOff()
Resume from off mode.
bool m_powerRestricted
Flag whether transmit power is restricted by OBSS PD SR.
Callback< void > m_capabilitiesChangedCallback
Callback when PHY capabilities changed.
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.
Ptr< PhyEntity > GetPhyEntityForPpdu(const Ptr< const WifiPpdu > ppdu) const
Get the supported PHY entity to use for a received PPDU.
Time GetAckTxTime() const
Return the estimated Ack TX time for this PHY.
uint64_t GetPreviouslyRxPpduUid() const
void Reset()
Reset data upon end of TX or RX.
TracedCallback< WifiTxVector, Time > m_phyRxPayloadBeginTrace
The trace source fired when the reception of the PHY payload (PSDU) begins.
Time GetLastRxEndTime() const
Return the end time of the last received packet.
Time m_timeLastPreambleDetected
Record the time the last preamble was detected.
uint8_t GetMaxSupportedTxSpatialStreams() const
void Configure80211a()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11a standard.
std::list< WifiMode > GetMcsList() const
The WifiPhy::GetMcsList() method is used (e.g., by a WifiRemoteStationManager) to determine the set o...
std::list< WifiMode > GetModeList() const
The WifiPhy::GetModeList() method is used (e.g., by a WifiRemoteStationManager) to determine the set ...
double m_rxSensitivityW
Receive sensitivity threshold in watts.
const WifiPhyOperatingChannel & GetOperatingChannel() const
Get a const reference to the operating channel.
double GetCcaSensitivityThreshold() const
Return the CCA sensitivity threshold (dBm).
bool m_fixedPhyBand
True to prohibit changing PHY band after initialization.
Ptr< PhyEntity > GetLatestPhyEntity() const
Get the latest PHY entity supported by this PHY instance.
void SetTxPowerStart(double start)
Sets the minimum available transmission power level (dBm).
uint8_t GetNTxPower() const
Return the number of available transmission power levels.
virtual int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
static Time CalculatePhyPreambleAndHeaderDuration(const WifiTxVector &txVector)
bool IsModeSupported(WifiMode mode) const
Check if the given WifiMode is supported by the PHY.
Time m_ackTxTime
estimated Ack TX time
void UnregisterListener(const std::shared_ptr< WifiPhyListener > &listener)
void NotifyTxDrop(Ptr< const WifiPsdu > psdu)
Public method used to fire a PhyTxDrop trace.
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.
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::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.
std::ostream & operator<<(std::ostream &os, const Angles &a)
static constexpr uint16_t SU_STA_ID
STA_ID to identify a single user (SU)
Struct defining a frequency range between minFrequency (MHz) and maxFrequency (MHz).
RxSignalInfo structure containing info on the received signal.
SignalNoiseDbm structure.
WifiSpectrumBandInfo structure containing info about a spectrum band.