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 
26 #include <iomanip>
27 #include "ns3/core-module.h"
28 #include "ns3/network-module.h"
29 #include "ns3/applications-module.h"
30 #include "ns3/wifi-module.h"
31 #include "ns3/mobility-module.h"
32 #include "ns3/spectrum-module.h"
33 #include "ns3/internet-module.h"
34 
35 // This is a simple example of an IEEE 802.11n Wi-Fi network.
36 //
37 // The main use case is to enable and test SpectrumWifiPhy vs YansWifiPhy
38 // for packet error ratio
39 //
40 // Network topology:
41 //
42 // Wi-Fi 192.168.1.0
43 //
44 // STA AP
45 // * <-- distance --> *
46 // | |
47 // n1 n2
48 //
49 // Users may vary the following command-line arguments in addition to the
50 // attributes, global values, and default values typically available:
51 //
52 // --simulationTime: Simulation time in seconds [10]
53 // --udp: UDP if set to 1, TCP otherwise [true]
54 // --distance: meters separation between nodes [50]
55 // --index: restrict index to single value between 0 and 31 [256]
56 // --wifiType: select ns3::SpectrumWifiPhy or ns3::YansWifiPhy [ns3::SpectrumWifiPhy]
57 // --errorModelType: select ns3::NistErrorRateModel or ns3::YansErrorRateModel [ns3::NistErrorRateModel]
58 // --enablePcap: enable pcap output [false]
59 //
60 // By default, the program will step through 32 index values, corresponding
61 // to the following MCS, channel width, and guard interval combinations:
62 // index 0-7: MCS 0-7, long guard interval, 20 MHz channel
63 // index 8-15: MCS 0-7, short guard interval, 20 MHz channel
64 // index 16-23: MCS 0-7, long guard interval, 40 MHz channel
65 // index 24-31: MCS 0-7, short guard interval, 40 MHz channel
66 // and send UDP for 10 seconds using each MCS, using the SpectrumWifiPhy and the
67 // NistErrorRateModel, at a distance of 50 meters. The program outputs
68 // results such as:
69 //
70 // wifiType: ns3::SpectrumWifiPhy distance: 50m; time: 10; TxPower: 1 dBm (1.3 mW)
71 // index MCS Rate (Mb/s) Tput (Mb/s) Received Signal (dBm) Noise (dBm) SNR (dB)
72 // 0 0 6.50 5.77 7414 -79.71 -93.97 14.25
73 // 1 1 13.00 11.58 14892 -79.71 -93.97 14.25
74 // 2 2 19.50 17.39 22358 -79.71 -93.97 14.25
75 // 3 3 26.00 22.96 29521 -79.71 -93.97 14.25
76 // ...
77 //
78 
79 using namespace ns3;
80 
81 // Global variables for use in callbacks.
84 uint32_t g_samples;
85 
87  uint16_t channelFreqMhz,
88  WifiTxVector txVector,
89  MpduInfo aMpdu,
90  SignalNoiseDbm signalNoise)
91 
92 {
93  g_samples++;
94  g_signalDbmAvg += ((signalNoise.signal - g_signalDbmAvg) / g_samples);
95  g_noiseDbmAvg += ((signalNoise.noise - g_noiseDbmAvg) / g_samples);
96 }
97 
98 NS_LOG_COMPONENT_DEFINE ("WifiSpectrumPerExample");
99 
100 int main (int argc, char *argv[])
101 {
102  bool udp = true;
103  double distance = 50;
104  double simulationTime = 10; //seconds
105  uint16_t index = 256;
106  std::string wifiType = "ns3::SpectrumWifiPhy";
107  std::string errorModelType = "ns3::NistErrorRateModel";
108  bool enablePcap = false;
109  const uint32_t tcpPacketSize = 1448;
110 
112  cmd.AddValue ("simulationTime", "Simulation time in seconds", simulationTime);
113  cmd.AddValue ("udp", "UDP if set to 1, TCP otherwise", udp);
114  cmd.AddValue ("distance", "meters separation between nodes", distance);
115  cmd.AddValue ("index", "restrict index to single value between 0 and 31", index);
116  cmd.AddValue ("wifiType", "select ns3::SpectrumWifiPhy or ns3::YansWifiPhy", wifiType);
117  cmd.AddValue ("errorModelType", "select ns3::NistErrorRateModel or ns3::YansErrorRateModel", errorModelType);
118  cmd.AddValue ("enablePcap", "enable pcap output", enablePcap);
119  cmd.Parse (argc,argv);
120 
121  uint16_t startIndex = 0;
122  uint16_t stopIndex = 31;
123  if (index < 32)
124  {
125  startIndex = index;
126  stopIndex = index;
127  }
128 
129  std::cout << "wifiType: " << wifiType << " distance: " << distance << "m; time: " << simulationTime << "; TxPower: 1 dBm (1.3 mW)" << std::endl;
130  std::cout << std::setw (5) << "index" <<
131  std::setw (6) << "MCS" <<
132  std::setw (13) << "Rate (Mb/s)" <<
133  std::setw (12) << "Tput (Mb/s)" <<
134  std::setw (10) << "Received " <<
135  std::setw (12) << "Signal (dBm)" <<
136  std::setw (12) << "Noise (dBm)" <<
137  std::setw (9) << "SNR (dB)" <<
138  std::endl;
139  for (uint16_t i = startIndex; i <= stopIndex; i++)
140  {
141  uint32_t payloadSize;
142  if (udp)
143  {
144  payloadSize = 972; // 1000 bytes IPv4
145  }
146  else
147  {
148  payloadSize = 1448; // 1500 bytes IPv6
149  Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (payloadSize));
150  }
151 
152  NodeContainer wifiStaNode;
153  wifiStaNode.Create (1);
155  wifiApNode.Create (1);
156 
159  if (wifiType == "ns3::YansWifiPhy")
160  {
162  channel.AddPropagationLoss ("ns3::FriisPropagationLossModel",
163  "Frequency", DoubleValue (5.180e9));
164  channel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
165  phy.SetChannel (channel.Create ());
166  phy.Set ("TxPowerStart", DoubleValue (1)); // dBm (1.26 mW)
167  phy.Set ("TxPowerEnd", DoubleValue (1));
168  phy.Set ("Frequency", UintegerValue (5180));
169 
170  if (i <= 7)
171  {
172  phy.Set ("ShortGuardEnabled", BooleanValue (false));
173  phy.Set ("ChannelWidth", UintegerValue (20));
174  }
175  else if (i > 7 && i <= 15)
176  {
177  phy.Set ("ShortGuardEnabled", BooleanValue (true));
178  phy.Set ("ChannelWidth", UintegerValue (20));
179  }
180  else if (i > 15 && i <= 23)
181  {
182  phy.Set ("ShortGuardEnabled", BooleanValue (false));
183  phy.Set ("ChannelWidth", UintegerValue (40));
184  }
185  else
186  {
187  phy.Set ("ShortGuardEnabled", BooleanValue (true));
188  phy.Set ("ChannelWidth", UintegerValue (40));
189  }
190  }
191  else if (wifiType == "ns3::SpectrumWifiPhy")
192  {
193  //Bug 2460: CcaMode1Threshold default should be set to -62 dBm when using Spectrum
194  Config::SetDefault ("ns3::WifiPhy::CcaMode1Threshold", DoubleValue (-62.0));
195 
196  Ptr<MultiModelSpectrumChannel> spectrumChannel
197  = CreateObject<MultiModelSpectrumChannel> ();
199  = CreateObject<FriisPropagationLossModel> ();
200  lossModel->SetFrequency (5.180e9);
201  spectrumChannel->AddPropagationLossModel (lossModel);
202 
204  = CreateObject<ConstantSpeedPropagationDelayModel> ();
205  spectrumChannel->SetPropagationDelayModel (delayModel);
206 
207  spectrumPhy.SetChannel (spectrumChannel);
208  spectrumPhy.SetErrorRateModel (errorModelType);
209  spectrumPhy.Set ("Frequency", UintegerValue (5180));
210  spectrumPhy.Set ("TxPowerStart", DoubleValue (1)); // dBm (1.26 mW)
211  spectrumPhy.Set ("TxPowerEnd", DoubleValue (1));
212 
213  if (i <= 7)
214  {
215  spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (false));
216  spectrumPhy.Set ("ChannelWidth", UintegerValue (20));
217  }
218  else if (i > 7 && i <= 15)
219  {
220  spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (true));
221  spectrumPhy.Set ("ChannelWidth", UintegerValue (20));
222  }
223  else if (i > 15 && i <= 23)
224  {
225  spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (false));
226  spectrumPhy.Set ("ChannelWidth", UintegerValue (40));
227  }
228  else
229  {
230  spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (true));
231  spectrumPhy.Set ("ChannelWidth", UintegerValue (40));
232  }
233  }
234  else
235  {
236  NS_FATAL_ERROR ("Unsupported WiFi type " << wifiType);
237  }
238 
239 
243 
244  Ssid ssid = Ssid ("ns380211n");
245 
246  double datarate = 0;
248  if (i == 0)
249  {
250  DataRate = StringValue ("HtMcs0");
251  datarate = 6.5;
252  }
253  else if (i == 1)
254  {
255  DataRate = StringValue ("HtMcs1");
256  datarate = 13;
257  }
258  else if (i == 2)
259  {
260  DataRate = StringValue ("HtMcs2");
261  datarate = 19.5;
262  }
263  else if (i == 3)
264  {
265  DataRate = StringValue ("HtMcs3");
266  datarate = 26;
267  }
268  else if (i == 4)
269  {
270  DataRate = StringValue ("HtMcs4");
271  datarate = 39;
272  }
273  else if (i == 5)
274  {
275  DataRate = StringValue ("HtMcs5");
276  datarate = 52;
277  }
278  else if (i == 6)
279  {
280  DataRate = StringValue ("HtMcs6");
281  datarate = 58.5;
282  }
283  else if (i == 7)
284  {
285  DataRate = StringValue ("HtMcs7");
286  datarate = 65;
287  }
288  else if (i == 8)
289  {
290  DataRate = StringValue ("HtMcs0");
291  datarate = 7.2;
292  }
293  else if (i == 9)
294  {
295  DataRate = StringValue ("HtMcs1");
296  datarate = 14.4;
297  }
298  else if (i == 10)
299  {
300  DataRate = StringValue ("HtMcs2");
301  datarate = 21.7;
302  }
303  else if (i == 11)
304  {
305  DataRate = StringValue ("HtMcs3");
306  datarate = 28.9;
307  }
308  else if (i == 12)
309  {
310  DataRate = StringValue ("HtMcs4");
311  datarate = 43.3;
312  }
313  else if (i == 13)
314  {
315  DataRate = StringValue ("HtMcs5");
316  datarate = 57.8;
317  }
318  else if (i == 14)
319  {
320  DataRate = StringValue ("HtMcs6");
321  datarate = 65;
322  }
323  else if (i == 15)
324  {
325  DataRate = StringValue ("HtMcs7");
326  datarate = 72.2;
327  }
328  else if (i == 16)
329  {
330  DataRate = StringValue ("HtMcs0");
331  datarate = 13.5;
332  }
333  else if (i == 17)
334  {
335  DataRate = StringValue ("HtMcs1");
336  datarate = 27;
337  }
338  else if (i == 18)
339  {
340  DataRate = StringValue ("HtMcs2");
341  datarate = 40.5;
342  }
343  else if (i == 19)
344  {
345  DataRate = StringValue ("HtMcs3");
346  datarate = 54;
347  }
348  else if (i == 20)
349  {
350  DataRate = StringValue ("HtMcs4");
351  datarate = 81;
352  }
353  else if (i == 21)
354  {
355  DataRate = StringValue ("HtMcs5");
356  datarate = 108;
357  }
358  else if (i == 22)
359  {
360  DataRate = StringValue ("HtMcs6");
361  datarate = 121.5;
362  }
363  else if (i == 23)
364  {
365  DataRate = StringValue ("HtMcs7");
366  datarate = 135;
367  }
368  else if (i == 24)
369  {
370  DataRate = StringValue ("HtMcs0");
371  datarate = 15;
372  }
373  else if (i == 25)
374  {
375  DataRate = StringValue ("HtMcs1");
376  datarate = 30;
377  }
378  else if (i == 26)
379  {
380  DataRate = StringValue ("HtMcs2");
381  datarate = 45;
382  }
383  else if (i == 27)
384  {
385  DataRate = StringValue ("HtMcs3");
386  datarate = 60;
387  }
388  else if (i == 28)
389  {
390  DataRate = StringValue ("HtMcs4");
391  datarate = 90;
392  }
393  else if (i == 29)
394  {
395  DataRate = StringValue ("HtMcs5");
396  datarate = 120;
397  }
398  else if (i == 30)
399  {
400  DataRate = StringValue ("HtMcs6");
401  datarate = 135;
402  }
403  else
404  {
405  DataRate = StringValue ("HtMcs7");
406  datarate = 150;
407  }
408 
409  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager","DataMode", DataRate,
410  "ControlMode", DataRate);
411 
412  NetDeviceContainer staDevice;
413  NetDeviceContainer apDevice;
414 
415  if (wifiType == "ns3::YansWifiPhy")
416  {
417  mac.SetType ("ns3::StaWifiMac",
418  "Ssid", SsidValue (ssid),
419  "ActiveProbing", BooleanValue (false));
420  staDevice = wifi.Install (phy, mac, wifiStaNode);
421  mac.SetType ("ns3::ApWifiMac",
422  "Ssid", SsidValue (ssid));
423  apDevice = wifi.Install (phy, mac, wifiApNode);
424 
425  }
426  else if (wifiType == "ns3::SpectrumWifiPhy")
427  {
428  mac.SetType ("ns3::StaWifiMac",
429  "Ssid", SsidValue (ssid),
430  "ActiveProbing", BooleanValue (false));
431  staDevice = wifi.Install (spectrumPhy, mac, wifiStaNode);
432  mac.SetType ("ns3::ApWifiMac",
433  "Ssid", SsidValue (ssid));
434  apDevice = wifi.Install (spectrumPhy, mac, wifiApNode);
435  }
436 
437  // mobility.
439  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
440 
441  positionAlloc->Add (Vector (0.0, 0.0, 0.0));
442  positionAlloc->Add (Vector (distance, 0.0, 0.0));
443  mobility.SetPositionAllocator (positionAlloc);
444 
445  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
446 
447  mobility.Install (wifiApNode);
448  mobility.Install (wifiStaNode);
449 
450  /* Internet stack*/
452  stack.Install (wifiApNode);
453  stack.Install (wifiStaNode);
454 
456  address.SetBase ("192.168.1.0", "255.255.255.0");
457  Ipv4InterfaceContainer staNodeInterface;
458  Ipv4InterfaceContainer apNodeInterface;
459 
460  staNodeInterface = address.Assign (staDevice);
461  apNodeInterface = address.Assign (apDevice);
462 
463  /* Setting applications */
464  ApplicationContainer serverApp;
465  if (udp)
466  {
467  //UDP flow
468  uint16_t port = 9;
469  UdpServerHelper server (port);
470  serverApp = server.Install (wifiStaNode.Get (0));
471  serverApp.Start (Seconds (0.0));
472  serverApp.Stop (Seconds (simulationTime + 1));
473 
474  UdpClientHelper client (staNodeInterface.GetAddress (0), port);
475  client.SetAttribute ("MaxPackets", UintegerValue (4294967295u));
476  client.SetAttribute ("Interval", TimeValue (Time ("0.00001"))); //packets/s
477  client.SetAttribute ("PacketSize", UintegerValue (payloadSize));
478  ApplicationContainer clientApp = client.Install (wifiApNode.Get (0));
479  clientApp.Start (Seconds (1.0));
480  clientApp.Stop (Seconds (simulationTime + 1));
481  }
482  else
483  {
484  //TCP flow
485  uint16_t port = 50000;
486  Address localAddress (InetSocketAddress (Ipv4Address::GetAny (), port));
487  PacketSinkHelper packetSinkHelper ("ns3::TcpSocketFactory", localAddress);
488  serverApp = packetSinkHelper.Install (wifiStaNode.Get (0));
489  serverApp.Start (Seconds (0.0));
490  serverApp.Stop (Seconds (simulationTime + 1));
491 
492  OnOffHelper onoff ("ns3::TcpSocketFactory", Ipv4Address::GetAny ());
493  onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
494  onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
495  onoff.SetAttribute ("PacketSize", UintegerValue (payloadSize));
496  onoff.SetAttribute ("DataRate", DataRateValue (1000000000)); //bit/s
497  AddressValue remoteAddress (InetSocketAddress (staNodeInterface.GetAddress (0), port));
498  onoff.SetAttribute ("Remote", remoteAddress);
499  ApplicationContainer clientApp = onoff.Install (wifiApNode.Get (0));
500  clientApp.Start (Seconds (1.0));
501  clientApp.Stop (Seconds (simulationTime + 1));
502  }
503 
504  Config::ConnectWithoutContext ("/NodeList/0/DeviceList/*/Phy/MonitorSnifferRx", MakeCallback (&MonitorSniffRx));
505 
506  if (enablePcap)
507  {
508  std::stringstream ss;
509  ss << "wifi-spectrum-per-example-" << i;
510  phy.EnablePcap (ss.str (), apDevice);
511  }
512  g_signalDbmAvg = 0;
513  g_noiseDbmAvg = 0;
514  g_samples = 0;
515 
516  Simulator::Stop (Seconds (simulationTime + 1));
517  Simulator::Run ();
518 
519  double throughput = 0;
520  uint64_t totalPacketsThrough = 0;
521  if (udp)
522  {
523  //UDP
524  totalPacketsThrough = DynamicCast<UdpServer> (serverApp.Get (0))->GetReceived ();
525  throughput = totalPacketsThrough * payloadSize * 8 / (simulationTime * 1000000.0); //Mbit/s
526  }
527  else
528  {
529  //TCP
530  uint32_t totalBytesRx = DynamicCast<PacketSink> (serverApp.Get (0))->GetTotalRx ();
531  totalPacketsThrough = totalBytesRx / tcpPacketSize;
532  throughput = totalBytesRx * 8 / (simulationTime * 1000000.0); //Mbit/s
533  }
534  std::cout << std::setw (5) << i <<
535  std::setw (6) << (i % 8) <<
536  std::setprecision (2) << std::fixed <<
537  std::setw (10) << datarate <<
538  std::setw (12) << throughput <<
539  std::setw (8) << totalPacketsThrough;
540  if (totalPacketsThrough > 0)
541  {
542  std::cout << std::setw (12) << g_signalDbmAvg <<
543  std::setw (12) << g_noiseDbmAvg <<
544  std::setw (12) << (g_signalDbmAvg - g_noiseDbmAvg) <<
545  std::endl;
546  }
547  else
548  {
549  std::cout << std::setw (12) << "N/A" <<
550  std::setw (12) << "N/A" <<
551  std::setw (12) << "N/A" <<
552  std::endl;
553  }
555  }
556  return 0;
557 }
MpduInfo structure.
Definition: wifi-phy.h:74
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.
double signal
in dBm
Definition: wifi-phy.h:69
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
an Inet address class
static Ipv4Address GetAny(void)
AttributeValue implementation for Boolean.
Definition: boolean.h:36
HT 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:719
Hold variables of type string.
Definition: string.h:41
Make it easy to create and manage PHY objects for the yans model.
bool enablePcap
double g_noiseDbmAvg
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
virtual void AddPropagationLossModel(Ptr< PropagationLossModel > loss)
Add 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:213
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
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
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:1055
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: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
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Definition: callback.h:1489
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
Definition: config.cc:832
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
void MonitorSniffRx(Ptr< const Packet > packet, uint16_t channelFreqMhz, WifiTxVector txVector, MpduInfo aMpdu, SignalNoiseDbm signalNoise)
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.
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...
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:498
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
Definition: simulator.cc:234
SignalNoiseDbm structure.
Definition: wifi-phy.h:67
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:993
AttributeValue implementation for Ssid.
Definition: ssid.h:117
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:782
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.
double noise
in dBm
Definition: wifi-phy.h:70
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.