A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wifi-eht-network.cc
Go to the documentation of this file.
1/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2022
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 * Author: Sebastien Deronne <sebastien.deronne@gmail.com>
19 */
20
21#include "ns3/boolean.h"
22#include "ns3/command-line.h"
23#include "ns3/config.h"
24#include "ns3/double.h"
25#include "ns3/eht-phy.h"
26#include "ns3/enum.h"
27#include "ns3/internet-stack-helper.h"
28#include "ns3/ipv4-address-helper.h"
29#include "ns3/ipv4-global-routing-helper.h"
30#include "ns3/log.h"
31#include "ns3/mobility-helper.h"
32#include "ns3/multi-model-spectrum-channel.h"
33#include "ns3/on-off-helper.h"
34#include "ns3/packet-sink-helper.h"
35#include "ns3/packet-sink.h"
36#include "ns3/rng-seed-manager.h"
37#include "ns3/spectrum-wifi-helper.h"
38#include "ns3/ssid.h"
39#include "ns3/string.h"
40#include "ns3/udp-client-server-helper.h"
41#include "ns3/uinteger.h"
42#include "ns3/wifi-acknowledgment.h"
43#include "ns3/yans-wifi-channel.h"
44#include "ns3/yans-wifi-helper.h"
45
46#include <array>
47#include <functional>
48#include <numeric>
49
50// This is a simple example in order to show how to configure an IEEE 802.11be Wi-Fi network.
51//
52// It outputs the UDP or TCP goodput for every EHT MCS value, which depends on the MCS value (0 to
53// 13), the channel width (20, 40, 80 or 160 MHz) and the guard interval (800ns, 1600ns or 3200ns).
54// The PHY bitrate is constant over all the simulation run. The user can also specify the distance
55// between the access point and the station: the larger the distance the smaller the goodput.
56//
57// The simulation assumes a configurable number of stations in an infrastructure network:
58//
59// STA AP
60// * *
61// | |
62// n1 n2
63//
64// Packets in this simulation belong to BestEffort Access Class (AC_BE).
65// By selecting an acknowledgment sequence for DL MU PPDUs, it is possible to aggregate a
66// Round Robin scheduler to the AP, so that DL MU PPDUs are sent by the AP via DL OFDMA.
67
68using namespace ns3;
69
70NS_LOG_COMPONENT_DEFINE("eht-wifi-network");
71
78std::vector<uint64_t>
79GetRxBytes(bool udp, const ApplicationContainer& serverApp, uint32_t payloadSize)
80{
81 std::vector<uint64_t> rxBytes(serverApp.GetN(), 0);
82 if (udp)
83 {
84 for (uint32_t i = 0; i < serverApp.GetN(); i++)
85 {
86 rxBytes[i] = payloadSize * DynamicCast<UdpServer>(serverApp.Get(i))->GetReceived();
87 }
88 }
89 else
90 {
91 for (uint32_t i = 0; i < serverApp.GetN(); i++)
92 {
93 rxBytes[i] = DynamicCast<PacketSink>(serverApp.Get(i))->GetTotalRx();
94 }
95 }
96 return rxBytes;
97};
98
108void
109PrintIntermediateTput(std::vector<uint64_t>& rxBytes,
110 bool udp,
111 const ApplicationContainer& serverApp,
112 uint32_t payloadSize,
113 Time tputInterval,
114 double simulationTime)
115{
116 auto newRxBytes = GetRxBytes(udp, serverApp, payloadSize);
117 Time now = Simulator::Now();
118
119 std::cout << "[" << (now - tputInterval).As(Time::S) << " - " << now.As(Time::S)
120 << "] Per-STA Throughput (Mbit/s):";
121
122 for (std::size_t i = 0; i < newRxBytes.size(); i++)
123 {
124 std::cout << "\t\t(" << i << ") "
125 << (newRxBytes[i] - rxBytes[i]) * 8. / tputInterval.GetMicroSeconds(); // Mbit/s
126 }
127 std::cout << std::endl;
128
129 rxBytes.swap(newRxBytes);
130
131 if (now < Seconds(simulationTime) - NanoSeconds(1))
132 {
133 Simulator::Schedule(Min(tputInterval, Seconds(simulationTime) - now - NanoSeconds(1)),
135 rxBytes,
136 udp,
137 serverApp,
138 payloadSize,
139 tputInterval,
140 simulationTime);
141 }
142}
143
144int
145main(int argc, char* argv[])
146{
147 bool udp{true};
148 bool downlink{true};
149 bool useRts{false};
150 bool useExtendedBlockAck{false};
151 double simulationTime{10}; // seconds
152 double distance{1.0}; // meters
153 double frequency{5}; // whether the first link operates in the 2.4, 5 or 6 GHz
154 double frequency2{0}; // whether the second link operates in the 2.4, 5 or 6 GHz (0 means no
155 // second link exists)
156 double frequency3{
157 0}; // whether the third link operates in the 2.4, 5 or 6 GHz (0 means no third link exists)
158 std::size_t nStations{1};
159 std::string dlAckSeqType{"NO-OFDMA"};
160 bool enableUlOfdma{false};
161 bool enableBsrp{false};
162 int mcs{-1}; // -1 indicates an unset value
163 uint32_t payloadSize =
164 700; // must fit in the max TX duration when transmitting at MCS 0 over an RU of 26 tones
165 Time tputInterval{0}; // interval for detailed throughput measurement
166 double minExpectedThroughput{0};
167 double maxExpectedThroughput{0};
168 Time accessReqInterval{0};
169
170 CommandLine cmd(__FILE__);
171 cmd.AddValue(
172 "frequency",
173 "Whether the first link operates in the 2.4, 5 or 6 GHz band (other values gets rejected)",
174 frequency);
175 cmd.AddValue(
176 "frequency2",
177 "Whether the second link operates in the 2.4, 5 or 6 GHz band (0 means the device has one "
178 "link, otherwise the band must be different than first link and third link)",
179 frequency2);
180 cmd.AddValue(
181 "frequency3",
182 "Whether the third link operates in the 2.4, 5 or 6 GHz band (0 means the device has up to "
183 "two links, otherwise the band must be different than first link and second link)",
184 frequency3);
185 cmd.AddValue("distance",
186 "Distance in meters between the station and the access point",
187 distance);
188 cmd.AddValue("simulationTime", "Simulation time in seconds", simulationTime);
189 cmd.AddValue("udp", "UDP if set to 1, TCP otherwise", udp);
190 cmd.AddValue("downlink",
191 "Generate downlink flows if set to 1, uplink flows otherwise",
192 downlink);
193 cmd.AddValue("useRts", "Enable/disable RTS/CTS", useRts);
194 cmd.AddValue("useExtendedBlockAck", "Enable/disable use of extended BACK", useExtendedBlockAck);
195 cmd.AddValue("nStations", "Number of non-AP HE stations", nStations);
196 cmd.AddValue("dlAckType",
197 "Ack sequence type for DL OFDMA (NO-OFDMA, ACK-SU-FORMAT, MU-BAR, AGGR-MU-BAR)",
198 dlAckSeqType);
199 cmd.AddValue("enableUlOfdma",
200 "Enable UL OFDMA (useful if DL OFDMA is enabled and TCP is used)",
201 enableUlOfdma);
202 cmd.AddValue("enableBsrp",
203 "Enable BSRP (useful if DL and UL OFDMA are enabled and TCP is used)",
204 enableBsrp);
205 cmd.AddValue(
206 "muSchedAccessReqInterval",
207 "Duration of the interval between two requests for channel access made by the MU scheduler",
208 accessReqInterval);
209 cmd.AddValue("mcs", "if set, limit testing to a specific MCS (0-11)", mcs);
210 cmd.AddValue("payloadSize", "The application payload size in bytes", payloadSize);
211 cmd.AddValue("tputInterval", "duration of intervals for throughput measurement", tputInterval);
212 cmd.AddValue("minExpectedThroughput",
213 "if set, simulation fails if the lowest throughput is below this value",
214 minExpectedThroughput);
215 cmd.AddValue("maxExpectedThroughput",
216 "if set, simulation fails if the highest throughput is above this value",
217 maxExpectedThroughput);
218 cmd.Parse(argc, argv);
219
220 if (useRts)
221 {
222 Config::SetDefault("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue("0"));
223 Config::SetDefault("ns3::WifiDefaultProtectionManager::EnableMuRts", BooleanValue(true));
224 }
225
226 if (dlAckSeqType == "ACK-SU-FORMAT")
227 {
228 Config::SetDefault("ns3::WifiDefaultAckManager::DlMuAckSequenceType",
230 }
231 else if (dlAckSeqType == "MU-BAR")
232 {
233 Config::SetDefault("ns3::WifiDefaultAckManager::DlMuAckSequenceType",
235 }
236 else if (dlAckSeqType == "AGGR-MU-BAR")
237 {
238 Config::SetDefault("ns3::WifiDefaultAckManager::DlMuAckSequenceType",
240 }
241 else if (dlAckSeqType != "NO-OFDMA")
242 {
243 NS_ABORT_MSG("Invalid DL ack sequence type (must be NO-OFDMA, ACK-SU-FORMAT, MU-BAR or "
244 "AGGR-MU-BAR)");
245 }
246
247 double prevThroughput[12];
248 for (uint32_t l = 0; l < 12; l++)
249 {
250 prevThroughput[l] = 0;
251 }
252 std::cout << "MCS value"
253 << "\t\t"
254 << "Channel width"
255 << "\t\t"
256 << "GI"
257 << "\t\t\t"
258 << "Throughput" << '\n';
259 int minMcs = 0;
260 int maxMcs = 13;
261 if (mcs >= 0 && mcs <= 13)
262 {
263 minMcs = mcs;
264 maxMcs = mcs;
265 }
266 for (int mcs = minMcs; mcs <= maxMcs; mcs++)
267 {
268 uint8_t index = 0;
269 double previous = 0;
270 uint16_t maxChannelWidth =
271 (frequency != 2.4 && frequency2 != 2.4 && frequency3 != 2.4) ? 160 : 40;
272 for (int channelWidth = 20; channelWidth <= maxChannelWidth;) // MHz
273 {
274 for (int gi = 3200; gi >= 800;) // Nanoseconds
275 {
276 if (!udp)
277 {
278 Config::SetDefault("ns3::TcpSocket::SegmentSize", UintegerValue(payloadSize));
279 }
280
282 wifiStaNodes.Create(nStations);
284 wifiApNode.Create(1);
285
286 NetDeviceContainer apDevice;
290
291 wifi.SetStandard(WIFI_STANDARD_80211be);
292 std::array<std::string, 3> channelStr;
293 uint8_t nLinks = 0;
294 std::string dataModeStr = "EhtMcs" + std::to_string(mcs);
295 std::string ctrlRateStr;
296 uint64_t nonHtRefRateMbps = EhtPhy::GetNonHtReferenceRate(mcs) / 1e6;
297
298 if (frequency2 == frequency || frequency3 == frequency ||
299 (frequency3 != 0 && frequency3 == frequency2))
300 {
301 std::cout << "Frequency values must be unique!" << std::endl;
302 return 0;
303 }
304
305 for (auto freq : {frequency, frequency2, frequency3})
306 {
307 if (nLinks > 0 && freq == 0)
308 {
309 break;
310 }
311 channelStr[nLinks] = "{0, " + std::to_string(channelWidth) + ", ";
312 if (freq == 6)
313 {
314 channelStr[nLinks] += "BAND_6GHZ, 0}";
315 Config::SetDefault("ns3::LogDistancePropagationLossModel::ReferenceLoss",
316 DoubleValue(48));
317 wifi.SetRemoteStationManager(nLinks,
318 "ns3::ConstantRateWifiManager",
319 "DataMode",
320 StringValue(dataModeStr),
321 "ControlMode",
322 StringValue(dataModeStr));
323 }
324 else if (freq == 5)
325 {
326 channelStr[nLinks] += "BAND_5GHZ, 0}";
327 ctrlRateStr = "OfdmRate" + std::to_string(nonHtRefRateMbps) + "Mbps";
328 wifi.SetRemoteStationManager(nLinks,
329 "ns3::ConstantRateWifiManager",
330 "DataMode",
331 StringValue(dataModeStr),
332 "ControlMode",
333 StringValue(ctrlRateStr));
334 }
335 else if (freq == 2.4)
336 {
337 channelStr[nLinks] += "BAND_2_4GHZ, 0}";
338 Config::SetDefault("ns3::LogDistancePropagationLossModel::ReferenceLoss",
339 DoubleValue(40));
340 ctrlRateStr = "ErpOfdmRate" + std::to_string(nonHtRefRateMbps) + "Mbps";
341 wifi.SetRemoteStationManager(nLinks,
342 "ns3::ConstantRateWifiManager",
343 "DataMode",
344 StringValue(dataModeStr),
345 "ControlMode",
346 StringValue(ctrlRateStr));
347 }
348 else
349 {
350 std::cout << "Wrong frequency value!" << std::endl;
351 return 0;
352 }
353 nLinks++;
354 }
355
356 Ssid ssid = Ssid("ns3-80211be");
357
358 /*
359 * SingleModelSpectrumChannel cannot be used with 802.11be because two
360 * spectrum models are required: one with 78.125 kHz bands for HE PPDUs
361 * and one with 312.5 kHz bands for, e.g., non-HT PPDUs (for more details,
362 * see issue #408 (CLOSED))
363 */
364 Ptr<MultiModelSpectrumChannel> spectrumChannel =
365 CreateObject<MultiModelSpectrumChannel>();
366
368 CreateObject<LogDistancePropagationLossModel>();
369 spectrumChannel->AddPropagationLossModel(lossModel);
370
372 phy.SetPcapDataLinkType(WifiPhyHelper::DLT_IEEE802_11_RADIO);
373 phy.SetChannel(spectrumChannel);
374
375 mac.SetType("ns3::StaWifiMac", "Ssid", SsidValue(ssid));
376 for (uint8_t linkId = 0; linkId < nLinks; linkId++)
377 {
378 phy.Set(linkId, "ChannelSettings", StringValue(channelStr[linkId]));
379 }
380 staDevices = wifi.Install(phy, mac, wifiStaNodes);
381
382 if (dlAckSeqType != "NO-OFDMA")
383 {
384 mac.SetMultiUserScheduler("ns3::RrMultiUserScheduler",
385 "EnableUlOfdma",
386 BooleanValue(enableUlOfdma),
387 "EnableBsrp",
388 BooleanValue(enableBsrp),
389 "AccessReqInterval",
390 TimeValue(accessReqInterval));
391 }
392 mac.SetType("ns3::ApWifiMac",
393 "EnableBeaconJitter",
394 BooleanValue(false),
395 "Ssid",
396 SsidValue(ssid));
397 apDevice = wifi.Install(phy, mac, wifiApNode);
398
401 int64_t streamNumber = 100;
402 streamNumber += wifi.AssignStreams(apDevice, streamNumber);
403 streamNumber += wifi.AssignStreams(staDevices, streamNumber);
404
405 // Set guard interval and MPDU buffer size
407 "/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HeConfiguration/GuardInterval",
410 "/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HeConfiguration/MpduBufferSize",
411 UintegerValue(useExtendedBlockAck ? 256 : 64));
412
413 // mobility.
415 Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator>();
416
417 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
418 positionAlloc->Add(Vector(distance, 0.0, 0.0));
419 mobility.SetPositionAllocator(positionAlloc);
420
421 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
422
423 mobility.Install(wifiApNode);
424 mobility.Install(wifiStaNodes);
425
426 /* Internet stack*/
428 stack.Install(wifiApNode);
429 stack.Install(wifiStaNodes);
430
432 address.SetBase("192.168.1.0", "255.255.255.0");
433 Ipv4InterfaceContainer staNodeInterfaces;
434 Ipv4InterfaceContainer apNodeInterface;
435
436 staNodeInterfaces = address.Assign(staDevices);
437 apNodeInterface = address.Assign(apDevice);
438
439 /* Setting applications */
440 ApplicationContainer serverApp;
441 auto serverNodes = downlink ? std::ref(wifiStaNodes) : std::ref(wifiApNode);
442 Ipv4InterfaceContainer serverInterfaces;
443 NodeContainer clientNodes;
444 for (std::size_t i = 0; i < nStations; i++)
445 {
446 serverInterfaces.Add(downlink ? staNodeInterfaces.Get(i)
447 : apNodeInterface.Get(0));
448 clientNodes.Add(downlink ? wifiApNode.Get(0) : wifiStaNodes.Get(i));
449 }
450
451 if (udp)
452 {
453 // UDP flow
454 uint16_t port = 9;
455 UdpServerHelper server(port);
456 serverApp = server.Install(serverNodes.get());
457 serverApp.Start(Seconds(0.0));
458 serverApp.Stop(Seconds(simulationTime + 1));
459
460 for (std::size_t i = 0; i < nStations; i++)
461 {
462 UdpClientHelper client(serverInterfaces.GetAddress(i), port);
463 client.SetAttribute("MaxPackets", UintegerValue(4294967295U));
464 client.SetAttribute("Interval", TimeValue(Time("0.00001"))); // packets/s
465 client.SetAttribute("PacketSize", UintegerValue(payloadSize));
466 ApplicationContainer clientApp = client.Install(clientNodes.Get(i));
467 clientApp.Start(Seconds(1.0));
468 clientApp.Stop(Seconds(simulationTime + 1));
469 }
470 }
471 else
472 {
473 // TCP flow
474 uint16_t port = 50000;
476 PacketSinkHelper packetSinkHelper("ns3::TcpSocketFactory", localAddress);
477 serverApp = packetSinkHelper.Install(serverNodes.get());
478 serverApp.Start(Seconds(0.0));
479 serverApp.Stop(Seconds(simulationTime + 1));
480
481 for (std::size_t i = 0; i < nStations; i++)
482 {
483 OnOffHelper onoff("ns3::TcpSocketFactory", Ipv4Address::GetAny());
484 onoff.SetAttribute("OnTime",
485 StringValue("ns3::ConstantRandomVariable[Constant=1]"));
486 onoff.SetAttribute("OffTime",
487 StringValue("ns3::ConstantRandomVariable[Constant=0]"));
488 onoff.SetAttribute("PacketSize", UintegerValue(payloadSize));
489 onoff.SetAttribute("DataRate", DataRateValue(1000000000)); // bit/s
490 AddressValue remoteAddress(
491 InetSocketAddress(serverInterfaces.GetAddress(i), port));
492 onoff.SetAttribute("Remote", remoteAddress);
493 ApplicationContainer clientApp = onoff.Install(clientNodes.Get(i));
494 clientApp.Start(Seconds(1.0));
495 clientApp.Stop(Seconds(simulationTime + 1));
496 }
497 }
498
499 // cumulative number of bytes received by each server application
500 std::vector<uint64_t> cumulRxBytes(nStations, 0);
501
502 if (tputInterval.IsStrictlyPositive())
503 {
504 Simulator::Schedule(Seconds(1) + tputInterval,
506 cumulRxBytes,
507 udp,
508 serverApp,
509 payloadSize,
510 tputInterval,
511 simulationTime + 1);
512 }
513
515
516 Simulator::Stop(Seconds(simulationTime + 1));
518
519 // When multiple stations are used, there are chances that association requests
520 // collide and hence the throughput may be lower than expected. Therefore, we relax
521 // the check that the throughput cannot decrease by introducing a scaling factor (or
522 // tolerance)
523 double tolerance = 0.10;
524 cumulRxBytes = GetRxBytes(udp, serverApp, payloadSize);
525 uint64_t rxBytes = std::accumulate(cumulRxBytes.cbegin(), cumulRxBytes.cend(), 0);
526 double throughput = (rxBytes * 8) / (simulationTime * 1000000.0); // Mbit/s
527
529
530 std::cout << mcs << "\t\t\t" << channelWidth << " MHz\t\t\t" << gi << " ns\t\t\t"
531 << throughput << " Mbit/s" << std::endl;
532
533 // test first element
534 if (mcs == 0 && channelWidth == 20 && gi == 3200)
535 {
536 if (throughput * (1 + tolerance) < minExpectedThroughput)
537 {
538 NS_LOG_ERROR("Obtained throughput " << throughput << " is not expected!");
539 exit(1);
540 }
541 }
542 // test last element
543 if (mcs == 11 && channelWidth == 160 && gi == 800)
544 {
545 if (maxExpectedThroughput > 0 &&
546 throughput > maxExpectedThroughput * (1 + tolerance))
547 {
548 NS_LOG_ERROR("Obtained throughput " << throughput << " is not expected!");
549 exit(1);
550 }
551 }
552 // test previous throughput is smaller (for the same mcs)
553 if (throughput * (1 + tolerance) > previous)
554 {
555 previous = throughput;
556 }
557 else if (throughput > 0)
558 {
559 NS_LOG_ERROR("Obtained throughput " << throughput << " is not expected!");
560 exit(1);
561 }
562 // test previous throughput is smaller (for the same channel width and GI)
563 if (throughput * (1 + tolerance) > prevThroughput[index])
564 {
565 prevThroughput[index] = throughput;
566 }
567 else if (throughput > 0)
568 {
569 NS_LOG_ERROR("Obtained throughput " << throughput << " is not expected!");
570 exit(1);
571 }
572 index++;
573 gi /= 2;
574 }
575 channelWidth *= 2;
576 }
577 }
578 return 0;
579}
#define Min(a, b)
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.
uint32_t GetN() const
Get the number of Ptr<Application> stored in this container.
AttributeValue implementation for Boolean.
Definition: boolean.h:37
Parse command-line arguments.
Definition: command-line.h:232
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
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:371
Hold variables of type enum.
Definition: enum.h:56
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()
static void PopulateRoutingTables()
Build a routing database and initialize the routing tables of the nodes in the simulation.
holds a vector of std::pair of Ptr<Ipv4> and interface index.
std::pair< Ptr< Ipv4 >, uint32_t > Get(uint32_t i) const
Get the std::pair of an Ptr<Ipv4> and interface stored at the location specified by the index.
void Add(const Ipv4InterfaceContainer &other)
Concatenate the entries in the other container with ours.
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
keep track of a set of node pointers.
void Add(const NodeContainer &nc)
Append the contents of another NodeContainer to the end of this container.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
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 void SetRun(uint64_t run)
Set the run number of simulation.
static void SetSeed(uint32_t seed)
Set the seed.
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 Time Now()
Return the current simulation virtual time.
Definition: simulator.cc:199
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.
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
TimeWithUnit As(const Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
Definition: time.cc:417
@ S
second
Definition: nstime.h:116
int64_t GetMicroSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:412
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
helps to create WifiNetDevice objects
Definition: wifi-helper.h:325
create MAC layers for a ns3::WifiNetDevice.
@ DLT_IEEE802_11_RADIO
Include Radiotap link layer information.
Definition: wifi-helper.h:179
uint16_t port
Definition: dsdv-manet.cc:45
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:891
void Set(std::string path, const AttributeValue &value)
Definition: config.cc:877
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Definition: abort.h:49
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
Definition: log.h:254
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1372
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1336
@ WIFI_STANDARD_80211be
ns address
Definition: first.py:40
ns stack
Definition: first.py:37
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns cmd
Definition: second.py:33
STL namespace.
ns wifi
Definition: third.py:88
ns ssid
Definition: third.py:86
ns staDevices
Definition: third.py:91
ns mac
Definition: third.py:85
ns wifiApNode
Definition: third.py:79
ns mobility
Definition: third.py:96
ns wifiStaNodes
Definition: third.py:77
ns phy
Definition: third.py:82
void PrintIntermediateTput(std::vector< uint64_t > &rxBytes, bool udp, const ApplicationContainer &serverApp, uint32_t payloadSize, Time tputInterval, double simulationTime)
Print average throughput over an intermediate time interval.
std::vector< uint64_t > GetRxBytes(bool udp, const ApplicationContainer &serverApp, uint32_t payloadSize)