A Discrete-Event Network Simulator
API
ns3::WifiMode Class Reference

represent a single transmission modeA WifiMode is implemented by a single integer which is used to lookup in a global array the characteristics of the associated transmission mode. More...

#include "wifi-mode.h"

Public Member Functions

 WifiMode ()
 Create an invalid WifiMode. More...
 
 WifiMode (std::string name)
 Create a WifiMode if the given string represents a valid WifiMode name. More...
 
WifiCodeRate GetCodeRate (void) const
 
uint16_t GetConstellationSize (void) const
 
uint64_t GetDataRate (uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
 
uint64_t GetDataRate (const WifiTxVector &txVector, uint16_t staId=SU_STA_ID) const
 
uint64_t GetDataRate (uint16_t channelWidth) const
 
uint8_t GetMcsValue (void) const
 
WifiModulationClass GetModulationClass () const
 
uint64_t GetNonHtReferenceRate (void) const
 
uint64_t GetPhyRate (uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
 
uint64_t GetPhyRate (const WifiTxVector &txVector, uint16_t staId=SU_STA_ID) const
 
uint64_t GetPhyRate (uint16_t channelWidth) const
 
uint32_t GetUid (void) const
 
std::string GetUniqueName (void) const
 
bool IsAllowed (uint16_t channelWidth, uint8_t nss) const
 
bool IsHigherCodeRate (WifiMode mode) const
 
bool IsHigherDataRate (WifiMode mode) const
 
bool IsMandatory (void) const
 

Private Member Functions

 WifiMode (uint32_t uid)
 Create a WifiMode from a given unique ID. More...
 

Private Attributes

uint32_t m_uid
 UID. More...
 

Friends

class WifiModeFactory
 allow WifiModeFactory class access More...
 

Detailed Description

represent a single transmission mode

A WifiMode is implemented by a single integer which is used to lookup in a global array the characteristics of the associated transmission mode.

It is thus extremely cheap to keep a WifiMode variable around.

See also
WifiMode Attribute

Definition at line 47 of file wifi-mode.h.

Constructor & Destructor Documentation

◆ WifiMode() [1/3]

ns3::WifiMode::WifiMode ( )

Create an invalid WifiMode.

Calling any method on the instance created will trigger an assert. This is useful to separate the declaration of a WifiMode variable from its initialization.

Definition at line 220 of file wifi-mode.cc.

◆ WifiMode() [2/3]

ns3::WifiMode::WifiMode ( std::string  name)

Create a WifiMode if the given string represents a valid WifiMode name.

Parameters
namestd::string of a valid WifiMode name

Definition at line 230 of file wifi-mode.cc.

References ns3::WifiModeFactory::GetFactory(), and ns3::WifiModeFactory::Search().

+ Here is the call graph for this function:

◆ WifiMode() [3/3]

ns3::WifiMode::WifiMode ( uint32_t  uid)
private

Create a WifiMode from a given unique ID.

Parameters
uidunique ID

Definition at line 225 of file wifi-mode.cc.

Member Function Documentation

◆ GetCodeRate()

WifiCodeRate ns3::WifiMode::GetCodeRate ( void  ) const
Returns
the coding rate of this transmission mode

Definition at line 108 of file wifi-mode.cc.

References ns3::WifiModeFactory::Get(), ns3::WifiModeFactory::WifiModeItem::GetCodeRateCallback, ns3::WifiModeFactory::GetFactory(), and m_uid.

Referenced by ns3::NistErrorRateModel::DoGetChunkSuccessRate(), ns3::YansErrorRateModel::DoGetChunkSuccessRate(), ns3::TableBasedErrorRateModel::GetMcsForMode(), IsHigherCodeRate(), and IsHigherDataRate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetConstellationSize()

uint16_t ns3::WifiMode::GetConstellationSize ( void  ) const
Returns
the size of the modulation constellation.

Definition at line 115 of file wifi-mode.cc.

References ns3::WifiModeFactory::Get(), ns3::WifiModeFactory::WifiModeItem::GetConstellationSizeCallback, ns3::WifiModeFactory::GetFactory(), and m_uid.

Referenced by ns3::NistErrorRateModel::DoGetChunkSuccessRate(), ns3::YansErrorRateModel::DoGetChunkSuccessRate(), ns3::TableBasedErrorRateModel::GetMcsForMode(), and IsHigherDataRate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetDataRate() [1/3]

uint64_t ns3::WifiMode::GetDataRate ( uint16_t  channelWidth,
uint16_t  guardInterval,
uint8_t  nss 
) const
Parameters
channelWidththe considered channel width in MHz
guardIntervalthe considered guard interval duration in nanoseconds
nssthe considered number of streams
Returns
the data bit rate of this signal in bps.

Definition at line 100 of file wifi-mode.cc.

References ns3::WifiModeFactory::Get(), ns3::WifiModeFactory::WifiModeItem::GetDataRateCallback, ns3::WifiModeFactory::GetFactory(), m_uid, and NS_ASSERT.

Referenced by ns3::InterferenceHelper::CalculateChunkSuccessRate(), ns3::InterferenceHelper::CalculatePayloadChunkSuccessRate(), HeRuMcsDataRateTestCase::CheckDataRate(), TxDurationTest::CheckHeMuTxDuration(), ns3::ParfWifiManager::CheckInit(), ns3::AparfWifiManager::CheckInit(), ns3::RrpaaWifiManager::CheckInit(), TxDurationTest::CheckPayloadDuration(), ns3::MeshWifiInterfaceMac::CheckSupportedRates(), TxDurationTest::CheckTxDuration(), ns3::AarfWifiManager::DoGetDataTxVector(), ns3::ThompsonSamplingWifiManager::DoGetDataTxVector(), ns3::CaraWifiManager::DoGetDataTxVector(), ns3::ParfWifiManager::DoGetDataTxVector(), ns3::AmrrWifiManager::DoGetDataTxVector(), ns3::OnoeWifiManager::DoGetDataTxVector(), ns3::ArfWifiManager::DoGetDataTxVector(), ns3::IdealWifiManager::DoGetDataTxVector(), ns3::AarfcdWifiManager::DoGetDataTxVector(), ns3::AparfWifiManager::DoGetDataTxVector(), ns3::RraaWifiManager::DoGetDataTxVector(), ns3::RrpaaWifiManager::DoGetDataTxVector(), ns3::MinstrelHtWifiManager::DoGetDataTxVector(), ns3::MinstrelHtWifiManager::DoGetRtsTxVector(), ns3::DsssPpdu::DsssPpdu(), ns3::ErrorRateModel::GetChunkSuccessRate(), GetDataRate(), ns3::WaveFrameExchangeManager::GetDataTxVector(), ns3::MinstrelWifiManager::GetDataTxVector(), ns3::DsssPhy::GetHeaderDuration(), ns3::ApWifiMac::GetHtOperation(), ns3::VhtPhy::GetNumberBccEncoders(), ns3::HtPhy::GetNumberBccEncoders(), ns3::DsssPhy::GetPayloadDuration(), ns3::HtPhy::GetPayloadDuration(), ns3::OfdmPhy::GetPayloadDuration(), ns3::DsssPhy::GetPreambleDuration(), ns3::WifiPhyHelper::GetRadiotapHeader(), ns3::PhyEntity::GetReceptionStatus(), ns3::HePhy::GetSigBDuration(), ns3::MeshWifiInterfaceMac::GetSupportedRates(), ns3::ApWifiMac::GetSupportedRates(), ns3::OfdmPpdu::OfdmPpdu(), PowerRateAdaptationTest::TestAparf(), PowerRateAdaptationTest::TestParf(), and PowerRateAdaptationTest::TestRrpaa().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetDataRate() [2/3]

uint64_t ns3::WifiMode::GetDataRate ( const WifiTxVector txVector,
uint16_t  staId = SU_STA_ID 
) const
Parameters
txVectorthe const WifiTxVector& of the signal
staIdthe station ID for MU (unused if SU)
Returns
the data bit rate of this signal.

Definition at line 93 of file wifi-mode.cc.

References ns3::WifiModeFactory::Get(), ns3::WifiModeFactory::WifiModeItem::GetDataRateFromTxVectorCallback, ns3::WifiModeFactory::GetFactory(), and m_uid.

+ Here is the call graph for this function:

◆ GetDataRate() [3/3]

uint64_t ns3::WifiMode::GetDataRate ( uint16_t  channelWidth) const
Parameters
channelWidththe considered channel width in MHz
Returns
the data bit rate of this non-HT.

Definition at line 87 of file wifi-mode.cc.

References GetDataRate().

+ Here is the call graph for this function:

◆ GetMcsValue()

◆ GetModulationClass()

WifiModulationClass ns3::WifiMode::GetModulationClass ( ) const
Returns
the Modulation Class (Section 9.7.8 "Modulation classes"; IEEE 802.11-2012) to which this WifiMode belongs.

Definition at line 159 of file wifi-mode.cc.

References ns3::WifiModeFactory::Get(), ns3::WifiModeFactory::GetFactory(), m_uid, and ns3::WifiModeFactory::WifiModeItem::modClass.

Referenced by ns3::WifiRemoteStationManager::AddBasicMode(), ns3::WifiRemoteStationManager::AddSupportedMode(), ns3::IdealWifiManager::BuildSnrThresholds(), TxDurationTest::CheckPayloadDuration(), TxDurationTest::CheckTxDuration(), ns3::ConvertGuardIntervalToNanoSeconds(), ns3::NistErrorRateModel::DoGetChunkSuccessRate(), ns3::TableBasedErrorRateModel::DoGetChunkSuccessRate(), ns3::YansErrorRateModel::DoGetChunkSuccessRate(), ns3::ConstantRateWifiManager::DoGetDataTxVector(), ns3::AarfWifiManager::DoGetDataTxVector(), ns3::ThompsonSamplingWifiManager::DoGetDataTxVector(), ns3::CaraWifiManager::DoGetDataTxVector(), ns3::AmrrWifiManager::DoGetDataTxVector(), ns3::ParfWifiManager::DoGetDataTxVector(), ns3::OnoeWifiManager::DoGetDataTxVector(), ns3::ArfWifiManager::DoGetDataTxVector(), ns3::IdealWifiManager::DoGetDataTxVector(), ns3::AarfcdWifiManager::DoGetDataTxVector(), ns3::AparfWifiManager::DoGetDataTxVector(), ns3::RraaWifiManager::DoGetDataTxVector(), ns3::RrpaaWifiManager::DoGetDataTxVector(), ns3::MinstrelHtWifiManager::DoGetDataTxVector(), ns3::ConstantRateWifiManager::DoGetRtsTxVector(), ns3::AarfWifiManager::DoGetRtsTxVector(), ns3::ThompsonSamplingWifiManager::DoGetRtsTxVector(), ns3::CaraWifiManager::DoGetRtsTxVector(), ns3::ParfWifiManager::DoGetRtsTxVector(), ns3::AmrrWifiManager::DoGetRtsTxVector(), ns3::OnoeWifiManager::DoGetRtsTxVector(), ns3::ArfWifiManager::DoGetRtsTxVector(), ns3::IdealWifiManager::DoGetRtsTxVector(), ns3::AarfcdWifiManager::DoGetRtsTxVector(), ns3::AparfWifiManager::DoGetRtsTxVector(), ns3::RraaWifiManager::DoGetRtsTxVector(), ns3::RrpaaWifiManager::DoGetRtsTxVector(), ns3::MinstrelHtWifiManager::DoGetRtsTxVector(), ns3::IdealWifiManager::GetChannelWidthForNonHtMode(), ns3::GetChannelWidthForTransmission(), ns3::ErrorRateModel::GetChunkSuccessRate(), ns3::WifiRemoteStationManager::GetControlAnswerMode(), ns3::WifiRemoteStationManager::GetCtsToSelfTxVector(), ns3::DsssPhy::GetDataRateFromTxVector(), ns3::MinstrelWifiManager::GetDataTxVector(), ns3::WifiRemoteStationManager::GetDataTxVector(), ns3::ErpOfdmPhy::GetHeaderMode(), ns3::TableBasedErrorRateModel::GetMcsForMode(), ns3::ThompsonSamplingWifiManager::GetModeGuardInterval(), ns3::WifiTxVector::GetModulationClass(), ns3::WifiPhyHelper::GetRadiotapHeader(), ns3::MinstrelWifiManager::GetRtsTxVector(), ns3::WifiRemoteStationManager::GetRtsTxVector(), ns3::ThompsonSamplingWifiManager::InitializeStation(), IsHigherDataRate(), ns3::WifiRemoteStationManager::NeedCtsToSelf(), ns3::WifiRemoteStationManager::NeedRts(), ns3::MinstrelHtWifiManager::RateInit(), ns3::WifiTxVector::SetHeMuUserInfo(), Bug2843TestCase::StoreDistinctTuple(), and Issue169TestCase::TxCallback().

+ Here is the call graph for this function:

◆ GetNonHtReferenceRate()

uint64_t ns3::WifiMode::GetNonHtReferenceRate ( void  ) const
Returns
the rate (in bps) of the non-HT Reference Rate which corresponds to the HT MCS of this WifiMode.

To convert an HT MCS to is corresponding non-HT Reference Rate use the modulation and coding rate of the HT MCS and lookup in Table 9-5 of IEEE 802.11-2012.

Definition at line 166 of file wifi-mode.cc.

References ns3::WifiModeFactory::Get(), ns3::WifiModeFactory::GetFactory(), ns3::WifiModeFactory::WifiModeItem::GetNonHtReferenceRateCallback, ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), m_uid, and NS_ASSERT_MSG.

Referenced by ns3::MinstrelHtWifiManager::DoGetRtsTxVector().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetPhyRate() [1/3]

uint64_t ns3::WifiMode::GetPhyRate ( uint16_t  channelWidth,
uint16_t  guardInterval,
uint8_t  nss 
) const
Parameters
channelWidththe considered channel width in MHz
guardIntervalthe considered guard interval duration in nanoseconds
nssthe considered number of streams
Returns
the physical bit rate of this signal in bps.

If a transmission mode uses 1/2 FEC, and if its data rate is 3.25Mbps, the PHY rate is 6.5Mbps

Definition at line 73 of file wifi-mode.cc.

References ns3::WifiModeFactory::Get(), ns3::WifiModeFactory::GetFactory(), ns3::WifiModeFactory::WifiModeItem::GetPhyRateCallback, and m_uid.

Referenced by ns3::YansErrorRateModel::DoGetChunkSuccessRate(), and GetPhyRate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetPhyRate() [2/3]

uint64_t ns3::WifiMode::GetPhyRate ( const WifiTxVector txVector,
uint16_t  staId = SU_STA_ID 
) const
Parameters
txVectorthe const WifiTxVector& of the signal
staIdthe station ID for MU (unused if SU)
Returns
the physical bit rate of this signal in bps.

If a transmission mode uses 1/2 FEC, and if its data rate is 3.25Mbps, the PHY rate is 6.5Mbps

Definition at line 80 of file wifi-mode.cc.

References ns3::WifiModeFactory::Get(), ns3::WifiModeFactory::GetFactory(), ns3::WifiModeFactory::WifiModeItem::GetPhyRateFromTxVectorCallback, and m_uid.

+ Here is the call graph for this function:

◆ GetPhyRate() [3/3]

uint64_t ns3::WifiMode::GetPhyRate ( uint16_t  channelWidth) const
Parameters
channelWidththe considered channel width in MHz
Returns
the physical bit rate of this non-HT signal.

Definition at line 67 of file wifi-mode.cc.

References GetPhyRate().

+ Here is the call graph for this function:

◆ GetUid()

uint32_t ns3::WifiMode::GetUid ( void  ) const
Returns
the UID associated to this wireless mode.

Each specific wireless mode should have a different UID. For example, the 802.11b 1Mbps and the 802.11b 2Mbps modes should have different UIDs.

Definition at line 153 of file wifi-mode.cc.

References m_uid.

Referenced by ns3::operator!=(), ns3::operator<(), and ns3::operator==().

+ Here is the caller graph for this function:

◆ GetUniqueName()

◆ IsAllowed()

bool ns3::WifiMode::IsAllowed ( uint16_t  channelWidth,
uint8_t  nss 
) const
Returns
true if this <MCS, channel width, NSS> combination is allowed, false otherwise.
Parameters
channelWidththe considered channel width in MHz
nssthe considered number of streams

Definition at line 60 of file wifi-mode.cc.

References ns3::WifiModeFactory::Get(), ns3::WifiModeFactory::GetFactory(), ns3::WifiModeFactory::WifiModeItem::IsModeAllowedCallback, and m_uid.

Referenced by ns3::IdealWifiManager::BuildSnrThresholds().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsHigherCodeRate()

bool ns3::WifiMode::IsHigherCodeRate ( WifiMode  mode) const
Parameters
modethe WifiMode
Returns
true if this WifiMode has a a code rate strictly higher than mode.

Definition at line 174 of file wifi-mode.cc.

References GetCodeRate(), NS_ASSERT_MSG, and ns3::WIFI_CODE_RATE_UNDEFINED.

Referenced by IsHigherDataRate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsHigherDataRate()

bool ns3::WifiMode::IsHigherDataRate ( WifiMode  mode) const
Parameters
modethe WifiMode
Returns
true if this WifiMode has a a rate strictly higher than mode.

Definition at line 181 of file wifi-mode.cc.

References GetCodeRate(), GetConstellationSize(), GetModulationClass(), IsHigherCodeRate(), ns3::WIFI_CODE_RATE_UNDEFINED, ns3::WIFI_MOD_CLASS_DSSS, and ns3::WIFI_MOD_CLASS_HR_DSSS.

Referenced by ns3::WifiRemoteStationManager::GetControlAnswerMode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsMandatory()

bool ns3::WifiMode::IsMandatory ( void  ) const
Returns
true if this mode is a mandatory mode, false otherwise.

Definition at line 130 of file wifi-mode.cc.

References ns3::WifiModeFactory::Get(), ns3::WifiModeFactory::GetFactory(), ns3::WifiModeFactory::WifiModeItem::isMandatory, and m_uid.

Referenced by ns3::WifiRemoteStationManager::SetupPhy().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ WifiModeFactory

friend class WifiModeFactory
friend

allow WifiModeFactory class access

Definition at line 184 of file wifi-mode.h.

Member Data Documentation

◆ m_uid


The documentation for this class was generated from the following files: