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
107 uint16_t channelFreqMhz,
108 WifiTxVector txVector,
109 MpduInfo aMpdu,
110 SignalNoiseDbm signalNoise,
111 uint16_t staId)
112
113{
114 g_samples++;
115 g_signalDbmAvg += ((signalNoise.signal - g_signalDbmAvg) / g_samples);
116 g_noiseDbmAvg += ((signalNoise.noise - g_noiseDbmAvg) / g_samples);
117}
118
119NS_LOG_COMPONENT_DEFINE ("WifiSpectrumPerInterference");
120
122
125{
126public:
128 {
129 BandInfo bandInfo;
130 bandInfo.fc = 5180e6;
131 bandInfo.fl = 5180e6 - 10e6;
132 bandInfo.fh = 5180e6 + 10e6;
133
134 Bands bands;
135 bands.push_back (bandInfo);
136
137 SpectrumModelWifi5180MHz = Create<SpectrumModel> (bands);
138 }
139
141
144{
145public:
147 {
148 BandInfo bandInfo;
149 bandInfo.fc = 5190e6;
150 bandInfo.fl = 5190e6 - 10e6;
151 bandInfo.fh = 5190e6 + 10e6;
152
153 Bands bands;
154 bands.push_back (bandInfo);
155
156 SpectrumModelWifi5190MHz = Create<SpectrumModel> (bands);
157 }
158
160
161int main (int argc, char *argv[])
162{
163 bool udp = true;
164 double distance = 50;
165 double simulationTime = 10; //seconds
166 uint16_t index = 256;
167 std::string wifiType = "ns3::SpectrumWifiPhy";
168 std::string errorModelType = "ns3::NistErrorRateModel";
169 bool enablePcap = false;
170 const uint32_t tcpPacketSize = 1448;
171 double waveformPower = 0;
172
173 CommandLine cmd (__FILE__);
174 cmd.AddValue ("simulationTime", "Simulation time in seconds", simulationTime);
175 cmd.AddValue ("udp", "UDP if set to 1, TCP otherwise", udp);
176 cmd.AddValue ("distance", "meters separation between nodes", distance);
177 cmd.AddValue ("index", "restrict index to single value between 0 and 31", index);
178 cmd.AddValue ("wifiType", "select ns3::SpectrumWifiPhy or ns3::YansWifiPhy", wifiType);
179 cmd.AddValue ("errorModelType", "select ns3::NistErrorRateModel or ns3::YansErrorRateModel", errorModelType);
180 cmd.AddValue ("enablePcap", "enable pcap output", enablePcap);
181 cmd.AddValue ("waveformPower", "Waveform power (linear W)", waveformPower);
182 cmd.Parse (argc,argv);
183
184 uint16_t startIndex = 0;
185 uint16_t stopIndex = 31;
186 if (index < 32)
187 {
188 startIndex = index;
189 stopIndex = index;
190 }
191
192 std::cout << "wifiType: " << wifiType << " distance: " << distance << "m; time: " << simulationTime << "; TxPower: 16 dBm (40 mW)" << std::endl;
193 std::cout << std::setw (5) << "index" <<
194 std::setw (6) << "MCS" <<
195 std::setw (13) << "Rate (Mb/s)" <<
196 std::setw (12) << "Tput (Mb/s)" <<
197 std::setw (10) << "Received " <<
198 std::setw (12) << "Signal (dBm)" <<
199 std::setw (12) << "Noi+Inf(dBm)" <<
200 std::setw (9) << "SNR (dB)" <<
201 std::endl;
202 for (uint16_t i = startIndex; i <= stopIndex; i++)
203 {
204 uint32_t payloadSize;
205 if (udp)
206 {
207 payloadSize = 972; // 1000 bytes IPv4
208 }
209 else
210 {
211 payloadSize = 1448; // 1500 bytes IPv6
212 Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (payloadSize));
213 }
214
215 NodeContainer wifiStaNode;
216 wifiStaNode.Create (1);
218 wifiApNode.Create (1);
219 NodeContainer interferingNode;
220 interferingNode.Create (1);
221
223 SpectrumWifiPhyHelper spectrumPhy;
224 Ptr<MultiModelSpectrumChannel> spectrumChannel;
225 uint16_t frequency = (i <= 15 ? 5180 : 5190);
226 if (wifiType == "ns3::YansWifiPhy")
227 {
229 channel.AddPropagationLoss ("ns3::FriisPropagationLossModel",
230 "Frequency", DoubleValue (frequency * 1e6));
231 channel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
232 phy.SetChannel (channel.Create ());
233 phy.Set ("ChannelSettings", StringValue (std::string ("{") + (frequency == 5180 ? "36" : "38")
234 + ", 0, BAND_5GHZ, 0}"));
235 }
236 else if (wifiType == "ns3::SpectrumWifiPhy")
237 {
238 spectrumChannel
239 = CreateObject<MultiModelSpectrumChannel> ();
241 = CreateObject<FriisPropagationLossModel> ();
242 lossModel->SetFrequency (frequency * 1e6);
243 spectrumChannel->AddPropagationLossModel (lossModel);
244
246 = CreateObject<ConstantSpeedPropagationDelayModel> ();
247 spectrumChannel->SetPropagationDelayModel (delayModel);
248
249 spectrumPhy.SetChannel (spectrumChannel);
250 spectrumPhy.SetErrorRateModel (errorModelType);
251 // channel 36 at 20 MHz, 38 at 40 MHz
252 spectrumPhy.Set ("ChannelSettings", StringValue (std::string ("{")
253 + (frequency == 5180 ? "36" : "38")
254 + ", 0, BAND_5GHZ, 0}"));
255 }
256 else
257 {
258 NS_FATAL_ERROR ("Unsupported WiFi type " << wifiType);
259 }
260
262 wifi.SetStandard (WIFI_STANDARD_80211n);
264
265 Ssid ssid = Ssid ("ns380211n");
266
267 double datarate = 0;
269 if (i == 0)
270 {
271 DataRate = StringValue ("HtMcs0");
272 datarate = 6.5;
273 }
274 else if (i == 1)
275 {
276 DataRate = StringValue ("HtMcs1");
277 datarate = 13;
278 }
279 else if (i == 2)
280 {
281 DataRate = StringValue ("HtMcs2");
282 datarate = 19.5;
283 }
284 else if (i == 3)
285 {
286 DataRate = StringValue ("HtMcs3");
287 datarate = 26;
288 }
289 else if (i == 4)
290 {
291 DataRate = StringValue ("HtMcs4");
292 datarate = 39;
293 }
294 else if (i == 5)
295 {
296 DataRate = StringValue ("HtMcs5");
297 datarate = 52;
298 }
299 else if (i == 6)
300 {
301 DataRate = StringValue ("HtMcs6");
302 datarate = 58.5;
303 }
304 else if (i == 7)
305 {
306 DataRate = StringValue ("HtMcs7");
307 datarate = 65;
308 }
309 else if (i == 8)
310 {
311 DataRate = StringValue ("HtMcs0");
312 datarate = 7.2;
313 }
314 else if (i == 9)
315 {
316 DataRate = StringValue ("HtMcs1");
317 datarate = 14.4;
318 }
319 else if (i == 10)
320 {
321 DataRate = StringValue ("HtMcs2");
322 datarate = 21.7;
323 }
324 else if (i == 11)
325 {
326 DataRate = StringValue ("HtMcs3");
327 datarate = 28.9;
328 }
329 else if (i == 12)
330 {
331 DataRate = StringValue ("HtMcs4");
332 datarate = 43.3;
333 }
334 else if (i == 13)
335 {
336 DataRate = StringValue ("HtMcs5");
337 datarate = 57.8;
338 }
339 else if (i == 14)
340 {
341 DataRate = StringValue ("HtMcs6");
342 datarate = 65;
343 }
344 else if (i == 15)
345 {
346 DataRate = StringValue ("HtMcs7");
347 datarate = 72.2;
348 }
349 else if (i == 16)
350 {
351 DataRate = StringValue ("HtMcs0");
352 datarate = 13.5;
353 }
354 else if (i == 17)
355 {
356 DataRate = StringValue ("HtMcs1");
357 datarate = 27;
358 }
359 else if (i == 18)
360 {
361 DataRate = StringValue ("HtMcs2");
362 datarate = 40.5;
363 }
364 else if (i == 19)
365 {
366 DataRate = StringValue ("HtMcs3");
367 datarate = 54;
368 }
369 else if (i == 20)
370 {
371 DataRate = StringValue ("HtMcs4");
372 datarate = 81;
373 }
374 else if (i == 21)
375 {
376 DataRate = StringValue ("HtMcs5");
377 datarate = 108;
378 }
379 else if (i == 22)
380 {
381 DataRate = StringValue ("HtMcs6");
382 datarate = 121.5;
383 }
384 else if (i == 23)
385 {
386 DataRate = StringValue ("HtMcs7");
387 datarate = 135;
388 }
389 else if (i == 24)
390 {
391 DataRate = StringValue ("HtMcs0");
392 datarate = 15;
393 }
394 else if (i == 25)
395 {
396 DataRate = StringValue ("HtMcs1");
397 datarate = 30;
398 }
399 else if (i == 26)
400 {
401 DataRate = StringValue ("HtMcs2");
402 datarate = 45;
403 }
404 else if (i == 27)
405 {
406 DataRate = StringValue ("HtMcs3");
407 datarate = 60;
408 }
409 else if (i == 28)
410 {
411 DataRate = StringValue ("HtMcs4");
412 datarate = 90;
413 }
414 else if (i == 29)
415 {
416 DataRate = StringValue ("HtMcs5");
417 datarate = 120;
418 }
419 else if (i == 30)
420 {
421 DataRate = StringValue ("HtMcs6");
422 datarate = 135;
423 }
424 else
425 {
426 DataRate = StringValue ("HtMcs7");
427 datarate = 150;
428 }
429
430 wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager","DataMode", DataRate,
431 "ControlMode", DataRate);
432
433 NetDeviceContainer staDevice;
434 NetDeviceContainer apDevice;
435
436 if (wifiType == "ns3::YansWifiPhy")
437 {
438 mac.SetType ("ns3::StaWifiMac",
439 "Ssid", SsidValue (ssid));
440 staDevice = wifi.Install (phy, mac, wifiStaNode);
441 mac.SetType ("ns3::ApWifiMac",
442 "Ssid", SsidValue (ssid));
443 apDevice = wifi.Install (phy, mac, wifiApNode);
444
445 }
446 else if (wifiType == "ns3::SpectrumWifiPhy")
447 {
448 mac.SetType ("ns3::StaWifiMac",
449 "Ssid", SsidValue (ssid));
450 staDevice = wifi.Install (spectrumPhy, mac, wifiStaNode);
451 mac.SetType ("ns3::ApWifiMac",
452 "Ssid", SsidValue (ssid));
453 apDevice = wifi.Install (spectrumPhy, mac, wifiApNode);
454 }
455
456 if (i <= 7)
457 {
458 Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/ShortGuardIntervalSupported", BooleanValue (false));
459 }
460 else if (i > 7 && i <= 15)
461 {
462 Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/ShortGuardIntervalSupported", BooleanValue (true));
463 }
464 else if (i > 15 && i <= 23)
465 {
466 Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/ShortGuardIntervalSupported", BooleanValue (false));
467 }
468 else
469 {
470 Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HtConfiguration/ShortGuardIntervalSupported", BooleanValue (true));
471 }
472
473 // mobility.
475 Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
476
477 positionAlloc->Add (Vector (0.0, 0.0, 0.0));
478 positionAlloc->Add (Vector (distance, 0.0, 0.0));
479 positionAlloc->Add (Vector (distance, distance, 0.0));
480 mobility.SetPositionAllocator (positionAlloc);
481
482 mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
483
484 mobility.Install (wifiApNode);
485 mobility.Install (wifiStaNode);
486 mobility.Install (interferingNode);
487
488 /* Internet stack*/
490 stack.Install (wifiApNode);
491 stack.Install (wifiStaNode);
492
494 address.SetBase ("192.168.1.0", "255.255.255.0");
495 Ipv4InterfaceContainer staNodeInterface;
496 Ipv4InterfaceContainer apNodeInterface;
497
498 staNodeInterface = address.Assign (staDevice);
499 apNodeInterface = address.Assign (apDevice);
500
501 /* Setting applications */
502 ApplicationContainer serverApp;
503 if (udp)
504 {
505 //UDP flow
506 uint16_t port = 9;
507 UdpServerHelper server (port);
508 serverApp = server.Install (wifiStaNode.Get (0));
509 serverApp.Start (Seconds (0.0));
510 serverApp.Stop (Seconds (simulationTime + 1));
511
512 UdpClientHelper client (staNodeInterface.GetAddress (0), port);
513 client.SetAttribute ("MaxPackets", UintegerValue (4294967295u));
514 client.SetAttribute ("Interval", TimeValue (Time ("0.0001"))); //packets/s
515 client.SetAttribute ("PacketSize", UintegerValue (payloadSize));
516 ApplicationContainer clientApp = client.Install (wifiApNode.Get (0));
517 clientApp.Start (Seconds (1.0));
518 clientApp.Stop (Seconds (simulationTime + 1));
519 }
520 else
521 {
522 //TCP flow
523 uint16_t port = 50000;
524 Address localAddress (InetSocketAddress (Ipv4Address::GetAny (), port));
525 PacketSinkHelper packetSinkHelper ("ns3::TcpSocketFactory", localAddress);
526 serverApp = packetSinkHelper.Install (wifiStaNode.Get (0));
527 serverApp.Start (Seconds (0.0));
528 serverApp.Stop (Seconds (simulationTime + 1));
529
530 OnOffHelper onoff ("ns3::TcpSocketFactory", Ipv4Address::GetAny ());
531 onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
532 onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
533 onoff.SetAttribute ("PacketSize", UintegerValue (payloadSize));
534 onoff.SetAttribute ("DataRate", DataRateValue (1000000000)); //bit/s
535 AddressValue remoteAddress (InetSocketAddress (staNodeInterface.GetAddress (0), port));
536 onoff.SetAttribute ("Remote", remoteAddress);
537 ApplicationContainer clientApp = onoff.Install (wifiApNode.Get (0));
538 clientApp.Start (Seconds (1.0));
539 clientApp.Stop (Seconds (simulationTime + 1));
540 }
541
542 // Configure waveform generator
543 Ptr<SpectrumValue> wgPsd = Create<SpectrumValue> (i <= 15 ? SpectrumModelWifi5180MHz
545 *wgPsd = waveformPower / 20e6; // PSD spread across 20 MHz
546 NS_LOG_INFO ("wgPsd : " << *wgPsd << " integrated power: " << Integral (*(GetPointer (wgPsd))));
547
548 if (wifiType == "ns3::SpectrumWifiPhy")
549 {
550 WaveformGeneratorHelper waveformGeneratorHelper;
551 waveformGeneratorHelper.SetChannel (spectrumChannel);
552 waveformGeneratorHelper.SetTxPowerSpectralDensity (wgPsd);
553
554 waveformGeneratorHelper.SetPhyAttribute ("Period", TimeValue (Seconds (0.0007)));
555 waveformGeneratorHelper.SetPhyAttribute ("DutyCycle", DoubleValue (1));
556 NetDeviceContainer waveformGeneratorDevices = waveformGeneratorHelper.Install (interferingNode);
557
558 Simulator::Schedule (Seconds (0.002), &WaveformGenerator::Start,
559 waveformGeneratorDevices.Get (0)->GetObject<NonCommunicatingNetDevice> ()->GetPhy ()->GetObject<WaveformGenerator> ());
560 }
561
562 Config::ConnectWithoutContext ("/NodeList/0/DeviceList/*/Phy/MonitorSnifferRx", MakeCallback (&MonitorSniffRx));
563
564 if (enablePcap)
565 {
566 phy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11_RADIO);
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<WifiPhy> wifiPhyPtr = staDevicePtr->GetObject <WifiNetDevice> ()->GetPhy ();
579 if (i <= 15)
580 {
581 NS_ABORT_MSG_IF (wifiPhyPtr->GetChannelWidth () != 20,
582 "Error: Channel width must be 20 MHz if MCS index <= 15");
583 NS_ABORT_MSG_IF (wifiPhyPtr->GetFrequency () != 5180,
584 "Error: Wi-Fi nodes must be tuned to 5180 MHz to match the waveform generator");
585 }
586 else
587 {
588 NS_ABORT_MSG_IF (wifiPhyPtr->GetChannelWidth () != 40,
589 "Error: Channel width must be 40 MHz if MCS index > 15");
590 NS_ABORT_MSG_IF (wifiPhyPtr->GetFrequency () != 5190,
591 "Error: Wi-Fi nodes must be tuned to 5190 MHz to match the waveform generator");
592 }
593
594 Simulator::Stop (Seconds (simulationTime + 1));
595 Simulator::Run ();
596
597 double throughput = 0;
598 uint64_t totalPacketsThrough = 0;
599 if (udp)
600 {
601 //UDP
602 totalPacketsThrough = DynamicCast<UdpServer> (serverApp.Get (0))->GetReceived ();
603 throughput = totalPacketsThrough * payloadSize * 8 / (simulationTime * 1000000.0); //Mbit/s
604 }
605 else
606 {
607 //TCP
608 uint64_t totalBytesRx = DynamicCast<PacketSink> (serverApp.Get (0))->GetTotalRx ();
609 totalPacketsThrough = totalBytesRx / tcpPacketSize;
610 throughput = totalBytesRx * 8 / (simulationTime * 1000000.0); //Mbit/s
611 }
612 std::cout << std::setw (5) << i <<
613 std::setw (6) << (i % 8) <<
614 std::setprecision (2) << std::fixed <<
615 std::setw (10) << datarate <<
616 std::setw (12) << throughput <<
617 std::setw (8) << totalPacketsThrough;
618 if (totalPacketsThrough > 0)
619 {
620 std::cout << std::setw (12) << g_signalDbmAvg <<
621 std::setw (12) << g_noiseDbmAvg <<
622 std::setw (12) << (g_signalDbmAvg - g_noiseDbmAvg) <<
623 std::endl;
624 }
625 else
626 {
627 std::cout << std::setw (12) << "N/A" <<
628 std::setw (12) << "N/A" <<
629 std::setw (12) << "N/A" <<
630 std::endl;
631 }
632 Simulator::Destroy ();
633 }
634 return 0;
635}
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
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes.
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:103
AttributeValue implementation for Time.
Definition: nstime.h:1308
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: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:274
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:154
void SetErrorRateModel(std::string type, Args &&... args)
Helper function used to set the error rate model.
Definition: wifi-helper.h:440
uint16_t GetChannelWidth(void) const
Definition: wifi-phy.cc:918
uint16_t GetFrequency(void) const
Definition: wifi-phy.cc:906
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:205
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:281
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:1244
@ WIFI_STANDARD_80211n
address
Definition: first.py:44
stack
Definition: first.py:41
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double Integral(const SpectrumValue &arg)
std::vector< BandInfo > Bands
Container of BandInfo.
U * GetPointer(const Ptr< U > &p)
Definition: ptr.h:421
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Definition: callback.h:1648
cmd
Definition: second.py:35
ssid
Definition: third.py:97
channel
Definition: third.py:92
mac
Definition: third.py:96
wifi
Definition: third.py:99
wifiApNode
Definition: third.py:90
mobility
Definition: third.py:107
phy
Definition: third.py:93
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:60
SignalNoiseDbm structure.
Definition: phy-entity.h:53
double noise
noise power in dBm
Definition: phy-entity.h:55
double signal
signal strength in dBm
Definition: phy-entity.h:54
class static_SpectrumModelWifi5190MHz_initializer static_SpectrumModelWifi5190MHz_initializer_instance
class static_SpectrumModelWifi5180MHz_initializer static_SpectrumModelWifi5180MHz_initializer_instance
Ptr< SpectrumModel > SpectrumModelWifi5190MHz
void MonitorSniffRx(Ptr< const Packet > packet, uint16_t channelFreqMhz, WifiTxVector txVector, MpduInfo aMpdu, SignalNoiseDbm signalNoise, uint16_t staId)
Ptr< SpectrumModel > SpectrumModelWifi5180MHz