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 
26 #include <iomanip>
27 #include "ns3/core-module.h"
28 #include "ns3/applications-module.h"
29 #include "ns3/wifi-module.h"
30 #include "ns3/mobility-module.h"
31 #include "ns3/spectrum-module.h"
32 #include "ns3/internet-module.h"
33 
34 // This is a simple example of an IEEE 802.11n Wi-Fi network.
35 //
36 // The main use case is to enable and test SpectrumWifiPhy vs YansWifiPhy
37 // under saturation conditions (for max throughput).
38 //
39 // Network topology:
40 //
41 // Wi-Fi 192.168.1.0
42 //
43 // STA AP
44 // * <-- distance --> *
45 // | |
46 // n1 n2
47 //
48 // Users may vary the following command-line arguments in addition to the
49 // attributes, global values, and default values typically available:
50 //
51 // --simulationTime: Simulation time in seconds [10]
52 // --distance: meters separation between nodes [50]
53 // --index: restrict index to single value between 0 and 31 [256]
54 // --wifiType: select ns3::SpectrumWifiPhy or ns3::YansWifiPhy [ns3::SpectrumWifiPhy]
55 // --errorModelType: select ns3::NistErrorRateModel or ns3::YansErrorRateModel [ns3::NistErrorRateModel]
56 // --enablePcap: enable pcap output [false]
57 //
58 // By default, the program will step through 64 index values, corresponding
59 // to the following MCS, channel width, and guard interval combinations:
60 // index 0-7: MCS 0-7, long guard interval, 20 MHz channel
61 // index 8-15: MCS 0-7, short guard interval, 20 MHz channel
62 // index 16-23: MCS 0-7, long guard interval, 40 MHz channel
63 // index 24-31: MCS 0-7, short guard interval, 40 MHz channel
64 // index 32-39: MCS 8-15, long guard interval, 20 MHz channel
65 // index 40-47: MCS 8-15, short guard interval, 20 MHz channel
66 // index 48-55: MCS 8-15, long guard interval, 40 MHz channel
67 // index 56-63: MCS 8-15, short guard interval, 40 MHz channel
68 // and send packets at a high rate using each MCS, using the SpectrumWifiPhy
69 // and the NistErrorRateModel, at a distance of 1 meter. The program outputs
70 // results such as:
71 //
72 // wifiType: ns3::SpectrumWifiPhy distance: 1m
73 // index MCS width Rate (Mb/s) Tput (Mb/s) Received
74 // 0 0 20 6.5 5.96219 5063
75 // 1 1 20 13 11.9491 10147
76 // 2 2 20 19.5 17.9184 15216
77 // 3 3 20 26 23.9253 20317
78 // ...
79 //
80 // selection of index values 32-63 will result in MCS selection 8-15
81 // involving two spatial streams
82 
83 using namespace ns3;
84 
85 NS_LOG_COMPONENT_DEFINE ("WifiSpectrumSaturationExample");
86 
87 int main (int argc, char *argv[])
88 {
89  double distance = 1;
90  double simulationTime = 10; //seconds
91  uint16_t index = 256;
92  uint32_t channelWidth = 0;
93  std::string wifiType = "ns3::SpectrumWifiPhy";
94  std::string errorModelType = "ns3::NistErrorRateModel";
95  bool enablePcap = false;
96 
98  cmd.AddValue ("simulationTime", "Simulation time in seconds", simulationTime);
99  cmd.AddValue ("distance", "meters separation between nodes", distance);
100  cmd.AddValue ("index", "restrict index to single value between 0 and 63", index);
101  cmd.AddValue ("wifiType", "select ns3::SpectrumWifiPhy or ns3::YansWifiPhy", wifiType);
102  cmd.AddValue ("errorModelType", "select ns3::NistErrorRateModel or ns3::YansErrorRateModel", errorModelType);
103  cmd.AddValue ("enablePcap", "enable pcap output", enablePcap);
104  cmd.Parse (argc,argv);
105 
106  uint16_t startIndex = 0;
107  uint16_t stopIndex = 63;
108  if (index < 64)
109  {
110  startIndex = index;
111  stopIndex = index;
112  }
113 
114  std::cout << "wifiType: " << wifiType << " distance: " << distance << "m" << std::endl;
115  std::cout << std::setw (5) << "index" <<
116  std::setw (6) << "MCS" <<
117  std::setw (8) << "width" <<
118  std::setw (12) << "Rate (Mb/s)" <<
119  std::setw (12) << "Tput (Mb/s)" <<
120  std::setw (10) << "Received " <<
121  std::endl;
122  for (uint16_t i = startIndex; i <= stopIndex; i++)
123  {
124  uint32_t payloadSize;
125  payloadSize = 1472; // 1500 bytes IPv4
126 
127  NodeContainer wifiStaNode;
128  wifiStaNode.Create (1);
130  wifiApNode.Create (1);
131 
134  if (wifiType == "ns3::YansWifiPhy")
135  {
137  channel.AddPropagationLoss ("ns3::FriisPropagationLossModel");
138  channel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
139  phy.SetChannel (channel.Create ());
140  phy.Set ("TxPowerStart", DoubleValue (1));
141  phy.Set ("TxPowerEnd", DoubleValue (1));
142 
143  if (i <= 7)
144  {
145  phy.Set ("ShortGuardEnabled", BooleanValue (false));
146  channelWidth = 20;
147  }
148  else if (i > 7 && i <= 15)
149  {
150  phy.Set ("ShortGuardEnabled", BooleanValue (true));
151  channelWidth = 20;
152  }
153  else if (i > 15 && i <= 23)
154  {
155  phy.Set ("ShortGuardEnabled", BooleanValue (false));
156  channelWidth = 40;
157  }
158  else if (i > 23 && i <= 31)
159  {
160  phy.Set ("ShortGuardEnabled", BooleanValue (true));
161  channelWidth = 40;
162  }
163  else if (i > 31 && i <= 39)
164  {
165  phy.Set ("ShortGuardEnabled", BooleanValue (false));
166  phy.Set ("Antennas", UintegerValue (2));
167  phy.Set ("MaxSupportedTxSpatialStreams", UintegerValue (2));
168  phy.Set ("MaxSupportedRxSpatialStreams", UintegerValue (2));
169  channelWidth = 20;
170  }
171  else if (i > 39 && i <= 47)
172  {
173  phy.Set ("ShortGuardEnabled", BooleanValue (true));
174  phy.Set ("Antennas", UintegerValue (2));
175  phy.Set ("MaxSupportedTxSpatialStreams", UintegerValue (2));
176  phy.Set ("MaxSupportedRxSpatialStreams", UintegerValue (2));
177  channelWidth = 20;
178  }
179  else if (i > 47 && i <= 55)
180  {
181  phy.Set ("ShortGuardEnabled", BooleanValue (false));
182  phy.Set ("Antennas", UintegerValue (2));
183  phy.Set ("MaxSupportedTxSpatialStreams", UintegerValue (2));
184  phy.Set ("MaxSupportedRxSpatialStreams", UintegerValue (2));
185  channelWidth = 40;
186  }
187  else if (i > 55 && i <= 63)
188  {
189  phy.Set ("ShortGuardEnabled", BooleanValue (true));
190  phy.Set ("Antennas", UintegerValue (2));
191  phy.Set ("MaxSupportedTxSpatialStreams", UintegerValue (2));
192  phy.Set ("MaxSupportedRxSpatialStreams", UintegerValue (2));
193  channelWidth = 40;
194  }
195  }
196  else if (wifiType == "ns3::SpectrumWifiPhy")
197  {
198  //Bug 2460: CcaMode1Threshold default should be set to -62 dBm when using Spectrum
199  Config::SetDefault ("ns3::WifiPhy::CcaMode1Threshold", DoubleValue (-62.0));
200 
201  Ptr<SingleModelSpectrumChannel> spectrumChannel
202  = CreateObject<SingleModelSpectrumChannel> ();
204  = CreateObject<FriisPropagationLossModel> ();
205  spectrumChannel->AddPropagationLossModel (lossModel);
206 
208  = CreateObject<ConstantSpeedPropagationDelayModel> ();
209  spectrumChannel->SetPropagationDelayModel (delayModel);
210 
211  spectrumPhy.SetChannel (spectrumChannel);
212  spectrumPhy.SetErrorRateModel (errorModelType);
213  spectrumPhy.Set ("Frequency", UintegerValue (5180)); // channel 36 at 20 MHz
214  spectrumPhy.Set ("TxPowerStart", DoubleValue (1));
215  spectrumPhy.Set ("TxPowerEnd", DoubleValue (1));
216 
217  if (i <= 7)
218  {
219  spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (false));
220  channelWidth = 20;
221  }
222  else if (i > 7 && i <= 15)
223  {
224  spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (true));
225  channelWidth = 20;
226  }
227  else if (i > 15 && i <= 23)
228  {
229  spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (false));
230  channelWidth = 40;
231  }
232  else if (i > 23 && i <= 31)
233  {
234  spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (true));
235  channelWidth = 40;
236  }
237  else if (i > 31 && i <= 39)
238  {
239  spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (false));
240  spectrumPhy.Set ("Antennas", UintegerValue (2));
241  spectrumPhy.Set ("MaxSupportedTxSpatialStreams", UintegerValue (2));
242  spectrumPhy.Set ("MaxSupportedRxSpatialStreams", UintegerValue (2));
243  channelWidth = 20;
244  }
245  else if (i > 39 && i <= 47)
246  {
247  spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (true));
248  spectrumPhy.Set ("Antennas", UintegerValue (2));
249  spectrumPhy.Set ("MaxSupportedTxSpatialStreams", UintegerValue (2));
250  spectrumPhy.Set ("MaxSupportedRxSpatialStreams", UintegerValue (2));
251  channelWidth = 20;
252  }
253  else if (i > 47 && i <= 55)
254  {
255  spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (false));
256  spectrumPhy.Set ("Antennas", UintegerValue (2));
257  spectrumPhy.Set ("MaxSupportedTxSpatialStreams", UintegerValue (2));
258  spectrumPhy.Set ("MaxSupportedRxSpatialStreams", UintegerValue (2));
259  channelWidth = 40;
260  }
261  else if (i > 55 && i <= 63)
262  {
263  spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (true));
264  spectrumPhy.Set ("Antennas", UintegerValue (2));
265  spectrumPhy.Set ("MaxSupportedTxSpatialStreams", UintegerValue (2));
266  spectrumPhy.Set ("MaxSupportedRxSpatialStreams", UintegerValue (2));
267  channelWidth = 40;
268  }
269  }
270  else
271  {
272  NS_FATAL_ERROR ("Unsupported WiFi type " << wifiType);
273  }
274 
278 
279  Ssid ssid = Ssid ("ns380211n");
280 
281  double datarate = 0;
283  if (i == 0)
284  {
285  DataRate = StringValue ("HtMcs0");
286  datarate = 6.5;
287  }
288  else if (i == 1)
289  {
290  DataRate = StringValue ("HtMcs1");
291  datarate = 13;
292  }
293  else if (i == 2)
294  {
295  DataRate = StringValue ("HtMcs2");
296  datarate = 19.5;
297  }
298  else if (i == 3)
299  {
300  DataRate = StringValue ("HtMcs3");
301  datarate = 26;
302  }
303  else if (i == 4)
304  {
305  DataRate = StringValue ("HtMcs4");
306  datarate = 39;
307  }
308  else if (i == 5)
309  {
310  DataRate = StringValue ("HtMcs5");
311  datarate = 52;
312  }
313  else if (i == 6)
314  {
315  DataRate = StringValue ("HtMcs6");
316  datarate = 58.5;
317  }
318  else if (i == 7)
319  {
320  DataRate = StringValue ("HtMcs7");
321  datarate = 65;
322  }
323  else if (i == 8)
324  {
325  DataRate = StringValue ("HtMcs0");
326  datarate = 7.2;
327  }
328  else if (i == 9)
329  {
330  DataRate = StringValue ("HtMcs1");
331  datarate = 14.4;
332  }
333  else if (i == 10)
334  {
335  DataRate = StringValue ("HtMcs2");
336  datarate = 21.7;
337  }
338  else if (i == 11)
339  {
340  DataRate = StringValue ("HtMcs3");
341  datarate = 28.9;
342  }
343  else if (i == 12)
344  {
345  DataRate = StringValue ("HtMcs4");
346  datarate = 43.3;
347  }
348  else if (i == 13)
349  {
350  DataRate = StringValue ("HtMcs5");
351  datarate = 57.8;
352  }
353  else if (i == 14)
354  {
355  DataRate = StringValue ("HtMcs6");
356  datarate = 65;
357  }
358  else if (i == 15)
359  {
360  DataRate = StringValue ("HtMcs7");
361  datarate = 72.2;
362  }
363  else if (i == 16)
364  {
365  DataRate = StringValue ("HtMcs0");
366  datarate = 13.5;
367  }
368  else if (i == 17)
369  {
370  DataRate = StringValue ("HtMcs1");
371  datarate = 27;
372  }
373  else if (i == 18)
374  {
375  DataRate = StringValue ("HtMcs2");
376  datarate = 40.5;
377  }
378  else if (i == 19)
379  {
380  DataRate = StringValue ("HtMcs3");
381  datarate = 54;
382  }
383  else if (i == 20)
384  {
385  DataRate = StringValue ("HtMcs4");
386  datarate = 81;
387  }
388  else if (i == 21)
389  {
390  DataRate = StringValue ("HtMcs5");
391  datarate = 108;
392  }
393  else if (i == 22)
394  {
395  DataRate = StringValue ("HtMcs6");
396  datarate = 121.5;
397  }
398  else if (i == 23)
399  {
400  DataRate = StringValue ("HtMcs7");
401  datarate = 135;
402  }
403  else if (i == 24)
404  {
405  DataRate = StringValue ("HtMcs0");
406  datarate = 15;
407  }
408  else if (i == 25)
409  {
410  DataRate = StringValue ("HtMcs1");
411  datarate = 30;
412  }
413  else if (i == 26)
414  {
415  DataRate = StringValue ("HtMcs2");
416  datarate = 45;
417  }
418  else if (i == 27)
419  {
420  DataRate = StringValue ("HtMcs3");
421  datarate = 60;
422  }
423  else if (i == 28)
424  {
425  DataRate = StringValue ("HtMcs4");
426  datarate = 90;
427  }
428  else if (i == 29)
429  {
430  DataRate = StringValue ("HtMcs5");
431  datarate = 120;
432  }
433  else if (i == 30)
434  {
435  DataRate = StringValue ("HtMcs6");
436  datarate = 135;
437  }
438  else if (i == 31)
439  {
440  DataRate = StringValue ("HtMcs7");
441  datarate = 150;
442  }
443  else if (i == 32)
444  {
445  DataRate = StringValue ("HtMcs8");
446  datarate = 13;
447  }
448  else if (i == 33)
449  {
450  DataRate = StringValue ("HtMcs9");
451  datarate = 26;
452  }
453  else if (i == 34)
454  {
455  DataRate = StringValue ("HtMcs10");
456  datarate = 39;
457  }
458  else if (i == 35)
459  {
460  DataRate = StringValue ("HtMcs11");
461  datarate = 52;
462  }
463  else if (i == 36)
464  {
465  DataRate = StringValue ("HtMcs12");
466  datarate = 78;
467  }
468  else if (i == 37)
469  {
470  DataRate = StringValue ("HtMcs13");
471  datarate = 104;
472  }
473  else if (i == 38)
474  {
475  DataRate = StringValue ("HtMcs14");
476  datarate = 117;
477  }
478  else if (i == 39)
479  {
480  DataRate = StringValue ("HtMcs15");
481  datarate = 130;
482  }
483  else if (i == 40)
484  {
485  DataRate = StringValue ("HtMcs8");
486  datarate = 14.4;
487  }
488  else if (i == 41)
489  {
490  DataRate = StringValue ("HtMcs9");
491  datarate = 28.9;
492  }
493  else if (i == 42)
494  {
495  DataRate = StringValue ("HtMcs10");
496  datarate = 43.3;
497  }
498  else if (i == 43)
499  {
500  DataRate = StringValue ("HtMcs11");
501  datarate = 57.8;
502  }
503  else if (i == 44)
504  {
505  DataRate = StringValue ("HtMcs12");
506  datarate = 86.7;
507  }
508  else if (i == 45)
509  {
510  DataRate = StringValue ("HtMcs13");
511  datarate = 115.6;
512  }
513  else if (i == 46)
514  {
515  DataRate = StringValue ("HtMcs14");
516  datarate = 130.3;
517  }
518  else if (i == 47)
519  {
520  DataRate = StringValue ("HtMcs15");
521  datarate = 144.4;
522  }
523  else if (i == 48)
524  {
525  DataRate = StringValue ("HtMcs8");
526  datarate = 27;
527  }
528  else if (i == 49)
529  {
530  DataRate = StringValue ("HtMcs9");
531  datarate = 54;
532  }
533  else if (i == 50)
534  {
535  DataRate = StringValue ("HtMcs10");
536  datarate = 81;
537  }
538  else if (i == 51)
539  {
540  DataRate = StringValue ("HtMcs11");
541  datarate = 108;
542  }
543  else if (i == 52)
544  {
545  DataRate = StringValue ("HtMcs12");
546  datarate = 162;
547  }
548  else if (i == 53)
549  {
550  DataRate = StringValue ("HtMcs13");
551  datarate = 216;
552  }
553  else if (i == 54)
554  {
555  DataRate = StringValue ("HtMcs14");
556  datarate = 243;
557  }
558  else if (i == 55)
559  {
560  DataRate = StringValue ("HtMcs15");
561  datarate = 270;
562  }
563  else if (i == 56)
564  {
565  DataRate = StringValue ("HtMcs8");
566  datarate = 30;
567  }
568  else if (i == 57)
569  {
570  DataRate = StringValue ("HtMcs9");
571  datarate = 60;
572  }
573  else if (i == 58)
574  {
575  DataRate = StringValue ("HtMcs10");
576  datarate = 90;
577  }
578  else if (i == 59)
579  {
580  DataRate = StringValue ("HtMcs11");
581  datarate = 120;
582  }
583  else if (i == 60)
584  {
585  DataRate = StringValue ("HtMcs12");
586  datarate = 180;
587  }
588  else if (i == 61)
589  {
590  DataRate = StringValue ("HtMcs13");
591  datarate = 240;
592  }
593  else if (i == 62)
594  {
595  DataRate = StringValue ("HtMcs14");
596  datarate = 270;
597  }
598  else if (i == 63)
599  {
600  DataRate = StringValue ("HtMcs15");
601  datarate = 300;
602  }
603  else
604  {
605  NS_FATAL_ERROR ("Illegal index i " << i);
606  }
607 
608  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager","DataMode", DataRate,
609  "ControlMode", DataRate);
610 
611  NetDeviceContainer staDevice;
612  NetDeviceContainer apDevice;
613 
614  if (wifiType == "ns3::YansWifiPhy")
615  {
616  mac.SetType ("ns3::StaWifiMac",
617  "Ssid", SsidValue (ssid),
618  "ActiveProbing", BooleanValue (false));
619  staDevice = wifi.Install (phy, mac, wifiStaNode);
620  mac.SetType ("ns3::ApWifiMac",
621  "Ssid", SsidValue (ssid));
622  apDevice = wifi.Install (phy, mac, wifiApNode);
623 
624  }
625  else if (wifiType == "ns3::SpectrumWifiPhy")
626  {
627  mac.SetType ("ns3::StaWifiMac",
628  "Ssid", SsidValue (ssid),
629  "ActiveProbing", BooleanValue (false));
630  staDevice = wifi.Install (spectrumPhy, mac, wifiStaNode);
631  mac.SetType ("ns3::ApWifiMac",
632  "Ssid", SsidValue (ssid));
633  apDevice = wifi.Install (spectrumPhy, mac, wifiApNode);
634  }
635 
636  // Channel width must be set *after* installation because the attribute
637  // is overwritten by the ConfigureStandard method ()
638  Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", UintegerValue (channelWidth));
639 
640  // mobility.
642  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
643 
644  positionAlloc->Add (Vector (0.0, 0.0, 0.0));
645  positionAlloc->Add (Vector (distance, 0.0, 0.0));
646  mobility.SetPositionAllocator (positionAlloc);
647 
648  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
649 
650  mobility.Install (wifiApNode);
651  mobility.Install (wifiStaNode);
652 
653  /* Internet stack*/
655  stack.Install (wifiApNode);
656  stack.Install (wifiStaNode);
657 
659  address.SetBase ("192.168.1.0", "255.255.255.0");
660  Ipv4InterfaceContainer staNodeInterface;
661  Ipv4InterfaceContainer apNodeInterface;
662 
663  staNodeInterface = address.Assign (staDevice);
664  apNodeInterface = address.Assign (apDevice);
665 
666  /* Setting applications */
667  uint16_t port = 9;
668  UdpServerHelper server (port);
669  ApplicationContainer serverApp = server.Install (wifiStaNode.Get (0));
670  serverApp.Start (Seconds (0.0));
671  serverApp.Stop (Seconds (simulationTime + 1));
672 
673  UdpClientHelper client (staNodeInterface.GetAddress (0), port);
674  client.SetAttribute ("MaxPackets", UintegerValue (4294967295u));
675  client.SetAttribute ("Interval", TimeValue (Time ("0.00002"))); //packets/s
676  client.SetAttribute ("PacketSize", UintegerValue (payloadSize));
677  ApplicationContainer clientApp = client.Install (wifiApNode.Get (0));
678  clientApp.Start (Seconds (1.0));
679  clientApp.Stop (Seconds (simulationTime + 1));
680 
681  if (enablePcap)
682  {
683  std::stringstream ss;
684  ss << "wifi-spectrum-saturation-example-" << i;
685  phy.EnablePcap (ss.str (), apDevice);
686  }
687 
688  Simulator::Stop (Seconds (simulationTime + 1));
689  Simulator::Run ();
690 
691  double throughput;
692  uint32_t totalPacketsThrough;
693  totalPacketsThrough = DynamicCast<UdpServer> (serverApp.Get (0))->GetReceived ();
694  throughput = totalPacketsThrough * payloadSize * 8 / (simulationTime * 1000000.0); //Mbit/s
695  std::cout << std::setw (5) << i <<
696  std::setw (6) << (i % 8) + 8 * (i / 32) <<
697  std::setw (8) << channelWidth <<
698  std::setw (10) << datarate <<
699  std::setw (12) << throughput <<
700  std::setw (8) << totalPacketsThrough <<
701  std::endl;
703  }
704  return 0;
705 }
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:132
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:36
HT 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:719
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:777
bool enablePcap
static void Run(void)
Run the simulation.
Definition: simulator.cc:226
#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)
Add the single-frequency propagation loss model to be used.
helps to create WifiNetDevice objects
Definition: wifi-helper.h:213
tuple cmd
Definition: second.py:35
uint16_t port
Definition: dsdv-manet.cc:44
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:1055
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:742
Create a server application which waits for input UDP packets and uses the information carried into t...
virtual NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &mac, NodeContainer::Iterator first, NodeContainer::Iterator last) const
Definition: wifi-helper.cc:748
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:190
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:138
tuple stack
Definition: first.py:34
The IEEE 802.11 SSID Information Element.
Definition: ssid.h:35
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:498
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
Definition: simulator.cc:234
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:993
AttributeValue implementation for Ssid.
Definition: ssid.h:117
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:782
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.