A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wifi-error-rate-models-test.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016 University of Washington
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Authors: Tom Henderson (tomhend@u.washington.edu)
7 * Sébastien Deronne (sebastien.deronne@gmail.com)
8 */
9
10#ifdef HAVE_GSL
11#include <gsl/gsl_cdf.h>
12#include <gsl/gsl_integration.h>
13#include <gsl/gsl_math.h>
14#include <gsl/gsl_sf_bessel.h>
15#endif
16
17#include "ns3/dsss-error-rate-model.h"
18#include "ns3/he-phy.h" //includes HT and VHT
19#include "ns3/interference-helper.h"
20#include "ns3/log.h"
21#include "ns3/nist-error-rate-model.h"
22#include "ns3/table-based-error-rate-model.h"
23#include "ns3/test.h"
24#include "ns3/wifi-phy.h"
25#include "ns3/wifi-utils.h"
26#include "ns3/yans-error-rate-model.h"
27
28using namespace ns3;
29
30NS_LOG_COMPONENT_DEFINE("WifiErrorRateModelsTest");
31
32static double
34{
35 // SINR is based on receiver noise figure of 7 dB and thermal noise
36 // of -100.5522786 dBm in this 22 MHz bandwidth at 290K
37 dBm_u noisePower{-100.5522786 + 7};
38 dB_u sinr{rss - noisePower};
39 // return SINR expressed as ratio
40 return DbToRatio(sinr);
41}
42
43/**
44 * @ingroup wifi-test
45 * @ingroup tests
46 *
47 * @brief Wifi Error Rate Models Test Case Dsss
48 */
50{
51 public:
54
55 private:
56 void DoRun() override;
57};
58
60 : TestCase("WifiErrorRateModel test case DSSS")
61{
62}
63
67
68void
70{
71 // 1024 bytes plus headers
72 uint64_t size = (1024 + 40 + 14) * 8;
73 // Spot test some values returned from DsssErrorRateModel
74 // Values taken from sample 80211b.c program used in validation paper
75 double value;
76 // DBPSK
78 NS_TEST_ASSERT_MSG_EQ_TOL(value, 0, 1e-13, "Not equal within tolerance");
80 NS_TEST_ASSERT_MSG_EQ_TOL(value, 1.5e-13, 1e-13, "Not equal within tolerance");
82 NS_TEST_ASSERT_MSG_EQ_TOL(value, 0.0003, 0.0001, "Not equal within tolerance");
84 NS_TEST_ASSERT_MSG_EQ_TOL(value, 0.202, 0.005, "Not equal within tolerance");
86 NS_TEST_ASSERT_MSG_EQ_TOL(value, 0.813, 0.005, "Not equal within tolerance");
88 NS_TEST_ASSERT_MSG_EQ_TOL(value, 0.984, 0.005, "Not equal within tolerance");
90 NS_TEST_ASSERT_MSG_EQ_TOL(value, 0.999, 0.001, "Not equal within tolerance");
92 NS_TEST_ASSERT_MSG_EQ_TOL(value, 1, 0.001, "Not equal within tolerance");
93
94 // DQPSK
95 //
97 NS_TEST_ASSERT_MSG_EQ_TOL(value, 0, 1e-13, "Not equal within tolerance");
99 NS_TEST_ASSERT_MSG_EQ_TOL(value, 4.5e-6, 1e-6, "Not equal within tolerance");
101 NS_TEST_ASSERT_MSG_EQ_TOL(value, 0.036, 0.005, "Not equal within tolerance");
103 NS_TEST_ASSERT_MSG_EQ_TOL(value, 0.519, 0.005, "Not equal within tolerance");
105 NS_TEST_ASSERT_MSG_EQ_TOL(value, 0.915, 0.005, "Not equal within tolerance");
107 NS_TEST_ASSERT_MSG_EQ_TOL(value, 0.993, 0.005, "Not equal within tolerance");
109 NS_TEST_ASSERT_MSG_EQ_TOL(value, 0.999, 0.001, "Not equal within tolerance");
111 NS_TEST_ASSERT_MSG_EQ_TOL(value, 1, 0.001, "Not equal within tolerance");
112
113#ifdef HAVE_GSL
114 // DQPSK_CCK5.5
116 NS_TEST_ASSERT_MSG_EQ_TOL(value, 0, 1e-13, "Not equal within tolerance");
118 NS_TEST_ASSERT_MSG_EQ_TOL(value, 6.6e-14, 5e-14, "Not equal within tolerance");
120 NS_TEST_ASSERT_MSG_EQ_TOL(value, 0.0001, 0.00005, "Not equal within tolerance");
122 NS_TEST_ASSERT_MSG_EQ_TOL(value, 0.132, 0.005, "Not equal within tolerance");
124 NS_TEST_ASSERT_MSG_EQ_TOL(value, 0.744, 0.005, "Not equal within tolerance");
126 NS_TEST_ASSERT_MSG_EQ_TOL(value, 0.974, 0.005, "Not equal within tolerance");
128 NS_TEST_ASSERT_MSG_EQ_TOL(value, 0.999, 0.001, "Not equal within tolerance");
130 NS_TEST_ASSERT_MSG_EQ_TOL(value, 1, 0.001, "Not equal within tolerance");
131
132 // DQPSK_CCK11
134 NS_TEST_ASSERT_MSG_EQ_TOL(value, 0, 1e-14, "Not equal within tolerance");
136 NS_TEST_ASSERT_MSG_EQ_TOL(value, 4.7e-14, 1e-14, "Not equal within tolerance");
138 NS_TEST_ASSERT_MSG_EQ_TOL(value, 8.85e-5, 1e-5, "Not equal within tolerance");
140 NS_TEST_ASSERT_MSG_EQ_TOL(value, 0.128, 0.005, "Not equal within tolerance");
142 NS_TEST_ASSERT_MSG_EQ_TOL(value, 0.739, 0.005, "Not equal within tolerance");
144 NS_TEST_ASSERT_MSG_EQ_TOL(value, 0.973, 0.005, "Not equal within tolerance");
146 NS_TEST_ASSERT_MSG_EQ_TOL(value, 0.999, 0.001, "Not equal within tolerance");
148 NS_TEST_ASSERT_MSG_EQ_TOL(value, 1, 0.001, "Not equal within tolerance");
149#endif
150}
151
152/**
153 * @ingroup wifi-test
154 * @ingroup tests
155 *
156 * @brief Wifi Error Rate Models Test Case Nist
157 */
159{
160 public:
163
164 private:
165 void DoRun() override;
166};
167
169 : TestCase("WifiErrorRateModel test case NIST")
170{
171}
172
176
177void
179{
180 uint32_t frameSize = 2000;
181 WifiTxVector txVector;
183
184 // Spot test some values returned from NistErrorRateModel
185 // values can be generated by the example program ofdm-validation.cc
186 dB_u snr{2.5};
187 auto ps = nist->GetChunkSuccessRate(WifiMode("OfdmRate6Mbps"),
188 txVector,
189 DbToRatio(snr),
190 frameSize * 8);
191 NS_TEST_ASSERT_MSG_EQ_TOL(ps, 2.04e-10, 1e-10, "Not equal within tolerance");
192 snr = dB_u{3.0};
193 ps = nist->GetChunkSuccessRate(WifiMode("OfdmRate6Mbps"),
194 txVector,
195 DbToRatio(snr),
196 frameSize * 8);
197 NS_TEST_ASSERT_MSG_EQ_TOL(ps, 0.020, 0.001, "Not equal within tolerance");
198 snr = dB_u{4.0};
199 ps = nist->GetChunkSuccessRate(WifiMode("OfdmRate6Mbps"),
200 txVector,
201 DbToRatio(snr),
202 frameSize * 8);
203 NS_TEST_ASSERT_MSG_EQ_TOL(ps, 0.885, 0.001, "Not equal within tolerance");
204 snr = dB_u{5.0};
205 ps = nist->GetChunkSuccessRate(WifiMode("OfdmRate6Mbps"),
206 txVector,
207 DbToRatio(snr),
208 frameSize * 8);
209 NS_TEST_ASSERT_MSG_EQ_TOL(ps, 0.997, 0.001, "Not equal within tolerance");
210
211 snr = dB_u{6.0};
212 ps = nist->GetChunkSuccessRate(WifiMode("OfdmRate9Mbps"),
213 txVector,
214 DbToRatio(snr),
215 frameSize * 8);
216 NS_TEST_ASSERT_MSG_EQ_TOL(ps, 0.097, 0.001, "Not equal within tolerance");
217 snr = dB_u{7.0};
218 ps = nist->GetChunkSuccessRate(WifiMode("OfdmRate9Mbps"),
219 txVector,
220 DbToRatio(snr),
221 frameSize * 8);
222 NS_TEST_ASSERT_MSG_EQ_TOL(ps, 0.918, 0.001, "Not equal within tolerance");
223 snr = dB_u{8.0};
224 ps = nist->GetChunkSuccessRate(WifiMode("OfdmRate9Mbps"),
225 txVector,
226 DbToRatio(snr),
227 frameSize * 8);
228 NS_TEST_ASSERT_MSG_EQ_TOL(ps, 0.998, 0.001, "Not equal within tolerance");
229 snr = dB_u{9.0};
230 ps = nist->GetChunkSuccessRate(WifiMode("OfdmRate9Mbps"),
231 txVector,
232 DbToRatio(snr),
233 frameSize * 8);
234 NS_TEST_ASSERT_MSG_EQ_TOL(ps, 0.999, 0.001, "Not equal within tolerance");
235
236 snr = dB_u{6.0};
237 ps = nist->GetChunkSuccessRate(WifiMode("OfdmRate12Mbps"),
238 txVector,
239 DbToRatio(snr),
240 frameSize * 8);
241 NS_TEST_ASSERT_MSG_EQ_TOL(ps, 0.0174, 0.001, "Not equal within tolerance");
242 snr = dB_u{7.0};
243 ps = nist->GetChunkSuccessRate(WifiMode("OfdmRate12Mbps"),
244 txVector,
245 DbToRatio(snr),
246 frameSize * 8);
247 NS_TEST_ASSERT_MSG_EQ_TOL(ps, 0.881, 0.001, "Not equal within tolerance");
248 snr = dB_u{8.0};
249 ps = nist->GetChunkSuccessRate(WifiMode("OfdmRate12Mbps"),
250 txVector,
251 DbToRatio(snr),
252 frameSize * 8);
253 NS_TEST_ASSERT_MSG_EQ_TOL(ps, 0.997, 0.001, "Not equal within tolerance");
254 snr = dB_u{9.0};
255 ps = nist->GetChunkSuccessRate(WifiMode("OfdmRate12Mbps"),
256 txVector,
257 DbToRatio(snr),
258 frameSize * 8);
259 NS_TEST_ASSERT_MSG_EQ_TOL(ps, 0.999, 0.001, "Not equal within tolerance");
260
261 snr = dB_u{8.5};
262 ps = nist->GetChunkSuccessRate(WifiMode("OfdmRate18Mbps"),
263 txVector,
264 DbToRatio(snr),
265 frameSize * 8);
266 NS_TEST_ASSERT_MSG_EQ_TOL(ps, 2.85e-6, 1e-6, "Not equal within tolerance");
267 snr = dB_u{9.5};
268 ps = nist->GetChunkSuccessRate(WifiMode("OfdmRate18Mbps"),
269 txVector,
270 DbToRatio(snr),
271 frameSize * 8);
272 NS_TEST_ASSERT_MSG_EQ_TOL(ps, 0.623, 0.001, "Not equal within tolerance");
273 snr = dB_u{10.5};
274 ps = nist->GetChunkSuccessRate(WifiMode("OfdmRate18Mbps"),
275 txVector,
276 DbToRatio(snr),
277 frameSize * 8);
278 NS_TEST_ASSERT_MSG_EQ_TOL(ps, 0.985, 0.001, "Not equal within tolerance");
279 snr = dB_u{11.5};
280 ps = nist->GetChunkSuccessRate(WifiMode("OfdmRate18Mbps"),
281 txVector,
282 DbToRatio(snr),
283 frameSize * 8);
284 NS_TEST_ASSERT_MSG_EQ_TOL(ps, 0.999, 0.001, "Not equal within tolerance");
285
286 snr = dB_u{12.0};
287 ps = nist->GetChunkSuccessRate(WifiMode("OfdmRate24Mbps"),
288 txVector,
289 DbToRatio(snr),
290 frameSize * 8);
291 NS_TEST_ASSERT_MSG_EQ_TOL(ps, 2.22e-7, 1e-7, "Not equal within tolerance");
292 snr = dB_u{13.0};
293 ps = nist->GetChunkSuccessRate(WifiMode("OfdmRate24Mbps"),
294 txVector,
295 DbToRatio(snr),
296 frameSize * 8);
297 NS_TEST_ASSERT_MSG_EQ_TOL(ps, 0.495, 0.001, "Not equal within tolerance");
298 snr = dB_u{14.0};
299 ps = nist->GetChunkSuccessRate(WifiMode("OfdmRate24Mbps"),
300 txVector,
301 DbToRatio(snr),
302 frameSize * 8);
303 NS_TEST_ASSERT_MSG_EQ_TOL(ps, 0.974, 0.001, "Not equal within tolerance");
304 snr = dB_u{15.0};
305 ps = nist->GetChunkSuccessRate(WifiMode("OfdmRate24Mbps"),
306 txVector,
307 DbToRatio(snr),
308 frameSize * 8);
309 NS_TEST_ASSERT_MSG_EQ_TOL(ps, 0.999, 0.001, "Not equal within tolerance");
310
311 snr = dB_u{15.5};
312 ps = nist->GetChunkSuccessRate(WifiMode("OfdmRate36Mbps"),
313 txVector,
314 DbToRatio(snr),
315 frameSize * 8);
316 NS_TEST_ASSERT_MSG_EQ_TOL(ps, 0.012, 0.001, "Not equal within tolerance");
317 snr = dB_u{16.5};
318 ps = nist->GetChunkSuccessRate(WifiMode("OfdmRate36Mbps"),
319 txVector,
320 DbToRatio(snr),
321 frameSize * 8);
322 NS_TEST_ASSERT_MSG_EQ_TOL(ps, 0.818, 0.001, "Not equal within tolerance");
323 snr = dB_u{17.5};
324 ps = nist->GetChunkSuccessRate(WifiMode("OfdmRate36Mbps"),
325 txVector,
326 DbToRatio(snr),
327 frameSize * 8);
328 NS_TEST_ASSERT_MSG_EQ_TOL(ps, 0.993, 0.001, "Not equal within tolerance");
329 snr = dB_u{18.5};
330 ps = nist->GetChunkSuccessRate(WifiMode("OfdmRate36Mbps"),
331 txVector,
332 DbToRatio(snr),
333 frameSize * 8);
334 NS_TEST_ASSERT_MSG_EQ_TOL(ps, 0.999, 0.001, "Not equal within tolerance");
335
336 snr = dB_u{20.0};
337 ps = nist->GetChunkSuccessRate(WifiMode("OfdmRate48Mbps"),
338 txVector,
339 DbToRatio(snr),
340 frameSize * 8);
341 NS_TEST_ASSERT_MSG_EQ_TOL(ps, 1.3e-4, 1e-4, "Not equal within tolerance");
342 snr = dB_u{21.0};
343 ps = nist->GetChunkSuccessRate(WifiMode("OfdmRate48Mbps"),
344 txVector,
345 DbToRatio(snr),
346 frameSize * 8);
347 NS_TEST_ASSERT_MSG_EQ_TOL(ps, 0.649, 0.001, "Not equal within tolerance");
348 snr = dB_u{22.0};
349 ps = nist->GetChunkSuccessRate(WifiMode("OfdmRate48Mbps"),
350 txVector,
351 DbToRatio(snr),
352 frameSize * 8);
353 NS_TEST_ASSERT_MSG_EQ_TOL(ps, 0.983, 0.001, "Not equal within tolerance");
354 snr = dB_u{23.0};
355 ps = nist->GetChunkSuccessRate(WifiMode("OfdmRate48Mbps"),
356 txVector,
357 DbToRatio(snr),
358 frameSize * 8);
359 NS_TEST_ASSERT_MSG_EQ_TOL(ps, 0.999, 0.001, "Not equal within tolerance");
360
361 snr = dB_u{21.0};
362 ps = nist->GetChunkSuccessRate(WifiMode("OfdmRate54Mbps"),
363 txVector,
364 DbToRatio(snr),
365 frameSize * 8);
366 NS_TEST_ASSERT_MSG_EQ_TOL(ps, 5.44e-8, 1e-8, "Not equal within tolerance");
367 snr = dB_u{22.0};
368 ps = nist->GetChunkSuccessRate(WifiMode("OfdmRate54Mbps"),
369 txVector,
370 DbToRatio(snr),
371 frameSize * 8);
372 NS_TEST_ASSERT_MSG_EQ_TOL(ps, 0.410, 0.001, "Not equal within tolerance");
373 snr = dB_u{23.0};
374 ps = nist->GetChunkSuccessRate(WifiMode("OfdmRate54Mbps"),
375 txVector,
376 DbToRatio(snr),
377 frameSize * 8);
378 NS_TEST_ASSERT_MSG_EQ_TOL(ps, 0.958, 0.001, "Not equal within tolerance");
379 snr = dB_u{24.0};
380 ps = nist->GetChunkSuccessRate(WifiMode("OfdmRate54Mbps"),
381 txVector,
382 DbToRatio(snr),
383 frameSize * 8);
384 NS_TEST_ASSERT_MSG_EQ_TOL(ps, 0.999, 0.001, "Not equal within tolerance");
385}
386
393
394/**
395 * @ingroup wifi-test
396 * @ingroup tests
397 *
398 * @brief Wifi Error Rate Models Test Case MIMO
399 */
401{
402 public:
405
406 private:
407 void DoRun() override;
408};
409
411 : TestCase("WifiErrorRateModel test case MIMO")
412{
413}
414
418
419void
421{
422 TestInterferenceHelper interference;
423 interference.SetNoiseFigure(0);
424 WifiMode mode = HtPhy::GetHtMcs0();
425 WifiTxVector txVector;
426
427 txVector.SetMode(mode);
429 txVector.SetChannelWidth(MHz_u{20});
430 txVector.SetNss(1);
431 txVector.SetNTx(1);
432
433 interference.SetNumberOfReceiveAntennas(1);
435 interference.SetErrorRateModel(nist);
436
437 // SISO: initial SNR set to 4dB
438 dB_u initialSnr{4.0};
439 dB_u tol{0.1};
440 auto snr = interference.CalculateSnr(Watt_u{0.001},
441 Watt_u{0.001} / DbToRatio(initialSnr),
442 txVector.GetChannelWidth(),
443 txVector.GetNss());
445 initialSnr,
446 tol,
447 "Attempt to set initial SNR to known value failed");
448 Time duration = MilliSeconds(2);
449 auto chunkSuccess = interference.CalculatePayloadChunkSuccessRate(snr, duration, txVector);
450 NS_TEST_ASSERT_MSG_EQ_TOL(chunkSuccess,
451 0.905685,
452 0.000001,
453 "CSR not within tolerance for SISO");
454 auto sisoChunkSuccess = chunkSuccess;
455
456 // MIMO 2x1:2: expect no SNR gain in AWGN channel
457 txVector.SetNss(2);
458 txVector.SetNTx(2);
459 snr = interference.CalculateSnr(Watt_u{0.001},
460 Watt_u{0.001} / DbToRatio(initialSnr),
461 txVector.GetChannelWidth(),
462 txVector.GetNss());
464 initialSnr,
465 tol,
466 "SNR not within tolerance for 2x1:2 MIMO");
467 chunkSuccess = interference.CalculatePayloadChunkSuccessRate(snr, duration, txVector);
468 NS_TEST_ASSERT_MSG_EQ_TOL(chunkSuccess,
469 0.905685,
470 0.000001,
471 "CSR not within tolerance for SISO");
472
473 // MIMO 1x2:1: expect that SNR is increased by a factor of 3 dB (10 log 2/1) compared to SISO
474 // thanks to RX diversity
475 txVector.SetNss(1);
476 txVector.SetNTx(1);
477 interference.SetNumberOfReceiveAntennas(2);
478 snr = interference.CalculateSnr(Watt_u{0.001},
479 Watt_u{0.001} / DbToRatio(initialSnr),
480 txVector.GetChannelWidth(),
481 txVector.GetNss());
483 initialSnr + dB_u{3.0},
484 tol,
485 "SNR not within tolerance for 1x2:1 MIMO");
486 chunkSuccess = interference.CalculatePayloadChunkSuccessRate(snr, duration, txVector);
487 NS_TEST_ASSERT_MSG_GT(chunkSuccess,
488 sisoChunkSuccess,
489 "CSR not within tolerance for 1x2:1 MIMO");
490
491 // MIMO 2x2:1: expect that SNR is increased by a factor of 3 dB (10 log 2/1) compared to SISO
492 // thanks to RX diversity
493 txVector.SetNss(1);
494 txVector.SetNTx(2);
495 interference.SetNumberOfReceiveAntennas(2);
496 snr = interference.CalculateSnr(Watt_u{0.001},
497 Watt_u{0.001} / DbToRatio(initialSnr),
498 txVector.GetChannelWidth(),
499 txVector.GetNss());
501 initialSnr + dB_u{3.0},
502 tol,
503 "SNR not equal within tolerance for 2x2:1 MIMO");
504 chunkSuccess = interference.CalculatePayloadChunkSuccessRate(snr, duration, txVector);
505 NS_TEST_ASSERT_MSG_GT(chunkSuccess,
506 sisoChunkSuccess,
507 "CSR not within tolerance for 2x2:1 MIMO");
508
509 // MIMO 2x2:2: expect no SNR gain in AWGN channel
510 txVector.SetNss(2);
511 txVector.SetNTx(2);
512 interference.SetNumberOfReceiveAntennas(2);
513 snr = interference.CalculateSnr(Watt_u{0.001},
514 Watt_u{0.001} / DbToRatio(initialSnr),
515 txVector.GetChannelWidth(),
516 txVector.GetNss());
518 initialSnr,
519 tol,
520 "SNR not equal within tolerance for 2x2:2 MIMO");
521 chunkSuccess = interference.CalculatePayloadChunkSuccessRate(snr, duration, txVector);
522 NS_TEST_ASSERT_MSG_EQ_TOL(chunkSuccess,
523 sisoChunkSuccess,
524 0.000001,
525 "CSR not within tolerance for 2x2:2 MIMO");
526
527 // MIMO 3x3:1: expect that SNR is increased by a factor of 4.8 dB (10 log 3/1) compared to SISO
528 // thanks to RX diversity
529 txVector.SetNss(1);
530 txVector.SetNTx(3);
531 interference.SetNumberOfReceiveAntennas(3);
532 snr = interference.CalculateSnr(Watt_u{0.001},
533 Watt_u{0.001} / DbToRatio(initialSnr),
534 txVector.GetChannelWidth(),
535 txVector.GetNss());
537 initialSnr + dB_u{4.8},
538 tol,
539 "SNR not within tolerance for 3x3:1 MIMO");
540 chunkSuccess = interference.CalculatePayloadChunkSuccessRate(snr, duration, txVector);
541 NS_TEST_ASSERT_MSG_GT(chunkSuccess,
542 sisoChunkSuccess,
543 "CSR not within tolerance for 3x3:1 MIMO");
544
545 // MIMO 3x3:2: expect that SNR is increased by a factor of 1.8 dB (10 log 3/2) compared to SISO
546 // thanks to RX diversity
547 txVector.SetNss(2);
548 txVector.SetNTx(3);
549 interference.SetNumberOfReceiveAntennas(3);
550 snr = interference.CalculateSnr(Watt_u{0.001},
551 Watt_u{0.001} / DbToRatio(initialSnr),
552 txVector.GetChannelWidth(),
553 txVector.GetNss());
555 initialSnr + dB_u{1.8},
556 tol,
557 "SNR not within tolerance for 3x3:2 MIMO");
558 chunkSuccess = interference.CalculatePayloadChunkSuccessRate(snr, duration, txVector);
559 NS_TEST_ASSERT_MSG_GT(chunkSuccess,
560 sisoChunkSuccess,
561 "CSR not within tolerance for 3x3:2 MIMO");
562
563 // MIMO 3x3:3: expect no SNR gain in AWGN channel
564 txVector.SetNss(3);
565 txVector.SetNTx(3);
566 interference.SetNumberOfReceiveAntennas(3);
567 snr = interference.CalculateSnr(Watt_u{0.001},
568 Watt_u{0.001} / DbToRatio(initialSnr),
569 txVector.GetChannelWidth(),
570 txVector.GetNss());
572 initialSnr,
573 tol,
574 "SNR not within tolerance for 3x3:3 MIMO");
575 chunkSuccess = interference.CalculatePayloadChunkSuccessRate(snr, duration, txVector);
576 NS_TEST_ASSERT_MSG_EQ_TOL(chunkSuccess,
577 sisoChunkSuccess,
578 0.000001,
579 "CSR not equal within tolerance for 3x3:3 MIMO");
580
581 // MIMO 4x4:1: expect that SNR is increased by a factor of 6 dB (10 log 4/1) compared to SISO
582 // thanks to RX diversity
583 txVector.SetNss(1);
584 txVector.SetNTx(4);
585 interference.SetNumberOfReceiveAntennas(4);
586 snr = interference.CalculateSnr(Watt_u{0.001},
587 Watt_u{0.001} / DbToRatio(initialSnr),
588 txVector.GetChannelWidth(),
589 txVector.GetNss());
591 initialSnr + dB_u{6.0},
592 tol,
593 "SNR not within tolerance for 4x4:1 MIMO");
594 chunkSuccess = interference.CalculatePayloadChunkSuccessRate(snr, duration, txVector);
595 NS_TEST_ASSERT_MSG_GT(chunkSuccess,
596 sisoChunkSuccess,
597 "CSR not within tolerance for 4x4:1 MIMO");
598
599 // MIMO 4x4:2: expect that SNR is increased by a factor of 3 dB (10 log 4/2) compared to SISO
600 // thanks to RX diversity
601 txVector.SetNss(2);
602 txVector.SetNTx(4);
603 interference.SetNumberOfReceiveAntennas(4);
604 snr = interference.CalculateSnr(Watt_u{0.001},
605 Watt_u{0.001} / DbToRatio(initialSnr),
606 txVector.GetChannelWidth(),
607 txVector.GetNss());
609 initialSnr + dB_u{3.0},
610 tol,
611 "SNR not within tolerance for 4x4:2 MIMO");
612 chunkSuccess = interference.CalculatePayloadChunkSuccessRate(snr, duration, txVector);
613 NS_TEST_ASSERT_MSG_GT(chunkSuccess,
614 sisoChunkSuccess,
615 "CSR not within tolerance for 4x4:2 MIMO");
616
617 // MIMO 4x4:3: expect that SNR is increased by a factor of 1.2 dB (10 log 4/3) compared to SISO
618 // thanks to RX diversity
619 txVector.SetNss(3);
620 txVector.SetNTx(4);
621 interference.SetNumberOfReceiveAntennas(4);
622 snr = interference.CalculateSnr(Watt_u{0.001},
623 Watt_u{0.001} / DbToRatio(initialSnr),
624 txVector.GetChannelWidth(),
625 txVector.GetNss());
627 initialSnr + dB_u{1.2},
628 tol,
629 "SNR not within tolerance for 4x4:3 MIMO");
630 chunkSuccess = interference.CalculatePayloadChunkSuccessRate(snr, duration, txVector);
631 NS_TEST_ASSERT_MSG_GT(chunkSuccess,
632 sisoChunkSuccess,
633 "CSR not within tolerance for 4x4:1 MIMO");
634
635 // MIMO 4x4:4: expect no SNR gain in AWGN channel
636 txVector.SetNss(4);
637 txVector.SetNTx(4);
638 interference.SetNumberOfReceiveAntennas(4);
639 snr = interference.CalculateSnr(Watt_u{0.001},
640 Watt_u{0.001} / DbToRatio(initialSnr),
641 txVector.GetChannelWidth(),
642 txVector.GetNss());
644 initialSnr,
645 tol,
646 "SNR not within tolerance for 4x4:4 MIMO");
647 chunkSuccess = interference.CalculatePayloadChunkSuccessRate(snr, duration, txVector);
648 NS_TEST_ASSERT_MSG_EQ_TOL(chunkSuccess,
649 sisoChunkSuccess,
650 0.000001,
651 "CSR not within tolerance for 4x4:4 MIMO");
652}
653
654/**
655 * map of PER values that have been manually computed for a given MCS, size (in bytes) and SNR (in
656 * dB) in order to verify against the PER calculated by the model
657 */
658const std::map<std::pair<uint8_t /* mcs */, uint32_t /* size */>,
659 std::map<dB_u /* snr */, double /* per */>>
661 /* MCS 0 - 1458 bytes */
662 {std::make_pair(0, 1458),
663 {
664 {dB_u{-4.00}, 1.00000}, {dB_u{-3.75}, 1.00000}, {dB_u{-3.50}, 1.00000},
665 {dB_u{-3.25}, 1.00000}, {dB_u{-3.00}, 1.00000}, {dB_u{-2.75}, 1.00000},
666 {dB_u{-2.50}, 1.00000}, {dB_u{-2.25}, 1.00000}, {dB_u{-2.00}, 1.00000},
667 {dB_u{-1.75}, 1.00000}, {dB_u{-1.50}, 1.00000}, {dB_u{-1.25}, 1.00000},
668 {dB_u{-1.00}, 1.00000}, {dB_u{-0.75}, 0.99700}, {dB_u{-0.50}, 0.99400},
669 {dB_u{-0.25}, 0.90625}, {dB_u{0.00}, 0.81850}, {dB_u{0.25}, 0.55465},
670 {dB_u{0.50}, 0.29080}, {dB_u{0.75}, 0.17855}, {dB_u{1.00}, 0.06630},
671 {dB_u{1.25}, 0.03875}, {dB_u{1.50}, 0.01120}, {dB_u{1.75}, 0.00635},
672 {dB_u{2.00}, 0.00150}, {dB_u{2.25}, 0.00083}, {dB_u{2.50}, 0.00015},
673 {dB_u{2.75}, 0.00008}, {dB_u{3.00}, 0.00001}, {dB_u{3.25}, 0.00000},
674 {dB_u{3.50}, 0.00000}, {dB_u{3.75}, 0.00000}, {dB_u{4.00}, 0.00000},
675 {dB_u{4.25}, 0.00000}, {dB_u{4.50}, 0.00000}, {dB_u{4.75}, 0.00000},
676 {dB_u{5.00}, 0.00000}, {dB_u{5.25}, 0.00000}, {dB_u{5.50}, 0.00000},
677 {dB_u{5.75}, 0.00000}, {dB_u{6.00}, 0.00000}, {dB_u{6.25}, 0.00000},
678 {dB_u{6.50}, 0.00000}, {dB_u{6.75}, 0.00000}, {dB_u{7.00}, 0.00000},
679 {dB_u{7.25}, 0.00000}, {dB_u{7.50}, 0.00000}, {dB_u{7.75}, 0.00000},
680 {dB_u{8.00}, 0.00000}, {dB_u{8.25}, 0.00000}, {dB_u{8.50}, 0.00000},
681 {dB_u{8.75}, 0.00000}, {dB_u{9.00}, 0.00000}, {dB_u{9.25}, 0.00000},
682 {dB_u{9.50}, 0.00000}, {dB_u{9.75}, 0.00000}, {dB_u{10.00}, 0.00000},
683 {dB_u{10.25}, 0.00000}, {dB_u{10.50}, 0.00000}, {dB_u{10.75}, 0.00000},
684 {dB_u{11.00}, 0.00000}, {dB_u{11.25}, 0.00000}, {dB_u{11.50}, 0.00000},
685 {dB_u{11.75}, 0.00000}, {dB_u{12.00}, 0.00000}, {dB_u{12.25}, 0.00000},
686 {dB_u{12.50}, 0.00000}, {dB_u{12.75}, 0.00000}, {dB_u{13.00}, 0.00000},
687 {dB_u{13.25}, 0.00000}, {dB_u{13.50}, 0.00000}, {dB_u{13.75}, 0.00000},
688 {dB_u{14.00}, 0.00000}, {dB_u{14.25}, 0.00000}, {dB_u{14.50}, 0.00000},
689 {dB_u{14.75}, 0.00000}, {dB_u{15.00}, 0.00000}, {dB_u{15.25}, 0.00000},
690 {dB_u{15.50}, 0.00000}, {dB_u{15.75}, 0.00000}, {dB_u{16.00}, 0.00000},
691 {dB_u{16.25}, 0.00000}, {dB_u{16.50}, 0.00000}, {dB_u{16.75}, 0.00000},
692 {dB_u{17.00}, 0.00000}, {dB_u{17.25}, 0.00000}, {dB_u{17.50}, 0.00000},
693 {dB_u{17.75}, 0.00000}, {dB_u{18.00}, 0.00000}, {dB_u{18.25}, 0.00000},
694 {dB_u{18.50}, 0.00000}, {dB_u{18.75}, 0.00000}, {dB_u{19.00}, 0.00000},
695 {dB_u{19.25}, 0.00000}, {dB_u{19.50}, 0.00000}, {dB_u{19.75}, 0.00000},
696 {dB_u{20.00}, 0.00000}, {dB_u{20.25}, 0.00000}, {dB_u{20.50}, 0.00000},
697 {dB_u{20.75}, 0.00000}, {dB_u{21.00}, 0.00000}, {dB_u{21.25}, 0.00000},
698 {dB_u{21.50}, 0.00000}, {dB_u{21.75}, 0.00000}, {dB_u{22.00}, 0.00000},
699 {dB_u{22.25}, 0.00000}, {dB_u{22.50}, 0.00000}, {dB_u{22.75}, 0.00000},
700 {dB_u{23.00}, 0.00000}, {dB_u{23.25}, 0.00000}, {dB_u{23.50}, 0.00000},
701 {dB_u{23.75}, 0.00000}, {dB_u{24.00}, 0.00000}, {dB_u{24.25}, 0.00000},
702 {dB_u{24.50}, 0.00000}, {dB_u{24.75}, 0.00000}, {dB_u{25.00}, 0.00000},
703 {dB_u{25.25}, 0.00000}, {dB_u{25.50}, 0.00000}, {dB_u{25.75}, 0.00000},
704 {dB_u{26.00}, 0.00000}, {dB_u{26.25}, 0.00000}, {dB_u{26.50}, 0.00000},
705 {dB_u{26.75}, 0.00000}, {dB_u{27.00}, 0.00000}, {dB_u{27.25}, 0.00000},
706 {dB_u{27.50}, 0.00000}, {dB_u{27.75}, 0.00000}, {dB_u{28.00}, 0.00000},
707 {dB_u{28.25}, 0.00000}, {dB_u{28.50}, 0.00000}, {dB_u{28.75}, 0.00000},
708 {dB_u{29.00}, 0.00000}, {dB_u{29.25}, 0.00000}, {dB_u{29.50}, 0.00000},
709 {dB_u{29.75}, 0.00000}, {dB_u{30.00}, 0.00000},
710 }},
711 /* MCS 0 - 32 bytes */
712 {std::make_pair(0, 32),
713 {
714 {dB_u{-4.00}, 1.00000}, {dB_u{-3.75}, 1.00000}, {dB_u{-3.50}, 1.00000},
715 {dB_u{-3.25}, 0.99750}, {dB_u{-3.00}, 0.99500}, {dB_u{-2.75}, 0.96790},
716 {dB_u{-2.50}, 0.94080}, {dB_u{-2.25}, 0.88335}, {dB_u{-2.00}, 0.82590},
717 {dB_u{-1.75}, 0.70770}, {dB_u{-1.50}, 0.58950}, {dB_u{-1.25}, 0.44890},
718 {dB_u{-1.00}, 0.30830}, {dB_u{-0.75}, 0.21685}, {dB_u{-0.50}, 0.12540},
719 {dB_u{-0.25}, 0.07990}, {dB_u{0.00}, 0.03440}, {dB_u{0.25}, 0.02145},
720 {dB_u{0.50}, 0.00850}, {dB_u{0.75}, 0.00500}, {dB_u{1.00}, 0.00150},
721 {dB_u{1.25}, 0.00087}, {dB_u{1.50}, 0.00024}, {dB_u{1.75}, 0.00017},
722 {dB_u{2.00}, 0.00009}, {dB_u{2.25}, 0.00005}, {dB_u{2.50}, 0.00000},
723 {dB_u{2.75}, 0.00000}, {dB_u{3.00}, 0.00000}, {dB_u{3.25}, 0.00000},
724 {dB_u{3.50}, 0.00000}, {dB_u{3.75}, 0.00000}, {dB_u{4.00}, 0.00000},
725 {dB_u{4.25}, 0.00000}, {dB_u{4.50}, 0.00000}, {dB_u{4.75}, 0.00000},
726 {dB_u{5.00}, 0.00000}, {dB_u{5.25}, 0.00000}, {dB_u{5.50}, 0.00000},
727 {dB_u{5.75}, 0.00000}, {dB_u{6.00}, 0.00000}, {dB_u{6.25}, 0.00000},
728 {dB_u{6.50}, 0.00000}, {dB_u{6.75}, 0.00000}, {dB_u{7.00}, 0.00000},
729 {dB_u{7.25}, 0.00000}, {dB_u{7.50}, 0.00000}, {dB_u{7.75}, 0.00000},
730 {dB_u{8.00}, 0.00000}, {dB_u{8.25}, 0.00000}, {dB_u{8.50}, 0.00000},
731 {dB_u{8.75}, 0.00000}, {dB_u{9.00}, 0.00000}, {dB_u{9.25}, 0.00000},
732 {dB_u{9.50}, 0.00000}, {dB_u{9.75}, 0.00000}, {dB_u{10.00}, 0.00000},
733 {dB_u{10.25}, 0.00000}, {dB_u{10.50}, 0.00000}, {dB_u{10.75}, 0.00000},
734 {dB_u{11.00}, 0.00000}, {dB_u{11.25}, 0.00000}, {dB_u{11.50}, 0.00000},
735 {dB_u{11.75}, 0.00000}, {dB_u{12.00}, 0.00000}, {dB_u{12.25}, 0.00000},
736 {dB_u{12.50}, 0.00000}, {dB_u{12.75}, 0.00000}, {dB_u{13.00}, 0.00000},
737 {dB_u{13.25}, 0.00000}, {dB_u{13.50}, 0.00000}, {dB_u{13.75}, 0.00000},
738 {dB_u{14.00}, 0.00000}, {dB_u{14.25}, 0.00000}, {dB_u{14.50}, 0.00000},
739 {dB_u{14.75}, 0.00000}, {dB_u{15.00}, 0.00000}, {dB_u{15.25}, 0.00000},
740 {dB_u{15.50}, 0.00000}, {dB_u{15.75}, 0.00000}, {dB_u{16.00}, 0.00000},
741 {dB_u{16.25}, 0.00000}, {dB_u{16.50}, 0.00000}, {dB_u{16.75}, 0.00000},
742 {dB_u{17.00}, 0.00000}, {dB_u{17.25}, 0.00000}, {dB_u{17.50}, 0.00000},
743 {dB_u{17.75}, 0.00000}, {dB_u{18.00}, 0.00000}, {dB_u{18.25}, 0.00000},
744 {dB_u{18.50}, 0.00000}, {dB_u{18.75}, 0.00000}, {dB_u{19.00}, 0.00000},
745 {dB_u{19.25}, 0.00000}, {dB_u{19.50}, 0.00000}, {dB_u{19.75}, 0.00000},
746 {dB_u{20.00}, 0.00000}, {dB_u{20.25}, 0.00000}, {dB_u{20.50}, 0.00000},
747 {dB_u{20.75}, 0.00000}, {dB_u{21.00}, 0.00000}, {dB_u{21.25}, 0.00000},
748 {dB_u{21.50}, 0.00000}, {dB_u{21.75}, 0.00000}, {dB_u{22.00}, 0.00000},
749 {dB_u{22.25}, 0.00000}, {dB_u{22.50}, 0.00000}, {dB_u{22.75}, 0.00000},
750 {dB_u{23.00}, 0.00000}, {dB_u{23.25}, 0.00000}, {dB_u{23.50}, 0.00000},
751 {dB_u{23.75}, 0.00000}, {dB_u{24.00}, 0.00000}, {dB_u{24.25}, 0.00000},
752 {dB_u{24.50}, 0.00000}, {dB_u{24.75}, 0.00000}, {dB_u{25.00}, 0.00000},
753 {dB_u{25.25}, 0.00000}, {dB_u{25.50}, 0.00000}, {dB_u{25.75}, 0.00000},
754 {dB_u{26.00}, 0.00000}, {dB_u{26.25}, 0.00000}, {dB_u{26.50}, 0.00000},
755 {dB_u{26.75}, 0.00000}, {dB_u{27.00}, 0.00000}, {dB_u{27.25}, 0.00000},
756 {dB_u{27.50}, 0.00000}, {dB_u{27.75}, 0.00000}, {dB_u{28.00}, 0.00000},
757 {dB_u{28.25}, 0.00000}, {dB_u{28.50}, 0.00000}, {dB_u{28.75}, 0.00000},
758 {dB_u{29.00}, 0.00000}, {dB_u{29.25}, 0.00000}, {dB_u{29.50}, 0.00000},
759 {dB_u{29.75}, 0.00000}, {dB_u{30.00}, 0.00000},
760 }},
761 /* MCS 0 - 1000 bytes */
762 {std::make_pair(0, 1000),
763 {
764 {dB_u{-4.00}, 1.00000}, {dB_u{-3.75}, 1.00000}, {dB_u{-3.50}, 1.00000},
765 {dB_u{-3.25}, 1.00000}, {dB_u{-3.00}, 1.00000}, {dB_u{-2.75}, 1.00000},
766 {dB_u{-2.50}, 1.00000}, {dB_u{-2.25}, 1.00000}, {dB_u{-2.00}, 1.00000},
767 {dB_u{-1.75}, 1.00000}, {dB_u{-1.50}, 1.00000}, {dB_u{-1.25}, 1.00000},
768 {dB_u{-1.00}, 1.00000}, {dB_u{-0.75}, 0.98140}, {dB_u{-0.50}, 0.97007},
769 {dB_u{-0.25}, 0.80280}, {dB_u{0.00}, 0.68977}, {dB_u{0.25}, 0.42581},
770 {dB_u{0.50}, 0.20997}, {dB_u{0.75}, 0.12620}, {dB_u{1.00}, 0.04596},
771 {dB_u{1.25}, 0.02674}, {dB_u{1.50}, 0.00770}, {dB_u{1.75}, 0.00436},
772 {dB_u{2.00}, 0.00103}, {dB_u{2.25}, 0.00057}, {dB_u{2.50}, 0.00010},
773 {dB_u{2.75}, 0.00005}, {dB_u{3.00}, 0.00001}, {dB_u{3.25}, 0.00000},
774 {dB_u{3.50}, 0.00000}, {dB_u{3.75}, 0.00000}, {dB_u{4.00}, 0.00000},
775 {dB_u{4.25}, 0.00000}, {dB_u{4.50}, 0.00000}, {dB_u{4.75}, 0.00000},
776 {dB_u{5.00}, 0.00000}, {dB_u{5.25}, 0.00000}, {dB_u{5.50}, 0.00000},
777 {dB_u{5.75}, 0.00000}, {dB_u{6.00}, 0.00000}, {dB_u{6.25}, 0.00000},
778 {dB_u{6.50}, 0.00000}, {dB_u{6.75}, 0.00000}, {dB_u{7.00}, 0.00000},
779 {dB_u{7.25}, 0.00000}, {dB_u{7.50}, 0.00000}, {dB_u{7.75}, 0.00000},
780 {dB_u{8.00}, 0.00000}, {dB_u{8.25}, 0.00000}, {dB_u{8.50}, 0.00000},
781 {dB_u{8.75}, 0.00000}, {dB_u{9.00}, 0.00000}, {dB_u{9.25}, 0.00000},
782 {dB_u{9.50}, 0.00000}, {dB_u{9.75}, 0.00000}, {dB_u{10.00}, 0.00000},
783 {dB_u{10.25}, 0.00000}, {dB_u{10.50}, 0.00000}, {dB_u{10.75}, 0.00000},
784 {dB_u{11.00}, 0.00000}, {dB_u{11.25}, 0.00000}, {dB_u{11.50}, 0.00000},
785 {dB_u{11.75}, 0.00000}, {dB_u{12.00}, 0.00000}, {dB_u{12.25}, 0.00000},
786 {dB_u{12.50}, 0.00000}, {dB_u{12.75}, 0.00000}, {dB_u{13.00}, 0.00000},
787 {dB_u{13.25}, 0.00000}, {dB_u{13.50}, 0.00000}, {dB_u{13.75}, 0.00000},
788 {dB_u{14.00}, 0.00000}, {dB_u{14.25}, 0.00000}, {dB_u{14.50}, 0.00000},
789 {dB_u{14.75}, 0.00000}, {dB_u{15.00}, 0.00000}, {dB_u{15.25}, 0.00000},
790 {dB_u{15.50}, 0.00000}, {dB_u{15.75}, 0.00000}, {dB_u{16.00}, 0.00000},
791 {dB_u{16.25}, 0.00000}, {dB_u{16.50}, 0.00000}, {dB_u{16.75}, 0.00000},
792 {dB_u{17.00}, 0.00000}, {dB_u{17.25}, 0.00000}, {dB_u{17.50}, 0.00000},
793 {dB_u{17.75}, 0.00000}, {dB_u{18.00}, 0.00000}, {dB_u{18.25}, 0.00000},
794 {dB_u{18.50}, 0.00000}, {dB_u{18.75}, 0.00000}, {dB_u{19.00}, 0.00000},
795 {dB_u{19.25}, 0.00000}, {dB_u{19.50}, 0.00000}, {dB_u{19.75}, 0.00000},
796 {dB_u{20.00}, 0.00000}, {dB_u{20.25}, 0.00000}, {dB_u{20.50}, 0.00000},
797 {dB_u{20.75}, 0.00000}, {dB_u{21.00}, 0.00000}, {dB_u{21.25}, 0.00000},
798 {dB_u{21.50}, 0.00000}, {dB_u{21.75}, 0.00000}, {dB_u{22.00}, 0.00000},
799 {dB_u{22.25}, 0.00000}, {dB_u{22.50}, 0.00000}, {dB_u{22.75}, 0.00000},
800 {dB_u{23.00}, 0.00000}, {dB_u{23.25}, 0.00000}, {dB_u{23.50}, 0.00000},
801 {dB_u{23.75}, 0.00000}, {dB_u{24.00}, 0.00000}, {dB_u{24.25}, 0.00000},
802 {dB_u{24.50}, 0.00000}, {dB_u{24.75}, 0.00000}, {dB_u{25.00}, 0.00000},
803 {dB_u{25.25}, 0.00000}, {dB_u{25.50}, 0.00000}, {dB_u{25.75}, 0.00000},
804 {dB_u{26.00}, 0.00000}, {dB_u{26.25}, 0.00000}, {dB_u{26.50}, 0.00000},
805 {dB_u{26.75}, 0.00000}, {dB_u{27.00}, 0.00000}, {dB_u{27.25}, 0.00000},
806 {dB_u{27.50}, 0.00000}, {dB_u{27.75}, 0.00000}, {dB_u{28.00}, 0.00000},
807 {dB_u{28.25}, 0.00000}, {dB_u{28.50}, 0.00000}, {dB_u{28.75}, 0.00000},
808 {dB_u{29.00}, 0.00000}, {dB_u{29.25}, 0.00000}, {dB_u{29.50}, 0.00000},
809 {dB_u{29.75}, 0.00000}, {dB_u{30.00}, 0.00000},
810 }},
811 /* MCS 0 - 1 byte */
812 {std::make_pair(0, 1),
813 {
814 {dB_u{-4.00}, 1.00000}, {dB_u{-3.75}, 1.00000}, {dB_u{-3.50}, 1.00000},
815 {dB_u{-3.25}, 0.17075}, {dB_u{-3.00}, 0.15260}, {dB_u{-2.75}, 0.10190},
816 {dB_u{-2.50}, 0.08455}, {dB_u{-2.25}, 0.06494}, {dB_u{-2.00}, 0.05316},
817 {dB_u{-1.75}, 0.03771}, {dB_u{-1.50}, 0.02744}, {dB_u{-1.25}, 0.01845},
818 {dB_u{-1.00}, 0.01145}, {dB_u{-0.75}, 0.00761}, {dB_u{-0.50}, 0.00418},
819 {dB_u{-0.25}, 0.00260}, {dB_u{0.00}, 0.00110}, {dB_u{0.25}, 0.00068},
820 {dB_u{0.50}, 0.00027}, {dB_u{0.75}, 0.00016}, {dB_u{1.00}, 0.00005},
821 {dB_u{1.25}, 0.00003}, {dB_u{1.50}, 0.00000}, {dB_u{1.75}, 0.00000},
822 {dB_u{2.00}, 0.00000}, {dB_u{2.25}, 0.00000}, {dB_u{2.50}, 0.00000},
823 {dB_u{2.75}, 0.00000}, {dB_u{3.00}, 0.00000}, {dB_u{3.25}, 0.00000},
824 {dB_u{3.50}, 0.00000}, {dB_u{3.75}, 0.00000}, {dB_u{4.00}, 0.00000},
825 {dB_u{4.25}, 0.00000}, {dB_u{4.50}, 0.00000}, {dB_u{4.75}, 0.00000},
826 {dB_u{5.00}, 0.00000}, {dB_u{5.25}, 0.00000}, {dB_u{5.50}, 0.00000},
827 {dB_u{5.75}, 0.00000}, {dB_u{6.00}, 0.00000}, {dB_u{6.25}, 0.00000},
828 {dB_u{6.50}, 0.00000}, {dB_u{6.75}, 0.00000}, {dB_u{7.00}, 0.00000},
829 {dB_u{7.25}, 0.00000}, {dB_u{7.50}, 0.00000}, {dB_u{7.75}, 0.00000},
830 {dB_u{8.00}, 0.00000}, {dB_u{8.25}, 0.00000}, {dB_u{8.50}, 0.00000},
831 {dB_u{8.75}, 0.00000}, {dB_u{9.00}, 0.00000}, {dB_u{9.25}, 0.00000},
832 {dB_u{9.50}, 0.00000}, {dB_u{9.75}, 0.00000}, {dB_u{10.00}, 0.00000},
833 {dB_u{10.25}, 0.00000}, {dB_u{10.50}, 0.00000}, {dB_u{10.75}, 0.00000},
834 {dB_u{11.00}, 0.00000}, {dB_u{11.25}, 0.00000}, {dB_u{11.50}, 0.00000},
835 {dB_u{11.75}, 0.00000}, {dB_u{12.00}, 0.00000}, {dB_u{12.25}, 0.00000},
836 {dB_u{12.50}, 0.00000}, {dB_u{12.75}, 0.00000}, {dB_u{13.00}, 0.00000},
837 {dB_u{13.25}, 0.00000}, {dB_u{13.50}, 0.00000}, {dB_u{13.75}, 0.00000},
838 {dB_u{14.00}, 0.00000}, {dB_u{14.25}, 0.00000}, {dB_u{14.50}, 0.00000},
839 {dB_u{14.75}, 0.00000}, {dB_u{15.00}, 0.00000}, {dB_u{15.25}, 0.00000},
840 {dB_u{15.50}, 0.00000}, {dB_u{15.75}, 0.00000}, {dB_u{16.00}, 0.00000},
841 {dB_u{16.25}, 0.00000}, {dB_u{16.50}, 0.00000}, {dB_u{16.75}, 0.00000},
842 {dB_u{17.00}, 0.00000}, {dB_u{17.25}, 0.00000}, {dB_u{17.50}, 0.00000},
843 {dB_u{17.75}, 0.00000}, {dB_u{18.00}, 0.00000}, {dB_u{18.25}, 0.00000},
844 {dB_u{18.50}, 0.00000}, {dB_u{18.75}, 0.00000}, {dB_u{19.00}, 0.00000},
845 {dB_u{19.25}, 0.00000}, {dB_u{19.50}, 0.00000}, {dB_u{19.75}, 0.00000},
846 {dB_u{20.00}, 0.00000}, {dB_u{20.25}, 0.00000}, {dB_u{20.50}, 0.00000},
847 {dB_u{20.75}, 0.00000}, {dB_u{21.00}, 0.00000}, {dB_u{21.25}, 0.00000},
848 {dB_u{21.50}, 0.00000}, {dB_u{21.75}, 0.00000}, {dB_u{22.00}, 0.00000},
849 {dB_u{22.25}, 0.00000}, {dB_u{22.50}, 0.00000}, {dB_u{22.75}, 0.00000},
850 {dB_u{23.00}, 0.00000}, {dB_u{23.25}, 0.00000}, {dB_u{23.50}, 0.00000},
851 {dB_u{23.75}, 0.00000}, {dB_u{24.00}, 0.00000}, {dB_u{24.25}, 0.00000},
852 {dB_u{24.50}, 0.00000}, {dB_u{24.75}, 0.00000}, {dB_u{25.00}, 0.00000},
853 {dB_u{25.25}, 0.00000}, {dB_u{25.50}, 0.00000}, {dB_u{25.75}, 0.00000},
854 {dB_u{26.00}, 0.00000}, {dB_u{26.25}, 0.00000}, {dB_u{26.50}, 0.00000},
855 {dB_u{26.75}, 0.00000}, {dB_u{27.00}, 0.00000}, {dB_u{27.25}, 0.00000},
856 {dB_u{27.50}, 0.00000}, {dB_u{27.75}, 0.00000}, {dB_u{28.00}, 0.00000},
857 {dB_u{28.25}, 0.00000}, {dB_u{28.50}, 0.00000}, {dB_u{28.75}, 0.00000},
858 {dB_u{29.00}, 0.00000}, {dB_u{29.25}, 0.00000}, {dB_u{29.50}, 0.00000},
859 {dB_u{29.75}, 0.00000}, {dB_u{30.00}, 0.00000},
860 }},
861 /* MCS 0 - 2000 bytes */
862 {std::make_pair(0, 2000),
863 {
864 {dB_u{-4.00}, 1.00000}, {dB_u{-3.75}, 1.00000}, {dB_u{-3.50}, 1.00000},
865 {dB_u{-3.25}, 1.00000}, {dB_u{-3.00}, 1.00000}, {dB_u{-2.75}, 1.00000},
866 {dB_u{-2.50}, 1.00000}, {dB_u{-2.25}, 1.00000}, {dB_u{-2.00}, 1.00000},
867 {dB_u{-1.75}, 1.00000}, {dB_u{-1.50}, 1.00000}, {dB_u{-1.25}, 1.00000},
868 {dB_u{-1.00}, 1.00000}, {dB_u{-0.75}, 0.99965}, {dB_u{-0.50}, 0.99910},
869 {dB_u{-0.25}, 0.96111}, {dB_u{0.00}, 0.90376}, {dB_u{0.25}, 0.67031},
870 {dB_u{0.50}, 0.37584}, {dB_u{0.75}, 0.23647}, {dB_u{1.00}, 0.08981},
871 {dB_u{1.25}, 0.05277}, {dB_u{1.50}, 0.01533}, {dB_u{1.75}, 0.00870},
872 {dB_u{2.00}, 0.00206}, {dB_u{2.25}, 0.00113}, {dB_u{2.50}, 0.00021},
873 {dB_u{2.75}, 0.00011}, {dB_u{3.00}, 0.00001}, {dB_u{3.25}, 0.00000},
874 {dB_u{3.50}, 0.00000}, {dB_u{3.75}, 0.00000}, {dB_u{4.00}, 0.00000},
875 {dB_u{4.25}, 0.00000}, {dB_u{4.50}, 0.00000}, {dB_u{4.75}, 0.00000},
876 {dB_u{5.00}, 0.00000}, {dB_u{5.25}, 0.00000}, {dB_u{5.50}, 0.00000},
877 {dB_u{5.75}, 0.00000}, {dB_u{6.00}, 0.00000}, {dB_u{6.25}, 0.00000},
878 {dB_u{6.50}, 0.00000}, {dB_u{6.75}, 0.00000}, {dB_u{7.00}, 0.00000},
879 {dB_u{7.25}, 0.00000}, {dB_u{7.50}, 0.00000}, {dB_u{7.75}, 0.00000},
880 {dB_u{8.00}, 0.00000}, {dB_u{8.25}, 0.00000}, {dB_u{8.50}, 0.00000},
881 {dB_u{8.75}, 0.00000}, {dB_u{9.00}, 0.00000}, {dB_u{9.25}, 0.00000},
882 {dB_u{9.50}, 0.00000}, {dB_u{9.75}, 0.00000}, {dB_u{10.00}, 0.00000},
883 {dB_u{10.25}, 0.00000}, {dB_u{10.50}, 0.00000}, {dB_u{10.75}, 0.00000},
884 {dB_u{11.00}, 0.00000}, {dB_u{11.25}, 0.00000}, {dB_u{11.50}, 0.00000},
885 {dB_u{11.75}, 0.00000}, {dB_u{12.00}, 0.00000}, {dB_u{12.25}, 0.00000},
886 {dB_u{12.50}, 0.00000}, {dB_u{12.75}, 0.00000}, {dB_u{13.00}, 0.00000},
887 {dB_u{13.25}, 0.00000}, {dB_u{13.50}, 0.00000}, {dB_u{13.75}, 0.00000},
888 {dB_u{14.00}, 0.00000}, {dB_u{14.25}, 0.00000}, {dB_u{14.50}, 0.00000},
889 {dB_u{14.75}, 0.00000}, {dB_u{15.00}, 0.00000}, {dB_u{15.25}, 0.00000},
890 {dB_u{15.50}, 0.00000}, {dB_u{15.75}, 0.00000}, {dB_u{16.00}, 0.00000},
891 {dB_u{16.25}, 0.00000}, {dB_u{16.50}, 0.00000}, {dB_u{16.75}, 0.00000},
892 {dB_u{17.00}, 0.00000}, {dB_u{17.25}, 0.00000}, {dB_u{17.50}, 0.00000},
893 {dB_u{17.75}, 0.00000}, {dB_u{18.00}, 0.00000}, {dB_u{18.25}, 0.00000},
894 {dB_u{18.50}, 0.00000}, {dB_u{18.75}, 0.00000}, {dB_u{19.00}, 0.00000},
895 {dB_u{19.25}, 0.00000}, {dB_u{19.50}, 0.00000}, {dB_u{19.75}, 0.00000},
896 {dB_u{20.00}, 0.00000}, {dB_u{20.25}, 0.00000}, {dB_u{20.50}, 0.00000},
897 {dB_u{20.75}, 0.00000}, {dB_u{21.00}, 0.00000}, {dB_u{21.25}, 0.00000},
898 {dB_u{21.50}, 0.00000}, {dB_u{21.75}, 0.00000}, {dB_u{22.00}, 0.00000},
899 {dB_u{22.25}, 0.00000}, {dB_u{22.50}, 0.00000}, {dB_u{22.75}, 0.00000},
900 {dB_u{23.00}, 0.00000}, {dB_u{23.25}, 0.00000}, {dB_u{23.50}, 0.00000},
901 {dB_u{23.75}, 0.00000}, {dB_u{24.00}, 0.00000}, {dB_u{24.25}, 0.00000},
902 {dB_u{24.50}, 0.00000}, {dB_u{24.75}, 0.00000}, {dB_u{25.00}, 0.00000},
903 {dB_u{25.25}, 0.00000}, {dB_u{25.50}, 0.00000}, {dB_u{25.75}, 0.00000},
904 {dB_u{26.00}, 0.00000}, {dB_u{26.25}, 0.00000}, {dB_u{26.50}, 0.00000},
905 {dB_u{26.75}, 0.00000}, {dB_u{27.00}, 0.00000}, {dB_u{27.25}, 0.00000},
906 {dB_u{27.50}, 0.00000}, {dB_u{27.75}, 0.00000}, {dB_u{28.00}, 0.00000},
907 {dB_u{28.25}, 0.00000}, {dB_u{28.50}, 0.00000}, {dB_u{28.75}, 0.00000},
908 {dB_u{29.00}, 0.00000}, {dB_u{29.25}, 0.00000}, {dB_u{29.50}, 0.00000},
909 {dB_u{29.75}, 0.00000}, {dB_u{30.00}, 0.00000},
910 }},
911 /* MCS 7 - 1500 bytes */
912 {std::make_pair(7, 1500),
913 {
914 {dB_u{-4.00}, 1.00000}, {dB_u{-3.75}, 1.00000}, {dB_u{-3.50}, 1.00000},
915 {dB_u{-3.25}, 1.00000}, {dB_u{-3.00}, 1.00000}, {dB_u{-2.75}, 1.00000},
916 {dB_u{-2.50}, 1.00000}, {dB_u{-2.25}, 1.00000}, {dB_u{-2.00}, 1.00000},
917 {dB_u{-1.75}, 1.00000}, {dB_u{-1.50}, 1.00000}, {dB_u{-1.25}, 1.00000},
918 {dB_u{-1.00}, 1.00000}, {dB_u{-0.75}, 1.00000}, {dB_u{-0.50}, 1.00000},
919 {dB_u{-0.25}, 1.00000}, {dB_u{0.00}, 1.00000}, {dB_u{0.25}, 1.00000},
920 {dB_u{0.50}, 1.00000}, {dB_u{0.75}, 1.00000}, {dB_u{1.00}, 1.00000},
921 {dB_u{1.25}, 1.00000}, {dB_u{1.50}, 1.00000}, {dB_u{1.75}, 1.00000},
922 {dB_u{2.00}, 1.00000}, {dB_u{2.25}, 1.00000}, {dB_u{2.50}, 1.00000},
923 {dB_u{2.75}, 1.00000}, {dB_u{3.00}, 1.00000}, {dB_u{3.25}, 1.00000},
924 {dB_u{3.50}, 1.00000}, {dB_u{3.75}, 1.00000}, {dB_u{4.00}, 1.00000},
925 {dB_u{4.25}, 1.00000}, {dB_u{4.50}, 1.00000}, {dB_u{4.75}, 1.00000},
926 {dB_u{5.00}, 1.00000}, {dB_u{5.25}, 1.00000}, {dB_u{5.50}, 1.00000},
927 {dB_u{5.75}, 1.00000}, {dB_u{6.00}, 1.00000}, {dB_u{6.25}, 1.00000},
928 {dB_u{6.50}, 1.00000}, {dB_u{6.75}, 1.00000}, {dB_u{7.00}, 1.00000},
929 {dB_u{7.25}, 1.00000}, {dB_u{7.50}, 1.00000}, {dB_u{7.75}, 1.00000},
930 {dB_u{8.00}, 1.00000}, {dB_u{8.25}, 1.00000}, {dB_u{8.50}, 1.00000},
931 {dB_u{8.75}, 1.00000}, {dB_u{9.00}, 1.00000}, {dB_u{9.25}, 1.00000},
932 {dB_u{9.50}, 1.00000}, {dB_u{9.75}, 1.00000}, {dB_u{10.00}, 1.00000},
933 {dB_u{10.25}, 1.00000}, {dB_u{10.50}, 1.00000}, {dB_u{10.75}, 1.00000},
934 {dB_u{11.00}, 1.00000}, {dB_u{11.25}, 1.00000}, {dB_u{11.50}, 1.00000},
935 {dB_u{11.75}, 1.00000}, {dB_u{12.00}, 1.00000}, {dB_u{12.25}, 1.00000},
936 {dB_u{12.50}, 1.00000}, {dB_u{12.75}, 1.00000}, {dB_u{13.00}, 1.00000},
937 {dB_u{13.25}, 1.00000}, {dB_u{13.50}, 1.00000}, {dB_u{13.75}, 1.00000},
938 {dB_u{14.00}, 1.00000}, {dB_u{14.25}, 1.00000}, {dB_u{14.50}, 1.00000},
939 {dB_u{14.75}, 1.00000}, {dB_u{15.00}, 1.00000}, {dB_u{15.25}, 1.00000},
940 {dB_u{15.50}, 1.00000}, {dB_u{15.75}, 1.00000}, {dB_u{16.00}, 1.00000},
941 {dB_u{16.25}, 1.00000}, {dB_u{16.50}, 1.00000}, {dB_u{16.75}, 1.00000},
942 {dB_u{17.00}, 1.00000}, {dB_u{17.25}, 1.00000}, {dB_u{17.50}, 1.00000},
943 {dB_u{17.75}, 0.99057}, {dB_u{18.00}, 0.98075}, {dB_u{18.25}, 0.86664},
944 {dB_u{18.50}, 0.74920}, {dB_u{18.75}, 0.54857}, {dB_u{19.00}, 0.34531},
945 {dB_u{19.25}, 0.23624}, {dB_u{19.50}, 0.12672}, {dB_u{19.75}, 0.08164},
946 {dB_u{20.00}, 0.03650}, {dB_u{20.25}, 0.02340}, {dB_u{20.50}, 0.01029},
947 {dB_u{20.75}, 0.00653}, {dB_u{21.00}, 0.00278}, {dB_u{21.25}, 0.00165},
948 {dB_u{21.50}, 0.00051}, {dB_u{21.75}, 0.00030}, {dB_u{22.00}, 0.00009},
949 {dB_u{22.25}, 0.00005}, {dB_u{22.50}, 0.00001}, {dB_u{22.75}, 0.00000},
950 {dB_u{23.00}, 0.00000}, {dB_u{23.25}, 0.00000}, {dB_u{23.50}, 0.00000},
951 {dB_u{23.75}, 0.00000}, {dB_u{24.00}, 0.00000}, {dB_u{24.25}, 0.00000},
952 {dB_u{24.50}, 0.00000}, {dB_u{24.75}, 0.00000}, {dB_u{25.00}, 0.00000},
953 {dB_u{25.25}, 0.00000}, {dB_u{25.50}, 0.00000}, {dB_u{25.75}, 0.00000},
954 {dB_u{26.00}, 0.00000}, {dB_u{26.25}, 0.00000}, {dB_u{26.50}, 0.00000},
955 {dB_u{26.75}, 0.00000}, {dB_u{27.00}, 0.00000}, {dB_u{27.25}, 0.00000},
956 {dB_u{27.50}, 0.00000}, {dB_u{27.75}, 0.00000}, {dB_u{28.00}, 0.00000},
957 {dB_u{28.25}, 0.00000}, {dB_u{28.50}, 0.00000}, {dB_u{28.75}, 0.00000},
958 {dB_u{29.00}, 0.00000}, {dB_u{29.25}, 0.00000}, {dB_u{29.50}, 0.00000},
959 {dB_u{29.75}, 0.00000}, {dB_u{30.00}, 0.00000},
960 }},
961 /* MCS 8 - 1500 bytes */
962 {std::make_pair(8, 1500),
963 {
964 {dB_u{-4.00}, 1.00000}, {dB_u{-3.75}, 1.00000}, {dB_u{-3.50}, 1.00000},
965 {dB_u{-3.25}, 1.00000}, {dB_u{-3.00}, 1.00000}, {dB_u{-2.75}, 1.00000},
966 {dB_u{-2.50}, 1.00000}, {dB_u{-2.25}, 1.00000}, {dB_u{-2.00}, 1.00000},
967 {dB_u{-1.75}, 1.00000}, {dB_u{-1.50}, 1.00000}, {dB_u{-1.25}, 1.00000},
968 {dB_u{-1.00}, 1.00000}, {dB_u{-0.75}, 1.00000}, {dB_u{-0.50}, 1.00000},
969 {dB_u{-0.25}, 1.00000}, {dB_u{0.00}, 1.00000}, {dB_u{0.25}, 1.00000},
970 {dB_u{0.50}, 1.00000}, {dB_u{0.75}, 1.00000}, {dB_u{1.00}, 1.00000},
971 {dB_u{1.25}, 1.00000}, {dB_u{1.50}, 1.00000}, {dB_u{1.75}, 1.00000},
972 {dB_u{2.00}, 1.00000}, {dB_u{2.25}, 1.00000}, {dB_u{2.50}, 1.00000},
973 {dB_u{2.75}, 1.00000}, {dB_u{3.00}, 1.00000}, {dB_u{3.25}, 1.00000},
974 {dB_u{3.50}, 1.00000}, {dB_u{3.75}, 1.00000}, {dB_u{4.00}, 1.00000},
975 {dB_u{4.25}, 1.00000}, {dB_u{4.50}, 1.00000}, {dB_u{4.75}, 1.00000},
976 {dB_u{5.00}, 1.00000}, {dB_u{5.25}, 1.00000}, {dB_u{5.50}, 1.00000},
977 {dB_u{5.75}, 1.00000}, {dB_u{6.00}, 1.00000}, {dB_u{6.25}, 1.00000},
978 {dB_u{6.50}, 1.00000}, {dB_u{6.75}, 1.00000}, {dB_u{7.00}, 1.00000},
979 {dB_u{7.25}, 1.00000}, {dB_u{7.50}, 1.00000}, {dB_u{7.75}, 1.00000},
980 {dB_u{8.00}, 1.00000}, {dB_u{8.25}, 1.00000}, {dB_u{8.50}, 1.00000},
981 {dB_u{8.75}, 1.00000}, {dB_u{9.00}, 1.00000}, {dB_u{9.25}, 1.00000},
982 {dB_u{9.50}, 1.00000}, {dB_u{9.75}, 1.00000}, {dB_u{10.00}, 1.00000},
983 {dB_u{10.25}, 1.00000}, {dB_u{10.50}, 1.00000}, {dB_u{10.75}, 1.00000},
984 {dB_u{11.00}, 1.00000}, {dB_u{11.25}, 1.00000}, {dB_u{11.50}, 1.00000},
985 {dB_u{11.75}, 1.00000}, {dB_u{12.00}, 1.00000}, {dB_u{12.25}, 1.00000},
986 {dB_u{12.50}, 1.00000}, {dB_u{12.75}, 1.00000}, {dB_u{13.00}, 1.00000},
987 {dB_u{13.25}, 1.00000}, {dB_u{13.50}, 1.00000}, {dB_u{13.75}, 1.00000},
988 {dB_u{14.00}, 1.00000}, {dB_u{14.25}, 1.00000}, {dB_u{14.50}, 1.00000},
989 {dB_u{14.75}, 1.00000}, {dB_u{15.00}, 1.00000}, {dB_u{15.25}, 1.00000},
990 {dB_u{15.50}, 1.00000}, {dB_u{15.75}, 1.00000}, {dB_u{16.00}, 1.00000},
991 {dB_u{16.25}, 1.00000}, {dB_u{16.50}, 1.00000}, {dB_u{16.75}, 1.00000},
992 {dB_u{17.00}, 1.00000}, {dB_u{17.25}, 1.00000}, {dB_u{17.50}, 1.00000},
993 {dB_u{17.75}, 1.00000}, {dB_u{18.00}, 1.00000}, {dB_u{18.25}, 1.00000},
994 {dB_u{18.50}, 1.00000}, {dB_u{18.75}, 1.00000}, {dB_u{19.00}, 1.00000},
995 {dB_u{19.25}, 1.00000}, {dB_u{19.50}, 1.00000}, {dB_u{19.75}, 1.00000},
996 {dB_u{20.00}, 1.00000}, {dB_u{20.25}, 1.00000}, {dB_u{20.50}, 1.00000},
997 {dB_u{20.75}, 1.00000}, {dB_u{21.00}, 1.00000}, {dB_u{21.25}, 0.99918},
998 {dB_u{21.50}, 0.99833}, {dB_u{21.75}, 0.97191}, {dB_u{22.00}, 0.94458},
999 {dB_u{22.25}, 0.81436}, {dB_u{22.50}, 0.68127}, {dB_u{22.75}, 0.52168},
1000 {dB_u{23.00}, 0.36056}, {dB_u{23.25}, 0.25114}, {dB_u{23.50}, 0.14127},
1001 {dB_u{23.75}, 0.09509}, {dB_u{24.00}, 0.04883}, {dB_u{24.25}, 0.03234},
1002 {dB_u{24.50}, 0.01584}, {dB_u{24.75}, 0.01060}, {dB_u{25.00}, 0.00535},
1003 {dB_u{25.25}, 0.00345}, {dB_u{25.50}, 0.00154}, {dB_u{25.75}, 0.00096},
1004 {dB_u{26.00}, 0.00037}, {dB_u{26.25}, 0.00022}, {dB_u{26.50}, 0.00007},
1005 {dB_u{26.75}, 0.00004}, {dB_u{27.00}, 0.00000}, {dB_u{27.25}, 0.00000},
1006 {dB_u{27.50}, 0.00000}, {dB_u{27.75}, 0.00000}, {dB_u{28.00}, 0.00000},
1007 {dB_u{28.25}, 0.00000}, {dB_u{28.50}, 0.00000}, {dB_u{28.75}, 0.00000},
1008 {dB_u{29.00}, 0.00000}, {dB_u{29.25}, 0.00000}, {dB_u{29.50}, 0.00000},
1009 {dB_u{29.75}, 0.00000}, {dB_u{30.00}, 0.00000},
1010 }},
1011};
1012
1013/**
1014 * @ingroup wifi-test
1015 * @ingroup tests
1016 *
1017 * @brief Wifi Table-based Error Rate Models Test Case
1018 */
1020{
1021 public:
1022 /**
1023 * Constructor
1024 *
1025 * @param testName the test name
1026 * @param mode the WifiMode to use for the test
1027 * @param size the number of bytes to use for the test
1028 */
1029 TableBasedErrorRateTestCase(const std::string& testName, WifiMode mode, uint32_t size);
1031
1032 private:
1033 void DoRun() override;
1034
1035 std::string m_testName; ///< The name of the test to run
1036 WifiMode m_mode; ///< The WifiMode to test
1037 uint32_t m_size; ///< The size (in bytes) to test
1038};
1039
1041 WifiMode mode,
1042 uint32_t size)
1043 : TestCase(testName),
1044 m_testName(testName),
1045 m_mode(mode),
1046 m_size(size)
1047{
1048}
1049
1053
1054void
1056{
1057 // LogComponentEnable ("WifiErrorRateModelsTest", LOG_LEVEL_ALL);
1058 // LogComponentEnable ("TableBasedErrorRateModel", LOG_LEVEL_ALL);
1059 // LogComponentEnable ("YansErrorRateModel", LOG_LEVEL_ALL);
1060
1062 WifiTxVector txVector;
1063 txVector.SetMode(m_mode);
1064
1065 // Spot test some values returned from TableBasedErrorRateModel
1066 for (int snrMultipliedByFour = -16; snrMultipliedByFour <= 120; ++snrMultipliedByFour)
1067 {
1068 dB_u snr{snrMultipliedByFour / 4.0};
1069 double expectedPer = 0;
1070 if (m_mode.GetMcsValue() > ERROR_TABLE_BCC_MAX_NUM_MCS)
1071 {
1073 expectedPer =
1074 1 - yans->GetChunkSuccessRate(m_mode, txVector, DbToRatio(snr), m_size * 8);
1075 }
1076 else
1077 {
1078 const auto cit = expectedTableValues.find(std::make_pair(m_mode.GetMcsValue(), m_size));
1079 if (cit != expectedTableValues.cend())
1080 {
1081 // Lambda to find map key within tolerance (avoids floating-point comparison issues)
1082 const auto& snrPerMap = cit->second;
1083 const auto expectedIt = [&]() {
1084 constexpr dB_u tolerance{1e-6};
1085 const auto iter = snrPerMap.lower_bound(snr - tolerance);
1086 return (iter != snrPerMap.cend() && iter->first <= snr + tolerance)
1087 ? iter
1088 : snrPerMap.cend();
1089 }();
1090 if (expectedIt != snrPerMap.cend())
1091 {
1092 expectedPer = expectedIt->second;
1093 }
1094 else
1095 {
1096 NS_FATAL_ERROR("SNR value " << snr << " dB not found!");
1097 }
1098 }
1099 else
1100 {
1101 NS_FATAL_ERROR("No expected PER found for the combination MCS "
1102 << +m_mode.GetMcsValue() << " and size " << m_size << " bytes");
1103 }
1104 }
1105 const auto per =
1106 1 - table->GetChunkSuccessRate(m_mode, txVector, DbToRatio(snr), m_size * 8);
1107 NS_LOG_INFO(m_testName << ": snr=" << snr << "dB per=" << per
1108 << " expectedPER=" << expectedPer);
1109 NS_TEST_ASSERT_MSG_EQ_TOL(per, expectedPer, 1e-5, "Not equal within tolerance");
1110 }
1111}
1112
1113/**
1114 * @ingroup wifi-test
1115 * @ingroup tests
1116 *
1117 * @brief Wifi Error Rate Models Test Suite
1118 */
1120{
1121 public:
1123};
1124
1126 : TestSuite("wifi-error-rate-models", Type::UNIT)
1127{
1131 AddTestCase(new TableBasedErrorRateTestCase("DefaultTableBasedHtMcs0-1458bytes",
1133 1458),
1136 new TableBasedErrorRateTestCase("DefaultTableBasedHtMcs0-32bytes", HtPhy::GetHtMcs0(), 32),
1138 AddTestCase(new TableBasedErrorRateTestCase("DefaultTableBasedHtMcs0-1000bytes",
1140 1000),
1143 new TableBasedErrorRateTestCase("DefaultTableBasedHtMcs0-1byte", HtPhy::GetHtMcs0(), 1),
1145 AddTestCase(new TableBasedErrorRateTestCase("DefaultTableBasedHtMcs0-2000bytes",
1147 2000),
1149 AddTestCase(new TableBasedErrorRateTestCase("DefaultTableBasedHtMcs7-1500bytes",
1151 1500),
1153 AddTestCase(new TableBasedErrorRateTestCase("DefaultTableBasedVhtMcs0-1458bytes",
1155 1458),
1157 AddTestCase(new TableBasedErrorRateTestCase("DefaultTableBasedVhtMcs0-32bytes",
1159 32),
1161 AddTestCase(new TableBasedErrorRateTestCase("DefaultTableBasedVhtMcs0-1000bytes",
1163 1000),
1166 new TableBasedErrorRateTestCase("DefaultTableBasedVhtMcs0-1byte", VhtPhy::GetVhtMcs0(), 1),
1168 AddTestCase(new TableBasedErrorRateTestCase("DefaultTableBasedVhtMcs0-2000bytes",
1170 2000),
1172 AddTestCase(new TableBasedErrorRateTestCase("DefaultTableBasedVhtMcs8-1500bytes",
1174 1500),
1176 AddTestCase(new TableBasedErrorRateTestCase("FallbackTableBasedHeMcs11-1458bytes",
1178 1458),
1180}
1181
Wifi Table-based Error Rate Models Test Case.
void DoRun() override
Implementation to actually run this TestCase.
WifiMode m_mode
The WifiMode to test.
uint32_t m_size
The size (in bytes) to test.
TableBasedErrorRateTestCase(const std::string &testName, WifiMode mode, uint32_t size)
Constructor.
std::string m_testName
The name of the test to run.
double CalculatePayloadChunkSuccessRate(double snir, Time duration, const WifiTxVector &txVector, uint16_t staId=SU_STA_ID) const
Calculate the success rate of the payload chunk given the SINR, duration, and TXVECTOR.
double CalculateSnr(Ptr< Event > event, MHz_u channelWidth, uint8_t nss, const WifiSpectrumBandInfo &band) const
Calculate the SNIR for the event (starting from now until the event end).
Wifi Error Rate Models Test Case Dsss.
void DoRun() override
Implementation to actually run this TestCase.
Wifi Error Rate Models Test Case MIMO.
void DoRun() override
Implementation to actually run this TestCase.
Wifi Error Rate Models Test Case Nist.
void DoRun() override
Implementation to actually run this TestCase.
Wifi Error Rate Models Test Suite.
static double GetDsssDqpskSuccessRate(double sinr, uint64_t nbits)
Return the chunk success rate of the differential encoded QPSK.
static double GetDsssDbpskSuccessRate(double sinr, uint64_t nbits)
Return the chunk success rate of the differential BPSK.
static double GetDsssDqpskCck5_5SuccessRate(double sinr, uint64_t nbits)
Return the chunk success rate of the differential encoded QPSK for 5.5Mbps data rate.
static double GetDsssDqpskCck11SuccessRate(double sinr, uint64_t nbits)
Return the chunk success rate of the differential encoded QPSK for 11Mbps data rate.
static WifiMode GetHeMcs11()
static WifiMode GetHtMcs0()
static WifiMode GetHtMcs7()
void SetNoiseFigure(double value)
Set the noise figure.
void SetErrorRateModel(const Ptr< ErrorRateModel > rate)
Set the error rate model for this interference helper.
double CalculatePayloadChunkSuccessRate(double snir, Time duration, const WifiTxVector &txVector, uint16_t staId=SU_STA_ID) const
Calculate the success rate of the payload chunk given the SINR, duration, and TXVECTOR.
void SetNumberOfReceiveAntennas(uint8_t rx)
Set the number of RX antennas in the receiver corresponding to this interference helper.
double CalculateSnr(Ptr< Event > event, MHz_u channelWidth, uint8_t nss, const WifiSpectrumBandInfo &band) const
Calculate the SNIR for the event (starting from now until the event end).
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:70
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Definition test.cc:296
@ QUICK
Fast test.
Definition test.h:1057
TestCase(const TestCase &)=delete
Caller graph was not generated because of its size.
Type
Type of test.
Definition test.h:1271
TestSuite(std::string name, Type type=Type::UNIT)
Construct a new test suite.
Definition test.cc:494
Simulation virtual time values and global simulation resolution.
Definition nstime.h:95
static WifiMode GetVhtMcs0()
static WifiMode GetVhtMcs8()
represent a single transmission mode
Definition wifi-mode.h:39
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
void SetTxPowerLevel(uint8_t powerlevel)
Sets the selected transmission power level.
void SetChannelWidth(MHz_u channelWidth)
Sets the selected channelWidth.
uint8_t GetNss(uint16_t staId=SU_STA_ID) const
If this TX vector is associated with an SU PPDU, return the number of spatial streams.
MHz_u GetChannelWidth() const
void SetNTx(uint8_t nTx)
Sets the number of TX antennas.
void SetMode(WifiMode mode)
Sets the selected payload transmission mode.
void SetNss(uint8_t nss)
Sets the number of Nss.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:201
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition log.h:274
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition object.h:627
#define NS_TEST_ASSERT_MSG_GT(actual, limit, msg)
Test that an actual value is greater than a limit and report and abort if not.
Definition test.h:863
#define NS_TEST_ASSERT_MSG_EQ_TOL(actual, limit, tol, msg)
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report and...
Definition test.h:326
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition nstime.h:1330
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static constexpr uint8_t WIFI_MIN_TX_PWR_LEVEL
minimum TX power level value
const uint8_t ERROR_TABLE_BCC_MAX_NUM_MCS
maximum number of MCSs for BCC
double MHz_u
MHz weak type.
Definition wifi-units.h:31
double dBm_u
dBm weak type
Definition wifi-units.h:27
double DbToRatio(dB_u val)
Convert from dB to ratio.
Definition wifi-utils.cc:26
double Watt_u
Watt weak type.
Definition wifi-units.h:25
double dB_u
dB weak type
Definition wifi-units.h:28
dB_u RatioToDb(double ratio)
Convert from ratio to dB.
Definition wifi-utils.cc:45
const std::map< std::pair< uint8_t, uint32_t >, std::map< dB_u, double > > expectedTableValues
map of PER values that have been manually computed for a given MCS, size (in bytes) and SNR (in dB) i...
static WifiErrorRateModelsTestSuite wifiErrorRateModelsTestSuite
the test suite
static double FromRss(dBm_u rss)