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 (linear W) [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 (linear W)", 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  else if (wifiType == "ns3::SpectrumWifiPhy")
214  {
215  spectrumChannel
216  = CreateObject<MultiModelSpectrumChannel> ();
218  = CreateObject<FriisPropagationLossModel> ();
219  lossModel->SetFrequency (5.180e9);
220  spectrumChannel->AddPropagationLossModel (lossModel);
221 
223  = CreateObject<ConstantSpeedPropagationDelayModel> ();
224  spectrumChannel->SetPropagationDelayModel (delayModel);
225 
226  spectrumPhy.SetChannel (spectrumChannel);
227  spectrumPhy.SetErrorRateModel (errorModelType);
228  spectrumPhy.Set ("Frequency", UintegerValue (5180)); // channel 36 at 20 MHz
229  }
230  else
231  {
232  NS_FATAL_ERROR ("Unsupported WiFi type " << wifiType);
233  }
234 
236  wifi.SetStandard (WIFI_PHY_STANDARD_80211n_5GHZ);
238 
239  Ssid ssid = Ssid ("ns380211n");
240 
241  double datarate = 0;
243  if (i == 0)
244  {
245  DataRate = StringValue ("HtMcs0");
246  datarate = 6.5;
247  }
248  else if (i == 1)
249  {
250  DataRate = StringValue ("HtMcs1");
251  datarate = 13;
252  }
253  else if (i == 2)
254  {
255  DataRate = StringValue ("HtMcs2");
256  datarate = 19.5;
257  }
258  else if (i == 3)
259  {
260  DataRate = StringValue ("HtMcs3");
261  datarate = 26;
262  }
263  else if (i == 4)
264  {
265  DataRate = StringValue ("HtMcs4");
266  datarate = 39;
267  }
268  else if (i == 5)
269  {
270  DataRate = StringValue ("HtMcs5");
271  datarate = 52;
272  }
273  else if (i == 6)
274  {
275  DataRate = StringValue ("HtMcs6");
276  datarate = 58.5;
277  }
278  else if (i == 7)
279  {
280  DataRate = StringValue ("HtMcs7");
281  datarate = 65;
282  }
283  else if (i == 8)
284  {
285  DataRate = StringValue ("HtMcs0");
286  datarate = 7.2;
287  }
288  else if (i == 9)
289  {
290  DataRate = StringValue ("HtMcs1");
291  datarate = 14.4;
292  }
293  else if (i == 10)
294  {
295  DataRate = StringValue ("HtMcs2");
296  datarate = 21.7;
297  }
298  else if (i == 11)
299  {
300  DataRate = StringValue ("HtMcs3");
301  datarate = 28.9;
302  }
303  else if (i == 12)
304  {
305  DataRate = StringValue ("HtMcs4");
306  datarate = 43.3;
307  }
308  else if (i == 13)
309  {
310  DataRate = StringValue ("HtMcs5");
311  datarate = 57.8;
312  }
313  else if (i == 14)
314  {
315  DataRate = StringValue ("HtMcs6");
316  datarate = 65;
317  }
318  else if (i == 15)
319  {
320  DataRate = StringValue ("HtMcs7");
321  datarate = 72.2;
322  }
323  else if (i == 16)
324  {
325  DataRate = StringValue ("HtMcs0");
326  datarate = 13.5;
327  }
328  else if (i == 17)
329  {
330  DataRate = StringValue ("HtMcs1");
331  datarate = 27;
332  }
333  else if (i == 18)
334  {
335  DataRate = StringValue ("HtMcs2");
336  datarate = 40.5;
337  }
338  else if (i == 19)
339  {
340  DataRate = StringValue ("HtMcs3");
341  datarate = 54;
342  }
343  else if (i == 20)
344  {
345  DataRate = StringValue ("HtMcs4");
346  datarate = 81;
347  }
348  else if (i == 21)
349  {
350  DataRate = StringValue ("HtMcs5");
351  datarate = 108;
352  }
353  else if (i == 22)
354  {
355  DataRate = StringValue ("HtMcs6");
356  datarate = 121.5;
357  }
358  else if (i == 23)
359  {
360  DataRate = StringValue ("HtMcs7");
361  datarate = 135;
362  }
363  else if (i == 24)
364  {
365  DataRate = StringValue ("HtMcs0");
366  datarate = 15;
367  }
368  else if (i == 25)
369  {
370  DataRate = StringValue ("HtMcs1");
371  datarate = 30;
372  }
373  else if (i == 26)
374  {
375  DataRate = StringValue ("HtMcs2");
376  datarate = 45;
377  }
378  else if (i == 27)
379  {
380  DataRate = StringValue ("HtMcs3");
381  datarate = 60;
382  }
383  else if (i == 28)
384  {
385  DataRate = StringValue ("HtMcs4");
386  datarate = 90;
387  }
388  else if (i == 29)
389  {
390  DataRate = StringValue ("HtMcs5");
391  datarate = 120;
392  }
393  else if (i == 30)
394  {
395  DataRate = StringValue ("HtMcs6");
396  datarate = 135;
397  }
398  else
399  {
400  DataRate = StringValue ("HtMcs7");
401  datarate = 150;
402  }
403 
404  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager","DataMode", DataRate,
405  "ControlMode", DataRate);
406 
407  NetDeviceContainer staDevice;
408  NetDeviceContainer apDevice;
409 
410  if (wifiType == "ns3::YansWifiPhy")
411  {
412  mac.SetType ("ns3::StaWifiMac",
413  "Ssid", SsidValue (ssid));
414  staDevice = wifi.Install (phy, mac, wifiStaNode);
415  mac.SetType ("ns3::ApWifiMac",
416  "Ssid", SsidValue (ssid));
417  apDevice = wifi.Install (phy, mac, wifiApNode);
418 
419  }
420  else if (wifiType == "ns3::SpectrumWifiPhy")
421  {
422  mac.SetType ("ns3::StaWifiMac",
423  "Ssid", SsidValue (ssid));
424  staDevice = wifi.Install (spectrumPhy, mac, wifiStaNode);
425  mac.SetType ("ns3::ApWifiMac",
426  "Ssid", SsidValue (ssid));
427  apDevice = wifi.Install (spectrumPhy, mac, wifiApNode);
428  }
429 
430  if (i <= 7)
431  {
432  Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", UintegerValue (20));
433  Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/ShortGuardIntervalSupported", BooleanValue (false));
434  }
435  else if (i > 7 && i <= 15)
436  {
437  Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", UintegerValue (20));
438  Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/ShortGuardIntervalSupported", BooleanValue (true));
439  }
440  else if (i > 15 && i <= 23)
441  {
442  Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", UintegerValue (40));
443  Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/ShortGuardIntervalSupported", BooleanValue (false));
444  }
445  else
446  {
447  Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", UintegerValue (40));
448  Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/ShortGuardIntervalSupported", BooleanValue (true));
449  }
450 
451  // mobility.
453  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
454 
455  positionAlloc->Add (Vector (0.0, 0.0, 0.0));
456  positionAlloc->Add (Vector (distance, 0.0, 0.0));
457  positionAlloc->Add (Vector (distance, distance, 0.0));
458  mobility.SetPositionAllocator (positionAlloc);
459 
460  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
461 
462  mobility.Install (wifiApNode);
463  mobility.Install (wifiStaNode);
464  mobility.Install (interferingNode);
465 
466  /* Internet stack*/
468  stack.Install (wifiApNode);
469  stack.Install (wifiStaNode);
470 
472  address.SetBase ("192.168.1.0", "255.255.255.0");
473  Ipv4InterfaceContainer staNodeInterface;
474  Ipv4InterfaceContainer apNodeInterface;
475 
476  staNodeInterface = address.Assign (staDevice);
477  apNodeInterface = address.Assign (apDevice);
478 
479  /* Setting applications */
480  ApplicationContainer serverApp;
481  if (udp)
482  {
483  //UDP flow
484  uint16_t port = 9;
485  UdpServerHelper server (port);
486  serverApp = server.Install (wifiStaNode.Get (0));
487  serverApp.Start (Seconds (0.0));
488  serverApp.Stop (Seconds (simulationTime + 1));
489 
490  UdpClientHelper client (staNodeInterface.GetAddress (0), port);
491  client.SetAttribute ("MaxPackets", UintegerValue (4294967295u));
492  client.SetAttribute ("Interval", TimeValue (Time ("0.0001"))); //packets/s
493  client.SetAttribute ("PacketSize", UintegerValue (payloadSize));
494  ApplicationContainer clientApp = client.Install (wifiApNode.Get (0));
495  clientApp.Start (Seconds (1.0));
496  clientApp.Stop (Seconds (simulationTime + 1));
497  }
498  else
499  {
500  //TCP flow
501  uint16_t port = 50000;
502  Address localAddress (InetSocketAddress (Ipv4Address::GetAny (), port));
503  PacketSinkHelper packetSinkHelper ("ns3::TcpSocketFactory", localAddress);
504  serverApp = packetSinkHelper.Install (wifiStaNode.Get (0));
505  serverApp.Start (Seconds (0.0));
506  serverApp.Stop (Seconds (simulationTime + 1));
507 
508  OnOffHelper onoff ("ns3::TcpSocketFactory", Ipv4Address::GetAny ());
509  onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
510  onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
511  onoff.SetAttribute ("PacketSize", UintegerValue (payloadSize));
512  onoff.SetAttribute ("DataRate", DataRateValue (1000000000)); //bit/s
513  AddressValue remoteAddress (InetSocketAddress (staNodeInterface.GetAddress (0), port));
514  onoff.SetAttribute ("Remote", remoteAddress);
515  ApplicationContainer clientApp = onoff.Install (wifiApNode.Get (0));
516  clientApp.Start (Seconds (1.0));
517  clientApp.Stop (Seconds (simulationTime + 1));
518  }
519 
520  // Configure waveform generator
521  Ptr<SpectrumValue> wgPsd = Create<SpectrumValue> (SpectrumModelWifi5180MHz);
522  *wgPsd = waveformPower / 20e6; // PSD spread across 20 MHz
523  NS_LOG_INFO ("wgPsd : " << *wgPsd << " integrated power: " << Integral (*(GetPointer (wgPsd))));
524 
525  if (wifiType == "ns3::SpectrumWifiPhy")
526  {
527  WaveformGeneratorHelper waveformGeneratorHelper;
528  waveformGeneratorHelper.SetChannel (spectrumChannel);
529  waveformGeneratorHelper.SetTxPowerSpectralDensity (wgPsd);
530 
531  waveformGeneratorHelper.SetPhyAttribute ("Period", TimeValue (Seconds (0.0007)));
532  waveformGeneratorHelper.SetPhyAttribute ("DutyCycle", DoubleValue (1));
533  NetDeviceContainer waveformGeneratorDevices = waveformGeneratorHelper.Install (interferingNode);
534 
536  waveformGeneratorDevices.Get (0)->GetObject<NonCommunicatingNetDevice> ()->GetPhy ()->GetObject<WaveformGenerator> ());
537  }
538 
539  Config::ConnectWithoutContext ("/NodeList/0/DeviceList/*/Phy/MonitorSnifferRx", MakeCallback (&MonitorSniffRx));
540 
541  if (enablePcap)
542  {
543  std::stringstream ss;
544  ss << "wifi-spectrum-per-example-" << i;
545  phy.EnablePcap (ss.str (), apDevice);
546  }
547  g_signalDbmAvg = 0;
548  g_noiseDbmAvg = 0;
549  g_samples = 0;
550 
551  // Make sure we are tuned to 5180 MHz; if not, the example will
552  // not work properly
553  Ptr<NetDevice> staDevicePtr = staDevice.Get (0);
554  Ptr<WifiNetDevice> wifiStaDevicePtr = staDevicePtr->GetObject <WifiNetDevice> ();
555  UintegerValue val;
556  wifiStaDevicePtr->GetPhy ()->GetAttribute ("Frequency", val);
557  if (val.Get () != 5180)
558  {
559  NS_FATAL_ERROR ("Error: Wi-Fi nodes must be tuned to 5180 MHz to match the waveform generator");
560  }
561 
562  Simulator::Stop (Seconds (simulationTime + 1));
563  Simulator::Run ();
564 
565  double throughput = 0;
566  uint64_t totalPacketsThrough = 0;
567  if (udp)
568  {
569  //UDP
570  totalPacketsThrough = DynamicCast<UdpServer> (serverApp.Get (0))->GetReceived ();
571  throughput = totalPacketsThrough * payloadSize * 8 / (simulationTime * 1000000.0); //Mbit/s
572  }
573  else
574  {
575  //TCP
576  uint64_t totalBytesRx = DynamicCast<PacketSink> (serverApp.Get (0))->GetTotalRx ();
577  totalPacketsThrough = totalBytesRx / tcpPacketSize;
578  throughput = totalBytesRx * 8 / (simulationTime * 1000000.0); //Mbit/s
579  }
580  std::cout << std::setw (5) << i <<
581  std::setw (6) << (i % 8) <<
582  std::setprecision (2) << std::fixed <<
583  std::setw (10) << datarate <<
584  std::setw (12) << throughput <<
585  std::setw (8) << totalPacketsThrough;
586  if (totalPacketsThrough > 0)
587  {
588  std::cout << std::setw (12) << g_signalDbmAvg <<
589  std::setw (12) << g_noiseDbmAvg <<
590  std::setw (12) << (g_signalDbmAvg - g_noiseDbmAvg) <<
591  std::endl;
592  }
593  else
594  {
595  std::cout << std::setw (12) << "N/A" <<
596  std::setw (12) << "N/A" <<
597  std::setw (12) << "N/A" <<
598  std::endl;
599  }
601  }
602  return 0;
603 }
MpduInfo structure.
Definition: wifi-phy.h:71
void Set(std::string name, const AttributeValue &v)
Definition: wifi-helper.cc:142
holds a vector of ns3::Application pointers.
Ptr< SpectrumModel > SpectrumModelWifi5180MHz
double signal
in dBm
Definition: wifi-phy.h:66
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.
void Set(std::string path, const AttributeValue &value)
Definition: config.cc:805
bool enablePcap
void SetPhyAttribute(std::string name, const AttributeValue &v)
static void Run(void)
Run the simulation.
Definition: simulator.cc:170
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:204
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:280
#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:299
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:1389
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:1124
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:860
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:134
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:148
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:178
SignalNoiseDbm structure.
Definition: wifi-phy.h:64
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:1062
AttributeValue implementation for Ssid.
Definition: ssid.h:110
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:810
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:67
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.