wifi: Channel width coded on 1 byte

This commit is contained in:
Sébastien Deronne
2016-12-31 20:23:09 +01:00
parent 585df8fc46
commit 1ca4ac42b3
19 changed files with 99 additions and 100 deletions

View File

@@ -242,10 +242,10 @@ ApWifiMac::IsNonGfHtStasPresent (void) const
return false;
}
uint32_t
uint8_t
ApWifiMac::GetVhtOperationalChannelWidth (void) const
{
uint32_t channelWidth = m_phy->GetChannelWidth ();
uint8_t channelWidth = m_phy->GetChannelWidth ();
for (std::list<Mac48Address>::const_iterator i = m_staList.begin (); i != m_staList.end (); i++)
{
if (m_stationManager->GetVhtSupported (*i))
@@ -528,7 +528,7 @@ ApWifiMac::GetVhtOperation (void) const
operation.SetVhtSupported (1);
if (m_vhtSupported)
{
uint32_t channelWidth = GetVhtOperationalChannelWidth ();
uint8_t channelWidth = GetVhtOperationalChannelWidth ();
if (channelWidth == 160)
{
operation.SetChannelWidth (2);

View File

@@ -120,7 +120,7 @@ public:
/**
* Determine the VHT operational channel width.
*/
uint32_t GetVhtOperationalChannelWidth (void) const;
uint8_t GetVhtOperationalChannelWidth (void) const;
/**
* Assign a fixed random variable stream number to the random variables

View File

@@ -78,7 +78,7 @@ IdealWifiManager::SetupPhy (Ptr<WifiPhy> phy)
WifiRemoteStationManager::SetupPhy (phy);
}
uint32_t
uint8_t
IdealWifiManager::GetChannelWidthForMode (WifiMode mode) const
{
NS_ASSERT (mode.GetModulationClass () != WIFI_MOD_CLASS_HT);
@@ -110,7 +110,7 @@ IdealWifiManager::DoInitialize ()
txVector.SetNss (nss);
txVector.SetMode (mode);
NS_LOG_DEBUG ("Initialize, adding mode = " << mode.GetUniqueName () <<
" channel width " << txVector.GetChannelWidth () <<
" channel width " << (uint16_t) txVector.GetChannelWidth () <<
" nss " << (uint16_t) nss <<
" short GI " << GetPhy ()->GetGuardInterval ());
AddSnrThreshold (txVector, GetPhy ()->CalculateSnr (txVector, m_ber));
@@ -133,7 +133,7 @@ IdealWifiManager::DoInitialize ()
nss = GetPhy ()->GetMaxSupportedTxSpatialStreams ();
}
NS_LOG_DEBUG ("Initialize, adding mode = " << mode.GetUniqueName () <<
" channel width " << GetPhy ()->GetChannelWidth () <<
" channel width " << (uint16_t) GetPhy ()->GetChannelWidth () <<
" nss " << (uint16_t) nss <<
" short GI " << GetPhy ()->GetGuardInterval ());
NS_LOG_DEBUG ("In SetupPhy, adding mode = " << mode.GetUniqueName ());
@@ -152,10 +152,10 @@ IdealWifiManager::GetSnrThreshold (WifiTxVector txVector) const
{
NS_LOG_DEBUG ("Checking " << i->second.GetMode ().GetUniqueName () <<
" nss " << (uint16_t) i->second.GetNss () <<
" width " << i->second.GetChannelWidth ());
" width " << (uint16_t) i->second.GetChannelWidth ());
NS_LOG_DEBUG ("against TxVector " << txVector.GetMode ().GetUniqueName () <<
" nss " << (uint16_t) txVector.GetNss () <<
" width " << txVector.GetChannelWidth ());
" width " << (uint16_t) txVector.GetChannelWidth ());
if (txVector.GetMode () == i->second.GetMode () &&
txVector.GetNss () == i->second.GetNss () &&
txVector.IsShortGuardInterval () == i->second.IsShortGuardInterval () &&
@@ -298,8 +298,8 @@ IdealWifiManager::DoGetDataTxVector (WifiRemoteStation *st)
if (WifiPhy::IsValidTxVector (txVector) == false)
{
NS_LOG_DEBUG ("Skipping mode " << mode.GetUniqueName () <<
" nss " << nss << " width " <<
txVector.GetChannelWidth());
" nss " << nss << " width " <<
(uint16_t) txVector.GetChannelWidth());
continue;
}
double threshold = GetSnrThreshold (txVector);
@@ -360,8 +360,8 @@ IdealWifiManager::DoGetDataTxVector (WifiRemoteStation *st)
station->m_lastMode = maxMode;
station->m_nss = nss;
}
uint32_t channelWidth = GetChannelWidth (station);
NS_LOG_DEBUG ("Found maxMode: " << maxMode << " channelWidth: " << channelWidth);
uint8_t channelWidth = GetChannelWidth (station);
NS_LOG_DEBUG ("Found maxMode: " << maxMode << " channelWidth: " << (uint16_t) channelWidth);
if (m_currentRate != maxMode.GetDataRate (channelWidth, GetPhy ()->GetGuardInterval (), nss))
{
NS_LOG_DEBUG ("New datarate: " << maxMode.GetDataRate (channelWidth, GetPhy ()->GetGuardInterval (), nss));

View File

@@ -93,7 +93,7 @@ private:
* \param non-(V)HT WifiMode
* \return the channel width (MHz) for the selected mode
*/
uint32_t GetChannelWidthForMode (WifiMode mode) const;
uint8_t GetChannelWidthForMode (WifiMode mode) const;
/**
* A vector of <snr, WifiTxVector> pair holding the minimum SNR for the

View File

@@ -233,7 +233,7 @@ InterferenceHelper::AppendEvent (Ptr<InterferenceHelper::Event> event)
double
InterferenceHelper::CalculateSnr (double signal, double noiseInterference, uint32_t channelWidth) const
InterferenceHelper::CalculateSnr (double signal, double noiseInterference, uint8_t channelWidth) const
{
//thermal noise at 290K in J/s = W
static const double BOLTZMANN = 1.3803e-23;
@@ -243,7 +243,7 @@ InterferenceHelper::CalculateSnr (double signal, double noiseInterference, uint3
double noiseFloor = m_noiseFigure * Nt;
double noise = noiseFloor + noiseInterference;
double snr = signal / noise; //linear scale
NS_LOG_DEBUG ("bandwidth(MHz)=" << channelWidth << ", signal(W)= " << signal << ", noise(W)=" << noiseFloor << ", interference(W)=" << noiseInterference << ", snr(linear)=" << snr);
NS_LOG_DEBUG ("bandwidth(MHz)=" << (uint16_t)channelWidth << ", signal(W)= " << signal << ", noise(W)=" << noiseFloor << ", interference(W)=" << noiseInterference << ", snr(linear)=" << snr);
return snr;
}

View File

@@ -281,7 +281,7 @@ private:
*
* \return SNR in liear ratio
*/
double CalculateSnr (double signal, double noiseInterference, uint32_t channelWidth) const;
double CalculateSnr (double signal, double noiseInterference, uint8_t channelWidth) const;
/**
* Calculate the success rate of the chunk given the SINR, duration, and Wi-Fi mode.
* The duration and mode are used to calculate how many bits are present in the chunk.

View File

@@ -221,7 +221,7 @@ MinstrelHtWifiManager::DoInitialize ()
m_minstrelGroups = MinstrelMcsGroups (m_numGroups);
// Initialize all HT groups
for (uint32_t chWidth = 20; chWidth <= MAX_HT_WIDTH; chWidth *= 2)
for (uint8_t chWidth = 20; chWidth <= MAX_HT_WIDTH; chWidth *= 2)
{
for (uint8_t sgi = 0; sgi <= 1; sgi++)
{
@@ -251,7 +251,7 @@ MinstrelHtWifiManager::DoInitialize ()
AddFirstMpduTxTime (groupId, mode, CalculateFirstMpduTxDuration (GetPhy (), streams, sgi, chWidth, mode));
AddMpduTxTime (groupId, mode, CalculateMpduTxDuration (GetPhy (), streams, sgi, chWidth, mode));
}
NS_LOG_DEBUG ("Initialized group " << groupId << ": (" << (uint32_t)streams << "," << (uint32_t)sgi << "," << chWidth << ")");
NS_LOG_DEBUG ("Initialized group " << groupId << ": (" << (uint16_t)streams << "," << (uint16_t)sgi << "," << (uint16_t)chWidth << ")");
}
}
}
@@ -260,7 +260,7 @@ MinstrelHtWifiManager::DoInitialize ()
if (HasVhtSupported ())
{
// Initialize all VHT groups
for (uint32_t chWidth = 20; chWidth <= MAX_VHT_WIDTH; chWidth *= 2)
for (uint8_t chWidth = 20; chWidth <= MAX_VHT_WIDTH; chWidth *= 2)
{
for (uint8_t sgi = 0; sgi <= 1; sgi++)
{
@@ -293,7 +293,7 @@ MinstrelHtWifiManager::DoInitialize ()
AddMpduTxTime (groupId, mode, CalculateMpduTxDuration (GetPhy (), streams, sgi, chWidth, mode));
}
}
NS_LOG_DEBUG ("Initialized group " << groupId << ": (" << (uint32_t)streams << "," << (uint32_t)sgi << "," << chWidth << ")");
NS_LOG_DEBUG ("Initialized group " << groupId << ": (" << (uint16_t)streams << "," << (uint16_t)sgi << "," << (uint16_t)chWidth << ")");
}
}
}
@@ -311,9 +311,9 @@ MinstrelHtWifiManager::SetupMac (Ptr<WifiMac> mac)
}
bool
MinstrelHtWifiManager::IsValidMcs (Ptr<WifiPhy> phy, uint8_t streams, uint32_t chWidth, WifiMode mode)
MinstrelHtWifiManager::IsValidMcs (Ptr<WifiPhy> phy, uint8_t streams, uint8_t chWidth, WifiMode mode)
{
NS_LOG_FUNCTION (this << phy << (int)streams << chWidth << mode);
NS_LOG_FUNCTION (this << phy << (uint16_t)streams << (uint16_t)chWidth << mode);
WifiTxVector txvector;
txvector.SetNss (streams);
@@ -323,9 +323,9 @@ MinstrelHtWifiManager::IsValidMcs (Ptr<WifiPhy> phy, uint8_t streams, uint32_t c
}
Time
MinstrelHtWifiManager::CalculateFirstMpduTxDuration (Ptr<WifiPhy> phy, uint8_t streams, uint8_t sgi, uint32_t chWidth, WifiMode mode)
MinstrelHtWifiManager::CalculateFirstMpduTxDuration (Ptr<WifiPhy> phy, uint8_t streams, uint8_t sgi, uint8_t chWidth, WifiMode mode)
{
NS_LOG_FUNCTION (this << phy << (int)streams << (int)sgi << chWidth << mode);
NS_LOG_FUNCTION (this << phy << (uint16_t)streams << (uint16_t)sgi << (uint16_t)chWidth << mode);
WifiTxVector txvector;
txvector.SetNss (streams);
@@ -339,9 +339,9 @@ MinstrelHtWifiManager::CalculateFirstMpduTxDuration (Ptr<WifiPhy> phy, uint8_t s
}
Time
MinstrelHtWifiManager::CalculateMpduTxDuration (Ptr<WifiPhy> phy, uint8_t streams, uint8_t sgi, uint32_t chWidth, WifiMode mode)
MinstrelHtWifiManager::CalculateMpduTxDuration (Ptr<WifiPhy> phy, uint8_t streams, uint8_t sgi, uint8_t chWidth, WifiMode mode)
{
NS_LOG_FUNCTION (this << phy << (int)streams << (int)sgi << chWidth << mode);
NS_LOG_FUNCTION (this << phy << (uint16_t)streams << (uint16_t)sgi << (uint16_t)chWidth << mode);
WifiTxVector txvector;
txvector.SetNss (streams);
@@ -1824,17 +1824,17 @@ MinstrelHtWifiManager::GetGroupId (uint32_t index)
}
uint32_t
MinstrelHtWifiManager::GetHtGroupId (uint8_t txstreams, uint8_t sgi, uint32_t chWidth)
MinstrelHtWifiManager::GetHtGroupId (uint8_t txstreams, uint8_t sgi, uint8_t chWidth)
{
NS_LOG_FUNCTION (this << (int)txstreams << (int)sgi << chWidth);
NS_LOG_FUNCTION (this << (uint16_t)txstreams << (uint16_t)sgi << (uint16_t)chWidth);
return MAX_SUPPORTED_STREAMS * 2 * (chWidth == 40 ? 1 : 0) + MAX_SUPPORTED_STREAMS * sgi + txstreams - 1;
}
uint32_t
MinstrelHtWifiManager::GetVhtGroupId (uint8_t txstreams, uint8_t sgi, uint32_t chWidth)
MinstrelHtWifiManager::GetVhtGroupId (uint8_t txstreams, uint8_t sgi, uint8_t chWidth)
{
NS_LOG_FUNCTION (this << (int)txstreams << (int)sgi << chWidth);
NS_LOG_FUNCTION (this << (uint16_t)txstreams << (uint16_t)sgi << (uint16_t)chWidth);
return MAX_HT_STREAM_GROUPS * MAX_SUPPORTED_STREAMS + MAX_SUPPORTED_STREAMS * 2 * (chWidth == 160 ? 3 : chWidth == 80 ? 2 : chWidth == 40 ? 1 : 0) + MAX_SUPPORTED_STREAMS * sgi + txstreams - 1;
}

View File

@@ -47,7 +47,7 @@ struct McsGroup
{
uint8_t streams;
uint8_t sgi;
uint32_t chWidth;
uint8_t chWidth;
bool isVht;
bool isSupported;
@@ -250,13 +250,13 @@ private:
virtual void DoDisposeStation (WifiRemoteStation *station);
/// Check the validity of a combination of number of streams, chWidth and mode.
bool IsValidMcs (Ptr<WifiPhy> phy, uint8_t streams, uint32_t chWidth, WifiMode mode);
bool IsValidMcs (Ptr<WifiPhy> phy, uint8_t streams, uint8_t chWidth, WifiMode mode);
/// Estimates the TxTime of a frame with a given mode and group (stream, guard interval and channel width).
Time CalculateMpduTxDuration (Ptr<WifiPhy> phy, uint8_t streams, uint8_t sgi, uint32_t chWidth, WifiMode mode);
Time CalculateMpduTxDuration (Ptr<WifiPhy> phy, uint8_t streams, uint8_t sgi, uint8_t chWidth, WifiMode mode);
/// Estimates the TxTime of a frame with a given mode and group (stream, guard interval and channel width).
Time CalculateFirstMpduTxDuration (Ptr<WifiPhy> phy, uint8_t streams, uint8_t sgi, uint32_t chWidth, WifiMode mode);
Time CalculateFirstMpduTxDuration (Ptr<WifiPhy> phy, uint8_t streams, uint8_t sgi, uint8_t chWidth, WifiMode mode);
/// Obtain the TXtime saved in the group information.
Time GetMpduTxTime (uint32_t groupId, WifiMode mode) const;
@@ -364,10 +364,10 @@ private:
uint32_t GetIndex (uint32_t groupId, uint32_t rateId);
/// Returns the groupId of a HT MCS with the given number of streams, if using sgi and the channel width used.
uint32_t GetHtGroupId (uint8_t txstreams, uint8_t sgi, uint32_t chWidth);
uint32_t GetHtGroupId (uint8_t txstreams, uint8_t sgi, uint8_t chWidth);
/// Returns the groupId of a VHT MCS with the given number of streams, if using sgi and the channel width used.
uint32_t GetVhtGroupId (uint8_t txstreams, uint8_t sgi, uint32_t chWidth);
uint32_t GetVhtGroupId (uint8_t txstreams, uint8_t sgi, uint8_t chWidth);
/// Returns the lowest global index of the rates supported by the station.
uint32_t GetLowestIndex (MinstrelHtWifiRemoteStation *station);

View File

@@ -106,7 +106,7 @@ SpectrumWifiPhy::GetRxSpectrumModel () const
}
else
{
NS_LOG_DEBUG ("Creating spectrum model from frequency/width pair of (" << GetFrequency () << ", " << GetChannelWidth () << ")");
NS_LOG_DEBUG ("Creating spectrum model from frequency/width pair of (" << GetFrequency () << ", " << (uint16_t)GetChannelWidth () << ")");
m_rxSpectrumModel = WifiSpectrumValueHelper::GetSpectrumModel (GetFrequency (), GetChannelWidth ());
}
}
@@ -228,9 +228,9 @@ SpectrumWifiPhy::CreateWifiSpectrumPhyInterface (Ptr<NetDevice> device)
}
Ptr<SpectrumValue>
SpectrumWifiPhy::GetTxPowerSpectralDensity (uint32_t centerFrequency, uint32_t channelWidth, double txPowerW) const
SpectrumWifiPhy::GetTxPowerSpectralDensity (uint32_t centerFrequency, uint8_t channelWidth, double txPowerW) const
{
NS_LOG_FUNCTION (centerFrequency << channelWidth << txPowerW);
NS_LOG_FUNCTION (centerFrequency << (uint16_t)channelWidth << txPowerW);
Ptr<SpectrumValue> v;
switch (GetStandard ())
{

View File

@@ -163,7 +163,7 @@ private:
* This is a helper function to create the right Tx PSD corresponding
* to the standard in use.
*/
Ptr<SpectrumValue> GetTxPowerSpectralDensity (uint32_t centerFrequency, uint32_t channelWidth, double txPowerW) const;
Ptr<SpectrumValue> GetTxPowerSpectralDensity (uint32_t centerFrequency, uint8_t channelWidth, double txPowerW) const;
Ptr<SpectrumChannel> m_channel; //!< SpectrumChannel that this SpectrumWifiPhy is connected to
std::vector<uint16_t> m_operationalChannelList; //!< List of possible channels

View File

@@ -69,7 +69,7 @@ std::istream & operator >> (std::istream &is, WifiMode &mode)
}
uint64_t
WifiMode::GetPhyRate (uint32_t channelWidth, bool isShortGuardInterval, uint8_t nss) const
WifiMode::GetPhyRate (uint8_t channelWidth, bool isShortGuardInterval, uint8_t nss) const
{
//TODO: nss > 4 not supported yet
NS_ASSERT (nss <= 4);
@@ -104,7 +104,7 @@ WifiMode::GetPhyRate (WifiTxVector txVector) const
}
uint64_t
WifiMode::GetDataRate (uint32_t channelWidth) const
WifiMode::GetDataRate (uint8_t channelWidth) const
{
return GetDataRate (channelWidth, false, 1);
}
@@ -116,7 +116,7 @@ WifiMode::GetDataRate (WifiTxVector txVector) const
}
uint64_t
WifiMode::GetDataRate (uint32_t channelWidth, bool isShortGuardInterval, uint8_t nss) const
WifiMode::GetDataRate (uint8_t channelWidth, bool isShortGuardInterval, uint8_t nss) const
{
//TODO: nss > 4 not supported yet
NS_ASSERT (nss <= 4);

View File

@@ -106,7 +106,7 @@ public:
* If a transmission mode uses 1/2 FEC, and if its
* data rate is 3.25Mbps, the phy rate is 6.5Mbps
*/
uint64_t GetPhyRate (uint32_t channelWidth, bool isShortGuardInterval, uint8_t nss) const;
uint64_t GetPhyRate (uint8_t channelWidth, bool isShortGuardInterval, uint8_t nss) const;
/**
* \param txVector the WifiTxVector of the signal
*
@@ -124,7 +124,7 @@ public:
*
* \returns the data bit rate of this signal.
*/
uint64_t GetDataRate (uint32_t channelWidth, bool isShortGuardInterval, uint8_t nss) const;
uint64_t GetDataRate (uint8_t channelWidth, bool isShortGuardInterval, uint8_t nss) const;
/**
* \param txVector the WifiTxVector of the signal
*
@@ -136,7 +136,7 @@ public:
*
* \returns the data bit rate of this non-HT or non-VHT signal.
*/
uint64_t GetDataRate (uint32_t channelWidth) const;
uint64_t GetDataRate (uint8_t channelWidth) const;
/**
* \returns the coding rate of this transmission mode

View File

@@ -168,7 +168,7 @@ WifiPhy::GetTypeId (void)
UintegerValue (20),
MakeUintegerAccessor (&WifiPhy::GetChannelWidth,
&WifiPhy::SetChannelWidth),
MakeUintegerChecker<uint32_t> ())
MakeUintegerChecker<uint8_t> ())
.AddAttribute ("ChannelNumber",
"If set to non-zero defined value, will control Frequency and ChannelWidth assignment",
UintegerValue (0),
@@ -972,9 +972,9 @@ WifiPhy::Configure80211ac (void)
}
bool
WifiPhy::DefineChannelNumber (uint16_t channelNumber, WifiPhyStandard standard, uint32_t frequency, uint32_t channelWidth)
WifiPhy::DefineChannelNumber (uint16_t channelNumber, WifiPhyStandard standard, uint32_t frequency, uint8_t channelWidth)
{
NS_LOG_FUNCTION (this << channelNumber << standard << frequency << channelWidth);
NS_LOG_FUNCTION (this << channelNumber << standard << frequency << (uint16_t)channelWidth);
ChannelNumberStandardPair p = std::make_pair (channelNumber, standard);
ChannelToFrequencyWidthMap::const_iterator it;
it = m_channelToFrequencyWidth.find (p);
@@ -989,9 +989,9 @@ WifiPhy::DefineChannelNumber (uint16_t channelNumber, WifiPhyStandard standard,
}
uint16_t
WifiPhy::FindChannelNumberForFrequencyWidth (uint32_t frequency, uint32_t width) const
WifiPhy::FindChannelNumberForFrequencyWidth (uint32_t frequency, uint8_t width) const
{
NS_LOG_FUNCTION (this << frequency << width);
NS_LOG_FUNCTION (this << frequency << (uint16_t)width);
bool found = false;
FrequencyWidthPair f = std::make_pair (frequency, width);
ChannelToFrequencyWidthMap::const_iterator it = m_channelToFrequencyWidth.begin ();
@@ -1025,9 +1025,8 @@ WifiPhy::ConfigureChannelForStandard (WifiPhyStandard standard)
if (GetFrequency () != 0)
{
// If Frequency is already set, then see whether a ChannelNumber can
// be found that matches Frequency and ChannelWidth. If so, configure
// the ChannelNumber to that channel number. If not, set
// ChannelNumber to zero.
// be found that matches Frequency and ChannelWidth. If so, configure
// the ChannelNumber to that channel number. If not, set ChannelNumber to zero.
NS_LOG_DEBUG ("Frequency set; checking whether a channel number corresponds");
uint32_t channelNumberSearched = FindChannelNumberForFrequencyWidth (GetFrequency (), GetChannelWidth ());
if (channelNumberSearched)
@@ -1060,7 +1059,7 @@ WifiPhy::ConfigureChannelForStandard (WifiPhyStandard standard)
}
else
{
NS_LOG_DEBUG ("Setting frequency to " << f.first << "; width to " << f.second);
NS_LOG_DEBUG ("Setting frequency to " << f.first << "; width to " << (uint16_t)f.second);
SetFrequency (f.first);
SetChannelWidth (f.second);
}
@@ -1191,14 +1190,14 @@ WifiPhy::GetFrequency (void) const
}
void
WifiPhy::SetChannelWidth (uint32_t channelwidth)
WifiPhy::SetChannelWidth (uint8_t channelwidth)
{
NS_ASSERT_MSG (channelwidth == 5 || channelwidth == 10 || channelwidth == 20 || channelwidth == 22 || channelwidth == 40 || channelwidth == 80 || channelwidth == 160, "wrong channel width value");
m_channelWidth = channelwidth;
AddSupportedChannelWidth (channelwidth);
}
uint32_t
uint8_t
WifiPhy::GetChannelWidth (void) const
{
return m_channelWidth;
@@ -1292,9 +1291,9 @@ WifiPhy::GetMembershipSelectorModes (uint32_t selector)
}
void
WifiPhy::AddSupportedChannelWidth (uint32_t width)
WifiPhy::AddSupportedChannelWidth (uint8_t width)
{
NS_LOG_FUNCTION (this << width);
NS_LOG_FUNCTION (this << (uint16_t)width);
for (std::vector<uint32_t>::size_type i = 0; i != m_supportedChannelWidthSet.size (); i++)
{
if (m_supportedChannelWidthSet[i] == width)
@@ -1302,11 +1301,11 @@ WifiPhy::AddSupportedChannelWidth (uint32_t width)
return;
}
}
NS_LOG_FUNCTION ("Adding " << width << " to supported channel width set");
NS_LOG_FUNCTION ("Adding " << (uint16_t)width << " to supported channel width set");
m_supportedChannelWidthSet.push_back (width);
}
std::vector<uint32_t>
std::vector<uint8_t>
WifiPhy::GetSupportedChannelWidthSet (void) const
{
return m_supportedChannelWidthSet;
@@ -1357,7 +1356,7 @@ WifiPhy::SetChannelNumber (uint16_t nch)
{
if (DoChannelSwitch (nch))
{
NS_LOG_DEBUG ("Setting frequency to " << f.first << "; width to " << f.second);
NS_LOG_DEBUG ("Setting frequency to " << f.first << "; width to " << (uint16_t)f.second);
m_channelCenterFrequency = f.first;
SetChannelWidth (f.second);
m_channelNumber = nch;
@@ -2055,7 +2054,7 @@ WifiPhy::GetPayloadDuration (uint32_t size, WifiTxVector txVector, double freque
}
//IEEE Std 802.11n, section 20.3.11, equation (20-32)
double numDataBitsPerSymbol = payloadMode.GetDataRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), txVector.GetNss ()) * symbolDuration.GetNanoSeconds () / 1e9;
double numDataBitsPerSymbol = payloadMode.GetDataRate (txVector) * symbolDuration.GetNanoSeconds () / 1e9;
double numSymbols;
if (mpdutype == MPDU_IN_AGGREGATE && preamble != WIFI_PREAMBLE_NONE)
@@ -3311,9 +3310,9 @@ WifiPhy::GetVhtMcs9 ()
bool
WifiPhy::IsValidTxVector (WifiTxVector txVector)
{
uint32_t chWidth = txVector.GetChannelWidth();
uint8_t chWidth = txVector.GetChannelWidth ();
uint8_t nss = txVector.GetNss();
std::string modeName = txVector.GetMode().GetUniqueName();
std::string modeName = txVector.GetMode ().GetUniqueName ();
if (chWidth == 20)
{

View File

@@ -619,7 +619,7 @@ public:
*
* \return true if the channel definition succeeded
*/
bool DefineChannelNumber (uint16_t channelNumber, WifiPhyStandard standard, uint32_t frequency, uint32_t channelWidth);
bool DefineChannelNumber (uint16_t channelNumber, WifiPhyStandard standard, uint32_t frequency, uint8_t channelWidth);
/**
* A pair of a ChannelNumber and WifiPhyStandard
@@ -628,7 +628,7 @@ public:
/**
* A pair of a center Frequency and a ChannelWidth
*/
typedef std::pair<uint32_t, uint32_t> FrequencyWidthPair;
typedef std::pair<uint32_t, uint8_t> FrequencyWidthPair;
/**
* Return the WifiChannel this WifiPhy is connected to.
@@ -1510,19 +1510,19 @@ public:
/**
* \return the channel width
*/
virtual uint32_t GetChannelWidth (void) const;
virtual uint8_t GetChannelWidth (void) const;
/**
* \param channelwidth channel width
*/
virtual void SetChannelWidth (uint32_t channelwidth);
virtual void SetChannelWidth (uint8_t channelwidth);
/**
* \param channelwidth channel width (in MHz) to support
*/
virtual void AddSupportedChannelWidth (uint32_t channelwidth);
virtual void AddSupportedChannelWidth (uint8_t channelwidth);
/**
* \return a vector containing the supported channel widths, values in MHz
*/
virtual std::vector<uint32_t> GetSupportedChannelWidthSet (void) const;
virtual std::vector<uint8_t> GetSupportedChannelWidthSet (void) const;
protected:
@@ -1658,7 +1658,7 @@ private:
* \param width The channel width to use
* \return the channel number if found, zero if not
*/
uint16_t FindChannelNumberForFrequencyWidth (uint32_t frequency, uint32_t width) const;
uint16_t FindChannelNumberForFrequencyWidth (uint32_t frequency, uint8_t width) const;
/**
* Lookup frequency/width pair for channelNumber/standard pair
* \param channelNumber The channel number to check
@@ -1788,7 +1788,7 @@ private:
uint32_t m_channelCenterFrequency; //!< Center frequency in MHz
uint32_t m_initialFrequency; //!< Store frequency until initialization
bool m_frequencyChannelNumberInitialized; //!< Store initialization state
uint32_t m_channelWidth; //!< Channel width
uint8_t m_channelWidth; //!< Channel width
double m_edThresholdW; //!< Energy detection threshold in watts
double m_ccaMode1ThresholdW; //!< Clear channel assessment (CCA) threshold in watts
@@ -1814,7 +1814,7 @@ private:
typedef std::map<ChannelNumberStandardPair,FrequencyWidthPair> ChannelToFrequencyWidthMap;
static ChannelToFrequencyWidthMap m_channelToFrequencyWidth;
std::vector<uint32_t> m_supportedChannelWidthSet; //!< Supported channel width
std::vector<uint8_t> m_supportedChannelWidthSet; //!< Supported channel width
uint16_t m_channelNumber; //!< Operating channel number
uint16_t m_initialChannelNumber; //!< Initial channel number

View File

@@ -1350,7 +1350,7 @@ WifiRemoteStationManager::DoGetCtsTxPowerLevel (Mac48Address address, WifiMode c
return m_defaultTxPowerLevel;
}
uint32_t
uint8_t
WifiRemoteStationManager::DoGetCtsTxChannelWidth (Mac48Address address, WifiMode ctsMode)
{
return m_wifiPhy->GetChannelWidth ();
@@ -1386,7 +1386,7 @@ WifiRemoteStationManager::DoGetAckTxPowerLevel (Mac48Address address, WifiMode a
return m_defaultTxPowerLevel;
}
uint32_t
uint8_t
WifiRemoteStationManager::DoGetAckTxChannelWidth (Mac48Address address, WifiMode ctsMode)
{
return m_wifiPhy->GetChannelWidth ();
@@ -1422,7 +1422,7 @@ WifiRemoteStationManager::DoGetBlockAckTxPowerLevel (Mac48Address address, WifiM
return m_defaultTxPowerLevel;
}
uint32_t
uint8_t
WifiRemoteStationManager::DoGetBlockAckTxChannelWidth (Mac48Address address, WifiMode ctsMode)
{
return m_wifiPhy->GetChannelWidth ();
@@ -1806,7 +1806,7 @@ WifiRemoteStationManager::GetAddress (const WifiRemoteStation *station) const
return station->m_state->m_address;
}
uint32_t
uint8_t
WifiRemoteStationManager::GetChannelWidth (const WifiRemoteStation *station) const
{
return station->m_state->m_channelWidth;
@@ -1911,7 +1911,7 @@ WifiRemoteStationManager::GetNNonErpSupported (const WifiRemoteStation *station)
return size;
}
uint32_t
uint8_t
WifiRemoteStationManager::GetChannelWidthSupported (Mac48Address address) const
{
return LookupState (address)->m_channelWidth;

View File

@@ -369,7 +369,7 @@ public:
*
* \return he channel width supported by the station
*/
uint32_t GetChannelWidthSupported (Mac48Address address) const;
uint8_t GetChannelWidthSupported (Mac48Address address) const;
/**
* Return whether the station supports VHT or not.
*
@@ -855,7 +855,7 @@ protected:
*
* \return the channel width (in MHz) supported by the station
*/
uint32_t GetChannelWidth (const WifiRemoteStation *station) const;
uint8_t GetChannelWidth (const WifiRemoteStation *station) const;
/**
* Return whether the given station supports short guard interval.
*
@@ -1054,17 +1054,17 @@ private:
*/
virtual uint8_t DoGetBlockAckTxPowerLevel (Mac48Address address, WifiMode blockAckMode);
virtual uint32_t DoGetCtsTxChannelWidth (Mac48Address address, WifiMode ctsMode);
virtual uint8_t DoGetCtsTxChannelWidth (Mac48Address address, WifiMode ctsMode);
virtual bool DoGetCtsTxGuardInterval (Mac48Address address, WifiMode ctsMode);
virtual uint8_t DoGetCtsTxNss (Mac48Address address, WifiMode ctsMode);
virtual uint8_t DoGetCtsTxNess (Mac48Address address, WifiMode ctsMode);
virtual bool DoGetCtsTxStbc (Mac48Address address, WifiMode ctsMode);
virtual uint32_t DoGetAckTxChannelWidth (Mac48Address address, WifiMode ctsMode);
virtual uint8_t DoGetAckTxChannelWidth (Mac48Address address, WifiMode ctsMode);
virtual bool DoGetAckTxGuardInterval (Mac48Address address, WifiMode ackMode);
virtual uint8_t DoGetAckTxNss (Mac48Address address, WifiMode ackMode);
virtual uint8_t DoGetAckTxNess (Mac48Address address, WifiMode ackMode);
virtual bool DoGetAckTxStbc (Mac48Address address, WifiMode ackMode);
virtual uint32_t DoGetBlockAckTxChannelWidth (Mac48Address address, WifiMode ctsMode);
virtual uint8_t DoGetBlockAckTxChannelWidth (Mac48Address address, WifiMode ctsMode);
virtual bool DoGetBlockAckTxGuardInterval (Mac48Address address, WifiMode blockAckMode);
virtual uint8_t DoGetBlockAckTxNss (Mac48Address address, WifiMode blockAckMode);
virtual uint8_t DoGetBlockAckTxNess (Mac48Address address, WifiMode blockAckMode);
@@ -1318,7 +1318,7 @@ struct WifiRemoteStationState
Mac48Address m_address; //!< Mac48Address of the remote station
WifiRemoteStationInfo m_info;
uint32_t m_channelWidth; //!< Channel width (in MHz) supported by the remote station
uint8_t m_channelWidth; //!< Channel width (in MHz) supported by the remote station
bool m_shortGuardInterval; //!< Flag if short guard interval is supported by the remote station
uint8_t m_streams; //!< Number of supported streams by the remote station
uint32_t m_ness; //!< Number of streams in beamforming of the remote station

View File

@@ -46,7 +46,7 @@ WifiTxVector::WifiTxVector (WifiMode mode,
uint8_t nTx,
uint8_t nss,
uint8_t ness,
uint32_t channelWidth,
uint8_t channelWidth,
bool aggregation,
bool stbc)
: m_mode (mode),
@@ -97,7 +97,7 @@ WifiTxVector::GetPreambleType (void) const
return m_preamble;
}
uint32_t
uint8_t
WifiTxVector::GetChannelWidth (void) const
{
return m_channelWidth;
@@ -166,7 +166,7 @@ WifiTxVector::SetPreambleType (WifiPreamble preamble)
}
void
WifiTxVector::SetChannelWidth (uint32_t channelWidth)
WifiTxVector::SetChannelWidth (uint8_t channelWidth)
{
m_channelWidth = channelWidth;
}
@@ -210,14 +210,14 @@ WifiTxVector::SetStbc (bool stbc)
std::ostream & operator << ( std::ostream &os, const WifiTxVector &v)
{
os << "mode: " << v.GetMode () <<
" txpwrlvl: " << (uint32_t)v.GetTxPowerLevel () <<
" retries: " << (uint32_t)v.GetRetries () <<
" txpwrlvl: " << (uint16_t)v.GetTxPowerLevel () <<
" retries: " << (uint16_t)v.GetRetries () <<
" preamble: " << v.GetPreambleType () <<
" channel width: " << v.GetChannelWidth () <<
" channel width: " << (uint16_t)v.GetChannelWidth () <<
" Short GI: " << v.IsShortGuardInterval () <<
" NTx: " << (uint32_t)v.GetNTx () <<
" Nss: " << (uint32_t)v.GetNss () <<
" Ness: " << (uint32_t)v.GetNess () <<
" NTx: " << (uint16_t)v.GetNTx () <<
" Nss: " << (uint16_t)v.GetNss () <<
" Ness: " << (uint16_t)v.GetNess () <<
" MPDU aggregation: " << v.IsAggregation () <<
" STBC: " << v.IsStbc ();
return os;

View File

@@ -85,7 +85,7 @@ public:
uint8_t nTx,
uint8_t nss,
uint8_t ness,
uint32_t channelWidth,
uint8_t channelWidth,
bool aggregation,
bool stbc);
/**
@@ -131,13 +131,13 @@ public:
/**
* \returns the channel width (in MHz)
*/
uint32_t GetChannelWidth (void) const;
uint8_t GetChannelWidth (void) const;
/**
* Sets the selected channelWidth (in MHz)
*
* \param channelWidth
*/
void SetChannelWidth (uint32_t channelWidth);
void SetChannelWidth (uint8_t channelWidth);
/**
* \returns if ShortGuardInterval is used or not
*/
@@ -215,7 +215,7 @@ private:
uint8_t m_retries; /**< The DATA_RETRIES/RTS_RETRIES parameter
for Click radiotap information */
WifiPreamble m_preamble; /** preamble */
uint32_t m_channelWidth; /**< channel width in MHz */
uint8_t m_channelWidth; /**< channel width in MHz */
bool m_shortGuardInterval; /**< true if short GI is going to be used */
uint8_t m_nTx; /**< number of TX antennas */
uint8_t m_nss; /**< number of spatial streams */

View File

@@ -66,7 +66,7 @@ SpectrumWifiPhyBasicTest::SpectrumWifiPhyBasicTest (std::string name)
Ptr<SpectrumSignalParameters>
SpectrumWifiPhyBasicTest::MakeSignal (double txPowerWatts)
{
WifiTxVector txVector = WifiTxVector (WifiPhy::GetOfdmRate6Mbps (), 0, 0, WIFI_PREAMBLE_LONG, false, 1, 1, 0, 20000000, false, false);
WifiTxVector txVector = WifiTxVector (WifiPhy::GetOfdmRate6Mbps (), 0, 0, WIFI_PREAMBLE_LONG, false, 1, 1, 0, 20, false, false);
MpduType mpdutype = NORMAL_MPDU;
Ptr<Packet> pkt = Create<Packet> (1000);