25 #include "ns3/error-model.h"
36 class WifiPhyStateHelper;
37 class FrameCaptureModel;
38 class PreambleDetectionModel;
39 class WifiRadioEnergyModel;
40 class UniformRandomVariable;
41 class InterferenceHelper;
297 bool incFlag, uint32_t &totalAmpduSize,
double &totalAmpduNumSymbols,
586 uint16_t channelFreqMhz,
589 std::vector<bool> statusPerMpdu,
613 uint16_t channelFreqMhz,
633 uint16_t channelFreqMhz,
651 uint16_t channelFreqMhz,
964 void ResetCca (
bool powerRestricted,
double txPowerMaxSiso = 0,
double txPowerMaxMimo = 0);
An identifier for simulation events.
std::pair< int16_t, int16_t > SubcarrierRange
(lowest index, highest index) pair defining a subcarrier range
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
void SetNumberOfAntennas(uint8_t antennas)
Ptr< WifiPhyStateHelper > m_state
Pointer to WifiPhyStateHelper.
double m_rxGainDb
Reception gain (dB)
Ptr< MobilityModel > m_mobility
Pointer to the mobility model.
bool IsStateIdle(void) const
void(* PhyTxBeginTracedCallback)(Ptr< const Packet > packet, double txPowerW)
TracedCallback signature for Phy transmit events.
virtual void SetInterferenceHelper(const Ptr< InterferenceHelper > helper)
Sets the interference helper.
uint8_t m_txSpatialStreams
Number of supported TX spatial streams.
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.
bool IsStateTx(void) const
void StartReceivePreamble(Ptr< WifiPpdu > ppdu, RxPowerWattPerChannelBand &rxPowersW, Time rxDuration)
Start receiving the PHY preamble of a PPDU (i.e.
Ptr< UniformRandomVariable > m_random
Provides uniform random variables.
uint8_t GetChannelNumber(void) const
Return current channel number.
Ptr< WifiRadioEnergyModel > m_wifiRadioEnergyModel
Wifi radio energy model.
Time m_channelSwitchDelay
Time required to switch between channel.
std::list< WifiMode > GetMcsList(void) const
The WifiPhy::GetMcsList() method is used (e.g., by a WifiRemoteStationManager) to determine the set o...
void SetCcaEdThreshold(double threshold)
Sets the CCA threshold (dBm).
TracedCallback< Ptr< const Packet >, WifiPhyRxfailureReason > m_phyRxDropTrace
The trace source fired when the PHY layer drops a packet it has received.
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.
TracedCallback< Ptr< const Packet >, RxPowerWattPerChannelBand > m_phyRxBeginTrace
The trace source fired when a packet begins the reception process from the medium.
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)
TracedCallback< Ptr< const Packet >, double > m_phyTxBeginTrace
The trace source fired when a packet begins the transmission process on the medium.
Ptr< MobilityModel > GetMobility(void) const
Return the mobility model this PHY is associated with.
void SetMaxSupportedRxSpatialStreams(uint8_t streams)
const WifiPhyOperatingChannel & GetOperatingChannel(void) const
Get a const reference to the operating channel.
Ptr< const WifiPsdu > GetAddressedPsduInPpdu(Ptr< const WifiPpdu > ppdu) const
Get the PSDU addressed to that PHY in a PPDU (useful for MU PPDU).
bool GetShortPhyPreambleSupported(void) const
Return whether short PHY preamble is supported.
void NotifyTxEnd(WifiConstPsduMap psdus)
Public method used to fire a PhyTxEnd trace.
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...
Time m_slot
Slot duration.
double m_powerDensityLimit
the power density limit (dBm/MHz)
WifiMode GetDefaultMode(void) const
Get the default WifiMode supported by the PHY.
std::vector< uint16_t > GetSupportedChannelWidthSet(void) const
bool IsStateRx(void) const
void SetSifs(Time sifs)
Set the Short Interframe Space (SIFS) for this PHY.
WifiPhyBand GetPhyBand(void) const
Get the configured Wi-Fi band.
EventId m_endPhyRxEvent
the end of PHY receive event
double m_txPowerBaseDbm
Minimum transmission power (dBm)
Ptr< WifiPhyStateHelper > GetState(void) const
Return the WifiPhyStateHelper of this PHY.
Ptr< WifiNetDevice > GetDevice(void) const
Return the device this PHY is associated with.
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.
WifiStandard GetStandard(void) const
Get the configured Wi-Fi standard.
virtual void DoDispose(void)
Destructor implementation.
Time m_blockAckTxTime
estimated BlockAck TX time
uint8_t GetPrimaryChannelNumber(uint16_t primaryChannelWidth) const
Get channel number of the primary channel.
void Configure80211a(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11a standard.
std::list< uint8_t > GetBssMembershipSelectorList(void) const
The WifiPhy::BssMembershipSelector() method is used (e.g., by a WifiRemoteStationManager) to determin...
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)
Time GetSlot(void) const
Return the slot duration for this PHY.
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.
void SetMaxSupportedTxSpatialStreams(uint8_t streams)
uint16_t GetMeasurementChannelWidth(const Ptr< const WifiPpdu > ppdu) const
Return the channel width used to measure the RSSI.
double GetTxPowerEnd(void) const
Return the maximum available transmission power level (dBm).
Time m_sifs
Short Interframe Space (SIFS) duration.
void SetReceiveErrorCallback(RxErrorCallback callback)
void ResetReceive(Ptr< Event > event)
Reset PHY at the end of the packet under reception after it has failed the PHY header.
virtual uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const =0
void(* PsduTxBeginCallback)(WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
TracedCallback signature for PSDU transmit events.
virtual void ConfigureStandard(WifiStandard standard)
Configure the PHY-level parameters for different Wi-Fi standard.
uint8_t GetMaxSupportedRxSpatialStreams(void) const
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)
Time GetLastRxStartTime(void) const
Return the start time of the last received packet.
Time GetBlockAckTxTime(void) const
Return the estimated BlockAck TX time for this PHY.
void Configure80211p(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11p standard.
Time GetPifs(void) const
Return the PCF Interframe Space (PIFS) for this PHY.
static uint32_t GetMaxPsduSize(WifiModulationClass modulation)
Get the maximum PSDU size in bytes for the given modulation class.
void NotifyTxBegin(WifiConstPsduMap psdus, double txPowerW)
Public method used to fire a PhyTxBegin trace.
void Reset(void)
Reset data upon end of TX or RX.
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...
static TypeId GetTypeId(void)
Get the type ID.
WifiPhyBand m_band
WifiPhyBand.
void Configure80211b(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11b standard.
void SetSleepMode(void)
Put in sleep mode.
void SetRxSensitivity(double threshold)
Sets the receive sensitivity threshold (dBm).
uint8_t GetPrimary20Index(void) const
static const Ptr< const PhyEntity > GetStaticPhyEntity(WifiModulationClass modulation)
Get the implemented PHY entity corresponding to the modulation class.
uint8_t GetMaxSupportedTxSpatialStreams(void) const
void(* MonitorSnifferTxCallback)(const Ptr< const Packet > packet, uint16_t channelFreqMhz, WifiTxVector txVector, MpduInfo aMpdu, uint16_t staId)
TracedCallback signature for monitor mode transmit events.
void Configure80211g(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11g standard.
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.
Time GetChannelSwitchDelay(void) const
virtual WifiSpectrumBand ConvertHeRuSubcarriers(uint16_t bandWidth, uint16_t guardBandwidth, HeRu::SubcarrierRange range, uint8_t bandIndex=0) const
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.
void RebuildMcsMap(void)
Rebuild the mapping of MCS values to indices in the device MCS set.
void AddPhyEntity(WifiModulationClass modulation, Ptr< PhyEntity > phyEntity)
Add the PHY entity to the map of supported PHY entities for the given modulation class for the WifiPh...
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.
double GetTxPowerStart(void) const
Return the minimum available transmission power level (dBm).
EventId m_endTxEvent
the end of transmit event
void ConfigureHtDeviceMcsSet(void)
Configure the device MCS set with the appropriate HtMcs modes for the number of available transmit sp...
static WifiConstPsduMap GetWifiConstPsduMap(Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector)
Get a WifiConstPsduMap from a PSDU and the TXVECTOR to use to send the PSDU.
uint16_t GetNMcs(void) const
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.
Ptr< Event > m_currentEvent
Hold the current event.
virtual std::tuple< double, double, double > GetTxMaskRejectionParams(void) const =0
double m_ccaEdThresholdW
Clear channel assessment (CCA) 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, for the WifiPhy instance.
virtual WifiSpectrumBand GetBand(uint16_t bandWidth, uint8_t bandIndex=0)
Get the start band index and the stop band index for a given band.
TracedCallback< Ptr< const Packet > > m_phyTxEndTrace
The trace source fired when a packet ends the transmission process on the medium.
void ResumeFromSleep(void)
Resume from sleep mode.
uint64_t m_previouslyRxPpduUid
UID of the previously received PPDU, reset to UINT64_MAX upon transmission.
void Configure80211ac(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11ac standard.
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.
void SetDevice(const Ptr< WifiNetDevice > device)
Sets the device this PHY is associated with.
void NotifyChannelAccessRequested(void)
Notify the PHY that an access to the channel was requested.
Ptr< PreambleDetectionModel > m_preambleDetectionModel
Preamble detection model.
uint8_t GetNumberOfAntennas(void) const
void SwitchMaybeToCcaBusy(uint16_t channelWidth)
Check if PHY state should move to CCA busy state based on current state of interference tracker.
void SetTxPowerEnd(double end)
Sets the maximum available transmission power level (dBm).
static std::map< WifiModulationClass, Ptr< PhyEntity > > & GetStaticPhyEntities(void)
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.
std::list< WifiMode > GetModeList(void) const
The WifiPhy::GetModeList() method is used (e.g., by a WifiRemoteStationManager) to determine the set ...
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)
std::vector< uint16_t > m_supportedChannelWidthSet
Supported channel width set (MHz)
WifiSpectrumBand GetPrimaryBand(uint16_t bandWidth)
If the operating channel width is a multiple of 20 MHz, return the start band index and the stop band...
Time GetDelayUntilIdle(void)
uint64_t GetPreviouslyRxPpduUid(void) const
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.
double m_noiseFigureDb
The noise figure in dB.
void SetPreambleDetectionModel(const Ptr< PreambleDetectionModel > preambleDetectionModel)
Sets the preamble detection model.
void SetPifs(Time pifs)
Set the PCF Interframe Space (PIFS) for this PHY.
Time GetSifs(void) const
Return the Short Interframe Space (SIFS) for this PHY.
static Time GetStartOfPacketDuration(const WifiTxVector &txVector)
virtual void StartTx(Ptr< WifiPpdu > ppdu)=0
Time GetAckTxTime(void) const
Return the estimated Ack TX time for this PHY.
void UnregisterListener(WifiPhyListener *listener)
void SetRxGain(double gain)
Sets the reception gain (dB).
void SetMobility(const Ptr< MobilityModel > mobility)
assign a mobility model to this device
double GetRxGain(void) const
Return the reception gain (dB).
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)
void SetOffMode(void)
Put in off mode.
double CalculateSnr(const WifiTxVector &txVector, double ber) const
void Configure80211n(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11n standard.
void(* PhyRxBeginTracedCallback)(Ptr< const Packet > packet, RxPowerWattPerChannelBand rxPowersW)
TracedCallback signature for PhyRxBegin trace source.
bool IsStateSwitching(void) const
double GetTxGain(void) const
Return the transmission gain (dB).
uint8_t GetNTxPower(void) const
Return the number of available transmission power levels.
Time GetDelayUntilChannelSwitch(void)
Perform any actions necessary when user changes operating channel after initialization.
void EndReceiveInterBss(void)
For HE receptions only, check and possibly modify the transmit power restriction state at the end of ...
double GetCcaEdThreshold(void) const
Return the CCA threshold (dBm).
double GetRxSensitivity(void) const
Return the receive sensitivity threshold (dBm).
void RegisterListener(WifiPhyListener *listener)
Ptr< WifiNetDevice > m_device
Pointer to the device.
Ptr< InterferenceHelper > m_interference
Pointer to a helper responsible for interference computations.
bool IsStateSleep(void) const
bool IsStateCcaBusy(void) const
bool m_shortPreamble
Flag if short PHY preamble is supported.
Time m_pifs
PCF Interframe Space (PIFS) duration.
void SetRxNoiseFigure(double noiseFigureDb)
Sets the RX loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in the receiver.
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.
void SetCapabilitiesChangedCallback(Callback< void > callback)
void SetReceiveOkCallback(RxOkCallback callback)
void SetFrameCaptureModel(const Ptr< FrameCaptureModel > frameCaptureModel)
Sets the frame capture model.
void ResumeFromOff(void)
Resume from off mode.
void Configure80211ax(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11ax standard.
bool m_powerRestricted
Flag whether transmit power is restricted by OBSS PD SR.
Callback< void > m_capabilitiesChangedCallback
Callback when PHY capabilities changed.
void AddSupportedChannelWidth(uint16_t width)
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.
virtual void DoChannelSwitch(void)
Actually switch channel based on the stored channel settings.
TracedCallback< WifiTxVector, Time > m_phyRxPayloadBeginTrace
The trace source fired when the reception of the PHY payload (PSDU) begins.
static Time GetPreambleDetectionDuration(void)
std::tuple< uint8_t, uint16_t, int, uint8_t > ChannelTuple
Tuple identifying an operating channel.
Time m_timeLastPreambleDetected
Record the time the last preamble was detected.
double m_rxSensitivityW
Receive sensitivity threshold in watts.
Time GetLastRxEndTime(void) const
Return the end time of the last received packet.
uint16_t GetChannelWidth(void) const
bool IsStateOff(void) const
void SetTxPowerStart(double start)
Sets the minimum available transmission power level (dBm).
virtual Ptr< Channel > GetChannel(void) const =0
Return the Channel this WifiPhy is connected to.
virtual int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
static Time CalculatePhyPreambleAndHeaderDuration(const WifiTxVector &txVector)
bool IsModeSupported(WifiMode mode) const
Check if the given WifiMode is supported by the PHY.
uint16_t GetFrequency(void) const
Time m_ackTxTime
estimated Ack TX time
void NotifyTxDrop(Ptr< const WifiPsdu > psdu)
Public method used to fire a PhyTxDrop trace.
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.
WifiModulationClass
This enumeration defines the modulation classes per (Table 10-6 "Modulation classes"; IEEE 802....
MpduType
The type of an MPDU.
@ NORMAL_MPDU
The MPDU is not part of an A-MPDU.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
std::pair< uint32_t, uint32_t > WifiSpectrumBand
typedef for a pair of start and stop sub-band indexes
std::map< WifiSpectrumBand, double > RxPowerWattPerChannelBand
A map of the received power (Watts) for each band.
std::ostream & operator<<(std::ostream &os, const Angles &a)
RxSignalInfo structure containing info on the received signal.
SignalNoiseDbm structure.