From 6056e854e1bcc9860053815eeef772ebd7fe47a6 Mon Sep 17 00:00:00 2001 From: Roberto Louro Magueta Date: Sat, 25 Jun 2022 18:07:09 +0100 Subject: [PATCH] Get TPMI up 4 antenna ports and 1 layer --- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 76 +++++++++++++++++-- openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h | 2 + .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 26 ++++++- 3 files changed, 94 insertions(+), 10 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index 7343b900fa..d9c39fa171 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -314,12 +314,76 @@ const uint8_t table_5_1_2_1_1_5_time_dom_res_alloc_C_dmrs_typeA_pos3[16][4]={ // TS 38.211 - Table 6.3.1.5-1: Precoding matrix W for single-layer transmission using two antenna ports, 'n' = -1 and 'o' = -j const char table_38211_6_3_1_5_1[6][2][1] = { - {{'1'}, {'0'}},//pmi 0 - {{'0'}, {'1'}}, - {{'1'}, {'1'}}, - {{'1'}, {'n'}}, - {{'1'}, {'j'}}, - {{'1'}, {'o'}} //pmi 5 + {{'1'}, {'0'}}, // tpmi 0 + {{'0'}, {'1'}}, // tpmi 1 + {{'1'}, {'1'}}, // tpmi 2 + {{'1'}, {'n'}}, // tpmi 3 + {{'1'}, {'j'}}, // tpmi 4 + {{'1'}, {'o'}} // tpmi 5 +}; + +// TS 38.211 - Table 6.3.1.5-2: Precoding matrix W for single-layer transmission using four antenna ports with transform precoding enabled, 'n' = -1 and 'o' = -j +const char table_38211_6_3_1_5_2[28][4][1] = { + {{'1'}, {'0'}, {'0'}, {'0'}}, // tpmi 0 + {{'0'}, {'1'}, {'0'}, {'0'}}, // tpmi 1 + {{'0'}, {'0'}, {'1'}, {'0'}}, // tpmi 2 + {{'0'}, {'0'}, {'0'}, {'1'}}, // tpmi 3 + {{'1'}, {'0'}, {'1'}, {'0'}}, // tpmi 4 + {{'1'}, {'0'}, {'n'}, {'0'}}, // tpmi 5 + {{'1'}, {'0'}, {'j'}, {'0'}}, // tpmi 6 + {{'1'}, {'0'}, {'o'}, {'0'}}, // tpmi 7 + {{'0'}, {'1'}, {'0'}, {'1'}}, // tpmi 8 + {{'0'}, {'1'}, {'0'}, {'n'}}, // tpmi 9 + {{'0'}, {'1'}, {'0'}, {'j'}}, // tpmi 10 + {{'0'}, {'1'}, {'0'}, {'o'}}, // tpmi 11 + {{'1'}, {'1'}, {'1'}, {'n'}}, // tpmi 12 + {{'1'}, {'1'}, {'j'}, {'j'}}, // tpmi 13 + {{'1'}, {'1'}, {'n'}, {'1'}}, // tpmi 14 + {{'1'}, {'1'}, {'o'}, {'o'}}, // tpmi 15 + {{'1'}, {'j'}, {'1'}, {'j'}}, // tpmi 16 + {{'1'}, {'j'}, {'j'}, {'1'}}, // tpmi 17 + {{'1'}, {'j'}, {'n'}, {'o'}}, // tpmi 18 + {{'1'}, {'j'}, {'o'}, {'n'}}, // tpmi 19 + {{'1'}, {'n'}, {'1'}, {'1'}}, // tpmi 20 + {{'1'}, {'n'}, {'j'}, {'o'}}, // tpmi 21 + {{'1'}, {'n'}, {'n'}, {'n'}}, // tpmi 22 + {{'1'}, {'n'}, {'o'}, {'j'}}, // tpmi 23 + {{'1'}, {'o'}, {'1'}, {'o'}}, // tpmi 24 + {{'1'}, {'o'}, {'j'}, {'n'}}, // tpmi 25 + {{'1'}, {'o'}, {'n'}, {'j'}}, // tpmi 26 + {{'1'}, {'o'}, {'o'}, {'1'}} // tpmi 27 +}; + +// TS 38.211 - Table 6.3.1.5-3: Precoding matrix W for single-layer transmission using four antenna ports with transform precoding disabled, 'n' = -1 and 'o' = -j +const char table_38211_6_3_1_5_3[28][4][1] = { + {{'1'}, {'0'}, {'0'}, {'0'}}, // tpmi 0 + {{'0'}, {'1'}, {'0'}, {'0'}}, // tpmi 1 + {{'0'}, {'0'}, {'1'}, {'0'}}, // tpmi 2 + {{'0'}, {'0'}, {'0'}, {'1'}}, // tpmi 3 + {{'1'}, {'0'}, {'1'}, {'0'}}, // tpmi 4 + {{'1'}, {'0'}, {'n'}, {'0'}}, // tpmi 5 + {{'1'}, {'0'}, {'j'}, {'0'}}, // tpmi 6 + {{'1'}, {'0'}, {'o'}, {'0'}}, // tpmi 7 + {{'0'}, {'1'}, {'0'}, {'1'}}, // tpmi 8 + {{'0'}, {'1'}, {'0'}, {'n'}}, // tpmi 9 + {{'0'}, {'1'}, {'0'}, {'j'}}, // tpmi 10 + {{'0'}, {'1'}, {'0'}, {'o'}}, // tpmi 11 + {{'1'}, {'1'}, {'1'}, {'1'}}, // tpmi 12 + {{'1'}, {'1'}, {'j'}, {'j'}}, // tpmi 13 + {{'1'}, {'1'}, {'n'}, {'n'}}, // tpmi 14 + {{'1'}, {'1'}, {'o'}, {'o'}}, // tpmi 15 + {{'1'}, {'j'}, {'1'}, {'j'}}, // tpmi 16 + {{'1'}, {'j'}, {'j'}, {'n'}}, // tpmi 17 + {{'1'}, {'j'}, {'n'}, {'o'}}, // tpmi 18 + {{'1'}, {'j'}, {'o'}, {'1'}}, // tpmi 19 + {{'1'}, {'n'}, {'1'}, {'n'}}, // tpmi 20 + {{'1'}, {'n'}, {'j'}, {'o'}}, // tpmi 21 + {{'1'}, {'n'}, {'n'}, {'1'}}, // tpmi 22 + {{'1'}, {'n'}, {'o'}, {'j'}}, // tpmi 23 + {{'1'}, {'o'}, {'1'}, {'o'}}, // tpmi 24 + {{'1'}, {'o'}, {'j'}, {'1'}}, // tpmi 25 + {{'1'}, {'o'}, {'n'}, {'j'}}, // tpmi 26 + {{'1'}, {'o'}, {'o'}, {'n'}} // tpmi 27 }; void get_info_from_tda_tables(int default_abc, diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h index 4829ee15d8..51b6eaefcd 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h @@ -144,4 +144,6 @@ extern const float table_38213_13_12_c3[16]; extern const int32_t table_38213_10_1_1_c2[5]; extern const char table_38211_6_3_1_5_1[6][2][1]; +extern const char table_38211_6_3_1_5_2[28][4][1]; +extern const char table_38211_6_3_1_5_3[28][4][1]; #endif //DEF_H diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index f7cf2cc4b9..d9a595b9e7 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -979,12 +979,29 @@ uint8_t get_max_tpmi(const NR_PUSCH_Config_t *pusch_Config, return max_tpmi; } -void get_precoder_matrix_coef(char *w, uint8_t tpmi, uint8_t uI) { - // TODO: Add the remaining tables - *w = *table_38211_6_3_1_5_1[tpmi][uI]; +void get_precoder_matrix_coef(char *w, + const uint8_t ul_ri, + const uint16_t num_ue_srs_ports, + const uint8_t transform_precoding, + const uint8_t tpmi, + const uint8_t uI) { + if (ul_ri == 0) { + if (num_ue_srs_ports == 2) { + *w = *table_38211_6_3_1_5_1[tpmi][uI]; + } else { + if (transform_precoding == NR_PUSCH_Config__transformPrecoder_enabled) { + *w = *table_38211_6_3_1_5_2[tpmi][uI]; + } else { + *w = *table_38211_6_3_1_5_3[tpmi][uI]; + } + } + } else { + AssertFatal(1==0,"Function get_precoder_matrix_coef() does not support %i layers yet!\n", ul_ri+1); + } } int nr_srs_tpmi_estimation(const NR_PUSCH_Config_t *pusch_Config, + const uint8_t transform_precoding, const uint8_t *channel_matrix, const uint8_t normalized_iq_representation, const uint16_t num_gnb_antenna_elements, @@ -1030,7 +1047,7 @@ int nr_srs_tpmi_estimation(const NR_PUSCH_Config_t *pusch_Config, for(int uI = 0; uI < num_ue_srs_ports; uI++) { uint16_t index = uI*num_gnb_antenna_elements*num_prgs + index_gI_pI; - get_precoder_matrix_coef(&w, tpmi, uI); + get_precoder_matrix_coef(&w, ul_ri, num_ue_srs_ports, transform_precoding, tpmi, uI); c16_t h_times_w = nr_h_times_w(channel_matrix16[index], w); precoded_channel_matrix_re[index_gI_pI] += h_times_w.r; @@ -1169,6 +1186,7 @@ void handle_nr_srs_measurements(const module_id_t module_id, ps->srs_feedback.sri = NR_SRS_SRI_0; ps->srs_feedback.ul_ri = 0; // TODO: Compute this ps->srs_feedback.tpmi = nr_srs_tpmi_estimation(ps->pusch_Config, + ps->transform_precoding, nr_srs_normalized_channel_iq_matrix.channel_matrix, nr_srs_normalized_channel_iq_matrix.normalized_iq_representation, nr_srs_normalized_channel_iq_matrix.num_gnb_antenna_elements,