A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wifi-dynamic-bw-op-test.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 Universita' degli Studi di Napoli Federico II
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Stefano Avallone <stavallo@unina.it>
7 */
8
9#include "ns3/channel-access-manager.h"
10#include "ns3/config.h"
11#include "ns3/mobility-helper.h"
12#include "ns3/multi-model-spectrum-channel.h"
13#include "ns3/packet-socket-client.h"
14#include "ns3/packet-socket-helper.h"
15#include "ns3/packet-socket-server.h"
16#include "ns3/qos-txop.h"
17#include "ns3/rng-seed-manager.h"
18#include "ns3/spectrum-wifi-helper.h"
19#include "ns3/string.h"
20#include "ns3/test.h"
21#include "ns3/wifi-mac.h"
22#include "ns3/wifi-net-device.h"
23#include "ns3/wifi-psdu.h"
24
25using namespace ns3;
26
27NS_LOG_COMPONENT_DEFINE("WifiDynamicBwOpTestSuite");
28
29/**
30 * @ingroup wifi-test
31 * @ingroup tests
32 *
33 * Two BSSes, each with one AP and one non-AP STA, are configured to operate on
34 * different channels. Specifically, the operating channel of BSS 1 is the secondary<X>
35 * channel of BSS 0, where X is half the width of the channel used by BSS 0.
36 * This test demonstrates that, if a transmission is ongoing on BSS 1, we can have
37 * a transmission on BSS 0 on its primary<X> channel.
38 */
40{
41 public:
42 /**
43 * Constructor
44 *
45 * @param channelStr channel setting strings for BSS 0 and BSS 1
46 * @param bss0Width width of the transmission in BSS 0 started when BSS 1 is transmitting
47 */
48 WifiUseAvailBwTest(std::initializer_list<std::string> channelStr, MHz_u bss0Width);
49 ~WifiUseAvailBwTest() override;
50
51 /**
52 * Function to trace packets received by the server application in the given BSS
53 * @param bss the given BSS
54 * @param p the packet
55 * @param addr the address
56 */
57 void L7Receive(uint8_t bss, Ptr<const Packet> p, const Address& addr);
58 /**
59 * Callback invoked when a PHY receives a PSDU to transmit
60 * @param bss the BSS the PSDU belongs to
61 * @param psduMap the PSDU map
62 * @param txVector the TX vector
63 * @param txPowerW the tx power in Watts
64 */
65 void Transmit(uint8_t bss, WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW);
66 /**
67 * Check correctness of transmitted frames
68 */
69 void CheckResults();
70
71 private:
72 void DoRun() override;
73
74 /// Information about transmitted frames
75 struct FrameInfo
76 {
77 Time txStart; ///< Frame start TX time
78 Time txDuration; ///< Frame TX duration
79 uint8_t bss; ///< BSS the frame belongs to
80 WifiMacHeader header; ///< Frame MAC header
81 std::size_t nMpdus; ///< number of MPDUs in the PSDU
82 WifiTxVector txVector; ///< TX vector used to transmit the frame
83 };
84
85 std::vector<std::string> m_channelStr; ///< channel setting strings
86 MHz_u m_bss0Width; ///< width of the transmission in BSS 0
87 ///< started when BSS 1 is transmitting
88 NetDeviceContainer m_staDevices; ///< container for stations' NetDevices
89 NetDeviceContainer m_apDevices; ///< container for AP's NetDevice
90 std::array<PacketSocketAddress, 2> m_sockets; ///< packet sockets for the two BSSes
91 std::vector<FrameInfo> m_txPsdus; ///< transmitted PSDUs
92 uint8_t m_txPkts; ///< TX packets per BSS (in addition to the two
93 ///< required to establish BA agreement)
94 std::array<uint8_t, 2> m_rcvPkts; ///< number of packets received by the stations
95};
96
97WifiUseAvailBwTest::WifiUseAvailBwTest(std::initializer_list<std::string> channelStr,
98 MHz_u bss0Width)
99 : TestCase("Check transmission on available bandwidth"),
100 m_channelStr(channelStr),
101 m_bss0Width(bss0Width),
102 m_txPkts(bss0Width / 10), // so that they all fit in an A-MPDU
103 m_rcvPkts({0, 0})
104{
105}
106
110
111void
113{
114 NS_LOG_INFO("Received " << p->GetSize() << " bytes in BSS " << +bss);
115 m_rcvPkts[bss]++;
116}
117
118void
120 WifiConstPsduMap psduMap,
121 WifiTxVector txVector,
122 double txPowerW)
123{
124 auto psdu = psduMap.begin()->second;
125 Time now = Simulator::Now();
126 const auto band = DynamicCast<WifiNetDevice>(m_apDevices.Get(0))->GetPhy()->GetPhyBand();
127
128 // Log all frames that are not management frames (we are only interested in data
129 // frames and acknowledgments) and have been transmitted after 400ms (so as to
130 // skip association requests/responses)
131 if (!psdu->GetHeader(0).IsMgt() && now > MilliSeconds(400))
132 {
133 m_txPsdus.push_back({now,
134 WifiPhy::CalculateTxDuration(psduMap, txVector, band),
135 bss,
136 psdu->GetHeader(0),
137 psdu->GetNMpdus(),
138 txVector});
139 }
140
141 NS_LOG_INFO(now << " BSS " << +bss << " " << psdu->GetHeader(0).GetTypeString() << " seq "
142 << psdu->GetHeader(0).GetSequenceNumber() << " to " << psdu->GetAddr1()
143 << " #MPDUs " << psdu->GetNMpdus() << " size " << psdu->GetSize()
144 << " TX duration " << WifiPhy::CalculateTxDuration(psduMap, txVector, band)
145 << "\n"
146 << "TXVECTOR " << txVector << "\n");
147
148 // when AP of BSS 1 starts transmitting (after 1.5 s), we generate packets
149 // for the AP of BSS 0 to transmit
150 if (bss == 1 && psdu->GetNMpdus() == m_txPkts && now >= Seconds(1.5))
151 {
153 client->SetAttribute("PacketSize", UintegerValue(2000));
154 client->SetAttribute("MaxPackets", UintegerValue(m_txPkts));
155 client->SetAttribute("Interval", TimeValue(MicroSeconds(0)));
156 client->SetRemote(m_sockets[0]);
157 m_apDevices.Get(0)->GetNode()->AddApplication(client);
158 client->SetStartTime(Seconds(0)); // start now
159 client->SetStopTime(Seconds(1)); // stop in a second
160 client->Initialize();
161
162 // after 1us (to allow for propagation delay), the largest idle primary
163 // channel on the AP of BSS 0 should be the expected one
165 auto mac = StaticCast<WifiNetDevice>(m_apDevices.Get(0))->GetMac();
166 auto cam = mac->GetChannelAccessManager();
168 cam->GetLargestIdlePrimaryChannel(MicroSeconds(1), Simulator::Now()),
170 "Unexpected width of the largest idle primary channel");
171 });
172 }
173}
174
175void
177{
180 int64_t streamNumber = 100;
181
182 NodeContainer wifiApNodes(2);
183 NodeContainer wifiStaNodes(2);
184
185 auto spectrumChannel = CreateObject<MultiModelSpectrumChannel>();
187 spectrumChannel->AddPropagationLossModel(lossModel);
190 spectrumChannel->SetPropagationDelayModel(delayModel);
191
193 phy.SetChannel(spectrumChannel);
194
195 // increase TX power to ensure signal spread over 160 MHz will trigger CCA busy indication on
196 // each 20 MHz subchannel
197 phy.Set("TxPowerStart", DoubleValue(20));
198 phy.Set("TxPowerEnd", DoubleValue(20));
199
200 WifiHelper wifi;
201 wifi.SetStandard(WIFI_STANDARD_80211be);
202 wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager",
203 "DataMode",
204 StringValue("EhtMcs0"),
205 "ControlMode",
206 StringValue("OfdmRate6Mbps"));
207
208 WifiMacHelper apMac;
209 apMac.SetType("ns3::ApWifiMac", "Ssid", SsidValue(Ssid("dynamic-bw-op-ssid")));
210
211 WifiMacHelper staMac;
212 staMac.SetType("ns3::StaWifiMac", "Ssid", SsidValue(Ssid("dynamic-bw-op-ssid")));
213
214 // BSS 0
215 phy.Set("ChannelSettings", StringValue(m_channelStr.at(0)));
216
217 m_apDevices = wifi.Install(phy, apMac, wifiApNodes.Get(0));
218 m_staDevices = wifi.Install(phy, staMac, wifiStaNodes.Get(0));
219
220 // BSS 1
221 phy.Set("ChannelSettings", StringValue(m_channelStr.at(1)));
222
223 m_apDevices.Add(wifi.Install(phy, apMac, wifiApNodes.Get(1)));
224 m_staDevices.Add(wifi.Install(phy, staMac, wifiStaNodes.Get(1)));
225
226 // schedule association requests at different times
228
229 // Assign fixed streams to random variables in use
230 streamNumber += WifiHelper::AssignStreams(m_apDevices, streamNumber);
231 streamNumber += WifiHelper::AssignStreams(m_staDevices, streamNumber);
232
233 MobilityHelper mobility;
235
236 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
237 positionAlloc->Add(Vector(50.0, 0.0, 0.0));
238 positionAlloc->Add(Vector(0.0, 50.0, 0.0));
239 positionAlloc->Add(Vector(50.0, 50.0, 0.0));
240 mobility.SetPositionAllocator(positionAlloc);
241
242 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
243 mobility.Install(wifiApNodes);
244 mobility.Install(wifiStaNodes);
245
246 NS_LOG_INFO("Position of AP (BSS 0) = "
247 << wifiApNodes.Get(0)->GetObject<MobilityModel>()->GetPosition());
248 NS_LOG_INFO("Position of AP (BSS 1) = "
249 << wifiApNodes.Get(1)->GetObject<MobilityModel>()->GetPosition());
250 NS_LOG_INFO("Position of STA (BSS 0) = "
251 << wifiStaNodes.Get(0)->GetObject<MobilityModel>()->GetPosition());
252 NS_LOG_INFO("Position of STA (BSS 1) = "
253 << wifiStaNodes.Get(1)->GetObject<MobilityModel>()->GetPosition());
254
255 PacketSocketHelper packetSocket;
256 packetSocket.Install(wifiApNodes);
257 packetSocket.Install(wifiStaNodes);
258
259 // DL frames
260 for (uint8_t bss : {0, 1})
261 {
262 m_sockets[bss].SetSingleDevice(m_apDevices.Get(bss)->GetIfIndex());
263 m_sockets[bss].SetPhysicalAddress(m_staDevices.Get(bss)->GetAddress());
264 m_sockets[bss].SetProtocol(1);
265
266 // the first client application generates two packets in order
267 // to trigger the establishment of a Block Ack agreement
269 client1->SetAttribute("PacketSize", UintegerValue(500));
270 client1->SetAttribute("MaxPackets", UintegerValue(2));
271 client1->SetAttribute("Interval", TimeValue(MicroSeconds(0)));
272 client1->SetRemote(m_sockets[bss]);
273 wifiApNodes.Get(bss)->AddApplication(client1);
274 client1->SetStartTime(Seconds(0.5) + bss * MilliSeconds(500));
275 client1->SetStopTime(Seconds(2));
276
277 // At time 1.5, start a transmission in BSS 1
278 if (bss == 1)
279 {
281 client2->SetAttribute("PacketSize", UintegerValue(2000));
282 client2->SetAttribute("MaxPackets", UintegerValue(m_txPkts));
283 client2->SetAttribute("Interval", TimeValue(MicroSeconds(0)));
284 client2->SetRemote(m_sockets[bss]);
285 wifiApNodes.Get(bss)->AddApplication(client2);
286 client2->SetStartTime(Seconds(1.5));
287 client2->SetStopTime(Seconds(2));
288 }
289
291 server->SetLocal(m_sockets[bss]);
292 wifiStaNodes.Get(bss)->AddApplication(server);
293 server->SetStartTime(Seconds(0));
294 server->SetStopTime(Seconds(2));
295
296 // Trace received packets on non-AP STAs
297 Config::ConnectWithoutContext("/NodeList/" + std::to_string(2 + bss) +
298 "/ApplicationList/*/$ns3::PacketSocketServer/Rx",
300 // Trace PSDUs passed to the PHY of the AP
301 Config::ConnectWithoutContext("/NodeList/" + std::to_string(bss) +
302 "/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyTxPsduBegin",
304 // Trace PSDUs passed to the PHY of the non-AP STA
305 Config::ConnectWithoutContext("/NodeList/" + std::to_string(2 + bss) +
306 "/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyTxPsduBegin",
308 }
309
312
313 CheckResults();
314
316}
317
318void
320{
321 NS_TEST_ASSERT_MSG_EQ(m_txPsdus.size(), 12, "Expected 12 transmitted frames");
322
323 // first logged frames are Acks after ADDBA Request/Response frames
324 auto psduIt = m_txPsdus.begin();
325 NS_TEST_EXPECT_MSG_EQ(psduIt->header.IsAck(), true, "Expected Ack after ADDBA Request");
326 NS_TEST_EXPECT_MSG_EQ(+psduIt->bss, 0, "Expected a transmission in BSS 0");
327 psduIt++;
328
329 NS_TEST_EXPECT_MSG_EQ(psduIt->header.IsAck(), true, "Expected Ack after ADDBA Response");
330 NS_TEST_EXPECT_MSG_EQ(+psduIt->bss, 0, "Expected a transmission in BSS 0");
331 psduIt++;
332
333 // the first data frame is an A-MPDU sent by the AP of BSS 0 right after the
334 // establishment of the Block Ack agreement
335 NS_TEST_EXPECT_MSG_EQ(psduIt->header.IsQosData(), true, "Expected a QoS data frame");
336 NS_TEST_EXPECT_MSG_EQ(+psduIt->bss, 0, "Expected a transmission in BSS 0");
337 NS_TEST_EXPECT_MSG_EQ(psduIt->nMpdus, 2, "Expected an A-MPDU of 2 MPDUs after Block Ack");
339 psduIt->txVector.GetChannelWidth(),
340 StaticCast<WifiNetDevice>(m_apDevices.Get(0))->GetPhy()->GetChannelWidth(),
341 "Expected a transmission on the whole channel width");
342 psduIt++;
343
344 NS_TEST_EXPECT_MSG_EQ(psduIt->header.IsBlockAck(), true, "Expected Block Ack after data frame");
345 NS_TEST_EXPECT_MSG_EQ(+psduIt->bss, 0, "Expected a transmission in BSS 0");
346 psduIt++;
347
348 // same sequence for BSS 1
349 NS_TEST_EXPECT_MSG_EQ(psduIt->header.IsAck(), true, "Expected Ack after ADDBA Request");
350 NS_TEST_EXPECT_MSG_EQ(+psduIt->bss, 1, "Expected a transmission in BSS 1");
351 psduIt++;
352
353 NS_TEST_EXPECT_MSG_EQ(psduIt->header.IsAck(), true, "Expected Ack after ADDBA Response");
354 NS_TEST_EXPECT_MSG_EQ(+psduIt->bss, 1, "Expected a transmission in BSS 1");
355 psduIt++;
356
357 NS_TEST_EXPECT_MSG_EQ(psduIt->header.IsQosData(), true, "Expected a QoS data frame");
358 NS_TEST_EXPECT_MSG_EQ(+psduIt->bss, 1, "Expected a transmission in BSS 1");
359 NS_TEST_EXPECT_MSG_EQ(psduIt->nMpdus, 2, "Expected an A-MPDU of 2 MPDUs after Block Ack");
361 psduIt->txVector.GetChannelWidth(),
362 StaticCast<WifiNetDevice>(m_apDevices.Get(1))->GetPhy()->GetChannelWidth(),
363 "Expected a transmission on the whole channel width");
364 psduIt++;
365
366 NS_TEST_EXPECT_MSG_EQ(psduIt->header.IsBlockAck(), true, "Expected Block Ack after data frame");
367 NS_TEST_EXPECT_MSG_EQ(+psduIt->bss, 1, "Expected a transmission in BSS 1");
368 psduIt++;
369
370 // after some time, we have another A-MPDU transmitted in BSS 1
371 NS_TEST_EXPECT_MSG_EQ(psduIt->header.IsQosData(), true, "Expected a QoS data frame");
372 NS_TEST_EXPECT_MSG_EQ(+psduIt->bss, 1, "Expected a transmission in BSS 1");
373 NS_TEST_EXPECT_MSG_EQ(psduIt->nMpdus,
374 +m_txPkts,
375 "Expected an A-MPDU of " << +m_txPkts << " MPDUs");
377 psduIt->txVector.GetChannelWidth(),
378 StaticCast<WifiNetDevice>(m_apDevices.Get(1))->GetPhy()->GetChannelWidth(),
379 "Expected a transmission on the whole channel width");
380 psduIt++;
381
382 // we expect that the AP of BSS 0 starts transmitting while the AP of BSS 1 is transmitting
383 NS_TEST_EXPECT_MSG_EQ(psduIt->header.IsQosData(), true, "Expected a QoS data frame");
384 NS_TEST_EXPECT_MSG_EQ(+psduIt->bss, 0, "Expected a transmission in BSS 0");
385 NS_TEST_EXPECT_MSG_EQ(psduIt->nMpdus,
386 +m_txPkts,
387 "Expected an A-MPDU of " << +m_txPkts << " MPDUs");
388 NS_TEST_EXPECT_MSG_EQ(psduIt->txVector.GetChannelWidth(),
390 "Unexpected transmission width");
391 NS_TEST_EXPECT_MSG_LT(psduIt->txStart,
392 std::prev(psduIt)->txStart + std::prev(psduIt)->txDuration,
393 "AP 0 is expected to transmit before the end of transmission of AP 1");
394 psduIt++;
395
396 // receive a Block Ack in BSS 1 and then a Block Ack in BSS 0
397 NS_TEST_EXPECT_MSG_EQ(psduIt->header.IsBlockAck(), true, "Expected Block Ack after data frame");
398 NS_TEST_EXPECT_MSG_EQ(+psduIt->bss, 1, "Expected a transmission in BSS 1");
399 psduIt++;
400
401 NS_TEST_EXPECT_MSG_EQ(psduIt->header.IsBlockAck(), true, "Expected Block Ack after data frame");
402 NS_TEST_EXPECT_MSG_EQ(+psduIt->bss, 0, "Expected a transmission in BSS 0");
403 psduIt++;
404
405 // each application server (on STAs) received 2 packets right after Block Ack
406 // agreement establishment and m_txPkts packets afterwards
408 2 + m_txPkts,
409 "Unexpected number of packets received by STA 0");
411 2 + m_txPkts,
412 "Unexpected number of packets received by STA 1");
413}
414
415/**
416 * @ingroup wifi-test
417 * @ingroup tests
418 *
419 * @brief wifi dynamic bandwidth operation Test Suite
420 */
422{
423 public:
425};
426
428 : TestSuite("wifi-dynamic-bw-op", Type::UNIT)
429{
430 /**
431 * primary20
432 * ┌────────┬────────┐
433 * BSS 0 │ 52 │ 56 │
434 * └────────┴────────┘
435 *
436 * ┌────────┐
437 * BSS 1 │ 52 │
438 * └────────┘
439 */
441 new WifiUseAvailBwTest({"{54, 40, BAND_5GHZ, 1}", "{52, 20, BAND_5GHZ, 0}"}, MHz_u{20}),
442 TestCase::Duration::QUICK);
443 /**
444 * ─── primary 40 ───
445 * primary20
446 * ┌────────┬────────┬────────┬────────┐
447 * BSS 0 │ 52 │ 56 │ 60 │ 64 │
448 * └────────┴────────┴────────┴────────┘
449 *
450 * ┌────────┬────────┐
451 * BSS 1 │ 60 │ 64 │
452 * └────────┴────────┘
453 * primary20
454 */
456 new WifiUseAvailBwTest({"{58, 80, BAND_5GHZ, 0}", "{62, 40, BAND_5GHZ, 1}"}, MHz_u{40}),
457 TestCase::Duration::QUICK);
458 /**
459 * ─────────── primary 80 ───────────
460 * primary20
461 * ┌────────┬────────┬────────┬────────┬───────┬────────┬────────┬────────┐
462 * BSS 0 │ 36 │ 40 │ 44 │ 48 │ 52 │ 56 │ 60 │ 64 │
463 * └────────┴────────┴────────┴────────┴───────┴────────┴────────┴────────┘
464 *
465 * ┌────────┬────────┬────────┬────────┐
466 * BSS 1 │ 36 │ 40 │ 44 │ 48 │
467 * └────────┴────────┴────────┴────────┘
468 * primary20
469 */
471 new WifiUseAvailBwTest({"{50, 160, BAND_5GHZ, 5}", "{42, 80, BAND_5GHZ, 2}"}, MHz_u{80}),
472 TestCase::Duration::QUICK);
473 // clang-format off
474 /**
475 * ───────────────────────────── primary 160 ─────────────────────────────
476 * primary20
477 * ┌────────┬────────┬────────┬────────┬───────┬────────┬────────┬────────┌────────┬────────┬────────┬────────┬───────┬────────┬────────┬────────┐
478 * BSS 0 │ 1 │ 5 │ 9 │ 13 │ 17 │ 21 │ 25 │ 29 │ 33 │ 37 │ 41 │ 45 │ 49 │ 53 │ 57 │ 61 │
479 * └────────┴────────┴────────┴────────┴───────┴────────┴────────┴────────└────────┴────────┴────────┴────────┴───────┴────────┴────────┴────────┘
480 *
481 * ┌────────┬────────┬────────┬────────┬───────┬────────┬────────┬────────┐
482 * BSS 1 │ 1 │ 5 │ 9 │ 13 │ 17 │ 21 │ 25 │ 29 │
483 * └────────┴────────┴────────┴────────┴───────┴────────┴────────┴────────┘
484 * primary20
485 */
486 // clang-format on
488 new WifiUseAvailBwTest({"{31, 320, BAND_6GHZ, 10}", "{15, 160, BAND_6GHZ, 7}"}, 160),
489 TestCase::Duration::QUICK);
490}
491
wifi dynamic bandwidth operation Test Suite
Two BSSes, each with one AP and one non-AP STA, are configured to operate on different channels.
void Transmit(uint8_t bss, WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
Callback invoked when a PHY receives a PSDU to transmit.
std::vector< std::string > m_channelStr
channel setting strings
std::array< uint8_t, 2 > m_rcvPkts
number of packets received by the stations
std::vector< FrameInfo > m_txPsdus
transmitted PSDUs
std::array< PacketSocketAddress, 2 > m_sockets
packet sockets for the two BSSes
void L7Receive(uint8_t bss, Ptr< const Packet > p, const Address &addr)
Function to trace packets received by the server application in the given BSS.
MHz_u m_bss0Width
width of the transmission in BSS 0 started when BSS 1 is transmitting
void DoRun() override
Implementation to actually run this TestCase.
uint8_t m_txPkts
TX packets per BSS (in addition to the two required to establish BA agreement)
void CheckResults()
Check correctness of transmitted frames.
NetDeviceContainer m_apDevices
container for AP's NetDevice
NetDeviceContainer m_staDevices
container for stations' NetDevices
WifiUseAvailBwTest(std::initializer_list< std::string > channelStr, MHz_u bss0Width)
Constructor.
a polymophic address class
Definition address.h:90
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition double.h:31
Helper class used to assign positions and mobility models to nodes.
Keep track of the current position and velocity of an object.
Vector GetPosition() const
holds a vector of ns3::NetDevice pointers
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
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.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
uint32_t AddApplication(Ptr< Application > application)
Associate an Application to this Node.
Definition node.cc:153
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
Definition object.h:511
Give ns3::PacketSocket powers to ns3::Node.
void Install(Ptr< Node > node) const
Aggregate an instance of a ns3::PacketSocketFactory onto the provided node.
Smart pointer class similar to boost::intrusive_ptr.
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:561
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
encapsulates test code
Definition test.h:1050
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Definition test.cc:292
A suite of tests to run.
Definition test.h:1267
Type
Type of test.
Definition test.h:1274
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
AttributeValue implementation for Time.
Definition nstime.h:1432
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 ...
Implements the IEEE 802.11 MAC header.
create MAC layers for a ns3::WifiNetDevice.
void SetType(std::string type, Args &&... args)
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
Definition wifi-phy.cc:1563
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
Definition config.cc:946
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition log.h:264
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition object.h:619
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
Definition test.h:134
#define NS_TEST_EXPECT_MSG_LT(actual, limit, msg)
Test that an actual value is less than a limit and report if not.
Definition test.h:780
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Definition test.h:241
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition nstime.h:1369
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1345
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition nstime.h:1357
@ WIFI_STANDARD_80211be
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:684
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
Definition ptr.h:580
Ptr< T1 > StaticCast(const Ptr< T2 > &p)
Cast a Ptr.
Definition ptr.h:587
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
Definition wifi-ppdu.h:38
Information about transmitted frames.
uint8_t bss
BSS the frame belongs to.
std::size_t nMpdus
number of MPDUs in the PSDU
WifiTxVector txVector
TX vector used to transmit the frame.
WifiMacHeader header
Frame MAC header.
static WifiDynamicBwOpTestSuite g_wifiDynamicBwOpTestSuite
the test suite