wifi: Switch to the new PHY methods to set the operating channel

This commit is contained in:
Stefano Avallone
2021-11-24 13:17:46 +01:00
parent 1c8cdac51c
commit bd7ebdd4cf
37 changed files with 368 additions and 406 deletions

View File

@@ -124,7 +124,7 @@ int main (int argc, char *argv[])
//Network A
ssid = Ssid ("network-A");
phy.Set ("ChannelNumber", UintegerValue (36));
phy.Set ("ChannelSettings", StringValue ("{36, 20, BAND_5GHZ, 0}"));
mac.SetType ("ns3::StaWifiMac",
"QosSupported", BooleanValue (true),
"Ssid", SsidValue (ssid));
@@ -138,7 +138,7 @@ int main (int argc, char *argv[])
//Network B
ssid = Ssid ("network-B");
phy.Set ("ChannelNumber", UintegerValue (40));
phy.Set ("ChannelSettings", StringValue ("{40, 20, BAND_5GHZ, 0}"));
mac.SetType ("ns3::StaWifiMac",
"QosSupported", BooleanValue (true),
"Ssid", SsidValue (ssid));
@@ -172,7 +172,7 @@ int main (int argc, char *argv[])
//Network C
ssid = Ssid ("network-C");
phy.Set ("ChannelNumber", UintegerValue (44));
phy.Set ("ChannelSettings", StringValue ("{44, 20, BAND_5GHZ, 0}"));
mac.SetType ("ns3::StaWifiMac",
"QosSupported", BooleanValue (true),
"Ssid", SsidValue (ssid));
@@ -196,7 +196,7 @@ int main (int argc, char *argv[])
//Network D
ssid = Ssid ("network-D");
phy.Set ("ChannelNumber", UintegerValue (48));
phy.Set ("ChannelSettings", StringValue ("{48, 20, BAND_5GHZ, 0}"));
mac.SetType ("ns3::StaWifiMac",
"QosSupported", BooleanValue (true),
"Ssid", SsidValue (ssid));

View File

@@ -141,6 +141,10 @@ int main (int argc, char *argv[])
phy.Set ("Antennas", UintegerValue (nStreams));
phy.Set ("MaxSupportedTxSpatialStreams", UintegerValue (nStreams));
phy.Set ("MaxSupportedRxSpatialStreams", UintegerValue (nStreams));
phy.Set ("ChannelSettings", StringValue (std::string ("{0, ")
+ (channelBonding ? "40, " : "20, ")
+ (frequency == 2.4 ? "BAND_2_4GHZ" : "BAND_5GHZ")
+ ", 0}"));
WifiMacHelper mac;
WifiHelper wifi;
@@ -186,12 +190,6 @@ int main (int argc, char *argv[])
NetDeviceContainer apDevice;
apDevice = wifi.Install (phy, mac, wifiApNode);
// Set channel width
if (channelBonding)
{
Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", UintegerValue (40));
}
// Set guard interval
Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/ShortGuardIntervalSupported", BooleanValue (shortGuardInterval));

View File

@@ -112,7 +112,7 @@ int main (int argc, char *argv[])
// Network A
ssid = Ssid ("network-A");
phy.Set ("ChannelNumber", UintegerValue (36));
phy.Set ("ChannelSettings", StringValue ("{36, 0, BAND_5GHZ, 0}"));
mac.SetType ("ns3::StaWifiMac",
"Ssid", SsidValue (ssid));
staDeviceA = wifi.Install (phy, mac, wifiStaNodes.Get (0));
@@ -124,7 +124,7 @@ int main (int argc, char *argv[])
// Network B
ssid = Ssid ("network-B");
phy.Set ("ChannelNumber", UintegerValue (40));
phy.Set ("ChannelSettings", StringValue ("{40, 0, BAND_5GHZ, 0}"));
mac.SetType ("ns3::StaWifiMac",
"Ssid", SsidValue (ssid));
@@ -147,7 +147,7 @@ int main (int argc, char *argv[])
// Network C
ssid = Ssid ("network-C");
phy.Set ("ChannelNumber", UintegerValue (44));
phy.Set ("ChannelSettings", StringValue ("{44, 0, BAND_5GHZ, 0}"));
mac.SetType ("ns3::StaWifiMac",
"Ssid", SsidValue (ssid));
@@ -172,7 +172,7 @@ int main (int argc, char *argv[])
// Network D
ssid = Ssid ("network-D");
phy.Set ("ChannelNumber", UintegerValue (48));
phy.Set ("ChannelSettings", StringValue ("{48, 0, BAND_5GHZ, 0}"));
mac.SetType ("ns3::StaWifiMac",
"Ssid", SsidValue (ssid));

View File

@@ -22,6 +22,8 @@
#include "ns3/config.h"
#include "ns3/uinteger.h"
#include "ns3/boolean.h"
#include "ns3/enum.h"
#include "ns3/tuple.h"
#include "ns3/log.h"
#include "ns3/yans-wifi-helper.h"
#include "ns3/ssid.h"
@@ -123,6 +125,7 @@ int main (int argc, char *argv[])
WifiMacHelper mac;
WifiHelper wifi;
Ssid ssid = Ssid ("ns3");
TupleValue<UintegerValue, UintegerValue, EnumValue, UintegerValue> channelValue;
wifi.SetStandard (ConvertStringToStandard (staVersion));
wifi.SetRemoteStationManager ("ns3::" + staRaa + "WifiManager");
@@ -132,11 +135,11 @@ int main (int argc, char *argv[])
"Ssid", SsidValue (ssid));
//Workaround needed as long as we do not fully support channel bonding
if (staVersion == "80211ac")
{
phy.Set ("ChannelWidth", UintegerValue (20));
phy.Set ("Frequency", UintegerValue (5180));
}
uint16_t width = (staVersion == "80211ac" ? 20 : 0);
auto standardIt = wifiStandards.find (ConvertStringToStandard (staVersion));
NS_ABORT_IF (standardIt == wifiStandards.end ());
channelValue.Set (WifiPhy::ChannelTuple {0, width, standardIt->second.phyBand, 0});
phy.Set ("ChannelSettings", channelValue);
NetDeviceContainer staDevice;
staDevice = wifi.Install (phy, mac, wifiStaNode);
@@ -149,11 +152,11 @@ int main (int argc, char *argv[])
"Ssid", SsidValue (ssid));
//Workaround needed as long as we do not fully support channel bonding
if (apVersion == "80211ac")
{
phy.Set ("ChannelWidth", UintegerValue (20));
phy.Set ("Frequency", UintegerValue (5180));
}
width = (apVersion == "80211ac" ? 20 : 0);
standardIt = wifiStandards.find (ConvertStringToStandard (apVersion));
NS_ABORT_IF (standardIt == wifiStandards.end ());
channelValue.Set (WifiPhy::ChannelTuple {0, width, standardIt->second.phyBand, 0});
phy.Set ("ChannelSettings", channelValue);
NetDeviceContainer apDevice;
apDevice = wifi.Install (phy, mac, wifiApNode);

View File

@@ -167,19 +167,23 @@ int main (int argc, char *argv[])
NetDeviceContainer apDevice, staDevices;
WifiMacHelper mac;
WifiHelper wifi;
std::string channelStr ("{0, " + std::to_string (channelWidth) + ", ");
if (frequency == 6)
{
wifi.SetStandard (WIFI_STANDARD_80211ax_6GHZ);
channelStr += "BAND_6GHZ, 0}";
Config::SetDefault ("ns3::LogDistancePropagationLossModel::ReferenceLoss", DoubleValue (48));
}
else if (frequency == 5)
{
wifi.SetStandard (WIFI_STANDARD_80211ax_5GHZ);
channelStr += "BAND_5GHZ, 0}";
}
else if (frequency == 2.4)
{
wifi.SetStandard (WIFI_STANDARD_80211ax_2_4GHZ);
channelStr += "BAND_2_4GHZ, 0}";
Config::SetDefault ("ns3::LogDistancePropagationLossModel::ReferenceLoss", DoubleValue (40));
}
else
@@ -210,7 +214,7 @@ int main (int argc, char *argv[])
mac.SetType ("ns3::StaWifiMac",
"Ssid", SsidValue (ssid));
phy.Set ("ChannelWidth", UintegerValue (channelWidth));
phy.Set ("ChannelSettings", StringValue (channelStr));
staDevices = wifi.Install (phy, mac, wifiStaNodes);
if (dlAckSeqType != "NO-OFDMA")
@@ -222,7 +226,6 @@ int main (int argc, char *argv[])
mac.SetType ("ns3::ApWifiMac",
"EnableBeaconJitter", BooleanValue (false),
"Ssid", SsidValue (ssid));
phy.Set ("ChannelWidth", UintegerValue (channelWidth));
apDevice = wifi.Install (phy, mac, wifiApNode);
}
else
@@ -234,13 +237,12 @@ int main (int argc, char *argv[])
mac.SetType ("ns3::StaWifiMac",
"Ssid", SsidValue (ssid));
phy.Set ("ChannelWidth", UintegerValue (channelWidth));
phy.Set ("ChannelSettings", StringValue (channelStr));
staDevices = wifi.Install (phy, mac, wifiStaNodes);
mac.SetType ("ns3::ApWifiMac",
"EnableBeaconJitter", BooleanValue (false),
"Ssid", SsidValue (ssid));
phy.Set ("ChannelWidth", UintegerValue (channelWidth));
apDevice = wifi.Install (phy, mac, wifiApNode);
}

View File

@@ -25,6 +25,8 @@
#include "ns3/boolean.h"
#include "ns3/double.h"
#include "ns3/string.h"
#include "ns3/enum.h"
#include "ns3/tuple.h"
#include "ns3/log.h"
#include "ns3/yans-wifi-helper.h"
#include "ns3/ssid.h"
@@ -128,6 +130,7 @@ int main (int argc, char *argv[])
WifiMacHelper mac;
WifiHelper wifi;
if (frequency == 5.0)
{
wifi.SetStandard (WIFI_STANDARD_80211n_5GHZ);
@@ -149,10 +152,13 @@ int main (int argc, char *argv[])
"ControlMode", StringValue (oss.str ()));
Ssid ssid = Ssid ("ns3-80211n");
TupleValue<UintegerValue, UintegerValue, EnumValue, UintegerValue> channelValue;
WifiPhyBand band = (frequency == 5.0 ? WIFI_PHY_BAND_5GHZ : WIFI_PHY_BAND_2_4GHZ);
channelValue.Set (WifiPhy::ChannelTuple {0, channelWidth, band, 0});
mac.SetType ("ns3::StaWifiMac",
"Ssid", SsidValue (ssid));
phy.Set ("ChannelWidth", UintegerValue (channelWidth));
phy.Set ("ChannelSettings", channelValue);
NetDeviceContainer staDevice;
staDevice = wifi.Install (phy, mac, wifiStaNode);
@@ -160,7 +166,6 @@ int main (int argc, char *argv[])
mac.SetType ("ns3::ApWifiMac",
"EnableBeaconJitter", BooleanValue (false),
"Ssid", SsidValue (ssid));
phy.Set ("ChannelWidth", UintegerValue (channelWidth));
NetDeviceContainer apDevice;
apDevice = wifi.Install (phy, mac, wifiApNode);

View File

@@ -76,7 +76,7 @@ int main (int argc, char *argv[])
WifiMacHelper mac;
WifiHelper wifi;
wifi.SetStandard (WIFI_STANDARD_80211n_5GHZ);
wifi.SetStandard (WIFI_STANDARD_80211n_2_4GHZ);
std::ostringstream oss;
oss << "HtMcs" << mcs;
@@ -100,7 +100,8 @@ int main (int argc, char *argv[])
apDevice = wifi.Install (phy, mac, wifiApNode);
// Set channel width
Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", UintegerValue (channelWidth));
Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelSettings",
StringValue ("{0, " + std::to_string (channelWidth) + ", BAND_2_4GHZ, 0}"));
// Set guard interval
Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/ShortGuardIntervalSupported", BooleanValue (useShortGuardInterval));

View File

@@ -98,6 +98,7 @@ int main (int argc, char *argv[])
YansWifiPhyHelper phy;
phy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11_RADIO);
phy.SetChannel (channel.Create ());
phy.Set ("ChannelSettings", StringValue ("{36, 0, BAND_5GHZ, 0}"));
WifiHelper wifi;
wifi.SetStandard (WIFI_STANDARD_80211n_5GHZ);

View File

@@ -384,11 +384,11 @@ int main (int argc, char *argv[])
{
mac.SetType ("ns3::StaWifiMac",
"Ssid", SsidValue (ssid));
phy.Set ("ChannelWidth", UintegerValue (i <= 15 ? 20 : 40));
phy.Set ("ChannelSettings", StringValue (std::string ("{0, ") + (i <= 15 ? "20" : "40")
+ ", BAND_5GHZ, 0}"));
staDevice = wifi.Install (phy, mac, wifiStaNode);
mac.SetType ("ns3::ApWifiMac",
"Ssid", SsidValue (ssid));
phy.Set ("ChannelWidth", UintegerValue (i <= 15 ? 20 : 40));
apDevice = wifi.Install (phy, mac, wifiApNode);
}
@@ -396,11 +396,11 @@ int main (int argc, char *argv[])
{
mac.SetType ("ns3::StaWifiMac",
"Ssid", SsidValue (ssid));
phy.Set ("ChannelWidth", UintegerValue (i <= 15 ? 20 : 40));
phy.Set ("ChannelSettings", StringValue (std::string ("{0, ") + (i <= 15 ? "20" : "40")
+ ", BAND_5GHZ, 0}"));
staDevice = wifi.Install (spectrumPhy, mac, wifiStaNode);
mac.SetType ("ns3::ApWifiMac",
"Ssid", SsidValue (ssid));
phy.Set ("ChannelWidth", UintegerValue (i <= 15 ? 20 : 40));
apDevice = wifi.Install (spectrumPhy, mac, wifiApNode);
}

View File

@@ -120,6 +120,7 @@ NS_LOG_COMPONENT_DEFINE ("WifiSpectrumPerInterference");
Ptr<SpectrumModel> SpectrumModelWifi5180MHz, SpectrumModelWifi5190MHz;
/** Initializer for a static spectrum model centered around 5180 MHz */
class static_SpectrumModelWifi5180MHz_initializer
{
public:
@@ -138,6 +139,7 @@ public:
} static_SpectrumModelWifi5180MHz_initializer_instance;
/** Initializer for a static spectrum model centered around 5190 MHz */
class static_SpectrumModelWifi5190MHz_initializer
{
public:
@@ -228,7 +230,8 @@ int main (int argc, char *argv[])
"Frequency", DoubleValue (frequency * 1e6));
channel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
phy.SetChannel (channel.Create ());
phy.Set ("Frequency", UintegerValue (frequency));
phy.Set ("ChannelSettings", StringValue (std::string ("{") + (frequency == 5180 ? "36" : "38")
+ ", 0, BAND_5GHZ, 0}"));
}
else if (wifiType == "ns3::SpectrumWifiPhy")
{
@@ -245,7 +248,10 @@ int main (int argc, char *argv[])
spectrumPhy.SetChannel (spectrumChannel);
spectrumPhy.SetErrorRateModel (errorModelType);
spectrumPhy.Set ("Frequency", UintegerValue (frequency)); // channel 36 at 20 MHz, 38 at 40 MHz
// channel 36 at 20 MHz, 38 at 40 MHz
spectrumPhy.Set ("ChannelSettings", StringValue (std::string ("{")
+ (frequency == 5180 ? "36" : "38")
+ ", 0, BAND_5GHZ, 0}"));
}
else
{

View File

@@ -563,16 +563,18 @@ int main (int argc, char *argv[])
NetDeviceContainer apDevice;
channelWidth = (i <= 15 || (i > 31 && i <= 47) ? 20 : 40);
std::string channelStr = "{0, " + std::to_string (channelWidth) + ", BAND_5GHZ, 0}";
if (wifiType == "ns3::YansWifiPhy")
{
mac.SetType ("ns3::StaWifiMac",
"Ssid", SsidValue (ssid));
phy.Set ("ChannelWidth", UintegerValue (channelWidth));
phy.Set ("ChannelSettings", StringValue (channelStr));
staDevice = wifi.Install (phy, mac, wifiStaNode);
mac.SetType ("ns3::ApWifiMac",
"Ssid", SsidValue (ssid));
phy.Set ("ChannelWidth", UintegerValue (channelWidth));
phy.Set ("ChannelSettings", StringValue (channelStr));
apDevice = wifi.Install (phy, mac, wifiApNode);
}
@@ -580,11 +582,11 @@ int main (int argc, char *argv[])
{
mac.SetType ("ns3::StaWifiMac",
"Ssid", SsidValue (ssid));
phy.Set ("ChannelWidth", UintegerValue (channelWidth));
phy.Set ("ChannelSettings", StringValue (channelStr));
staDevice = wifi.Install (spectrumPhy, mac, wifiStaNode);
mac.SetType ("ns3::ApWifiMac",
"Ssid", SsidValue (ssid));
phy.Set ("ChannelWidth", UintegerValue (channelWidth));
phy.Set ("ChannelSettings", StringValue (channelStr));
apDevice = wifi.Install (spectrumPhy, mac, wifiApNode);
}

View File

@@ -140,7 +140,7 @@ int main (int argc, char *argv[])
// Network A
ssid = Ssid ("network-A");
phy.Set ("ChannelNumber", UintegerValue (36));
phy.Set ("ChannelSettings", StringValue ("{36, 0, BAND_5GHZ, 0}"));
mac.SetType ("ns3::StaWifiMac",
"Ssid", SsidValue (ssid));
staDeviceA = wifi.Install (phy, mac, wifiStaNodes.Get (0));
@@ -165,7 +165,7 @@ int main (int argc, char *argv[])
// Network B
ssid = Ssid ("network-B");
phy.Set ("ChannelNumber", UintegerValue (40));
phy.Set ("ChannelSettings", StringValue ("{40, 0, BAND_5GHZ, 0}"));
mac.SetType ("ns3::StaWifiMac",
"Ssid", SsidValue (ssid));
@@ -197,7 +197,7 @@ int main (int argc, char *argv[])
// Network C
ssid = Ssid ("network-C");
phy.Set ("ChannelNumber", UintegerValue (44));
phy.Set ("ChannelSettings", StringValue ("{44, 0, BAND_5GHZ, 0}"));
mac.SetType ("ns3::StaWifiMac",
"Ssid", SsidValue (ssid));
@@ -231,7 +231,7 @@ int main (int argc, char *argv[])
// Network D
ssid = Ssid ("network-D");
phy.Set ("ChannelNumber", UintegerValue (48));
phy.Set ("ChannelSettings", StringValue ("{48, 0, BAND_5GHZ, 0}"));
mac.SetType ("ns3::StaWifiMac",
"Ssid", SsidValue (ssid));

View File

@@ -128,6 +128,9 @@ int main (int argc, char *argv[])
YansWifiPhyHelper phy;
phy.SetChannel (channel.Create ());
phy.Set ("ChannelSettings", StringValue ("{0, " + std::to_string (channelWidth)
+ ", BAND_5GHZ, 0}"));
WifiHelper wifi;
wifi.SetStandard (WIFI_STANDARD_80211ac);
WifiMacHelper mac;
@@ -141,7 +144,6 @@ int main (int argc, char *argv[])
mac.SetType ("ns3::StaWifiMac",
"Ssid", SsidValue (ssid));
phy.Set ("ChannelWidth", UintegerValue (channelWidth));
NetDeviceContainer staDevice;
staDevice = wifi.Install (phy, mac, wifiStaNode);
@@ -149,7 +151,6 @@ int main (int argc, char *argv[])
mac.SetType ("ns3::ApWifiMac",
"EnableBeaconJitter", BooleanValue (false),
"Ssid", SsidValue (ssid));
phy.Set ("ChannelWidth", UintegerValue (channelWidth));
NetDeviceContainer apDevice;
apDevice = wifi.Install (phy, mac, wifiApNode);

View File

@@ -210,7 +210,7 @@ MeshHelper::CreateInterface (const WifiPhyHelper &phyHelper, Ptr<Node> node, uin
ackManager->SetWifiMac (wifiMac);
fem->SetAckManager (ackManager);
}
phy->ConfigureStandardAndBand (it->second.phyStandard, it->second.phyBand);
phy->ConfigureStandard (it->second.phyStandard);
device->SetMac (mac);
device->SetPhy (phy);
device->SetRemoteStationManager (manager);

View File

@@ -197,7 +197,7 @@ MeshWifiInterfaceMac::SwitchFrequencyChannel (uint16_t new_id)
*
* Now we use dirty channel switch -- just change frequency
*/
m_phy->SetChannelNumber (new_id);
m_phy->SetOperatingChannel (WifiPhy::ChannelTuple {new_id, 0, m_phy->GetPhyBand (), 0});
// Don't know NAV on new channel
m_channelAccessManager->NotifyNavResetNow (Seconds (0));
}

View File

@@ -384,8 +384,9 @@ WaveHelper::Install (const WifiPhyHelper &phyHelper, const WifiMacHelper &macHe
for (uint32_t j = 0; j != m_physNumber; ++j)
{
Ptr<WifiPhy> phy = phyHelper.Create (node, device);
phy->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211p, WIFI_PHY_BAND_5GHZ);
phy->SetChannelNumber (ChannelManager::GetCch ());
phy->ConfigureStandard (WIFI_PHY_STANDARD_80211p);
phy->SetOperatingChannel (WifiPhy::ChannelTuple {ChannelManager::GetCch (), 0,
WIFI_PHY_BAND_5GHZ, 0});
device->AddPhy (phy);
}

View File

@@ -342,7 +342,7 @@ DefaultChannelScheduler::AssignDefaultCchAccess (void)
Ptr<OcbWifiMac> cchMacEntity = m_device->GetMac (CCH);
if (Now ().GetMilliSeconds() != 0)
{
m_phy->SetChannelNumber (CCH);
m_phy->SetOperatingChannel (WifiPhy::ChannelTuple {CCH, 0, WIFI_PHY_BAND_5GHZ, 0});
Time switchTime = m_phy->GetChannelSwitchDelay ();
cchMacEntity->MakeVirtualBusy (switchTime);
}
@@ -371,7 +371,7 @@ DefaultChannelScheduler::SwitchToNextChannel (uint32_t curChannelNumber, uint32_
// second unattached current MAC entity from single PHY device
curMacEntity->ResetWifiPhy ();
// third switch PHY device from current channel to next channel;
m_phy->SetChannelNumber (nextChannelNumber);
m_phy->SetOperatingChannel (WifiPhy::ChannelTuple {nextChannelNumber, 0, WIFI_PHY_BAND_5GHZ, 0});
// four attach next MAC entity to single PHY device
nextMacEntity->SetWifiPhy (m_phy);
// Here channel switch time is required to notify next MAC entity

View File

@@ -1173,7 +1173,6 @@ int main (int argc, char *argv[])
WifiHelper::EnableLogComponents ();
}
Config::SetDefault ("ns3::WifiPhy::ChannelWidth", UintegerValue (channelWidth));
std::stringstream phyModeStr;
phyModeStr << phyMode;
if (phyMode.find ("Mcs") != std::string::npos)
@@ -1251,6 +1250,11 @@ int main (int argc, char *argv[])
NS_FATAL_ERROR ("Unsupported standard: " << standard);
}
std::string channelStr = "{0, " + std::to_string (channelWidth) + ", BAND_"
+ (frequency == 2.4 ? "2_4" : (frequency == 5 ? "5" : "6"))
+ "GHZ, 0}";
Config::SetDefault ("ns3::WifiPhy::ChannelSettings", StringValue (channelStr));
YansWifiPhyHelper wifiPhy;
wifiPhy.DisablePreambleDetectionModel ();

View File

@@ -42,6 +42,8 @@
#include "ns3/uinteger.h"
#include "ns3/boolean.h"
#include "ns3/double.h"
#include "ns3/enum.h"
#include "ns3/tuple.h"
#include "ns3/gnuplot.h"
#include "ns3/command-line.h"
#include "ns3/yans-wifi-helper.h"
@@ -100,6 +102,7 @@ struct StandardInfo
*
* \param name reference name
* \param standard wifi standard
* \param band PHY band
* \param width channel width
* \param snrLow SNR low
* \param snrHigh SNR high
@@ -107,9 +110,10 @@ struct StandardInfo
* \param xMax x maximum
* \param yMax y maximum
*/
StandardInfo (std::string name, WifiStandard standard, uint16_t width, double snrLow, double snrHigh, double xMin, double xMax, double yMax)
StandardInfo (std::string name, WifiStandard standard, WifiPhyBand band, uint16_t width, double snrLow, double snrHigh, double xMin, double xMax, double yMax)
: m_name (name),
m_standard (standard),
m_band (band),
m_width (width),
m_snrLow (snrLow),
m_snrHigh (snrHigh),
@@ -120,6 +124,7 @@ struct StandardInfo
}
std::string m_name; ///< name
WifiStandard m_standard; ///< standard
WifiPhyBand m_band; ///< PHY band
uint16_t m_width; ///< channel width
double m_snrLow; ///< lowest SNR
double m_snrHigh; ///< highest SNR
@@ -288,29 +293,29 @@ int main (int argc, char *argv[])
// The first number is channel width, second is minimum SNR, third is maximum
// SNR, fourth and fifth provide xrange axis limits, and sixth the yaxis
// maximum
serverStandards.push_back (StandardInfo ("802.11a", WIFI_STANDARD_80211a, 20, 3, 27, 0, 30, 60));
serverStandards.push_back (StandardInfo ("802.11b", WIFI_STANDARD_80211b, 22, -5, 11, -6, 15, 15));
serverStandards.push_back (StandardInfo ("802.11g", WIFI_STANDARD_80211g, 20, -5, 27, -6, 30, 60));
serverStandards.push_back (StandardInfo ("802.11n-5GHz", WIFI_STANDARD_80211n_5GHZ, serverChannelWidth, 3, 30, 0, 35, 80 * channelRateFactor));
serverStandards.push_back (StandardInfo ("802.11n-2.4GHz", WIFI_STANDARD_80211n_2_4GHZ, serverChannelWidth, 3, 30, 0, 35, 80 * channelRateFactor));
serverStandards.push_back (StandardInfo ("802.11ac", WIFI_STANDARD_80211ac, serverChannelWidth, 5, 50, 0, 55, 120 * channelRateFactor));
serverStandards.push_back (StandardInfo ("802.11p-10MHz", WIFI_STANDARD_80211p, 10, 3, 27, 0, 30, 60));
serverStandards.push_back (StandardInfo ("802.11p-5MHz", WIFI_STANDARD_80211p, 5, 3, 27, 0, 30, 60));
serverStandards.push_back (StandardInfo ("802.11ax-6GHz", WIFI_STANDARD_80211ax_6GHZ, serverChannelWidth, 5, 55, 0, 60, 120 * channelRateFactor));
serverStandards.push_back (StandardInfo ("802.11ax-5GHz", WIFI_STANDARD_80211ax_5GHZ, serverChannelWidth, 5, 55, 0, 60, 120 * channelRateFactor));
serverStandards.push_back (StandardInfo ("802.11ax-2.4GHz", WIFI_STANDARD_80211ax_2_4GHZ, serverChannelWidth, 5, 55, 0, 60, 120 * channelRateFactor));
serverStandards.push_back (StandardInfo ("802.11a", WIFI_STANDARD_80211a, WIFI_PHY_BAND_5GHZ, 20, 3, 27, 0, 30, 60));
serverStandards.push_back (StandardInfo ("802.11b", WIFI_STANDARD_80211b, WIFI_PHY_BAND_2_4GHZ, 22, -5, 11, -6, 15, 15));
serverStandards.push_back (StandardInfo ("802.11g", WIFI_STANDARD_80211g, WIFI_PHY_BAND_2_4GHZ, 20, -5, 27, -6, 30, 60));
serverStandards.push_back (StandardInfo ("802.11n-5GHz", WIFI_STANDARD_80211n_5GHZ, WIFI_PHY_BAND_5GHZ, serverChannelWidth, 3, 30, 0, 35, 80 * channelRateFactor));
serverStandards.push_back (StandardInfo ("802.11n-2.4GHz", WIFI_STANDARD_80211n_2_4GHZ, WIFI_PHY_BAND_2_4GHZ, serverChannelWidth, 3, 30, 0, 35, 80 * channelRateFactor));
serverStandards.push_back (StandardInfo ("802.11ac", WIFI_STANDARD_80211ac, WIFI_PHY_BAND_5GHZ, serverChannelWidth, 5, 50, 0, 55, 120 * channelRateFactor));
serverStandards.push_back (StandardInfo ("802.11p-10MHz", WIFI_STANDARD_80211p, WIFI_PHY_BAND_5GHZ, 10, 3, 27, 0, 30, 60));
serverStandards.push_back (StandardInfo ("802.11p-5MHz", WIFI_STANDARD_80211p, WIFI_PHY_BAND_5GHZ, 5, 3, 27, 0, 30, 60));
serverStandards.push_back (StandardInfo ("802.11ax-6GHz", WIFI_STANDARD_80211ax_6GHZ, WIFI_PHY_BAND_6GHZ, serverChannelWidth, 5, 55, 0, 60, 120 * channelRateFactor));
serverStandards.push_back (StandardInfo ("802.11ax-5GHz", WIFI_STANDARD_80211ax_5GHZ, WIFI_PHY_BAND_5GHZ, serverChannelWidth, 5, 55, 0, 60, 120 * channelRateFactor));
serverStandards.push_back (StandardInfo ("802.11ax-2.4GHz", WIFI_STANDARD_80211ax_2_4GHZ, WIFI_PHY_BAND_2_4GHZ, serverChannelWidth, 5, 55, 0, 60, 120 * channelRateFactor));
clientStandards.push_back (StandardInfo ("802.11a", WIFI_STANDARD_80211a, 20, 3, 27, 0, 30, 60));
clientStandards.push_back (StandardInfo ("802.11b", WIFI_STANDARD_80211b, 22, -5, 11, -6, 15, 15));
clientStandards.push_back (StandardInfo ("802.11g", WIFI_STANDARD_80211g, 20, -5, 27, -6, 30, 60));
clientStandards.push_back (StandardInfo ("802.11n-5GHz", WIFI_STANDARD_80211n_5GHZ, clientChannelWidth, 3, 30, 0, 35, 80 * channelRateFactor));
clientStandards.push_back (StandardInfo ("802.11n-2.4GHz", WIFI_STANDARD_80211n_2_4GHZ, clientChannelWidth, 3, 30, 0, 35, 80 * channelRateFactor));
clientStandards.push_back (StandardInfo ("802.11ac", WIFI_STANDARD_80211ac, clientChannelWidth, 5, 50, 0, 55, 120 * channelRateFactor));
clientStandards.push_back (StandardInfo ("802.11p-10MHz", WIFI_STANDARD_80211p, 10, 3, 27, 0, 30, 60));
clientStandards.push_back (StandardInfo ("802.11p-5MHz", WIFI_STANDARD_80211p, 5, 3, 27, 0, 30, 60));
clientStandards.push_back (StandardInfo ("802.11ax-6GHz", WIFI_STANDARD_80211ax_6GHZ, clientChannelWidth, 5, 55, 0, 60, 160 * channelRateFactor));
clientStandards.push_back (StandardInfo ("802.11ax-5GHz", WIFI_STANDARD_80211ax_5GHZ, clientChannelWidth, 5, 55, 0, 60, 160 * channelRateFactor));
clientStandards.push_back (StandardInfo ("802.11ax-2.4GHz", WIFI_STANDARD_80211ax_2_4GHZ, clientChannelWidth, 5, 55, 0, 60, 160 * channelRateFactor));
clientStandards.push_back (StandardInfo ("802.11a", WIFI_STANDARD_80211a, WIFI_PHY_BAND_5GHZ, 20, 3, 27, 0, 30, 60));
clientStandards.push_back (StandardInfo ("802.11b", WIFI_STANDARD_80211b, WIFI_PHY_BAND_2_4GHZ, 22, -5, 11, -6, 15, 15));
clientStandards.push_back (StandardInfo ("802.11g", WIFI_STANDARD_80211g, WIFI_PHY_BAND_2_4GHZ, 20, -5, 27, -6, 30, 60));
clientStandards.push_back (StandardInfo ("802.11n-5GHz", WIFI_STANDARD_80211n_5GHZ, WIFI_PHY_BAND_5GHZ, clientChannelWidth, 3, 30, 0, 35, 80 * channelRateFactor));
clientStandards.push_back (StandardInfo ("802.11n-2.4GHz", WIFI_STANDARD_80211n_2_4GHZ, WIFI_PHY_BAND_2_4GHZ, clientChannelWidth, 3, 30, 0, 35, 80 * channelRateFactor));
clientStandards.push_back (StandardInfo ("802.11ac", WIFI_STANDARD_80211ac, WIFI_PHY_BAND_5GHZ, clientChannelWidth, 5, 50, 0, 55, 120 * channelRateFactor));
clientStandards.push_back (StandardInfo ("802.11p-10MHz", WIFI_STANDARD_80211p, WIFI_PHY_BAND_5GHZ, 10, 3, 27, 0, 30, 60));
clientStandards.push_back (StandardInfo ("802.11p-5MHz", WIFI_STANDARD_80211p, WIFI_PHY_BAND_5GHZ, 5, 3, 27, 0, 30, 60));
clientStandards.push_back (StandardInfo ("802.11ax-6GHz", WIFI_STANDARD_80211ax_6GHZ, WIFI_PHY_BAND_6GHZ, clientChannelWidth, 5, 55, 0, 60, 160 * channelRateFactor));
clientStandards.push_back (StandardInfo ("802.11ax-5GHz", WIFI_STANDARD_80211ax_5GHZ, WIFI_PHY_BAND_5GHZ, clientChannelWidth, 5, 55, 0, 60, 160 * channelRateFactor));
clientStandards.push_back (StandardInfo ("802.11ax-2.4GHz", WIFI_STANDARD_80211ax_2_4GHZ, WIFI_PHY_BAND_2_4GHZ, clientChannelWidth, 5, 55, 0, 60, 160 * channelRateFactor));
for (std::vector<StandardInfo>::size_type i = 0; i != serverStandards.size (); i++)
{
@@ -391,25 +396,35 @@ int main (int argc, char *argv[])
NetDeviceContainer serverDevice;
NetDeviceContainer clientDevice;
TupleValue<UintegerValue, UintegerValue, EnumValue, UintegerValue> channelValue;
WifiMacHelper wifiMac;
if (infrastructure)
{
Ssid ssid = Ssid ("ns-3-ssid");
wifiMac.SetType ("ns3::StaWifiMac",
"Ssid", SsidValue (ssid));
wifiPhy.Set ("ChannelWidth", UintegerValue (serverSelectedStandard.m_width));
channelValue.Set (WifiPhy::ChannelTuple {0, serverSelectedStandard.m_width,
serverSelectedStandard.m_band, 0});
wifiPhy.Set ("ChannelSettings", channelValue);
serverDevice = wifi.Install (wifiPhy, wifiMac, serverNode);
wifiMac.SetType ("ns3::ApWifiMac",
"Ssid", SsidValue (ssid));
wifiPhy.Set ("ChannelWidth", UintegerValue (clientSelectedStandard.m_width));
channelValue.Set (WifiPhy::ChannelTuple {0, clientSelectedStandard.m_width,
clientSelectedStandard.m_band, 0});
clientDevice = wifi.Install (wifiPhy, wifiMac, clientNode);
}
else
{
wifiMac.SetType ("ns3::AdhocWifiMac");
wifiPhy.Set ("ChannelWidth", UintegerValue (serverSelectedStandard.m_width));
channelValue.Set (WifiPhy::ChannelTuple {0, serverSelectedStandard.m_width,
serverSelectedStandard.m_band, 0});
wifiPhy.Set ("ChannelSettings", channelValue);
serverDevice = wifi.Install (wifiPhy, wifiMac, serverNode);
wifiPhy.Set ("ChannelWidth", UintegerValue (clientSelectedStandard.m_width));
channelValue.Set (WifiPhy::ChannelTuple {0, clientSelectedStandard.m_width,
clientSelectedStandard.m_band, 0});
clientDevice = wifi.Install (wifiPhy, wifiMac, clientNode);
}

View File

@@ -146,6 +146,7 @@ int main (int argc, char *argv[])
break;
case 4:
wifi.SetStandard (WIFI_STANDARD_80211n_5GHZ);
phy.Set ("ChannelSettings", StringValue ("{0, 0, BAND_5GHZ, 0}"));
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
apDevice = wifi.Install (phy, macAp, wifiApNode.Get (0));
phySta = GetYansWifiPhyPtr (staDevice);
@@ -179,6 +180,7 @@ int main (int argc, char *argv[])
break;
case 7:
wifi.SetStandard (WIFI_STANDARD_80211ax_2_4GHZ);
phy.Set ("ChannelSettings", StringValue ("{0, 0, BAND_2_4GHZ, 0}"));
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
apDevice = wifi.Install (phy, macAp, wifiApNode.Get (0));
phySta = GetYansWifiPhyPtr (staDevice);
@@ -201,6 +203,7 @@ int main (int argc, char *argv[])
break;
case 9:
wifi.SetStandard (WIFI_STANDARD_80211ax_6GHZ);
phy.Set ("ChannelSettings", StringValue ("{0, 0, BAND_6GHZ, 0}"));
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
apDevice = wifi.Install (phy, macAp, wifiApNode.Get (0));
phySta = GetYansWifiPhyPtr (staDevice);
@@ -212,7 +215,7 @@ int main (int argc, char *argv[])
break;
case 10:
wifi.SetStandard (WIFI_STANDARD_80211p);
phy.Set ("ChannelWidth", UintegerValue (10));
phy.Set ("ChannelSettings", StringValue ("{0, 10, BAND_5GHZ, 0}"));
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
apDevice = wifi.Install (phy, macAp, wifiApNode.Get (0));
phySta = GetYansWifiPhyPtr (staDevice);
@@ -224,7 +227,7 @@ int main (int argc, char *argv[])
break;
case 11:
wifi.SetStandard (WIFI_STANDARD_80211p);
phy.Set ("ChannelWidth", UintegerValue (5));
phy.Set ("ChannelSettings", StringValue ("{0, 5, BAND_5GHZ, 0}"));
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
apDevice = wifi.Install (phy, macAp, wifiApNode.Get (0));
phySta = GetYansWifiPhyPtr (staDevice);
@@ -236,7 +239,7 @@ int main (int argc, char *argv[])
break;
case 12:
wifi.SetStandard (WIFI_STANDARD_80211n_5GHZ);
phy.Set ("ChannelNumber", UintegerValue (44));
phy.Set ("ChannelSettings", StringValue ("{44, 20, BAND_5GHZ, 0}"));
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
apDevice = wifi.Install (phy, macAp, wifiApNode.Get (0));
phySta = GetYansWifiPhyPtr (staDevice);
@@ -248,13 +251,13 @@ int main (int argc, char *argv[])
break;
case 13:
wifi.SetStandard (WIFI_STANDARD_80211n_5GHZ);
phy.Set ("ChannelNumber", UintegerValue (44));
phy.Set ("ChannelSettings", StringValue ("{44, 0, BAND_5GHZ, 0}"));
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
apDevice = wifi.Install (phy, macAp, wifiApNode.Get (0));
phySta = GetYansWifiPhyPtr (staDevice);
// Post-install reconfiguration to channel number 40
Config::Set ("/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelNumber", UintegerValue (40));
Config::Set ("/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelNumber", UintegerValue (40));
Config::Set ("/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelSettings", StringValue ("{40, 0, BAND_5GHZ, 0}"));
Config::Set ("/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelSettings", StringValue ("{40, 0, BAND_5GHZ, 0}"));
// We expect channel 40, width 20, frequency 5200
NS_ASSERT (phySta->GetChannelNumber () == 40);
NS_ASSERT (phySta->GetChannelWidth () == 20);
@@ -263,35 +266,35 @@ int main (int argc, char *argv[])
break;
case 14:
wifi.SetStandard (WIFI_STANDARD_80211n_5GHZ);
phy.Set ("ChannelNumber", UintegerValue (44));
phy.Set ("ChannelSettings", StringValue ("{44, 0, BAND_5GHZ, 0}"));
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
apDevice = wifi.Install (phy, macAp, wifiApNode.Get (0));
phySta = GetYansWifiPhyPtr (staDevice);
// Post-install reconfiguration to a 40 MHz channel
Config::Set ("/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelNumber", UintegerValue (46));
Config::Set ("/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelNumber", UintegerValue (46));
Config::Set ("/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelSettings", StringValue ("{46, 0, BAND_5GHZ, 0}"));
Config::Set ("/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelSettings", StringValue ("{46, 0, BAND_5GHZ, 0}"));
NS_ASSERT (phySta->GetChannelNumber () == 46);
NS_ASSERT (phySta->GetChannelWidth () == 40);
NS_ASSERT (phySta->GetFrequency () == 5230);
PrintAttributesIfEnabled (printAttributes);
break;
case 15:
Config::SetDefault ("ns3::WifiPhy::ChannelNumber", UintegerValue (44));
Config::SetDefault ("ns3::WifiPhy::ChannelSettings", StringValue ("{44, 0, BAND_5GHZ, 0}"));
wifi.SetStandard (WIFI_STANDARD_80211n_5GHZ);
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
apDevice = wifi.Install (phy, macAp, wifiApNode.Get (0));
phySta = GetYansWifiPhyPtr (staDevice);
// Post-install reconfiguration to a 40 MHz channel
Config::Set ("/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelNumber", UintegerValue (46));
Config::Set ("/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelNumber", UintegerValue (46));
Config::Set ("/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelSettings", StringValue ("{46, 0, BAND_5GHZ, 0}"));
Config::Set ("/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelSettings", StringValue ("{46, 0, BAND_5GHZ, 0}"));
NS_ASSERT (phySta->GetChannelNumber () == 46);
NS_ASSERT (phySta->GetChannelWidth () == 40);
NS_ASSERT (phySta->GetFrequency () == 5230);
PrintAttributesIfEnabled (printAttributes);
break;
case 16:
// Test that setting Frequency to a non-standard value will throw an exception
Config::SetDefault ("ns3::WifiPhy::Frequency", UintegerValue (5281));
// Test that setting channel number to a non-standard value will throw an exception
Config::SetDefault ("ns3::WifiPhy::ChannelSettings", StringValue ("{45, 0, BAND_5GHZ, 0}"));
wifi.SetStandard (WIFI_STANDARD_80211n_5GHZ);
exceptionThrown = false;
try
@@ -318,7 +321,7 @@ int main (int argc, char *argv[])
case 17:
// Test that setting Frequency to a standard value will set the
// channel number correctly
Config::SetDefault ("ns3::WifiPhy::Frequency", UintegerValue (5500));
Config::SetDefault ("ns3::WifiPhy::ChannelSettings", StringValue ("{100, 0, BAND_5GHZ, 0}"));
wifi.SetStandard (WIFI_STANDARD_80211n_5GHZ);
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
apDevice = wifi.Install (phy, macAp, wifiApNode.Get (0));
@@ -338,7 +341,7 @@ int main (int argc, char *argv[])
exceptionThrown = false;
try
{
phySta->SetOperatingChannel (99, 5185, 40);
phySta->SetOperatingChannel (WifiPhy::ChannelTuple {99, 40, WIFI_PHY_BAND_5GHZ, 0});
}
catch (const std::runtime_error&)
{
@@ -350,21 +353,22 @@ int main (int argc, char *argv[])
case 19:
// Test how channel number behaves when frequency is non-standard
wifi.SetStandard (WIFI_STANDARD_80211n_5GHZ);
phy.Set ("ChannelSettings", StringValue ("{44, 0, BAND_5GHZ, 0}"));
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
apDevice = wifi.Install (phy, macAp, wifiApNode.Get (0));
phySta = GetYansWifiPhyPtr (staDevice);
exceptionThrown = false;
try
{
phySta->SetAttribute ("Frequency", UintegerValue (5181));
phySta->SetAttribute ("ChannelSettings", StringValue ("{45, 0, BAND_5GHZ, 0}"));
}
catch (const std::runtime_error&)
{
exceptionThrown = true;
}
// We expect that an exception is thrown due to unknown center frequency 5181
// We expect that an exception is thrown due to unknown channel number 45
NS_ASSERT (exceptionThrown);
phySta->SetAttribute ("Frequency", UintegerValue (5180));
phySta->SetAttribute ("ChannelSettings", StringValue ("{36, 0, BAND_5GHZ, 0}"));
// We expect channel number to be 36 due to known center frequency 5180
NS_ASSERT (phySta->GetChannelNumber () == 36);
NS_ASSERT (phySta->GetChannelWidth () == 20);
@@ -372,15 +376,15 @@ int main (int argc, char *argv[])
exceptionThrown = false;
try
{
phySta->SetAttribute ("Frequency", UintegerValue (5179));
phySta->SetAttribute ("ChannelSettings", StringValue ("{43, 0, BAND_5GHZ, 0}"));
}
catch (const std::runtime_error&)
{
exceptionThrown = true;
}
// We expect that an exception is thrown due to unknown center frequency 5179
// We expect that an exception is thrown due to unknown channel number 43
NS_ASSERT (exceptionThrown);
phySta->SetAttribute ("ChannelNumber", UintegerValue (36));
phySta->SetAttribute ("ChannelSettings", StringValue ("{36, 0, BAND_5GHZ, 0}"));
NS_ASSERT (phySta->GetChannelNumber () == 36);
NS_ASSERT (phySta->GetChannelWidth () == 20);
NS_ASSERT (phySta->GetFrequency () == 5180);
@@ -388,8 +392,7 @@ int main (int argc, char *argv[])
break;
case 20:
// Set both channel and frequency to consistent values before initialization
Config::SetDefault ("ns3::WifiPhy::Frequency", UintegerValue (5200));
Config::SetDefault ("ns3::WifiPhy::ChannelNumber", UintegerValue (40));
Config::SetDefault ("ns3::WifiPhy::ChannelSettings", StringValue ("{40, 0, BAND_5GHZ, 0}"));
wifi.SetStandard (WIFI_STANDARD_80211n_5GHZ);
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
apDevice = wifi.Install (phy, macAp, wifiApNode.Get (0));
@@ -402,44 +405,30 @@ int main (int argc, char *argv[])
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
apDevice = wifi.Install (phy, macAp, wifiApNode.Get (0));
phySta = GetYansWifiPhyPtr (staDevice);
phySta->SetAttribute ("Frequency", UintegerValue (5200));
phySta->SetAttribute ("ChannelNumber", UintegerValue (40));
NS_ASSERT (phySta->GetChannelNumber () == 40);
NS_ASSERT (phySta->GetChannelWidth () == 20);
NS_ASSERT (phySta->GetFrequency () == 5200);
// Set both channel and frequency to inconsistent values
phySta->SetAttribute ("Frequency", UintegerValue (5200));
phySta->SetAttribute ("ChannelNumber", UintegerValue (36));
// We expect channel number to be 36
NS_ASSERT (phySta->GetChannelNumber () == 36);
NS_ASSERT (phySta->GetChannelWidth () == 20);
NS_ASSERT (phySta->GetFrequency () == 5180);
phySta->SetAttribute ("ChannelNumber", UintegerValue (36));
phySta->SetAttribute ("Frequency", UintegerValue (5200));
// We expect channel number to be 40
phySta->SetAttribute ("ChannelSettings", StringValue ("{40, 0, BAND_5GHZ, 0}"));
NS_ASSERT (phySta->GetChannelNumber () == 40);
NS_ASSERT (phySta->GetChannelWidth () == 20);
NS_ASSERT (phySta->GetFrequency () == 5200);
exceptionThrown = false;
try
{
phySta->SetAttribute ("Frequency", UintegerValue (5179));
phySta->SetAttribute ("ChannelSettings", StringValue ("{45, 0, BAND_5GHZ, 0}"));
}
catch (const std::runtime_error&)
{
exceptionThrown = true;
}
phySta->SetAttribute ("ChannelNumber", UintegerValue (36));
phySta->SetAttribute ("ChannelSettings", StringValue ("{36, 0, BAND_5GHZ, 0}"));
// We expect channel number to be 36 and an exception to be thrown
NS_ASSERT (phySta->GetChannelNumber () == 36);
NS_ASSERT (phySta->GetChannelWidth () == 20);
NS_ASSERT (phySta->GetFrequency () == 5180);
NS_ASSERT (exceptionThrown);
phySta->SetAttribute ("ChannelNumber", UintegerValue (36));
phySta->SetAttribute ("ChannelSettings", StringValue ("{36, 0, BAND_5GHZ, 0}"));
exceptionThrown = false;
try
{
phySta->SetAttribute ("Frequency", UintegerValue (5179));
phySta->SetAttribute ("ChannelSettings", StringValue ("{43, 0, BAND_5GHZ, 0}"));
}
catch (const std::runtime_error&)
{

View File

@@ -134,8 +134,8 @@ PsrExperiment::Run (struct PsrExperiment::Input input)
tx->SetMobility (posTx);
rx->SetMobility (posRx);
tx->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211a, WIFI_PHY_BAND_5GHZ);
rx->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211a, WIFI_PHY_BAND_5GHZ);
tx->ConfigureStandard (WIFI_PHY_STANDARD_80211a);
rx->ConfigureStandard (WIFI_PHY_STANDARD_80211a);
rx->SetReceiveOkCallback (MakeCallback (&PsrExperiment::Receive, this));
@@ -300,9 +300,9 @@ CollisionExperiment::Run (struct CollisionExperiment::Input input)
txB->SetMobility (posTxB);
rx->SetMobility (posRx);
txA->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211a, WIFI_PHY_BAND_5GHZ);
txB->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211a, WIFI_PHY_BAND_5GHZ);
rx->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211a, WIFI_PHY_BAND_5GHZ);
txA->ConfigureStandard (WIFI_PHY_STANDARD_80211a);
txB->ConfigureStandard (WIFI_PHY_STANDARD_80211a);
rx->ConfigureStandard (WIFI_PHY_STANDARD_80211a);
rx->SetReceiveOkCallback (MakeCallback (&CollisionExperiment::Receive, this));

View File

@@ -269,9 +269,9 @@ InterferenceExperiment::Run (struct InterferenceExperiment::Input input)
rx->SetFrameCaptureModel (frameCaptureModel);
}
m_txA->ConfigureStandardAndBand (input.standard, input.band);
m_txB->ConfigureStandardAndBand (input.standard, input.band);
rx->ConfigureStandardAndBand (input.standard, input.band);
m_txA->ConfigureStandard (input.standard);
m_txB->ConfigureStandard (input.standard);
rx->ConfigureStandard (input.standard);
devA->SetPhy (m_txA);
nodeA->AddDevice (devA);
@@ -280,9 +280,10 @@ InterferenceExperiment::Run (struct InterferenceExperiment::Input input)
devRx->SetPhy (rx);
nodeRx->AddDevice (devRx);
m_txA->SetChannelNumber (input.channelA);
m_txB->SetChannelNumber (input.channelB);
rx->SetChannelNumber (std::max (input.channelA, input.channelB));
m_txA->SetOperatingChannel (WifiPhy::ChannelTuple {input.channelA, 0, (int)(input.band), 0});
m_txB->SetOperatingChannel (WifiPhy::ChannelTuple {input.channelB, 0, (int)(input.band), 0});
rx->SetOperatingChannel (WifiPhy::ChannelTuple {std::max (input.channelA, input.channelB), 0,
(int)(input.band), 0});
rx->TraceConnectWithoutContext ("PhyRxDrop", MakeCallback (&InterferenceExperiment::PacketDropped, this));

View File

@@ -809,7 +809,7 @@ WifiHelper::Install (const WifiPhyHelper &phyHelper,
}
Ptr<WifiRemoteStationManager> manager = m_stationManager.Create<WifiRemoteStationManager> ();
Ptr<WifiPhy> phy = phyHelper.Create (node, device);
phy->ConfigureStandardAndBand (it->second.phyStandard, it->second.phyBand);
phy->ConfigureStandard (it->second.phyStandard);
device->SetPhy (phy);
Ptr<WifiMac> mac = macHelper.Create (device, m_standard);
device->SetMac (mac);

View File

@@ -235,39 +235,6 @@ SpectrumWifiPhy::ResetSpectrumModel (void)
UpdateInterferenceHelperBands ();
}
void
SpectrumWifiPhy::SetChannelNumber (uint8_t nch)
{
NS_LOG_FUNCTION (this << +nch);
WifiPhy::SetChannelNumber (nch);
if (IsInitialized ())
{
ResetSpectrumModel ();
}
}
void
SpectrumWifiPhy::SetFrequency (uint16_t freq)
{
NS_LOG_FUNCTION (this << freq);
WifiPhy::SetFrequency (freq);
if (IsInitialized ())
{
ResetSpectrumModel ();
}
}
void
SpectrumWifiPhy::SetChannelWidth (uint16_t channelwidth)
{
NS_LOG_FUNCTION (this << channelwidth);
WifiPhy::SetChannelWidth (channelwidth);
if (IsInitialized ())
{
ResetSpectrumModel ();
}
}
void
SpectrumWifiPhy::DoChannelSwitch (void)
{
@@ -279,17 +246,6 @@ SpectrumWifiPhy::DoChannelSwitch (void)
}
}
void
SpectrumWifiPhy::ConfigureStandardAndBand (WifiPhyStandard standard, WifiPhyBand band)
{
NS_LOG_FUNCTION (this << standard << band);
WifiPhy::ConfigureStandardAndBand (standard, band);
if (IsInitialized ())
{
ResetSpectrumModel ();
}
}
void
SpectrumWifiPhy::StartRx (Ptr<SpectrumSignalParameters> rxParams)
{

View File

@@ -135,12 +135,8 @@ public:
*/
typedef void (* SignalArrivalCallback) (bool signalType, uint32_t senderNodeId, double rxPower, Time duration);
// The following four methods call to the base WifiPhy class method
// but also generate a new SpectrumModel if called during runtime
void SetChannelNumber (uint8_t id) override;
void SetFrequency (uint16_t freq) override;
void SetChannelWidth (uint16_t channelwidth) override;
void ConfigureStandardAndBand (WifiPhyStandard standard, WifiPhyBand band) override;
// The following method calls the base WifiPhy class method
// but also generates a new SpectrumModel if called during runtime
void DoChannelSwitch (void) override;
/**

View File

@@ -74,7 +74,7 @@ WifiPhy::GetTypeId (void)
"Note that the channel width can be left unspecified (0) if the channel "
"number uniquely identify a frequency channel for the given standard and band. ",
StringValue ("{0, 0, BAND_UNSPECIFIED, 0}"),
MakeTupleAccessor <UintegerValue, UintegerValue, EnumValue, UintegerValue> (&WifiPhy::m_channelSettings),
MakeTupleAccessor <UintegerValue, UintegerValue, EnumValue, UintegerValue> ((void (WifiPhy::*) (const ChannelTuple&))(&WifiPhy::SetOperatingChannel)),
MakeTupleChecker<UintegerValue, UintegerValue, EnumValue, UintegerValue>
(MakeUintegerChecker<uint8_t> (0, 233),
MakeUintegerChecker<uint16_t> (0, 160),
@@ -84,63 +84,25 @@ WifiPhy::GetTypeId (void)
WifiPhyBand::WIFI_PHY_BAND_UNSPECIFIED, "BAND_UNSPECIFIED"),
MakeUintegerChecker<uint8_t> (0, 7)))
.AddAttribute ("Frequency",
"The center frequency (MHz) of the operating channel. "
"If the operating channel for this object has not been set yet, the "
"value of this attribute is saved and will be used, along with the channel "
"number and width configured via other attributes, to set the operating "
"channel when the standard and band are configured. The default value of "
"this attribute is 0, which means unspecified center frequency. Note that "
"if center frequency and channel number are both 0 when the standard and "
"band are configured, a default channel (of the configured width, if any, "
"or the default width for the current standard and band, otherwise) is set. "
"If the operating channel for this object has been already set, the "
"specified center frequency must uniquely identify a channel in the "
"band being used.",
"The center frequency (MHz) of the current operating channel.",
UintegerValue (0),
MakeUintegerAccessor (&WifiPhy::GetFrequency,
&WifiPhy::SetFrequency),
MakeUintegerAccessor (&WifiPhy::GetFrequency),
MakeUintegerChecker<uint16_t> ())
.AddAttribute ("ChannelNumber",
"The channel number of the operating channel. "
"If the operating channel for this object has not been set yet, the "
"value of this attribute is saved and will be used, along with the center "
"frequency and width configured via other attributes, to set the operating "
"channel when the standard and band are configured. The default value of "
"this attribute is 0, which means unspecified channel number. Note that "
"if center frequency and channel number are both 0 when the standard and "
"band are configured, a default channel (of the configured width, if any, "
"or the default width for the current standard and band, otherwise) is set. "
"If the operating channel for this object has been already set, the "
"specified channel number must uniquely identify a channel in the "
"band being used.",
"The channel number of the current operating channel.",
UintegerValue (0),
MakeUintegerAccessor (&WifiPhy::SetChannelNumber,
&WifiPhy::GetChannelNumber),
MakeUintegerAccessor (&WifiPhy::GetChannelNumber),
MakeUintegerChecker<uint8_t> (0, 233))
.AddAttribute ("ChannelWidth",
"The width in MHz of the operating channel (5, 10, 20, 22, 40, 80 or 160). "
"If the operating channel for this object has not been set yet, the "
"value of this attribute is saved and will be used, along with the center "
"frequency and channel number configured via other attributes, to set the "
"operating channel when the standard and band are configured. The default value "
"of this attribute is 0, which means unspecified channel width. Note that "
"if center frequency and channel number are both 0 when the standard and "
"band are configured, a default channel (of the configured width, if any, "
"or the default width for the current standard and band, otherwise) is set. "
"Do not set this attribute when the standard and band of this object have "
"been already configured, because it cannot uniquely identify a channel in "
"the band being used.",
"The width in MHz of the current operating channel (5, 10, 20, 22, 40, 80 or 160).",
UintegerValue (0),
MakeUintegerAccessor (&WifiPhy::GetChannelWidth,
&WifiPhy::SetChannelWidth),
MakeUintegerAccessor (&WifiPhy::GetChannelWidth),
MakeUintegerChecker<uint16_t> (5, 160))
.AddAttribute ("Primary20MHzIndex",
"The index of the primary 20 MHz channel within the operating channel "
"(0 indicates the 20 MHz subchannel with the lowest center frequency). "
"This attribute is only valid if the width of the operating channel is "
"a multiple of 20 MHz.",
"The index of the primary 20 MHz channel within the current operating channel "
"(0 indicates the 20 MHz subchannel with the lowest center frequency).",
UintegerValue (0),
MakeUintegerAccessor (&WifiPhy::SetPrimary20Index),
MakeUintegerAccessor (&WifiPhy::GetPrimary20Index),
MakeUintegerChecker<uint8_t> (0, 7))
.AddAttribute ("RxSensitivity",
"The energy of a received signal should be higher than "
@@ -1091,6 +1053,12 @@ WifiPhy::SetPrimary20Index (uint8_t index)
m_operatingChannel.SetPrimary20Index (index);
}
uint8_t
WifiPhy::GetPrimary20Index (void) const
{
return m_operatingChannel.GetPrimaryChannelIndex (20);
}
void
WifiPhy::SetOperatingChannel (uint8_t number, uint16_t frequency, uint16_t width)
{

View File

@@ -491,6 +491,7 @@ public:
*
* \param id the channel number
*/
NS_DEPRECATED_3_35
virtual void SetChannelNumber (uint8_t id);
/**
* Return current channel number.
@@ -509,6 +510,7 @@ public:
* \param standard the Wi-Fi standard
* \param band the Wi-Fi band
*/
NS_DEPRECATED_3_35
virtual void ConfigureStandardAndBand (WifiPhyStandard standard, WifiPhyBand band);
/**
@@ -899,6 +901,7 @@ public:
*
* \param freq the operating center frequency (MHz) on this node.
*/
NS_DEPRECATED_3_35
virtual void SetFrequency (uint16_t freq);
/**
* \return the operating center frequency (MHz)
@@ -910,7 +913,12 @@ public:
*
* \param index the index of the primary 20 MHz channel
*/
NS_DEPRECATED_3_35
void SetPrimary20Index (uint8_t index);
/**
* \return the index of the primary 20 MHz channel
*/
uint8_t GetPrimary20Index (void) const;
/**
* \param antennas the number of antennas on this node.
*/
@@ -1003,6 +1011,7 @@ public:
*
* \param channelWidth the channel width (in MHz)
*/
NS_DEPRECATED_3_35
virtual void SetChannelWidth (uint16_t channelWidth);
/**
* \param width the channel width (in MHz) to support

View File

@@ -569,7 +569,7 @@ TestInterBssConstantObssPdAlgo::RunOne (void)
phy.SetChannel (channel);
phy.Set ("TxPowerStart", DoubleValue (m_txPowerDbm));
phy.Set ("TxPowerEnd", DoubleValue (m_txPowerDbm));
phy.Set ("ChannelWidth", UintegerValue (20));
phy.Set ("ChannelSettings", StringValue ("{36, 20, BAND_5GHZ, 0}"));
WifiHelper wifi;
wifi.SetStandard (WIFI_STANDARD_80211ax_5GHZ);

View File

@@ -102,7 +102,7 @@ PowerRateAdaptationTest::ConfigureNode ()
phy->SetChannel (channel);
phy->SetDevice (dev);
phy->SetMobility (mobility);
phy->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211a, WIFI_PHY_BAND_5GHZ);
phy->ConfigureStandard (WIFI_PHY_STANDARD_80211a);
/*
* Configure power control parameters.

View File

@@ -175,11 +175,10 @@ void
SpectrumWifiPhyBasicTest::DoSetup (void)
{
m_phy = CreateObject<SpectrumWifiPhy> ();
m_phy->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211n, WIFI_PHY_BAND_5GHZ);
m_phy->SetOperatingChannel (WifiPhy::ChannelTuple {CHANNEL_NUMBER, 0, WIFI_PHY_BAND_5GHZ, 0});
m_phy->ConfigureStandard (WIFI_PHY_STANDARD_80211n);
Ptr<ErrorRateModel> error = CreateObject<NistErrorRateModel> ();
m_phy->SetErrorRateModel (error);
m_phy->SetChannelNumber (CHANNEL_NUMBER);
m_phy->SetFrequency (FREQUENCY);
m_phy->SetReceiveOkCallback (MakeCallback (&SpectrumWifiPhyBasicTest::SpectrumWifiPhyRxSuccess, this));
m_phy->SetReceiveErrorCallback (MakeCallback (&SpectrumWifiPhyBasicTest::SpectrumWifiPhyRxFailure, this));
}
@@ -471,7 +470,7 @@ SpectrumWifiPhyFilterTest::DoSetup (void)
Ptr<WifiNetDevice> txDev = CreateObject<WifiNetDevice> ();
m_txPhy = CreateObject<ExtSpectrumWifiPhy> ();
m_txPhy->CreateWifiSpectrumPhyInterface (txDev);
m_txPhy->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211ax, WIFI_PHY_BAND_5GHZ);
m_txPhy->ConfigureStandard (WIFI_PHY_STANDARD_80211ax);
Ptr<ErrorRateModel> error = CreateObject<NistErrorRateModel> ();
m_txPhy->SetErrorRateModel (error);
m_txPhy->SetDevice (txDev);
@@ -486,7 +485,7 @@ SpectrumWifiPhyFilterTest::DoSetup (void)
Ptr<WifiNetDevice> rxDev = CreateObject<WifiNetDevice> ();
m_rxPhy = CreateObject<ExtSpectrumWifiPhy> ();
m_rxPhy->CreateWifiSpectrumPhyInterface (rxDev);
m_rxPhy->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211ax, WIFI_PHY_BAND_5GHZ);
m_rxPhy->ConfigureStandard (WIFI_PHY_STANDARD_80211ax);
m_rxPhy->SetErrorRateModel (error);
m_rxPhy->SetChannel (spectrumChannel);
Ptr<ConstantPositionMobilityModel> sta1Mobility = CreateObject<ConstantPositionMobilityModel> ();
@@ -526,7 +525,11 @@ SpectrumWifiPhyFilterTest::RunOne (void)
txFrequency = 5250;
break;
}
m_txPhy->SetFrequency (txFrequency);
auto txChannelNum = std::get<0> (*WifiPhyOperatingChannel::FindFirst (0, txFrequency, m_txChannelWidth,
WIFI_PHY_STANDARD_80211ax,
WIFI_PHY_BAND_5GHZ));
m_txPhy->SetOperatingChannel (WifiPhy::ChannelTuple {txChannelNum, m_txChannelWidth,
(int)(WIFI_PHY_BAND_5GHZ), 0});
uint16_t rxFrequency;
switch (m_rxChannelWidth)
@@ -545,7 +548,11 @@ SpectrumWifiPhyFilterTest::RunOne (void)
rxFrequency = 5250;
break;
}
m_rxPhy->SetFrequency (rxFrequency);
auto rxChannelNum = std::get<0> (*WifiPhyOperatingChannel::FindFirst (0, rxFrequency, m_rxChannelWidth,
WIFI_PHY_STANDARD_80211ax,
WIFI_PHY_BAND_5GHZ));
m_rxPhy->SetOperatingChannel (WifiPhy::ChannelTuple {rxChannelNum, m_rxChannelWidth,
(int)(WIFI_PHY_BAND_5GHZ), 0});
m_ruBands.clear ();
for (uint16_t bw = 160; bw >= 20; bw = bw / 2)

View File

@@ -103,7 +103,7 @@ AmpduAggregationTest::DoRun (void)
*/
m_phy = CreateObject<YansWifiPhy> ();
m_phy->SetDevice (m_device);
m_phy->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211n, WIFI_PHY_BAND_5GHZ);
m_phy->ConfigureStandard (WIFI_PHY_STANDARD_80211n);
m_device->SetPhy (m_phy);
/*
@@ -350,7 +350,7 @@ TwoLevelAggregationTest::DoRun (void)
*/
m_phy = CreateObject<YansWifiPhy> ();
m_phy->SetDevice (m_device);
m_phy->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211n, WIFI_PHY_BAND_5GHZ);
m_phy->ConfigureStandard (WIFI_PHY_STANDARD_80211n);
m_device->SetPhy (m_phy);
/*
@@ -583,7 +583,7 @@ HeAggregationTest::DoRunSubTest (uint16_t bufferSize)
*/
m_phy = CreateObject<YansWifiPhy> ();
m_phy->SetDevice (m_device);
m_phy->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211ax, WIFI_PHY_BAND_5GHZ);
m_phy->ConfigureStandard (WIFI_PHY_STANDARD_80211ax);
m_device->SetPhy (m_phy);
/*

View File

@@ -1113,21 +1113,20 @@ OfdmaAckSequenceTest::DoRun (void)
switch (m_channelWidth)
{
case 20:
phy.Set ("ChannelNumber", UintegerValue (36));
phy.Set ("ChannelSettings", StringValue ("{36, 20, BAND_5GHZ, 0}"));
break;
case 40:
phy.Set ("ChannelNumber", UintegerValue (38));
phy.Set ("ChannelSettings", StringValue ("{38, 40, BAND_5GHZ, 0}"));
break;
case 80:
phy.Set ("ChannelNumber", UintegerValue (42));
phy.Set ("ChannelSettings", StringValue ("{42, 80, BAND_5GHZ, 0}"));
break;
case 160:
phy.Set ("ChannelNumber", UintegerValue (50));
phy.Set ("ChannelSettings", StringValue ("{50, 160, BAND_5GHZ, 0}"));
break;
default:
NS_ABORT_MSG ("Invalid channel bandwidth (must be 20, 40, 80 or 160)");
}
phy.Set ("ChannelWidth", UintegerValue (m_channelWidth));
Config::SetDefault ("ns3::HeConfiguration::MuBeAifsn",
UintegerValue (m_muEdcaParameterSet.muAifsn));

View File

@@ -655,7 +655,7 @@ TestDlOfdmaPhyTransmission::DoSetup (void)
Ptr<WifiNetDevice> apDev = CreateObject<WifiNetDevice> ();
m_phyAp = CreateObject<SpectrumWifiPhy> ();
m_phyAp->CreateWifiSpectrumPhyInterface (apDev);
m_phyAp->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211ax, WIFI_PHY_BAND_5GHZ);
m_phyAp->ConfigureStandard (WIFI_PHY_STANDARD_80211ax);
Ptr<ErrorRateModel> error = CreateObject<NistErrorRateModel> ();
m_phyAp->SetErrorRateModel (error);
m_phyAp->SetDevice (apDev);
@@ -670,7 +670,7 @@ TestDlOfdmaPhyTransmission::DoSetup (void)
Ptr<WifiNetDevice> sta1Dev = CreateObject<WifiNetDevice> ();
m_phySta1 = CreateObject<OfdmaSpectrumWifiPhy> (1);
m_phySta1->CreateWifiSpectrumPhyInterface (sta1Dev);
m_phySta1->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211ax, WIFI_PHY_BAND_5GHZ);
m_phySta1->ConfigureStandard (WIFI_PHY_STANDARD_80211ax);
m_phySta1->SetErrorRateModel (error);
m_phySta1->SetDevice (sta1Dev);
m_phySta1->SetChannel (spectrumChannel);
@@ -686,7 +686,7 @@ TestDlOfdmaPhyTransmission::DoSetup (void)
Ptr<WifiNetDevice> sta2Dev = CreateObject<WifiNetDevice> ();
m_phySta2 = CreateObject<OfdmaSpectrumWifiPhy> (2);
m_phySta2->CreateWifiSpectrumPhyInterface (sta2Dev);
m_phySta2->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211ax, WIFI_PHY_BAND_5GHZ);
m_phySta2->ConfigureStandard (WIFI_PHY_STANDARD_80211ax);
m_phySta2->SetErrorRateModel (error);
m_phySta2->SetDevice (sta2Dev);
m_phySta2->SetChannel (spectrumChannel);
@@ -702,7 +702,7 @@ TestDlOfdmaPhyTransmission::DoSetup (void)
Ptr<WifiNetDevice> sta3Dev = CreateObject<WifiNetDevice> ();
m_phySta3 = CreateObject<OfdmaSpectrumWifiPhy> (3);
m_phySta3->CreateWifiSpectrumPhyInterface (sta3Dev);
m_phySta3->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211ax, WIFI_PHY_BAND_5GHZ);
m_phySta3->ConfigureStandard (WIFI_PHY_STANDARD_80211ax);
m_phySta3->SetErrorRateModel (error);
m_phySta3->SetDevice (sta3Dev);
m_phySta3->SetChannel (spectrumChannel);
@@ -749,17 +749,18 @@ TestDlOfdmaPhyTransmission::RunOne (void)
m_phySta2->AssignStreams (streamNumber);
m_phySta3->AssignStreams (streamNumber);
m_phyAp->SetFrequency (m_frequency);
m_phyAp->SetChannelWidth (m_channelWidth);
auto channelNum = std::get<0> (*WifiPhyOperatingChannel::FindFirst (0, m_frequency, m_channelWidth,
WIFI_PHY_STANDARD_80211ax,
WIFI_PHY_BAND_5GHZ));
m_phySta1->SetFrequency (m_frequency);
m_phySta1->SetChannelWidth (m_channelWidth);
m_phySta2->SetFrequency (m_frequency);
m_phySta2->SetChannelWidth (m_channelWidth);
m_phySta3->SetFrequency (m_frequency);
m_phySta3->SetChannelWidth (m_channelWidth);
m_phyAp->SetOperatingChannel (WifiPhy::ChannelTuple {channelNum, m_channelWidth,
(int)(WIFI_PHY_BAND_5GHZ), 0});
m_phySta1->SetOperatingChannel (WifiPhy::ChannelTuple {channelNum, m_channelWidth,
(int)(WIFI_PHY_BAND_5GHZ), 0});
m_phySta2->SetOperatingChannel (WifiPhy::ChannelTuple {channelNum, m_channelWidth,
(int)(WIFI_PHY_BAND_5GHZ), 0});
m_phySta3->SetOperatingChannel (WifiPhy::ChannelTuple {channelNum, m_channelWidth,
(int)(WIFI_PHY_BAND_5GHZ), 0});
Simulator::Schedule (Seconds (0.5), &TestDlOfdmaPhyTransmission::ResetResults, this);
@@ -1040,11 +1041,15 @@ TestUlOfdmaPpduUid::DoSetup (void)
Ptr<WifiNetDevice> apDev = CreateObject<WifiNetDevice> ();
m_phyAp = CreateObject<OfdmaSpectrumWifiPhy> (0);
m_phyAp->CreateWifiSpectrumPhyInterface (apDev);
m_phyAp->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211ax, WIFI_PHY_BAND_5GHZ);
m_phyAp->ConfigureStandard (WIFI_PHY_STANDARD_80211ax);
Ptr<ErrorRateModel> error = CreateObject<NistErrorRateModel> ();
m_phyAp->SetErrorRateModel (error);
m_phyAp->SetFrequency (DEFAULT_FREQUENCY);
m_phyAp->SetChannelWidth (DEFAULT_CHANNEL_WIDTH);
auto channelNum = std::get<0> (*WifiPhyOperatingChannel::FindFirst (0, DEFAULT_FREQUENCY,
DEFAULT_CHANNEL_WIDTH,
WIFI_PHY_STANDARD_80211ax,
WIFI_PHY_BAND_5GHZ));
m_phyAp->SetOperatingChannel (WifiPhy::ChannelTuple {channelNum, DEFAULT_CHANNEL_WIDTH,
(int)(WIFI_PHY_BAND_5GHZ), 0});
m_phyAp->SetDevice (apDev);
m_phyAp->SetChannel (spectrumChannel);
m_phyAp->TraceConnectWithoutContext ("TxPpduUid", MakeCallback (&TestUlOfdmaPpduUid::TxPpduAp, this));
@@ -1058,10 +1063,10 @@ TestUlOfdmaPpduUid::DoSetup (void)
Ptr<WifiNetDevice> sta1Dev = CreateObject<WifiNetDevice> ();
m_phySta1 = CreateObject<OfdmaSpectrumWifiPhy> (1);
m_phySta1->CreateWifiSpectrumPhyInterface (sta1Dev);
m_phySta1->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211ax, WIFI_PHY_BAND_5GHZ);
m_phySta1->ConfigureStandard (WIFI_PHY_STANDARD_80211ax);
m_phySta1->SetErrorRateModel (error);
m_phySta1->SetFrequency (DEFAULT_FREQUENCY);
m_phySta1->SetChannelWidth (DEFAULT_CHANNEL_WIDTH);
m_phySta1->SetOperatingChannel (WifiPhy::ChannelTuple {channelNum, DEFAULT_CHANNEL_WIDTH,
(int)(WIFI_PHY_BAND_5GHZ), 0});
m_phySta1->SetDevice (sta1Dev);
m_phySta1->SetChannel (spectrumChannel);
m_phySta1->TraceConnectWithoutContext ("TxPpduUid", MakeCallback (&TestUlOfdmaPpduUid::TxPpduSta1, this));
@@ -1075,10 +1080,10 @@ TestUlOfdmaPpduUid::DoSetup (void)
Ptr<WifiNetDevice> sta2Dev = CreateObject<WifiNetDevice> ();
m_phySta2 = CreateObject<OfdmaSpectrumWifiPhy> (2);
m_phySta2->CreateWifiSpectrumPhyInterface (sta2Dev);
m_phySta2->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211ax, WIFI_PHY_BAND_5GHZ);
m_phySta2->ConfigureStandard (WIFI_PHY_STANDARD_80211ax);
m_phySta2->SetErrorRateModel (error);
m_phySta2->SetFrequency (DEFAULT_FREQUENCY);
m_phySta2->SetChannelWidth (DEFAULT_CHANNEL_WIDTH);
m_phySta2->SetOperatingChannel (WifiPhy::ChannelTuple {channelNum, DEFAULT_CHANNEL_WIDTH,
(int)(WIFI_PHY_BAND_5GHZ), 0});
m_phySta2->SetDevice (sta2Dev);
m_phySta2->SetChannel (spectrumChannel);
m_phySta2->TraceConnectWithoutContext ("TxPpduUid", MakeCallback (&TestUlOfdmaPpduUid::TxPpduSta2, this));
@@ -1504,15 +1509,14 @@ TestMultipleHeTbPreambles::DoSetup (void)
{
Ptr<WifiNetDevice> dev = CreateObject<WifiNetDevice> ();
m_phy = CreateObject<OfdmaSpectrumWifiPhy> (0);
m_phy->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211ax, WIFI_PHY_BAND_5GHZ);
m_phy->ConfigureStandard (WIFI_PHY_STANDARD_80211ax);
Ptr<ErrorRateModel> error = CreateObject<NistErrorRateModel> ();
Ptr<ApWifiMac> mac = CreateObject<ApWifiMac> ();
mac->SetAttribute ("BeaconGeneration", BooleanValue (false));
dev->SetMac (mac);
m_phy->SetErrorRateModel (error);
m_phy->SetChannelNumber (DEFAULT_CHANNEL_NUMBER);
m_phy->SetFrequency (DEFAULT_FREQUENCY);
m_phy->SetChannelWidth (DEFAULT_CHANNEL_WIDTH);
m_phy->SetOperatingChannel (WifiPhy::ChannelTuple {DEFAULT_CHANNEL_NUMBER, DEFAULT_CHANNEL_WIDTH,
(int)(WIFI_PHY_BAND_5GHZ), 0});
m_phy->TraceConnectWithoutContext ("PhyRxDrop", MakeCallback (&TestMultipleHeTbPreambles::RxDropped, this));
m_phy->SetDevice (dev);
Ptr<ThresholdPreambleDetectionModel> preambleDetectionModel = CreateObject<ThresholdPreambleDetectionModel> ();
@@ -2135,7 +2139,7 @@ TestUlOfdmaPhyTransmission::DoSetup (void)
apDev->SetMac (apMac);
m_phyAp = CreateObject<OfdmaSpectrumWifiPhy> (0);
m_phyAp->CreateWifiSpectrumPhyInterface (apDev);
m_phyAp->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211ax, WIFI_PHY_BAND_5GHZ);
m_phyAp->ConfigureStandard (WIFI_PHY_STANDARD_80211ax);
Ptr<HeConfiguration> heConfiguration = CreateObject<HeConfiguration> ();
apDev->SetHeConfiguration (heConfiguration);
Ptr<ErrorRateModel> error = CreateObject<NistErrorRateModel> ();
@@ -2155,7 +2159,7 @@ TestUlOfdmaPhyTransmission::DoSetup (void)
Ptr<WifiNetDevice> sta1Dev = CreateObject<WifiNetDevice> ();
m_phySta1 = CreateObject<OfdmaSpectrumWifiPhy> (1);
m_phySta1->CreateWifiSpectrumPhyInterface (sta1Dev);
m_phySta1->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211ax, WIFI_PHY_BAND_5GHZ);
m_phySta1->ConfigureStandard (WIFI_PHY_STANDARD_80211ax);
m_phySta1->SetErrorRateModel (error);
m_phySta1->SetDevice (sta1Dev);
m_phySta1->SetChannel (spectrumChannel);
@@ -2170,7 +2174,7 @@ TestUlOfdmaPhyTransmission::DoSetup (void)
Ptr<WifiNetDevice> sta2Dev = CreateObject<WifiNetDevice> ();
m_phySta2 = CreateObject<OfdmaSpectrumWifiPhy> (2);
m_phySta2->CreateWifiSpectrumPhyInterface (sta2Dev);
m_phySta2->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211ax, WIFI_PHY_BAND_5GHZ);
m_phySta2->ConfigureStandard (WIFI_PHY_STANDARD_80211ax);
m_phySta2->SetErrorRateModel (error);
m_phySta2->SetDevice (sta2Dev);
m_phySta2->SetChannel (spectrumChannel);
@@ -2185,7 +2189,7 @@ TestUlOfdmaPhyTransmission::DoSetup (void)
Ptr<WifiNetDevice> sta3Dev = CreateObject<WifiNetDevice> ();
m_phySta3 = CreateObject<OfdmaSpectrumWifiPhy> (3);
m_phySta3->CreateWifiSpectrumPhyInterface (sta3Dev);
m_phySta3->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211ax, WIFI_PHY_BAND_5GHZ);
m_phySta3->ConfigureStandard (WIFI_PHY_STANDARD_80211ax);
m_phySta3->SetErrorRateModel (error);
m_phySta3->SetDevice (sta3Dev);
m_phySta3->SetChannel (spectrumChannel);
@@ -2364,17 +2368,18 @@ TestUlOfdmaPhyTransmission::RunOne (void)
m_phySta2->AssignStreams (streamNumber);
m_phySta3->AssignStreams (streamNumber);
m_phyAp->SetFrequency (m_frequency);
m_phyAp->SetChannelWidth (m_channelWidth);
auto channelNum = std::get<0> (*WifiPhyOperatingChannel::FindFirst (0, m_frequency, m_channelWidth,
WIFI_PHY_STANDARD_80211ax,
WIFI_PHY_BAND_5GHZ));
m_phySta1->SetFrequency (m_frequency);
m_phySta1->SetChannelWidth (m_channelWidth);
m_phySta2->SetFrequency (m_frequency);
m_phySta2->SetChannelWidth (m_channelWidth);
m_phySta3->SetFrequency (m_frequency);
m_phySta3->SetChannelWidth (m_channelWidth);
m_phyAp->SetOperatingChannel (WifiPhy::ChannelTuple {channelNum, m_channelWidth,
(int)(WIFI_PHY_BAND_5GHZ), 0});
m_phySta1->SetOperatingChannel (WifiPhy::ChannelTuple {channelNum, m_channelWidth,
(int)(WIFI_PHY_BAND_5GHZ), 0});
m_phySta2->SetOperatingChannel (WifiPhy::ChannelTuple {channelNum, m_channelWidth,
(int)(WIFI_PHY_BAND_5GHZ), 0});
m_phySta3->SetOperatingChannel (WifiPhy::ChannelTuple {channelNum, m_channelWidth,
(int)(WIFI_PHY_BAND_5GHZ), 0});
Time delay = Seconds (0.0);
Simulator::Schedule (delay, &TestUlOfdmaPhyTransmission::Reset, this);
@@ -3052,7 +3057,7 @@ TestPhyPaddingExclusion::DoSetup (void)
apDev->SetMac (apMac);
m_phyAp = CreateObject<OfdmaSpectrumWifiPhy> (0);
m_phyAp->CreateWifiSpectrumPhyInterface (apDev);
m_phyAp->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211ax, WIFI_PHY_BAND_5GHZ);
m_phyAp->ConfigureStandard (WIFI_PHY_STANDARD_80211ax);
Ptr<HeConfiguration> heConfiguration = CreateObject<HeConfiguration> ();
apDev->SetHeConfiguration (heConfiguration);
Ptr<ErrorRateModel> error = CreateObject<NistErrorRateModel> ();
@@ -3060,8 +3065,13 @@ TestPhyPaddingExclusion::DoSetup (void)
m_phyAp->SetDevice (apDev);
m_phyAp->SetChannel (spectrumChannel);
m_phyAp->AssignStreams (streamNumber);
m_phyAp->SetFrequency (DEFAULT_FREQUENCY);
m_phyAp->SetChannelWidth (DEFAULT_CHANNEL_WIDTH);
auto channelNum = std::get<0> (*WifiPhyOperatingChannel::FindFirst (0, DEFAULT_FREQUENCY,
DEFAULT_CHANNEL_WIDTH,
WIFI_PHY_STANDARD_80211ax,
WIFI_PHY_BAND_5GHZ));
m_phyAp->SetOperatingChannel (WifiPhy::ChannelTuple {channelNum, DEFAULT_CHANNEL_WIDTH,
(int)(WIFI_PHY_BAND_5GHZ), 0});
m_phyAp->SetReceiveOkCallback (MakeCallback (&TestPhyPaddingExclusion::RxSuccess, this));
m_phyAp->SetReceiveErrorCallback (MakeCallback (&TestPhyPaddingExclusion::RxFailure, this));
Ptr<ConstantPositionMobilityModel> apMobility = CreateObject<ConstantPositionMobilityModel> ();
@@ -3074,13 +3084,13 @@ TestPhyPaddingExclusion::DoSetup (void)
Ptr<WifiNetDevice> sta1Dev = CreateObject<WifiNetDevice> ();
m_phySta1 = CreateObject<OfdmaSpectrumWifiPhy> (1);
m_phySta1->CreateWifiSpectrumPhyInterface (sta1Dev);
m_phySta1->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211ax, WIFI_PHY_BAND_5GHZ);
m_phySta1->ConfigureStandard (WIFI_PHY_STANDARD_80211ax);
m_phySta1->SetErrorRateModel (error);
m_phySta1->SetDevice (sta1Dev);
m_phySta1->SetChannel (spectrumChannel);
m_phySta1->AssignStreams (streamNumber);
m_phySta1->SetFrequency (DEFAULT_FREQUENCY);
m_phySta1->SetChannelWidth (DEFAULT_CHANNEL_WIDTH);
m_phySta1->SetOperatingChannel (WifiPhy::ChannelTuple {channelNum, DEFAULT_CHANNEL_WIDTH,
(int)(WIFI_PHY_BAND_5GHZ), 0});
Ptr<ConstantPositionMobilityModel> sta1Mobility = CreateObject<ConstantPositionMobilityModel> ();
m_phySta1->SetMobility (sta1Mobility);
sta1Dev->SetPhy (m_phySta1);
@@ -3091,13 +3101,13 @@ TestPhyPaddingExclusion::DoSetup (void)
Ptr<WifiNetDevice> sta2Dev = CreateObject<WifiNetDevice> ();
m_phySta2 = CreateObject<OfdmaSpectrumWifiPhy> (2);
m_phySta2->CreateWifiSpectrumPhyInterface (sta2Dev);
m_phySta2->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211ax, WIFI_PHY_BAND_5GHZ);
m_phySta2->ConfigureStandard (WIFI_PHY_STANDARD_80211ax);
m_phySta2->SetErrorRateModel (error);
m_phySta2->SetDevice (sta2Dev);
m_phySta2->SetChannel (spectrumChannel);
m_phySta2->AssignStreams (streamNumber);
m_phySta2->SetFrequency (DEFAULT_FREQUENCY);
m_phySta2->SetChannelWidth (DEFAULT_CHANNEL_WIDTH);
m_phySta2->SetOperatingChannel (WifiPhy::ChannelTuple {channelNum, DEFAULT_CHANNEL_WIDTH,
(int)(WIFI_PHY_BAND_5GHZ), 0});
Ptr<ConstantPositionMobilityModel> sta2Mobility = CreateObject<ConstantPositionMobilityModel> ();
m_phySta2->SetMobility (sta2Mobility);
sta2Dev->SetPhy (m_phySta2);
@@ -3439,8 +3449,7 @@ TestUlOfdmaPowerControl::DoSetup (void)
SpectrumWifiPhyHelper spectrumPhy;
spectrumPhy.SetChannel (spectrumChannel);
spectrumPhy.SetErrorRateModel ("ns3::NistErrorRateModel");
spectrumPhy.Set ("Frequency", UintegerValue (DEFAULT_FREQUENCY));
spectrumPhy.Set ("ChannelWidth", UintegerValue (DEFAULT_CHANNEL_WIDTH));
spectrumPhy.Set ("ChannelSettings", StringValue ("{0, 0, BAND_5GHZ, 0}"));
WifiHelper wifi;
wifi.SetStandard (WIFI_STANDARD_80211ax_5GHZ);

View File

@@ -203,11 +203,10 @@ void
TestThresholdPreambleDetectionWithoutFrameCapture::DoSetup (void)
{
m_phy = CreateObject<SpectrumWifiPhy> ();
m_phy->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211ax, WIFI_PHY_BAND_5GHZ);
m_phy->ConfigureStandard (WIFI_PHY_STANDARD_80211ax);
Ptr<ErrorRateModel> error = CreateObject<NistErrorRateModel> ();
m_phy->SetErrorRateModel (error);
m_phy->SetChannelNumber (CHANNEL_NUMBER);
m_phy->SetFrequency (FREQUENCY);
m_phy->SetOperatingChannel (WifiPhy::ChannelTuple {CHANNEL_NUMBER, 0, WIFI_PHY_BAND_5GHZ, 0});
m_phy->SetReceiveOkCallback (MakeCallback (&TestThresholdPreambleDetectionWithoutFrameCapture::RxSuccess, this));
m_phy->SetReceiveErrorCallback (MakeCallback (&TestThresholdPreambleDetectionWithoutFrameCapture::RxFailure, this));
@@ -568,11 +567,10 @@ void
TestThresholdPreambleDetectionWithFrameCapture::DoSetup (void)
{
m_phy = CreateObject<SpectrumWifiPhy> ();
m_phy->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211ax, WIFI_PHY_BAND_5GHZ);
m_phy->ConfigureStandard (WIFI_PHY_STANDARD_80211ax);
Ptr<ErrorRateModel> error = CreateObject<NistErrorRateModel> ();
m_phy->SetErrorRateModel (error);
m_phy->SetChannelNumber (CHANNEL_NUMBER);
m_phy->SetFrequency (FREQUENCY);
m_phy->SetOperatingChannel (WifiPhy::ChannelTuple {CHANNEL_NUMBER, 0, WIFI_PHY_BAND_5GHZ, 0});
m_phy->SetReceiveOkCallback (MakeCallback (&TestThresholdPreambleDetectionWithFrameCapture::RxSuccess, this));
m_phy->SetReceiveErrorCallback (MakeCallback (&TestThresholdPreambleDetectionWithFrameCapture::RxFailure, this));
@@ -1107,11 +1105,10 @@ void
TestSimpleFrameCaptureModel::DoSetup (void)
{
m_phy = CreateObject<SpectrumWifiPhy> ();
m_phy->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211ax, WIFI_PHY_BAND_5GHZ);
m_phy->ConfigureStandard (WIFI_PHY_STANDARD_80211ax);
Ptr<ErrorRateModel> error = CreateObject<NistErrorRateModel> ();
m_phy->SetErrorRateModel (error);
m_phy->SetChannelNumber (CHANNEL_NUMBER);
m_phy->SetFrequency (FREQUENCY);
m_phy->SetOperatingChannel (WifiPhy::ChannelTuple {CHANNEL_NUMBER, 0, WIFI_PHY_BAND_5GHZ, 0});
m_phy->SetReceiveOkCallback (MakeCallback (&TestSimpleFrameCaptureModel::RxSuccess, this));
m_phy->TraceConnectWithoutContext ("PhyRxDrop", MakeCallback (&TestSimpleFrameCaptureModel::RxDropped, this));
@@ -1281,11 +1278,10 @@ void
TestPhyHeadersReception::DoSetup (void)
{
m_phy = CreateObject<SpectrumWifiPhy> ();
m_phy->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211ax, WIFI_PHY_BAND_5GHZ);
m_phy->ConfigureStandard (WIFI_PHY_STANDARD_80211ax);
Ptr<ErrorRateModel> error = CreateObject<NistErrorRateModel> ();
m_phy->SetErrorRateModel (error);
m_phy->SetChannelNumber (CHANNEL_NUMBER);
m_phy->SetFrequency (FREQUENCY);
m_phy->SetOperatingChannel (WifiPhy::ChannelTuple {CHANNEL_NUMBER, 0, WIFI_PHY_BAND_5GHZ, 0});
}
void
@@ -1779,11 +1775,10 @@ void
TestAmpduReception::DoSetup (void)
{
m_phy = CreateObject<SpectrumWifiPhy> ();
m_phy->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211ax, WIFI_PHY_BAND_5GHZ);
m_phy->ConfigureStandard (WIFI_PHY_STANDARD_80211ax);
Ptr<ErrorRateModel> error = CreateObject<NistErrorRateModel> ();
m_phy->SetErrorRateModel (error);
m_phy->SetChannelNumber (CHANNEL_NUMBER);
m_phy->SetFrequency (FREQUENCY);
m_phy->SetOperatingChannel (WifiPhy::ChannelTuple {CHANNEL_NUMBER, 0, WIFI_PHY_BAND_5GHZ, 0});
m_phy->SetReceiveOkCallback (MakeCallback (&TestAmpduReception::RxSuccess, this));
m_phy->SetReceiveErrorCallback (MakeCallback (&TestAmpduReception::RxFailure, this));

View File

@@ -230,11 +230,10 @@ void
WifiPhyThresholdsTest::DoSetup (void)
{
m_phy = CreateObject<SpectrumWifiPhy> ();
m_phy->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211ax, WIFI_PHY_BAND_5GHZ);
m_phy->ConfigureStandard (WIFI_PHY_STANDARD_80211ax);
Ptr<ErrorRateModel> error = CreateObject<NistErrorRateModel> ();
m_phy->SetErrorRateModel (error);
m_phy->SetChannelNumber (CHANNEL_NUMBER);
m_phy->SetFrequency (FREQUENCY);
m_phy->SetOperatingChannel (WifiPhy::ChannelTuple {CHANNEL_NUMBER, 0, WIFI_PHY_BAND_5GHZ, 0});
m_phy->SetReceiveOkCallback (MakeCallback (&WifiPhyThresholdsTest::RxSuccess, this));
m_phy->SetReceiveErrorCallback (MakeCallback (&WifiPhyThresholdsTest::RxFailure, this));
m_phy->TraceConnectWithoutContext ("PhyRxDrop", MakeCallback (&WifiPhyThresholdsTest::RxDropped, this));

View File

@@ -31,6 +31,7 @@
#include "ns3/he-phy.h"
#include "ns3/he-configuration.h"
#include "ns3/ctrl-headers.h"
#include "ns3/tuple.h"
#include <bitset>
#include <algorithm>
#include <sstream>
@@ -294,7 +295,7 @@ WifiPrimaryChannelsTest::DoSetup (void)
RngSeedManager::SetSeed (1);
RngSeedManager::SetRun (40);
int64_t streamNumber = 100;
uint16_t frequency;
uint8_t channelNum;
// we create as many stations per BSS as the number of 26-tone RUs in a channel
// of the configured width
@@ -302,19 +303,19 @@ WifiPrimaryChannelsTest::DoSetup (void)
{
case 20:
m_nStationsPerBss = 9;
frequency = 5180;
channelNum = 36;
break;
case 40:
m_nStationsPerBss = 18;
frequency = 5190;
channelNum = 38;
break;
case 80:
m_nStationsPerBss = 37;
frequency = 5210;
channelNum = 42;
break;
case 160:
m_nStationsPerBss = 74;
frequency = 5250;
channelNum= 50;
break;
default:
NS_ABORT_MSG ("Channel width (" << m_channelWidth << ") not allowed");
@@ -340,7 +341,6 @@ WifiPrimaryChannelsTest::DoSetup (void)
SpectrumWifiPhyHelper phy;
phy.SetChannel (spectrumChannel);
phy.Set ("Frequency", UintegerValue (frequency)); // same frequency for all BSSes
WifiHelper wifi;
wifi.SetStandard (WIFI_STANDARD_80211ax_5GHZ);
@@ -351,17 +351,21 @@ WifiPrimaryChannelsTest::DoSetup (void)
"Ssid", SsidValue (Ssid ("non-existent-ssid")),
"WaitBeaconTimeout", TimeValue (MicroSeconds (102400))); // same as BeaconInterval
TupleValue<UintegerValue, UintegerValue, EnumValue, UintegerValue> channelValue;
// Each BSS uses a distinct primary20 channel
for (uint8_t bss = 0; bss < m_nBss; bss++)
{
phy.Set ("Primary20MHzIndex", UintegerValue (bss));
channelValue.Set (WifiPhy::ChannelTuple {channelNum, m_channelWidth, WIFI_PHY_BAND_5GHZ, bss});
phy.Set ("ChannelSettings", channelValue);
m_staDevices.push_back (wifi.Install (phy, mac, wifiStaNodes[bss]));
}
for (uint8_t bss = 0; bss < m_nBss; bss++)
{
phy.Set ("Primary20MHzIndex", UintegerValue (bss));
channelValue.Set (WifiPhy::ChannelTuple {channelNum, m_channelWidth, WIFI_PHY_BAND_5GHZ, bss});
phy.Set ("ChannelSettings", channelValue);
mac.SetType ("ns3::ApWifiMac",
"Ssid", SsidValue (Ssid ("wifi-ssid-" + std::to_string (bss))),

View File

@@ -162,7 +162,7 @@ WifiTest::CreateOne (Vector pos, Ptr<YansWifiChannel> channel)
phy->SetErrorRateModel (error);
phy->SetChannel (channel);
phy->SetDevice (dev);
phy->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211a, WIFI_PHY_BAND_5GHZ);
phy->ConfigureStandard (WIFI_PHY_STANDARD_80211a);
Ptr<WifiRemoteStationManager> manager = m_manager.Create<WifiRemoteStationManager> ();
mobility->SetPosition (pos);
@@ -311,7 +311,7 @@ void
InterferenceHelperSequenceTest::SwitchCh (Ptr<WifiNetDevice> dev)
{
Ptr<WifiPhy> p = dev->GetPhy ();
p->SetChannelNumber (40);
p->SetOperatingChannel (WifiPhy::ChannelTuple {40, 0, (int)(WIFI_PHY_BAND_5GHZ), 0});
}
Ptr<Node>
@@ -339,7 +339,7 @@ InterferenceHelperSequenceTest::CreateOne (Vector pos, Ptr<YansWifiChannel> chan
phy->SetChannel (channel);
phy->SetDevice (dev);
phy->SetMobility (mobility);
phy->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211a, WIFI_PHY_BAND_5GHZ);
phy->ConfigureStandard (WIFI_PHY_STANDARD_80211a);
Ptr<WifiRemoteStationManager> manager = m_manager.Create<WifiRemoteStationManager> ();
mobility->SetPosition (pos);
@@ -547,7 +547,7 @@ DcfImmediateAccessBroadcastTestCase::DoRun (void)
txPhy->SetChannel (channel);
txPhy->SetDevice (txDev);
txPhy->SetMobility (txMobility);
txPhy->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211a, WIFI_PHY_BAND_5GHZ);
txPhy->ConfigureStandard (WIFI_PHY_STANDARD_80211a);
txPhy->TraceConnectWithoutContext ("PhyTxBegin", MakeCallback (&DcfImmediateAccessBroadcastTestCase::NotifyPhyTxBegin, this));
@@ -995,11 +995,13 @@ SetChannelFrequencyTest::DoRun ()
WifiHelper wifi;
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
wifi.SetStandard (WIFI_STANDARD_80211n_5GHZ);
phy.Set ("ChannelSettings", StringValue ("{0, 0, BAND_5GHZ, 0}"));
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
phySta = GetYansWifiPhyPtr (staDevice);
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 36, "802.11n-5GHz configuration");
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11n-5GHz configuration");
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5180, "802.11n-5GHz configuration");
phy.Set ("ChannelSettings", StringValue ("{0, 0, BAND_UNSPECIFIED, 0}")); // restore default
}
{
// case 5:
@@ -1028,11 +1030,13 @@ SetChannelFrequencyTest::DoRun ()
WifiHelper wifi;
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
wifi.SetStandard (WIFI_STANDARD_80211ax_2_4GHZ);
phy.Set ("ChannelSettings", StringValue ("{0, 0, BAND_2_4GHZ, 0}"));
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
phySta = GetYansWifiPhyPtr (staDevice);
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 1, "802.11ax-2.4GHz configuration");
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11ax-2.4GHz configuration");
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 2412, "802.11ax-2.4GHz configuration");
phy.Set ("ChannelSettings", StringValue ("{0, 0, BAND_UNSPECIFIED, 0}")); // restore default
}
{
// case 8:
@@ -1050,98 +1054,106 @@ SetChannelFrequencyTest::DoRun ()
WifiHelper wifi;
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
wifi.SetStandard (WIFI_STANDARD_80211ax_6GHZ);
phy.Set ("ChannelSettings", StringValue ("{0, 0, BAND_6GHZ, 0}"));
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
phySta = GetYansWifiPhyPtr (staDevice);
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 7, "802.11ax-6GHz configuration");
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 80, "802.11ax-6GHz configuration");
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5975, "802.11ax-6GHz configuration");
phy.Set ("ChannelSettings", StringValue ("{0, 0, BAND_UNSPECIFIED, 0}")); // restore default
}
{
// case 10:
WifiHelper wifi;
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
wifi.SetStandard (WIFI_STANDARD_80211p);
phy.Set ("ChannelWidth", UintegerValue (10));
phy.Set ("ChannelSettings", StringValue ("{0, 10, BAND_5GHZ, 0}"));
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
phySta = GetYansWifiPhyPtr (staDevice);
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 172, "802.11p 10Mhz configuration");
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 10, "802.11p 10Mhz configuration");
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5860, "802.11p 10Mhz configuration");
phy.Set ("ChannelSettings", StringValue ("{0, 0, BAND_UNSPECIFIED, 0}")); // restore default
}
{
// case 11:
WifiHelper wifi;
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
wifi.SetStandard (WIFI_STANDARD_80211p);
phy.Set ("ChannelWidth", UintegerValue (5));
phy.Set ("ChannelSettings", StringValue ("{0, 5, BAND_5GHZ, 0}"));
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
phySta = GetYansWifiPhyPtr (staDevice);
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 171, "802.11p 5Mhz configuration");
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 5, "802.11p 5Mhz configuration");
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5860, "802.11p 5Mhz configuration");
phy.Set ("ChannelSettings", StringValue ("{0, 0, BAND_UNSPECIFIED, 0}")); // restore default
}
{
// case 12:
WifiHelper wifi;
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
wifi.SetStandard (WIFI_STANDARD_80211n_5GHZ);
phy.Set ("ChannelWidth", UintegerValue (20)); // reset value after previous case
phy.Set ("ChannelNumber", UintegerValue (44));
phy.Set ("ChannelSettings", StringValue ("{44, 20, BAND_5GHZ, 0}"));
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
phySta = GetYansWifiPhyPtr (staDevice);
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 44, "802.11 5GHz configuration");
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11 5GHz configuration");
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5220, "802.11 5GHz configuration");
phy.Set ("ChannelSettings", StringValue ("{0, 0, BAND_UNSPECIFIED, 0}")); // restore default
}
{
// case 13:
WifiHelper wifi;
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
phy.Set ("ChannelNumber", UintegerValue (44));
phy.Set ("ChannelSettings", StringValue ("{44, 0, BAND_5GHZ, 0}"));
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
phySta = GetYansWifiPhyPtr (staDevice);
// Post-install reconfiguration to channel number 40
std::ostringstream path;
path << "/NodeList/*/DeviceList/" << staDevice.Get(0)->GetIfIndex () << "/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelNumber";
Config::Set (path.str(), UintegerValue (40));
path << "/NodeList/*/DeviceList/" << staDevice.Get(0)->GetIfIndex () << "/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelSettings";
Config::Set (path.str(), StringValue ("{40, 0, BAND_5GHZ, 0}"));
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 40, "802.11 5GHz configuration");
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11 5GHz configuration");
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5200, "802.11 5GHz configuration");
phy.Set ("ChannelSettings", StringValue ("{0, 0, BAND_UNSPECIFIED, 0}")); // restore default
}
{
// case 14:
WifiHelper wifi;
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
phy.Set ("ChannelNumber", UintegerValue (44));
phy.Set ("ChannelSettings", StringValue ("{44, 0, BAND_5GHZ, 0}"));
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
phySta = GetYansWifiPhyPtr (staDevice);
// Post-install reconfiguration to a 40 MHz channel
std::ostringstream path;
path << "/NodeList/*/DeviceList/" << staDevice.Get(0)->GetIfIndex () << "/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelNumber";
Config::Set (path.str(), UintegerValue (46));
path << "/NodeList/*/DeviceList/" << staDevice.Get(0)->GetIfIndex () << "/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelSettings";
Config::Set (path.str(), StringValue ("{46, 0, BAND_5GHZ, 0}"));
// Although channel 44 is configured originally for 20 MHz, we
// allow it to be used for 40 MHz here
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 46, "802.11 5GHz configuration");
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 40, "802.11 5GHz configuration");
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5230, "802.11 5GHz configuration");
phy.Set ("ChannelSettings", StringValue ("{0, 0, BAND_UNSPECIFIED, 0}")); // restore default
}
{
// case 15:
WifiHelper wifi;
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
wifi.SetStandard (WIFI_STANDARD_80211n_5GHZ);
wifi.SetStandard (WIFI_STANDARD_80211n_2_4GHZ);
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
phySta = GetYansWifiPhyPtr (staDevice);
phySta->SetAttribute ("ChannelNumber", UintegerValue (44));
phySta->SetAttribute ("ChannelSettings", StringValue ("{3, 20, BAND_2_4GHZ, 0}"));
return;
// Post-install reconfiguration to a 40 MHz channel
std::ostringstream path;
path << "/NodeList/*/DeviceList/" << staDevice.Get(0)->GetIfIndex () << "/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelNumber";
Config::Set (path.str(), UintegerValue (46));
path << "/NodeList/*/DeviceList/" << staDevice.Get(0)->GetIfIndex () << "/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelSettings";
Config::Set (path.str(), StringValue ("{4, 40, BAND_2_4GHZ, 0}"));
// Although channel 44 is configured originally for 20 MHz, we
// allow it to be used for 40 MHz here
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 46, "802.11 5GHz configuration");
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 4, "802.11 5GHz configuration");
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 40, "802.11 5GHz configuration");
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5230, "802.11 5GHz configuration");
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 2427, "802.11 5GHz configuration");
phy.Set ("ChannelSettings", StringValue ("{0, 0, BAND_UNSPECIFIED, 0}")); // restore default
}
{
// case 16:
@@ -1149,12 +1161,13 @@ SetChannelFrequencyTest::DoRun ()
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
// Test that setting Frequency to a non-standard value will throw an exception
wifi.SetStandard (WIFI_STANDARD_80211n_5GHZ);
phy.Set ("ChannelSettings", StringValue ("{44, 0, BAND_5GHZ, 0}"));
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
phySta = GetYansWifiPhyPtr (staDevice);
bool exceptionThrown = false;
try
{
phySta->SetAttribute ("Frequency", UintegerValue (5281));
phySta->SetAttribute ("ChannelSettings", StringValue ("{45, 0, BAND_5GHZ, 0}"));
}
catch (const std::runtime_error&)
{
@@ -1168,12 +1181,13 @@ SetChannelFrequencyTest::DoRun ()
WifiHelper wifi;
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
wifi.SetStandard (WIFI_STANDARD_80211n_5GHZ);
phy.Set ("ChannelSettings", StringValue ("{44, 0, BAND_5GHZ, 0}"));
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
phySta = GetYansWifiPhyPtr (staDevice);
// Test that setting Frequency to a standard value will set the
// channel number correctly
phySta->SetAttribute ("Frequency", UintegerValue (5500));
// We expect channel number to be 100 due to frequency 5500
// Test that setting channel to a standard value will set the
// frequency correctly
phySta->SetAttribute ("ChannelSettings", StringValue ("{100, 0, BAND_5GHZ, 0}"));
// We expect frequency to be 5500 due to channel number being 100
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 100, "802.11 5GHz configuration");
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11 5GHz configuration");
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5500, "802.11 5GHz configuration");
@@ -1184,12 +1198,13 @@ SetChannelFrequencyTest::DoRun ()
WifiHelper wifi;
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
wifi.SetStandard (WIFI_STANDARD_80211n_5GHZ);
phy.Set ("ChannelSettings", StringValue ("{44, 0, BAND_5GHZ, 0}"));
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
phySta = GetYansWifiPhyPtr (staDevice);
bool exceptionThrown = false;
try
{
phySta->SetOperatingChannel (99, 5185, 40);
phySta->SetOperatingChannel (WifiPhy::ChannelTuple {99, 40, WIFI_PHY_BAND_5GHZ, 0});
}
catch (const std::runtime_error&)
{
@@ -1204,20 +1219,21 @@ SetChannelFrequencyTest::DoRun ()
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
// Test how channel number behaves when frequency is non-standard
wifi.SetStandard (WIFI_STANDARD_80211n_5GHZ);
phy.Set ("ChannelSettings", StringValue ("{44, 0, BAND_5GHZ, 0}"));
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
phySta = GetYansWifiPhyPtr (staDevice);
bool exceptionThrown = false;
try
{
phySta->SetAttribute ("Frequency", UintegerValue (5181));
phySta->SetAttribute ("ChannelSettings", StringValue ("{45, 0, BAND_5GHZ, 0}"));
}
catch (const std::runtime_error&)
{
exceptionThrown = true;
}
// We expect that an exception is thrown due to unknown center frequency 5181
// We expect that an exception is thrown due to unknown channel number 45
NS_TEST_ASSERT_MSG_EQ (exceptionThrown, true, "802.11 5GHz configuration");
phySta->SetAttribute ("Frequency", UintegerValue (5180));
phySta->SetAttribute ("ChannelSettings", StringValue ("{36, 0, BAND_5GHZ, 0}"));
// We expect channel number to be 36 due to known center frequency 5180
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 36, "802.11 5GHz configuration");
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11 5GHz configuration");
@@ -1225,15 +1241,15 @@ SetChannelFrequencyTest::DoRun ()
exceptionThrown = false;
try
{
phySta->SetAttribute ("Frequency", UintegerValue (5179));
phySta->SetAttribute ("ChannelSettings", StringValue ("{43, 0, BAND_5GHZ, 0}"));
}
catch (const std::runtime_error&)
{
exceptionThrown = true;
}
// We expect that an exception is thrown due to unknown center frequency 5179
// We expect that an exception is thrown due to unknown channel number 43
NS_TEST_ASSERT_MSG_EQ (exceptionThrown, true, "802.11 5GHz configuration");
phySta->SetAttribute ("ChannelNumber", UintegerValue (36));
phySta->SetAttribute ("ChannelSettings", StringValue ("{36, 0, BAND_5GHZ, 0}"));
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 36, "802.11 5GHz configuration");
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11 5GHz configuration");
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5180, "802.11 5GHz configuration");
@@ -1242,9 +1258,7 @@ SetChannelFrequencyTest::DoRun ()
// case 20:
WifiHelper wifi;
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
// Set both channel and frequency to consistent values before initialization
phy.Set ("Frequency", UintegerValue (5200));
phy.Set ("ChannelNumber", UintegerValue (40));
phy.Set ("ChannelSettings", StringValue ("{40, 0, BAND_5GHZ, 0}"));
wifi.SetStandard (WIFI_STANDARD_80211n_5GHZ);
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
phySta = GetYansWifiPhyPtr (staDevice);
@@ -1255,20 +1269,17 @@ SetChannelFrequencyTest::DoRun ()
wifi.SetStandard (WIFI_STANDARD_80211n_5GHZ);
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
phySta = GetYansWifiPhyPtr (staDevice);
phySta->SetAttribute ("Frequency", UintegerValue (5200));
phySta->SetAttribute ("ChannelNumber", UintegerValue (40));
phySta->SetAttribute ("ChannelSettings", StringValue ("{40, 0, BAND_5GHZ, 0}"));
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 40, "802.11 5GHz configuration");
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11 5GHz configuration");
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5200, "802.11 5GHz configuration");
// Set both channel and frequency to inconsistent values
phySta->SetAttribute ("Frequency", UintegerValue (5200));
phySta->SetAttribute ("ChannelNumber", UintegerValue (36));
phySta->SetAttribute ("ChannelSettings", StringValue ("{36, 0, BAND_5GHZ, 0}"));
// We expect channel number to be 36
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 36, "802.11 5GHz configuration");
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11 5GHz configuration");
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5180, "802.11 5GHz configuration");
phySta->SetAttribute ("ChannelNumber", UintegerValue (36));
phySta->SetAttribute ("Frequency", UintegerValue (5200));
phySta->SetAttribute ("ChannelSettings", StringValue ("{40, 0, BAND_5GHZ, 0}"));
// We expect channel number to be 40
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 40, "802.11 5GHz configuration");
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11 5GHz configuration");
@@ -1276,23 +1287,23 @@ SetChannelFrequencyTest::DoRun ()
bool exceptionThrown = false;
try
{
phySta->SetAttribute ("Frequency", UintegerValue (5179));
phySta->SetAttribute ("ChannelSettings", StringValue ("{45, 0, BAND_5GHZ, 0}"));
}
catch (const std::runtime_error&)
{
exceptionThrown = true;
}
phySta->SetAttribute ("ChannelNumber", UintegerValue (36));
phySta->SetAttribute ("ChannelSettings", StringValue ("{36, 0, BAND_5GHZ, 0}"));
// We expect channel number to be 36 and an exception to be thrown
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 36, "802.11 5GHz configuration");
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11 5GHz configuration");
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5180, "802.11 5GHz configuration");
NS_TEST_ASSERT_MSG_EQ (exceptionThrown, true, "802.11 5GHz configuration");
phySta->SetAttribute ("ChannelNumber", UintegerValue (36));
phySta->SetAttribute ("ChannelSettings", StringValue ("{36, 0, BAND_5GHZ, 0}"));
exceptionThrown = false;
try
{
phySta->SetAttribute ("Frequency", UintegerValue (5179));
phySta->SetAttribute ("ChannelSettings", StringValue ("{43, 0, BAND_5GHZ, 0}"));
}
catch (const std::runtime_error&)
{
@@ -1561,8 +1572,7 @@ Bug2843TestCase::DoRun (void)
spectrumPhy.SetChannel (spectrumChannel);
spectrumPhy.SetErrorRateModel ("ns3::NistErrorRateModel");
spectrumPhy.Set ("Frequency", UintegerValue (5190));
spectrumPhy.Set ("ChannelWidth", UintegerValue (channelWidth));
spectrumPhy.Set ("ChannelSettings", StringValue ("{38, 40, BAND_5GHZ, 0}"));
spectrumPhy.Set ("TxPowerStart", DoubleValue (10));
spectrumPhy.Set ("TxPowerEnd", DoubleValue (10));
@@ -1674,10 +1684,8 @@ Bug2831TestCase::~Bug2831TestCase ()
void
Bug2831TestCase::ChangeSupportedChannelWidth ()
{
m_apPhy->SetChannelNumber (38);
m_apPhy->SetChannelWidth (40);
m_staPhy->SetChannelNumber (38);
m_staPhy->SetChannelWidth (40);
m_apPhy->SetOperatingChannel (WifiPhy::ChannelTuple {38, 40, (int)(WIFI_PHY_BAND_5GHZ), 0});
m_staPhy->SetOperatingChannel (WifiPhy::ChannelTuple {38, 40, (int)(WIFI_PHY_BAND_5GHZ), 0});
}
void
@@ -1768,9 +1776,8 @@ Bug2831TestCase::DoRun (void)
m_apPhy->SetChannel (channel);
m_apPhy->SetMobility (apMobility);
m_apPhy->SetDevice (apDev);
m_apPhy->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211ax, WIFI_PHY_BAND_5GHZ);
m_apPhy->SetChannelNumber (36);
m_apPhy->SetChannelWidth (20);
m_apPhy->ConfigureStandard (WIFI_PHY_STANDARD_80211ax);
m_apPhy->SetOperatingChannel (WifiPhy::ChannelTuple {36, 20, (int)(WIFI_PHY_BAND_5GHZ), 0});
Ptr<ConstantPositionMobilityModel> staMobility = CreateObject<ConstantPositionMobilityModel> ();
staMobility->SetPosition (Vector (1.0, 0.0, 0.0));
@@ -1781,9 +1788,8 @@ Bug2831TestCase::DoRun (void)
m_staPhy->SetChannel (channel);
m_staPhy->SetMobility (staMobility);
m_staPhy->SetDevice (apDev);
m_staPhy->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211ax, WIFI_PHY_BAND_5GHZ);
m_staPhy->SetChannelNumber (36);
m_staPhy->SetChannelWidth (20);
m_staPhy->ConfigureStandard (WIFI_PHY_STANDARD_80211ax);
m_staPhy->SetOperatingChannel (WifiPhy::ChannelTuple {36, 20, (int)(WIFI_PHY_BAND_5GHZ), 0});
apDev->SetMac (apMac);
apDev->SetPhy (m_apPhy);
@@ -2184,6 +2190,7 @@ Bug2470TestCase::RunSubtest (PointerValue apErrorModel, PointerValue staErrorMod
WifiMacHelper mac;
NetDeviceContainer apDevice;
phy.Set ("PostReceptionErrorModel", apErrorModel);
phy.Set ("ChannelSettings", StringValue ("{36, 20, BAND_5GHZ, 0}"));
mac.SetType ("ns3::ApWifiMac", "EnableBeaconJitter", BooleanValue (false));
apDevice = wifi.Install (phy, mac, wifiApNode);
@@ -2673,24 +2680,8 @@ IdealRateManagerChannelWidthTest::~IdealRateManagerChannelWidthTest ()
void
IdealRateManagerChannelWidthTest::ChangeChannelWidth (uint16_t channelWidth)
{
uint16_t frequency;
switch (channelWidth)
{
case 20:
default:
frequency = 5180;
break;
case 40:
frequency = 5190;
break;
case 80:
frequency = 5210;
break;
case 160:
frequency = 5250;
break;
}
Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/Frequency", UintegerValue (frequency));
Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelSettings",
StringValue ("{0, " + std::to_string (channelWidth) + ", BAND_5GHZ, 0}"));
}
void