25 #include "ns3/error-model.h" 37 class WifiPhyStateHelper;
38 class FrameCaptureModel;
39 class PreambleDetectionModel;
40 class WifiRadioEnergyModel;
41 class UniformRandomVariable;
298 bool incFlag, uint32_t &totalAmpduSize,
double &totalAmpduNumSymbols,
611 uint16_t channelFreqMhz,
614 std::vector<bool> statusPerMpdu,
638 uint16_t channelFreqMhz,
658 uint16_t channelFreqMhz,
676 uint16_t channelFreqMhz,
996 void ResetCca (
bool powerRestricted,
double txPowerMaxSiso = 0,
double txPowerMaxMimo = 0);
WifiModulationClass
This enumeration defines the modulation classes per (Table 10-6 "Modulation classes"; IEEE 802...
void NotifyRxDrop(Ptr< const WifiPsdu > psdu, WifiPhyRxfailureReason reason)
Public method used to fire a PhyRxDrop trace.
Ptr< NetDevice > m_device
Pointer to the device.
uint8_t GetNTxPower(void) const
Return the number of available transmission power levels.
uint32_t m_txMpduReferenceNumber
A-MPDU reference number to identify all transmitted subframes belonging to the same received A-MPDU...
bool IsStateSwitching(void) const
void SetPifs(Time pifs)
Set the PCF Interframe Space (PIFS) for this PHY.
bool IsStateOff(void) const
TracedCallback< Ptr< const Packet >, RxPowerWattPerChannelBand > m_phyRxBeginTrace
The trace source fired when a packet begins the reception process from the medium.
static Time GetStartOfPacketDuration(const WifiTxVector &txVector)
Simulation virtual time values and global simulation resolution.
void NotifyTxBegin(WifiConstPsduMap psdus, double txPowerW)
Public method used to fire a PhyTxBegin trace.
Ptr< PhyEntity > GetPhyEntity(WifiModulationClass modulation) const
Get the supported PHY entity corresponding to the modulation class, for the WifiPhy instance...
Smart pointer class similar to boost::intrusive_ptr.
void SetNTxPower(uint8_t n)
Sets the number of transmission power levels available between the minimum level and the maximum leve...
double m_rxGainDb
Reception gain (dB)
static std::map< WifiModulationClass, Ptr< PhyEntity > > m_staticPhyEntities
Map of implemented PHY entities.
double GetRxGain(void) const
Return the reception gain (dB).
bool IsModeSupported(WifiMode mode) const
Check if the given WifiMode is supported by the PHY.
void AddSupportedChannelWidth(uint16_t width)
double GetCcaEdThreshold(void) const
Return the CCA threshold (dBm).
void NotifyTxEnd(WifiConstPsduMap psdus)
Public method used to fire a PhyTxEnd trace.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
double m_txGainDb
Transmission gain (dB)
void AbortCurrentReception(WifiPhyRxfailureReason reason)
Due to newly arrived signal, the current reception cannot be continued and has to be aborted...
Time DoChannelSwitch(void)
Perform any actions necessary when user changes operating channel after initialization.
void ResumeFromOff(void)
Resume from off mode.
Ptr< WifiPhyStateHelper > GetState(void) const
Return the WifiPhyStateHelper of this PHY.
void ResumeFromSleep(void)
Resume from sleep mode.
double m_rxSensitivityW
Receive sensitivity threshold in watts.
void SetOperatingChannel(uint8_t number, uint16_t frequency, uint16_t width)
Set the operating channel according to the specified parameters.
WifiPhyBand GetPhyBand(void) const
Get the configured Wi-Fi band.
Ptr< const WifiPsdu > GetAddressedPsduInPpdu(Ptr< const WifiPpdu > ppdu) const
Get the PSDU addressed to that PHY in a PPDU (useful for MU PPDU).
Time m_timeLastPreambleDetected
Record the time the last preamble was detected.
void SetTxGain(double gain)
Sets the transmission gain (dB).
void Configure80211ax(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11ax standard...
handles interference calculations
void SetRxSensitivity(double threshold)
Sets the receive sensitivity threshold (dBm).
virtual void ConfigureStandardAndBand(WifiPhyStandard standard, WifiPhyBand band)
Configure the PHY-level parameters for different Wi-Fi standard.
virtual void DoDispose(void)
Destructor implementation.
Forward calls to a chain of Callback.
void RebuildMcsMap(void)
Rebuild the mapping of MCS values to indices in the device MCS set.
double m_powerDensityLimit
the power density limit (dBm/MHz)
std::list< WifiMode > GetModeList(void) const
The WifiPhy::GetModeList() method is used (e.g., by a WifiRemoteStationManager) to determine the set ...
TracedCallback< Ptr< const Packet > > m_phyRxEndTrace
The trace source fired when a packet ends the reception process from the medium.
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...
bool IsStateCcaBusy(void) const
void SetReceiveErrorCallback(RxErrorCallback callback)
WifiPhyRxfailureReason
Enumeration of the possible reception failure reasons.
void SetSlot(Time slot)
Set the slot duration for this PHY.
void SetShortPhyPreambleSupported(bool preamble)
Enable or disable short PHY preamble.
TracedCallback< WifiTxVector, Time > m_phyRxPayloadBeginTrace
The trace source fired when the reception of the PHY payload (PSDU) begins.
EventId m_endPhyRxEvent
the end of PHY receive event
void SetMobility(const Ptr< MobilityModel > mobility)
assign a mobility model to this device
void UnregisterListener(WifiPhyListener *listener)
void SetRxNoiseFigure(double noiseFigureDb)
Sets the RX loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in the receiver.
bool IsStateIdle(void) const
Class that keeps track of all information about the current PHY operating channel.
void Reset(void)
Reset data upon end of TX or RX.
TracedCallback< Ptr< const Packet >, WifiPhyRxfailureReason > m_phyRxDropTrace
The trace source fired when the PHY layer drops a packet it has received.
virtual WifiSpectrumBand ConvertHeRuSubcarriers(uint16_t bandWidth, uint16_t guardBandwidth, HeRu::SubcarrierRange range, uint8_t bandIndex=0) const
uint8_t m_nTxPower
Number of available transmission power levels.
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...
std::list< WifiMode > GetMcsList(void) const
The WifiPhy::GetMcsList() method is used (e.g., by a WifiRemoteStationManager) to determine the set o...
virtual void SetFrequency(uint16_t freq)
If the operating channel for this object has not been set yet, the given center frequency is saved an...
double CalculateSnr(const WifiTxVector &txVector, double ber) const
void SetFrameCaptureModel(const Ptr< FrameCaptureModel > frameCaptureModel)
Sets the frame capture model.
void ResetCca(bool powerRestricted, double txPowerMaxSiso=0, double txPowerMaxMimo=0)
Reset PHY to IDLE, with some potential TX power restrictions for the next transmission.
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
uint8_t m_initialChannelNumber
Store channel number until initialization.
void NotifyRxEnd(Ptr< const WifiPsdu > psdu)
Public method used to fire a PhyRxEnd trace.
bool IsStateSleep(void) const
MpduType
The type of an MPDU.
std::pair< int16_t, int16_t > SubcarrierRange
(lowest index, highest index) pair defining a subcarrier range
double GetRxSensitivity(void) const
Return the receive sensitivity threshold (dBm).
virtual Ptr< Channel > GetChannel(void) const =0
Return the Channel this WifiPhy is connected to.
void SetDevice(const Ptr< NetDevice > device)
Sets the device this PHY is associated with.
uint16_t GetChannelWidth(void) const
bool m_powerRestricted
Flag whether transmit power is restricted by OBSS PD SR.
std::ostream & operator<<(std::ostream &os, const Angles &a)
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
void SwitchMaybeToCcaBusy(uint16_t channelWidth)
Check if PHY state should move to CCA busy state based on current state of interference tracker...
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
WifiPhyStandard
Identifies the PHY specification that a Wifi device is configured to use.
The MPDU is not part of an A-MPDU.
RxSignalInfo structure containing info on the received signal.
static const Ptr< const PhyEntity > GetStaticPhyEntity(WifiModulationClass modulation)
Get the implemented PHY entity corresponding to the modulation class.
WifiMode GetMcs(WifiModulationClass modulation, uint8_t mcs) const
Get the WifiMode object corresponding to the given MCS of the given modulation class.
Time m_slot
Slot duration.
Ptr< MobilityModel > m_mobility
Pointer to the mobility model.
void SetPrimary20Index(uint8_t index)
Set the index of the primary 20 MHz channel (0 indicates the 20 MHz subchannel with the lowest center...
Time m_blockAckTxTime
estimated BlockAck TX time
receive notifications about PHY events.
TracedCallback< Ptr< const Packet > > m_phyTxDropTrace
The trace source fired when the PHY layer drops a packet as it tries to transmit it.
double m_txPowerMaxMimo
MIMO maximum transmit power due to OBSS PD SR power restriction (dBm)
bool m_shortPreamble
Flag if short PHY preamble is supported.
virtual std::tuple< double, double, double > GetTxMaskRejectionParams(void) const =0
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.
EventId m_endTxEvent
the end of transmit event
Ptr< WifiRadioEnergyModel > m_wifiRadioEnergyModel
Wifi radio energy model.
void SetTxPowerEnd(double end)
Sets the maximum available transmission power level (dBm).
void SetPreambleDetectionModel(const Ptr< PreambleDetectionModel > preambleDetectionModel)
Sets the preamble detection model.
void NotifyChannelAccessRequested(void)
Notify the PHY that an access to the channel was requested.
uint64_t m_previouslyRxPpduUid
UID of the previously received PPDU, reset to UINT64_MAX upon transmission.
uint16_t GetMeasurementChannelWidth(const Ptr< const WifiPpdu > ppdu) const
Return the channel width used to measure the RSSI.
Time GetDelayUntilIdle(void)
uint8_t m_initialPrimary20Index
Store the index of primary20 until initialization.
uint32_t m_rxMpduReferenceNumber
A-MPDU reference number to identify all received subframes belonging to the same received A-MPDU...
std::list< uint8_t > GetBssMembershipSelectorList(void) const
The WifiPhy::BssMembershipSelector() method is used (e.g., by a WifiRemoteStationManager) to determin...
std::pair< uint32_t, uint32_t > WifiSpectrumBand
typedef for a pair of start and stop sub-band indexes
Abstract class for PHY entitiesThis class enables to have a unique set of APIs to be used by each PHY...
void SetCapabilitiesChangedCallback(Callback< void > callback)
void SetOffMode(void)
Put in off mode.
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...
void(* PhyRxPayloadBeginTracedCallback)(WifiTxVector txVector, Time psduDuration)
TracedCallback signature for start of PSDU reception events.
Ptr< PreambleDetectionModel > m_preambleDetectionModel
Preamble detection model.
double GetPowerDbm(uint8_t power) const
Get the power of the given power level in dBm.
WifiPhyStandard GetPhyStandard(void) const
Get the configured Wi-Fi standard.
Time GetBlockAckTxTime(void) const
Return the estimated BlockAck TX time for this PHY.
void SetErrorRateModel(const Ptr< ErrorRateModel > rate)
Sets the error rate model.
TracedCallback< WifiConstPsduMap, WifiTxVector, double > m_phyTxPsduBeginTrace
The trace source fired when a PSDU map begins the transmission process on the medium.
Ptr< MobilityModel > GetMobility(void) const
Return the mobility model this PHY is associated with.
static Time GetPreambleDetectionDuration(void)
Time m_pifs
PCF Interframe Space (PIFS) duration.
void SetPostReceptionErrorModel(const Ptr< ErrorModel > em)
Attach a receive ErrorModel to the WifiPhy.
void(* PsduTxBeginCallback)(WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
TracedCallback signature for PSDU transmit events.
static TypeId GetTypeId(void)
Get the type ID.
Time GetChannelSwitchDelay(void) const
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.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
WifiPhyBand m_band
WifiPhyBand.
static const std::set< FrequencyChannelInfo > m_frequencyChannels
Available frequency channels.
void SetWifiRadioEnergyModel(const Ptr< WifiRadioEnergyModel > wifiRadioEnergyModel)
Sets the wifi radio energy model.
uint16_t GetFrequency(void) const
uint8_t GetNumberOfAntennas(void) const
static uint32_t GetMaxPsduSize(WifiModulationClass modulation)
Get the maximum PSDU size in bytes for the given modulation class.
void NotifyTxDrop(Ptr< const WifiPsdu > psdu)
Public method used to fire a PhyTxDrop trace.
Time m_sifs
Short Interframe Space (SIFS) duration.
virtual uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const =0
TracedCallback< Ptr< const Packet >, double > m_phyTxBeginTrace
The trace source fired when a packet begins the transmission process on the medium.
virtual void StartTx(Ptr< WifiPpdu > ppdu)=0
void StartReceivePreamble(Ptr< WifiPpdu > ppdu, RxPowerWattPerChannelBand rxPowersW, Time rxDuration)
Start receiving the PHY preamble of a PPDU (i.e.
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...
void SetMaxSupportedRxSpatialStreams(uint8_t streams)
bool GetShortPhyPreambleSupported(void) const
Return whether short PHY preamble is supported.
double m_ccaEdThresholdW
Clear channel assessment (CCA) threshold in watts.
virtual void SetChannelNumber(uint8_t id)
Set channel number.
Time GetPifs(void) const
Return the PCF Interframe Space (PIFS) for this PHY.
Time GetAckTxTime(void) const
Return the estimated Ack TX time for this PHY.
void Configure80211ac(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11ac standard...
WifiMode GetDefaultMode(void) const
Get the default WifiMode supported by the 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...
uint8_t GetChannelNumber(void) const
Return current channel number.
WifiPhyStandard m_standard
WifiPhyStandard.
bool m_channelAccessRequested
Flag if channels access has been requested (used for OBSS_PD SR)
Ptr< UniformRandomVariable > m_random
Provides uniform random variables.
uint64_t GetPreviouslyRxPpduUid(void) const
uint8_t m_txSpatialStreams
Number of supported TX spatial streams.
double GetTxPowerStart(void) const
Return the minimum available transmission power level (dBm).
Time m_ackTxTime
estimated Ack TX time
Ptr< ErrorModel > m_postReceptionErrorModel
Error model for receive packet events.
std::vector< uint16_t > GetSupportedChannelWidthSet(void) const
Ptr< FrameCaptureModel > m_frameCaptureModel
Frame capture model.
void SetRxGain(double gain)
Sets the reception gain (dB).
void Configure80211b(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11b standard...
WifiPhyBand
Identifies the PHY band.
void SetSifs(Time sifs)
Set the Short Interframe Space (SIFS) for this PHY.
void SetReceiveOkCallback(RxOkCallback callback)
void RegisterListener(WifiPhyListener *listener)
bool IsStateTx(void) const
void NotifyRxBegin(Ptr< const WifiPsdu > psdu, RxPowerWattPerChannelBand rxPowersW)
Public method used to fire a PhyRxBegin trace.
void SetMaxSupportedTxSpatialStreams(uint8_t streams)
Ptr< WifiPhyStateHelper > m_state
Pointer to WifiPhyStateHelper.
void Configure80211n(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11n standard...
void SetTxPowerStart(double start)
Sets the minimum available transmission power level (dBm).
double m_txPowerBaseDbm
Minimum transmission power (dBm)
Time GetSifs(void) const
Return the Short Interframe Space (SIFS) for this PHY.
An identifier for simulation events.
void ResetReceive(Ptr< Event > event)
Reset PHY at the end of the packet under reception after it has failed the PHY header.
double GetTxPowerForTransmission(Ptr< const WifiPpdu > ppdu) const
Compute the transmit power for the next transmission.
SignalNoiseDbm structure.
InterferenceHelper m_interference
the class handling interference computations
virtual void SetChannelWidth(uint16_t channelWidth)
If the operating channel for this object has not been set yet, the given channel width is saved and w...
void ConfigureHtDeviceMcsSet(void)
Configure the device MCS set with the appropriate HtMcs modes for the number of available transmit sp...
void PushMcs(WifiMode mode)
Add the given MCS to the device MCS set.
void(* MonitorSnifferTxCallback)(const Ptr< const Packet > packet, uint16_t channelFreqMhz, WifiTxVector txVector, MpduInfo aMpdu, uint16_t staId)
TracedCallback signature for monitor mode transmit events.
WifiPhyOperatingChannel m_operatingChannel
Operating channel.
static Time GetPayloadDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, MpduType mpdutype=NORMAL_MPDU, uint16_t staId=SU_STA_ID)
double GetTxPowerEnd(void) const
Return the maximum available transmission power level (dBm).
Time GetSlot(void) const
Return the slot duration for this PHY.
void EndReceiveInterBss(void)
For HE receptions only, check and possibly modify the transmit power restriction state at the end of ...
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.
static Time CalculatePhyPreambleAndHeaderDuration(const WifiTxVector &txVector)
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...
void Configure80211g(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11g standard...
Ptr< NetDevice > GetDevice(void) const
Return the device this PHY is associated with.
double GetTxGain(void) const
Return the transmission gain (dB).
void SetSleepMode(void)
Put in sleep mode.
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. ...
void SetNumberOfAntennas(uint8_t antennas)
uint16_t m_initialChannelWidth
Store channel width (MHz) until initialization.
const WifiPhyOperatingChannel & GetOperatingChannel(void) const
Get a const reference to the operating channel.
A base class which provides memory management and object aggregation.
double m_txPowerEndDbm
Maximum transmission power (dBm)
void Configure80211p(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11p standard...
std::map< WifiModulationClass, Ptr< PhyEntity > > m_phyEntities
This map holds the supported PHY entities.
Time m_channelSwitchDelay
Time required to switch between channel.
Time GetLastRxEndTime(void) const
Return the end time of the last received packet.
void MaybeCcaBusyDuration(uint16_t channelWidth)
Eventually switch to CCA busy.
uint8_t m_numberOfAntennas
Number of transmitters.
uint8_t GetMaxSupportedTxSpatialStreams(void) const
a unique identifier for an interface.
uint16_t GetNMcs(void) const
Ptr< Event > m_currentEvent
Hold the current event.
Time GetLastRxStartTime(void) const
Return the start time of the last received packet.
double m_txPowerMaxSiso
SISO maximum transmit power due to OBSS PD SR power restriction (dBm)
bool IsStateRx(void) const
bool IsMcsSupported(WifiModulationClass modulation, uint8_t mcs) const
Check if the given MCS of the given modulation class is supported by the PHY.
uint8_t m_rxSpatialStreams
Number of supported RX spatial streams.
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
std::vector< uint16_t > m_supportedChannelWidthSet
Supported channel width set (MHz)
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...
void SetCcaEdThreshold(double threshold)
Sets the CCA threshold (dBm).
virtual int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
std::map< WifiSpectrumBand, double > RxPowerWattPerChannelBand
A map of the received power (Watts) for each band.
Callback< void > m_capabilitiesChangedCallback
Callback when PHY capabilities changed.
void Configure80211a(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11a standard...
uint8_t GetMaxSupportedRxSpatialStreams(void) const
TracedCallback< Ptr< const Packet > > m_phyTxEndTrace
The trace source fired when a packet ends the transmission process on the medium. ...
uint16_t m_initialFrequency
Store frequency until initialization (MHz)
virtual WifiSpectrumBand GetBand(uint16_t bandWidth, uint8_t bandIndex=0)
Get the start band index and the stop band index for a given band.