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