A Discrete-Event Network Simulator
API
wifi-phy-configuration.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 Tom Henderson
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Tom Henderson <tomh@tomh.org>
18  */
19 
20 // This example shows (and tests) some possible configurations for
21 // the Wi-Fi physical layer, particularly the interaction between
22 // WifiHelper.SetStandard () and the physical layer channel number,
23 // center frequency, and channel width.
24 
25 #include "ns3/boolean.h"
26 #include "ns3/command-line.h"
27 #include "ns3/config-store.h"
28 #include "ns3/config.h"
29 #include "ns3/log.h"
30 #include "ns3/ssid.h"
31 #include "ns3/string.h"
32 #include "ns3/uinteger.h"
33 #include "ns3/wifi-net-device.h"
34 #include "ns3/yans-wifi-helper.h"
35 #include "ns3/yans-wifi-phy.h"
36 
37 using namespace ns3;
38 
39 NS_LOG_COMPONENT_DEFINE("WifiPhyConfigurationExample");
40 
49 {
50  Ptr<WifiNetDevice> wnd = nc.Get(0)->GetObject<WifiNetDevice>();
51  Ptr<WifiPhy> wp = wnd->GetPhy();
52  return wp->GetObject<YansWifiPhy>();
53 }
54 
60 void
62 {
63  if (enabled)
64  {
65  ConfigStore outputConfig;
66  outputConfig.ConfigureAttributes();
67  }
68 }
69 
70 int
71 main(int argc, char* argv[])
72 {
73  uint32_t testCase = 0;
74  bool printAttributes = false;
75  bool exceptionThrown = false;
76 
77  CommandLine cmd(__FILE__);
78  cmd.AddValue("testCase", "Test case", testCase);
79  cmd.AddValue("printAttributes", "If true, print out attributes", printAttributes);
80  cmd.Parse(argc, argv);
81 
82  NodeContainer wifiStaNode;
83  wifiStaNode.Create(1);
85  wifiApNode.Create(1);
86 
89  phy.SetChannel(channel.Create());
91  wifi.SetRemoteStationManager("ns3::IdealWifiManager");
92 
93  // Configure and declare other generic components of this example
94  Ssid ssid;
95  ssid = Ssid("wifi-phy-configuration");
96  WifiMacHelper macSta;
97  macSta.SetType("ns3::StaWifiMac",
98  "Ssid",
99  SsidValue(ssid),
100  "ActiveProbing",
101  BooleanValue(false));
102  WifiMacHelper macAp;
103  macAp.SetType("ns3::ApWifiMac",
104  "Ssid",
105  SsidValue(ssid),
106  "BeaconInterval",
107  TimeValue(MicroSeconds(102400)),
108  "BeaconGeneration",
109  BooleanValue(true));
110  NetDeviceContainer staDevice;
111  NetDeviceContainer apDevice;
112  Ptr<YansWifiPhy> phySta;
113  Config::SetDefault("ns3::ConfigStore::Filename",
114  StringValue("output-attributes-" + std::to_string(testCase) + ".txt"));
115  Config::SetDefault("ns3::ConfigStore::FileFormat", StringValue("RawText"));
116  Config::SetDefault("ns3::ConfigStore::Mode", StringValue("Save"));
117 
118  switch (testCase)
119  {
120  case 0:
121  // Default configuration, without WifiHelper::SetStandard or WifiHelper
122  phySta = CreateObject<YansWifiPhy>();
123  // The default results in an invalid configuration
124  NS_ASSERT(!phySta->GetOperatingChannel().IsSet());
125  PrintAttributesIfEnabled(printAttributes);
126  break;
127 
128  // The following cases test the setting of WifiPhyStandard alone;
129  // i.e. without further channel number/width/frequency configuration
130 
131  case 1:
132  wifi.SetStandard(WIFI_STANDARD_80211a);
133  staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
134  apDevice = wifi.Install(phy, macAp, wifiApNode.Get(0));
135  phySta = GetYansWifiPhyPtr(staDevice);
136  // We expect channel 36, width 20, frequency 5180
137  NS_ASSERT(phySta->GetChannelNumber() == 36);
138  NS_ASSERT(phySta->GetChannelWidth() == 20);
139  NS_ASSERT(phySta->GetFrequency() == 5180);
140  PrintAttributesIfEnabled(printAttributes);
141  break;
142  case 2:
143  wifi.SetStandard(WIFI_STANDARD_80211b);
144  staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
145  apDevice = wifi.Install(phy, macAp, wifiApNode.Get(0));
146  phySta = GetYansWifiPhyPtr(staDevice);
147  // We expect channel 1, width 22, frequency 2412
148  NS_ASSERT(phySta->GetChannelNumber() == 1);
149  NS_ASSERT(phySta->GetChannelWidth() == 22);
150  NS_ASSERT(phySta->GetFrequency() == 2412);
151  PrintAttributesIfEnabled(printAttributes);
152  break;
153  case 3:
154  wifi.SetStandard(WIFI_STANDARD_80211g);
155  staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
156  apDevice = wifi.Install(phy, macAp, wifiApNode.Get(0));
157  phySta = GetYansWifiPhyPtr(staDevice);
158  // We expect channel 1, width 20, frequency 2412
159  NS_ASSERT(phySta->GetChannelNumber() == 1);
160  NS_ASSERT(phySta->GetChannelWidth() == 20);
161  NS_ASSERT(phySta->GetFrequency() == 2412);
162  PrintAttributesIfEnabled(printAttributes);
163  break;
164  case 4:
165  wifi.SetStandard(WIFI_STANDARD_80211n);
166  phy.Set("ChannelSettings", StringValue("{0, 0, BAND_5GHZ, 0}"));
167  staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
168  apDevice = wifi.Install(phy, macAp, wifiApNode.Get(0));
169  phySta = GetYansWifiPhyPtr(staDevice);
170  // We expect channel 36, width 20, frequency 5180
171  NS_ASSERT(phySta->GetChannelNumber() == 36);
172  NS_ASSERT(phySta->GetChannelWidth() == 20);
173  NS_ASSERT(phySta->GetFrequency() == 5180);
174  PrintAttributesIfEnabled(printAttributes);
175  break;
176  case 5:
177  wifi.SetStandard(WIFI_STANDARD_80211n);
178  staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
179  apDevice = wifi.Install(phy, macAp, wifiApNode.Get(0));
180  phySta = GetYansWifiPhyPtr(staDevice);
181  // We expect channel 1, width 20, frequency 2412
182  NS_ASSERT(phySta->GetChannelNumber() == 1);
183  NS_ASSERT(phySta->GetChannelWidth() == 20);
184  NS_ASSERT(phySta->GetFrequency() == 2412);
185  PrintAttributesIfEnabled(printAttributes);
186  break;
187  case 6:
188  wifi.SetStandard(WIFI_STANDARD_80211ac);
189  staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
190  apDevice = wifi.Install(phy, macAp, wifiApNode.Get(0));
191  phySta = GetYansWifiPhyPtr(staDevice);
192  // We expect channel 42, width 80, frequency 5210
193  NS_ASSERT(phySta->GetChannelNumber() == 42);
194  NS_ASSERT(phySta->GetChannelWidth() == 80);
195  NS_ASSERT(phySta->GetFrequency() == 5210);
196  PrintAttributesIfEnabled(printAttributes);
197  break;
198  case 7:
199  // By default, WifiHelper will use WIFI_STANDARD_80211ax
200  wifi.SetStandard(WIFI_STANDARD_80211ax);
201  phy.Set("ChannelSettings", StringValue("{0, 0, BAND_2_4GHZ, 0}"));
202  staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
203  apDevice = wifi.Install(phy, macAp, wifiApNode.Get(0));
204  phySta = GetYansWifiPhyPtr(staDevice);
205  // We expect channel 1, width 20, frequency 2412
206  NS_ASSERT(phySta->GetChannelNumber() == 1);
207  NS_ASSERT(phySta->GetChannelWidth() == 20);
208  NS_ASSERT(phySta->GetFrequency() == 2412);
209  PrintAttributesIfEnabled(printAttributes);
210  break;
211  case 8:
212  wifi.SetStandard(WIFI_STANDARD_80211ax);
213  staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
214  apDevice = wifi.Install(phy, macAp, wifiApNode.Get(0));
215  phySta = GetYansWifiPhyPtr(staDevice);
216  // We expect channel 42, width 80, frequency 5210
217  NS_ASSERT(phySta->GetChannelNumber() == 42);
218  NS_ASSERT(phySta->GetChannelWidth() == 80);
219  NS_ASSERT(phySta->GetFrequency() == 5210);
220  PrintAttributesIfEnabled(printAttributes);
221  break;
222  case 9:
223  wifi.SetStandard(WIFI_STANDARD_80211ax);
224  phy.Set("ChannelSettings", StringValue("{0, 0, BAND_6GHZ, 0}"));
225  staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
226  apDevice = wifi.Install(phy, macAp, wifiApNode.Get(0));
227  phySta = GetYansWifiPhyPtr(staDevice);
228  // We expect channel 7, width 80, frequency 5985
229  NS_ASSERT(phySta->GetChannelNumber() == 7);
230  NS_ASSERT(phySta->GetChannelWidth() == 80);
231  NS_ASSERT(phySta->GetFrequency() == 5985);
232  PrintAttributesIfEnabled(printAttributes);
233  break;
234  case 10:
235  wifi.SetStandard(WIFI_STANDARD_80211p);
236  phy.Set("ChannelSettings", StringValue("{0, 10, BAND_5GHZ, 0}"));
237  staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
238  apDevice = wifi.Install(phy, macAp, wifiApNode.Get(0));
239  phySta = GetYansWifiPhyPtr(staDevice);
240  // We expect channel 172, width 10, frequency 5860
241  NS_ASSERT(phySta->GetChannelNumber() == 172);
242  NS_ASSERT(phySta->GetChannelWidth() == 10);
243  NS_ASSERT(phySta->GetFrequency() == 5860);
244  PrintAttributesIfEnabled(printAttributes);
245  break;
246  case 11:
247  wifi.SetStandard(WIFI_STANDARD_80211p);
248  phy.Set("ChannelSettings", StringValue("{0, 5, BAND_5GHZ, 0}"));
249  staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
250  apDevice = wifi.Install(phy, macAp, wifiApNode.Get(0));
251  phySta = GetYansWifiPhyPtr(staDevice);
252  // We expect channel 171, width 5, frequency 5860
253  NS_ASSERT(phySta->GetChannelNumber() == 171);
254  NS_ASSERT(phySta->GetChannelWidth() == 5);
255  NS_ASSERT(phySta->GetFrequency() == 5860);
256  PrintAttributesIfEnabled(printAttributes);
257  break;
258  case 12:
259  wifi.SetStandard(WIFI_STANDARD_80211n);
260  phy.Set("ChannelSettings", StringValue("{44, 20, BAND_5GHZ, 0}"));
261  staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
262  apDevice = wifi.Install(phy, macAp, wifiApNode.Get(0));
263  phySta = GetYansWifiPhyPtr(staDevice);
264  // We expect channel 44, width 20, frequency 5220
265  NS_ASSERT(phySta->GetChannelNumber() == 44);
266  NS_ASSERT(phySta->GetChannelWidth() == 20);
267  NS_ASSERT(phySta->GetFrequency() == 5220);
268  PrintAttributesIfEnabled(printAttributes);
269  break;
270  case 13:
271  wifi.SetStandard(WIFI_STANDARD_80211n);
272  phy.Set("ChannelSettings", StringValue("{44, 0, BAND_5GHZ, 0}"));
273  staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
274  apDevice = wifi.Install(phy, macAp, wifiApNode.Get(0));
275  phySta = GetYansWifiPhyPtr(staDevice);
276  // Post-install reconfiguration to channel number 40
277  Config::Set(
278  "/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelSettings",
279  StringValue("{40, 0, BAND_5GHZ, 0}"));
280  Config::Set(
281  "/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelSettings",
282  StringValue("{40, 0, BAND_5GHZ, 0}"));
283  // We expect channel 40, width 20, frequency 5200
284  NS_ASSERT(phySta->GetChannelNumber() == 40);
285  NS_ASSERT(phySta->GetChannelWidth() == 20);
286  NS_ASSERT(phySta->GetFrequency() == 5200);
287  PrintAttributesIfEnabled(printAttributes);
288  break;
289  case 14:
290  wifi.SetStandard(WIFI_STANDARD_80211n);
291  phy.Set("ChannelSettings", StringValue("{44, 0, BAND_5GHZ, 0}"));
292  staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
293  apDevice = wifi.Install(phy, macAp, wifiApNode.Get(0));
294  phySta = GetYansWifiPhyPtr(staDevice);
295  // Post-install reconfiguration to a 40 MHz channel
296  Config::Set(
297  "/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelSettings",
298  StringValue("{46, 0, BAND_5GHZ, 0}"));
299  Config::Set(
300  "/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelSettings",
301  StringValue("{46, 0, BAND_5GHZ, 0}"));
302  NS_ASSERT(phySta->GetChannelNumber() == 46);
303  NS_ASSERT(phySta->GetChannelWidth() == 40);
304  NS_ASSERT(phySta->GetFrequency() == 5230);
305  PrintAttributesIfEnabled(printAttributes);
306  break;
307  case 15:
308  Config::SetDefault("ns3::WifiPhy::ChannelSettings", StringValue("{44, 0, BAND_5GHZ, 0}"));
309  wifi.SetStandard(WIFI_STANDARD_80211n);
310  staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
311  apDevice = wifi.Install(phy, macAp, wifiApNode.Get(0));
312  phySta = GetYansWifiPhyPtr(staDevice);
313  // Post-install reconfiguration to a 40 MHz channel
314  Config::Set(
315  "/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelSettings",
316  StringValue("{46, 0, BAND_5GHZ, 0}"));
317  Config::Set(
318  "/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelSettings",
319  StringValue("{46, 0, BAND_5GHZ, 0}"));
320  NS_ASSERT(phySta->GetChannelNumber() == 46);
321  NS_ASSERT(phySta->GetChannelWidth() == 40);
322  NS_ASSERT(phySta->GetFrequency() == 5230);
323  PrintAttributesIfEnabled(printAttributes);
324  break;
325  case 16:
326  // Test that setting channel number to a non-standard value will throw an exception
327  Config::SetDefault("ns3::WifiPhy::ChannelSettings", StringValue("{45, 0, BAND_5GHZ, 0}"));
328  wifi.SetStandard(WIFI_STANDARD_80211n);
329  exceptionThrown = false;
330  try
331  {
332  staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
333  }
334  catch (const std::runtime_error&)
335  {
336  exceptionThrown = true;
337  }
338  NS_ASSERT(exceptionThrown);
339  exceptionThrown = false;
340  try
341  {
342  apDevice = wifi.Install(phy, macAp, wifiApNode.Get(0));
343  }
344  catch (const std::runtime_error&)
345  {
346  exceptionThrown = true;
347  }
348  NS_ASSERT(exceptionThrown);
349  PrintAttributesIfEnabled(printAttributes);
350  break;
351  case 17:
352  // Test that setting Frequency to a standard value will set the
353  // channel number correctly
354  Config::SetDefault("ns3::WifiPhy::ChannelSettings", StringValue("{100, 0, BAND_5GHZ, 0}"));
355  wifi.SetStandard(WIFI_STANDARD_80211n);
356  staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
357  apDevice = wifi.Install(phy, macAp, wifiApNode.Get(0));
358  phySta = GetYansWifiPhyPtr(staDevice);
359  // We expect channel number to be 100 due to frequency 5500
360  NS_ASSERT(phySta->GetChannelNumber() == 100);
361  NS_ASSERT(phySta->GetChannelWidth() == 20);
362  NS_ASSERT(phySta->GetFrequency() == 5500);
363  PrintAttributesIfEnabled(printAttributes);
364  break;
365  case 18:
366  // Set a wrong channel after initialization
367  wifi.SetStandard(WIFI_STANDARD_80211n);
368  staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
369  apDevice = wifi.Install(phy, macAp, wifiApNode.Get(0));
370  phySta = GetYansWifiPhyPtr(staDevice);
371  exceptionThrown = false;
372  try
373  {
375  }
376  catch (const std::runtime_error&)
377  {
378  exceptionThrown = true;
379  }
380  NS_ASSERT(exceptionThrown);
381  PrintAttributesIfEnabled(printAttributes);
382  break;
383  case 19:
384  // Test how channel number behaves when frequency is non-standard
385  wifi.SetStandard(WIFI_STANDARD_80211n);
386  phy.Set("ChannelSettings", StringValue("{44, 0, BAND_5GHZ, 0}"));
387  staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
388  apDevice = wifi.Install(phy, macAp, wifiApNode.Get(0));
389  phySta = GetYansWifiPhyPtr(staDevice);
390  exceptionThrown = false;
391  try
392  {
393  phySta->SetAttribute("ChannelSettings", StringValue("{45, 0, BAND_5GHZ, 0}"));
394  }
395  catch (const std::runtime_error&)
396  {
397  exceptionThrown = true;
398  }
399  // We expect that an exception is thrown due to unknown channel number 45
400  NS_ASSERT(exceptionThrown);
401  phySta->SetAttribute("ChannelSettings", StringValue("{36, 0, BAND_5GHZ, 0}"));
402  // We expect channel number to be 36 due to known center frequency 5180
403  NS_ASSERT(phySta->GetChannelNumber() == 36);
404  NS_ASSERT(phySta->GetChannelWidth() == 20);
405  NS_ASSERT(phySta->GetFrequency() == 5180);
406  exceptionThrown = false;
407  try
408  {
409  phySta->SetAttribute("ChannelSettings", StringValue("{43, 0, BAND_5GHZ, 0}"));
410  }
411  catch (const std::runtime_error&)
412  {
413  exceptionThrown = true;
414  }
415  // We expect that an exception is thrown due to unknown channel number 43
416  NS_ASSERT(exceptionThrown);
417  phySta->SetAttribute("ChannelSettings", StringValue("{36, 0, BAND_5GHZ, 0}"));
418  NS_ASSERT(phySta->GetChannelNumber() == 36);
419  NS_ASSERT(phySta->GetChannelWidth() == 20);
420  NS_ASSERT(phySta->GetFrequency() == 5180);
421  PrintAttributesIfEnabled(printAttributes);
422  break;
423  case 20:
424  // Set both channel and frequency to consistent values before initialization
425  Config::SetDefault("ns3::WifiPhy::ChannelSettings", StringValue("{40, 0, BAND_5GHZ, 0}"));
426  wifi.SetStandard(WIFI_STANDARD_80211n);
427  staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
428  apDevice = wifi.Install(phy, macAp, wifiApNode.Get(0));
429  phySta = GetYansWifiPhyPtr(staDevice);
430  NS_ASSERT(phySta->GetChannelNumber() == 40);
431  NS_ASSERT(phySta->GetChannelWidth() == 20);
432  NS_ASSERT(phySta->GetFrequency() == 5200);
433  // Set both channel and frequency to consistent values after initialization
434  wifi.SetStandard(WIFI_STANDARD_80211n);
435  staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
436  apDevice = wifi.Install(phy, macAp, wifiApNode.Get(0));
437  phySta = GetYansWifiPhyPtr(staDevice);
438  phySta->SetAttribute("ChannelSettings", StringValue("{40, 0, BAND_5GHZ, 0}"));
439  NS_ASSERT(phySta->GetChannelNumber() == 40);
440  NS_ASSERT(phySta->GetChannelWidth() == 20);
441  NS_ASSERT(phySta->GetFrequency() == 5200);
442  exceptionThrown = false;
443  try
444  {
445  phySta->SetAttribute("ChannelSettings", StringValue("{45, 0, BAND_5GHZ, 0}"));
446  }
447  catch (const std::runtime_error&)
448  {
449  exceptionThrown = true;
450  }
451  phySta->SetAttribute("ChannelSettings", StringValue("{36, 0, BAND_5GHZ, 0}"));
452  // We expect channel number to be 36 and an exception to be thrown
453  NS_ASSERT(phySta->GetChannelNumber() == 36);
454  NS_ASSERT(phySta->GetChannelWidth() == 20);
455  NS_ASSERT(phySta->GetFrequency() == 5180);
456  NS_ASSERT(exceptionThrown);
457  phySta->SetAttribute("ChannelSettings", StringValue("{36, 0, BAND_5GHZ, 0}"));
458  exceptionThrown = false;
459  try
460  {
461  phySta->SetAttribute("ChannelSettings", StringValue("{43, 0, BAND_5GHZ, 0}"));
462  }
463  catch (const std::runtime_error&)
464  {
465  exceptionThrown = true;
466  }
467  // We expect channel number to be 36 and an exception to be thrown
468  NS_ASSERT(phySta->GetChannelNumber() == 36);
469  NS_ASSERT(phySta->GetChannelWidth() == 20);
470  NS_ASSERT(phySta->GetFrequency() == 5180);
471  NS_ASSERT(exceptionThrown);
472  PrintAttributesIfEnabled(printAttributes);
473  break;
474  default:
475  std::cerr << "Invalid testcase number " << testCase << std::endl;
476  exit(1);
477  break;
478  }
479 
480  // No need to Simulator::Run (); this is a configuration example
482 }
Parse command-line arguments.
Definition: command-line.h:232
void ConfigureAttributes()
Configure the attribute values.
holds a vector of ns3::NetDevice pointers
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:204
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
Definition: object.h:471
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition: simulator.cc:142
The IEEE 802.11 SSID Information Element.
Definition: ssid.h:36
Hold variables of type string.
Definition: string.h:56
helps to create WifiNetDevice objects
Definition: wifi-helper.h:324
create MAC layers for a ns3::WifiNetDevice.
void SetType(std::string type, Args &&... args)
Hold together all Wifi-related objects.
Ptr< WifiPhy > GetPhy() const
uint16_t GetChannelWidth() const
Definition: wifi-phy.cc:1051
uint16_t GetFrequency() const
Definition: wifi-phy.cc:1039
void SetOperatingChannel(const ChannelTuple &channelTuple)
If the standard for this object has not been set yet, store the given channel settings.
Definition: wifi-phy.cc:1098
uint8_t GetChannelNumber() const
Return current channel number.
Definition: wifi-phy.cc:1045
std::tuple< uint8_t, uint16_t, WifiPhyBand, uint8_t > ChannelTuple
Tuple identifying an operating channel.
Definition: wifi-phy.h:891
const WifiPhyOperatingChannel & GetOperatingChannel() const
Get a const reference to the operating channel.
Definition: wifi-phy.cc:1033
bool IsSet() const
Return true if a valid channel has been set, false otherwise.
manage and create wifi channel objects for the YANS model.
static YansWifiChannelHelper Default()
Create a channel helper in a default working state.
Make it easy to create and manage PHY objects for the YANS model.
802.11 PHY layer model
Definition: yans-wifi-phy.h:48
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:66
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:890
void Set(std::string path, const AttributeValue &value)
Definition: config.cc:876
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1350
@ WIFI_STANDARD_80211a
@ WIFI_STANDARD_80211p
@ WIFI_STANDARD_80211n
@ WIFI_STANDARD_80211g
@ WIFI_STANDARD_80211ax
@ WIFI_STANDARD_80211ac
@ WIFI_STANDARD_80211b
@ WIFI_PHY_BAND_5GHZ
The 5 GHz band.
Definition: wifi-phy-band.h:37
NLOHMANN_BASIC_JSON_TPL_DECLARATION std::string to_string(const NLOHMANN_BASIC_JSON_TPL &j)
user-defined to_string function for JSON values
Definition: json.h:25255
Every class exported by the ns3 library is enclosed in the ns3 namespace.
cmd
Definition: second.py:40
ssid
Definition: third.py:93
channel
Definition: third.py:88
wifi
Definition: third.py:95
wifiApNode
Definition: third.py:86
phy
Definition: third.py:89
Ptr< YansWifiPhy > GetYansWifiPhyPtr(const NetDeviceContainer &nc)
Get the Yans Wifi Phy Ptr object for the 1st node in the NodeContainer.
void PrintAttributesIfEnabled(bool enabled)
Print the attributes to a file.