A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wifi-eht-network.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Sebastien Deronne <sebastien.deronne@gmail.com>
7 */
8
9#include "ns3/attribute-container.h"
10#include "ns3/boolean.h"
11#include "ns3/command-line.h"
12#include "ns3/config.h"
13#include "ns3/double.h"
14#include "ns3/eht-phy.h"
15#include "ns3/enum.h"
16#include "ns3/internet-stack-helper.h"
17#include "ns3/ipv4-address-helper.h"
18#include "ns3/log.h"
19#include "ns3/mobility-helper.h"
20#include "ns3/multi-model-spectrum-channel.h"
21#include "ns3/on-off-helper.h"
22#include "ns3/packet-sink-helper.h"
23#include "ns3/packet-sink.h"
24#include "ns3/spectrum-wifi-helper.h"
25#include "ns3/ssid.h"
26#include "ns3/string.h"
27#include "ns3/udp-client-server-helper.h"
28#include "ns3/udp-server.h"
29#include "ns3/uinteger.h"
30#include "ns3/wifi-acknowledgment.h"
31#include "ns3/yans-wifi-channel.h"
32#include "ns3/yans-wifi-helper.h"
33
34#include <algorithm>
35#include <array>
36#include <functional>
37#include <numeric>
38
39// This is a simple example in order to show how to configure an IEEE 802.11be Wi-Fi network.
40//
41// It outputs the UDP or TCP goodput for every EHT MCS value, which depends on the MCS value (0 to
42// 13), the channel width (20, 40, 80 or 160 MHz) and the guard interval (800ns, 1600ns or 3200ns).
43// The PHY bitrate is constant over all the simulation run. The user can also specify the distance
44// between the access point and the station: the larger the distance the smaller the goodput.
45//
46// The simulation assumes a configurable number of stations in an infrastructure network:
47//
48// STA AP
49// * *
50// | |
51// n1 n2
52//
53// Packets in this simulation belong to BestEffort Access Class (AC_BE).
54// By selecting an acknowledgment sequence for DL MU PPDUs, it is possible to aggregate a
55// Round Robin scheduler to the AP, so that DL MU PPDUs are sent by the AP via DL OFDMA.
56
57using namespace ns3;
58
59NS_LOG_COMPONENT_DEFINE("eht-wifi-network");
60
61/**
62 * @param udp true if UDP is used, false if TCP is used
63 * @param serverApp a container of server applications
64 * @param payloadSize the size in bytes of the packets
65 * @return the bytes received by each server application
66 */
67std::vector<uint64_t>
68GetRxBytes(bool udp, const ApplicationContainer& serverApp, uint32_t payloadSize)
69{
70 std::vector<uint64_t> rxBytes(serverApp.GetN(), 0);
71 if (udp)
72 {
73 for (uint32_t i = 0; i < serverApp.GetN(); i++)
74 {
75 rxBytes[i] = payloadSize * DynamicCast<UdpServer>(serverApp.Get(i))->GetReceived();
76 }
77 }
78 else
79 {
80 for (uint32_t i = 0; i < serverApp.GetN(); i++)
81 {
82 rxBytes[i] = DynamicCast<PacketSink>(serverApp.Get(i))->GetTotalRx();
83 }
84 }
85 return rxBytes;
86}
87
88/**
89 * Print average throughput over an intermediate time interval.
90 * @param rxBytes a vector of the amount of bytes received by each server application
91 * @param udp true if UDP is used, false if TCP is used
92 * @param serverApp a container of server applications
93 * @param payloadSize the size in bytes of the packets
94 * @param tputInterval the duration of an intermediate time interval
95 * @param simulationTime the simulation time in seconds
96 */
97void
98PrintIntermediateTput(std::vector<uint64_t>& rxBytes,
99 bool udp,
100 const ApplicationContainer& serverApp,
101 uint32_t payloadSize,
103 Time simulationTime)
104{
105 auto newRxBytes = GetRxBytes(udp, serverApp, payloadSize);
106 Time now = Simulator::Now();
107
108 std::cout << "[" << (now - tputInterval).As(Time::S) << " - " << now.As(Time::S)
109 << "] Per-STA Throughput (Mbit/s):";
110
111 for (std::size_t i = 0; i < newRxBytes.size(); i++)
112 {
113 std::cout << "\t\t(" << i << ") "
114 << (newRxBytes[i] - rxBytes[i]) * 8. / tputInterval.GetMicroSeconds(); // Mbit/s
115 }
116 std::cout << std::endl;
117
118 rxBytes.swap(newRxBytes);
119
120 if (now < (simulationTime - NanoSeconds(1)))
121 {
122 Simulator::Schedule(Min(tputInterval, simulationTime - now - NanoSeconds(1)),
124 rxBytes,
125 udp,
126 serverApp,
127 payloadSize,
129 simulationTime);
130 }
131}
132
133int
134main(int argc, char* argv[])
135{
136 bool udp{true};
137 bool downlink{true};
138 bool useRts{false};
139 bool use80Plus80{false};
140 uint16_t mpduBufferSize{512};
141 std::string emlsrMgrTypeId{"ns3::DefaultEmlsrManager"};
142 std::string emlsrLinks;
143 uint16_t paddingDelayUsec{32};
144 uint16_t transitionDelayUsec{128};
145 Time channelSwitchDelay{"100us"};
146 bool switchAuxPhy{true};
147 uint16_t auxPhyChWidth{20};
148 bool auxPhyTxCapable{true};
149 Time simulationTime{"10s"};
150 meter_u distance{1.0};
151 double frequency{5}; // whether the first link operates in the 2.4, 5 or 6 GHz
152 double frequency2{0}; // whether the second link operates in the 2.4, 5 or 6 GHz (0 means no
153 // second link exists)
154 double frequency3{
155 0}; // whether the third link operates in the 2.4, 5 or 6 GHz (0 means no third link exists)
156 std::size_t nStations{1};
157 std::string dlAckSeqType{"NO-OFDMA"};
158 bool enableUlOfdma{false};
159 bool enableBsrp{false};
160 std::string mcsStr;
161 std::vector<uint64_t> mcsValues;
162 int channelWidth{-1}; // in MHz, -1 indicates an unset value
163 int guardInterval{-1}; // in nanoseconds, -1 indicates an unset value
164 uint32_t payloadSize =
165 700; // must fit in the max TX duration when transmitting at MCS 0 over an RU of 26 tones
166 Time tputInterval{0}; // interval for detailed throughput measurement
167 double minExpectedThroughput{0.0};
168 double maxExpectedThroughput{0.0};
170
172 cmd.AddValue(
173 "frequency",
174 "Whether the first link operates in the 2.4, 5 or 6 GHz band (other values gets rejected)",
175 frequency);
176 cmd.AddValue(
177 "frequency2",
178 "Whether the second link operates in the 2.4, 5 or 6 GHz band (0 means the device has one "
179 "link, otherwise the band must be different than first link and third link)",
180 frequency2);
181 cmd.AddValue(
182 "frequency3",
183 "Whether the third link operates in the 2.4, 5 or 6 GHz band (0 means the device has up to "
184 "two links, otherwise the band must be different than first link and second link)",
185 frequency3);
186 cmd.AddValue("emlsrMgrTypeId", "The ns-3 TypeId of the EMLSR manager to use", emlsrMgrTypeId);
187 cmd.AddValue("emlsrLinks",
188 "The comma separated list of IDs of EMLSR links (for MLDs only)",
189 emlsrLinks);
190 cmd.AddValue("emlsrPaddingDelay",
191 "The EMLSR padding delay in microseconds (0, 32, 64, 128 or 256)",
193 cmd.AddValue("emlsrTransitionDelay",
194 "The EMLSR transition delay in microseconds (0, 16, 32, 64, 128 or 256)",
196 cmd.AddValue("emlsrAuxSwitch",
197 "Whether Aux PHY should switch channel to operate on the link on which "
198 "the Main PHY was operating before moving to the link of the Aux PHY. ",
199 switchAuxPhy);
200 cmd.AddValue("emlsrAuxChWidth",
201 "The maximum channel width (MHz) supported by Aux PHYs.",
203 cmd.AddValue("emlsrAuxTxCapable",
204 "Whether Aux PHYs are capable of transmitting.",
206 cmd.AddValue("channelSwitchDelay", "The PHY channel switch delay", channelSwitchDelay);
207 cmd.AddValue("distance",
208 "Distance in meters between the station and the access point",
209 distance);
210 cmd.AddValue("simulationTime", "Simulation time", simulationTime);
211 cmd.AddValue("udp", "UDP if set to 1, TCP otherwise", udp);
212 cmd.AddValue("downlink",
213 "Generate downlink flows if set to 1, uplink flows otherwise",
214 downlink);
215 cmd.AddValue("useRts", "Enable/disable RTS/CTS", useRts);
216 cmd.AddValue("use80Plus80", "Enable/disable use of 80+80 MHz", use80Plus80);
217 cmd.AddValue("mpduBufferSize",
218 "Size (in number of MPDUs) of the BlockAck buffer",
220 cmd.AddValue("nStations", "Number of non-AP EHT stations", nStations);
221 cmd.AddValue("dlAckType",
222 "Ack sequence type for DL OFDMA (NO-OFDMA, ACK-SU-FORMAT, MU-BAR, AGGR-MU-BAR)",
224 cmd.AddValue("enableUlOfdma",
225 "Enable UL OFDMA (useful if DL OFDMA is enabled and TCP is used)",
227 cmd.AddValue("enableBsrp",
228 "Enable BSRP (useful if DL and UL OFDMA are enabled and TCP is used)",
229 enableBsrp);
230 cmd.AddValue(
231 "muSchedAccessReqInterval",
232 "Duration of the interval between two requests for channel access made by the MU scheduler",
234 cmd.AddValue(
235 "mcs",
236 "list of comma separated MCS values to test; if unset, all MCS values (0-13) are tested",
237 mcsStr);
238 cmd.AddValue("channelWidth",
239 "if set, limit testing to a specific channel width expressed in MHz (20, 40, 80 "
240 "or 160 MHz)",
241 channelWidth);
242 cmd.AddValue("guardInterval",
243 "if set, limit testing to a specific guard interval duration expressed in "
244 "nanoseconds (800, 1600 or 3200 ns)",
246 cmd.AddValue("payloadSize", "The application payload size in bytes", payloadSize);
247 cmd.AddValue("tputInterval", "duration of intervals for throughput measurement", tputInterval);
248 cmd.AddValue("minExpectedThroughput",
249 "if set, simulation fails if the lowest throughput is below this value",
251 cmd.AddValue("maxExpectedThroughput",
252 "if set, simulation fails if the highest throughput is above this value",
254 cmd.Parse(argc, argv);
255
256 if (useRts)
257 {
258 Config::SetDefault("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue("0"));
259 Config::SetDefault("ns3::WifiDefaultProtectionManager::EnableMuRts", BooleanValue(true));
260 }
261
262 if (dlAckSeqType == "ACK-SU-FORMAT")
263 {
264 Config::SetDefault("ns3::WifiDefaultAckManager::DlMuAckSequenceType",
266 }
267 else if (dlAckSeqType == "MU-BAR")
268 {
269 Config::SetDefault("ns3::WifiDefaultAckManager::DlMuAckSequenceType",
271 }
272 else if (dlAckSeqType == "AGGR-MU-BAR")
273 {
274 Config::SetDefault("ns3::WifiDefaultAckManager::DlMuAckSequenceType",
276 }
277 else if (dlAckSeqType != "NO-OFDMA")
278 {
279 NS_ABORT_MSG("Invalid DL ack sequence type (must be NO-OFDMA, ACK-SU-FORMAT, MU-BAR or "
280 "AGGR-MU-BAR)");
281 }
282
283 double prevThroughput[12] = {0};
284
285 std::cout << "MCS value"
286 << "\t\t"
287 << "Channel width"
288 << "\t\t"
289 << "GI"
290 << "\t\t\t"
291 << "Throughput" << '\n';
292 uint8_t minMcs = 0;
293 uint8_t maxMcs = 13;
294
295 if (mcsStr.empty())
296 {
297 for (uint8_t mcs = minMcs; mcs <= maxMcs; ++mcs)
298 {
299 mcsValues.push_back(mcs);
300 }
301 }
302 else
303 {
304 AttributeContainerValue<UintegerValue, ',', std::vector> attr;
306 checker->SetItemChecker(MakeUintegerChecker<uint8_t>());
307 attr.DeserializeFromString(mcsStr, checker);
308 mcsValues = attr.Get();
309 std::sort(mcsValues.begin(), mcsValues.end());
310 }
311
312 int minChannelWidth = 20;
313 int maxChannelWidth = (frequency != 2.4 && frequency2 != 2.4 && frequency3 != 2.4) ? 160 : 40;
314 if (channelWidth >= minChannelWidth && channelWidth <= maxChannelWidth)
315 {
316 minChannelWidth = channelWidth;
317 maxChannelWidth = channelWidth;
318 }
319 int minGi = enableUlOfdma ? 1600 : 800;
320 int maxGi = 3200;
321 if (guardInterval >= minGi && guardInterval <= maxGi)
322 {
323 minGi = guardInterval;
325 }
326
327 for (const auto mcs : mcsValues)
328 {
329 uint8_t index = 0;
330 double previous = 0;
331 for (int width = minChannelWidth; width <= maxChannelWidth; width *= 2) // MHz
332 {
333 const auto is80Plus80 = (use80Plus80 && (width == 160));
334 const std::string widthStr = is80Plus80 ? "80+80" : std::to_string(width);
335 const auto segmentWidthStr = is80Plus80 ? "80" : widthStr;
336 for (int gi = maxGi; gi >= minGi; gi /= 2) // Nanoseconds
337 {
338 if (!udp)
339 {
340 Config::SetDefault("ns3::TcpSocket::SegmentSize", UintegerValue(payloadSize));
341 }
342
344 wifiStaNodes.Create(nStations);
346 wifiApNode.Create(1);
347
352
353 wifi.SetStandard(WIFI_STANDARD_80211be);
354 std::array<std::string, 3> channelStr;
355 std::array<FrequencyRange, 3> freqRanges;
356 uint8_t nLinks = 0;
357 std::string dataModeStr = "EhtMcs" + std::to_string(mcs);
358 std::string ctrlRateStr;
360
361 if (frequency2 == frequency || frequency3 == frequency ||
362 (frequency3 != 0 && frequency3 == frequency2))
363 {
364 NS_FATAL_ERROR("Frequency values must be unique!");
365 }
366
367 for (auto freq : {frequency, frequency2, frequency3})
368 {
369 if (nLinks > 0 && freq == 0)
370 {
371 break;
372 }
373 channelStr[nLinks] = "{0, " + segmentWidthStr + ", ";
374 if (freq == 6)
375 {
376 channelStr[nLinks] += "BAND_6GHZ, 0}";
378 Config::SetDefault("ns3::LogDistancePropagationLossModel::ReferenceLoss",
379 DoubleValue(48));
380 wifi.SetRemoteStationManager(nLinks,
381 "ns3::ConstantRateWifiManager",
382 "DataMode",
384 "ControlMode",
386 }
387 else if (freq == 5)
388 {
389 channelStr[nLinks] += "BAND_5GHZ, 0}";
391 ctrlRateStr = "OfdmRate" + std::to_string(nonHtRefRateMbps) + "Mbps";
392 wifi.SetRemoteStationManager(nLinks,
393 "ns3::ConstantRateWifiManager",
394 "DataMode",
396 "ControlMode",
398 }
399 else if (freq == 2.4)
400 {
401 channelStr[nLinks] += "BAND_2_4GHZ, 0}";
403 Config::SetDefault("ns3::LogDistancePropagationLossModel::ReferenceLoss",
404 DoubleValue(40));
405 ctrlRateStr = "ErpOfdmRate" + std::to_string(nonHtRefRateMbps) + "Mbps";
406 wifi.SetRemoteStationManager(nLinks,
407 "ns3::ConstantRateWifiManager",
408 "DataMode",
410 "ControlMode",
412 }
413 else
414 {
415 NS_FATAL_ERROR("Wrong frequency value!");
416 }
417
418 if (is80Plus80)
419 {
420 channelStr[nLinks] += std::string(";") + channelStr[nLinks];
421 }
422
423 nLinks++;
424 }
425
426 if (nLinks > 1 && !emlsrLinks.empty())
427 {
428 wifi.ConfigEhtOptions("EmlsrActivated", BooleanValue(true));
429 }
430
431 Ssid ssid = Ssid("ns3-80211be");
432
434 phy.SetPcapDataLinkType(WifiPhyHelper::DLT_IEEE802_11_RADIO);
435 phy.Set("ChannelSwitchDelay", TimeValue(channelSwitchDelay));
436
437 mac.SetType("ns3::StaWifiMac", "Ssid", SsidValue(ssid));
438 mac.SetEmlsrManager(emlsrMgrTypeId,
439 "EmlsrLinkSet",
441 "EmlsrPaddingDelay",
443 "EmlsrTransitionDelay",
445 "SwitchAuxPhy",
446 BooleanValue(switchAuxPhy),
447 "AuxPhyTxCapable",
449 "AuxPhyChannelWidth",
451 for (uint8_t linkId = 0; linkId < nLinks; linkId++)
452 {
453 phy.Set(linkId, "ChannelSettings", StringValue(channelStr[linkId]));
454
457 spectrumChannel->AddPropagationLossModel(lossModel);
458 phy.AddChannel(spectrumChannel, freqRanges[linkId]);
459 }
460 staDevices = wifi.Install(phy, mac, wifiStaNodes);
461
462 if (dlAckSeqType != "NO-OFDMA")
463 {
464 mac.SetMultiUserScheduler("ns3::RrMultiUserScheduler",
465 "EnableUlOfdma",
467 "EnableBsrp",
469 "AccessReqInterval",
471 }
472 mac.SetType("ns3::ApWifiMac",
473 "EnableBeaconJitter",
474 BooleanValue(false),
475 "Ssid",
476 SsidValue(ssid));
477 apDevice = wifi.Install(phy, mac, wifiApNode);
478
479 int64_t streamNumber = 100;
482
483 // Set guard interval and MPDU buffer size
485 "/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HeConfiguration/GuardInterval",
487 Config::Set("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/MpduBufferSize",
489
490 // mobility.
493
494 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
495 positionAlloc->Add(Vector(distance, 0.0, 0.0));
496 mobility.SetPositionAllocator(positionAlloc);
497
498 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
499
500 mobility.Install(wifiApNode);
501 mobility.Install(wifiStaNodes);
502
503 /* Internet stack*/
505 stack.Install(wifiApNode);
506 stack.Install(wifiStaNodes);
507 streamNumber += stack.AssignStreams(wifiApNode, streamNumber);
508 streamNumber += stack.AssignStreams(wifiStaNodes, streamNumber);
509
511 address.SetBase("192.168.1.0", "255.255.255.0");
514
515 staNodeInterfaces = address.Assign(staDevices);
517
518 /* Setting applications */
519 ApplicationContainer serverApp;
520 auto serverNodes = downlink ? std::ref(wifiStaNodes) : std::ref(wifiApNode);
523 for (std::size_t i = 0; i < nStations; i++)
524 {
525 serverInterfaces.Add(downlink ? staNodeInterfaces.Get(i)
526 : apNodeInterface.Get(0));
527 clientNodes.Add(downlink ? wifiApNode.Get(0) : wifiStaNodes.Get(i));
528 }
529
530 const auto maxLoad = nLinks *
532 MHz_u{static_cast<double>(width)},
533 NanoSeconds(gi),
534 1) /
535 nStations;
536 if (udp)
537 {
538 // UDP flow
539 uint16_t port = 9;
541 serverApp = server.Install(serverNodes.get());
542 streamNumber += server.AssignStreams(serverNodes.get(), streamNumber);
543
544 serverApp.Start(Seconds(0));
545 serverApp.Stop(simulationTime + Seconds(1));
546 const auto packetInterval = payloadSize * 8.0 / maxLoad;
547
548 for (std::size_t i = 0; i < nStations; i++)
549 {
551 client.SetAttribute("MaxPackets", UintegerValue(4294967295U));
552 client.SetAttribute("Interval", TimeValue(Seconds(packetInterval)));
553 client.SetAttribute("PacketSize", UintegerValue(payloadSize));
554 ApplicationContainer clientApp = client.Install(clientNodes.Get(i));
555 streamNumber += client.AssignStreams(clientNodes.Get(i), streamNumber);
556
557 clientApp.Start(Seconds(1));
558 clientApp.Stop(simulationTime + Seconds(1));
559 }
560 }
561 else
562 {
563 // TCP flow
564 uint16_t port = 50000;
566 PacketSinkHelper packetSinkHelper("ns3::TcpSocketFactory", localAddress);
567 serverApp = packetSinkHelper.Install(serverNodes.get());
568 streamNumber += packetSinkHelper.AssignStreams(serverNodes.get(), streamNumber);
569
570 serverApp.Start(Seconds(0));
571 serverApp.Stop(simulationTime + Seconds(1));
572
573 for (std::size_t i = 0; i < nStations; i++)
574 {
575 OnOffHelper onoff("ns3::TcpSocketFactory", Ipv4Address::GetAny());
576 onoff.SetAttribute("OnTime",
577 StringValue("ns3::ConstantRandomVariable[Constant=1]"));
578 onoff.SetAttribute("OffTime",
579 StringValue("ns3::ConstantRandomVariable[Constant=0]"));
580 onoff.SetAttribute("PacketSize", UintegerValue(payloadSize));
581 onoff.SetAttribute("DataRate", DataRateValue(maxLoad));
584 onoff.SetAttribute("Remote", remoteAddress);
585 ApplicationContainer clientApp = onoff.Install(clientNodes.Get(i));
586 streamNumber += onoff.AssignStreams(clientNodes.Get(i), streamNumber);
587
588 clientApp.Start(Seconds(1));
589 clientApp.Stop(simulationTime + Seconds(1));
590 }
591 }
592
593 // cumulative number of bytes received by each server application
594 std::vector<uint64_t> cumulRxBytes(nStations, 0);
595
596 if (tputInterval.IsStrictlyPositive())
597 {
601 udp,
602 serverApp,
603 payloadSize,
605 simulationTime + Seconds(1));
606 }
607
608 Simulator::Stop(simulationTime + Seconds(1));
610
611 // When multiple stations are used, there are chances that association requests
612 // collide and hence the throughput may be lower than expected. Therefore, we relax
613 // the check that the throughput cannot decrease by introducing a scaling factor (or
614 // tolerance)
615 auto tolerance = 0.10;
616 cumulRxBytes = GetRxBytes(udp, serverApp, payloadSize);
617 auto rxBytes = std::accumulate(cumulRxBytes.cbegin(), cumulRxBytes.cend(), 0.0);
618 auto throughput = (rxBytes * 8) / simulationTime.GetMicroSeconds(); // Mbit/s
619
621
622 std::cout << +mcs << "\t\t\t" << widthStr << " MHz\t\t"
623 << (widthStr.size() > 3 ? "" : "\t") << gi << " ns\t\t\t" << throughput
624 << " Mbit/s" << std::endl;
625
626 // test first element
627 if (mcs == minMcs && width == 20 && gi == 3200)
628 {
630 {
631 NS_LOG_ERROR("Obtained throughput " << throughput << " is not expected!");
632 exit(1);
633 }
634 }
635 // test last element
636 if (mcs == maxMcs && width == maxChannelWidth && gi == 800)
637 {
638 if (maxExpectedThroughput > 0 &&
640 {
641 NS_LOG_ERROR("Obtained throughput " << throughput << " is not expected!");
642 exit(1);
643 }
644 }
645 // test previous throughput is smaller (for the same mcs)
646 if (throughput * (1 + tolerance) > previous)
647 {
649 }
650 else if (throughput > 0)
651 {
652 NS_LOG_ERROR("Obtained throughput " << throughput << " is not expected!");
653 exit(1);
654 }
655 // test previous throughput is smaller (for the same channel width and GI)
656 if (throughput * (1 + tolerance) > prevThroughput[index])
657 {
658 prevThroughput[index] = throughput;
659 }
660 else if (throughput > 0)
661 {
662 NS_LOG_ERROR("Obtained throughput " << throughput << " is not expected!");
663 exit(1);
664 }
665 index++;
666 }
667 }
668 }
669 return 0;
670}
#define Min(a, b)
a polymophic address class
Definition address.h:90
AttributeValue implementation for Address.
Definition address.h:275
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.
uint32_t GetN() const
Get the number of Ptr<Application> stored in this container.
A container for one type of attribute.
AttributeValue implementation for Boolean.
Definition boolean.h:26
Parse command-line arguments.
AttributeValue implementation for DataRate.
Definition data-rate.h:285
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition double.h:31
static uint64_t GetDataRate(uint8_t mcsValue, MHz_u channelWidth, Time guardInterval, uint8_t nss)
Return the data rate corresponding to the supplied EHT MCS index, channel width, guard interval,...
Definition eht-phy.cc:365
static uint64_t GetNonHtReferenceRate(uint8_t mcsValue)
Calculate the rate in bps of the non-HT Reference Rate corresponding to the supplied HE MCS index.
Definition eht-phy.cc:378
Hold variables of type enum.
Definition enum.h:52
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.
Helper class used to assign positions and mobility models to nodes.
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
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:66
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition simulator.h:560
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition simulator.cc:131
static Time Now()
Return the current simulation virtual time.
Definition simulator.cc:197
static void Run()
Run the simulation.
Definition simulator.cc:167
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Definition simulator.cc:175
Make it easy to create and manage PHY objects for the spectrum model.
The IEEE 802.11 SSID Information Element.
Definition ssid.h:25
AttributeValue implementation for Ssid.
Definition ssid.h:85
Hold variables of type string.
Definition string.h:45
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
TimeWithUnit As(const Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
Definition time.cc:404
@ S
second
Definition nstime.h:105
AttributeValue implementation for Time.
Definition nstime.h:1431
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:34
helps to create WifiNetDevice objects
static int64_t AssignStreams(NetDeviceContainer c, int64_t stream)
Assign a fixed random variable stream number to the random variables used by the PHY and MAC aspects ...
create MAC layers for a ns3::WifiNetDevice.
@ DLT_IEEE802_11_RADIO
Include Radiotap link layer information.
uint16_t port
Definition dsdv-manet.cc:33
Ptr< AttributeChecker > MakeAttributeContainerChecker()
Make uninitialized AttributeContainerChecker using explicit types.
void SetDefault(std::string name, const AttributeValue &value)
Definition config.cc:883
void Set(std::string path, const AttributeValue &value)
Definition config.cc:869
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Definition abort.h:38
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
Definition log.h:243
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:436
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition nstime.h:1368
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition nstime.h:1380
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1344
@ WIFI_STANDARD_80211be
address
Definition first.py:36
stack
Definition first.py:33
Every class exported by the ns3 library is enclosed in the ns3 namespace.
constexpr FrequencyRange WIFI_SPECTRUM_6_GHZ
Identifier for the frequency range covering the wifi spectrum in the 6 GHz band.
constexpr FrequencyRange WIFI_SPECTRUM_5_GHZ
Identifier for the frequency range covering the wifi spectrum in the 5 GHz band.
constexpr FrequencyRange WIFI_SPECTRUM_2_4_GHZ
Identifier for the frequency range covering the wifi spectrum in the 2.4 GHz band.
STL namespace.
staDevices
Definition third.py:87
ssid
Definition third.py:82
mac
Definition third.py:81
wifi
Definition third.py:84
wifiApNode
Definition third.py:75
mobility
Definition third.py:92
wifiStaNodes
Definition third.py:73
phy
Definition third.py:78
std::ofstream throughput
void PrintIntermediateTput(std::vector< uint64_t > &rxBytes, bool udp, const ApplicationContainer &serverApp, uint32_t payloadSize, Time tputInterval, Time simulationTime)
Print average throughput over an intermediate time interval.
std::vector< uint64_t > GetRxBytes(bool udp, const ApplicationContainer &serverApp, uint32_t payloadSize)