A Discrete-Event Network Simulator
API
wifi-spectrum-per-interference.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009 MIRKO BANCHI
3  * Copyright (c) 2015 University of Washington
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Authors: Mirko Banchi <mk.banchi@gmail.com>
19  * Sebastien Deronne <sebastien.deronne@gmail.com>
20  * Tom Henderson <tomhend@u.washington.edu>
21  *
22  * Adapted from wifi-ht-network.cc example
23  */
24 
25 #include "ns3/command-line.h"
26 #include "ns3/config.h"
27 #include "ns3/internet-stack-helper.h"
28 #include "ns3/ipv4-address-helper.h"
29 #include "ns3/mobility-helper.h"
30 #include "ns3/multi-model-spectrum-channel.h"
31 #include "ns3/non-communicating-net-device.h"
32 #include "ns3/on-off-helper.h"
33 #include "ns3/packet-sink-helper.h"
34 #include "ns3/packet-sink.h"
35 #include "ns3/propagation-loss-model.h"
36 #include "ns3/spectrum-wifi-helper.h"
37 #include "ns3/ssid.h"
38 #include "ns3/string.h"
39 #include "ns3/udp-client-server-helper.h"
40 #include "ns3/udp-server.h"
41 #include "ns3/waveform-generator-helper.h"
42 #include "ns3/waveform-generator.h"
43 #include "ns3/wifi-net-device.h"
44 #include "ns3/yans-wifi-channel.h"
45 #include "ns3/yans-wifi-helper.h"
46 
47 #include <iomanip>
48 
49 // This is a simple example of an IEEE 802.11n Wi-Fi network with a
50 // non-Wi-Fi interferer. It is an adaptation of the wifi-spectrum-per-example
51 //
52 // Unless the --waveformPower argument is passed, it will operate similarly to
53 // wifi-spectrum-per-example. Adding --waveformPower=value for values
54 // greater than 0.0001 will result in frame losses beyond those that
55 // result from the normal SNR based on distance path loss.
56 //
57 // If YansWifiPhy is selected as the wifiType, --waveformPower will have
58 // no effect.
59 //
60 // Network topology:
61 //
62 // Wi-Fi 192.168.1.0
63 //
64 // STA AP
65 // * <-- distance --> *
66 // | |
67 // n1 n2
68 //
69 // Users may vary the following command-line arguments in addition to the
70 // attributes, global values, and default values typically available:
71 //
72 // --simulationTime: Simulation time in seconds [10]
73 // --udp: UDP if set to 1, TCP otherwise [true]
74 // --distance: meters separation between nodes [50]
75 // --index: restrict index to single value between 0 and 31 [256]
76 // --wifiType: select ns3::SpectrumWifiPhy or ns3::YansWifiPhy [ns3::SpectrumWifiPhy]
77 // --errorModelType: select ns3::NistErrorRateModel or ns3::YansErrorRateModel
78 // [ns3::NistErrorRateModel]
79 // --enablePcap: enable pcap output [false]
80 // --waveformPower: Waveform power (linear W) [0]
81 //
82 // By default, the program will step through 32 index values, corresponding
83 // to the following MCS, channel width, and guard interval combinations:
84 // index 0-7: MCS 0-7, long guard interval, 20 MHz channel
85 // index 8-15: MCS 0-7, short guard interval, 20 MHz channel
86 // index 16-23: MCS 0-7, long guard interval, 40 MHz channel
87 // index 24-31: MCS 0-7, short guard interval, 40 MHz channel
88 // and send UDP for 10 seconds using each MCS, using the SpectrumWifiPhy and the
89 // NistErrorRateModel, at a distance of 50 meters. The program outputs
90 // results such as:
91 //
92 // wifiType: ns3::SpectrumWifiPhy distance: 50m; time: 10; TxPower: 16 dBm (40 mW)
93 // index MCS Rate (Mb/s) Tput (Mb/s) Received Signal (dBm)Noi+Inf(dBm) SNR (dB)
94 // 0 0 6.50 5.77 7414 -64.69 -93.97 29.27
95 // 1 1 13.00 11.58 14892 -64.69 -93.97 29.27
96 // 2 2 19.50 17.39 22358 -64.69 -93.97 29.27
97 // 3 3 26.00 23.23 29875 -64.69 -93.97 29.27
98 // ...
99 //
100 
101 using namespace ns3;
102 
103 // Global variables for use in callbacks.
106 uint32_t g_samples;
107 
118 void
120  uint16_t channelFreqMhz,
121  WifiTxVector txVector,
122  MpduInfo aMpdu,
123  SignalNoiseDbm signalNoise,
124  uint16_t staId)
125 
126 {
127  g_samples++;
128  g_signalDbmAvg += ((signalNoise.signal - g_signalDbmAvg) / g_samples);
129  g_noiseDbmAvg += ((signalNoise.noise - g_noiseDbmAvg) / g_samples);
130 }
131 
132 NS_LOG_COMPONENT_DEFINE("WifiSpectrumPerInterference");
133 
136 
139 {
140  public:
142  {
143  BandInfo bandInfo;
144  bandInfo.fc = 5180e6;
145  bandInfo.fl = 5180e6 - 10e6;
146  bandInfo.fh = 5180e6 + 10e6;
147 
148  Bands bands;
149  bands.push_back(bandInfo);
150 
151  SpectrumModelWifi5180MHz = Create<SpectrumModel>(bands);
152  }
153 };
154 
157 
160 {
161  public:
163  {
164  BandInfo bandInfo;
165  bandInfo.fc = 5190e6;
166  bandInfo.fl = 5190e6 - 10e6;
167  bandInfo.fh = 5190e6 + 10e6;
168 
169  Bands bands;
170  bands.push_back(bandInfo);
171 
172  SpectrumModelWifi5190MHz = Create<SpectrumModel>(bands);
173  }
174 };
175 
178 
179 int
180 main(int argc, char* argv[])
181 {
182  bool udp = true;
183  double distance = 50;
184  double simulationTime = 10; // seconds
185  uint16_t index = 256;
186  std::string wifiType = "ns3::SpectrumWifiPhy";
187  std::string errorModelType = "ns3::NistErrorRateModel";
188  bool enablePcap = false;
189  const uint32_t tcpPacketSize = 1448;
190  double waveformPower = 0;
191 
192  CommandLine cmd(__FILE__);
193  cmd.AddValue("simulationTime", "Simulation time in seconds", simulationTime);
194  cmd.AddValue("udp", "UDP if set to 1, TCP otherwise", udp);
195  cmd.AddValue("distance", "meters separation between nodes", distance);
196  cmd.AddValue("index", "restrict index to single value between 0 and 31", index);
197  cmd.AddValue("wifiType", "select ns3::SpectrumWifiPhy or ns3::YansWifiPhy", wifiType);
198  cmd.AddValue("errorModelType",
199  "select ns3::NistErrorRateModel or ns3::YansErrorRateModel",
200  errorModelType);
201  cmd.AddValue("enablePcap", "enable pcap output", enablePcap);
202  cmd.AddValue("waveformPower", "Waveform power (linear W)", waveformPower);
203  cmd.Parse(argc, argv);
204 
205  uint16_t startIndex = 0;
206  uint16_t stopIndex = 31;
207  if (index < 32)
208  {
209  startIndex = index;
210  stopIndex = index;
211  }
212 
213  std::cout << "wifiType: " << wifiType << " distance: " << distance
214  << "m; time: " << simulationTime << "; TxPower: 16 dBm (40 mW)" << std::endl;
215  std::cout << std::setw(5) << "index" << std::setw(6) << "MCS" << std::setw(13) << "Rate (Mb/s)"
216  << std::setw(12) << "Tput (Mb/s)" << std::setw(10) << "Received " << std::setw(12)
217  << "Signal (dBm)" << std::setw(12) << "Noi+Inf(dBm)" << std::setw(9) << "SNR (dB)"
218  << std::endl;
219  for (uint16_t i = startIndex; i <= stopIndex; i++)
220  {
221  uint32_t payloadSize;
222  if (udp)
223  {
224  payloadSize = 972; // 1000 bytes IPv4
225  }
226  else
227  {
228  payloadSize = 1448; // 1500 bytes IPv6
229  Config::SetDefault("ns3::TcpSocket::SegmentSize", UintegerValue(payloadSize));
230  }
231 
232  NodeContainer wifiStaNode;
233  wifiStaNode.Create(1);
235  wifiApNode.Create(1);
236  NodeContainer interferingNode;
237  interferingNode.Create(1);
238 
240  SpectrumWifiPhyHelper spectrumPhy;
241  Ptr<MultiModelSpectrumChannel> spectrumChannel;
242  uint16_t frequency = (i <= 15 ? 5180 : 5190);
243  if (wifiType == "ns3::YansWifiPhy")
244  {
246  channel.AddPropagationLoss("ns3::FriisPropagationLossModel",
247  "Frequency",
248  DoubleValue(frequency * 1e6));
249  channel.SetPropagationDelay("ns3::ConstantSpeedPropagationDelayModel");
250  phy.SetChannel(channel.Create());
251  phy.Set("ChannelSettings",
252  StringValue(std::string("{") + (frequency == 5180 ? "36" : "38") +
253  ", 0, BAND_5GHZ, 0}"));
254  }
255  else if (wifiType == "ns3::SpectrumWifiPhy")
256  {
257  spectrumChannel = CreateObject<MultiModelSpectrumChannel>();
258  Ptr<FriisPropagationLossModel> lossModel = CreateObject<FriisPropagationLossModel>();
259  lossModel->SetFrequency(frequency * 1e6);
260  spectrumChannel->AddPropagationLossModel(lossModel);
261 
263  CreateObject<ConstantSpeedPropagationDelayModel>();
264  spectrumChannel->SetPropagationDelayModel(delayModel);
265 
266  spectrumPhy.SetChannel(spectrumChannel);
267  spectrumPhy.SetErrorRateModel(errorModelType);
268  // channel 36 at 20 MHz, 38 at 40 MHz
269  spectrumPhy.Set("ChannelSettings",
270  StringValue(std::string("{") + (frequency == 5180 ? "36" : "38") +
271  ", 0, BAND_5GHZ, 0}"));
272  }
273  else
274  {
275  NS_FATAL_ERROR("Unsupported WiFi type " << wifiType);
276  }
277 
279  wifi.SetStandard(WIFI_STANDARD_80211n);
281 
282  Ssid ssid = Ssid("ns380211n");
283 
284  double datarate = 0;
286  if (i == 0)
287  {
288  DataRate = StringValue("HtMcs0");
289  datarate = 6.5;
290  }
291  else if (i == 1)
292  {
293  DataRate = StringValue("HtMcs1");
294  datarate = 13;
295  }
296  else if (i == 2)
297  {
298  DataRate = StringValue("HtMcs2");
299  datarate = 19.5;
300  }
301  else if (i == 3)
302  {
303  DataRate = StringValue("HtMcs3");
304  datarate = 26;
305  }
306  else if (i == 4)
307  {
308  DataRate = StringValue("HtMcs4");
309  datarate = 39;
310  }
311  else if (i == 5)
312  {
313  DataRate = StringValue("HtMcs5");
314  datarate = 52;
315  }
316  else if (i == 6)
317  {
318  DataRate = StringValue("HtMcs6");
319  datarate = 58.5;
320  }
321  else if (i == 7)
322  {
323  DataRate = StringValue("HtMcs7");
324  datarate = 65;
325  }
326  else if (i == 8)
327  {
328  DataRate = StringValue("HtMcs0");
329  datarate = 7.2;
330  }
331  else if (i == 9)
332  {
333  DataRate = StringValue("HtMcs1");
334  datarate = 14.4;
335  }
336  else if (i == 10)
337  {
338  DataRate = StringValue("HtMcs2");
339  datarate = 21.7;
340  }
341  else if (i == 11)
342  {
343  DataRate = StringValue("HtMcs3");
344  datarate = 28.9;
345  }
346  else if (i == 12)
347  {
348  DataRate = StringValue("HtMcs4");
349  datarate = 43.3;
350  }
351  else if (i == 13)
352  {
353  DataRate = StringValue("HtMcs5");
354  datarate = 57.8;
355  }
356  else if (i == 14)
357  {
358  DataRate = StringValue("HtMcs6");
359  datarate = 65;
360  }
361  else if (i == 15)
362  {
363  DataRate = StringValue("HtMcs7");
364  datarate = 72.2;
365  }
366  else if (i == 16)
367  {
368  DataRate = StringValue("HtMcs0");
369  datarate = 13.5;
370  }
371  else if (i == 17)
372  {
373  DataRate = StringValue("HtMcs1");
374  datarate = 27;
375  }
376  else if (i == 18)
377  {
378  DataRate = StringValue("HtMcs2");
379  datarate = 40.5;
380  }
381  else if (i == 19)
382  {
383  DataRate = StringValue("HtMcs3");
384  datarate = 54;
385  }
386  else if (i == 20)
387  {
388  DataRate = StringValue("HtMcs4");
389  datarate = 81;
390  }
391  else if (i == 21)
392  {
393  DataRate = StringValue("HtMcs5");
394  datarate = 108;
395  }
396  else if (i == 22)
397  {
398  DataRate = StringValue("HtMcs6");
399  datarate = 121.5;
400  }
401  else if (i == 23)
402  {
403  DataRate = StringValue("HtMcs7");
404  datarate = 135;
405  }
406  else if (i == 24)
407  {
408  DataRate = StringValue("HtMcs0");
409  datarate = 15;
410  }
411  else if (i == 25)
412  {
413  DataRate = StringValue("HtMcs1");
414  datarate = 30;
415  }
416  else if (i == 26)
417  {
418  DataRate = StringValue("HtMcs2");
419  datarate = 45;
420  }
421  else if (i == 27)
422  {
423  DataRate = StringValue("HtMcs3");
424  datarate = 60;
425  }
426  else if (i == 28)
427  {
428  DataRate = StringValue("HtMcs4");
429  datarate = 90;
430  }
431  else if (i == 29)
432  {
433  DataRate = StringValue("HtMcs5");
434  datarate = 120;
435  }
436  else if (i == 30)
437  {
438  DataRate = StringValue("HtMcs6");
439  datarate = 135;
440  }
441  else
442  {
443  DataRate = StringValue("HtMcs7");
444  datarate = 150;
445  }
446 
447  wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager",
448  "DataMode",
449  DataRate,
450  "ControlMode",
451  DataRate);
452 
453  NetDeviceContainer staDevice;
454  NetDeviceContainer apDevice;
455 
456  if (wifiType == "ns3::YansWifiPhy")
457  {
458  mac.SetType("ns3::StaWifiMac", "Ssid", SsidValue(ssid));
459  staDevice = wifi.Install(phy, mac, wifiStaNode);
460  mac.SetType("ns3::ApWifiMac", "Ssid", SsidValue(ssid));
461  apDevice = wifi.Install(phy, mac, wifiApNode);
462  }
463  else if (wifiType == "ns3::SpectrumWifiPhy")
464  {
465  mac.SetType("ns3::StaWifiMac", "Ssid", SsidValue(ssid));
466  staDevice = wifi.Install(spectrumPhy, mac, wifiStaNode);
467  mac.SetType("ns3::ApWifiMac", "Ssid", SsidValue(ssid));
468  apDevice = wifi.Install(spectrumPhy, mac, wifiApNode);
469  }
470 
471  if (i <= 7)
472  {
473  Config::Set("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/"
474  "ShortGuardIntervalSupported",
475  BooleanValue(false));
476  }
477  else if (i > 7 && i <= 15)
478  {
479  Config::Set("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/"
480  "ShortGuardIntervalSupported",
481  BooleanValue(true));
482  }
483  else if (i > 15 && i <= 23)
484  {
485  Config::Set("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/"
486  "ShortGuardIntervalSupported",
487  BooleanValue(false));
488  }
489  else
490  {
491  Config::Set("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/"
492  "ShortGuardIntervalSupported",
493  BooleanValue(true));
494  }
495 
496  // mobility.
498  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator>();
499 
500  positionAlloc->Add(Vector(0.0, 0.0, 0.0));
501  positionAlloc->Add(Vector(distance, 0.0, 0.0));
502  positionAlloc->Add(Vector(distance, distance, 0.0));
503  mobility.SetPositionAllocator(positionAlloc);
504 
505  mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
506 
507  mobility.Install(wifiApNode);
508  mobility.Install(wifiStaNode);
509  mobility.Install(interferingNode);
510 
511  /* Internet stack*/
513  stack.Install(wifiApNode);
514  stack.Install(wifiStaNode);
515 
517  address.SetBase("192.168.1.0", "255.255.255.0");
518  Ipv4InterfaceContainer staNodeInterface;
519  Ipv4InterfaceContainer apNodeInterface;
520 
521  staNodeInterface = address.Assign(staDevice);
522  apNodeInterface = address.Assign(apDevice);
523 
524  /* Setting applications */
525  ApplicationContainer serverApp;
526  if (udp)
527  {
528  // UDP flow
529  uint16_t port = 9;
531  serverApp = server.Install(wifiStaNode.Get(0));
532  serverApp.Start(Seconds(0.0));
533  serverApp.Stop(Seconds(simulationTime + 1));
534 
535  UdpClientHelper client(staNodeInterface.GetAddress(0), port);
536  client.SetAttribute("MaxPackets", UintegerValue(4294967295U));
537  client.SetAttribute("Interval", TimeValue(Time("0.0001"))); // packets/s
538  client.SetAttribute("PacketSize", UintegerValue(payloadSize));
539  ApplicationContainer clientApp = client.Install(wifiApNode.Get(0));
540  clientApp.Start(Seconds(1.0));
541  clientApp.Stop(Seconds(simulationTime + 1));
542  }
543  else
544  {
545  // TCP flow
546  uint16_t port = 50000;
548  PacketSinkHelper packetSinkHelper("ns3::TcpSocketFactory", localAddress);
549  serverApp = packetSinkHelper.Install(wifiStaNode.Get(0));
550  serverApp.Start(Seconds(0.0));
551  serverApp.Stop(Seconds(simulationTime + 1));
552 
553  OnOffHelper onoff("ns3::TcpSocketFactory", Ipv4Address::GetAny());
554  onoff.SetAttribute("OnTime", StringValue("ns3::ConstantRandomVariable[Constant=1]"));
555  onoff.SetAttribute("OffTime", StringValue("ns3::ConstantRandomVariable[Constant=0]"));
556  onoff.SetAttribute("PacketSize", UintegerValue(payloadSize));
557  onoff.SetAttribute("DataRate", DataRateValue(1000000000)); // bit/s
558  AddressValue remoteAddress(InetSocketAddress(staNodeInterface.GetAddress(0), port));
559  onoff.SetAttribute("Remote", remoteAddress);
560  ApplicationContainer clientApp = onoff.Install(wifiApNode.Get(0));
561  clientApp.Start(Seconds(1.0));
562  clientApp.Stop(Seconds(simulationTime + 1));
563  }
564 
565  // Configure waveform generator
566  Ptr<SpectrumValue> wgPsd =
567  Create<SpectrumValue>(i <= 15 ? SpectrumModelWifi5180MHz : SpectrumModelWifi5190MHz);
568  *wgPsd = waveformPower / 20e6; // PSD spread across 20 MHz
569  NS_LOG_INFO("wgPsd : " << *wgPsd
570  << " integrated power: " << Integral(*(GetPointer(wgPsd))));
571 
572  if (wifiType == "ns3::SpectrumWifiPhy")
573  {
574  WaveformGeneratorHelper waveformGeneratorHelper;
575  waveformGeneratorHelper.SetChannel(spectrumChannel);
576  waveformGeneratorHelper.SetTxPowerSpectralDensity(wgPsd);
577 
578  waveformGeneratorHelper.SetPhyAttribute("Period", TimeValue(Seconds(0.0007)));
579  waveformGeneratorHelper.SetPhyAttribute("DutyCycle", DoubleValue(1));
580  NetDeviceContainer waveformGeneratorDevices =
581  waveformGeneratorHelper.Install(interferingNode);
582 
585  waveformGeneratorDevices.Get(0)
586  ->GetObject<NonCommunicatingNetDevice>()
587  ->GetPhy()
589  }
590 
591  Config::ConnectWithoutContext("/NodeList/0/DeviceList/*/Phy/MonitorSnifferRx",
593 
594  if (enablePcap)
595  {
596  phy.SetPcapDataLinkType(WifiPhyHelper::DLT_IEEE802_11_RADIO);
597  std::stringstream ss;
598  ss << "wifi-spectrum-per-example-" << i;
599  phy.EnablePcap(ss.str(), apDevice);
600  }
601  g_signalDbmAvg = 0;
602  g_noiseDbmAvg = 0;
603  g_samples = 0;
604 
605  // Make sure we are tuned to 5180 MHz; if not, the example will
606  // not work properly
607  Ptr<NetDevice> staDevicePtr = staDevice.Get(0);
608  Ptr<WifiPhy> wifiPhyPtr = staDevicePtr->GetObject<WifiNetDevice>()->GetPhy();
609  if (i <= 15)
610  {
611  NS_ABORT_MSG_IF(wifiPhyPtr->GetChannelWidth() != 20,
612  "Error: Channel width must be 20 MHz if MCS index <= 15");
614  wifiPhyPtr->GetFrequency() != 5180,
615  "Error: Wi-Fi nodes must be tuned to 5180 MHz to match the waveform generator");
616  }
617  else
618  {
619  NS_ABORT_MSG_IF(wifiPhyPtr->GetChannelWidth() != 40,
620  "Error: Channel width must be 40 MHz if MCS index > 15");
622  wifiPhyPtr->GetFrequency() != 5190,
623  "Error: Wi-Fi nodes must be tuned to 5190 MHz to match the waveform generator");
624  }
625 
626  Simulator::Stop(Seconds(simulationTime + 1));
627  Simulator::Run();
628 
629  double throughput = 0;
630  uint64_t totalPacketsThrough = 0;
631  if (udp)
632  {
633  // UDP
634  totalPacketsThrough = DynamicCast<UdpServer>(serverApp.Get(0))->GetReceived();
635  throughput =
636  totalPacketsThrough * payloadSize * 8 / (simulationTime * 1000000.0); // Mbit/s
637  }
638  else
639  {
640  // TCP
641  uint64_t totalBytesRx = DynamicCast<PacketSink>(serverApp.Get(0))->GetTotalRx();
642  totalPacketsThrough = totalBytesRx / tcpPacketSize;
643  throughput = totalBytesRx * 8 / (simulationTime * 1000000.0); // Mbit/s
644  }
645  std::cout << std::setw(5) << i << std::setw(6) << (i % 8) << std::setprecision(2)
646  << std::fixed << std::setw(10) << datarate << std::setw(12) << throughput
647  << std::setw(8) << totalPacketsThrough;
648  if (totalPacketsThrough > 0)
649  {
650  std::cout << std::setw(12) << g_signalDbmAvg << std::setw(12) << g_noiseDbmAvg
651  << std::setw(12) << (g_signalDbmAvg - g_noiseDbmAvg) << std::endl;
652  }
653  else
654  {
655  std::cout << std::setw(12) << "N/A" << std::setw(12) << "N/A" << std::setw(12) << "N/A"
656  << std::endl;
657  }
659  }
660  return 0;
661 }
a polymophic address class
Definition: address.h:101
holds a vector of ns3::Application pointers.
void Start(Time start) const
Start all of the Applications in this container at the start time given as a parameter.
Ptr< Application > Get(uint32_t i) const
Get the Ptr<Application> stored in this container at a given index.
void Stop(Time stop) const
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter.
Parse command-line arguments.
Definition: command-line.h:232
Class for representing data rates.
Definition: data-rate.h:89
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:42
an Inet address class
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
static Ipv4Address GetAny()
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
Helper class used to assign positions and mobility models to nodes.
holds a vector of ns3::NetDevice pointers
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
This class implements a device which does not communicate, in the sense that it does not interact wit...
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
Definition: object.h:471
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
Definition: on-off-helper.h:44
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:571
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition: simulator.cc:142
static void Run()
Run the simulation.
Definition: simulator.cc:178
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Definition: simulator.cc:186
Make it easy to create and manage PHY objects for the spectrum model.
void SetChannel(const Ptr< SpectrumChannel > channel)
The IEEE 802.11 SSID Information Element.
Definition: ssid.h:36
Hold variables of type string.
Definition: string.h:56
Create a client application which sends UDP packets carrying a 32bit sequence number and a 64 bit tim...
Create a server application which waits for input UDP packets and uses the information carried into t...
Hold an unsigned integer type.
Definition: uinteger.h:45
Create a Waveform generator, which can be used to inject specific noise in the channel.
void SetTxPowerSpectralDensity(Ptr< SpectrumValue > txPsd)
void SetChannel(Ptr< SpectrumChannel > channel)
set the SpectrumChannel that will be used by SpectrumPhy instances created by this helper
NetDeviceContainer Install(NodeContainer c) const
void SetPhyAttribute(std::string name, const AttributeValue &v)
Simple SpectrumPhy implementation that sends customizable waveform.
virtual void Start()
Start the waveform generator.
helps to create WifiNetDevice objects
Definition: wifi-helper.h:324
create MAC layers for a ns3::WifiNetDevice.
Hold together all Wifi-related objects.
void Set(std::string name, const AttributeValue &v)
Definition: wifi-helper.cc:163
void SetErrorRateModel(std::string type, Args &&... args)
Helper function used to set the error rate model.
Definition: wifi-helper.h:550
@ DLT_IEEE802_11_RADIO
Include Radiotap link layer information.
Definition: wifi-helper.h:178
uint16_t GetChannelWidth() const
Definition: wifi-phy.cc:1051
uint16_t GetFrequency() const
Definition: wifi-phy.cc:1039
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
manage and create wifi channel objects for the YANS model.
Make it easy to create and manage PHY objects for the YANS model.
Initializer for a static spectrum model centered around 5180 MHz.
Initializer for a static spectrum model centered around 5190 MHz.
uint16_t port
Definition: dsdv-manet.cc:44
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:890
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
Definition: config.cc:950
void Set(std::string path, const AttributeValue &value)
Definition: config.cc:876
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:179
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition: abort.h:108
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:275
void(* DataRate)(DataRate oldValue, DataRate newValue)
TracedValue callback signature for DataRate.
Definition: data-rate.h:327
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1326
@ WIFI_STANDARD_80211n
address
Definition: first.py:47
stack
Definition: first.py:44
void(* Time)(Time oldValue, Time newValue)
TracedValue callback signature for Time.
Definition: nstime.h:839
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Definition: callback.h:704
double Integral(const SpectrumValue &arg)
std::vector< BandInfo > Bands
Container of BandInfo.
U * GetPointer(const Ptr< U > &p)
Definition: ptr.h:456
cmd
Definition: second.py:40
ssid
Definition: third.py:93
channel
Definition: third.py:88
mac
Definition: third.py:92
wifi
Definition: third.py:95
wifiApNode
Definition: third.py:86
mobility
Definition: third.py:105
phy
Definition: third.py:89
The building block of a SpectrumModel.
double fc
center frequency
double fl
lower limit of subband
double fh
upper limit of subband
MpduInfo structure.
Definition: phy-entity.h:62
SignalNoiseDbm structure.
Definition: phy-entity.h:55
double noise
noise power in dBm
Definition: phy-entity.h:57
double signal
signal strength in dBm
Definition: phy-entity.h:56
std::ofstream throughput
double g_signalDbmAvg
Average signal power [dBm].
double g_noiseDbmAvg
Average noise power [dBm].
Ptr< SpectrumModel > SpectrumModelWifi5190MHz
Spectrum model at 5190 MHz.
static_SpectrumModelWifi5180MHz_initializer static_SpectrumModelWifi5180MHz_initializer_instance
Static instance to initizlize the spectrum model around 5180 MHz.
uint32_t g_samples
Number of samples.
void MonitorSniffRx(Ptr< const Packet > packet, uint16_t channelFreqMhz, WifiTxVector txVector, MpduInfo aMpdu, SignalNoiseDbm signalNoise, uint16_t staId)
Monitor sniffer Rx trace.
static_SpectrumModelWifi5190MHz_initializer static_SpectrumModelWifi5190MHz_initializer_instance
Static instance to initizlize the spectrum model around 5190 MHz.
Ptr< SpectrumModel > SpectrumModelWifi5180MHz
Spectrum model at 5180 MHz.