From fe7d6dd6e82df4b0cf0d95469bc599fd26fbd7bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deronne?= Date: Mon, 21 Sep 2020 20:18:11 +0200 Subject: [PATCH] wifi: Add error rate table for LDPC FEC encoding --- src/wifi/model/reference/error-rate-tables.h | 88 +++++++++++++++++-- .../model/table-based-error-rate-model.cc | 9 +- src/wifi/test/wifi-error-rate-models-test.cc | 2 +- 3 files changed, 89 insertions(+), 10 deletions(-) diff --git a/src/wifi/model/reference/error-rate-tables.h b/src/wifi/model/reference/error-rate-tables.h index 070e9e4a4..0a927e14b 100644 --- a/src/wifi/model/reference/error-rate-tables.h +++ b/src/wifi/model/reference/error-rate-tables.h @@ -25,11 +25,13 @@ namespace ns3 { -const uint16_t ERROR_TABLE_SMALL_FRAME_SIZE = 32; -const uint16_t ERROR_TABLE_LARGE_FRAME_SIZE = 1458; -const uint8_t ERROR_TABLE_MAX_NUM_MCS = 9; +const uint16_t ERROR_TABLE_BCC_SMALL_FRAME_SIZE = 32; +const uint16_t ERROR_TABLE_BCC_LARGE_FRAME_SIZE = 1458; +const uint16_t ERROR_TABLE_LDPC_FRAME_SIZE = 1458; +const uint8_t ERROR_TABLE_BCC_MAX_NUM_MCS = 9; +const uint8_t ERROR_TABLE_LDPC_MAX_NUM_MCS = 11; -static const std::vector > AwgnErrorTable32 [ERROR_TABLE_MAX_NUM_MCS + 1] = { +static const std::vector > AwgnErrorTableBcc32 [ERROR_TABLE_BCC_MAX_NUM_MCS + 1] = { // MCS-0 { {-3.20000, 1.00000}, {-3.00000, 0.99751}, {-2.80000, 0.98526}, {-2.60000, 0.97805}, {-2.40000, 0.95933}, @@ -129,7 +131,7 @@ static const std::vector > Aw }, }; -static const std::vector > AwgnErrorTable1458 [ERROR_TABLE_MAX_NUM_MCS + 1] = { +static const std::vector > AwgnErrorTableBcc1458 [ERROR_TABLE_BCC_MAX_NUM_MCS + 1] = { // MCS-0 { {-0.80000, 1.00000}, {-0.60000, 0.99751}, {-0.40000, 0.98284}, {-0.20000, 0.93473}, {0.00000, 0.77713}, @@ -216,6 +218,82 @@ static const std::vector > Aw }, }; +static const std::vector > AwgnErrorTableLdpc1458 [ERROR_TABLE_LDPC_MAX_NUM_MCS + 1] = { + // MCS-0 + { + {-1.50000, 1.00000}, {-1.25000, 0.97950}, {-1.00000, 0.60480}, {-0.75000, 0.17050}, + {-0.50000, 0.03320}, {-0.25000, 0.00530}, {0.00000, 0.00085}, {0.25000, 0.00022}, + {0.50000, 0.00004}, {0.75000, 0.00000}, + }, + // MCS-1 + { + {1.50000, 1.00000}, {1.75000, 0.97470}, {2.00000, 0.62330}, {2.25000, 0.18590}, + {2.50000, 0.03400}, {2.75000, 0.00550}, {3.00000, 0.00083}, {3.25000, 0.00015}, + {3.50000, 0.00003}, {3.75000, 0.00000}, + }, + // MCS-2 + { + {4.00000, 1.00000}, {4.25000, 0.98720}, {4.50000, 0.62560}, {4.75000, 0.15800}, + {5.00000, 0.02090}, {5.25000, 0.00250}, {5.50000, 0.00034}, {5.75000, 0.00003}, + {6.00000, 0.00000}, + }, + // MCS-3 + { + {6.75000, 1.00000}, {7.00000, 0.99800}, {7.25000, 0.94340}, {7.50000, 0.57890}, + {7.75000, 0.20640}, {8.00000, 0.04840}, {8.25000, 0.00930}, {8.50000, 0.00180}, + {8.75000, 0.00040}, {9.00000, 0.00011}, {9.25000, 0.00002}, {9.50000, 0.00000}, + }, + // MCS-4 + { + {10.00000, 1.00000}, {10.25000, 0.99310}, {10.50000, 0.70890}, {10.75000, 0.24720}, + {11.00000, 0.04700}, {11.25000, 0.00590}, {11.50000, 0.00091}, {11.75000, 0.00016}, + {12.00000, 0.00003}, {12.25000, 0.00000} + }, + // MCS-5 + { + {14.00000, 1.00000}, {14.25000, 0.99700}, {14.50000, 0.91830}, {14.75000, 0.53790}, + {15.00000, 0.16610}, {15.25000, 0.03690}, {15.50000, 0.00650}, {15.75000, 0.00100}, + {16.00000, 0.00031}, {16.25000, 0.00005}, {16.50000, 0.00000}, + }, + // MCS-6 + { + {15.50000, 1.00000}, {15.75000, 0.98140}, {16.00000, 0.73930}, {16.25000, 0.33110}, + {16.50000, 0.08150}, {16.75000, 0.01620}, {17.00000, 0.00270}, {17.25000, 0.00052}, + {17.50000, 0.00005}, {17.75000, 0.00003}, {18.00000, 0.00000}, + }, + // MCS-7 + { + {17.00000, 1.00000}, {17.25000, 0.97750}, {17.50000, 0.73980}, {17.75000, 0.33190}, + {18.00000, 0.09640}, {18.25000, 0.02180}, {18.50000, 0.00470}, {18.75000, 0.00087}, + {19.00000, 0.00018}, {19.25000, 0.00003}, {19.50000, 0.00000}, + }, + // MCS-8 + { + {20.50000, 1.00000}, {20.75000, 0.99500}, {21.00000, 0.89700}, {21.25000, 0.56270}, + {21.50000, 0.20920}, {21.75000, 0.05600}, {22.00000, 0.01170}, {22.25000, 0.00250}, + {22.50000, 0.00038}, {22.75000, 0.00013}, {23.00000, 0.00004}, {23.25000, 0.00001}, + {23.50000, 0.00000}, + }, + // MCS-9 + { + {22.25000, 1.00000}, {22.50000, 0.99900}, {22.75000, 0.94080}, {23.00000, 0.63600}, + {23.25000, 0.27190}, {23.50000, 0.08700}, {23.75000, 0.02210}, {24.00000, 0.00500}, + {24.25000, 0.00110}, {24.50000, 0.00032}, {24.75000, 0.00004}, {25.00000, 0.00000}, + }, + // MCS-10 + { + {25.75000, 1.00000}, {26.00000, 0.94970}, {26.25000, 0.68660}, {26.50000, 0.32940}, + {26.75000, 0.11620}, {27.00000, 0.03440}, {27.25000, 0.00880}, {27.50000, 0.00210}, + {27.75000, 0.00054}, {28.00000, 0.00009}, {28.25000, 0.00002}, {28.50000, 0.00000}, + }, + // MCS-11 + { + {27.75000, 1.00000}, {28.00000, 0.94880}, {28.25000, 0.75260}, {28.50000, 0.40230}, + {28.75000, 0.16210}, {29.00000, 0.05150}, {29.25000, 0.01310}, {29.50000, 0.00360}, + {29.75000, 0.00100}, {30.00000, 0.00022}, {30.25000, 0.00006}, {30.50000, 0.00000}, + }, +}; + } //namespace ns3 #endif /* ERROR_RATE_TABLES_H */ diff --git a/src/wifi/model/table-based-error-rate-model.cc b/src/wifi/model/table-based-error-rate-model.cc index 440a3afb3..4072dbeed 100644 --- a/src/wifi/model/table-based-error-rate-model.cc +++ b/src/wifi/model/table-based-error-rate-model.cc @@ -146,7 +146,8 @@ TableBasedErrorRateModel::DoGetChunkSuccessRate (WifiMode mode, WifiTxVector txV uint64_t size = std::max (1, (nbits / 8)); double roundedSnr = RoundSnr (RatioToDb (snr), SNR_PRECISION); uint8_t mcs = GetMcsForMode (mode); - NS_LOG_FUNCTION (this << +mcs << roundedSnr << size); + bool ldpc = txVector.IsLdpc (); + NS_LOG_FUNCTION (this << +mcs << roundedSnr << size << ldpc); // HT: for mcs greater than 7, use 0 - 7 curves for data rate if (mode.GetModulationClass () == WIFI_MOD_CLASS_HT) @@ -154,13 +155,13 @@ TableBasedErrorRateModel::DoGetChunkSuccessRate (WifiMode mode, WifiTxVector txV mcs = mcs % 8; } - if (mcs > ERROR_TABLE_MAX_NUM_MCS) + if (mcs > (ldpc ? ERROR_TABLE_LDPC_MAX_NUM_MCS : ERROR_TABLE_BCC_MAX_NUM_MCS)) { NS_LOG_WARN ("Table missing for MCS: " << +mcs << " in TableBasedErrorRateModel: use fallback error rate model"); return m_fallbackErrorModel->GetChunkSuccessRate (mode, txVector, snr, nbits); } - auto errorTable = size < m_threshold ? AwgnErrorTable32 : AwgnErrorTable1458; + auto errorTable = (ldpc ? AwgnErrorTableLdpc1458 : (size < m_threshold ? AwgnErrorTableBcc32 : AwgnErrorTableBcc1458)); auto itVector = errorTable[mcs]; auto itTable = std::find_if (itVector.begin(), itVector.end(), [&roundedSnr](const std::pair& element) { @@ -204,7 +205,7 @@ TableBasedErrorRateModel::DoGetChunkSuccessRate (WifiMode mode, WifiTxVector txV per = itTable->second; } - uint16_t tableSize = size < m_threshold ? ERROR_TABLE_SMALL_FRAME_SIZE : ERROR_TABLE_LARGE_FRAME_SIZE; + uint16_t tableSize = (ldpc ? ERROR_TABLE_LDPC_FRAME_SIZE : (size < m_threshold ? ERROR_TABLE_BCC_SMALL_FRAME_SIZE : ERROR_TABLE_BCC_LARGE_FRAME_SIZE)); if (size != tableSize) { // From IEEE document 11-14/0803r1 (Packet Length for Box 0 Calibration) diff --git a/src/wifi/test/wifi-error-rate-models-test.cc b/src/wifi/test/wifi-error-rate-models-test.cc index bfad40b04..3358d45c3 100644 --- a/src/wifi/test/wifi-error-rate-models-test.cc +++ b/src/wifi/test/wifi-error-rate-models-test.cc @@ -1020,7 +1020,7 @@ TableBasedErrorRateTestCase::DoRun (void) for (double snr = -4.0; snr <= 30.0; snr += 0.5) { double expectedValue = 0; - if (m_mode.GetMcsValue () > ERROR_TABLE_MAX_NUM_MCS) + if (m_mode.GetMcsValue () > ERROR_TABLE_BCC_MAX_NUM_MCS) { Ptr yans = CreateObject (); expectedValue = 1 - yans->GetChunkSuccessRate (m_mode, txVector, std::pow (10.0, snr / 10.0), m_size * 8);