From d41a6e0524e3f597a37f56d105008e119fc91259 Mon Sep 17 00:00:00 2001 From: Bartosz Podrygajlo <bartosz.podrygajlo@openairinterface.org> Date: Wed, 19 Jun 2024 15:10:25 +0200 Subject: [PATCH] Remove hardcode for minimum TX power --- openair2/LAYER2/NR_MAC_UE/mac_proto.h | 2 ++ openair2/LAYER2/NR_MAC_UE/nr_ue_power_procedures.c | 10 +++++++++- .../NR_MAC_UE/tests/test_nr_ue_power_procedures.cpp | 10 +++++++++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/mac_proto.h b/openair2/LAYER2/NR_MAC_UE/mac_proto.h index 1bbdba61eb2..96e6238128a 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_proto.h @@ -238,6 +238,8 @@ float nr_get_Pcmax(int p_Max, int n_prbs, int start_prb); +float nr_get_Pcmin(int scs, int nr_band, int N_RB_UL); + int get_sum_delta_pucch(NR_UE_MAC_INST_t *mac, int slot, frame_t frame); /* Random Access */ diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_power_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_power_procedures.c index e874af44f27..459c93f26de 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_power_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_power_procedures.c @@ -224,6 +224,14 @@ float nr_get_Pcmax(int p_Max, } } +float nr_get_Pcmin(int scs, int nr_band, int N_RB_UL) { + int band_index = get_supported_band_index(nr_band > 256 ? FR2 : FR1, scs, N_RB_UL); + const float table_38101_6_3_1_1[] = { + -40, -40, -40, -40, -39, -38.2, -37.5, -37, -36.5, -35.2, -34.6, -34, -33.5, -33 + }; + return table_38101_6_3_1_1[band_index]; +} + // This is not entirely correct. In certain k2/k1/k0 settings we might postpone accumulating delta_PUCCH until next HARQ feedback // slot. The correct way to do this would be to calculate the K_PUCCH (delta_PUCCH summation window end) for each PUCCH occasion and // compare PUCCH transmission symbol with the reception symbol of the DCI containing delta_PUCCH to determine if the delta_PUCCH @@ -339,7 +347,7 @@ int16_t get_pucch_tx_power_ue(NR_UE_MAC_INST_t *mac, format_type == 2, 1, start_prb); - int P_CMIN = -40; // TODO: minimum TX power, possibly 38.101-1 6.3.1 + int P_CMIN = nr_get_Pcmin(mac->current_UL_BWP->scs, mac->nr_band, mac->current_UL_BWP->BWPSize); int16_t pathloss = compute_nr_SSB_PL(mac, mac->ssb_measurements.ssb_rsrp_dBm); if (power_config->twoPUCCH_PC_AdjustmentStates && *power_config->twoPUCCH_PC_AdjustmentStates > 1) { diff --git a/openair2/LAYER2/NR_MAC_UE/tests/test_nr_ue_power_procedures.cpp b/openair2/LAYER2/NR_MAC_UE/tests/test_nr_ue_power_procedures.cpp index 67b63e55154..cb2714791b5 100644 --- a/openair2/LAYER2/NR_MAC_UE/tests/test_nr_ue_power_procedures.cpp +++ b/openair2/LAYER2/NR_MAC_UE/tests/test_nr_ue_power_procedures.cpp @@ -104,7 +104,6 @@ TEST(test_pucch_power_state, test_accumulated_delta_pucch) uint16_t start_prb = 0; int P_CMAX = nr_get_Pcmax(23, mac.nr_band, FR1, 2, false, current_UL_BWP.scs, current_UL_BWP.BWPSize, false, nb_of_prbs, start_prb); - int pucch_power_prev = get_pucch_tx_power_ue(&mac, scs, &pucch_Config, @@ -165,6 +164,15 @@ TEST(test_pucch_power_state, test_accumulated_delta_pucch) } } +TEST(pc_min, check_all_bw_indexes) { + const int NB_RB_UL[] ={ + 11, 24, 38, 51, 65, 78, 106, 133, 162, 217, 245, 273 + }; + for (auto i = 0U; i < sizeof(NB_RB_UL)/sizeof(NB_RB_UL[0]); i++) { + (void)nr_get_Pcmin(1, 20, NB_RB_UL[i]); + } +} + int main(int argc, char** argv) { logInit(); -- GitLab