A Discrete-Event Network Simulator
API
wifi-error-rate-models-test.cc
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2016 University of Washington
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Authors: Tom Henderson (tomhend@u.washington.edu)
19 * S├ębastien Deronne (sebastien.deronne@gmail.com)
20 */
21
22#include "ns3/log.h"
23#include "ns3/test.h"
24#include "ns3/nist-error-rate-model.h"
25#include "ns3/yans-error-rate-model.h"
26#include "ns3/dsss-error-rate-model.h"
27#include "ns3/wifi-phy.h"
28#include "ns3/wifi-utils.h"
29#include "ns3/table-based-error-rate-model.h"
30#include "ns3/he-phy.h" //includes HT and VHT
31#include "ns3/interference-helper.h"
32
33using namespace ns3;
34
35NS_LOG_COMPONENT_DEFINE ("WifiErrorRateModelsTest");
36
37static double
38FromRss (double rssDbw)
39{
40 // SINR is based on receiver noise figure of 7 dB and thermal noise
41 // of -100.5522786 dBm in this 22 MHz bandwidth at 290K
42 double noisePowerDbw = -100.5522786 + 7;
43
44 double sinrDb = rssDbw - noisePowerDbw;
45 // return SINR expressed as ratio
46 return pow (10.0, sinrDb / 10.0);
47}
48
56{
57public:
60
61private:
62 void DoRun (void) override;
63};
64
66 : TestCase ("WifiErrorRateModel test case DSSS")
67{
68}
69
71{
72}
73
74void
76{
77 // 1024 bytes plus headers
78 uint64_t size = (1024 + 40 + 14) * 8;
79 // Spot test some values returned from DsssErrorRateModel
80 // Values taken from sample 80211b.c program used in validation paper
81 double value;
82 // DBPSK
83 value = DsssErrorRateModel::GetDsssDbpskSuccessRate (FromRss (-105.0), size);
84 NS_TEST_ASSERT_MSG_EQ_TOL (value, 0, 1e-13, "Not equal within tolerance");
85 value = DsssErrorRateModel::GetDsssDbpskSuccessRate (FromRss (-100.0), size);
86 NS_TEST_ASSERT_MSG_EQ_TOL (value, 1.5e-13, 1e-13, "Not equal within tolerance");
87 value = DsssErrorRateModel::GetDsssDbpskSuccessRate (FromRss (-99.0), size);
88 NS_TEST_ASSERT_MSG_EQ_TOL (value, 0.0003, 0.0001, "Not equal within tolerance");
89 value = DsssErrorRateModel::GetDsssDbpskSuccessRate (FromRss (-98.0), size);
90 NS_TEST_ASSERT_MSG_EQ_TOL (value, 0.202, 0.005, "Not equal within tolerance");
91 value = DsssErrorRateModel::GetDsssDbpskSuccessRate (FromRss (-97.0), size);
92 NS_TEST_ASSERT_MSG_EQ_TOL (value, 0.813, 0.005, "Not equal within tolerance");
93 value = DsssErrorRateModel::GetDsssDbpskSuccessRate (FromRss (-96.0), size);
94 NS_TEST_ASSERT_MSG_EQ_TOL (value, 0.984, 0.005, "Not equal within tolerance");
95 value = DsssErrorRateModel::GetDsssDbpskSuccessRate (FromRss (-95.0), size);
96 NS_TEST_ASSERT_MSG_EQ_TOL (value, 0.999, 0.001, "Not equal within tolerance");
97 value = DsssErrorRateModel::GetDsssDbpskSuccessRate (FromRss (-90.0), size);
98 NS_TEST_ASSERT_MSG_EQ_TOL (value, 1, 0.001, "Not equal within tolerance");
99
100 // DQPSK
101 //
102 value = DsssErrorRateModel::GetDsssDqpskSuccessRate (FromRss (-96.0), size);
103 NS_TEST_ASSERT_MSG_EQ_TOL (value, 0, 1e-13, "Not equal within tolerance");
104 value = DsssErrorRateModel::GetDsssDqpskSuccessRate (FromRss (-95.0), size);
105 NS_TEST_ASSERT_MSG_EQ_TOL (value, 4.5e-6, 1e-6, "Not equal within tolerance");
106 value = DsssErrorRateModel::GetDsssDqpskSuccessRate (FromRss (-94.0), size);
107 NS_TEST_ASSERT_MSG_EQ_TOL (value, 0.036, 0.005, "Not equal within tolerance");
108 value = DsssErrorRateModel::GetDsssDqpskSuccessRate (FromRss (-93.0), size);
109 NS_TEST_ASSERT_MSG_EQ_TOL (value, 0.519, 0.005, "Not equal within tolerance");
110 value = DsssErrorRateModel::GetDsssDqpskSuccessRate (FromRss (-92.0), size);
111 NS_TEST_ASSERT_MSG_EQ_TOL (value, 0.915, 0.005, "Not equal within tolerance");
112 value = DsssErrorRateModel::GetDsssDqpskSuccessRate (FromRss (-91.0), size);
113 NS_TEST_ASSERT_MSG_EQ_TOL (value, 0.993, 0.005, "Not equal within tolerance");
114 value = DsssErrorRateModel::GetDsssDqpskSuccessRate (FromRss (-90.0), size);
115 NS_TEST_ASSERT_MSG_EQ_TOL (value, 0.999, 0.001, "Not equal within tolerance");
116 value = DsssErrorRateModel::GetDsssDqpskSuccessRate (FromRss (-89.0), size);
117 NS_TEST_ASSERT_MSG_EQ_TOL (value, 1, 0.001, "Not equal within tolerance");
118
119#ifdef HAVE_GSL
120 // DQPSK_CCK5.5
121 value = DsssErrorRateModel::GetDsssDqpskCck5_5SuccessRate (FromRss (-94.0), size);
122 NS_TEST_ASSERT_MSG_EQ_TOL (value, 0, 1e-13, "Not equal within tolerance");
123 value = DsssErrorRateModel::GetDsssDqpskCck5_5SuccessRate (FromRss (-93.0), size);
124 NS_TEST_ASSERT_MSG_EQ_TOL (value, 6.6e-14, 5e-14, "Not equal within tolerance");
125 value = DsssErrorRateModel::GetDsssDqpskCck5_5SuccessRate (FromRss (-92.0), size);
126 NS_TEST_ASSERT_MSG_EQ_TOL (value, 0.0001, 0.00005, "Not equal within tolerance");
127 value = DsssErrorRateModel::GetDsssDqpskCck5_5SuccessRate (FromRss (-91.0), size);
128 NS_TEST_ASSERT_MSG_EQ_TOL (value, 0.132, 0.005, "Not equal within tolerance");
129 value = DsssErrorRateModel::GetDsssDqpskCck5_5SuccessRate (FromRss (-90.0), size);
130 NS_TEST_ASSERT_MSG_EQ_TOL (value, 0.744, 0.005, "Not equal within tolerance");
131 value = DsssErrorRateModel::GetDsssDqpskCck5_5SuccessRate (FromRss (-89.0), size);
132 NS_TEST_ASSERT_MSG_EQ_TOL (value, 0.974, 0.005, "Not equal within tolerance");
133 value = DsssErrorRateModel::GetDsssDqpskCck5_5SuccessRate (FromRss (-88.0), size);
134 NS_TEST_ASSERT_MSG_EQ_TOL (value, 0.999, 0.001, "Not equal within tolerance");
135 value = DsssErrorRateModel::GetDsssDqpskCck5_5SuccessRate (FromRss (-87.0), size);
136 NS_TEST_ASSERT_MSG_EQ_TOL (value, 1, 0.001, "Not equal within tolerance");
137
138 // DQPSK_CCK11
139 value = DsssErrorRateModel::GetDsssDqpskCck11SuccessRate (FromRss (-91.0), size);
140 NS_TEST_ASSERT_MSG_EQ_TOL (value, 0, 1e-14, "Not equal within tolerance");
141 value = DsssErrorRateModel::GetDsssDqpskCck11SuccessRate (FromRss (-90.0), size);
142 NS_TEST_ASSERT_MSG_EQ_TOL (value, 4.7e-14, 1e-14, "Not equal within tolerance");
143 value = DsssErrorRateModel::GetDsssDqpskCck11SuccessRate (FromRss (-89.0), size);
144 NS_TEST_ASSERT_MSG_EQ_TOL (value, 8.85e-5, 1e-5, "Not equal within tolerance");
145 value = DsssErrorRateModel::GetDsssDqpskCck11SuccessRate (FromRss (-88.0), size);
146 NS_TEST_ASSERT_MSG_EQ_TOL (value, 0.128, 0.005, "Not equal within tolerance");
147 value = DsssErrorRateModel::GetDsssDqpskCck11SuccessRate (FromRss (-87.0), size);
148 NS_TEST_ASSERT_MSG_EQ_TOL (value, 0.739, 0.005, "Not equal within tolerance");
149 value = DsssErrorRateModel::GetDsssDqpskCck11SuccessRate (FromRss (-86.0), size);
150 NS_TEST_ASSERT_MSG_EQ_TOL (value, 0.973, 0.005, "Not equal within tolerance");
151 value = DsssErrorRateModel::GetDsssDqpskCck11SuccessRate (FromRss (-85.0), size);
152 NS_TEST_ASSERT_MSG_EQ_TOL (value, 0.999, 0.001, "Not equal within tolerance");
153 value = DsssErrorRateModel::GetDsssDqpskCck11SuccessRate (FromRss (-84.0), size);
154 NS_TEST_ASSERT_MSG_EQ_TOL (value, 1, 0.001, "Not equal within tolerance");
155#endif
156}
157
165{
166public:
169
170private:
171 void DoRun (void) override;
172};
173
175 : TestCase ("WifiErrorRateModel test case NIST")
176{
177}
178
180{
181}
182
183void
185{
186 uint32_t frameSize = 2000;
187 WifiTxVector txVector;
188 Ptr<NistErrorRateModel> nist = CreateObject<NistErrorRateModel> ();
189
190 double ps; // probability of success
191 double snr; // dB
192
193 // Spot test some values returned from NistErrorRateModel
194 // values can be generated by the example program ofdm-validation.cc
195 snr = 2.5;
196 ps = nist->GetChunkSuccessRate (WifiMode ("OfdmRate6Mbps"), txVector, std::pow (10.0, snr / 10.0), frameSize * 8);
197 NS_TEST_ASSERT_MSG_EQ_TOL (ps, 2.04e-10, 1e-10, "Not equal within tolerance");
198 snr = 3.0;
199 ps = nist->GetChunkSuccessRate (WifiMode ("OfdmRate6Mbps"), txVector, std::pow (10.0, snr / 10.0), frameSize * 8);
200 NS_TEST_ASSERT_MSG_EQ_TOL (ps, 0.020, 0.001, "Not equal within tolerance");
201 snr = 4.0;
202 ps = nist->GetChunkSuccessRate (WifiMode ("OfdmRate6Mbps"), txVector, std::pow (10.0, snr / 10.0), frameSize * 8);
203 NS_TEST_ASSERT_MSG_EQ_TOL (ps, 0.885, 0.001, "Not equal within tolerance");
204 snr = 5.0;
205 ps = nist->GetChunkSuccessRate (WifiMode ("OfdmRate6Mbps"), txVector, std::pow (10.0, snr / 10.0), frameSize * 8);
206 NS_TEST_ASSERT_MSG_EQ_TOL (ps, 0.997, 0.001, "Not equal within tolerance");
207
208 snr = 6.0;
209 ps = nist->GetChunkSuccessRate (WifiMode ("OfdmRate9Mbps"), txVector, std::pow (10.0, snr / 10.0), frameSize * 8);
210 NS_TEST_ASSERT_MSG_EQ_TOL (ps, 0.097, 0.001, "Not equal within tolerance");
211 snr = 7.0;
212 ps = nist->GetChunkSuccessRate (WifiMode ("OfdmRate9Mbps"), txVector, std::pow (10.0, snr / 10.0), frameSize * 8);
213 NS_TEST_ASSERT_MSG_EQ_TOL (ps, 0.918, 0.001, "Not equal within tolerance");
214 snr = 8.0;
215 ps = nist->GetChunkSuccessRate (WifiMode ("OfdmRate9Mbps"), txVector, std::pow (10.0, snr / 10.0), frameSize * 8);
216 NS_TEST_ASSERT_MSG_EQ_TOL (ps, 0.998, 0.001, "Not equal within tolerance");
217 snr = 9.0;
218 ps = nist->GetChunkSuccessRate (WifiMode ("OfdmRate9Mbps"), txVector, std::pow (10.0, snr / 10.0), frameSize * 8);
219 NS_TEST_ASSERT_MSG_EQ_TOL (ps, 0.999, 0.001, "Not equal within tolerance");
220
221 snr = 6.0;
222 ps = nist->GetChunkSuccessRate (WifiMode ("OfdmRate12Mbps"), txVector, std::pow (10.0, snr / 10.0), frameSize * 8);
223 NS_TEST_ASSERT_MSG_EQ_TOL (ps, 0.0174, 0.001, "Not equal within tolerance");
224 snr = 7.0;
225 ps = nist->GetChunkSuccessRate (WifiMode ("OfdmRate12Mbps"), txVector, std::pow (10.0, snr / 10.0), frameSize * 8);
226 NS_TEST_ASSERT_MSG_EQ_TOL (ps, 0.881, 0.001, "Not equal within tolerance");
227 snr = 8.0;
228 ps = nist->GetChunkSuccessRate (WifiMode ("OfdmRate12Mbps"), txVector, std::pow (10.0, snr / 10.0), frameSize * 8);
229 NS_TEST_ASSERT_MSG_EQ_TOL (ps, 0.997, 0.001, "Not equal within tolerance");
230 snr = 9.0;
231 ps = nist->GetChunkSuccessRate (WifiMode ("OfdmRate12Mbps"), txVector, std::pow (10.0, snr / 10.0), frameSize * 8);
232 NS_TEST_ASSERT_MSG_EQ_TOL (ps, 0.999, 0.001, "Not equal within tolerance");
233
234 snr = 8.5;
235 ps = nist->GetChunkSuccessRate (WifiMode ("OfdmRate18Mbps"), txVector, std::pow (10.0, snr / 10.0), frameSize * 8);
236 NS_TEST_ASSERT_MSG_EQ_TOL (ps, 2.85e-6, 1e-6, "Not equal within tolerance");
237 snr = 9.5;
238 ps = nist->GetChunkSuccessRate (WifiMode ("OfdmRate18Mbps"), txVector, std::pow (10.0, snr / 10.0), frameSize * 8);
239 NS_TEST_ASSERT_MSG_EQ_TOL (ps, 0.623, 0.001, "Not equal within tolerance");
240 snr = 10.5;
241 ps = nist->GetChunkSuccessRate (WifiMode ("OfdmRate18Mbps"), txVector, std::pow (10.0, snr / 10.0), frameSize * 8);
242 NS_TEST_ASSERT_MSG_EQ_TOL (ps, 0.985, 0.001, "Not equal within tolerance");
243 snr = 11.5;
244 ps = nist->GetChunkSuccessRate (WifiMode ("OfdmRate18Mbps"), txVector, std::pow (10.0, snr / 10.0), frameSize * 8);
245 NS_TEST_ASSERT_MSG_EQ_TOL (ps, 0.999, 0.001, "Not equal within tolerance");
246
247 snr = 12.0;
248 ps = nist->GetChunkSuccessRate (WifiMode ("OfdmRate24Mbps"), txVector, std::pow (10.0, snr / 10.0), frameSize * 8);
249 NS_TEST_ASSERT_MSG_EQ_TOL (ps, 2.22e-7, 1e-7, "Not equal within tolerance");
250 snr = 13.0;
251 ps = nist->GetChunkSuccessRate (WifiMode ("OfdmRate24Mbps"), txVector, std::pow (10.0, snr / 10.0), frameSize * 8);
252 NS_TEST_ASSERT_MSG_EQ_TOL (ps, 0.495, 0.001, "Not equal within tolerance");
253 snr = 14.0;
254 ps = nist->GetChunkSuccessRate (WifiMode ("OfdmRate24Mbps"), txVector, std::pow (10.0, snr / 10.0), frameSize * 8);
255 NS_TEST_ASSERT_MSG_EQ_TOL (ps, 0.974, 0.001, "Not equal within tolerance");
256 snr = 15.0;
257 ps = nist->GetChunkSuccessRate (WifiMode ("OfdmRate24Mbps"), txVector, std::pow (10.0, snr / 10.0), frameSize * 8);
258 NS_TEST_ASSERT_MSG_EQ_TOL (ps, 0.999, 0.001, "Not equal within tolerance");
259
260 snr = 15.5;
261 ps = nist->GetChunkSuccessRate (WifiMode ("OfdmRate36Mbps"), txVector, std::pow (10.0, snr / 10.0), frameSize * 8);
262 NS_TEST_ASSERT_MSG_EQ_TOL (ps, 0.012, 0.001, "Not equal within tolerance");
263 snr = 16.5;
264 ps = nist->GetChunkSuccessRate (WifiMode ("OfdmRate36Mbps"), txVector, std::pow (10.0, snr / 10.0), frameSize * 8);
265 NS_TEST_ASSERT_MSG_EQ_TOL (ps, 0.818, 0.001, "Not equal within tolerance");
266 snr = 17.5;
267 ps = nist->GetChunkSuccessRate (WifiMode ("OfdmRate36Mbps"), txVector, std::pow (10.0, snr / 10.0), frameSize * 8);
268 NS_TEST_ASSERT_MSG_EQ_TOL (ps, 0.993, 0.001, "Not equal within tolerance");
269 snr = 18.5;
270 ps = nist->GetChunkSuccessRate (WifiMode ("OfdmRate36Mbps"), txVector, std::pow (10.0, snr / 10.0), frameSize * 8);
271 NS_TEST_ASSERT_MSG_EQ_TOL (ps, 0.999, 0.001, "Not equal within tolerance");
272
273 snr = 20.0;
274 ps = nist->GetChunkSuccessRate (WifiMode ("OfdmRate48Mbps"), txVector, std::pow (10.0, snr / 10.0), frameSize * 8);
275 NS_TEST_ASSERT_MSG_EQ_TOL (ps, 1.3e-4, 1e-4, "Not equal within tolerance");
276 snr = 21.0;
277 ps = nist->GetChunkSuccessRate (WifiMode ("OfdmRate48Mbps"), txVector, std::pow (10.0, snr / 10.0), frameSize * 8);
278 NS_TEST_ASSERT_MSG_EQ_TOL (ps, 0.649, 0.001, "Not equal within tolerance");
279 snr = 22.0;
280 ps = nist->GetChunkSuccessRate (WifiMode ("OfdmRate48Mbps"), txVector, std::pow (10.0, snr / 10.0), frameSize * 8);
281 NS_TEST_ASSERT_MSG_EQ_TOL (ps, 0.983, 0.001, "Not equal within tolerance");
282 snr = 23.0;
283 ps = nist->GetChunkSuccessRate (WifiMode ("OfdmRate48Mbps"), txVector, std::pow (10.0, snr / 10.0), frameSize * 8);
284 NS_TEST_ASSERT_MSG_EQ_TOL (ps, 0.999, 0.001, "Not equal within tolerance");
285
286 snr = 21.0;
287 ps = nist->GetChunkSuccessRate (WifiMode ("OfdmRate54Mbps"), txVector, std::pow (10.0, snr / 10.0), frameSize * 8);
288 NS_TEST_ASSERT_MSG_EQ_TOL (ps, 5.44e-8, 1e-8, "Not equal within tolerance");
289 snr = 22.0;
290 ps = nist->GetChunkSuccessRate (WifiMode ("OfdmRate54Mbps"), txVector, std::pow (10.0, snr / 10.0), frameSize * 8);
291 NS_TEST_ASSERT_MSG_EQ_TOL (ps, 0.410, 0.001, "Not equal within tolerance");
292 snr = 23.0;
293 ps = nist->GetChunkSuccessRate (WifiMode ("OfdmRate54Mbps"), txVector, std::pow (10.0, snr / 10.0), frameSize * 8);
294 NS_TEST_ASSERT_MSG_EQ_TOL (ps, 0.958, 0.001, "Not equal within tolerance");
295 snr = 24.0;
296 ps = nist->GetChunkSuccessRate (WifiMode ("OfdmRate54Mbps"), txVector, std::pow (10.0, snr / 10.0), frameSize * 8);
297 NS_TEST_ASSERT_MSG_EQ_TOL (ps, 0.999, 0.001, "Not equal within tolerance");
298}
299
301{
302public:
303 using InterferenceHelper::InterferenceHelper;
304 using InterferenceHelper::CalculatePayloadChunkSuccessRate;
305 using InterferenceHelper::CalculateSnr;
306};
307
315{
316public:
319
320private:
321 void DoRun (void) override;
322};
323
325 : TestCase ("WifiErrorRateModel test case MIMO")
326{
327}
328
330{
331}
332
333void
335{
336 TestInterferenceHelper interference;
337 interference.SetNoiseFigure (0);
338 WifiMode mode = HtPhy::GetHtMcs0 ();
339 WifiTxVector txVector;
340
341 txVector.SetMode (mode);
342 txVector.SetTxPowerLevel (0);
343 txVector.SetChannelWidth (20);
344 txVector.SetNss (1);
345 txVector.SetNTx (1);
346
347 interference.SetNumberOfReceiveAntennas (1);
348 Ptr<NistErrorRateModel> nist = CreateObject<NistErrorRateModel> ();
349 interference.SetErrorRateModel (nist);
350
351 // SISO: initial SNR set to 4dB
352 double initialSnr = 4.0;
353 double snr = interference.CalculateSnr (0.001, 0.001 / DbToRatio (initialSnr), txVector.GetChannelWidth (), txVector.GetNss ());
354 NS_TEST_ASSERT_MSG_EQ_TOL (RatioToDb (snr), initialSnr, 0.1, "Attempt to set initial SNR to known value failed");
355 Time duration = MilliSeconds (2);
356 double chunkSuccess = interference.CalculatePayloadChunkSuccessRate (snr, duration, txVector);
357 NS_TEST_ASSERT_MSG_EQ_TOL (chunkSuccess, 0.905685, 0.000001, "CSR not within tolerance for SISO");
358 double sisoChunkSuccess = chunkSuccess;
359
360 // MIMO 2x1:2: expect no SNR gain in AWGN channel
361 txVector.SetNss (2);
362 txVector.SetNTx (2);
363 snr = interference.CalculateSnr (0.001, 0.001 / DbToRatio (initialSnr), txVector.GetChannelWidth (), txVector.GetNss ());
364 NS_TEST_ASSERT_MSG_EQ_TOL (RatioToDb (snr), initialSnr, 0.1, "SNR not within tolerance for 2x1:2 MIMO");
365 chunkSuccess = interference.CalculatePayloadChunkSuccessRate (snr, duration, txVector);
366 NS_TEST_ASSERT_MSG_EQ_TOL (chunkSuccess, 0.905685, 0.000001, "CSR not within tolerance for SISO");
367
368 // MIMO 1x2:1: expect that SNR is increased by a factor of 3 dB (10 log 2/1) compared to SISO thanks to RX diversity
369 txVector.SetNss (1);
370 txVector.SetNTx (1);
371 interference.SetNumberOfReceiveAntennas (2);
372 snr = interference.CalculateSnr (0.001, 0.001 / DbToRatio (initialSnr), txVector.GetChannelWidth (), txVector.GetNss ());
373 NS_TEST_ASSERT_MSG_EQ_TOL (RatioToDb (snr), initialSnr + 3, 0.1, "SNR not within tolerance for 1x2:1 MIMO");
374 chunkSuccess = interference.CalculatePayloadChunkSuccessRate (snr, duration, txVector);
375 NS_TEST_ASSERT_MSG_GT (chunkSuccess, sisoChunkSuccess, "CSR not within tolerance for 1x2:1 MIMO");
376
377 // MIMO 2x2:1: expect that SNR is increased by a factor of 3 dB (10 log 2/1) compared to SISO thanks to RX diversity
378 txVector.SetNss (1);
379 txVector.SetNTx (2);
380 interference.SetNumberOfReceiveAntennas (2);
381 snr = interference.CalculateSnr (0.001, 0.001 / DbToRatio (initialSnr), txVector.GetChannelWidth (), txVector.GetNss ());
382 NS_TEST_ASSERT_MSG_EQ_TOL (RatioToDb (snr), initialSnr + 3, 0.1, "SNR not equal within tolerance for 2x2:1 MIMO");
383 chunkSuccess = interference.CalculatePayloadChunkSuccessRate (snr, duration, txVector);
384 NS_TEST_ASSERT_MSG_GT (chunkSuccess, sisoChunkSuccess, "CSR not within tolerance for 2x2:1 MIMO");
385
386 // MIMO 2x2:2: expect no SNR gain in AWGN channel
387 txVector.SetNss (2);
388 txVector.SetNTx (2);
389 interference.SetNumberOfReceiveAntennas (2);
390 snr = interference.CalculateSnr (0.001, 0.001 / DbToRatio (initialSnr), txVector.GetChannelWidth (), txVector.GetNss ());
391 NS_TEST_ASSERT_MSG_EQ_TOL (RatioToDb (snr), initialSnr, 0.1, "SNR not equal within tolerance for 2x2:2 MIMO");
392 chunkSuccess = interference.CalculatePayloadChunkSuccessRate (snr, duration, txVector);
393 NS_TEST_ASSERT_MSG_EQ_TOL (chunkSuccess, sisoChunkSuccess, 0.000001, "CSR not within tolerance for 2x2:2 MIMO");
394
395 // MIMO 3x3:1: expect that SNR is increased by a factor of 4.8 dB (10 log 3/1) compared to SISO thanks to RX diversity
396 txVector.SetNss (1);
397 txVector.SetNTx (3);
398 interference.SetNumberOfReceiveAntennas (3);
399 snr = interference.CalculateSnr (0.001, 0.001 / DbToRatio (initialSnr), txVector.GetChannelWidth (), txVector.GetNss ());
400 NS_TEST_ASSERT_MSG_EQ_TOL (RatioToDb (snr), initialSnr + 4.8, 0.1, "SNR not within tolerance for 3x3:1 MIMO");
401 chunkSuccess = interference.CalculatePayloadChunkSuccessRate (snr, duration, txVector);
402 NS_TEST_ASSERT_MSG_GT (chunkSuccess, sisoChunkSuccess, "CSR not within tolerance for 3x3:1 MIMO");
403
404 // MIMO 3x3:2: expect that SNR is increased by a factor of 1.8 dB (10 log 3/2) compared to SISO thanks to RX diversity
405 txVector.SetNss (2);
406 txVector.SetNTx (3);
407 interference.SetNumberOfReceiveAntennas (3);
408 snr = interference.CalculateSnr (0.001, 0.001 / DbToRatio (initialSnr), txVector.GetChannelWidth (), txVector.GetNss ());
409 NS_TEST_ASSERT_MSG_EQ_TOL (RatioToDb (snr), initialSnr + 1.8, 0.1, "SNR not within tolerance for 3x3:2 MIMO");
410 chunkSuccess = interference.CalculatePayloadChunkSuccessRate (snr, duration, txVector);
411 NS_TEST_ASSERT_MSG_GT (chunkSuccess, sisoChunkSuccess, "CSR not within tolerance for 3x3:2 MIMO");
412
413 // MIMO 3x3:3: expect no SNR gain in AWGN channel
414 txVector.SetNss (3);
415 txVector.SetNTx (3);
416 interference.SetNumberOfReceiveAntennas (3);
417 snr = interference.CalculateSnr (0.001, 0.001 / DbToRatio (initialSnr), txVector.GetChannelWidth (), txVector.GetNss ());
418 NS_TEST_ASSERT_MSG_EQ_TOL (RatioToDb (snr), initialSnr, 0.1, "SNR not within tolerance for 3x3:3 MIMO");
419 chunkSuccess = interference.CalculatePayloadChunkSuccessRate (snr, duration, txVector);
420 NS_TEST_ASSERT_MSG_EQ_TOL (chunkSuccess, sisoChunkSuccess, 0.000001, "CSR not equal within tolerance for 3x3:3 MIMO");
421
422 // MIMO 4x4:1: expect that SNR is increased by a factor of 6 dB (10 log 4/1) compared to SISO thanks to RX diversity
423 txVector.SetNss (1);
424 txVector.SetNTx (4);
425 interference.SetNumberOfReceiveAntennas (4);
426 snr = interference.CalculateSnr (0.001, 0.001 / DbToRatio (initialSnr), txVector.GetChannelWidth (), txVector.GetNss ());
427 NS_TEST_ASSERT_MSG_EQ_TOL (RatioToDb (snr), initialSnr + 6, 0.1, "SNR not within tolerance for 4x4:1 MIMO");
428 chunkSuccess = interference.CalculatePayloadChunkSuccessRate (snr, duration, txVector);
429 NS_TEST_ASSERT_MSG_GT (chunkSuccess, sisoChunkSuccess, "CSR not within tolerance for 4x4:1 MIMO");
430
431 // MIMO 4x4:2: expect that SNR is increased by a factor of 3 dB (10 log 4/2) compared to SISO thanks to RX diversity
432 txVector.SetNss (2);
433 txVector.SetNTx (4);
434 interference.SetNumberOfReceiveAntennas (4);
435 snr = interference.CalculateSnr (0.001, 0.001 / DbToRatio (initialSnr), txVector.GetChannelWidth (), txVector.GetNss ());
436 NS_TEST_ASSERT_MSG_EQ_TOL (RatioToDb (snr), initialSnr + 3, 0.1, "SNR not within tolerance for 4x4:2 MIMO");
437 chunkSuccess = interference.CalculatePayloadChunkSuccessRate (snr, duration, txVector);
438 NS_TEST_ASSERT_MSG_GT (chunkSuccess, sisoChunkSuccess, "CSR not within tolerance for 4x4:2 MIMO");
439
440 // MIMO 4x4:3: expect that SNR is increased by a factor of 1.2 dB (10 log 4/3) compared to SISO thanks to RX diversity
441 txVector.SetNss (3);
442 txVector.SetNTx (4);
443 interference.SetNumberOfReceiveAntennas (4);
444 snr = interference.CalculateSnr (0.001, 0.001 / DbToRatio (initialSnr), txVector.GetChannelWidth (), txVector.GetNss ());
445 NS_TEST_ASSERT_MSG_EQ_TOL (RatioToDb (snr), initialSnr + 1.2, 0.1, "SNR not within tolerance for 4x4:3 MIMO");
446 chunkSuccess = interference.CalculatePayloadChunkSuccessRate (snr, duration, txVector);
447 NS_TEST_ASSERT_MSG_GT (chunkSuccess, sisoChunkSuccess, "CSR not within tolerance for 4x4:1 MIMO");
448
449 // MIMO 4x4:4: expect no SNR gain in AWGN channel
450 txVector.SetNss (4);
451 txVector.SetNTx (4);
452 interference.SetNumberOfReceiveAntennas (4);
453 snr = interference.CalculateSnr (0.001, 0.001 / DbToRatio (initialSnr), txVector.GetChannelWidth (), txVector.GetNss ());
454 NS_TEST_ASSERT_MSG_EQ_TOL (RatioToDb (snr), initialSnr, 0.1, "SNR not within tolerance for 4x4:4 MIMO");
455 chunkSuccess = interference.CalculatePayloadChunkSuccessRate (snr, duration, txVector);
456 NS_TEST_ASSERT_MSG_EQ_TOL (chunkSuccess, sisoChunkSuccess, 0.000001, "CSR not within tolerance for 4x4:4 MIMO");
457}
458
462std::map<std::pair <uint8_t /* mcs */, uint32_t /* size */>, std::map<double /* snr */, double /* per */> > expectedTableValues =
463{
464/* MCS 0 - 1458 bytes */
465 {std::make_pair (0, 1458), {
466 {-4.00, 1.00000},
467 {-3.75, 1.00000},
468 {-3.50, 1.00000},
469 {-3.25, 1.00000},
470 {-3.00, 1.00000},
471 {-2.75, 1.00000},
472 {-2.50, 1.00000},
473 {-2.25, 1.00000},
474 {-2.00, 1.00000},
475 {-1.75, 1.00000},
476 {-1.50, 1.00000},
477 {-1.25, 1.00000},
478 {-1.00, 1.00000},
479 {-0.75, 0.99700},
480 {-0.50, 0.99400},
481 {-0.25, 0.90625},
482 {0.00, 0.81850},
483 {0.25, 0.55465},
484 {0.50, 0.29080},
485 {0.75, 0.17855},
486 {1.00, 0.06630},
487 {1.25, 0.03875},
488 {1.50, 0.01120},
489 {1.75, 0.00635},
490 {2.00, 0.00150},
491 {2.25, 0.00083},
492 {2.50, 0.00015},
493 {2.75, 0.00008},
494 {3.00, 0.00001},
495 {3.25, 0.00000},
496 {3.50, 0.00000},
497 {3.75, 0.00000},
498 {4.00, 0.00000},
499 {4.25, 0.00000},
500 {4.50, 0.00000},
501 {4.75, 0.00000},
502 {5.00, 0.00000},
503 {5.25, 0.00000},
504 {5.50, 0.00000},
505 {5.75, 0.00000},
506 {6.00, 0.00000},
507 {6.25, 0.00000},
508 {6.50, 0.00000},
509 {6.75, 0.00000},
510 {7.00, 0.00000},
511 {7.25, 0.00000},
512 {7.50, 0.00000},
513 {7.75, 0.00000},
514 {8.00, 0.00000},
515 {8.25, 0.00000},
516 {8.50, 0.00000},
517 {8.75, 0.00000},
518 {9.00, 0.00000},
519 {9.25, 0.00000},
520 {9.50, 0.00000},
521 {9.75, 0.00000},
522 {10.00, 0.00000},
523 {10.25, 0.00000},
524 {10.50, 0.00000},
525 {10.75, 0.00000},
526 {11.00, 0.00000},
527 {11.25, 0.00000},
528 {11.50, 0.00000},
529 {11.75, 0.00000},
530 {12.00, 0.00000},
531 {12.25, 0.00000},
532 {12.50, 0.00000},
533 {12.75, 0.00000},
534 {13.00, 0.00000},
535 {13.25, 0.00000},
536 {13.50, 0.00000},
537 {13.75, 0.00000},
538 {14.00, 0.00000},
539 {14.25, 0.00000},
540 {14.50, 0.00000},
541 {14.75, 0.00000},
542 {15.00, 0.00000},
543 {15.25, 0.00000},
544 {15.50, 0.00000},
545 {15.75, 0.00000},
546 {16.00, 0.00000},
547 {16.25, 0.00000},
548 {16.50, 0.00000},
549 {16.75, 0.00000},
550 {17.00, 0.00000},
551 {17.25, 0.00000},
552 {17.50, 0.00000},
553 {17.75, 0.00000},
554 {18.00, 0.00000},
555 {18.25, 0.00000},
556 {18.50, 0.00000},
557 {18.75, 0.00000},
558 {19.00, 0.00000},
559 {19.25, 0.00000},
560 {19.50, 0.00000},
561 {19.75, 0.00000},
562 {20.00, 0.00000},
563 {20.25, 0.00000},
564 {20.50, 0.00000},
565 {20.75, 0.00000},
566 {21.00, 0.00000},
567 {21.25, 0.00000},
568 {21.50, 0.00000},
569 {21.75, 0.00000},
570 {22.00, 0.00000},
571 {22.25, 0.00000},
572 {22.50, 0.00000},
573 {22.75, 0.00000},
574 {23.00, 0.00000},
575 {23.25, 0.00000},
576 {23.50, 0.00000},
577 {23.75, 0.00000},
578 {24.00, 0.00000},
579 {24.25, 0.00000},
580 {24.50, 0.00000},
581 {24.75, 0.00000},
582 {25.00, 0.00000},
583 {25.25, 0.00000},
584 {25.50, 0.00000},
585 {25.75, 0.00000},
586 {26.00, 0.00000},
587 {26.25, 0.00000},
588 {26.50, 0.00000},
589 {26.75, 0.00000},
590 {27.00, 0.00000},
591 {27.25, 0.00000},
592 {27.50, 0.00000},
593 {27.75, 0.00000},
594 {28.00, 0.00000},
595 {28.25, 0.00000},
596 {28.50, 0.00000},
597 {28.75, 0.00000},
598 {29.00, 0.00000},
599 {29.25, 0.00000},
600 {29.50, 0.00000},
601 {29.75, 0.00000},
602 {30.00, 0.00000},
603 }},
604/* MCS 0 - 32 bytes */
605 {std::make_pair (0, 32), {
606 {-4.00, 1.00000},
607 {-3.75, 1.00000},
608 {-3.50, 1.00000},
609 {-3.25, 0.99750},
610 {-3.00, 0.99500},
611 {-2.75, 0.96790},
612 {-2.50, 0.94080},
613 {-2.25, 0.88335},
614 {-2.00, 0.82590},
615 {-1.75, 0.70770},
616 {-1.50, 0.58950},
617 {-1.25, 0.44890},
618 {-1.00, 0.30830},
619 {-0.75, 0.21685},
620 {-0.50, 0.12540},
621 {-0.25, 0.07990},
622 {0.00, 0.03440},
623 {0.25, 0.02145},
624 {0.50, 0.00850},
625 {0.75, 0.00500},
626 {1.00, 0.00150},
627 {1.25, 0.00087},
628 {1.50, 0.00024},
629 {1.75, 0.00017},
630 {2.00, 0.00009},
631 {2.25, 0.00005},
632 {2.50, 0.00000},
633 {2.75, 0.00000},
634 {3.00, 0.00000},
635 {3.25, 0.00000},
636 {3.50, 0.00000},
637 {3.75, 0.00000},
638 {4.00, 0.00000},
639 {4.25, 0.00000},
640 {4.50, 0.00000},
641 {4.75, 0.00000},
642 {5.00, 0.00000},
643 {5.25, 0.00000},
644 {5.50, 0.00000},
645 {5.75, 0.00000},
646 {6.00, 0.00000},
647 {6.25, 0.00000},
648 {6.50, 0.00000},
649 {6.75, 0.00000},
650 {7.00, 0.00000},
651 {7.25, 0.00000},
652 {7.50, 0.00000},
653 {7.75, 0.00000},
654 {8.00, 0.00000},
655 {8.25, 0.00000},
656 {8.50, 0.00000},
657 {8.75, 0.00000},
658 {9.00, 0.00000},
659 {9.25, 0.00000},
660 {9.50, 0.00000},
661 {9.75, 0.00000},
662 {10.00, 0.00000},
663 {10.25, 0.00000},
664 {10.50, 0.00000},
665 {10.75, 0.00000},
666 {11.00, 0.00000},
667 {11.25, 0.00000},
668 {11.50, 0.00000},
669 {11.75, 0.00000},
670 {12.00, 0.00000},
671 {12.25, 0.00000},
672 {12.50, 0.00000},
673 {12.75, 0.00000},
674 {13.00, 0.00000},
675 {13.25, 0.00000},
676 {13.50, 0.00000},
677 {13.75, 0.00000},
678 {14.00, 0.00000},
679 {14.25, 0.00000},
680 {14.50, 0.00000},
681 {14.75, 0.00000},
682 {15.00, 0.00000},
683 {15.25, 0.00000},
684 {15.50, 0.00000},
685 {15.75, 0.00000},
686 {16.00, 0.00000},
687 {16.25, 0.00000},
688 {16.50, 0.00000},
689 {16.75, 0.00000},
690 {17.00, 0.00000},
691 {17.25, 0.00000},
692 {17.50, 0.00000},
693 {17.75, 0.00000},
694 {18.00, 0.00000},
695 {18.25, 0.00000},
696 {18.50, 0.00000},
697 {18.75, 0.00000},
698 {19.00, 0.00000},
699 {19.25, 0.00000},
700 {19.50, 0.00000},
701 {19.75, 0.00000},
702 {20.00, 0.00000},
703 {20.25, 0.00000},
704 {20.50, 0.00000},
705 {20.75, 0.00000},
706 {21.00, 0.00000},
707 {21.25, 0.00000},
708 {21.50, 0.00000},
709 {21.75, 0.00000},
710 {22.00, 0.00000},
711 {22.25, 0.00000},
712 {22.50, 0.00000},
713 {22.75, 0.00000},
714 {23.00, 0.00000},
715 {23.25, 0.00000},
716 {23.50, 0.00000},
717 {23.75, 0.00000},
718 {24.00, 0.00000},
719 {24.25, 0.00000},
720 {24.50, 0.00000},
721 {24.75, 0.00000},
722 {25.00, 0.00000},
723 {25.25, 0.00000},
724 {25.50, 0.00000},
725 {25.75, 0.00000},
726 {26.00, 0.00000},
727 {26.25, 0.00000},
728 {26.50, 0.00000},
729 {26.75, 0.00000},
730 {27.00, 0.00000},
731 {27.25, 0.00000},
732 {27.50, 0.00000},
733 {27.75, 0.00000},
734 {28.00, 0.00000},
735 {28.25, 0.00000},
736 {28.50, 0.00000},
737 {28.75, 0.00000},
738 {29.00, 0.00000},
739 {29.25, 0.00000},
740 {29.50, 0.00000},
741 {29.75, 0.00000},
742 {30.00, 0.00000},
743 }},
744/* MCS 0 - 1000 bytes */
745 {std::make_pair (0, 1000), {
746 {-4.00, 1.00000},
747 {-3.75, 1.00000},
748 {-3.50, 1.00000},
749 {-3.25, 1.00000},
750 {-3.00, 1.00000},
751 {-2.75, 1.00000},
752 {-2.50, 1.00000},
753 {-2.25, 1.00000},
754 {-2.00, 1.00000},
755 {-1.75, 1.00000},
756 {-1.50, 1.00000},
757 {-1.25, 1.00000},
758 {-1.00, 1.00000},
759 {-0.75, 0.98140},
760 {-0.50, 0.97007},
761 {-0.25, 0.80280},
762 {0.00, 0.68977},
763 {0.25, 0.42581},
764 {0.50, 0.20997},
765 {0.75, 0.12620},
766 {1.00, 0.04596},
767 {1.25, 0.02674},
768 {1.50, 0.00770},
769 {1.75, 0.00436},
770 {2.00, 0.00103},
771 {2.25, 0.00057},
772 {2.50, 0.00010},
773 {2.75, 0.00005},
774 {3.00, 0.00001},
775 {3.25, 0.00000},
776 {3.50, 0.00000},
777 {3.75, 0.00000},
778 {4.00, 0.00000},
779 {4.25, 0.00000},
780 {4.50, 0.00000},
781 {4.75, 0.00000},
782 {5.00, 0.00000},
783 {5.25, 0.00000},
784 {5.50, 0.00000},
785 {5.75, 0.00000},
786 {6.00, 0.00000},
787 {6.25, 0.00000},
788 {6.50, 0.00000},
789 {6.75, 0.00000},
790 {7.00, 0.00000},
791 {7.25, 0.00000},
792 {7.50, 0.00000},
793 {7.75, 0.00000},
794 {8.00, 0.00000},
795 {8.25, 0.00000},
796 {8.50, 0.00000},
797 {8.75, 0.00000},
798 {9.00, 0.00000},
799 {9.25, 0.00000},
800 {9.50, 0.00000},
801 {9.75, 0.00000},
802 {10.00, 0.00000},
803 {10.25, 0.00000},
804 {10.50, 0.00000},
805 {10.75, 0.00000},
806 {11.00, 0.00000},
807 {11.25, 0.00000},
808 {11.50, 0.00000},
809 {11.75, 0.00000},
810 {12.00, 0.00000},
811 {12.25, 0.00000},
812 {12.50, 0.00000},
813 {12.75, 0.00000},
814 {13.00, 0.00000},
815 {13.25, 0.00000},
816 {13.50, 0.00000},
817 {13.75, 0.00000},
818 {14.00, 0.00000},
819 {14.25, 0.00000},
820 {14.50, 0.00000},
821 {14.75, 0.00000},
822 {15.00, 0.00000},
823 {15.25, 0.00000},
824 {15.50, 0.00000},
825 {15.75, 0.00000},
826 {16.00, 0.00000},
827 {16.25, 0.00000},
828 {16.50, 0.00000},
829 {16.75, 0.00000},
830 {17.00, 0.00000},
831 {17.25, 0.00000},
832 {17.50, 0.00000},
833 {17.75, 0.00000},
834 {18.00, 0.00000},
835 {18.25, 0.00000},
836 {18.50, 0.00000},
837 {18.75, 0.00000},
838 {19.00, 0.00000},
839 {19.25, 0.00000},
840 {19.50, 0.00000},
841 {19.75, 0.00000},
842 {20.00, 0.00000},
843 {20.25, 0.00000},
844 {20.50, 0.00000},
845 {20.75, 0.00000},
846 {21.00, 0.00000},
847 {21.25, 0.00000},
848 {21.50, 0.00000},
849 {21.75, 0.00000},
850 {22.00, 0.00000},
851 {22.25, 0.00000},
852 {22.50, 0.00000},
853 {22.75, 0.00000},
854 {23.00, 0.00000},
855 {23.25, 0.00000},
856 {23.50, 0.00000},
857 {23.75, 0.00000},
858 {24.00, 0.00000},
859 {24.25, 0.00000},
860 {24.50, 0.00000},
861 {24.75, 0.00000},
862 {25.00, 0.00000},
863 {25.25, 0.00000},
864 {25.50, 0.00000},
865 {25.75, 0.00000},
866 {26.00, 0.00000},
867 {26.25, 0.00000},
868 {26.50, 0.00000},
869 {26.75, 0.00000},
870 {27.00, 0.00000},
871 {27.25, 0.00000},
872 {27.50, 0.00000},
873 {27.75, 0.00000},
874 {28.00, 0.00000},
875 {28.25, 0.00000},
876 {28.50, 0.00000},
877 {28.75, 0.00000},
878 {29.00, 0.00000},
879 {29.25, 0.00000},
880 {29.50, 0.00000},
881 {29.75, 0.00000},
882 {30.00, 0.00000},
883 }},
884/* MCS 0 - 1 byte */
885 {std::make_pair (0, 1), {
886 {-4.00, 1.00000},
887 {-3.75, 1.00000},
888 {-3.50, 1.00000},
889 {-3.25, 0.17075},
890 {-3.00, 0.15260},
891 {-2.75, 0.10190},
892 {-2.50, 0.08455},
893 {-2.25, 0.06494},
894 {-2.00, 0.05316},
895 {-1.75, 0.03771},
896 {-1.50, 0.02744},
897 {-1.25, 0.01845},
898 {-1.00, 0.01145},
899 {-0.75, 0.00761},
900 {-0.50, 0.00418},
901 {-0.25, 0.00260},
902 {0.00, 0.00110},
903 {0.25, 0.00068},
904 {0.50, 0.00027},
905 {0.75, 0.00016},
906 {1.00, 0.00005},
907 {1.25, 0.00003},
908 {1.50, 0.00000},
909 {1.75, 0.00000},
910 {2.00, 0.00000},
911 {2.25, 0.00000},
912 {2.50, 0.00000},
913 {2.75, 0.00000},
914 {3.00, 0.00000},
915 {3.25, 0.00000},
916 {3.50, 0.00000},
917 {3.75, 0.00000},
918 {4.00, 0.00000},
919 {4.25, 0.00000},
920 {4.50, 0.00000},
921 {4.75, 0.00000},
922 {5.00, 0.00000},
923 {5.25, 0.00000},
924 {5.50, 0.00000},
925 {5.75, 0.00000},
926 {6.00, 0.00000},
927 {6.25, 0.00000},
928 {6.50, 0.00000},
929 {6.75, 0.00000},
930 {7.00, 0.00000},
931 {7.25, 0.00000},
932 {7.50, 0.00000},
933 {7.75, 0.00000},
934 {8.00, 0.00000},
935 {8.25, 0.00000},
936 {8.50, 0.00000},
937 {8.75, 0.00000},
938 {9.00, 0.00000},
939 {9.25, 0.00000},
940 {9.50, 0.00000},
941 {9.75, 0.00000},
942 {10.00, 0.00000},
943 {10.25, 0.00000},
944 {10.50, 0.00000},
945 {10.75, 0.00000},
946 {11.00, 0.00000},
947 {11.25, 0.00000},
948 {11.50, 0.00000},
949 {11.75, 0.00000},
950 {12.00, 0.00000},
951 {12.25, 0.00000},
952 {12.50, 0.00000},
953 {12.75, 0.00000},
954 {13.00, 0.00000},
955 {13.25, 0.00000},
956 {13.50, 0.00000},
957 {13.75, 0.00000},
958 {14.00, 0.00000},
959 {14.25, 0.00000},
960 {14.50, 0.00000},
961 {14.75, 0.00000},
962 {15.00, 0.00000},
963 {15.25, 0.00000},
964 {15.50, 0.00000},
965 {15.75, 0.00000},
966 {16.00, 0.00000},
967 {16.25, 0.00000},
968 {16.50, 0.00000},
969 {16.75, 0.00000},
970 {17.00, 0.00000},
971 {17.25, 0.00000},
972 {17.50, 0.00000},
973 {17.75, 0.00000},
974 {18.00, 0.00000},
975 {18.25, 0.00000},
976 {18.50, 0.00000},
977 {18.75, 0.00000},
978 {19.00, 0.00000},
979 {19.25, 0.00000},
980 {19.50, 0.00000},
981 {19.75, 0.00000},
982 {20.00, 0.00000},
983 {20.25, 0.00000},
984 {20.50, 0.00000},
985 {20.75, 0.00000},
986 {21.00, 0.00000},
987 {21.25, 0.00000},
988 {21.50, 0.00000},
989 {21.75, 0.00000},
990 {22.00, 0.00000},
991 {22.25, 0.00000},
992 {22.50, 0.00000},
993 {22.75, 0.00000},
994 {23.00, 0.00000},
995 {23.25, 0.00000},
996 {23.50, 0.00000},
997 {23.75, 0.00000},
998 {24.00, 0.00000},
999 {24.25, 0.00000},
1000 {24.50, 0.00000},
1001 {24.75, 0.00000},
1002 {25.00, 0.00000},
1003 {25.25, 0.00000},
1004 {25.50, 0.00000},
1005 {25.75, 0.00000},
1006 {26.00, 0.00000},
1007 {26.25, 0.00000},
1008 {26.50, 0.00000},
1009 {26.75, 0.00000},
1010 {27.00, 0.00000},
1011 {27.25, 0.00000},
1012 {27.50, 0.00000},
1013 {27.75, 0.00000},
1014 {28.00, 0.00000},
1015 {28.25, 0.00000},
1016 {28.50, 0.00000},
1017 {28.75, 0.00000},
1018 {29.00, 0.00000},
1019 {29.25, 0.00000},
1020 {29.50, 0.00000},
1021 {29.75, 0.00000},
1022 {30.00, 0.00000},
1023 }},
1024/* MCS 0 - 2000 bytes */
1025 {std::make_pair (0, 2000), {
1026 {-4.00, 1.00000},
1027 {-3.75, 1.00000},
1028 {-3.50, 1.00000},
1029 {-3.25, 1.00000},
1030 {-3.00, 1.00000},
1031 {-2.75, 1.00000},
1032 {-2.50, 1.00000},
1033 {-2.25, 1.00000},
1034 {-2.00, 1.00000},
1035 {-1.75, 1.00000},
1036 {-1.50, 1.00000},
1037 {-1.25, 1.00000},
1038 {-1.00, 1.00000},
1039 {-0.75, 0.99965},
1040 {-0.50, 0.99910},
1041 {-0.25, 0.96111},
1042 {0.00, 0.90376},
1043 {0.25, 0.67031},
1044 {0.50, 0.37584},
1045 {0.75, 0.23647},
1046 {1.00, 0.08981},
1047 {1.25, 0.05277},
1048 {1.50, 0.01533},
1049 {1.75, 0.00870},
1050 {2.00, 0.00206},
1051 {2.25, 0.00113},
1052 {2.50, 0.00021},
1053 {2.75, 0.00011},
1054 {3.00, 0.00001},
1055 {3.25, 0.00000},
1056 {3.50, 0.00000},
1057 {3.75, 0.00000},
1058 {4.00, 0.00000},
1059 {4.25, 0.00000},
1060 {4.50, 0.00000},
1061 {4.75, 0.00000},
1062 {5.00, 0.00000},
1063 {5.25, 0.00000},
1064 {5.50, 0.00000},
1065 {5.75, 0.00000},
1066 {6.00, 0.00000},
1067 {6.25, 0.00000},
1068 {6.50, 0.00000},
1069 {6.75, 0.00000},
1070 {7.00, 0.00000},
1071 {7.25, 0.00000},
1072 {7.50, 0.00000},
1073 {7.75, 0.00000},
1074 {8.00, 0.00000},
1075 {8.25, 0.00000},
1076 {8.50, 0.00000},
1077 {8.75, 0.00000},
1078 {9.00, 0.00000},
1079 {9.25, 0.00000},
1080 {9.50, 0.00000},
1081 {9.75, 0.00000},
1082 {10.00, 0.00000},
1083 {10.25, 0.00000},
1084 {10.50, 0.00000},
1085 {10.75, 0.00000},
1086 {11.00, 0.00000},
1087 {11.25, 0.00000},
1088 {11.50, 0.00000},
1089 {11.75, 0.00000},
1090 {12.00, 0.00000},
1091 {12.25, 0.00000},
1092 {12.50, 0.00000},
1093 {12.75, 0.00000},
1094 {13.00, 0.00000},
1095 {13.25, 0.00000},
1096 {13.50, 0.00000},
1097 {13.75, 0.00000},
1098 {14.00, 0.00000},
1099 {14.25, 0.00000},
1100 {14.50, 0.00000},
1101 {14.75, 0.00000},
1102 {15.00, 0.00000},
1103 {15.25, 0.00000},
1104 {15.50, 0.00000},
1105 {15.75, 0.00000},
1106 {16.00, 0.00000},
1107 {16.25, 0.00000},
1108 {16.50, 0.00000},
1109 {16.75, 0.00000},
1110 {17.00, 0.00000},
1111 {17.25, 0.00000},
1112 {17.50, 0.00000},
1113 {17.75, 0.00000},
1114 {18.00, 0.00000},
1115 {18.25, 0.00000},
1116 {18.50, 0.00000},
1117 {18.75, 0.00000},
1118 {19.00, 0.00000},
1119 {19.25, 0.00000},
1120 {19.50, 0.00000},
1121 {19.75, 0.00000},
1122 {20.00, 0.00000},
1123 {20.25, 0.00000},
1124 {20.50, 0.00000},
1125 {20.75, 0.00000},
1126 {21.00, 0.00000},
1127 {21.25, 0.00000},
1128 {21.50, 0.00000},
1129 {21.75, 0.00000},
1130 {22.00, 0.00000},
1131 {22.25, 0.00000},
1132 {22.50, 0.00000},
1133 {22.75, 0.00000},
1134 {23.00, 0.00000},
1135 {23.25, 0.00000},
1136 {23.50, 0.00000},
1137 {23.75, 0.00000},
1138 {24.00, 0.00000},
1139 {24.25, 0.00000},
1140 {24.50, 0.00000},
1141 {24.75, 0.00000},
1142 {25.00, 0.00000},
1143 {25.25, 0.00000},
1144 {25.50, 0.00000},
1145 {25.75, 0.00000},
1146 {26.00, 0.00000},
1147 {26.25, 0.00000},
1148 {26.50, 0.00000},
1149 {26.75, 0.00000},
1150 {27.00, 0.00000},
1151 {27.25, 0.00000},
1152 {27.50, 0.00000},
1153 {27.75, 0.00000},
1154 {28.00, 0.00000},
1155 {28.25, 0.00000},
1156 {28.50, 0.00000},
1157 {28.75, 0.00000},
1158 {29.00, 0.00000},
1159 {29.25, 0.00000},
1160 {29.50, 0.00000},
1161 {29.75, 0.00000},
1162 {30.00, 0.00000},
1163 }},
1164/* MCS 7 - 1500 bytes */
1165 {std::make_pair (7, 1500), {
1166 {-4.00, 1.00000},
1167 {-3.75, 1.00000},
1168 {-3.50, 1.00000},
1169 {-3.25, 1.00000},
1170 {-3.00, 1.00000},
1171 {-2.75, 1.00000},
1172 {-2.50, 1.00000},
1173 {-2.25, 1.00000},
1174 {-2.00, 1.00000},
1175 {-1.75, 1.00000},
1176 {-1.50, 1.00000},
1177 {-1.25, 1.00000},
1178 {-1.00, 1.00000},
1179 {-0.75, 1.00000},
1180 {-0.50, 1.00000},
1181 {-0.25, 1.00000},
1182 {0.00, 1.00000},
1183 {0.25, 1.00000},
1184 {0.50, 1.00000},
1185 {0.75, 1.00000},
1186 {1.00, 1.00000},
1187 {1.25, 1.00000},
1188 {1.50, 1.00000},
1189 {1.75, 1.00000},
1190 {2.00, 1.00000},
1191 {2.25, 1.00000},
1192 {2.50, 1.00000},
1193 {2.75, 1.00000},
1194 {3.00, 1.00000},
1195 {3.25, 1.00000},
1196 {3.50, 1.00000},
1197 {3.75, 1.00000},
1198 {4.00, 1.00000},
1199 {4.25, 1.00000},
1200 {4.50, 1.00000},
1201 {4.75, 1.00000},
1202 {5.00, 1.00000},
1203 {5.25, 1.00000},
1204 {5.50, 1.00000},
1205 {5.75, 1.00000},
1206 {6.00, 1.00000},
1207 {6.25, 1.00000},
1208 {6.50, 1.00000},
1209 {6.75, 1.00000},
1210 {7.00, 1.00000},
1211 {7.25, 1.00000},
1212 {7.50, 1.00000},
1213 {7.75, 1.00000},
1214 {8.00, 1.00000},
1215 {8.25, 1.00000},
1216 {8.50, 1.00000},
1217 {8.75, 1.00000},
1218 {9.00, 1.00000},
1219 {9.25, 1.00000},
1220 {9.50, 1.00000},
1221 {9.75, 1.00000},
1222 {10.00, 1.00000},
1223 {10.25, 1.00000},
1224 {10.50, 1.00000},
1225 {10.75, 1.00000},
1226 {11.00, 1.00000},
1227 {11.25, 1.00000},
1228 {11.50, 1.00000},
1229 {11.75, 1.00000},
1230 {12.00, 1.00000},
1231 {12.25, 1.00000},
1232 {12.50, 1.00000},
1233 {12.75, 1.00000},
1234 {13.00, 1.00000},
1235 {13.25, 1.00000},
1236 {13.50, 1.00000},
1237 {13.75, 1.00000},
1238 {14.00, 1.00000},
1239 {14.25, 1.00000},
1240 {14.50, 1.00000},
1241 {14.75, 1.00000},
1242 {15.00, 1.00000},
1243 {15.25, 1.00000},
1244 {15.50, 1.00000},
1245 {15.75, 1.00000},
1246 {16.00, 1.00000},
1247 {16.25, 1.00000},
1248 {16.50, 1.00000},
1249 {16.75, 1.00000},
1250 {17.00, 1.00000},
1251 {17.25, 1.00000},
1252 {17.50, 1.00000},
1253 {17.75, 0.99057},
1254 {18.00, 0.98075},
1255 {18.25, 0.86664},
1256 {18.50, 0.74920},
1257 {18.75, 0.54857},
1258 {19.00, 0.34531},
1259 {19.25, 0.23624},
1260 {19.50, 0.12672},
1261 {19.75, 0.08164},
1262 {20.00, 0.03650},
1263 {20.25, 0.02340},
1264 {20.50, 0.01029},
1265 {20.75, 0.00653},
1266 {21.00, 0.00278},
1267 {21.25, 0.00165},
1268 {21.50, 0.00051},
1269 {21.75, 0.00030},
1270 {22.00, 0.00009},
1271 {22.25, 0.00005},
1272 {22.50, 0.00001},
1273 {22.75, 0.00000},
1274 {23.00, 0.00000},
1275 {23.25, 0.00000},
1276 {23.50, 0.00000},
1277 {23.75, 0.00000},
1278 {24.00, 0.00000},
1279 {24.25, 0.00000},
1280 {24.50, 0.00000},
1281 {24.75, 0.00000},
1282 {25.00, 0.00000},
1283 {25.25, 0.00000},
1284 {25.50, 0.00000},
1285 {25.75, 0.00000},
1286 {26.00, 0.00000},
1287 {26.25, 0.00000},
1288 {26.50, 0.00000},
1289 {26.75, 0.00000},
1290 {27.00, 0.00000},
1291 {27.25, 0.00000},
1292 {27.50, 0.00000},
1293 {27.75, 0.00000},
1294 {28.00, 0.00000},
1295 {28.25, 0.00000},
1296 {28.50, 0.00000},
1297 {28.75, 0.00000},
1298 {29.00, 0.00000},
1299 {29.25, 0.00000},
1300 {29.50, 0.00000},
1301 {29.75, 0.00000},
1302 {30.00, 0.00000},
1303 }},
1304/* MCS 8 - 1500 bytes */
1305 {std::make_pair (8, 1500), {
1306 {-4.00, 1.00000},
1307 {-3.75, 1.00000},
1308 {-3.50, 1.00000},
1309 {-3.25, 1.00000},
1310 {-3.00, 1.00000},
1311 {-2.75, 1.00000},
1312 {-2.50, 1.00000},
1313 {-2.25, 1.00000},
1314 {-2.00, 1.00000},
1315 {-1.75, 1.00000},
1316 {-1.50, 1.00000},
1317 {-1.25, 1.00000},
1318 {-1.00, 1.00000},
1319 {-0.75, 1.00000},
1320 {-0.50, 1.00000},
1321 {-0.25, 1.00000},
1322 {0.00, 1.00000},
1323 {0.25, 1.00000},
1324 {0.50, 1.00000},
1325 {0.75, 1.00000},
1326 {1.00, 1.00000},
1327 {1.25, 1.00000},
1328 {1.50, 1.00000},
1329 {1.75, 1.00000},
1330 {2.00, 1.00000},
1331 {2.25, 1.00000},
1332 {2.50, 1.00000},
1333 {2.75, 1.00000},
1334 {3.00, 1.00000},
1335 {3.25, 1.00000},
1336 {3.50, 1.00000},
1337 {3.75, 1.00000},
1338 {4.00, 1.00000},
1339 {4.25, 1.00000},
1340 {4.50, 1.00000},
1341 {4.75, 1.00000},
1342 {5.00, 1.00000},
1343 {5.25, 1.00000},
1344 {5.50, 1.00000},
1345 {5.75, 1.00000},
1346 {6.00, 1.00000},
1347 {6.25, 1.00000},
1348 {6.50, 1.00000},
1349 {6.75, 1.00000},
1350 {7.00, 1.00000},
1351 {7.25, 1.00000},
1352 {7.50, 1.00000},
1353 {7.75, 1.00000},
1354 {8.00, 1.00000},
1355 {8.25, 1.00000},
1356 {8.50, 1.00000},
1357 {8.75, 1.00000},
1358 {9.00, 1.00000},
1359 {9.25, 1.00000},
1360 {9.50, 1.00000},
1361 {9.75, 1.00000},
1362 {10.00, 1.00000},
1363 {10.25, 1.00000},
1364 {10.50, 1.00000},
1365 {10.75, 1.00000},
1366 {11.00, 1.00000},
1367 {11.25, 1.00000},
1368 {11.50, 1.00000},
1369 {11.75, 1.00000},
1370 {12.00, 1.00000},
1371 {12.25, 1.00000},
1372 {12.50, 1.00000},
1373 {12.75, 1.00000},
1374 {13.00, 1.00000},
1375 {13.25, 1.00000},
1376 {13.50, 1.00000},
1377 {13.75, 1.00000},
1378 {14.00, 1.00000},
1379 {14.25, 1.00000},
1380 {14.50, 1.00000},
1381 {14.75, 1.00000},
1382 {15.00, 1.00000},
1383 {15.25, 1.00000},
1384 {15.50, 1.00000},
1385 {15.75, 1.00000},
1386 {16.00, 1.00000},
1387 {16.25, 1.00000},
1388 {16.50, 1.00000},
1389 {16.75, 1.00000},
1390 {17.00, 1.00000},
1391 {17.25, 1.00000},
1392 {17.50, 1.00000},
1393 {17.75, 1.00000},
1394 {18.00, 1.00000},
1395 {18.25, 1.00000},
1396 {18.50, 1.00000},
1397 {18.75, 1.00000},
1398 {19.00, 1.00000},
1399 {19.25, 1.00000},
1400 {19.50, 1.00000},
1401 {19.75, 1.00000},
1402 {20.00, 1.00000},
1403 {20.25, 1.00000},
1404 {20.50, 1.00000},
1405 {20.75, 1.00000},
1406 {21.00, 1.00000},
1407 {21.25, 0.99918},
1408 {21.50, 0.99833},
1409 {21.75, 0.97191},
1410 {22.00, 0.94458},
1411 {22.25, 0.81436},
1412 {22.50, 0.68127},
1413 {22.75, 0.52168},
1414 {23.00, 0.36056},
1415 {23.25, 0.25114},
1416 {23.50, 0.14127},
1417 {23.75, 0.09509},
1418 {24.00, 0.04883},
1419 {24.25, 0.03234},
1420 {24.50, 0.01584},
1421 {24.75, 0.01060},
1422 {25.00, 0.00535},
1423 {25.25, 0.00345},
1424 {25.50, 0.00154},
1425 {25.75, 0.00096},
1426 {26.00, 0.00037},
1427 {26.25, 0.00022},
1428 {26.50, 0.00007},
1429 {26.75, 0.00004},
1430 {27.00, 0.00000},
1431 {27.25, 0.00000},
1432 {27.50, 0.00000},
1433 {27.75, 0.00000},
1434 {28.00, 0.00000},
1435 {28.25, 0.00000},
1436 {28.50, 0.00000},
1437 {28.75, 0.00000},
1438 {29.00, 0.00000},
1439 {29.25, 0.00000},
1440 {29.50, 0.00000},
1441 {29.75, 0.00000},
1442 {30.00, 0.00000},
1443 }},
1444};
1445
1453{
1454public:
1462 TableBasedErrorRateTestCase (const std::string &testName, WifiMode mode, uint32_t size);
1464
1465private:
1466 void DoRun (void) override;
1467
1468 std::string m_testName;
1471};
1472
1474 : TestCase (testName),
1475 m_testName (testName),
1476 m_mode (mode),
1477 m_size (size)
1478{
1479}
1480
1482{
1483}
1484
1485void
1487{
1488 //LogComponentEnable ("WifiErrorRateModelsTest", LOG_LEVEL_ALL);
1489 //LogComponentEnable ("TableBasedErrorRateModel", LOG_LEVEL_ALL);
1490 //LogComponentEnable ("YansErrorRateModel", LOG_LEVEL_ALL);
1491
1492 Ptr<TableBasedErrorRateModel> table = CreateObject<TableBasedErrorRateModel> ();
1493 WifiTxVector txVector;
1494 txVector.SetMode (m_mode);
1495
1496 // Spot test some values returned from TableBasedErrorRateModel
1497 for (double snr = -4; snr <= 30; snr += 0.25)
1498 {
1499 double expectedValue = 0;
1501 {
1502 Ptr<YansErrorRateModel> yans = CreateObject<YansErrorRateModel> ();
1503 expectedValue = 1 - yans->GetChunkSuccessRate (m_mode, txVector, std::pow (10, snr / 10), m_size * 8);
1504 }
1505 else
1506 {
1507 auto it = expectedTableValues.find (std::make_pair (m_mode.GetMcsValue (), m_size));
1508 if (it != expectedTableValues.end ())
1509 {
1510 auto itValue = it->second.find (snr);
1511 if (itValue != it->second.end ())
1512 {
1513 expectedValue = itValue->second;
1514 }
1515 else
1516 {
1517 NS_FATAL_ERROR ("SNR value " << snr << " dB not found!");
1518 }
1519 }
1520 else
1521 {
1522 NS_FATAL_ERROR ("No expected value found for the combination MCS " << +m_mode.GetMcsValue () << " and size " << m_size << " bytes");
1523 }
1524 }
1525 double per = 1 - table->GetChunkSuccessRate (m_mode, txVector, std::pow (10, snr / 10), m_size * 8);
1526 NS_LOG_INFO (m_testName << ": snr=" << snr << "dB per=" << per << " expectedPER=" << expectedValue);
1527 NS_TEST_ASSERT_MSG_EQ_TOL (per, expectedValue, 1e-5, "Not equal within tolerance");
1528 }
1529}
1530
1538{
1539public:
1541};
1542
1544 : TestSuite ("wifi-error-rate-models", UNIT)
1545{
1546 AddTestCase (new WifiErrorRateModelsTestCaseDsss, TestCase::QUICK);
1547 AddTestCase (new WifiErrorRateModelsTestCaseNist, TestCase::QUICK);
1548 AddTestCase (new WifiErrorRateModelsTestCaseMimo, TestCase::QUICK);
1549 AddTestCase (new TableBasedErrorRateTestCase ("DefaultTableBasedHtMcs0-1458bytes", HtPhy::GetHtMcs0 (), 1458), TestCase::QUICK);
1550 AddTestCase (new TableBasedErrorRateTestCase ("DefaultTableBasedHtMcs0-32bytes", HtPhy::GetHtMcs0 (), 32), TestCase::QUICK);
1551 AddTestCase (new TableBasedErrorRateTestCase ("DefaultTableBasedHtMcs0-1000bytes", HtPhy::GetHtMcs0 (), 1000), TestCase::QUICK);
1552 AddTestCase (new TableBasedErrorRateTestCase ("DefaultTableBasedHtMcs0-1byte", HtPhy::GetHtMcs0 (), 1), TestCase::QUICK);
1553 AddTestCase (new TableBasedErrorRateTestCase ("DefaultTableBasedHtMcs0-2000bytes", HtPhy::GetHtMcs0 (), 2000), TestCase::QUICK);
1554 AddTestCase (new TableBasedErrorRateTestCase ("DefaultTableBasedHtMcs7-1500bytes", HtPhy::GetHtMcs7 (), 1500), TestCase::QUICK);
1555 AddTestCase (new TableBasedErrorRateTestCase ("DefaultTableBasedVhtMcs0-1458bytes", VhtPhy::GetVhtMcs0 (), 1458), TestCase::QUICK);
1556 AddTestCase (new TableBasedErrorRateTestCase ("DefaultTableBasedVhtMcs0-32bytes", VhtPhy::GetVhtMcs0 (), 32), TestCase::QUICK);
1557 AddTestCase (new TableBasedErrorRateTestCase ("DefaultTableBasedVhtMcs0-1000bytes", VhtPhy::GetVhtMcs0 (), 1000), TestCase::QUICK);
1558 AddTestCase (new TableBasedErrorRateTestCase ("DefaultTableBasedVhtMcs0-1byte", VhtPhy::GetVhtMcs0 (), 1), TestCase::QUICK);
1559 AddTestCase (new TableBasedErrorRateTestCase ("DefaultTableBasedVhtMcs0-2000bytes", VhtPhy::GetVhtMcs0 (), 2000), TestCase::QUICK);
1560 AddTestCase (new TableBasedErrorRateTestCase ("DefaultTableBasedVhtMcs8-1500bytes", VhtPhy::GetVhtMcs8 (), 1500), TestCase::QUICK);
1561 AddTestCase (new TableBasedErrorRateTestCase ("FallbackTableBasedHeMcs11-1458bytes", HePhy::GetHeMcs11 (), 1458), TestCase::QUICK);
1562}
1563
Wifi Table-based Error Rate Models Test Case.
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.
void DoRun(void) override
Implementation to actually run this TestCase.
Wifi Error Rate Models Test Case Dsss.
void DoRun(void) override
Implementation to actually run this TestCase.
Wifi Error Rate Models Test Case MIMO.
void DoRun(void) override
Implementation to actually run this TestCase.
Wifi Error Rate Models Test Case Nist.
void DoRun(void) override
Implementation to actually run this TestCase.
Wifi Error Rate Models Test Suite.
handles interference calculations
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.
double CalculateSnr(Ptr< Event > event, uint16_t channelWidth, uint8_t nss, WifiSpectrumBand band) const
Calculate the SNIR for the event (starting from now until the event end).
void SetNumberOfReceiveAntennas(uint8_t rx)
Set the number of RX antennas in the receiver corresponding to this interference helper.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
encapsulates test code
Definition: test.h:994
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:299
A suite of tests to run.
Definition: test.h:1188
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
represent a single transmission mode
Definition: wifi-mode.h:48
uint8_t GetMcsValue(void) const
Definition: wifi-mode.cc:155
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(uint16_t channelWidth)
Sets the selected channelWidth (in MHz)
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.
void SetNTx(uint8_t nTx)
Sets the number of TX antennas.
uint16_t GetChannelWidth(void) const
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.
Definition: fatal-error.h:165
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:281
#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:825
#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:323
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1253
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double RatioToDb(double ratio)
Convert from ratio to dB.
Definition: wifi-utils.cc:49
const uint8_t ERROR_TABLE_BCC_MAX_NUM_MCS
maximum number of MCSs for BCC
double DbToRatio(double dB)
Convert from dB to ratio.
Definition: wifi-utils.cc:31
std::map< std::pair< uint8_t, uint32_t >, std::map< double, double > > expectedTableValues
map of PER values that have been manually computed for a given MCS, size (in bytes) and SNR (in dB) i...
static double FromRss(double rssDbw)
static WifiErrorRateModelsTestSuite wifiErrorRateModelsTestSuite
the test suite