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