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