A Discrete-Event Network Simulator
API
wifi-spectrum-per-interference.cc
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2009 MIRKO BANCHI
4  * Copyright (c) 2015 University of Washington
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Authors: Mirko Banchi <mk.banchi@gmail.com>
20  * Sebastien Deronne <sebastien.deronne@gmail.com>
21  * Tom Henderson <tomhend@u.washington.edu>
22  *
23  * Adapted from ht-wifi-network.cc example
24  */
25 
26 #include <iomanip>
27 #include "ns3/core-module.h"
28 #include "ns3/applications-module.h"
29 #include "ns3/wifi-module.h"
30 #include "ns3/mobility-module.h"
31 #include "ns3/spectrum-module.h"
32 #include "ns3/internet-module.h"
33 
34 // This is a simple example of an IEEE 802.11n Wi-Fi network with a
35 // non-Wi-Fi interferer. It is an adaptation of the wifi-spectrum-per-example
36 //
37 // Unless the --waveformPower argument is passed, it will operate similarly to
38 // wifi-spectrum-per-example. Adding --waveformPower=value for values
39 // greater than 0.0001 will result in frame losses beyond those that
40 // result from the normal SNR based on distance path loss.
41 //
42 // If YansWifiPhy is selected as the wifiType, --waveformPower will have
43 // no effect.
44 //
45 // Network topology:
46 //
47 // Wi-Fi 192.168.1.0
48 //
49 // STA AP
50 // * <-- distance --> *
51 // | |
52 // n1 n2
53 //
54 // Users may vary the following command-line arguments in addition to the
55 // attributes, global values, and default values typically available:
56 //
57 // --simulationTime: Simulation time in seconds [10]
58 // --udp: UDP if set to 1, TCP otherwise [true]
59 // --distance: meters separation between nodes [50]
60 // --index: restrict index to single value between 0 and 31 [256]
61 // --wifiType: select ns3::SpectrumWifiPhy or ns3::YansWifiPhy [ns3::SpectrumWifiPhy]
62 // --errorModelType: select ns3::NistErrorRateModel or ns3::YansErrorRateModel [ns3::NistErrorRateModel]
63 // --enablePcap: enable pcap output [false]
64 // --waveformPower: Waveform power [0]
65 //
66 // By default, the program will step through 32 index values, corresponding
67 // to the following MCS, channel width, and guard interval combinations:
68 // index 0-7: MCS 0-7, long guard interval, 20 MHz channel
69 // index 8-15: MCS 0-7, short guard interval, 20 MHz channel
70 // index 16-23: MCS 0-7, long guard interval, 40 MHz channel
71 // index 24-31: MCS 0-7, short guard interval, 40 MHz channel
72 // and send UDP for 10 seconds using each MCS, using the SpectrumWifiPhy and the
73 // NistErrorRateModel, at a distance of 50 meters. The program outputs
74 // results such as:
75 //
76 // wifiType: ns3::SpectrumWifiPhy distance: 50m; time: 10; TxPower: 16 dBm (40 mW)
77 // index MCS Rate (Mb/s) Tput (Mb/s) Received Signal (dBm)Noi+Inf(dBm) SNR (dB)
78 // 0 0 6.50 5.77 7414 -64.69 -93.97 29.27
79 // 1 1 13.00 11.58 14892 -64.69 -93.97 29.27
80 // 2 2 19.50 17.39 22358 -64.69 -93.97 29.27
81 // 3 3 26.00 23.23 29875 -64.69 -93.97 29.27
82 // ...
83 //
84 
85 using namespace ns3;
86 
87 // Global variables for use in callbacks.
90 uint32_t g_samples;
91 
93  uint16_t channelFreqMhz,
94  WifiTxVector txVector,
95  MpduInfo aMpdu,
96  SignalNoiseDbm signalNoise)
97 
98 {
99  g_samples++;
100  g_signalDbmAvg += ((signalNoise.signal - g_signalDbmAvg) / g_samples);
101  g_noiseDbmAvg += ((signalNoise.noise - g_noiseDbmAvg) / g_samples);
102 }
103 
104 NS_LOG_COMPONENT_DEFINE ("WifiSpectrumPerInterference");
105 
107 
109 {
110 public:
112  {
113  BandInfo bandInfo;
114  bandInfo.fc = 5180e6;
115  bandInfo.fl = 5180e6 - 10e6;
116  bandInfo.fh = 5180e6 + 10e6;
117 
118  Bands bands;
119  bands.push_back (bandInfo);
120 
121  SpectrumModelWifi5180MHz = Create<SpectrumModel> (bands);
122  }
123 
125 
126 int main (int argc, char *argv[])
127 {
128  bool udp = true;
129  double distance = 50;
130  double simulationTime = 10; //seconds
131  uint16_t index = 256;
132  std::string wifiType = "ns3::SpectrumWifiPhy";
133  std::string errorModelType = "ns3::NistErrorRateModel";
134  bool enablePcap = false;
135  const uint32_t tcpPacketSize = 1448;
136  double waveformPower = 0;
137 
139  cmd.AddValue ("simulationTime", "Simulation time in seconds", simulationTime);
140  cmd.AddValue ("udp", "UDP if set to 1, TCP otherwise", udp);
141  cmd.AddValue ("distance", "meters separation between nodes", distance);
142  cmd.AddValue ("index", "restrict index to single value between 0 and 31", index);
143  cmd.AddValue ("wifiType", "select ns3::SpectrumWifiPhy or ns3::YansWifiPhy", wifiType);
144  cmd.AddValue ("errorModelType", "select ns3::NistErrorRateModel or ns3::YansErrorRateModel", errorModelType);
145  cmd.AddValue ("enablePcap", "enable pcap output", enablePcap);
146  cmd.AddValue ("waveformPower", "Waveform power", waveformPower);
147  cmd.Parse (argc,argv);
148 
149  uint16_t startIndex = 0;
150  uint16_t stopIndex = 31;
151  if (index < 32)
152  {
153  startIndex = index;
154  stopIndex = index;
155  }
156 
157  std::cout << "wifiType: " << wifiType << " distance: " << distance << "m; time: " << simulationTime << "; TxPower: 16 dBm (40 mW)" << std::endl;
158  std::cout << std::setw (5) << "index" <<
159  std::setw (6) << "MCS" <<
160  std::setw (13) << "Rate (Mb/s)" <<
161  std::setw (12) << "Tput (Mb/s)" <<
162  std::setw (10) << "Received " <<
163  std::setw (12) << "Signal (dBm)" <<
164  std::setw (12) << "Noi+Inf(dBm)" <<
165  std::setw (9) << "SNR (dB)" <<
166  std::endl;
167  for (uint16_t i = startIndex; i <= stopIndex; i++)
168  {
169  uint32_t payloadSize;
170  if (udp)
171  {
172  payloadSize = 972; // 1000 bytes IPv4
173  }
174  else
175  {
176  payloadSize = 1448; // 1500 bytes IPv6
177  Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (payloadSize));
178  }
179 
180  NodeContainer wifiStaNode;
181  wifiStaNode.Create (1);
183  wifiApNode.Create (1);
184  NodeContainer interferingNode;
185  interferingNode.Create (1);
186 
189  Ptr<MultiModelSpectrumChannel> spectrumChannel;
190  if (wifiType == "ns3::YansWifiPhy")
191  {
193  channel.AddPropagationLoss ("ns3::FriisPropagationLossModel",
194  "Frequency", DoubleValue (5.180e9));
195  channel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
196  phy.SetChannel (channel.Create ());
197  phy.Set ("Frequency", UintegerValue (5180));
198 
199  if (i <= 7)
200  {
201  phy.Set ("ShortGuardEnabled", BooleanValue (false));
202  phy.Set ("ChannelWidth", UintegerValue (20));
203  }
204  else if (i > 7 && i <= 15)
205  {
206  phy.Set ("ShortGuardEnabled", BooleanValue (true));
207  phy.Set ("ChannelWidth", UintegerValue (20));
208  }
209  else if (i > 15 && i <= 23)
210  {
211  phy.Set ("ShortGuardEnabled", BooleanValue (false));
212  phy.Set ("ChannelWidth", UintegerValue (40));
213  }
214  else
215  {
216  phy.Set ("ShortGuardEnabled", BooleanValue (true));
217  phy.Set ("ChannelWidth", UintegerValue (40));
218  }
219  }
220  else if (wifiType == "ns3::SpectrumWifiPhy")
221  {
222  //Bug 2460: CcaMode1Threshold default should be set to -62 dBm when using Spectrum
223  Config::SetDefault ("ns3::WifiPhy::CcaMode1Threshold", DoubleValue (-62.0));
224 
225  spectrumChannel
226  = CreateObject<MultiModelSpectrumChannel> ();
228  = CreateObject<FriisPropagationLossModel> ();
229  lossModel->SetFrequency (5.180e9);
230  spectrumChannel->AddPropagationLossModel (lossModel);
231 
233  = CreateObject<ConstantSpeedPropagationDelayModel> ();
234  spectrumChannel->SetPropagationDelayModel (delayModel);
235 
236  spectrumPhy.SetChannel (spectrumChannel);
237  spectrumPhy.SetErrorRateModel (errorModelType);
238  spectrumPhy.Set ("Frequency", UintegerValue (5180)); // channel 36 at 20 MHz
239 
240  if (i <= 7)
241  {
242  spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (false));
243  spectrumPhy.Set ("ChannelWidth", UintegerValue (20));
244  }
245  else if (i > 7 && i <= 15)
246  {
247  spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (true));
248  spectrumPhy.Set ("ChannelWidth", UintegerValue (20));
249  }
250  else if (i > 15 && i <= 23)
251  {
252  spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (false));
253  spectrumPhy.Set ("ChannelWidth", UintegerValue (40));
254  }
255  else
256  {
257  spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (true));
258  spectrumPhy.Set ("ChannelWidth", UintegerValue (40));
259  }
260  }
261  else
262  {
263  NS_FATAL_ERROR ("Unsupported WiFi type " << wifiType);
264  }
265 
269 
270  Ssid ssid = Ssid ("ns380211n");
271 
272  double datarate = 0;
274  if (i == 0)
275  {
276  DataRate = StringValue ("HtMcs0");
277  datarate = 6.5;
278  }
279  else if (i == 1)
280  {
281  DataRate = StringValue ("HtMcs1");
282  datarate = 13;
283  }
284  else if (i == 2)
285  {
286  DataRate = StringValue ("HtMcs2");
287  datarate = 19.5;
288  }
289  else if (i == 3)
290  {
291  DataRate = StringValue ("HtMcs3");
292  datarate = 26;
293  }
294  else if (i == 4)
295  {
296  DataRate = StringValue ("HtMcs4");
297  datarate = 39;
298  }
299  else if (i == 5)
300  {
301  DataRate = StringValue ("HtMcs5");
302  datarate = 52;
303  }
304  else if (i == 6)
305  {
306  DataRate = StringValue ("HtMcs6");
307  datarate = 58.5;
308  }
309  else if (i == 7)
310  {
311  DataRate = StringValue ("HtMcs7");
312  datarate = 65;
313  }
314  else if (i == 8)
315  {
316  DataRate = StringValue ("HtMcs0");
317  datarate = 7.2;
318  }
319  else if (i == 9)
320  {
321  DataRate = StringValue ("HtMcs1");
322  datarate = 14.4;
323  }
324  else if (i == 10)
325  {
326  DataRate = StringValue ("HtMcs2");
327  datarate = 21.7;
328  }
329  else if (i == 11)
330  {
331  DataRate = StringValue ("HtMcs3");
332  datarate = 28.9;
333  }
334  else if (i == 12)
335  {
336  DataRate = StringValue ("HtMcs4");
337  datarate = 43.3;
338  }
339  else if (i == 13)
340  {
341  DataRate = StringValue ("HtMcs5");
342  datarate = 57.8;
343  }
344  else if (i == 14)
345  {
346  DataRate = StringValue ("HtMcs6");
347  datarate = 65;
348  }
349  else if (i == 15)
350  {
351  DataRate = StringValue ("HtMcs7");
352  datarate = 72.2;
353  }
354  else if (i == 16)
355  {
356  DataRate = StringValue ("HtMcs0");
357  datarate = 13.5;
358  }
359  else if (i == 17)
360  {
361  DataRate = StringValue ("HtMcs1");
362  datarate = 27;
363  }
364  else if (i == 18)
365  {
366  DataRate = StringValue ("HtMcs2");
367  datarate = 40.5;
368  }
369  else if (i == 19)
370  {
371  DataRate = StringValue ("HtMcs3");
372  datarate = 54;
373  }
374  else if (i == 20)
375  {
376  DataRate = StringValue ("HtMcs4");
377  datarate = 81;
378  }
379  else if (i == 21)
380  {
381  DataRate = StringValue ("HtMcs5");
382  datarate = 108;
383  }
384  else if (i == 22)
385  {
386  DataRate = StringValue ("HtMcs6");
387  datarate = 121.5;
388  }
389  else if (i == 23)
390  {
391  DataRate = StringValue ("HtMcs7");
392  datarate = 135;
393  }
394  else if (i == 24)
395  {
396  DataRate = StringValue ("HtMcs0");
397  datarate = 15;
398  }
399  else if (i == 25)
400  {
401  DataRate = StringValue ("HtMcs1");
402  datarate = 30;
403  }
404  else if (i == 26)
405  {
406  DataRate = StringValue ("HtMcs2");
407  datarate = 45;
408  }
409  else if (i == 27)
410  {
411  DataRate = StringValue ("HtMcs3");
412  datarate = 60;
413  }
414  else if (i == 28)
415  {
416  DataRate = StringValue ("HtMcs4");
417  datarate = 90;
418  }
419  else if (i == 29)
420  {
421  DataRate = StringValue ("HtMcs5");
422  datarate = 120;
423  }
424  else if (i == 30)
425  {
426  DataRate = StringValue ("HtMcs6");
427  datarate = 135;
428  }
429  else
430  {
431  DataRate = StringValue ("HtMcs7");
432  datarate = 150;
433  }
434 
435  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager","DataMode", DataRate,
436  "ControlMode", DataRate);
437 
438  NetDeviceContainer staDevice;
439  NetDeviceContainer apDevice;
440 
441  if (wifiType == "ns3::YansWifiPhy")
442  {
443  mac.SetType ("ns3::StaWifiMac",
444  "Ssid", SsidValue (ssid),
445  "ActiveProbing", BooleanValue (false));
446  staDevice = wifi.Install (phy, mac, wifiStaNode);
447  mac.SetType ("ns3::ApWifiMac",
448  "Ssid", SsidValue (ssid));
449  apDevice = wifi.Install (phy, mac, wifiApNode);
450 
451  }
452  else if (wifiType == "ns3::SpectrumWifiPhy")
453  {
454  mac.SetType ("ns3::StaWifiMac",
455  "Ssid", SsidValue (ssid),
456  "ActiveProbing", BooleanValue (false));
457  staDevice = wifi.Install (spectrumPhy, mac, wifiStaNode);
458  mac.SetType ("ns3::ApWifiMac",
459  "Ssid", SsidValue (ssid));
460  apDevice = wifi.Install (spectrumPhy, mac, wifiApNode);
461  }
462 
463  // mobility.
465  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
466 
467  positionAlloc->Add (Vector (0.0, 0.0, 0.0));
468  positionAlloc->Add (Vector (distance, 0.0, 0.0));
469  positionAlloc->Add (Vector (distance, distance, 0.0));
470  mobility.SetPositionAllocator (positionAlloc);
471 
472  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
473 
474  mobility.Install (wifiApNode);
475  mobility.Install (wifiStaNode);
476  mobility.Install (interferingNode);
477 
478  /* Internet stack*/
480  stack.Install (wifiApNode);
481  stack.Install (wifiStaNode);
482 
484  address.SetBase ("192.168.1.0", "255.255.255.0");
485  Ipv4InterfaceContainer staNodeInterface;
486  Ipv4InterfaceContainer apNodeInterface;
487 
488  staNodeInterface = address.Assign (staDevice);
489  apNodeInterface = address.Assign (apDevice);
490 
491  /* Setting applications */
492  ApplicationContainer serverApp;
493  if (udp)
494  {
495  //UDP flow
496  uint16_t port = 9;
497  UdpServerHelper server (port);
498  serverApp = server.Install (wifiStaNode.Get (0));
499  serverApp.Start (Seconds (0.0));
500  serverApp.Stop (Seconds (simulationTime + 1));
501 
502  UdpClientHelper client (staNodeInterface.GetAddress (0), port);
503  client.SetAttribute ("MaxPackets", UintegerValue (4294967295u));
504  client.SetAttribute ("Interval", TimeValue (Time ("0.00001"))); //packets/s
505  client.SetAttribute ("PacketSize", UintegerValue (payloadSize));
506  ApplicationContainer clientApp = client.Install (wifiApNode.Get (0));
507  clientApp.Start (Seconds (1.0));
508  clientApp.Stop (Seconds (simulationTime + 1));
509  }
510  else
511  {
512  //TCP flow
513  uint16_t port = 50000;
514  Address localAddress (InetSocketAddress (Ipv4Address::GetAny (), port));
515  PacketSinkHelper packetSinkHelper ("ns3::TcpSocketFactory", localAddress);
516  serverApp = packetSinkHelper.Install (wifiStaNode.Get (0));
517  serverApp.Start (Seconds (0.0));
518  serverApp.Stop (Seconds (simulationTime + 1));
519 
520  OnOffHelper onoff ("ns3::TcpSocketFactory", Ipv4Address::GetAny ());
521  onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
522  onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
523  onoff.SetAttribute ("PacketSize", UintegerValue (payloadSize));
524  onoff.SetAttribute ("DataRate", DataRateValue (1000000000)); //bit/s
525  AddressValue remoteAddress (InetSocketAddress (staNodeInterface.GetAddress (0), port));
526  onoff.SetAttribute ("Remote", remoteAddress);
527  ApplicationContainer clientApp = onoff.Install (wifiApNode.Get (0));
528  clientApp.Start (Seconds (1.0));
529  clientApp.Stop (Seconds (simulationTime + 1));
530  }
531 
532  // Configure waveform generator
533  Ptr<SpectrumValue> wgPsd = Create<SpectrumValue> (SpectrumModelWifi5180MHz);
534  *wgPsd = waveformPower / (100 * 180000);
535  NS_LOG_INFO ("wgPsd : " << *wgPsd << " integrated power: " << Integral (*(GetPointer (wgPsd))));
536 
537  if (wifiType == "ns3::SpectrumWifiPhy")
538  {
539  WaveformGeneratorHelper waveformGeneratorHelper;
540  waveformGeneratorHelper.SetChannel (spectrumChannel);
541  waveformGeneratorHelper.SetTxPowerSpectralDensity (wgPsd);
542 
543  waveformGeneratorHelper.SetPhyAttribute ("Period", TimeValue (Seconds (0.0007)));
544  waveformGeneratorHelper.SetPhyAttribute ("DutyCycle", DoubleValue (1));
545  NetDeviceContainer waveformGeneratorDevices = waveformGeneratorHelper.Install (interferingNode);
546 
548  waveformGeneratorDevices.Get (0)->GetObject<NonCommunicatingNetDevice> ()->GetPhy ()->GetObject<WaveformGenerator> ());
549  }
550 
551  Config::ConnectWithoutContext ("/NodeList/0/DeviceList/*/Phy/MonitorSnifferRx", MakeCallback (&MonitorSniffRx));
552 
553  if (enablePcap)
554  {
555  std::stringstream ss;
556  ss << "wifi-spectrum-per-example-" << i;
557  phy.EnablePcap (ss.str (), apDevice);
558  }
559  g_signalDbmAvg = 0;
560  g_noiseDbmAvg = 0;
561  g_samples = 0;
562 
563  // Make sure we are tuned to 5180 MHz; if not, the example will
564  // not work properly
565  Ptr<NetDevice> staDevicePtr = staDevice.Get (0);
566  Ptr<WifiNetDevice> wifiStaDevicePtr = staDevicePtr->GetObject <WifiNetDevice> ();
567  UintegerValue val;
568  wifiStaDevicePtr->GetPhy ()->GetAttribute ("Frequency", val);
569  if (val.Get () != 5180)
570  {
571  NS_FATAL_ERROR ("Error: Wi-Fi nodes must be tuned to 5180 MHz to match the waveform generator");
572  }
573 
574  Simulator::Stop (Seconds (simulationTime + 1));
575  Simulator::Run ();
576 
577  double throughput = 0;
578  uint32_t totalPacketsThrough = 0;
579  if (udp)
580  {
581  //UDP
582  totalPacketsThrough = DynamicCast<UdpServer> (serverApp.Get (0))->GetReceived ();
583  throughput = totalPacketsThrough * payloadSize * 8 / (simulationTime * 1000000.0); //Mbit/s
584  }
585  else
586  {
587  //TCP
588  uint32_t totalBytesRx = DynamicCast<PacketSink> (serverApp.Get (0))->GetTotalRx ();
589  totalPacketsThrough = totalBytesRx / tcpPacketSize;
590  throughput = totalBytesRx * 8 / (simulationTime * 1000000.0); //Mbit/s
591  }
592  std::cout << std::setw (5) << i <<
593  std::setw (6) << (i % 8) <<
594  std::setprecision (2) << std::fixed <<
595  std::setw (10) << datarate <<
596  std::setw (12) << throughput <<
597  std::setw (8) << totalPacketsThrough;
598  if (totalPacketsThrough > 0)
599  {
600  std::cout << std::setw (12) << g_signalDbmAvg <<
601  std::setw (12) << g_noiseDbmAvg <<
602  std::setw (12) << (g_signalDbmAvg - g_noiseDbmAvg) <<
603  std::endl;
604  }
605  else
606  {
607  std::cout << std::setw (12) << "N/A" <<
608  std::setw (12) << "N/A" <<
609  std::setw (12) << "N/A" <<
610  std::endl;
611  }
613  }
614  return 0;
615 }
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.
Ptr< SpectrumModel > SpectrumModelWifi5180MHz
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...
double Integral(const SpectrumValue &arg)
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
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:459
Hold variables of type string.
Definition: string.h:41
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
Make it easy to create and manage PHY objects for the yans model.
uint32_t g_samples
bool enablePcap
NetDeviceContainer Install(NodeContainer c) const
void SetPhyAttribute(std::string name, const AttributeValue &v)
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_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:277
#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.
This class implements a device which does not communicate, in the sense that it does not interact wit...
helps to create WifiNetDevice objects
Definition: wifi-helper.h:213
void SetTxPowerSpectralDensity(Ptr< SpectrumValue > txPsd)
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 void Start()
Start the waveform generator.
std::vector< BandInfo > Bands
Container of BandInfo.
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
Simple SpectrumPhy implementation that sends customizable waveform.
void SetChannel(Ptr< YansWifiChannel > channel)
Ptr< WifiPhy > GetPhy(void) const
U * GetPointer(const Ptr< U > &p)
Definition: ptr.h:570
void Install(Ptr< Node > node) const
"Layout" a single node according to the current position allocator type.
tuple mobility
Definition: third.py:101
tuple phy
Definition: third.py:86
static EventId Schedule(Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event to expire after delay.
Definition: simulator.h:1375
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
double fc
center frequency
holds a vector of ns3::NetDevice pointers
virtual void SetStandard(enum WifiPhyStandard standard)
Definition: wifi-helper.cc:742
Create a server application which waits for input UDP packets and uses the information carried into t...
virtual NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &mac, NodeContainer::Iterator first, NodeContainer::Iterator last) const
Definition: wifi-helper.cc:748
Hold together all Wifi-related objects.
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
Create a Waveform generator, which can be used to inject specific noise in the channel.
tuple mac
Definition: third.py:92
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter...
Parse command-line arguments.
Definition: command-line.h:205
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
Definition: simulator.cc:190
tuple wifiApNode
Definition: third.py:83
void SetAttribute(std::string name, const AttributeValue &value)
Record an attribute to be set in each Application after it is is created.
void MonitorSniffRx(Ptr< const Packet > packet, uint16_t channelFreqMhz, WifiTxVector txVector, MpduInfo aMpdu, SignalNoiseDbm signalNoise)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double fl
lower limit of subband
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.
void GetAttribute(std::string name, AttributeValue &value) const
Get the value of an attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:223
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...
double fh
upper limit of subband
This class can be used to hold variables of floating point type such as 'double' or 'float'...
Definition: double.h:41
class static_SpectrumModelWifi5180MHz_initializer static_SpectrumModelWifi5180MHz_initializer_instance
The building block of a SpectrumModel.
void SetChannel(Ptr< SpectrumChannel > channel)
set the SpectrumChannel that will be used by SpectrumPhy instances created by this helper ...
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.