A Discrete-Event Network Simulator
API
wifi-spectrum-saturation-example.cc
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2009 MIRKO BANCHI
4  * Copyright (c) 2015 University of Washington
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Authors: Mirko Banchi <mk.banchi@gmail.com>
20  * Sebastien Deronne <sebastien.deronne@gmail.com>
21  * Tom Henderson <tomhend@u.washington.edu>
22  *
23  * Adapted from ht-wifi-network.cc example
24  */
25 #include <sstream>
26 #include <iomanip>
27 
28 #include "ns3/core-module.h"
29 #include "ns3/config-store-module.h"
30 #include "ns3/network-module.h"
31 #include "ns3/applications-module.h"
32 #include "ns3/wifi-module.h"
33 #include "ns3/mobility-module.h"
34 #include "ns3/spectrum-module.h"
35 #include "ns3/internet-module.h"
36 
37 // This is a simple example of an IEEE 802.11n Wi-Fi network.
38 //
39 // The main use case is to enable and test SpectrumWifiPhy vs YansWifiPhy
40 // under saturation conditions (for max throughput).
41 //
42 // Network topology:
43 //
44 // Wi-Fi 192.168.1.0
45 //
46 // STA AP
47 // * <-- distance --> *
48 // | |
49 // n1 n2
50 //
51 // Users may vary the following command-line arguments in addition to the
52 // attributes, global values, and default values typically available:
53 //
54 // --simulationTime: Simulation time in seconds [10]
55 // --distance: meters separation between nodes [50]
56 // --index: restrict index to single value between 0 and 31 [256]
57 // --wifiType: select ns3::SpectrumWifiPhy or ns3::YansWifiPhy [ns3::SpectrumWifiPhy]
58 // --errorModelType: select ns3::NistErrorRateModel or ns3::YansErrorRateModel [ns3::NistErrorRateModel]
59 // --enablePcap: enable pcap output [false]
60 //
61 // By default, the program will step through 64 index values, corresponding
62 // to the following MCS, channel width, and guard interval combinations:
63 // index 0-7: MCS 0-7, long guard interval, 20 MHz channel
64 // index 8-15: MCS 0-7, short guard interval, 20 MHz channel
65 // index 16-23: MCS 0-7, long guard interval, 40 MHz channel
66 // index 24-31: MCS 0-7, short guard interval, 40 MHz channel
67 // index 32-39: MCS 8-15, long guard interval, 20 MHz channel
68 // index 40-47: MCS 8-15, short guard interval, 20 MHz channel
69 // index 48-55: MCS 8-15, long guard interval, 40 MHz channel
70 // index 56-63: MCS 8-15, short guard interval, 40 MHz channel
71 // and send packets at a high rate using each MCS, using the SpectrumWifiPhy
72 // and the NistErrorRateModel, at a distance of 1 meter. The program outputs
73 // results such as:
74 //
75 // wifiType: ns3::SpectrumWifiPhy distance: 1m
76 // index MCS width Rate (Mb/s) Tput (Mb/s) Received
77 // 0 0 20 6.5 5.96219 5063
78 // 1 1 20 13 11.9491 10147
79 // 2 2 20 19.5 17.9184 15216
80 // 3 3 20 26 23.9253 20317
81 // ...
82 //
83 // selection of index values 32-63 will result in MCS selection 8-15
84 // involving two spatial streams
85 
86 using namespace ns3;
87 
88 NS_LOG_COMPONENT_DEFINE ("WifiSpectrumSaturationExample");
89 
90 int main (int argc, char *argv[])
91 {
92  double distance = 1;
93  double simulationTime = 10; //seconds
94  uint16_t index = 256;
95  uint32_t channelWidth = 0;
96  std::string wifiType = "ns3::SpectrumWifiPhy";
97  std::string errorModelType = "ns3::NistErrorRateModel";
98  bool enablePcap = false;
99 
101  cmd.AddValue ("simulationTime", "Simulation time in seconds", simulationTime);
102  cmd.AddValue ("distance", "meters separation between nodes", distance);
103  cmd.AddValue ("index", "restrict index to single value between 0 and 63", index);
104  cmd.AddValue ("wifiType", "select ns3::SpectrumWifiPhy or ns3::YansWifiPhy", wifiType);
105  cmd.AddValue ("errorModelType", "select ns3::NistErrorRateModel or ns3::YansErrorRateModel", errorModelType);
106  cmd.AddValue ("enablePcap", "enable pcap output", enablePcap);
107  cmd.Parse (argc,argv);
108 
109  uint16_t startIndex = 0;
110  uint16_t stopIndex = 63;
111  if (index < 64)
112  {
113  startIndex = index;
114  stopIndex = index;
115  }
116 
117  std::cout << "wifiType: " << wifiType << " distance: " << distance << "m" << std::endl;
118  std::cout << std::setw (5) << "index" <<
119  std::setw (6) << "MCS" <<
120  std::setw (8) << "width" <<
121  std::setw (12) << "Rate (Mb/s)" <<
122  std::setw (12) << "Tput (Mb/s)" <<
123  std::setw (10) << "Received " <<
124  std::endl;
125  for (uint16_t i = startIndex; i <= stopIndex; i++)
126  {
127  uint32_t payloadSize;
128  payloadSize = 1472; // 1500 bytes IPv4
129 
130  NodeContainer wifiStaNode;
131  wifiStaNode.Create (1);
133  wifiApNode.Create (1);
134 
137  if (wifiType == "ns3::YansWifiPhy")
138  {
140  channel.AddPropagationLoss ("ns3::FriisPropagationLossModel");
141  channel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
142  phy.SetChannel (channel.Create ());
143  phy.Set ("TxPowerStart", DoubleValue (1));
144  phy.Set ("TxPowerEnd", DoubleValue (1));
145 
146  if (i <= 7)
147  {
148  phy.Set ("ShortGuardEnabled", BooleanValue (false));
149  channelWidth = 20;
150  }
151  else if (i > 7 && i <= 15)
152  {
153  phy.Set ("ShortGuardEnabled", BooleanValue (true));
154  channelWidth = 20;
155  }
156  else if (i > 15 && i <= 23)
157  {
158  phy.Set ("ShortGuardEnabled", BooleanValue (false));
159  channelWidth = 40;
160  }
161  else if (i > 23 && i <= 31)
162  {
163  phy.Set ("ShortGuardEnabled", BooleanValue (true));
164  channelWidth = 40;
165  }
166  else if (i > 31 && i <= 39)
167  {
168  phy.Set ("ShortGuardEnabled", BooleanValue (false));
169  phy.Set ("RxAntennas", UintegerValue (2));
170  phy.Set ("TxAntennas", UintegerValue (2));
171  channelWidth = 20;
172  }
173  else if (i > 39 && i <= 47)
174  {
175  phy.Set ("ShortGuardEnabled", BooleanValue (true));
176  phy.Set ("RxAntennas", UintegerValue (2));
177  phy.Set ("TxAntennas", UintegerValue (2));
178  channelWidth = 20;
179  }
180  else if (i > 47 && i <= 55)
181  {
182  phy.Set ("ShortGuardEnabled", BooleanValue (false));
183  phy.Set ("RxAntennas", UintegerValue (2));
184  phy.Set ("TxAntennas", UintegerValue (2));
185  channelWidth = 40;
186  }
187  else if (i > 55 && i <= 63)
188  {
189  phy.Set ("ShortGuardEnabled", BooleanValue (true));
190  phy.Set ("RxAntennas", UintegerValue (2));
191  phy.Set ("TxAntennas", UintegerValue (2));
192  channelWidth = 40;
193  }
194  }
195  else if (wifiType == "ns3::SpectrumWifiPhy")
196  {
197  //Bug 2460: CcaMode1Threshold default should be set to -62 dBm when using Spectrum
198  Config::SetDefault ("ns3::WifiPhy::CcaMode1Threshold", DoubleValue (-62.0));
199 
200  Ptr<SingleModelSpectrumChannel> spectrumChannel
201  = CreateObject<SingleModelSpectrumChannel> ();
203  = CreateObject<FriisPropagationLossModel> ();
204  spectrumChannel->AddPropagationLossModel (lossModel);
205 
207  = CreateObject<ConstantSpeedPropagationDelayModel> ();
208  spectrumChannel->SetPropagationDelayModel (delayModel);
209 
210  spectrumPhy.SetChannel (spectrumChannel);
211  spectrumPhy.SetErrorRateModel (errorModelType);
212  spectrumPhy.Set ("Frequency", UintegerValue (5180)); // channel 36 at 20 MHz
213  spectrumPhy.Set ("TxPowerStart", DoubleValue (1));
214  spectrumPhy.Set ("TxPowerEnd", DoubleValue (1));
215 
216  if (i <= 7)
217  {
218  spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (false));
219  channelWidth = 20;
220  }
221  else if (i > 7 && i <= 15)
222  {
223  spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (true));
224  channelWidth = 20;
225  }
226  else if (i > 15 && i <= 23)
227  {
228  spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (false));
229  channelWidth = 40;
230  }
231  else if (i > 23 && i <= 31)
232  {
233  spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (true));
234  channelWidth = 40;
235  }
236  else if (i > 31 && i <= 39)
237  {
238  spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (false));
239  spectrumPhy.Set ("RxAntennas", UintegerValue (2));
240  spectrumPhy.Set ("TxAntennas", UintegerValue (2));
241  channelWidth = 20;
242  }
243  else if (i > 39 && i <= 47)
244  {
245  spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (true));
246  spectrumPhy.Set ("RxAntennas", UintegerValue (2));
247  spectrumPhy.Set ("TxAntennas", UintegerValue (2));
248  channelWidth = 20;
249  }
250  else if (i > 47 && i <= 55)
251  {
252  spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (false));
253  spectrumPhy.Set ("RxAntennas", UintegerValue (2));
254  spectrumPhy.Set ("TxAntennas", UintegerValue (2));
255  channelWidth = 40;
256  }
257  else if (i > 55 && i <= 63)
258  {
259  spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (true));
260  spectrumPhy.Set ("RxAntennas", UintegerValue (2));
261  spectrumPhy.Set ("TxAntennas", UintegerValue (2));
262  channelWidth = 40;
263  }
264  }
265  else
266  {
267  NS_FATAL_ERROR ("Unsupported WiFi type " << wifiType);
268  }
269 
270 
274 
275  Ssid ssid = Ssid ("ns380211n");
276 
277  double datarate = 0;
279  if (i == 0)
280  {
281  DataRate = StringValue ("HtMcs0");
282  datarate = 6.5;
283  }
284  else if (i == 1)
285  {
286  DataRate = StringValue ("HtMcs1");
287  datarate = 13;
288  }
289  else if (i == 2)
290  {
291  DataRate = StringValue ("HtMcs2");
292  datarate = 19.5;
293  }
294  else if (i == 3)
295  {
296  DataRate = StringValue ("HtMcs3");
297  datarate = 26;
298  }
299  else if (i == 4)
300  {
301  DataRate = StringValue ("HtMcs4");
302  datarate = 39;
303  }
304  else if (i == 5)
305  {
306  DataRate = StringValue ("HtMcs5");
307  datarate = 52;
308  }
309  else if (i == 6)
310  {
311  DataRate = StringValue ("HtMcs6");
312  datarate = 58.5;
313  }
314  else if (i == 7)
315  {
316  DataRate = StringValue ("HtMcs7");
317  datarate = 65;
318  }
319  else if (i == 8)
320  {
321  DataRate = StringValue ("HtMcs0");
322  datarate = 7.2;
323  }
324  else if (i == 9)
325  {
326  DataRate = StringValue ("HtMcs1");
327  datarate = 14.4;
328  }
329  else if (i == 10)
330  {
331  DataRate = StringValue ("HtMcs2");
332  datarate = 21.7;
333  }
334  else if (i == 11)
335  {
336  DataRate = StringValue ("HtMcs3");
337  datarate = 28.9;
338  }
339  else if (i == 12)
340  {
341  DataRate = StringValue ("HtMcs4");
342  datarate = 43.3;
343  }
344  else if (i == 13)
345  {
346  DataRate = StringValue ("HtMcs5");
347  datarate = 57.8;
348  }
349  else if (i == 14)
350  {
351  DataRate = StringValue ("HtMcs6");
352  datarate = 65;
353  }
354  else if (i == 15)
355  {
356  DataRate = StringValue ("HtMcs7");
357  datarate = 72.2;
358  }
359  else if (i == 16)
360  {
361  DataRate = StringValue ("HtMcs0");
362  datarate = 13.5;
363  }
364  else if (i == 17)
365  {
366  DataRate = StringValue ("HtMcs1");
367  datarate = 27;
368  }
369  else if (i == 18)
370  {
371  DataRate = StringValue ("HtMcs2");
372  datarate = 40.5;
373  }
374  else if (i == 19)
375  {
376  DataRate = StringValue ("HtMcs3");
377  datarate = 54;
378  }
379  else if (i == 20)
380  {
381  DataRate = StringValue ("HtMcs4");
382  datarate = 81;
383  }
384  else if (i == 21)
385  {
386  DataRate = StringValue ("HtMcs5");
387  datarate = 108;
388  }
389  else if (i == 22)
390  {
391  DataRate = StringValue ("HtMcs6");
392  datarate = 121.5;
393  }
394  else if (i == 23)
395  {
396  DataRate = StringValue ("HtMcs7");
397  datarate = 135;
398  }
399  else if (i == 24)
400  {
401  DataRate = StringValue ("HtMcs0");
402  datarate = 15;
403  }
404  else if (i == 25)
405  {
406  DataRate = StringValue ("HtMcs1");
407  datarate = 30;
408  }
409  else if (i == 26)
410  {
411  DataRate = StringValue ("HtMcs2");
412  datarate = 45;
413  }
414  else if (i == 27)
415  {
416  DataRate = StringValue ("HtMcs3");
417  datarate = 60;
418  }
419  else if (i == 28)
420  {
421  DataRate = StringValue ("HtMcs4");
422  datarate = 90;
423  }
424  else if (i == 29)
425  {
426  DataRate = StringValue ("HtMcs5");
427  datarate = 120;
428  }
429  else if (i == 30)
430  {
431  DataRate = StringValue ("HtMcs6");
432  datarate = 135;
433  }
434  else if (i == 31)
435  {
436  DataRate = StringValue ("HtMcs7");
437  datarate = 150;
438  }
439  else if (i == 32)
440  {
441  DataRate = StringValue ("HtMcs8");
442  datarate = 13;
443  }
444  else if (i == 33)
445  {
446  DataRate = StringValue ("HtMcs9");
447  datarate = 26;
448  }
449  else if (i == 34)
450  {
451  DataRate = StringValue ("HtMcs10");
452  datarate = 39;
453  }
454  else if (i == 35)
455  {
456  DataRate = StringValue ("HtMcs11");
457  datarate = 52;
458  }
459  else if (i == 36)
460  {
461  DataRate = StringValue ("HtMcs12");
462  datarate = 78;
463  }
464  else if (i == 37)
465  {
466  DataRate = StringValue ("HtMcs13");
467  datarate = 104;
468  }
469  else if (i == 38)
470  {
471  DataRate = StringValue ("HtMcs14");
472  datarate = 117;
473  }
474  else if (i == 39)
475  {
476  DataRate = StringValue ("HtMcs15");
477  datarate = 130;
478  }
479  else if (i == 40)
480  {
481  DataRate = StringValue ("HtMcs8");
482  datarate = 14.4;
483  }
484  else if (i == 41)
485  {
486  DataRate = StringValue ("HtMcs9");
487  datarate = 28.9;
488  }
489  else if (i == 42)
490  {
491  DataRate = StringValue ("HtMcs10");
492  datarate = 43.3;
493  }
494  else if (i == 43)
495  {
496  DataRate = StringValue ("HtMcs11");
497  datarate = 57.8;
498  }
499  else if (i == 44)
500  {
501  DataRate = StringValue ("HtMcs12");
502  datarate = 86.7;
503  }
504  else if (i == 45)
505  {
506  DataRate = StringValue ("HtMcs13");
507  datarate = 115.6;
508  }
509  else if (i == 46)
510  {
511  DataRate = StringValue ("HtMcs14");
512  datarate = 130.3;
513  }
514  else if (i == 47)
515  {
516  DataRate = StringValue ("HtMcs15");
517  datarate = 144.4;
518  }
519  else if (i == 48)
520  {
521  DataRate = StringValue ("HtMcs8");
522  datarate = 27;
523  }
524  else if (i == 49)
525  {
526  DataRate = StringValue ("HtMcs9");
527  datarate = 54;
528  }
529  else if (i == 50)
530  {
531  DataRate = StringValue ("HtMcs10");
532  datarate = 81;
533  }
534  else if (i == 51)
535  {
536  DataRate = StringValue ("HtMcs11");
537  datarate = 108;
538  }
539  else if (i == 52)
540  {
541  DataRate = StringValue ("HtMcs12");
542  datarate = 162;
543  }
544  else if (i == 53)
545  {
546  DataRate = StringValue ("HtMcs13");
547  datarate = 216;
548  }
549  else if (i == 54)
550  {
551  DataRate = StringValue ("HtMcs14");
552  datarate = 243;
553  }
554  else if (i == 55)
555  {
556  DataRate = StringValue ("HtMcs15");
557  datarate = 270;
558  }
559  else if (i == 56)
560  {
561  DataRate = StringValue ("HtMcs8");
562  datarate = 30;
563  }
564  else if (i == 57)
565  {
566  DataRate = StringValue ("HtMcs9");
567  datarate = 60;
568  }
569  else if (i == 58)
570  {
571  DataRate = StringValue ("HtMcs10");
572  datarate = 90;
573  }
574  else if (i == 59)
575  {
576  DataRate = StringValue ("HtMcs11");
577  datarate = 120;
578  }
579  else if (i == 60)
580  {
581  DataRate = StringValue ("HtMcs12");
582  datarate = 180;
583  }
584  else if (i == 61)
585  {
586  DataRate = StringValue ("HtMcs13");
587  datarate = 240;
588  }
589  else if (i == 62)
590  {
591  DataRate = StringValue ("HtMcs14");
592  datarate = 270;
593  }
594  else if (i == 63)
595  {
596  DataRate = StringValue ("HtMcs15");
597  datarate = 300;
598  }
599  else
600  {
601  NS_FATAL_ERROR ("Illegal index i " << i);
602  }
603 
604  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager","DataMode", DataRate,
605  "ControlMode", DataRate);
606 
607  NetDeviceContainer staDevice;
608  NetDeviceContainer apDevice;
609 
610  if (wifiType == "ns3::YansWifiPhy")
611  {
612  mac.SetType ("ns3::StaWifiMac",
613  "Ssid", SsidValue (ssid),
614  "ActiveProbing", BooleanValue (false));
615  staDevice = wifi.Install (phy, mac, wifiStaNode);
616  mac.SetType ("ns3::ApWifiMac",
617  "Ssid", SsidValue (ssid));
618  apDevice = wifi.Install (phy, mac, wifiApNode);
619 
620  }
621  else if (wifiType == "ns3::SpectrumWifiPhy")
622  {
623  mac.SetType ("ns3::StaWifiMac",
624  "Ssid", SsidValue (ssid),
625  "ActiveProbing", BooleanValue (false));
626  staDevice = wifi.Install (spectrumPhy, mac, wifiStaNode);
627  mac.SetType ("ns3::ApWifiMac",
628  "Ssid", SsidValue (ssid));
629  apDevice = wifi.Install (spectrumPhy, mac, wifiApNode);
630  }
631 
632  // Channel width must be set *after* installation because the attribute
633  // is overwritten by the ConfigureStandard method ()
634  Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", UintegerValue (channelWidth));
635 
636  // mobility.
638  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
639 
640  positionAlloc->Add (Vector (0.0, 0.0, 0.0));
641  positionAlloc->Add (Vector (distance, 0.0, 0.0));
642  mobility.SetPositionAllocator (positionAlloc);
643 
644  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
645 
646  mobility.Install (wifiApNode);
647  mobility.Install (wifiStaNode);
648 
649  /* Internet stack*/
651  stack.Install (wifiApNode);
652  stack.Install (wifiStaNode);
653 
655 
656  address.SetBase ("192.168.1.0", "255.255.255.0");
657  Ipv4InterfaceContainer staNodeInterface;
658  Ipv4InterfaceContainer apNodeInterface;
659 
660  staNodeInterface = address.Assign (staDevice);
661  apNodeInterface = address.Assign (apDevice);
662 
663  /* Setting applications */
664  ApplicationContainer serverApp, sinkApp;
665  //UDP flow
666  UdpServerHelper myServer (9);
667  serverApp = myServer.Install (wifiStaNode.Get (0));
668  serverApp.Start (Seconds (0.0));
669  serverApp.Stop (Seconds (simulationTime + 1));
670 
671  UdpClientHelper myClient (staNodeInterface.GetAddress (0), 9);
672  myClient.SetAttribute ("MaxPackets", UintegerValue (4294967295u));
673  myClient.SetAttribute ("Interval", TimeValue (Time ("0.00002"))); //packets/s
674  myClient.SetAttribute ("PacketSize", UintegerValue (payloadSize));
675 
676  ApplicationContainer clientApp = myClient.Install (wifiApNode.Get (0));
677  clientApp.Start (Seconds (1.0));
678  clientApp.Stop (Seconds (simulationTime + 1));
679 
680  if (enablePcap)
681  {
682  std::stringstream ss;
683  ss << "wifi-spectrum-saturation-example-" << i;
684  phy.EnablePcap (ss.str (), apDevice);
685  }
686 
687  Simulator::Stop (Seconds (simulationTime + 1));
688  Simulator::Run ();
689 
690  double throughput;
691  uint32_t totalPacketsThrough;
692  totalPacketsThrough = DynamicCast<UdpServer> (serverApp.Get (0))->GetReceived ();
693  throughput = totalPacketsThrough * payloadSize * 8 / (simulationTime * 1000000.0); //Mbit/s
694  std::cout << std::setw (5) << i <<
695  std::setw (6) << (i % 8) + 8 * (i / 32) <<
696  std::setw (8) << channelWidth <<
697  std::setw (10) << datarate <<
698  std::setw (12) << throughput <<
699  std::setw (8) << totalPacketsThrough <<
700  std::endl;
702  }
703  return 0;
704 }
void AddPropagationLoss(std::string name, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
tuple channel
Definition: third.py:85
void Set(std::string name, const AttributeValue &v)
Definition: wifi-helper.cc:112
holds a vector of ns3::Application pointers.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
AttributeValue implementation for Boolean.
Definition: boolean.h:34
HT OFDM PHY for the 5 GHz band (clause 20)
holds a vector of std::pair of Ptr and interface index.
Ptr< YansWifiChannel > Create(void) const
void SetRemoteStationManager(std::string type, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
Definition: wifi-helper.cc:683
Hold variables of type string.
Definition: string.h:41
Make it easy to create and manage PHY objects for the yans model.
void Set(std::string path, const AttributeValue &value)
Definition: config.cc:769
bool enablePcap
static void Run(void)
Run the simulation.
Definition: simulator.cc:201
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:201
aggregate IP/TCP/UDP functionality to existing Nodes.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:162
static YansWifiPhyHelper Default(void)
Create a phy helper in a default working state.
virtual void AddPropagationLossModel(Ptr< PropagationLossModel > loss)
Set the single-frequency propagation loss model to be used.
helps to create WifiNetDevice objects
Definition: wifi-helper.h:231
tuple cmd
Definition: second.py:35
virtual NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &mac, NodeContainer c) const
Definition: wifi-helper.cc:712
Class for representing data rates.
Definition: data-rate.h:88
void SetChannel(Ptr< YansWifiChannel > channel)
void Install(Ptr< Node > node) const
"Layout" a single node according to the current position allocator type.
tuple mobility
Definition: third.py:101
tuple phy
Definition: third.py:86
Create a client application which sends UDP packets carrying a 32bit sequence number and a 64 bit tim...
static SpectrumWifiPhyHelper Default(void)
Create a phy helper in a default working state.
AttributeValue implementation for Time.
Definition: nstime.h:957
void SetChannel(Ptr< SpectrumChannel > channel)
Hold an unsigned integer type.
Definition: uinteger.h:44
holds a vector of ns3::NetDevice pointers
virtual void SetStandard(enum WifiPhyStandard standard)
Definition: wifi-helper.cc:706
Create a server application which waits for input UDP packets and uses the information carried into t...
tuple mac
Definition: third.py:92
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter...
Parse command-line arguments.
Definition: command-line.h:205
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
Definition: simulator.cc:165
tuple wifiApNode
Definition: third.py:83
void SetAttribute(std::string name, const AttributeValue &value)
Record an attribute to be set in each Application after it is is created.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
keep track of a set of node pointers.
Ptr< Application > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
void SetMobilityModel(std::string type, std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue(), std::string n8="", const AttributeValue &v8=EmptyAttributeValue(), std::string n9="", const AttributeValue &v9=EmptyAttributeValue())
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
tuple ssid
Definition: third.py:93
manage and create wifi channel objects for the yans model.
create MAC layers for a ns3::WifiNetDevice.
void SetErrorRateModel(std::string name, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
Definition: wifi-helper.cc:118
tuple stack
Definition: first.py:34
The IEEE 802.11 SSID Information Element.
Definition: ssid.h:38
virtual void SetType(std::string type, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue(), std::string n8="", const AttributeValue &v8=EmptyAttributeValue(), std::string n9="", const AttributeValue &v9=EmptyAttributeValue(), std::string n10="", const AttributeValue &v10=EmptyAttributeValue())
Helper class used to assign positions and mobility models to nodes.
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter...
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
void AddValue(const std::string &name, const std::string &help, T &value)
Add a program argument, assigning to POD.
Definition: command-line.h:495
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
Definition: simulator.cc:209
Ptr< Node > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:895
AttributeValue implementation for Ssid.
Definition: ssid.h:95
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:774
virtual void SetPropagationDelayModel(Ptr< PropagationDelayModel > delay)
Set the propagation delay model to be used.
void Add(Vector v)
Add a position to the list of positions.
void Parse(int argc, char *argv[])
Parse the program arguments.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
tuple wifi
Definition: third.py:89
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
tuple address
Definition: first.py:37
void SetPropagationDelay(std::string name, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
void EnablePcap(std::string prefix, Ptr< NetDevice > nd, bool promiscuous=false, bool explicitFilename=false)
Enable pcap output the indicated net device.
void SetPositionAllocator(Ptr< PositionAllocator > allocator)
Set the position allocator which will be used to allocate the initial position of every node initiali...
This class can be used to hold variables of floating point type such as 'double' or 'float'...
Definition: double.h:41
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
Make it easy to create and manage PHY objects for the spectrum model.