A Discrete-Event Network Simulator
API
wifi-spectrum-per-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 // for packet error ratio
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 // --udp: UDP if set to 1, TCP otherwise [true]
56 // --distance: meters separation between nodes [50]
57 // --index: restrict index to single value between 0 and 31 [256]
58 // --wifiType: select ns3::SpectrumWifiPhy or ns3::YansWifiPhy [ns3::SpectrumWifiPhy]
59 // --errorModelType: select ns3::NistErrorRateModel or ns3::YansErrorRateModel [ns3::NistErrorRateModel]
60 // --enablePcap: enable pcap output [false]
61 //
62 // By default, the program will step through 32 index values, corresponding
63 // to the following MCS, channel width, and guard interval combinations:
64 // index 0-7: MCS 0-7, long guard interval, 20 MHz channel
65 // index 8-15: MCS 0-7, short guard interval, 20 MHz channel
66 // index 16-23: MCS 0-7, long guard interval, 40 MHz channel
67 // index 24-31: MCS 0-7, short guard interval, 40 MHz channel
68 // and send 1000 UDP packets using each MCS, using the SpectrumWifiPhy and the
69 // NistErrorRateModel, at a distance of 50 meters. The program outputs
70 // results such as:
71 //
72 // wifiType: ns3::SpectrumWifiPhy distance: 50m; sent: 1000
73 // index MCS Rate (Mb/s) Tput (Mb/s) Received Signal (dBm) Noise (dBm) SNR (dB)
74 // 0 0 6.5 0.7776 1000 -77.6633 -100.966 23.3027
75 // 1 1 13 0.7776 1000 -77.6633 -100.966 23.3027
76 // 2 2 19.5 0.7776 1000 -77.6633 -100.966 23.3027
77 // 3 3 26 0.7776 1000 -77.6633 -100.966 23.3027
78 // ...
79 //
80 // When UDP is used, the throughput will always be 0.7776 Mb/s since the
81 // traffic generator does not attempt to match the maximum Phy data rate
82 // but instead sends at a constant rate. When TCP is used, the TCP flow
83 // will exhibit different throughput depending on the index.
84 
85 using namespace ns3;
86 
87 // Global variables for use in callbacks.
90 uint32_t g_samples;
91 uint16_t g_channelNumber;
92 uint32_t g_rate;
93 
94 void MonitorSniffRx (Ptr<const Packet> packet, uint16_t channelFreqMhz,
95  uint16_t channelNumber, uint32_t rate,
96  WifiPreamble preamble, WifiTxVector txVector,
97  struct mpduInfo aMpdu, struct signalNoiseDbm signalNoise)
98 
99 {
100  g_samples++;
101  g_signalDbmAvg += ((signalNoise.signal - g_signalDbmAvg) / g_samples);
102  g_noiseDbmAvg += ((signalNoise.noise - g_noiseDbmAvg) / g_samples);
103  g_rate = rate;
104  g_channelNumber = channelNumber;
105 }
106 
107 NS_LOG_COMPONENT_DEFINE ("WifiSpectrumPerExample");
108 
109 int main (int argc, char *argv[])
110 {
111  bool udp = true;
112  double distance = 50;
113  double simulationTime = 10; //seconds
114  uint16_t index = 256;
115  std::string wifiType = "ns3::SpectrumWifiPhy";
116  std::string errorModelType = "ns3::NistErrorRateModel";
117  bool enablePcap = false;
118  const uint32_t tcpPacketSize = 1448;
119 
121  cmd.AddValue ("simulationTime", "Simulation time in seconds", simulationTime);
122  cmd.AddValue ("udp", "UDP if set to 1, TCP otherwise", udp);
123  cmd.AddValue ("distance", "meters separation between nodes", distance);
124  cmd.AddValue ("index", "restrict index to single value between 0 and 31", index);
125  cmd.AddValue ("wifiType", "select ns3::SpectrumWifiPhy or ns3::YansWifiPhy", wifiType);
126  cmd.AddValue ("errorModelType", "select ns3::NistErrorRateModel or ns3::YansErrorRateModel", errorModelType);
127  cmd.AddValue ("enablePcap", "enable pcap output", enablePcap);
128  cmd.Parse (argc,argv);
129 
130  uint16_t startIndex = 0;
131  uint16_t stopIndex = 31;
132  if (index < 32)
133  {
134  startIndex = index;
135  stopIndex = index;
136  }
137 
138  std::cout << "wifiType: " << wifiType << " distance: " << distance << "m; sent: 1000 TxPower: 1 dBm (1.3 mW)" << std::endl;
139  std::cout << std::setw (5) << "index" <<
140  std::setw (6) << "MCS" <<
141  std::setw (12) << "Rate (Mb/s)" <<
142  std::setw (12) << "Tput (Mb/s)" <<
143  std::setw (10) << "Received " <<
144  std::setw (12) << "Signal (dBm)" <<
145  std::setw (12) << "Noise (dBm)" <<
146  std::setw (10) << "SNR (dB)" <<
147  std::endl;
148  for (uint16_t i = startIndex; i <= stopIndex; i++)
149  {
150  uint32_t payloadSize;
151  if (udp)
152  {
153  payloadSize = 972; // 1000 bytes IPv4
154  }
155  else
156  {
157  payloadSize = 1448; // 1500 bytes IPv6
158  Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (payloadSize));
159  }
160 
161  NodeContainer wifiStaNode;
162  wifiStaNode.Create (1);
164  wifiApNode.Create (1);
165 
168  if (wifiType == "ns3::YansWifiPhy")
169  {
171  channel.AddPropagationLoss ("ns3::FriisPropagationLossModel");
172  channel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
173  phy.SetChannel (channel.Create ());
174  phy.Set ("TxPowerStart", DoubleValue (1)); // dBm (1.26 mW)
175  phy.Set ("TxPowerEnd", DoubleValue (1));
176 
177  if (i <= 7)
178  {
179  phy.Set ("ShortGuardEnabled", BooleanValue (false));
180  phy.Set ("ChannelWidth", UintegerValue (20));
181  }
182  else if (i > 7 && i <= 15)
183  {
184  phy.Set ("ShortGuardEnabled", BooleanValue (true));
185  phy.Set ("ChannelWidth", UintegerValue (20));
186  }
187  else if (i > 15 && i <= 23)
188  {
189  phy.Set ("ShortGuardEnabled", BooleanValue (false));
190  phy.Set ("ChannelWidth", UintegerValue (40));
191  }
192  else
193  {
194  phy.Set ("ShortGuardEnabled", BooleanValue (true));
195  phy.Set ("ChannelWidth", UintegerValue (40));
196  }
197  }
198  else if (wifiType == "ns3::SpectrumWifiPhy")
199  {
200  //Bug 2460: CcaMode1Threshold default should be set to -62 dBm when using Spectrum
201  Config::SetDefault ("ns3::WifiPhy::CcaMode1Threshold", DoubleValue (-62.0));
202 
203  Ptr<MultiModelSpectrumChannel> spectrumChannel
204  = CreateObject<MultiModelSpectrumChannel> ();
206  = CreateObject<FriisPropagationLossModel> ();
207  spectrumChannel->AddPropagationLossModel (lossModel);
208 
210  = CreateObject<ConstantSpeedPropagationDelayModel> ();
211  spectrumChannel->SetPropagationDelayModel (delayModel);
212 
213  spectrumPhy.SetChannel (spectrumChannel);
214  spectrumPhy.SetErrorRateModel (errorModelType);
215  spectrumPhy.Set ("Frequency", UintegerValue (5180));
216  spectrumPhy.Set ("TxPowerStart", DoubleValue (1)); // dBm (1.26 mW)
217  spectrumPhy.Set ("TxPowerEnd", DoubleValue (1));
218 
219  if (i <= 7)
220  {
221  spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (false));
222  spectrumPhy.Set ("ChannelWidth", UintegerValue (20));
223  }
224  else if (i > 7 && i <= 15)
225  {
226  spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (true));
227  spectrumPhy.Set ("ChannelWidth", UintegerValue (20));
228  }
229  else if (i > 15 && i <= 23)
230  {
231  spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (false));
232  spectrumPhy.Set ("ChannelWidth", UintegerValue (40));
233  }
234  else
235  {
236  spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (true));
237  spectrumPhy.Set ("ChannelWidth", UintegerValue (40));
238  }
239  }
240  else
241  {
242  NS_FATAL_ERROR ("Unsupported WiFi type " << wifiType);
243  }
244 
245 
249 
250  Ssid ssid = Ssid ("ns380211n");
251 
252  double datarate = 0;
254  if (i == 0)
255  {
256  DataRate = StringValue ("HtMcs0");
257  datarate = 6.5;
258  }
259  else if (i == 1)
260  {
261  DataRate = StringValue ("HtMcs1");
262  datarate = 13;
263  }
264  else if (i == 2)
265  {
266  DataRate = StringValue ("HtMcs2");
267  datarate = 19.5;
268  }
269  else if (i == 3)
270  {
271  DataRate = StringValue ("HtMcs3");
272  datarate = 26;
273  }
274  else if (i == 4)
275  {
276  DataRate = StringValue ("HtMcs4");
277  datarate = 39;
278  }
279  else if (i == 5)
280  {
281  DataRate = StringValue ("HtMcs5");
282  datarate = 52;
283  }
284  else if (i == 6)
285  {
286  DataRate = StringValue ("HtMcs6");
287  datarate = 58.5;
288  }
289  else if (i == 7)
290  {
291  DataRate = StringValue ("HtMcs7");
292  datarate = 65;
293  }
294  else if (i == 8)
295  {
296  DataRate = StringValue ("HtMcs0");
297  datarate = 7.2;
298  }
299  else if (i == 9)
300  {
301  DataRate = StringValue ("HtMcs1");
302  datarate = 14.4;
303  }
304  else if (i == 10)
305  {
306  DataRate = StringValue ("HtMcs2");
307  datarate = 21.7;
308  }
309  else if (i == 11)
310  {
311  DataRate = StringValue ("HtMcs3");
312  datarate = 28.9;
313  }
314  else if (i == 12)
315  {
316  DataRate = StringValue ("HtMcs4");
317  datarate = 43.3;
318  }
319  else if (i == 13)
320  {
321  DataRate = StringValue ("HtMcs5");
322  datarate = 57.8;
323  }
324  else if (i == 14)
325  {
326  DataRate = StringValue ("HtMcs6");
327  datarate = 65;
328  }
329  else if (i == 15)
330  {
331  DataRate = StringValue ("HtMcs7");
332  datarate = 72.2;
333  }
334  else if (i == 16)
335  {
336  DataRate = StringValue ("HtMcs0");
337  datarate = 13.5;
338  }
339  else if (i == 17)
340  {
341  DataRate = StringValue ("HtMcs1");
342  datarate = 27;
343  }
344  else if (i == 18)
345  {
346  DataRate = StringValue ("HtMcs2");
347  datarate = 40.5;
348  }
349  else if (i == 19)
350  {
351  DataRate = StringValue ("HtMcs3");
352  datarate = 54;
353  }
354  else if (i == 20)
355  {
356  DataRate = StringValue ("HtMcs4");
357  datarate = 81;
358  }
359  else if (i == 21)
360  {
361  DataRate = StringValue ("HtMcs5");
362  datarate = 108;
363  }
364  else if (i == 22)
365  {
366  DataRate = StringValue ("HtMcs6");
367  datarate = 121.5;
368  }
369  else if (i == 23)
370  {
371  DataRate = StringValue ("HtMcs7");
372  datarate = 135;
373  }
374  else if (i == 24)
375  {
376  DataRate = StringValue ("HtMcs0");
377  datarate = 15;
378  }
379  else if (i == 25)
380  {
381  DataRate = StringValue ("HtMcs1");
382  datarate = 30;
383  }
384  else if (i == 26)
385  {
386  DataRate = StringValue ("HtMcs2");
387  datarate = 45;
388  }
389  else if (i == 27)
390  {
391  DataRate = StringValue ("HtMcs3");
392  datarate = 60;
393  }
394  else if (i == 28)
395  {
396  DataRate = StringValue ("HtMcs4");
397  datarate = 90;
398  }
399  else if (i == 29)
400  {
401  DataRate = StringValue ("HtMcs5");
402  datarate = 120;
403  }
404  else if (i == 30)
405  {
406  DataRate = StringValue ("HtMcs6");
407  datarate = 135;
408  }
409  else
410  {
411  DataRate = StringValue ("HtMcs7");
412  datarate = 150;
413  }
414 
415  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager","DataMode", DataRate,
416  "ControlMode", DataRate);
417 
418  NetDeviceContainer staDevice;
419  NetDeviceContainer apDevice;
420 
421  if (wifiType == "ns3::YansWifiPhy")
422  {
423  mac.SetType ("ns3::StaWifiMac",
424  "Ssid", SsidValue (ssid),
425  "ActiveProbing", BooleanValue (false));
426  staDevice = wifi.Install (phy, mac, wifiStaNode);
427  mac.SetType ("ns3::ApWifiMac",
428  "Ssid", SsidValue (ssid));
429  apDevice = wifi.Install (phy, mac, wifiApNode);
430 
431  }
432  else if (wifiType == "ns3::SpectrumWifiPhy")
433  {
434  mac.SetType ("ns3::StaWifiMac",
435  "Ssid", SsidValue (ssid),
436  "ActiveProbing", BooleanValue (false));
437  staDevice = wifi.Install (spectrumPhy, mac, wifiStaNode);
438  mac.SetType ("ns3::ApWifiMac",
439  "Ssid", SsidValue (ssid));
440  apDevice = wifi.Install (spectrumPhy, mac, wifiApNode);
441  }
442 
443  // mobility.
445  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
446 
447  positionAlloc->Add (Vector (0.0, 0.0, 0.0));
448  positionAlloc->Add (Vector (distance, 0.0, 0.0));
449  mobility.SetPositionAllocator (positionAlloc);
450 
451  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
452 
453  mobility.Install (wifiApNode);
454  mobility.Install (wifiStaNode);
455 
456  /* Internet stack*/
458  stack.Install (wifiApNode);
459  stack.Install (wifiStaNode);
460 
462 
463  address.SetBase ("192.168.1.0", "255.255.255.0");
464  Ipv4InterfaceContainer staNodeInterface;
465  Ipv4InterfaceContainer apNodeInterface;
466 
467  staNodeInterface = address.Assign (staDevice);
468  apNodeInterface = address.Assign (apDevice);
469 
470  /* Setting applications */
471  ApplicationContainer serverApp, sinkApp;
472  if (udp)
473  {
474  //UDP flow
475  UdpServerHelper myServer (9);
476  serverApp = myServer.Install (wifiStaNode.Get (0));
477  serverApp.Start (Seconds (0.0));
478  serverApp.Stop (Seconds (simulationTime + 1));
479 
480  UdpClientHelper myClient (staNodeInterface.GetAddress (0), 9);
481  myClient.SetAttribute ("MaxPackets", UintegerValue (1000));
482  myClient.SetAttribute ("Interval", TimeValue (MilliSeconds (5)));
483  myClient.SetAttribute ("PacketSize", UintegerValue (payloadSize));
484 
485  ApplicationContainer clientApp = myClient.Install (wifiApNode.Get (0));
486  clientApp.Start (Seconds (1.0));
487  clientApp.Stop (Seconds (simulationTime + 1));
488  }
489  else
490  {
491  //TCP flow
492  uint16_t port = 50000;
493  Address apLocalAddress (InetSocketAddress (Ipv4Address::GetAny (), port));
494  PacketSinkHelper packetSinkHelper ("ns3::TcpSocketFactory", apLocalAddress);
495  sinkApp = packetSinkHelper.Install (wifiStaNode.Get (0));
496 
497  sinkApp.Start (Seconds (0.0));
498  sinkApp.Stop (Seconds (simulationTime + 1));
499 
500  OnOffHelper onoff ("ns3::TcpSocketFactory",Ipv4Address::GetAny ());
501  onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
502  onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
503  onoff.SetAttribute ("PacketSize", UintegerValue (payloadSize));
504  onoff.SetAttribute ("DataRate", DataRateValue (1000000000)); //bit/s
506 
507  AddressValue remoteAddress (InetSocketAddress (staNodeInterface.GetAddress (0), port));
508  onoff.SetAttribute ("Remote", remoteAddress);
509  apps.Add (onoff.Install (wifiApNode.Get (0)));
510  apps.Start (Seconds (1.0));
511  apps.Stop (Seconds (simulationTime + 1));
512  }
513 
514  Config::ConnectWithoutContext ("/NodeList/0/DeviceList/*/Phy/MonitorSnifferRx", MakeCallback (&MonitorSniffRx));
515 
516  if (enablePcap)
517  {
518  std::stringstream ss;
519  ss << "wifi-spectrum-per-example-" << i;
520  phy.EnablePcap (ss.str (), apDevice);
521  }
522  g_signalDbmAvg = 0;
523  g_noiseDbmAvg = 0;
524  g_samples = 0;
525  g_channelNumber = 0;
526  g_rate = 0;
527 
528  Simulator::Stop (Seconds (simulationTime + 1));
529  Simulator::Run ();
530 
531  double throughput = 0;
532  uint32_t totalPacketsThrough = 0;
533  if (udp)
534  {
535  //UDP
536  totalPacketsThrough = DynamicCast<UdpServer> (serverApp.Get (0))->GetReceived ();
537  throughput = totalPacketsThrough * payloadSize * 8 / (simulationTime * 1000000.0); //Mbit/s
538  }
539  else
540  {
541  //TCP
542  uint32_t totalBytesRx = DynamicCast<PacketSink> (sinkApp.Get (0))->GetTotalRx ();
543  totalPacketsThrough = totalBytesRx / tcpPacketSize;
544  throughput = totalBytesRx * 8 / (simulationTime * 1000000.0); //Mbit/s
545  }
546  std::cout << std::setw (5) << i <<
547  std::setw (6) << (i % 8) <<
548  std::setw (10) << datarate <<
549  std::setw (12) << throughput <<
550  std::setw (8) << totalPacketsThrough;
551  if (totalPacketsThrough > 0)
552  {
553  std::cout << std::setw (12) << g_signalDbmAvg <<
554  std::setw (12) << g_noiseDbmAvg <<
555  std::setw (12) << (g_signalDbmAvg - g_noiseDbmAvg) <<
556  std::endl;
557  }
558  else
559  {
560  std::cout << std::setw (12) << "N/A" <<
561  std::setw (12) << "N/A" <<
562  std::setw (12) << "N/A" <<
563  std::endl;
564  }
566  }
567  return 0;
568 }
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.
an Inet address class
static Ipv4Address GetAny(void)
AttributeValue implementation for Boolean.
Definition: boolean.h:34
HT OFDM PHY for the 5 GHz band (clause 20)
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
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 Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container. ...
bool enablePcap
double g_noiseDbmAvg
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
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:903
virtual void AddPropagationLossModel(Ptr< PropagationLossModel > loss)
Set the single-frequency propagation loss model to be used.
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
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes...
static YansWifiPhyHelper Default(void)
Create a phy helper in a default working state.
helps to create WifiNetDevice objects
Definition: wifi-helper.h:231
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
Definition: on-off-helper.h:42
tuple cmd
Definition: second.py:35
virtual NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &mac, NodeContainer c) const
Definition: wifi-helper.cc:712
uint16_t port
Definition: dsdv-manet.cc:44
a polymophic address class
Definition: address.h:90
Class for representing data rates.
Definition: data-rate.h:88
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
Definition: wifi-preamble.h:30
void SetChannel(Ptr< YansWifiChannel > channel)
void Install(Ptr< Node > node) const
"Layout" a single node according to the current position allocator type.
uint32_t g_samples
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
uint16_t g_channelNumber
void SetChannel(Ptr< SpectrumChannel > channel)
Hold an unsigned integer type.
Definition: uinteger.h:44
holds a vector of ns3::NetDevice pointers
double g_signalDbmAvg
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...
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Definition: callback.h:1489
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
Definition: config.cc:824
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 MonitorSniffRx(Ptr< const Packet > packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, WifiPreamble preamble, WifiTxVector txVector, struct mpduInfo aMpdu, struct signalNoiseDbm signalNoise)
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.
AttributeValue implementation for Address.
Definition: address.h:278
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter...
uint32_t g_rate
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
AttributeValue implementation for DataRate.
Definition: data-rate.h:242
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.
virtual 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:895
AttributeValue implementation for Ssid.
Definition: ssid.h:95
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:774
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.