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 (WifiTxVector txVector) 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 (WifiTxVector txVector) 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... | |
class | WifiPhyTag |
allow WifiPhyTag class access More... | |
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 97 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 666 of file wifi-mode.cc.
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 676 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 671 of file wifi-mode.cc.
WifiCodeRate ns3::WifiMode::GetCodeRate | ( | void | ) | const |
Definition at line 324 of file wifi-mode.cc.
References ns3::WifiModeFactory::WifiModeItem::codingRate, ns3::WifiModeFactory::Get(), ns3::WifiModeFactory::GetFactory(), m_uid, ns3::WifiModeFactory::WifiModeItem::mcsValue, ns3::WifiModeFactory::WifiModeItem::modClass, 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_HE, ns3::WIFI_MOD_CLASS_HT, and ns3::WIFI_MOD_CLASS_VHT.
Referenced by ns3::NistErrorRateModel::GetChunkSuccessRate(), ns3::YansErrorRateModel::GetChunkSuccessRate(), GetDataRate(), GetNonHtReferenceRate(), GetPhyRate(), and IsHigherCodeRate().
uint16_t ns3::WifiMode::GetConstellationSize | ( | void | ) | const |
Definition at line 400 of file wifi-mode.cc.
References ns3::WifiModeFactory::WifiModeItem::constellationSize, ns3::WifiModeFactory::Get(), ns3::WifiModeFactory::GetFactory(), m_uid, ns3::WifiModeFactory::WifiModeItem::mcsValue, ns3::WifiModeFactory::WifiModeItem::modClass, NS_ASSERT, ns3::WIFI_MOD_CLASS_HE, ns3::WIFI_MOD_CLASS_HT, and ns3::WIFI_MOD_CLASS_VHT.
Referenced by ns3::NistErrorRateModel::GetChunkSuccessRate(), ns3::YansErrorRateModel::GetChunkSuccessRate(), GetDataRate(), GetNonHtReferenceRate(), and IsHigherDataRate().
uint64_t ns3::WifiMode::GetDataRate | ( | uint16_t | channelWidth, |
uint16_t | guardInterval, | ||
uint8_t | nss | ||
) | const |
channelWidth | the considered channel width in MHz |
guardInterval | the considered guard interval duration in nanoseconds |
nss | the considered number of streams |
Definition at line 150 of file wifi-mode.cc.
References ns3::WifiModeFactory::Get(), GetCodeRate(), GetConstellationSize(), ns3::WifiModeFactory::GetFactory(), IsAllowed(), 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_HE, ns3::WIFI_MOD_CLASS_HR_DSSS, ns3::WIFI_MOD_CLASS_HT, ns3::WIFI_MOD_CLASS_OFDM, and ns3::WIFI_MOD_CLASS_VHT.
Referenced by ns3::InterferenceHelper::CalculateChunkSuccessRate(), ns3::ParfWifiManager::CheckInit(), ns3::AparfWifiManager::CheckInit(), ns3::RrpaaWifiManager::CheckInit(), TxDurationTest::CheckPayloadDuration(), ns3::MeshWifiInterfaceMac::CheckSupportedRates(), TxDurationTest::CheckTxDuration(), ns3::AarfWifiManager::DoGetDataTxVector(), ns3::CaraWifiManager::DoGetDataTxVector(), ns3::AmrrWifiManager::DoGetDataTxVector(), ns3::OnoeWifiManager::DoGetDataTxVector(), ns3::ParfWifiManager::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::NistErrorRateModel::GetChunkSuccessRate(), ns3::YansErrorRateModel::GetChunkSuccessRate(), GetDataRate(), ns3::WaveMacLow::GetDataTxVector(), ns3::MinstrelWifiManager::GetDataTxVector(), ns3::RegularWifiMac::GetHtCapabilities(), ns3::ApWifiMac::GetHtOperation(), ns3::WifiPhy::GetPayloadDuration(), GetPhyRate(), ns3::WifiPhy::GetPlcpHeaderDuration(), ns3::WifiPhy::GetPlcpPreambleDuration(), ns3::WifiPhyHelper::GetRadiotapHeader(), ns3::MeshWifiInterfaceMac::GetSupportedRates(), ns3::StaWifiMac::GetSupportedRates(), ns3::ApWifiMac::GetSupportedRates(), ns3::RegularWifiMac::GetVhtCapabilities(), ns3::ApWifiMac::Receive(), ns3::MeshWifiInterfaceMac::Receive(), ns3::MacLow::SendDataPacket(), ns3::WifiPhy::SendPacket(), NodeStatistics::SetupPhy(), ns3::WifiPhy::StartReceivePreamble(), PowerRateAdaptationTest::TestAparf(), PowerRateAdaptationTest::TestParf(), PowerRateAdaptationTest::TestRrpaa(), ns3::StaWifiMac::UpdateApInfoFromAssocResp(), ns3::StaWifiMac::UpdateApInfoFromBeacon(), and ns3::StaWifiMac::UpdateApInfoFromProbeResp().
uint64_t ns3::WifiMode::GetDataRate | ( | WifiTxVector | txVector | ) | const |
txVector | the WifiTxVector of the signal |
Definition at line 144 of file wifi-mode.cc.
References ns3::WifiTxVector::GetChannelWidth(), GetDataRate(), ns3::WifiTxVector::GetGuardInterval(), and ns3::WifiTxVector::GetNss().
uint64_t ns3::WifiMode::GetDataRate | ( | uint16_t | channelWidth | ) | const |
channelWidth | the considered channel width in MHz |
Definition at line 138 of file wifi-mode.cc.
References GetDataRate().
uint8_t ns3::WifiMode::GetMcsValue | ( | void | ) | const |
Definition at line 472 of file wifi-mode.cc.
References ns3::WifiModeFactory::Get(), ns3::WifiModeFactory::GetFactory(), m_uid, ns3::WifiModeFactory::WifiModeItem::mcsValue, ns3::WifiModeFactory::WifiModeItem::modClass, NS_ASSERT, ns3::WIFI_MOD_CLASS_HE, ns3::WIFI_MOD_CLASS_HT, and ns3::WIFI_MOD_CLASS_VHT.
Referenced by ns3::WifiRemoteStationManager::AddBasicMcs(), ns3::WifiRemoteStationManager::AddStationHtCapabilities(), ns3::WifiRemoteStationManager::AddStationVhtCapabilities(), ns3::IdealWifiManager::DoGetDataTxVector(), ns3::IdealWifiManager::DoInitialize(), ns3::RegularWifiMac::GetHeCapabilities(), ns3::RegularWifiMac::GetHtCapabilities(), ns3::ApWifiMac::GetHtOperation(), ns3::WifiPhy::GetPayloadDuration(), ns3::WifiPhyHelper::GetRadiotapHeader(), ns3::RegularWifiMac::GetVhtCapabilities(), ns3::MinstrelHtWifiManager::RateInit(), ns3::ApWifiMac::Receive(), TestAmpduReception::SendAmpduWithThreeMpdus(), TestThresholdPreambleDetectionWithoutFrameCapture::SendPacket(), ns3::WifiPhy::SendPacket(), TestThresholdPreambleDetectionWithFrameCapture::SendPacket(), TestSimpleFrameCaptureModel::SendPacket(), TestPhyHeadersReception::SendPacket(), ns3::WifiPhy::StartReceivePreamble(), ns3::StaWifiMac::UpdateApInfoFromAssocResp(), and ns3::StaWifiMac::UpdateApInfoFromBeacon().
WifiModulationClass ns3::WifiMode::GetModulationClass | ( | ) | const |
Definition at line 494 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::AddStationHeCapabilities(), ns3::WifiRemoteStationManager::AddStationHtCapabilities(), ns3::WifiRemoteStationManager::AddStationVhtCapabilities(), ns3::InterferenceHelper::CalculateChunkSuccessRate(), TxDurationTest::CheckPayloadDuration(), TxDurationTest::CheckTxDuration(), ns3::ConvertGuardIntervalToNanoSeconds(), ns3::WifiRemoteStationManager::DoGetCtsToSelfTxVector(), ns3::ConstantRateWifiManager::DoGetDataTxVector(), ns3::AarfWifiManager::DoGetDataTxVector(), ns3::CaraWifiManager::DoGetDataTxVector(), ns3::AmrrWifiManager::DoGetDataTxVector(), ns3::OnoeWifiManager::DoGetDataTxVector(), ns3::ParfWifiManager::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::CaraWifiManager::DoGetRtsTxVector(), ns3::AmrrWifiManager::DoGetRtsTxVector(), ns3::OnoeWifiManager::DoGetRtsTxVector(), ns3::ParfWifiManager::DoGetRtsTxVector(), ns3::ArfWifiManager::DoGetRtsTxVector(), ns3::IdealWifiManager::DoGetRtsTxVector(), ns3::AarfcdWifiManager::DoGetRtsTxVector(), ns3::AparfWifiManager::DoGetRtsTxVector(), ns3::RraaWifiManager::DoGetRtsTxVector(), ns3::RrpaaWifiManager::DoGetRtsTxVector(), ns3::MinstrelHtWifiManager::DoGetRtsTxVector(), ns3::IdealWifiManager::DoInitialize(), ns3::MacLow::GetAckDuration(), ns3::IdealWifiManager::GetChannelWidthForMode(), ns3::GetChannelWidthForTransmission(), ns3::NistErrorRateModel::GetChunkSuccessRate(), ns3::YansErrorRateModel::GetChunkSuccessRate(), ns3::MacLow::GetControlAnswerMode(), ns3::MacLow::GetCtsDuration(), ns3::MinstrelWifiManager::GetDataTxVector(), ns3::WifiRemoteStationManager::GetDataTxVector(), ns3::RegularWifiMac::GetHeCapabilities(), ns3::RegularWifiMac::GetHtCapabilities(), ns3::MinstrelHtWifiManager::GetHtDeviceMcsList(), ns3::ApWifiMac::GetHtOperation(), ns3::MpduAggregator::GetNextAmpdu(), ns3::MsduAggregator::GetNextAmsdu(), ns3::WifiPhy::GetPayloadDuration(), ns3::WifiPhy::GetPlcpHeaderDuration(), ns3::WifiPhy::GetPlcpHeaderMode(), ns3::WifiPhy::GetPlcpPreambleDuration(), ns3::WifiPhyHelper::GetRadiotapHeader(), ns3::MinstrelWifiManager::GetRtsTxVector(), ns3::WifiRemoteStationManager::GetRtsTxVector(), ns3::ApWifiMac::GetSupportedRates(), ns3::RegularWifiMac::GetVhtCapabilities(), ns3::MinstrelHtWifiManager::GetVhtDeviceMcsList(), IsHigherDataRate(), ns3::MacLow::IsWithinSizeAndTimeLimits(), SpectrumWifiPhyBasicTest::MakeSignal(), WifiPhyThresholdsTest::MakeWifiSignal(), ns3::WifiRemoteStationManager::NeedCtsToSelf(), ns3::WifiRemoteStationManager::NeedRts(), ns3::MinstrelHtWifiManager::RateInit(), ns3::ApWifiMac::Receive(), TestAmpduReception::SendAmpduWithThreeMpdus(), TestThresholdPreambleDetectionWithoutFrameCapture::SendPacket(), ns3::WifiPhy::SendPacket(), TestThresholdPreambleDetectionWithFrameCapture::SendPacket(), TestSimpleFrameCaptureModel::SendPacket(), TestPhyHeadersReception::SendPacket(), ns3::WifiPhy::StartReceiveHeader(), ns3::WifiPhy::StartReceivePayload(), ns3::WifiPhy::StartReceivePreamble(), ns3::MacLow::StartTransmission(), ns3::SpectrumWifiPhy::StartTx(), ns3::StaWifiMac::UpdateApInfoFromAssocResp(), ns3::StaWifiMac::UpdateApInfoFromBeacon(), and ns3::StaWifiMac::UpdateApInfoFromProbeResp().
uint64_t ns3::WifiMode::GetNonHtReferenceRate | ( | void | ) | 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 501 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_HE, ns3::WIFI_MOD_CLASS_HT, and ns3::WIFI_MOD_CLASS_VHT.
Referenced by ns3::MinstrelHtWifiManager::DoGetRtsTxVector().
uint64_t ns3::WifiMode::GetPhyRate | ( | uint16_t | channelWidth, |
uint16_t | guardInterval, | ||
uint8_t | nss | ||
) | const |
channelWidth | the considered channel width in MHz |
guardInterval | the considered guard interval duration in nanoseconds |
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 103 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::YansErrorRateModel::GetChunkSuccessRate(), and GetPhyRate().
uint64_t ns3::WifiMode::GetPhyRate | ( | WifiTxVector | txVector | ) | const |
txVector | the WifiTxVector of the 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 132 of file wifi-mode.cc.
References ns3::WifiTxVector::GetChannelWidth(), ns3::WifiTxVector::GetGuardInterval(), ns3::WifiTxVector::GetNss(), and GetPhyRate().
uint32_t ns3::WifiMode::GetUid | ( | void | ) | 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 488 of file wifi-mode.cc.
References m_uid.
Referenced by ns3::operator<(), and ns3::operator==().
std::string ns3::WifiMode::GetUniqueName | ( | void | ) | const |
Definition at line 457 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::DoGetDataTxVector(), ns3::IdealWifiManager::DoInitialize(), ns3::IdealWifiManager::DoReportDataOk(), ns3::IdealWifiManager::DoReportRtsOk(), ns3::IdealWifiManager::GetSnrThreshold(), ns3::ApWifiMac::GetSupportedRates(), ns3::QosTxop::GotBlockAck(), ns3::WifiTxVector::IsValid(), ns3::BlockAckManager::NotifyGotBlockAck(), ns3::operator<<(), and ns3::WaveNetDevice::RegisterTxProfile().
bool ns3::WifiMode::IsAllowed | ( | uint16_t | channelWidth, |
uint8_t | nss | ||
) | const |
channelWidth | the considered channel width in MHz |
nss | the considered number of streams |
Definition at line 85 of file wifi-mode.cc.
References ns3::WifiModeFactory::Get(), ns3::WifiModeFactory::GetFactory(), m_uid, ns3::WifiModeFactory::WifiModeItem::mcsValue, ns3::WifiModeFactory::WifiModeItem::modClass, and ns3::WIFI_MOD_CLASS_VHT.
Referenced by ns3::IdealWifiManager::DoInitialize(), GetDataRate(), and ns3::RegularWifiMac::GetVhtCapabilities().
bool ns3::WifiMode::IsHigherCodeRate | ( | WifiMode | mode | ) | const |
mode | wifi mode |
Definition at line 589 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::MacLow::GetControlAnswerMode(), and IsHigherDataRate().
bool ns3::WifiMode::IsHigherDataRate | ( | WifiMode | mode | ) | const |
mode | wifi mode |
Definition at line 609 of file wifi-mode.cc.
References ns3::WifiModeFactory::Get(), GetConstellationSize(), ns3::WifiModeFactory::GetFactory(), GetModulationClass(), IsHigherCodeRate(), m_uid, ns3::WifiModeFactory::WifiModeItem::modClass, NS_FATAL_ERROR, ns3::WIFI_MOD_CLASS_DSSS, ns3::WIFI_MOD_CLASS_ERP_OFDM, ns3::WIFI_MOD_CLASS_HE, ns3::WIFI_MOD_CLASS_HR_DSSS, ns3::WIFI_MOD_CLASS_HT, ns3::WIFI_MOD_CLASS_OFDM, and ns3::WIFI_MOD_CLASS_VHT.
Referenced by ns3::MacLow::GetControlAnswerMode().
bool ns3::WifiMode::IsMandatory | ( | void | ) | const |
Definition at line 465 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::MacLow::GetControlAnswerMode(), ns3::ApWifiMac::GetSupportedRates(), and ns3::WifiRemoteStationManager::SetupPhy().
|
friend |
allow WifiModeFactory class access
Definition at line 226 of file wifi-mode.h.
|
friend |
allow WifiPhyTag class access
Definition at line 228 of file wifi-mode.h.
|
private |
UID.
Definition at line 235 of file wifi-mode.h.
Referenced by GetCodeRate(), GetConstellationSize(), GetDataRate(), GetMcsValue(), GetModulationClass(), GetNonHtReferenceRate(), GetUid(), GetUniqueName(), IsAllowed(), IsHigherDataRate(), and IsMandatory().