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...
 
enum WifiCodeRate GetCodeRate (void) const
 
uint16_t GetConstellationSize (void) const
 
uint64_t GetDataRate (uint32_t channelWidth, bool isShortGuardInterval, uint8_t nss) const
 
uint64_t GetDataRate (WifiTxVector txVector) const
 
uint8_t GetMcsValue (void) const
 
enum WifiModulationClass GetModulationClass () const
 
uint64_t GetNonHtReferenceRate (void) const
 
uint64_t GetPhyRate (uint32_t channelWidth, bool isShortGuardInterval, uint8_t nss) const
 
uint64_t GetPhyRate (WifiTxVector txVector) const
 
uint32_t GetUid (void) const
 
std::string GetUniqueName (void) 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
 

Friends

class WifiModeFactory
 
class WifiPhyTag
 

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 99 of file wifi-mode.h.

Constructor & Destructor Documentation

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 521 of file wifi-mode.cc.

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 531 of file wifi-mode.cc.

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

+ Here is the call graph for this function:

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

Create a WifiMode from a given unique ID.

Parameters
uidunique ID

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

Member Function Documentation

uint16_t ns3::WifiMode::GetConstellationSize ( void  ) const
uint64_t ns3::WifiMode::GetDataRate ( uint32_t  channelWidth,
bool  isShortGuardInterval,
uint8_t  nss 
) const
Parameters
channelWidththe considered channel width in MHz
isShortGuardIntervalwhether short guard interval is considered or not
nssthe considered number of streams
Returns
the data bit rate of this signal.

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

References ns3::WifiModeFactory::Get(), GetCodeRate(), GetConstellationSize(), ns3::WifiModeFactory::GetFactory(), m_uid, ns3::WifiModeFactory::WifiModeItem::mcsValue, ns3::WifiModeFactory::WifiModeItem::modClass, NS_ASSERT, NS_ASSERT_MSG, NS_FATAL_ERROR, ns3::WIFI_CODE_RATE_1_2, ns3::WIFI_CODE_RATE_2_3, ns3::WIFI_CODE_RATE_3_4, ns3::WIFI_CODE_RATE_5_6, ns3::WIFI_CODE_RATE_UNDEFINED, ns3::WIFI_MOD_CLASS_DSSS, ns3::WIFI_MOD_CLASS_ERP_OFDM, ns3::WIFI_MOD_CLASS_HR_DSSS, ns3::WIFI_MOD_CLASS_HT, ns3::WIFI_MOD_CLASS_OFDM, and ns3::WIFI_MOD_CLASS_VHT.

Referenced by TxDurationTest::CheckPayloadDuration(), ns3::MeshWifiInterfaceMac::CheckSupportedRates(), TxDurationTest::CheckTxDuration(), ns3::IdealWifiManager::DoGetDataTxVector(), ns3::MinstrelHtWifiManager::DoGetDataTxVector(), ns3::MinstrelHtWifiManager::DoGetRtsTxVector(), ns3::NistErrorRateModel::GetChunkSuccessRate(), ns3::YansErrorRateModel::GetChunkSuccessRate(), GetDataRate(), ns3::WaveMacLow::GetDataTxVector(), ns3::RegularWifiMac::GetHtCapabilities(), ns3::WifiPhy::GetPayloadDuration(), GetPhyRate(), ns3::WifiPhy::GetPlcpHeaderDuration(), ns3::WifiPhy::GetPlcpPreambleDuration(), ns3::MeshWifiInterfaceMac::GetSupportedRates(), ns3::StaWifiMac::GetSupportedRates(), ns3::ApWifiMac::GetSupportedRates(), ns3::StaWifiMac::Receive(), ns3::ApWifiMac::Receive(), ns3::MeshWifiInterfaceMac::Receive(), ns3::YansWifiPhy::SendPacket(), ns3::SpectrumWifiPhy::SendPacket(), PowerRateAdaptationTest::TestAparf(), and PowerRateAdaptationTest::TestParf().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint64_t ns3::WifiMode::GetDataRate ( WifiTxVector  txVector) const
Parameters
txVectorthe WifiTxVector of the signal
Returns
the data bit rate of this signal.

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

References ns3::WifiTxVector::GetChannelWidth(), GetDataRate(), ns3::WifiTxVector::GetNss(), and ns3::WifiTxVector::IsShortGuardInterval().

+ Here is the call graph for this function:

enum 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 379 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::MacLow::AggregateToAmpdu(), ns3::MacLow::CalculateOverallTxTime(), ns3::MacLow::CalculateTransmissionTime(), TxDurationTest::CheckPayloadDuration(), TxDurationTest::CheckTxDuration(), ns3::IdealWifiManager::DoGetDataTxVector(), ns3::IdealWifiManager::DoInitialize(), ns3::MacLow::GetAckDuration(), ns3::MacLow::GetBlockAckDuration(), ns3::IdealWifiManager::GetChannelWidthForMode(), ns3::NistErrorRateModel::GetChunkSuccessRate(), ns3::YansErrorRateModel::GetChunkSuccessRate(), ns3::WifiRemoteStationManager::GetControlAnswerMode(), ns3::MacLow::GetCtsDuration(), ns3::RegularWifiMac::GetHtCapabilities(), ns3::MinstrelHtWifiManager::GetHtDeviceMcsList(), ns3::WifiPhy::GetPayloadDuration(), ns3::WifiPhy::GetPlcpHeaderDuration(), ns3::WifiPhy::GetPlcpHeaderMode(), ns3::WifiPhy::GetPlcpPreambleDuration(), ns3::ApWifiMac::GetSupportedRates(), ns3::RegularWifiMac::GetVhtCapabilities(), ns3::MinstrelHtWifiManager::GetVhtDeviceMcsList(), IsHigherDataRate(), ns3::WifiRemoteStationManager::NeedCtsToSelf(), ns3::WifiRemoteStationManager::NeedRts(), ns3::MinstrelHtWifiManager::RateInit(), ns3::StaWifiMac::Receive(), ns3::ApWifiMac::Receive(), ns3::MacLow::SendBlockAckResponse(), ns3::MacLow::SendCtsToSelf(), ns3::MacLow::SendDataAfterCts(), ns3::MacLow::SendDataPacket(), ns3::YansWifiPhy::SendPacket(), ns3::SpectrumWifiPhy::SendPacket(), ns3::MacLow::StartDataTxTimers(), and ns3::MacLow::StopMpduAggregation().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 386 of file wifi-mode.cc.

References ns3::WifiModeFactory::Get(), GetCodeRate(), GetConstellationSize(), ns3::WifiModeFactory::GetFactory(), m_uid, ns3::WifiModeFactory::WifiModeItem::modClass, NS_FATAL_ERROR, ns3::WIFI_CODE_RATE_1_2, ns3::WIFI_CODE_RATE_2_3, ns3::WIFI_CODE_RATE_3_4, ns3::WIFI_CODE_RATE_5_6, ns3::WIFI_MOD_CLASS_HT, and ns3::WIFI_MOD_CLASS_VHT.

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint64_t ns3::WifiMode::GetPhyRate ( uint32_t  channelWidth,
bool  isShortGuardInterval,
uint8_t  nss 
) const
Parameters
channelWidththe considered channel width in MHz
isShortGuardIntervalwhether short guard interval is considered or not
nssthe considered number of streams
Returns
the physical bit rate of this signal.

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 74 of file wifi-mode.cc.

References GetCodeRate(), GetDataRate(), NS_ASSERT, ns3::WIFI_CODE_RATE_1_2, ns3::WIFI_CODE_RATE_2_3, ns3::WIFI_CODE_RATE_3_4, ns3::WIFI_CODE_RATE_5_6, and ns3::WIFI_CODE_RATE_UNDEFINED.

Referenced by ns3::InterferenceHelper::CalculateChunkSuccessRate(), ns3::YansErrorRateModel::GetChunkSuccessRate(), and GetPhyRate().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint64_t ns3::WifiMode::GetPhyRate ( WifiTxVector  txVector) const
Parameters
txVectorthe WifiTxVector of the signal
Returns
the physical bit rate of this signal.

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 103 of file wifi-mode.cc.

References ns3::WifiTxVector::GetChannelWidth(), ns3::WifiTxVector::GetNss(), GetPhyRate(), and ns3::WifiTxVector::IsShortGuardInterval().

+ Here is the call graph for this function:

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 373 of file wifi-mode.cc.

References m_uid.

Referenced by ns3::operator==(), and ns3::WifiPhyTag::Serialize().

+ Here is the caller graph for this function:

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

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

References GetCodeRate(), NS_FATAL_ERROR, ns3::WIFI_CODE_RATE_1_2, ns3::WIFI_CODE_RATE_2_3, ns3::WIFI_CODE_RATE_3_4, and ns3::WIFI_CODE_RATE_5_6.

Referenced by ns3::WifiRemoteStationManager::GetControlAnswerMode(), and IsHigherDataRate().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

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

Referenced by ns3::WifiRemoteStationManager::AddAllSupportedModes(), ns3::WifiRemoteStationManager::GetControlAnswerMode(), ns3::ApWifiMac::GetSupportedRates(), and ns3::WifiRemoteStationManager::Reset().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Friends And Related Function Documentation

friend class WifiModeFactory
friend

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

friend class WifiPhyTag
friend

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

Member Data Documentation


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