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 wifi-ht-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 
108  CommandLine cmd (__FILE__);
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 
144  SpectrumWifiPhyHelper spectrumPhy;
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 > 31 && i <= 39)
155  {
156  phy.Set ("Antennas", UintegerValue (2));
157  phy.Set ("MaxSupportedTxSpatialStreams", UintegerValue (2));
158  phy.Set ("MaxSupportedRxSpatialStreams", UintegerValue (2));
159  }
160  else if (i > 39 && i <= 47)
161  {
162  phy.Set ("Antennas", UintegerValue (2));
163  phy.Set ("MaxSupportedTxSpatialStreams", UintegerValue (2));
164  phy.Set ("MaxSupportedRxSpatialStreams", UintegerValue (2));
165  }
166  else if (i > 47 && i <= 55)
167  {
168  phy.Set ("Antennas", UintegerValue (2));
169  phy.Set ("MaxSupportedTxSpatialStreams", UintegerValue (2));
170  phy.Set ("MaxSupportedRxSpatialStreams", UintegerValue (2));
171  }
172  else if (i > 55 && i <= 63)
173  {
174  phy.Set ("Antennas", UintegerValue (2));
175  phy.Set ("MaxSupportedTxSpatialStreams", UintegerValue (2));
176  phy.Set ("MaxSupportedRxSpatialStreams", UintegerValue (2));
177  }
178  }
179  else if (wifiType == "ns3::SpectrumWifiPhy")
180  {
181  Ptr<MultiModelSpectrumChannel> spectrumChannel
182  = CreateObject<MultiModelSpectrumChannel> ();
184  = CreateObject<FriisPropagationLossModel> ();
185  spectrumChannel->AddPropagationLossModel (lossModel);
186 
188  = CreateObject<ConstantSpeedPropagationDelayModel> ();
189  spectrumChannel->SetPropagationDelayModel (delayModel);
190 
191  spectrumPhy.SetChannel (spectrumChannel);
192  spectrumPhy.SetErrorRateModel (errorModelType);
193  spectrumPhy.Set ("Frequency", UintegerValue (5180)); // channel 36 at 20 MHz
194  spectrumPhy.Set ("TxPowerStart", DoubleValue (1));
195  spectrumPhy.Set ("TxPowerEnd", DoubleValue (1));
196 
197  if (i > 31 && i <= 39)
198  {
199  spectrumPhy.Set ("Antennas", UintegerValue (2));
200  spectrumPhy.Set ("MaxSupportedTxSpatialStreams", UintegerValue (2));
201  spectrumPhy.Set ("MaxSupportedRxSpatialStreams", UintegerValue (2));
202  }
203  else if (i > 39 && i <= 47)
204  {
205  spectrumPhy.Set ("Antennas", UintegerValue (2));
206  spectrumPhy.Set ("MaxSupportedTxSpatialStreams", UintegerValue (2));
207  spectrumPhy.Set ("MaxSupportedRxSpatialStreams", UintegerValue (2));
208  }
209  else if (i > 47 && i <= 55)
210  {
211  spectrumPhy.Set ("Antennas", UintegerValue (2));
212  spectrumPhy.Set ("MaxSupportedTxSpatialStreams", UintegerValue (2));
213  spectrumPhy.Set ("MaxSupportedRxSpatialStreams", UintegerValue (2));
214  }
215  else if (i > 55 && i <= 63)
216  {
217  spectrumPhy.Set ("Antennas", UintegerValue (2));
218  spectrumPhy.Set ("MaxSupportedTxSpatialStreams", UintegerValue (2));
219  spectrumPhy.Set ("MaxSupportedRxSpatialStreams", UintegerValue (2));
220  }
221  }
222  else
223  {
224  NS_FATAL_ERROR ("Unsupported WiFi type " << wifiType);
225  }
226 
228  wifi.SetStandard (WIFI_STANDARD_80211n_5GHZ);
230 
231  Ssid ssid = Ssid ("ns380211n");
232 
233  double datarate = 0;
235  if (i == 0)
236  {
237  DataRate = StringValue ("HtMcs0");
238  datarate = 6.5;
239  }
240  else if (i == 1)
241  {
242  DataRate = StringValue ("HtMcs1");
243  datarate = 13;
244  }
245  else if (i == 2)
246  {
247  DataRate = StringValue ("HtMcs2");
248  datarate = 19.5;
249  }
250  else if (i == 3)
251  {
252  DataRate = StringValue ("HtMcs3");
253  datarate = 26;
254  }
255  else if (i == 4)
256  {
257  DataRate = StringValue ("HtMcs4");
258  datarate = 39;
259  }
260  else if (i == 5)
261  {
262  DataRate = StringValue ("HtMcs5");
263  datarate = 52;
264  }
265  else if (i == 6)
266  {
267  DataRate = StringValue ("HtMcs6");
268  datarate = 58.5;
269  }
270  else if (i == 7)
271  {
272  DataRate = StringValue ("HtMcs7");
273  datarate = 65;
274  }
275  else if (i == 8)
276  {
277  DataRate = StringValue ("HtMcs0");
278  datarate = 7.2;
279  }
280  else if (i == 9)
281  {
282  DataRate = StringValue ("HtMcs1");
283  datarate = 14.4;
284  }
285  else if (i == 10)
286  {
287  DataRate = StringValue ("HtMcs2");
288  datarate = 21.7;
289  }
290  else if (i == 11)
291  {
292  DataRate = StringValue ("HtMcs3");
293  datarate = 28.9;
294  }
295  else if (i == 12)
296  {
297  DataRate = StringValue ("HtMcs4");
298  datarate = 43.3;
299  }
300  else if (i == 13)
301  {
302  DataRate = StringValue ("HtMcs5");
303  datarate = 57.8;
304  }
305  else if (i == 14)
306  {
307  DataRate = StringValue ("HtMcs6");
308  datarate = 65;
309  }
310  else if (i == 15)
311  {
312  DataRate = StringValue ("HtMcs7");
313  datarate = 72.2;
314  }
315  else if (i == 16)
316  {
317  DataRate = StringValue ("HtMcs0");
318  datarate = 13.5;
319  }
320  else if (i == 17)
321  {
322  DataRate = StringValue ("HtMcs1");
323  datarate = 27;
324  }
325  else if (i == 18)
326  {
327  DataRate = StringValue ("HtMcs2");
328  datarate = 40.5;
329  }
330  else if (i == 19)
331  {
332  DataRate = StringValue ("HtMcs3");
333  datarate = 54;
334  }
335  else if (i == 20)
336  {
337  DataRate = StringValue ("HtMcs4");
338  datarate = 81;
339  }
340  else if (i == 21)
341  {
342  DataRate = StringValue ("HtMcs5");
343  datarate = 108;
344  }
345  else if (i == 22)
346  {
347  DataRate = StringValue ("HtMcs6");
348  datarate = 121.5;
349  }
350  else if (i == 23)
351  {
352  DataRate = StringValue ("HtMcs7");
353  datarate = 135;
354  }
355  else if (i == 24)
356  {
357  DataRate = StringValue ("HtMcs0");
358  datarate = 15;
359  }
360  else if (i == 25)
361  {
362  DataRate = StringValue ("HtMcs1");
363  datarate = 30;
364  }
365  else if (i == 26)
366  {
367  DataRate = StringValue ("HtMcs2");
368  datarate = 45;
369  }
370  else if (i == 27)
371  {
372  DataRate = StringValue ("HtMcs3");
373  datarate = 60;
374  }
375  else if (i == 28)
376  {
377  DataRate = StringValue ("HtMcs4");
378  datarate = 90;
379  }
380  else if (i == 29)
381  {
382  DataRate = StringValue ("HtMcs5");
383  datarate = 120;
384  }
385  else if (i == 30)
386  {
387  DataRate = StringValue ("HtMcs6");
388  datarate = 135;
389  }
390  else if (i == 31)
391  {
392  DataRate = StringValue ("HtMcs7");
393  datarate = 150;
394  }
395  else if (i == 32)
396  {
397  DataRate = StringValue ("HtMcs8");
398  datarate = 13;
399  }
400  else if (i == 33)
401  {
402  DataRate = StringValue ("HtMcs9");
403  datarate = 26;
404  }
405  else if (i == 34)
406  {
407  DataRate = StringValue ("HtMcs10");
408  datarate = 39;
409  }
410  else if (i == 35)
411  {
412  DataRate = StringValue ("HtMcs11");
413  datarate = 52;
414  }
415  else if (i == 36)
416  {
417  DataRate = StringValue ("HtMcs12");
418  datarate = 78;
419  }
420  else if (i == 37)
421  {
422  DataRate = StringValue ("HtMcs13");
423  datarate = 104;
424  }
425  else if (i == 38)
426  {
427  DataRate = StringValue ("HtMcs14");
428  datarate = 117;
429  }
430  else if (i == 39)
431  {
432  DataRate = StringValue ("HtMcs15");
433  datarate = 130;
434  }
435  else if (i == 40)
436  {
437  DataRate = StringValue ("HtMcs8");
438  datarate = 14.4;
439  }
440  else if (i == 41)
441  {
442  DataRate = StringValue ("HtMcs9");
443  datarate = 28.9;
444  }
445  else if (i == 42)
446  {
447  DataRate = StringValue ("HtMcs10");
448  datarate = 43.3;
449  }
450  else if (i == 43)
451  {
452  DataRate = StringValue ("HtMcs11");
453  datarate = 57.8;
454  }
455  else if (i == 44)
456  {
457  DataRate = StringValue ("HtMcs12");
458  datarate = 86.7;
459  }
460  else if (i == 45)
461  {
462  DataRate = StringValue ("HtMcs13");
463  datarate = 115.6;
464  }
465  else if (i == 46)
466  {
467  DataRate = StringValue ("HtMcs14");
468  datarate = 130.3;
469  }
470  else if (i == 47)
471  {
472  DataRate = StringValue ("HtMcs15");
473  datarate = 144.4;
474  }
475  else if (i == 48)
476  {
477  DataRate = StringValue ("HtMcs8");
478  datarate = 27;
479  }
480  else if (i == 49)
481  {
482  DataRate = StringValue ("HtMcs9");
483  datarate = 54;
484  }
485  else if (i == 50)
486  {
487  DataRate = StringValue ("HtMcs10");
488  datarate = 81;
489  }
490  else if (i == 51)
491  {
492  DataRate = StringValue ("HtMcs11");
493  datarate = 108;
494  }
495  else if (i == 52)
496  {
497  DataRate = StringValue ("HtMcs12");
498  datarate = 162;
499  }
500  else if (i == 53)
501  {
502  DataRate = StringValue ("HtMcs13");
503  datarate = 216;
504  }
505  else if (i == 54)
506  {
507  DataRate = StringValue ("HtMcs14");
508  datarate = 243;
509  }
510  else if (i == 55)
511  {
512  DataRate = StringValue ("HtMcs15");
513  datarate = 270;
514  }
515  else if (i == 56)
516  {
517  DataRate = StringValue ("HtMcs8");
518  datarate = 30;
519  }
520  else if (i == 57)
521  {
522  DataRate = StringValue ("HtMcs9");
523  datarate = 60;
524  }
525  else if (i == 58)
526  {
527  DataRate = StringValue ("HtMcs10");
528  datarate = 90;
529  }
530  else if (i == 59)
531  {
532  DataRate = StringValue ("HtMcs11");
533  datarate = 120;
534  }
535  else if (i == 60)
536  {
537  DataRate = StringValue ("HtMcs12");
538  datarate = 180;
539  }
540  else if (i == 61)
541  {
542  DataRate = StringValue ("HtMcs13");
543  datarate = 240;
544  }
545  else if (i == 62)
546  {
547  DataRate = StringValue ("HtMcs14");
548  datarate = 270;
549  }
550  else if (i == 63)
551  {
552  DataRate = StringValue ("HtMcs15");
553  datarate = 300;
554  }
555  else
556  {
557  NS_FATAL_ERROR ("Illegal index i " << i);
558  }
559 
560  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager","DataMode", DataRate,
561  "ControlMode", DataRate);
562 
563  NetDeviceContainer staDevice;
564  NetDeviceContainer apDevice;
565 
566  if (wifiType == "ns3::YansWifiPhy")
567  {
568  mac.SetType ("ns3::StaWifiMac",
569  "Ssid", SsidValue (ssid));
570  staDevice = wifi.Install (phy, mac, wifiStaNode);
571  mac.SetType ("ns3::ApWifiMac",
572  "Ssid", SsidValue (ssid));
573  apDevice = wifi.Install (phy, mac, wifiApNode);
574 
575  }
576  else if (wifiType == "ns3::SpectrumWifiPhy")
577  {
578  mac.SetType ("ns3::StaWifiMac",
579  "Ssid", SsidValue (ssid));
580  staDevice = wifi.Install (spectrumPhy, mac, wifiStaNode);
581  mac.SetType ("ns3::ApWifiMac",
582  "Ssid", SsidValue (ssid));
583  apDevice = wifi.Install (spectrumPhy, mac, wifiApNode);
584  }
585 
586  if ((i <= 7) || (i > 31 && i <= 39))
587  {
588  Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", UintegerValue (20));
589  Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/ShortGuardIntervalSupported", BooleanValue (false));
590  }
591  else if ((i > 7 && i <= 15) || (i > 39 && i <= 47))
592  {
593  Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", UintegerValue (20));
594  Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/ShortGuardIntervalSupported", BooleanValue (true));
595  }
596  else if ((i > 15 && i <= 23) || (i > 47 && i <= 55))
597  {
598  Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", UintegerValue (40));
599  Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/ShortGuardIntervalSupported", BooleanValue (false));
600  }
601  else
602  {
603  Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", UintegerValue (40));
604  Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/ShortGuardIntervalSupported", BooleanValue (true));
605  }
606 
607  // mobility.
609  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
610 
611  positionAlloc->Add (Vector (0.0, 0.0, 0.0));
612  positionAlloc->Add (Vector (distance, 0.0, 0.0));
613  mobility.SetPositionAllocator (positionAlloc);
614 
615  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
616 
617  mobility.Install (wifiApNode);
618  mobility.Install (wifiStaNode);
619 
620  /* Internet stack*/
622  stack.Install (wifiApNode);
623  stack.Install (wifiStaNode);
624 
626  address.SetBase ("192.168.1.0", "255.255.255.0");
627  Ipv4InterfaceContainer staNodeInterface;
628  Ipv4InterfaceContainer apNodeInterface;
629 
630  staNodeInterface = address.Assign (staDevice);
631  apNodeInterface = address.Assign (apDevice);
632 
633  /* Setting applications */
634  uint16_t port = 9;
635  UdpServerHelper server (port);
636  ApplicationContainer serverApp = server.Install (wifiStaNode.Get (0));
637  serverApp.Start (Seconds (0.0));
638  serverApp.Stop (Seconds (simulationTime + 1));
639 
640  UdpClientHelper client (staNodeInterface.GetAddress (0), port);
641  client.SetAttribute ("MaxPackets", UintegerValue (4294967295u));
642  client.SetAttribute ("Interval", TimeValue (Time ("0.0001"))); //packets/s
643  client.SetAttribute ("PacketSize", UintegerValue (payloadSize));
644  ApplicationContainer clientApp = client.Install (wifiApNode.Get (0));
645  clientApp.Start (Seconds (1.0));
646  clientApp.Stop (Seconds (simulationTime + 1));
647 
648  if (enablePcap)
649  {
650  std::stringstream ss;
651  ss << "wifi-spectrum-saturation-example-" << i;
652  phy.EnablePcap (ss.str (), apDevice);
653  }
654 
655  Simulator::Stop (Seconds (simulationTime + 1));
656  Simulator::Run ();
657 
658  double throughput;
659  uint64_t totalPacketsThrough;
660  totalPacketsThrough = DynamicCast<UdpServer> (serverApp.Get (0))->GetReceived ();
661  throughput = totalPacketsThrough * payloadSize * 8 / (simulationTime * 1000000.0); //Mbit/s
662  std::cout << std::setw (5) << i <<
663  std::setw (6) << (i % 8) + 8 * (i / 32) <<
664  std::setw (8) << channelWidth <<
665  std::setw (10) << datarate <<
666  std::setw (12) << throughput <<
667  std::setw (8) << totalPacketsThrough <<
668  std::endl;
670  }
671  return 0;
672 }
holds a vector of ns3::Application pointers.
Ptr< Application > Get(uint32_t i) const
Get the Ptr<Application> stored in this container at a given index.
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter.
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter.
AttributeValue implementation for Boolean.
Definition: boolean.h:37
Parse command-line arguments.
Definition: command-line.h:229
Class for representing data rates.
Definition: data-rate.h:89
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:41
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
Helper class used to assign positions and mobility models to nodes.
holds a vector of ns3::NetDevice pointers
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.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
Definition: simulator.cc:180
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
Definition: simulator.cc:136
static void Run(void)
Run the simulation.
Definition: simulator.cc:172
Make it easy to create and manage PHY objects for the spectrum model.
void SetChannel(Ptr< SpectrumChannel > channel)
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
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
AttributeValue implementation for Time.
Definition: nstime.h:1308
Create a client application which sends UDP packets carrying a 32bit sequence number and a 64 bit tim...
Create a server application which waits for input UDP packets and uses the information carried into t...
Hold an unsigned integer type.
Definition: uinteger.h:44
helps to create WifiNetDevice objects
Definition: wifi-helper.h:274
create MAC layers for a ns3::WifiNetDevice.
void Set(std::string name, const AttributeValue &v)
Definition: wifi-helper.cc:154
void SetErrorRateModel(std::string type, Args &&... args)
Helper function used to set the error rate model.
Definition: wifi-helper.h:440
manage and create wifi channel objects for the YANS model.
Make it easy to create and manage PHY objects for the YANS model.
uint16_t port
Definition: dsdv-manet.cc:45
void Set(std::string path, const AttributeValue &value)
Definition: config.cc:839
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
void(* DataRate)(DataRate oldValue, DataRate newValue)
TracedValue callback signature for DataRate.
Definition: data-rate.h:329
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1244
address
Definition: first.py:44
stack
Definition: first.py:41
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
mac
Definition: third.py:99
wifi
Definition: third.py:96
wifiApNode
Definition: third.py:90
mobility
Definition: third.py:108
phy
Definition: third.py:93
bool enablePcap