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 #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 with a
38 // non-Wi-Fi interferer. It is an adaptation of the wifi-spectrum-per-example
39 //
40 // Unless the --waveformPower argument is passed, it will behave like
41 // wifi-spectrum-per-example. Adding --waveformPower=value for values
42 // greater than 0.0001 will result in frame losses beyond those that
43 // result from the normal SNR based on distance path loss.
44 //
45 // If YansWifiPhy is selected as the wifiType, --waveformPower will have
46 // no effect.
47 //
48 // Network topology:
49 //
50 // Wi-Fi 192.168.1.0
51 //
52 // STA AP
53 // * <-- distance --> *
54 // | |
55 // n1 n2
56 //
57 // Users may vary the following command-line arguments in addition to the
58 // attributes, global values, and default values typically available:
59 //
60 // --simulationTime: Simulation time in seconds [10]
61 // --udp: UDP if set to 1, TCP otherwise [true]
62 // --distance: meters separation between nodes [50]
63 // --index: restrict index to single value between 0 and 31 [256]
64 // --wifiType: select ns3::SpectrumWifiPhy or ns3::YansWifiPhy [ns3::SpectrumWifiPhy]
65 // --errorModelType: select ns3::NistErrorRateModel or ns3::YansErrorRateModel [ns3::NistErrorRateModel]
66 // --enablePcap: enable pcap output [false]
67 // --waveformPower: Waveform power [0]
68 //
69 // By default, the program will step through 32 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 // and send 1000 UDP packets using each MCS, using the SpectrumWifiPhy and the
76 // NistErrorRateModel, at a distance of 50 meters. The program outputs
77 // results such as:
78 //
79 // wifiType: ns3::SpectrumWifiPhy distance: 50m; sent: 1000
80 // index MCS Rate (Mb/s) Tput (Mb/s) Received Signal (dBm) Noise (dBm) SNR (dB)
81 // 0 0 6.5 0.7776 1000 -77.6633 -100.966 23.3027
82 // 1 1 13 0.7776 1000 -77.6633 -100.966 23.3027
83 // 2 2 19.5 0.7776 1000 -77.6633 -100.966 23.3027
84 // 3 3 26 0.7776 1000 -77.6633 -100.966 23.3027
85 // ...
86 //
87 // When UDP is used, the throughput will always be 0.7776 Mb/s since the
88 // traffic generator does not attempt to match the maximum Phy data rate
89 // but instead sends at a constant rate. When TCP is used, the TCP flow
90 // will exhibit different throughput depending on the index.
91 
92 using namespace ns3;
93 
94 // Global variables for use in callbacks.
97 uint32_t g_samples;
98 uint16_t g_channelNumber;
99 uint32_t g_rate;
100 
101 void MonitorSniffRx (Ptr<const Packet> packet, uint16_t channelFreqMhz,
102  uint16_t channelNumber, uint32_t rate,
103  WifiPreamble preamble, WifiTxVector txVector,
104  struct mpduInfo aMpdu, struct signalNoiseDbm signalNoise)
105 
106 {
107  g_samples++;
108  g_signalDbmAvg += ((signalNoise.signal - g_signalDbmAvg) / g_samples);
109  g_noiseDbmAvg += ((signalNoise.noise - g_noiseDbmAvg) / g_samples);
110  g_rate = rate;
111  g_channelNumber = channelNumber;
112 }
113 
114 NS_LOG_COMPONENT_DEFINE ("WifiSpectrumPerInterference");
115 
117 
119 {
120 public:
122  {
123  BandInfo bandInfo;
124  bandInfo.fc = 5180e6;
125  bandInfo.fl = 5180e6 - 10e6;
126  bandInfo.fh = 5180e6 + 10e6;
127 
128  Bands bands;
129  bands.push_back (bandInfo);
130 
131  SpectrumModelWifi5180MHz = Create<SpectrumModel> (bands);
132  }
133 
135 
136 int main (int argc, char *argv[])
137 {
138  bool udp = true;
139  double distance = 50;
140  double simulationTime = 10; //seconds
141  uint16_t index = 256;
142  std::string wifiType = "ns3::SpectrumWifiPhy";
143  std::string errorModelType = "ns3::NistErrorRateModel";
144  bool enablePcap = false;
145  const uint32_t tcpPacketSize = 1448;
146  double waveformPower = 0;
147 
149  cmd.AddValue ("simulationTime", "Simulation time in seconds", simulationTime);
150  cmd.AddValue ("udp", "UDP if set to 1, TCP otherwise", udp);
151  cmd.AddValue ("distance", "meters separation between nodes", distance);
152  cmd.AddValue ("index", "restrict index to single value between 0 and 31", index);
153  cmd.AddValue ("wifiType", "select ns3::SpectrumWifiPhy or ns3::YansWifiPhy", wifiType);
154  cmd.AddValue ("errorModelType", "select ns3::NistErrorRateModel or ns3::YansErrorRateModel", errorModelType);
155  cmd.AddValue ("enablePcap", "enable pcap output", enablePcap);
156  cmd.AddValue ("waveformPower", "Waveform power", waveformPower);
157  cmd.Parse (argc,argv);
158 
159  uint16_t startIndex = 0;
160  uint16_t stopIndex = 31;
161  if (index < 32)
162  {
163  startIndex = index;
164  stopIndex = index;
165  }
166 
167  std::cout << "wifiType: " << wifiType << " distance: " << distance << "m; sent: 1000 TxPower: 16 dBm (40 mW)" << std::endl;
168  std::cout << std::setw (5) << "index" <<
169  std::setw (6) << "MCS" <<
170  std::setw (12) << "Rate (Mb/s)" <<
171  std::setw (12) << "Tput (Mb/s)" <<
172  std::setw (10) << "Received " <<
173  std::setw (12) << "Signal (dBm)" <<
174  std::setw (12) << "Noi+Inf(dBm)" <<
175  std::setw (10) << "SNR (dB)" <<
176  std::endl;
177  for (uint16_t i = startIndex; i <= stopIndex; i++)
178  {
179  uint32_t payloadSize;
180  if (udp)
181  {
182  payloadSize = 972; // 1000 bytes IPv4
183  }
184  else
185  {
186  payloadSize = 1448; // 1500 bytes IPv6
187  Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (payloadSize));
188  }
189 
190  NodeContainer wifiStaNode;
191  wifiStaNode.Create (1);
193  wifiApNode.Create (1);
194  NodeContainer interferingNode;
195  interferingNode.Create (1);
196 
199  Ptr<MultiModelSpectrumChannel> spectrumChannel;
200  if (wifiType == "ns3::YansWifiPhy")
201  {
203  channel.AddPropagationLoss ("ns3::FriisPropagationLossModel");
204  channel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
205  phy.SetChannel (channel.Create ());
206  phy.Set ("Frequency", UintegerValue (5180));
207 
208  if (i <= 7)
209  {
210  phy.Set ("ShortGuardEnabled", BooleanValue (false));
211  phy.Set ("ChannelWidth", UintegerValue (20));
212  }
213  else if (i > 7 && i <= 15)
214  {
215  phy.Set ("ShortGuardEnabled", BooleanValue (true));
216  phy.Set ("ChannelWidth", UintegerValue (20));
217  }
218  else if (i > 15 && i <= 23)
219  {
220  phy.Set ("ShortGuardEnabled", BooleanValue (false));
221  phy.Set ("ChannelWidth", UintegerValue (40));
222  }
223  else
224  {
225  phy.Set ("ShortGuardEnabled", BooleanValue (true));
226  phy.Set ("ChannelWidth", UintegerValue (40));
227  }
228  }
229  else if (wifiType == "ns3::SpectrumWifiPhy")
230  {
231  //Bug 2460: CcaMode1Threshold default should be set to -62 dBm when using Spectrum
232  Config::SetDefault ("ns3::WifiPhy::CcaMode1Threshold", DoubleValue (-62.0));
233 
234  spectrumChannel
235  = CreateObject<MultiModelSpectrumChannel> ();
237  = CreateObject<FriisPropagationLossModel> ();
238  spectrumChannel->AddPropagationLossModel (lossModel);
239 
240 
242  = CreateObject<ConstantSpeedPropagationDelayModel> ();
243  spectrumChannel->SetPropagationDelayModel (delayModel);
244 
245  spectrumPhy.SetChannel (spectrumChannel);
246  spectrumPhy.SetErrorRateModel (errorModelType);
247  spectrumPhy.Set ("Frequency", UintegerValue (5180)); // channel 36 at 20 MHz
248 
249  if (i <= 7)
250  {
251  spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (false));
252  spectrumPhy.Set ("ChannelWidth", UintegerValue (20));
253  }
254  else if (i > 7 && i <= 15)
255  {
256  spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (true));
257  spectrumPhy.Set ("ChannelWidth", UintegerValue (20));
258  }
259  else if (i > 15 && i <= 23)
260  {
261  spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (false));
262  spectrumPhy.Set ("ChannelWidth", UintegerValue (40));
263  }
264  else
265  {
266  spectrumPhy.Set ("ShortGuardEnabled", BooleanValue (true));
267  spectrumPhy.Set ("ChannelWidth", UintegerValue (40));
268  }
269  }
270  else
271  {
272  NS_FATAL_ERROR ("Unsupported WiFi type " << wifiType);
273  }
274 
275 
279 
280  Ssid ssid = Ssid ("ns380211n");
281 
282  double datarate = 0;
284  if (i == 0)
285  {
286  DataRate = StringValue ("HtMcs0");
287  datarate = 6.5;
288  }
289  else if (i == 1)
290  {
291  DataRate = StringValue ("HtMcs1");
292  datarate = 13;
293  }
294  else if (i == 2)
295  {
296  DataRate = StringValue ("HtMcs2");
297  datarate = 19.5;
298  }
299  else if (i == 3)
300  {
301  DataRate = StringValue ("HtMcs3");
302  datarate = 26;
303  }
304  else if (i == 4)
305  {
306  DataRate = StringValue ("HtMcs4");
307  datarate = 39;
308  }
309  else if (i == 5)
310  {
311  DataRate = StringValue ("HtMcs5");
312  datarate = 52;
313  }
314  else if (i == 6)
315  {
316  DataRate = StringValue ("HtMcs6");
317  datarate = 58.5;
318  }
319  else if (i == 7)
320  {
321  DataRate = StringValue ("HtMcs7");
322  datarate = 65;
323  }
324  else if (i == 8)
325  {
326  DataRate = StringValue ("HtMcs0");
327  datarate = 7.2;
328  }
329  else if (i == 9)
330  {
331  DataRate = StringValue ("HtMcs1");
332  datarate = 14.4;
333  }
334  else if (i == 10)
335  {
336  DataRate = StringValue ("HtMcs2");
337  datarate = 21.7;
338  }
339  else if (i == 11)
340  {
341  DataRate = StringValue ("HtMcs3");
342  datarate = 28.9;
343  }
344  else if (i == 12)
345  {
346  DataRate = StringValue ("HtMcs4");
347  datarate = 43.3;
348  }
349  else if (i == 13)
350  {
351  DataRate = StringValue ("HtMcs5");
352  datarate = 57.8;
353  }
354  else if (i == 14)
355  {
356  DataRate = StringValue ("HtMcs6");
357  datarate = 65;
358  }
359  else if (i == 15)
360  {
361  DataRate = StringValue ("HtMcs7");
362  datarate = 72.2;
363  }
364  else if (i == 16)
365  {
366  DataRate = StringValue ("HtMcs0");
367  datarate = 13.5;
368  }
369  else if (i == 17)
370  {
371  DataRate = StringValue ("HtMcs1");
372  datarate = 27;
373  }
374  else if (i == 18)
375  {
376  DataRate = StringValue ("HtMcs2");
377  datarate = 40.5;
378  }
379  else if (i == 19)
380  {
381  DataRate = StringValue ("HtMcs3");
382  datarate = 54;
383  }
384  else if (i == 20)
385  {
386  DataRate = StringValue ("HtMcs4");
387  datarate = 81;
388  }
389  else if (i == 21)
390  {
391  DataRate = StringValue ("HtMcs5");
392  datarate = 108;
393  }
394  else if (i == 22)
395  {
396  DataRate = StringValue ("HtMcs6");
397  datarate = 121.5;
398  }
399  else if (i == 23)
400  {
401  DataRate = StringValue ("HtMcs7");
402  datarate = 135;
403  }
404  else if (i == 24)
405  {
406  DataRate = StringValue ("HtMcs0");
407  datarate = 15;
408  }
409  else if (i == 25)
410  {
411  DataRate = StringValue ("HtMcs1");
412  datarate = 30;
413  }
414  else if (i == 26)
415  {
416  DataRate = StringValue ("HtMcs2");
417  datarate = 45;
418  }
419  else if (i == 27)
420  {
421  DataRate = StringValue ("HtMcs3");
422  datarate = 60;
423  }
424  else if (i == 28)
425  {
426  DataRate = StringValue ("HtMcs4");
427  datarate = 90;
428  }
429  else if (i == 29)
430  {
431  DataRate = StringValue ("HtMcs5");
432  datarate = 120;
433  }
434  else if (i == 30)
435  {
436  DataRate = StringValue ("HtMcs6");
437  datarate = 135;
438  }
439  else
440  {
441  DataRate = StringValue ("HtMcs7");
442  datarate = 150;
443  }
444 
445  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager","DataMode", DataRate,
446  "ControlMode", DataRate);
447 
448  NetDeviceContainer staDevice;
449  NetDeviceContainer apDevice;
450 
451  if (wifiType == "ns3::YansWifiPhy")
452  {
453  mac.SetType ("ns3::StaWifiMac",
454  "Ssid", SsidValue (ssid),
455  "ActiveProbing", BooleanValue (false));
456  staDevice = wifi.Install (phy, mac, wifiStaNode);
457  mac.SetType ("ns3::ApWifiMac",
458  "Ssid", SsidValue (ssid));
459  apDevice = wifi.Install (phy, mac, wifiApNode);
460 
461  }
462  else if (wifiType == "ns3::SpectrumWifiPhy")
463  {
464  mac.SetType ("ns3::StaWifiMac",
465  "Ssid", SsidValue (ssid),
466  "ActiveProbing", BooleanValue (false));
467  staDevice = wifi.Install (spectrumPhy, mac, wifiStaNode);
468  mac.SetType ("ns3::ApWifiMac",
469  "Ssid", SsidValue (ssid));
470  apDevice = wifi.Install (spectrumPhy, mac, wifiApNode);
471  }
472 
473  // mobility.
475  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
476 
477  positionAlloc->Add (Vector (0.0, 0.0, 0.0));
478  positionAlloc->Add (Vector (distance, 0.0, 0.0));
479  positionAlloc->Add (Vector (distance, distance, 0.0));
480  mobility.SetPositionAllocator (positionAlloc);
481 
482  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
483 
484  mobility.Install (wifiApNode);
485  mobility.Install (wifiStaNode);
486  mobility.Install (interferingNode);
487 
488  /* Internet stack*/
490  stack.Install (wifiApNode);
491  stack.Install (wifiStaNode);
492 
494 
495  address.SetBase ("192.168.1.0", "255.255.255.0");
496  Ipv4InterfaceContainer staNodeInterface;
497  Ipv4InterfaceContainer apNodeInterface;
498 
499  staNodeInterface = address.Assign (staDevice);
500  apNodeInterface = address.Assign (apDevice);
501 
502  /* Setting applications */
503  ApplicationContainer serverApp, sinkApp;
504  if (udp)
505  {
506  //UDP flow
507  UdpServerHelper myServer (9);
508  serverApp = myServer.Install (wifiStaNode.Get (0));
509  serverApp.Start (Seconds (0.0));
510  serverApp.Stop (Seconds (simulationTime + 1));
511 
512  UdpClientHelper myClient (staNodeInterface.GetAddress (0), 9);
513  myClient.SetAttribute ("MaxPackets", UintegerValue (1000));
514  myClient.SetAttribute ("Interval", TimeValue (MilliSeconds (5)));
515  myClient.SetAttribute ("PacketSize", UintegerValue (payloadSize));
516 
517  ApplicationContainer clientApp = myClient.Install (wifiApNode.Get (0));
518  clientApp.Start (Seconds (1.0));
519  clientApp.Stop (Seconds (simulationTime + 1));
520  }
521  else
522  {
523  //TCP flow
524  uint16_t port = 50000;
525  Address apLocalAddress (InetSocketAddress (Ipv4Address::GetAny (), port));
526  PacketSinkHelper packetSinkHelper ("ns3::TcpSocketFactory", apLocalAddress);
527  sinkApp = packetSinkHelper.Install (wifiStaNode.Get (0));
528 
529  sinkApp.Start (Seconds (0.0));
530  sinkApp.Stop (Seconds (simulationTime + 1));
531 
532  OnOffHelper onoff ("ns3::TcpSocketFactory",Ipv4Address::GetAny ());
533  onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
534  onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
535  onoff.SetAttribute ("PacketSize", UintegerValue (payloadSize));
536  onoff.SetAttribute ("DataRate", DataRateValue (1000000000)); //bit/s
538 
539  AddressValue remoteAddress (InetSocketAddress (staNodeInterface.GetAddress (0), port));
540  onoff.SetAttribute ("Remote", remoteAddress);
541  apps.Add (onoff.Install (wifiApNode.Get (0)));
542  apps.Start (Seconds (1.0));
543  apps.Stop (Seconds (simulationTime + 1));
544  }
545  // Configure waveform generator
546 
547  Ptr<SpectrumValue> wgPsd = Create<SpectrumValue> (SpectrumModelWifi5180MHz);
548  *wgPsd = waveformPower / (100 * 180000);
549  NS_LOG_INFO ("wgPsd : " << *wgPsd << " integrated power: " << Integral (*(GetPointer (wgPsd))));
550 
551  if (wifiType == "ns3::SpectrumWifiPhy")
552  {
553  WaveformGeneratorHelper waveformGeneratorHelper;
554  waveformGeneratorHelper.SetChannel (spectrumChannel);
555  waveformGeneratorHelper.SetTxPowerSpectralDensity (wgPsd);
556 
557  waveformGeneratorHelper.SetPhyAttribute ("Period", TimeValue (Seconds (0.0007)));
558  waveformGeneratorHelper.SetPhyAttribute ("DutyCycle", DoubleValue (1));
559  NetDeviceContainer waveformGeneratorDevices = waveformGeneratorHelper.Install (interferingNode);
560 
562  waveformGeneratorDevices.Get (0)->GetObject<NonCommunicatingNetDevice> ()->GetPhy ()->GetObject<WaveformGenerator> ());
563  }
564 
565  Config::ConnectWithoutContext ("/NodeList/0/DeviceList/*/Phy/MonitorSnifferRx", MakeCallback (&MonitorSniffRx));
566 
567  if (enablePcap)
568  {
569  std::stringstream ss;
570  ss << "wifi-spectrum-per-example-" << i;
571  phy.EnablePcap (ss.str (), apDevice);
572  }
573  g_signalDbmAvg = 0;
574  g_noiseDbmAvg = 0;
575  g_samples = 0;
576  g_channelNumber = 0;
577  g_rate = 0;
578 
579  // Make sure we are tuned to 5180 MHz; if not, the example will
580  // not work properly
581  Ptr<NetDevice> staDevicePtr = staDevice.Get (0);
582  Ptr<WifiNetDevice> wifiStaDevicePtr = staDevicePtr->GetObject <WifiNetDevice> ();
583  UintegerValue val;
584  wifiStaDevicePtr->GetPhy ()->GetAttribute ("Frequency", val);
585  if (val.Get () != 5180)
586  {
587  NS_FATAL_ERROR ("Error: Wi-Fi nodes must be tuned to 5180 MHz to match the waveform generator");
588  }
589 
590  Simulator::Stop (Seconds (simulationTime + 1));
591  Simulator::Run ();
592 
593  double throughput = 0;
594  uint32_t totalPacketsThrough = 0;
595  if (udp)
596  {
597  //UDP
598  totalPacketsThrough = DynamicCast<UdpServer> (serverApp.Get (0))->GetReceived ();
599  throughput = totalPacketsThrough * payloadSize * 8 / (simulationTime * 1000000.0); //Mbit/s
600  }
601  else
602  {
603  //TCP
604  uint32_t totalBytesRx = DynamicCast<PacketSink> (sinkApp.Get (0))->GetTotalRx ();
605  totalPacketsThrough = totalBytesRx / tcpPacketSize;
606  throughput = totalBytesRx * 8 / (simulationTime * 1000000.0); //Mbit/s
607  }
608  std::cout << std::setw (5) << i <<
609  std::setw (6) << (i % 8) <<
610  std::setw (10) << datarate <<
611  std::setw (12) << throughput <<
612  std::setw (8) << totalPacketsThrough;
613  if (totalPacketsThrough > 0)
614  {
615  std::cout << std::setw (12) << g_signalDbmAvg <<
616  std::setw (12) << g_noiseDbmAvg <<
617  std::setw (12) << (g_signalDbmAvg - g_noiseDbmAvg) <<
618  std::endl;
619  }
620  else
621  {
622  std::cout << std::setw (12) << "N/A" <<
623  std::setw (12) << "N/A" <<
624  std::setw (12) << "N/A" <<
625  std::endl;
626  }
628  }
629  return 0;
630 }
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.
Ptr< SpectrumModel > SpectrumModelWifi5180MHz
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...
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:683
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:462
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
void Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container. ...
bool enablePcap
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)
NetDeviceContainer Install(NodeContainer c) const
void SetPhyAttribute(std::string name, const AttributeValue &v)
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_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:244
#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:231
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.
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
Simple SpectrumPhy implementation that sends customizable waveform.
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
Definition: wifi-preamble.h:30
void SetChannel(Ptr< YansWifiChannel > channel)
Ptr< WifiPhy > GetPhy(void) const
U * GetPointer(const Ptr< U > &p)
Definition: ptr.h:568
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:1238
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
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:706
Create a server application which waits for input UDP packets and uses the information carried into t...
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:824
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: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.
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:229
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...
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...
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.
uint16_t g_channelNumber
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.