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