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