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 wifi-ht-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
99using namespace ns3;
100
101// Global variables for use in callbacks.
105
117 uint16_t channelFreqMhz,
118 WifiTxVector txVector,
119 MpduInfo aMpdu,
120 SignalNoiseDbm signalNoise,
121 uint16_t staId)
122
123{
124 g_samples++;
125 g_signalDbmAvg += ((signalNoise.signal - g_signalDbmAvg) / g_samples);
126 g_noiseDbmAvg += ((signalNoise.noise - g_noiseDbmAvg) / g_samples);
127}
128
129NS_LOG_COMPONENT_DEFINE ("WifiSpectrumPerInterference");
130
133
136{
137public:
139 {
140 BandInfo bandInfo;
141 bandInfo.fc = 5180e6;
142 bandInfo.fl = 5180e6 - 10e6;
143 bandInfo.fh = 5180e6 + 10e6;
144
145 Bands bands;
146 bands.push_back (bandInfo);
147
148 SpectrumModelWifi5180MHz = Create<SpectrumModel> (bands);
149 }
150
151};
154
157{
158public:
160 {
161 BandInfo bandInfo;
162 bandInfo.fc = 5190e6;
163 bandInfo.fl = 5190e6 - 10e6;
164 bandInfo.fh = 5190e6 + 10e6;
165
166 Bands bands;
167 bands.push_back (bandInfo);
168
169 SpectrumModelWifi5190MHz = Create<SpectrumModel> (bands);
170 }
171
172};
175
176int main (int argc, char *argv[])
177{
178 bool udp = true;
179 double distance = 50;
180 double simulationTime = 10; //seconds
181 uint16_t index = 256;
182 std::string wifiType = "ns3::SpectrumWifiPhy";
183 std::string errorModelType = "ns3::NistErrorRateModel";
184 bool enablePcap = false;
185 const uint32_t tcpPacketSize = 1448;
186 double waveformPower = 0;
187
188 CommandLine cmd (__FILE__);
189 cmd.AddValue ("simulationTime", "Simulation time in seconds", simulationTime);
190 cmd.AddValue ("udp", "UDP if set to 1, TCP otherwise", udp);
191 cmd.AddValue ("distance", "meters separation between nodes", distance);
192 cmd.AddValue ("index", "restrict index to single value between 0 and 31", index);
193 cmd.AddValue ("wifiType", "select ns3::SpectrumWifiPhy or ns3::YansWifiPhy", wifiType);
194 cmd.AddValue ("errorModelType", "select ns3::NistErrorRateModel or ns3::YansErrorRateModel", errorModelType);
195 cmd.AddValue ("enablePcap", "enable pcap output", enablePcap);
196 cmd.AddValue ("waveformPower", "Waveform power (linear W)", waveformPower);
197 cmd.Parse (argc,argv);
198
199 uint16_t startIndex = 0;
200 uint16_t stopIndex = 31;
201 if (index < 32)
202 {
203 startIndex = index;
204 stopIndex = index;
205 }
206
207 std::cout << "wifiType: " << wifiType << " distance: " << distance << "m; time: " << simulationTime << "; TxPower: 16 dBm (40 mW)" << std::endl;
208 std::cout << std::setw (5) << "index" <<
209 std::setw (6) << "MCS" <<
210 std::setw (13) << "Rate (Mb/s)" <<
211 std::setw (12) << "Tput (Mb/s)" <<
212 std::setw (10) << "Received " <<
213 std::setw (12) << "Signal (dBm)" <<
214 std::setw (12) << "Noi+Inf(dBm)" <<
215 std::setw (9) << "SNR (dB)" <<
216 std::endl;
217 for (uint16_t i = startIndex; i <= stopIndex; i++)
218 {
219 uint32_t payloadSize;
220 if (udp)
221 {
222 payloadSize = 972; // 1000 bytes IPv4
223 }
224 else
225 {
226 payloadSize = 1448; // 1500 bytes IPv6
227 Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (payloadSize));
228 }
229
230 NodeContainer wifiStaNode;
231 wifiStaNode.Create (1);
233 wifiApNode.Create (1);
234 NodeContainer interferingNode;
235 interferingNode.Create (1);
236
238 SpectrumWifiPhyHelper spectrumPhy;
239 Ptr<MultiModelSpectrumChannel> spectrumChannel;
240 uint16_t frequency = (i <= 15 ? 5180 : 5190);
241 if (wifiType == "ns3::YansWifiPhy")
242 {
244 channel.AddPropagationLoss ("ns3::FriisPropagationLossModel",
245 "Frequency", DoubleValue (frequency * 1e6));
246 channel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
247 phy.SetChannel (channel.Create ());
248 phy.Set ("ChannelSettings", StringValue (std::string ("{") + (frequency == 5180 ? "36" : "38")
249 + ", 0, BAND_5GHZ, 0}"));
250 }
251 else if (wifiType == "ns3::SpectrumWifiPhy")
252 {
253 spectrumChannel
254 = CreateObject<MultiModelSpectrumChannel> ();
256 = CreateObject<FriisPropagationLossModel> ();
257 lossModel->SetFrequency (frequency * 1e6);
258 spectrumChannel->AddPropagationLossModel (lossModel);
259
261 = CreateObject<ConstantSpeedPropagationDelayModel> ();
262 spectrumChannel->SetPropagationDelayModel (delayModel);
263
264 spectrumPhy.SetChannel (spectrumChannel);
265 spectrumPhy.SetErrorRateModel (errorModelType);
266 // channel 36 at 20 MHz, 38 at 40 MHz
267 spectrumPhy.Set ("ChannelSettings", StringValue (std::string ("{")
268 + (frequency == 5180 ? "36" : "38")
269 + ", 0, BAND_5GHZ, 0}"));
270 }
271 else
272 {
273 NS_FATAL_ERROR ("Unsupported WiFi type " << wifiType);
274 }
275
277 wifi.SetStandard (WIFI_STANDARD_80211n);
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 staDevice = wifi.Install (phy, mac, wifiStaNode);
456 mac.SetType ("ns3::ApWifiMac",
457 "Ssid", SsidValue (ssid));
458 apDevice = wifi.Install (phy, mac, wifiApNode);
459
460 }
461 else if (wifiType == "ns3::SpectrumWifiPhy")
462 {
463 mac.SetType ("ns3::StaWifiMac",
464 "Ssid", SsidValue (ssid));
465 staDevice = wifi.Install (spectrumPhy, mac, wifiStaNode);
466 mac.SetType ("ns3::ApWifiMac",
467 "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/ShortGuardIntervalSupported", BooleanValue (false));
474 }
475 else if (i > 7 && i <= 15)
476 {
477 Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/ShortGuardIntervalSupported", BooleanValue (true));
478 }
479 else if (i > 15 && i <= 23)
480 {
481 Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/ShortGuardIntervalSupported", BooleanValue (false));
482 }
483 else
484 {
485 Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/ShortGuardIntervalSupported", BooleanValue (true));
486 }
487
488 // mobility.
490 Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
491
492 positionAlloc->Add (Vector (0.0, 0.0, 0.0));
493 positionAlloc->Add (Vector (distance, 0.0, 0.0));
494 positionAlloc->Add (Vector (distance, distance, 0.0));
495 mobility.SetPositionAllocator (positionAlloc);
496
497 mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
498
499 mobility.Install (wifiApNode);
500 mobility.Install (wifiStaNode);
501 mobility.Install (interferingNode);
502
503 /* Internet stack*/
505 stack.Install (wifiApNode);
506 stack.Install (wifiStaNode);
507
509 address.SetBase ("192.168.1.0", "255.255.255.0");
510 Ipv4InterfaceContainer staNodeInterface;
511 Ipv4InterfaceContainer apNodeInterface;
512
513 staNodeInterface = address.Assign (staDevice);
514 apNodeInterface = address.Assign (apDevice);
515
516 /* Setting applications */
517 ApplicationContainer serverApp;
518 if (udp)
519 {
520 //UDP flow
521 uint16_t port = 9;
522 UdpServerHelper server (port);
523 serverApp = server.Install (wifiStaNode.Get (0));
524 serverApp.Start (Seconds (0.0));
525 serverApp.Stop (Seconds (simulationTime + 1));
526
527 UdpClientHelper client (staNodeInterface.GetAddress (0), port);
528 client.SetAttribute ("MaxPackets", UintegerValue (4294967295u));
529 client.SetAttribute ("Interval", TimeValue (Time ("0.0001"))); //packets/s
530 client.SetAttribute ("PacketSize", UintegerValue (payloadSize));
531 ApplicationContainer clientApp = client.Install (wifiApNode.Get (0));
532 clientApp.Start (Seconds (1.0));
533 clientApp.Stop (Seconds (simulationTime + 1));
534 }
535 else
536 {
537 //TCP flow
538 uint16_t port = 50000;
539 Address localAddress (InetSocketAddress (Ipv4Address::GetAny (), port));
540 PacketSinkHelper packetSinkHelper ("ns3::TcpSocketFactory", localAddress);
541 serverApp = packetSinkHelper.Install (wifiStaNode.Get (0));
542 serverApp.Start (Seconds (0.0));
543 serverApp.Stop (Seconds (simulationTime + 1));
544
545 OnOffHelper onoff ("ns3::TcpSocketFactory", Ipv4Address::GetAny ());
546 onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
547 onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
548 onoff.SetAttribute ("PacketSize", UintegerValue (payloadSize));
549 onoff.SetAttribute ("DataRate", DataRateValue (1000000000)); //bit/s
550 AddressValue remoteAddress (InetSocketAddress (staNodeInterface.GetAddress (0), port));
551 onoff.SetAttribute ("Remote", remoteAddress);
552 ApplicationContainer clientApp = onoff.Install (wifiApNode.Get (0));
553 clientApp.Start (Seconds (1.0));
554 clientApp.Stop (Seconds (simulationTime + 1));
555 }
556
557 // Configure waveform generator
558 Ptr<SpectrumValue> wgPsd = Create<SpectrumValue> (i <= 15 ? SpectrumModelWifi5180MHz
560 *wgPsd = waveformPower / 20e6; // PSD spread across 20 MHz
561 NS_LOG_INFO ("wgPsd : " << *wgPsd << " integrated power: " << Integral (*(GetPointer (wgPsd))));
562
563 if (wifiType == "ns3::SpectrumWifiPhy")
564 {
565 WaveformGeneratorHelper waveformGeneratorHelper;
566 waveformGeneratorHelper.SetChannel (spectrumChannel);
567 waveformGeneratorHelper.SetTxPowerSpectralDensity (wgPsd);
568
569 waveformGeneratorHelper.SetPhyAttribute ("Period", TimeValue (Seconds (0.0007)));
570 waveformGeneratorHelper.SetPhyAttribute ("DutyCycle", DoubleValue (1));
571 NetDeviceContainer waveformGeneratorDevices = waveformGeneratorHelper.Install (interferingNode);
572
573 Simulator::Schedule (Seconds (0.002), &WaveformGenerator::Start,
574 waveformGeneratorDevices.Get (0)->GetObject<NonCommunicatingNetDevice> ()->GetPhy ()->GetObject<WaveformGenerator> ());
575 }
576
577 Config::ConnectWithoutContext ("/NodeList/0/DeviceList/*/Phy/MonitorSnifferRx", MakeCallback (&MonitorSniffRx));
578
579 if (enablePcap)
580 {
581 phy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11_RADIO);
582 std::stringstream ss;
583 ss << "wifi-spectrum-per-example-" << i;
584 phy.EnablePcap (ss.str (), apDevice);
585 }
586 g_signalDbmAvg = 0;
587 g_noiseDbmAvg = 0;
588 g_samples = 0;
589
590 // Make sure we are tuned to 5180 MHz; if not, the example will
591 // not work properly
592 Ptr<NetDevice> staDevicePtr = staDevice.Get (0);
593 Ptr<WifiPhy> wifiPhyPtr = staDevicePtr->GetObject <WifiNetDevice> ()->GetPhy ();
594 if (i <= 15)
595 {
596 NS_ABORT_MSG_IF (wifiPhyPtr->GetChannelWidth () != 20,
597 "Error: Channel width must be 20 MHz if MCS index <= 15");
598 NS_ABORT_MSG_IF (wifiPhyPtr->GetFrequency () != 5180,
599 "Error: Wi-Fi nodes must be tuned to 5180 MHz to match the waveform generator");
600 }
601 else
602 {
603 NS_ABORT_MSG_IF (wifiPhyPtr->GetChannelWidth () != 40,
604 "Error: Channel width must be 40 MHz if MCS index > 15");
605 NS_ABORT_MSG_IF (wifiPhyPtr->GetFrequency () != 5190,
606 "Error: Wi-Fi nodes must be tuned to 5190 MHz to match the waveform generator");
607 }
608
609 Simulator::Stop (Seconds (simulationTime + 1));
611
612 double throughput = 0;
613 uint64_t totalPacketsThrough = 0;
614 if (udp)
615 {
616 //UDP
617 totalPacketsThrough = DynamicCast<UdpServer> (serverApp.Get (0))->GetReceived ();
618 throughput = totalPacketsThrough * payloadSize * 8 / (simulationTime * 1000000.0); //Mbit/s
619 }
620 else
621 {
622 //TCP
623 uint64_t totalBytesRx = DynamicCast<PacketSink> (serverApp.Get (0))->GetTotalRx ();
624 totalPacketsThrough = totalBytesRx / tcpPacketSize;
625 throughput = totalBytesRx * 8 / (simulationTime * 1000000.0); //Mbit/s
626 }
627 std::cout << std::setw (5) << i <<
628 std::setw (6) << (i % 8) <<
629 std::setprecision (2) << std::fixed <<
630 std::setw (10) << datarate <<
631 std::setw (12) << throughput <<
632 std::setw (8) << totalPacketsThrough;
633 if (totalPacketsThrough > 0)
634 {
635 std::cout << std::setw (12) << g_signalDbmAvg <<
636 std::setw (12) << g_noiseDbmAvg <<
637 std::setw (12) << (g_signalDbmAvg - g_noiseDbmAvg) <<
638 std::endl;
639 }
640 else
641 {
642 std::cout << std::setw (12) << "N/A" <<
643 std::setw (12) << "N/A" <<
644 std::setw (12) << "N/A" <<
645 std::endl;
646 }
647 Simulator::Destroy ();
648 }
649 return 0;
650}
void Run(ObjectFactory &factory, uint32_t pop, uint32_t total, uint32_t runs, Ptr< RandomVariableStream > eventStream, bool calRev)
Perform the runs for a single scheduler type.
a polymophic address class
Definition: address.h:91
AttributeValue implementation for Address.
holds a vector of ns3::Application pointers.
Ptr< Application > Get(uint32_t i) const
Get the Ptr<Application> stored in this container at a given index.
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter.
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 Boolean.
Definition: boolean.h:37
Parse command-line arguments.
Definition: command-line.h:229
Class for representing data rates.
Definition: data-rate.h:89
AttributeValue implementation for DataRate.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:41
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.
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(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:470
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
Definition: on-off-helper.h:43
ApplicationContainer Install(NodeContainer c) const
Install an ns3::OnOffApplication on each node of the input container configured with all the attribut...
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes.
ApplicationContainer Install(NodeContainer c) const
Install an ns3::PacketSinkApplication on each node of the input container configured with all the att...
Make it easy to create and manage PHY objects for the spectrum model.
void SetChannel(Ptr< SpectrumChannel > channel)
The IEEE 802.11 SSID Information Element.
Definition: ssid.h:36
AttributeValue implementation for Ssid.
Hold variables of type string.
Definition: string.h:41
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
AttributeValue implementation for Time.
Definition: nstime.h:1309
Create a client application which sends UDP packets carrying a 32bit sequence number and a 64 bit tim...
void SetAttribute(std::string name, const AttributeValue &value)
Record an attribute to be set in each Application after it is is created.
ApplicationContainer Install(NodeContainer c)
Create a server application which waits for input UDP packets and uses the information carried into t...
ApplicationContainer Install(NodeContainer c)
Create one UDP server application on each of the Nodes in the NodeContainer.
Hold an unsigned integer type.
Definition: uinteger.h:44
Vector3D Vector
Vector alias typedef for compatibility with mobility models.
Definition: vector.h:324
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.
helps to create WifiNetDevice objects
Definition: wifi-helper.h:322
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:162
void SetErrorRateModel(std::string type, Args &&... args)
Helper function used to set the error rate model.
Definition: wifi-helper.h:531
uint16_t GetChannelWidth(void) const
Definition: wifi-phy.cc:969
uint16_t GetFrequency(void) const
Definition: wifi-phy.cc:957
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:45
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:849
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
Definition: config.cc:901
void Set(std::string path, const AttributeValue &value)
Definition: config.cc:839
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
#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:206
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:282
void(* DataRate)(DataRate oldValue, DataRate newValue)
TracedValue callback signature for DataRate.
Definition: data-rate.h:329
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1245
@ WIFI_STANDARD_80211n
address
Definition: first.py:40
stack
Definition: first.py:37
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:661
double Integral(const SpectrumValue &arg)
std::vector< BandInfo > Bands
Container of BandInfo.
U * GetPointer(const Ptr< U > &p)
Definition: ptr.h:495
cmd
Definition: second.py:43
ssid
Definition: third.py:88
channel
Definition: third.py:83
mac
Definition: third.py:87
wifi
Definition: third.py:90
wifiApNode
Definition: third.py:81
mobility
Definition: third.py:98
phy
Definition: third.py:84
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
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.