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