represent a single transmission mode More...
#include "wifi-mode.h"
Public Member Functions | |
WifiMode () | |
Create an invalid WifiMode. | |
WifiMode (std::string name) | |
Create a WifiMode if the given string represents a valid WifiMode name. | |
WifiCodeRate | GetCodeRate () const |
uint16_t | GetConstellationSize () const |
uint64_t | GetDataRate (const WifiTxVector &txVector, uint16_t staId=SU_STA_ID) const |
uint64_t | GetDataRate (MHz_u channelWidth) const |
uint64_t | GetDataRate (MHz_u channelWidth, Time guardInterval, uint8_t nss) const |
uint8_t | GetMcsValue () const |
WifiModulationClass | GetModulationClass () const |
uint64_t | GetNonHtReferenceRate () const |
uint64_t | GetPhyRate (const WifiTxVector &txVector, uint16_t staId=SU_STA_ID) const |
uint64_t | GetPhyRate (MHz_u channelWidth) const |
uint64_t | GetPhyRate (MHz_u channelWidth, Time guardInterval, uint8_t nss) const |
uint32_t | GetUid () const |
const std::string & | GetUniqueName () const |
bool | IsAllowed (const WifiTxVector &txVector) const |
bool | IsAllowed (MHz_u channelWidth, uint8_t nss) const |
bool | IsHigherCodeRate (WifiMode mode) const |
bool | IsHigherDataRate (WifiMode mode) const |
bool | IsMandatory () const |
Private Member Functions | |
WifiMode (uint32_t uid) | |
Create a WifiMode from a given unique ID. | |
Private Attributes | |
uint32_t | m_uid |
UID. | |
Friends | |
class | WifiModeFactory |
allow WifiModeFactory class access | |
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.
Definition at line 39 of file wifi-mode.h.
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 237 of file wifi-mode.cc.
Referenced by GetDataRate(), GetPhyRate(), and IsAllowed().
ns3::WifiMode::WifiMode | ( | std::string | name | ) |
Create a WifiMode if the given string represents a valid WifiMode name.
name | std::string of a valid WifiMode name |
Definition at line 247 of file wifi-mode.cc.
References ns3::WifiModeFactory::GetFactory(), and ns3::WifiModeFactory::Search().
|
private |
Create a WifiMode from a given unique ID.
uid | unique ID |
Definition at line 242 of file wifi-mode.cc.
WifiCodeRate ns3::WifiMode::GetCodeRate | ( | ) | const |
Definition at line 123 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().
uint16_t ns3::WifiMode::GetConstellationSize | ( | ) | const |
Definition at line 130 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().
uint64_t ns3::WifiMode::GetDataRate | ( | const WifiTxVector & | txVector, |
uint16_t | staId = SU_STA_ID ) const |
txVector | the const WifiTxVector& of the signal |
staId | the station ID for MU (unused if SU) |
Definition at line 104 of file wifi-mode.cc.
References ns3::WifiModeFactory::Get(), ns3::WifiModeFactory::WifiModeItem::GetDataRateCallback, ns3::WifiModeFactory::GetFactory(), and m_uid.
uint64_t ns3::WifiMode::GetDataRate | ( | MHz_u | channelWidth | ) | const |
channelWidth | the considered channel width |
Definition at line 98 of file wifi-mode.cc.
References GetDataRate(), and ns3::NanoSeconds().
channelWidth | the considered channel width |
guardInterval | the considered guard interval duration |
nss | the considered number of streams |
Definition at line 111 of file wifi-mode.cc.
References WifiMode(), GetDataRate(), m_uid, NS_ASSERT, ns3::WifiTxVector::SetChannelWidth(), ns3::WifiTxVector::SetGuardInterval(), ns3::WifiTxVector::SetMode(), and ns3::WifiTxVector::SetNss().
Referenced by ns3::WifiRemoteStationManager::AdjustTxVectorForIcf(), ns3::InterferenceHelper::CalculateChunkSuccessRate(), ns3::InterferenceHelper::CalculatePayloadChunkSuccessRate(), HeRuMcsDataRateTestCase::CheckDataRate(), ns3::AparfWifiManager::CheckInit(), ns3::ParfWifiManager::CheckInit(), ns3::RrpaaWifiManager::CheckInit(), EmlsrDlTxopTest::CheckInitialControlFrame(), TxDurationTest::CheckMuTxDuration(), TxDurationTest::CheckPayloadDuration(), TxDurationTest::CheckTxDuration(), ns3::AarfcdWifiManager::DoGetDataTxVector(), ns3::AarfWifiManager::DoGetDataTxVector(), ns3::AmrrWifiManager::DoGetDataTxVector(), ns3::AparfWifiManager::DoGetDataTxVector(), ns3::ArfWifiManager::DoGetDataTxVector(), ns3::CaraWifiManager::DoGetDataTxVector(), ns3::IdealWifiManager::DoGetDataTxVector(), ns3::MinstrelHtWifiManager::DoGetDataTxVector(), ns3::OnoeWifiManager::DoGetDataTxVector(), ns3::ParfWifiManager::DoGetDataTxVector(), ns3::RraaWifiManager::DoGetDataTxVector(), ns3::RrpaaWifiManager::DoGetDataTxVector(), ns3::MinstrelHtWifiManager::DoGetRtsTxVector(), WifiTxopTest::DoRun(), ns3::ErrorRateModel::GetChunkSuccessRate(), GetDataRate(), GetDataRate(), ns3::MinstrelWifiManager::GetDataTxVector(), ns3::AdvancedApEmlsrManager::GetDelayOnTxPsduNotForEmlsr(), ns3::DsssPhy::GetHeaderDuration(), ns3::ApWifiMac::GetHtOperation(), ns3::HtPhy::GetNumberBccEncoders(), ns3::VhtPhy::GetNumberBccEncoders(), ns3::DsssPhy::GetPayloadDuration(), ns3::HtPhy::GetPayloadDuration(), ns3::OfdmPhy::GetPayloadDuration(), ns3::DsssPhy::GetPreambleDuration(), ns3::WifiPhyHelper::GetRadiotapHeader(), ns3::PhyEntity::GetReceptionStatus(), ns3::HePhy::GetSigBDuration(), ns3::ApWifiMac::GetSupportedRates(), ns3::DsssPpdu::SetDsssHeader(), ns3::OfdmPpdu::SetLSigHeader(), PowerRateAdaptationTest::TestAparf(), PowerRateAdaptationTest::TestParf(), and PowerRateAdaptationTest::TestRrpaa().
uint8_t ns3::WifiMode::GetMcsValue | ( | ) | const |
Definition at line 152 of file wifi-mode.cc.
References ns3::WifiModeFactory::Get(), ns3::WifiModeFactory::GetFactory(), m_uid, ns3::WifiModeFactory::WifiModeItem::mcsValue, ns3::WifiModeFactory::WifiModeItem::modClass, NS_ASSERT, and ns3::WIFI_MOD_CLASS_HT.
Referenced by ns3::WifiRemoteStationManager::AddBasicMcs(), ns3::IdealWifiManager::BuildSnrThresholds(), ns3::ConstantRateWifiManager::DoGetDataTxVector(), TableBasedErrorRateTestCase::DoRun(), ns3::EhtPhy::GetDataRateFromTxVector(), ns3::HePhy::GetDataRateFromTxVector(), ns3::HtPhy::GetDataRateFromTxVector(), ns3::VhtPhy::GetDataRateFromTxVector(), ns3::EhtPpdu::GetEhtSigContentChannels(), ns3::ApWifiMac::GetHtOperation(), ns3::TableBasedErrorRateModel::GetMcsForMode(), ns3::VhtPhy::GetNumberBccEncoders(), ns3::EhtPhy::GetPhyRateFromTxVector(), ns3::HePhy::GetPhyRateFromTxVector(), ns3::HtPhy::GetPhyRateFromTxVector(), ns3::VhtPhy::GetPhyRateFromTxVector(), ns3::WifiPhyHelper::GetRadiotapHeader(), ns3::EhtPhy::GetSigBMode(), ns3::VhtPhy::IsAllowed(), ns3::MinstrelHtWifiManager::RateInit(), ns3::ApWifiMac::ReceiveAssocRequest(), ns3::EhtPpdu::SetEhtPhyHeader(), ns3::HePpdu::SetHeSigHeader(), ns3::HtPpdu::SetHtSigHeader(), ns3::WifiTxVector::SetMode(), ns3::VhtPpdu::SetVhtSigHeader(), and ns3::RrMultiUserScheduler::TrySendingDlMuPpdu().
WifiModulationClass ns3::WifiMode::GetModulationClass | ( | ) | const |
Definition at line 174 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::NistErrorRateModel::DoGetChunkSuccessRate(), ns3::TableBasedErrorRateModel::DoGetChunkSuccessRate(), ns3::YansErrorRateModel::DoGetChunkSuccessRate(), ns3::AarfcdWifiManager::DoGetDataTxVector(), ns3::AarfWifiManager::DoGetDataTxVector(), ns3::AmrrWifiManager::DoGetDataTxVector(), ns3::AparfWifiManager::DoGetDataTxVector(), ns3::ArfWifiManager::DoGetDataTxVector(), ns3::CaraWifiManager::DoGetDataTxVector(), ns3::ConstantRateWifiManager::DoGetDataTxVector(), ns3::IdealWifiManager::DoGetDataTxVector(), ns3::MinstrelHtWifiManager::DoGetDataTxVector(), ns3::OnoeWifiManager::DoGetDataTxVector(), ns3::ParfWifiManager::DoGetDataTxVector(), ns3::RraaWifiManager::DoGetDataTxVector(), ns3::RrpaaWifiManager::DoGetDataTxVector(), ns3::AarfcdWifiManager::DoGetRtsTxVector(), ns3::AarfWifiManager::DoGetRtsTxVector(), ns3::AmrrWifiManager::DoGetRtsTxVector(), ns3::AparfWifiManager::DoGetRtsTxVector(), ns3::ArfWifiManager::DoGetRtsTxVector(), ns3::CaraWifiManager::DoGetRtsTxVector(), ns3::ConstantRateWifiManager::DoGetRtsTxVector(), ns3::IdealWifiManager::DoGetRtsTxVector(), ns3::MinstrelHtWifiManager::DoGetRtsTxVector(), ns3::OnoeWifiManager::DoGetRtsTxVector(), ns3::ParfWifiManager::DoGetRtsTxVector(), ns3::RraaWifiManager::DoGetRtsTxVector(), ns3::RrpaaWifiManager::DoGetRtsTxVector(), ns3::ThompsonSamplingWifiManager::DoGetRtsTxVector(), ns3::WifiRemoteStationManager::GetAckTxVector(), ns3::WifiRemoteStationManager::GetBlockAckTxVector(), ns3::IdealWifiManager::GetChannelWidthForNonHtMode(), ns3::ErrorRateModel::GetChunkSuccessRate(), ns3::WifiRemoteStationManager::GetControlAnswerMode(), ns3::WifiRemoteStationManager::GetCtsToSelfTxVector(), ns3::WifiRemoteStationManager::GetCtsTxVector(), ns3::DsssPhy::GetDataRateFromTxVector(), ns3::MinstrelWifiManager::GetDataTxVector(), ns3::WifiRemoteStationManager::GetDataTxVector(), ns3::GetGuardIntervalForMode(), ns3::GetGuardIntervalForMode(), ns3::ErpOfdmPhy::GetHeaderMode(), ns3::TableBasedErrorRateModel::GetMcsForMode(), ns3::ThompsonSamplingWifiManager::GetModeGuardInterval(), ns3::WifiTxVector::GetModulationClass(), ns3::WifiPhyHelper::GetRadiotapHeader(), ns3::MinstrelWifiManager::GetRtsTxVector(), ns3::WifiRemoteStationManager::GetRtsTxVector(), ns3::WifiPhy::GetTxBandwidth(), ns3::ThompsonSamplingWifiManager::InitializeStation(), IsHigherDataRate(), ns3::WifiRemoteStationManager::NeedCtsToSelf(), ns3::MinstrelHtWifiManager::RateInit(), Bug2843TestCase::StoreDistinctTuple(), and Issue169TestCase::TxCallback().
uint64_t ns3::WifiMode::GetNonHtReferenceRate | ( | ) | const |
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 181 of file wifi-mode.cc.
References ns3::WifiModeFactory::Get(), ns3::WifiModeFactory::GetFactory(), ns3::WifiModeFactory::WifiModeItem::GetNonHtReferenceRateCallback, ns3::Callback< R, UArgs >::IsNull(), m_uid, and NS_ASSERT_MSG.
Referenced by ns3::MinstrelHtWifiManager::DoGetRtsTxVector().
uint64_t ns3::WifiMode::GetPhyRate | ( | const WifiTxVector & | txVector, |
uint16_t | staId = SU_STA_ID ) const |
txVector | the const WifiTxVector& of the signal |
staId | the station ID for MU (unused if SU) |
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 91 of file wifi-mode.cc.
References ns3::WifiModeFactory::Get(), ns3::WifiModeFactory::GetFactory(), ns3::WifiModeFactory::WifiModeItem::GetPhyRateCallback, and m_uid.
uint64_t ns3::WifiMode::GetPhyRate | ( | MHz_u | channelWidth | ) | const |
channelWidth | the considered channel width |
Definition at line 74 of file wifi-mode.cc.
References GetPhyRate(), and ns3::NanoSeconds().
channelWidth | the considered channel width |
guardInterval | the considered guard interval duration |
nss | the considered number of streams |
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 WifiMode(), GetPhyRate(), m_uid, ns3::WifiTxVector::SetChannelWidth(), ns3::WifiTxVector::SetGuardInterval(), ns3::WifiTxVector::SetMode(), and ns3::WifiTxVector::SetNss().
Referenced by ns3::YansErrorRateModel::DoGetChunkSuccessRate(), GetPhyRate(), and GetPhyRate().
uint32_t ns3::WifiMode::GetUid | ( | ) | const |
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 168 of file wifi-mode.cc.
References m_uid.
Referenced by ns3::operator!=(), ns3::operator<(), and ns3::operator==().
const std::string & ns3::WifiMode::GetUniqueName | ( | ) | const |
Definition at line 137 of file wifi-mode.cc.
References ns3::WifiModeFactory::Get(), ns3::WifiModeFactory::GetFactory(), m_uid, and ns3::WifiModeFactory::WifiModeItem::uniqueUid.
Referenced by ns3::IdealWifiManager::AddSnrThreshold(), ns3::IdealWifiManager::BuildSnrThresholds(), ns3::IdealWifiManager::DoGetDataTxVector(), ns3::IdealWifiManager::DoReportDataOk(), ns3::ThompsonSamplingWifiManager::DoReportDataOk(), ns3::IdealWifiManager::DoReportRtsOk(), ns3::ThompsonSamplingWifiManager::DoReportRtsOk(), ns3::DsssPhy::GetDataRateFromTxVector(), ns3::ErpOfdmPhy::GetDataRateFromTxVector(), ns3::OfdmPhy::GetDataRateFromTxVector(), ns3::ErpOfdmPhy::GetPhyRateFromTxVector(), ns3::OfdmPhy::GetPhyRateFromTxVector(), ns3::ApWifiMac::GetSupportedRates(), ns3::WifiTxVector::IsValid(), and ns3::operator<<().
bool ns3::WifiMode::IsAllowed | ( | const WifiTxVector & | txVector | ) | const |
txVector | the const WifiTxVector& of the signal |
Definition at line 67 of file wifi-mode.cc.
References ns3::WifiModeFactory::Get(), ns3::WifiModeFactory::GetFactory(), ns3::WifiModeFactory::WifiModeItem::IsAllowedCallback, and m_uid.
bool ns3::WifiMode::IsAllowed | ( | MHz_u | channelWidth, |
uint8_t | nss ) const |
channelWidth | the considered channel width |
nss | the considered number of streams |
Definition at line 57 of file wifi-mode.cc.
References WifiMode(), IsAllowed(), m_uid, ns3::WifiTxVector::SetChannelWidth(), ns3::WifiTxVector::SetMode(), and ns3::WifiTxVector::SetNss().
Referenced by ns3::IdealWifiManager::BuildSnrThresholds(), and IsAllowed().
bool ns3::WifiMode::IsHigherCodeRate | ( | WifiMode | mode | ) | const |
mode | the WifiMode |
Definition at line 190 of file wifi-mode.cc.
References GetCodeRate(), NS_ASSERT_MSG, and ns3::WIFI_CODE_RATE_UNDEFINED.
Referenced by IsHigherDataRate().
bool ns3::WifiMode::IsHigherDataRate | ( | WifiMode | mode | ) | const |
mode | the WifiMode |
Definition at line 197 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().
bool ns3::WifiMode::IsMandatory | ( | ) | const |
Definition at line 145 of file wifi-mode.cc.
References ns3::WifiModeFactory::Get(), ns3::WifiModeFactory::GetFactory(), ns3::WifiModeFactory::WifiModeItem::isMandatory, and m_uid.
|
friend |
allow WifiModeFactory class access
Definition at line 181 of file wifi-mode.h.
|
private |
UID.
Definition at line 188 of file wifi-mode.h.
Referenced by GetCodeRate(), GetConstellationSize(), GetDataRate(), GetDataRate(), GetMcsValue(), GetModulationClass(), GetNonHtReferenceRate(), GetPhyRate(), GetPhyRate(), GetUid(), GetUniqueName(), IsAllowed(), IsAllowed(), and IsMandatory().