Class that keeps track of all information about the current PHY operating channel. More...
#include "wifi-phy-operating-channel.h"
Public Types | |
typedef std::set< FrequencyChannelInfo >::const_iterator | ConstIterator |
Typedef for a const iterator pointing to a channel in the set of available channels. More... | |
Public Member Functions | |
WifiPhyOperatingChannel () | |
Create an uninitialized PHY operating channel. More... | |
WifiPhyOperatingChannel (ConstIterator it) | |
Create a PHY operating channel from an iterator pointing to a channel in the set of available channels. More... | |
virtual | ~WifiPhyOperatingChannel () |
std::set< uint8_t > | GetAll20MHzChannelIndicesInPrimary (uint16_t width) const |
Get the channel indices of all the 20 MHz channels included in the primary channel of the given width, if such primary channel exists, or an empty set, otherwise. More... | |
std::set< uint8_t > | GetAll20MHzChannelIndicesInSecondary (const std::set< uint8_t > &primaryIndices) const |
Get the channel indices of all the 20 MHz channels included in the secondary channel corresponding to the given primary channel, if such secondary channel exists, or an empty set, otherwise. More... | |
std::set< uint8_t > | GetAll20MHzChannelIndicesInSecondary (uint16_t width) const |
Get the channel indices of all the 20 MHz channels included in the secondary channel of the given width, if such secondary channel exists, or an empty set, otherwise. More... | |
uint16_t | GetFrequency () const |
Return the center frequency of the operating channel (in MHz). More... | |
uint8_t | GetNumber () const |
Return the channel number identifying the whole operating channel. More... | |
WifiPhyBand | GetPhyBand () const |
Return the PHY band of the operating channel. More... | |
uint16_t | GetPrimaryChannelCenterFrequency (uint16_t primaryChannelWidth) const |
Get the center frequency of the primary channel of the given width. More... | |
uint8_t | GetPrimaryChannelIndex (uint16_t primaryChannelWidth) const |
If the operating channel width is a multiple of 20 MHz, return the index of the primary channel of the given width within the operating channel (0 indicates the 20 MHz subchannel with the lowest center frequency). More... | |
uint8_t | GetPrimaryChannelNumber (uint16_t primaryChannelWidth, WifiStandard standard) const |
Get channel number of the primary channel. More... | |
uint16_t | GetSecondaryChannelCenterFrequency (uint16_t secondaryChannelWidth) const |
Get the center frequency of the secondary channel of the given width. More... | |
uint8_t | GetSecondaryChannelIndex (uint16_t secondaryChannelWidth) const |
If the operating channel width is made of a multiple of 20 MHz, return the index of the secondary channel of the given width within the operating channel (0 indicates the 20 MHz subchannel with the lowest center frequency). More... | |
uint16_t | GetWidth () const |
Return the width of the whole operating channel (in MHz). More... | |
bool | Is80211p () const |
Return whether the operating channel is an 802.11p channel. More... | |
bool | IsDsss () const |
Return whether the operating channel is a DSSS channel. More... | |
bool | IsOfdm () const |
Return whether the operating channel is an OFDM channel. More... | |
bool | IsSet () const |
Return true if a valid channel has been set, false otherwise. More... | |
void | Set (uint8_t number, uint16_t frequency, uint16_t width, WifiStandard standard, WifiPhyBand band) |
Set the channel according to the specified parameters if a unique frequency channel matches the specified criteria, or abort the simulation otherwise. More... | |
void | SetDefault (uint16_t width, WifiStandard standard, WifiPhyBand band) |
Set the default channel of the given width and for the given standard and band. More... | |
void | SetPrimary20Index (uint8_t index) |
Set the index of the primary 20 MHz channel (0 indicates the 20 MHz subchannel with the lowest center frequency). More... | |
Static Public Member Functions | |
static ConstIterator | FindFirst (uint8_t number, uint16_t frequency, uint16_t width, WifiStandard standard, WifiPhyBand band, ConstIterator start=m_frequencyChannels.begin()) |
Find the first channel matching the specified parameters. More... | |
static uint8_t | GetDefaultChannelNumber (uint16_t width, WifiStandard standard, WifiPhyBand band) |
Get the default channel number of the given width and for the given standard and band. More... | |
Static Public Attributes | |
static const std::set< FrequencyChannelInfo > | m_frequencyChannels |
Available frequency channels. More... | |
Private Attributes | |
ConstIterator | m_channelIt |
const iterator pointing to the configured frequency channel More... | |
uint8_t | m_primary20Index |
index of the primary20 channel (0 indicates the 20 MHz subchannel with the lowest center frequency) More... | |
Class that keeps track of all information about the current PHY operating channel.
Definition at line 44 of file wifi-phy-operating-channel.h.
typedef std::set<FrequencyChannelInfo>::const_iterator ns3::WifiPhyOperatingChannel::ConstIterator |
Typedef for a const iterator pointing to a channel in the set of available channels.
Definition at line 48 of file wifi-phy-operating-channel.h.
ns3::WifiPhyOperatingChannel::WifiPhyOperatingChannel | ( | ) |
Create an uninitialized PHY operating channel.
Definition at line 268 of file wifi-phy-operating-channel.cc.
ns3::WifiPhyOperatingChannel::WifiPhyOperatingChannel | ( | ConstIterator | it | ) |
Create a PHY operating channel from an iterator pointing to a channel in the set of available channels.
it | the iterator pointing to a channel in the set of available channels |
Definition at line 273 of file wifi-phy-operating-channel.cc.
References NS_LOG_FUNCTION.
|
virtual |
Definition at line 280 of file wifi-phy-operating-channel.cc.
References NS_LOG_FUNCTION_NOARGS.
|
static |
Find the first channel matching the specified parameters.
number | the channel number (use 0 to leave it unspecified) |
frequency | the channel center frequency in MHz (use 0 to leave it unspecified) |
width | the channel width in MHz (use 0 to leave it unspecified) |
standard | the standard (use WIFI_STANDARD_UNSPECIFIED not to check whether a channel is suitable for a specific standard) |
band | the PHY band |
start | an iterator pointing to the channel to start the search with |
Definition at line 344 of file wifi-phy-operating-channel.cc.
References third::channel, ns3::GetFrequencyChannelType(), ns3::GetMaximumChannelWidth(), m_frequencyChannels, visualizer.core::start(), ns3::WIFI_STANDARD_UNSPECIFIED, and ns3::wifiStandards.
Referenced by GetDefaultChannelNumber(), GetPrimaryChannelNumber(), and Set().
std::set< uint8_t > ns3::WifiPhyOperatingChannel::GetAll20MHzChannelIndicesInPrimary | ( | uint16_t | width | ) | const |
Get the channel indices of all the 20 MHz channels included in the primary channel of the given width, if such primary channel exists, or an empty set, otherwise.
width | the width in MHz of the primary channel |
Definition at line 518 of file wifi-phy-operating-channel.cc.
References GetAll20MHzChannelIndicesInSecondary(), GetWidth(), and m_primary20Index.
Referenced by GetAll20MHzChannelIndicesInSecondary(), ns3::HePhy::GetPer20MHzDurations(), ns3::HePhy::GetTxPowerSpectralDensity(), and Wifi20MHzChannelIndicesTest::RunOne().
std::set< uint8_t > ns3::WifiPhyOperatingChannel::GetAll20MHzChannelIndicesInSecondary | ( | const std::set< uint8_t > & | primaryIndices | ) | const |
Get the channel indices of all the 20 MHz channels included in the secondary channel corresponding to the given primary channel, if such secondary channel exists, or an empty set, otherwise.
primaryIndices | the channel indices of all the 20 MHz channels included in the primary channel |
Definition at line 546 of file wifi-phy-operating-channel.cc.
References GetWidth().
std::set< uint8_t > ns3::WifiPhyOperatingChannel::GetAll20MHzChannelIndicesInSecondary | ( | uint16_t | width | ) | const |
Get the channel indices of all the 20 MHz channels included in the secondary channel of the given width, if such secondary channel exists, or an empty set, otherwise.
width | the width in MHz of the secondary channel |
Definition at line 540 of file wifi-phy-operating-channel.cc.
References GetAll20MHzChannelIndicesInPrimary(), and GetAll20MHzChannelIndicesInSecondary().
Referenced by GetAll20MHzChannelIndicesInPrimary(), GetAll20MHzChannelIndicesInSecondary(), and Wifi20MHzChannelIndicesTest::RunOne().
|
static |
Get the default channel number of the given width and for the given standard and band.
width | the channel width in MHz |
standard | the standard |
band | the PHY band |
Definition at line 326 of file wifi-phy-operating-channel.cc.
References FindFirst(), and m_frequencyChannels.
Referenced by ns3::WifiPhy::DoChannelSwitch(), and SetDefault().
uint16_t ns3::WifiPhyOperatingChannel::GetFrequency | ( | ) | const |
Return the center frequency of the operating channel (in MHz).
Definition at line 400 of file wifi-phy-operating-channel.cc.
References IsSet(), m_channelIt, and NS_ASSERT.
Referenced by MultiLinkSetupTest::CheckMlSetup(), ns3::WifiPhy::GetFrequency(), and GetPrimaryChannelCenterFrequency().
uint8_t ns3::WifiPhyOperatingChannel::GetNumber | ( | ) | const |
Return the channel number identifying the whole operating channel.
Definition at line 393 of file wifi-phy-operating-channel.cc.
References IsSet(), m_channelIt, and NS_ASSERT.
Referenced by MultiLinkSetupTest::CheckMlSetup(), and ns3::WifiPhy::GetChannelNumber().
WifiPhyBand ns3::WifiPhyOperatingChannel::GetPhyBand | ( | ) | const |
Return the PHY band of the operating channel.
Definition at line 414 of file wifi-phy-operating-channel.cc.
References IsSet(), m_channelIt, and NS_ASSERT.
Referenced by MultiLinkSetupTest::CheckMlSetup().
uint16_t ns3::WifiPhyOperatingChannel::GetPrimaryChannelCenterFrequency | ( | uint16_t | primaryChannelWidth | ) | const |
Get the center frequency of the primary channel of the given width.
primaryChannelWidth | the width of the primary channel in MHz |
Definition at line 489 of file wifi-phy-operating-channel.cc.
References GetFrequency(), GetPrimaryChannelIndex(), GetWidth(), and NS_LOG_FUNCTION.
Referenced by ns3::PhyEntity::BuildPpdu(), ns3::EhtPhy::BuildPpdu(), ns3::HePhy::BuildPpdu(), ns3::HtPhy::BuildPpdu(), ns3::DsssPhy::BuildPpdu(), ns3::ErpOfdmPhy::BuildPpdu(), ns3::OfdmPhy::BuildPpdu(), ns3::VhtPhy::BuildPpdu(), ns3::HtPhy::GetCcaIndication(), ns3::VhtPhy::GetCcaIndication(), ns3::PhyEntity::GetCenterFrequencyForChannelWidth(), GetPrimaryChannelNumber(), GetSecondaryChannelCenterFrequency(), and ns3::SpectrumWifiPhy::StartRx().
uint8_t ns3::WifiPhyOperatingChannel::GetPrimaryChannelIndex | ( | uint16_t | primaryChannelWidth | ) | const |
If the operating channel width is a multiple of 20 MHz, return the index of the primary channel of the given width within the operating channel (0 indicates the 20 MHz subchannel with the lowest center frequency).
Otherwise, return 0.
primaryChannelWidth | the width of the primary channel in MHz |
Definition at line 442 of file wifi-phy-operating-channel.cc.
References GetWidth(), m_primary20Index, NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, and NS_LOG_LOGIC.
Referenced by ns3::EhtPhy::BuildPpdu(), ns3::HePhy::BuildPpdu(), MultiLinkSetupTest::CheckMlSetup(), ns3::HePhy::GetCenterFrequencyForNonOfdmaPart(), ns3::HePhy::GetNonOfdmaBand(), ns3::WifiPhy::GetPrimary20Index(), ns3::PhyEntity::GetPrimaryBand(), GetPrimaryChannelCenterFrequency(), ns3::HePhy::GetRuBandForRx(), GetSecondaryChannelCenterFrequency(), GetSecondaryChannelIndex(), ns3::HePhy::GetTxPowerSpectralDensity(), and ns3::SpectrumWifiPhy::UpdateInterferenceHelperBands().
uint8_t ns3::WifiPhyOperatingChannel::GetPrimaryChannelNumber | ( | uint16_t | primaryChannelWidth, |
WifiStandard | standard | ||
) | const |
Get channel number of the primary channel.
primaryChannelWidth | the width of the primary channel (MHz) |
standard | the standard |
Definition at line 508 of file wifi-phy-operating-channel.cc.
References FindFirst(), GetPrimaryChannelCenterFrequency(), and m_channelIt.
Referenced by ns3::WifiPhy::GetPrimaryChannelNumber().
uint16_t ns3::WifiPhyOperatingChannel::GetSecondaryChannelCenterFrequency | ( | uint16_t | secondaryChannelWidth | ) | const |
Get the center frequency of the secondary channel of the given width.
secondaryChannelWidth | the width of the secondary channel in MHz |
Definition at line 499 of file wifi-phy-operating-channel.cc.
References GetPrimaryChannelCenterFrequency(), and GetPrimaryChannelIndex().
Referenced by ns3::HtPhy::GetCcaIndication(), and ns3::VhtPhy::GetCcaIndication().
uint8_t ns3::WifiPhyOperatingChannel::GetSecondaryChannelIndex | ( | uint16_t | secondaryChannelWidth | ) | const |
If the operating channel width is made of a multiple of 20 MHz, return the index of the secondary channel of the given width within the operating channel (0 indicates the 20 MHz subchannel with the lowest center frequency).
Otherwise, return 0.
secondaryChannelWidth | the width of the secondary channel in MHz |
Definition at line 469 of file wifi-phy-operating-channel.cc.
References GetPrimaryChannelIndex(), NS_LOG_FUNCTION, and NS_LOG_LOGIC.
Referenced by ns3::PhyEntity::GetSecondaryBand().
uint16_t ns3::WifiPhyOperatingChannel::GetWidth | ( | ) | const |
Return the width of the whole operating channel (in MHz).
Definition at line 407 of file wifi-phy-operating-channel.cc.
References IsSet(), m_channelIt, and NS_ASSERT.
Referenced by MultiLinkSetupTest::CheckMlSetup(), GetAll20MHzChannelIndicesInPrimary(), GetAll20MHzChannelIndicesInSecondary(), ns3::WifiPhy::GetChannelWidth(), GetPrimaryChannelCenterFrequency(), GetPrimaryChannelIndex(), and SetPrimary20Index().
bool ns3::WifiPhyOperatingChannel::Is80211p | ( | ) | const |
Return whether the operating channel is an 802.11p channel.
Definition at line 435 of file wifi-phy-operating-channel.cc.
References IsSet(), m_channelIt, NS_ASSERT, and ns3::WIFI_PHY_80211p_CHANNEL.
bool ns3::WifiPhyOperatingChannel::IsDsss | ( | ) | const |
Return whether the operating channel is a DSSS channel.
Definition at line 428 of file wifi-phy-operating-channel.cc.
References IsSet(), m_channelIt, NS_ASSERT, and ns3::WIFI_PHY_DSSS_CHANNEL.
bool ns3::WifiPhyOperatingChannel::IsOfdm | ( | ) | const |
Return whether the operating channel is an OFDM channel.
Definition at line 421 of file wifi-phy-operating-channel.cc.
References IsSet(), m_channelIt, NS_ASSERT, and ns3::WIFI_PHY_OFDM_CHANNEL.
Referenced by ns3::ChannelAccessManager::DoGrantDcfAccess(), and ns3::ChannelAccessManager::InitLastBusyStructs().
bool ns3::WifiPhyOperatingChannel::IsSet | ( | ) | const |
Return true if a valid channel has been set, false otherwise.
Definition at line 286 of file wifi-phy-operating-channel.cc.
References m_channelIt, and m_frequencyChannels.
Referenced by ns3::WifiPhy::ConfigureStandard(), SetChannelFrequencyTest::DoRun(), GetFrequency(), GetNumber(), GetPhyBand(), GetWidth(), Is80211p(), IsDsss(), and IsOfdm().
void ns3::WifiPhyOperatingChannel::Set | ( | uint8_t | number, |
uint16_t | frequency, | ||
uint16_t | width, | ||
WifiStandard | standard, | ||
WifiPhyBand | band | ||
) |
Set the channel according to the specified parameters if a unique frequency channel matches the specified criteria, or abort the simulation otherwise.
If the channel width is a multiple of 20 MHz, the primary 20 MHz channel is set to the 20 MHz subchannel with the lowest center frequency.
number | the channel number (use 0 to leave it unspecified) |
frequency | the channel center frequency in MHz (use 0 to leave it unspecified) |
width | the channel width in MHz (use 0 to leave it unspecified) |
standard | the standard |
band | the PHY band |
Definition at line 292 of file wifi-phy-operating-channel.cc.
References FindFirst(), m_channelIt, m_frequencyChannels, m_primary20Index, and NS_LOG_FUNCTION.
Referenced by ns3::WifiPhy::DoChannelSwitch(), and SetDefault().
void ns3::WifiPhyOperatingChannel::SetDefault | ( | uint16_t | width, |
WifiStandard | standard, | ||
WifiPhyBand | band | ||
) |
Set the default channel of the given width and for the given standard and band.
If the channel width is a multiple of 20 MHz, the primary 20 MHz channel is set to the 20 MHz subchannel with the lowest center frequency.
width | the channel width in MHz |
standard | the standard |
band | the PHY band |
Definition at line 318 of file wifi-phy-operating-channel.cc.
References GetDefaultChannelNumber(), NS_LOG_FUNCTION, and Set().
Referenced by Wifi20MHzChannelIndicesTest::DoRun().
void ns3::WifiPhyOperatingChannel::SetPrimary20Index | ( | uint8_t | index | ) |
Set the index of the primary 20 MHz channel (0 indicates the 20 MHz subchannel with the lowest center frequency).
index | the index of the primary 20 MHz channel |
Definition at line 480 of file wifi-phy-operating-channel.cc.
References GetWidth(), m_primary20Index, NS_ABORT_MSG_IF, and NS_LOG_FUNCTION.
Referenced by ns3::WifiPhy::DoChannelSwitch(), and Wifi20MHzChannelIndicesTest::RunOne().
|
private |
const iterator pointing to the configured frequency channel
Definition at line 267 of file wifi-phy-operating-channel.h.
Referenced by GetFrequency(), GetNumber(), GetPhyBand(), GetPrimaryChannelNumber(), GetWidth(), Is80211p(), IsDsss(), IsOfdm(), IsSet(), and Set().
|
static |
Available frequency channels.
Definition at line 66 of file wifi-phy-operating-channel.h.
Referenced by FindFirst(), GetDefaultChannelNumber(), ns3::ReducedNeighborReport::GetOperatingChannel(), IsSet(), and Set().
|
private |
index of the primary20 channel (0 indicates the 20 MHz subchannel with the lowest center frequency)
Definition at line 268 of file wifi-phy-operating-channel.h.
Referenced by GetAll20MHzChannelIndicesInPrimary(), GetPrimaryChannelIndex(), Set(), and SetPrimary20Index().