diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h index f3a272330b..1dff70618e 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h @@ -577,6 +577,9 @@ typedef struct NR_UE_UL_BWP { int channel_bandwidth; // Minimum transmission power according to 38.101 6.3.1 float P_CMIN; + // SRS power control adjustment state + int h_b_f_c; + bool srs_power_control_initialized; } NR_UE_UL_BWP_t; // non-BWP serving cell configuration diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index fab0fb7a7c..be3413e308 100644 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -1513,6 +1513,7 @@ static void configure_common_BWP_ul(NR_UE_MAC_INST_t *mac, int bwp_id, NR_BWP_Up bwp->channel_bandwidth = get_supported_bw_mhz(mac->frequency_range, bw_index); // Minumum transmission power depends on bandwidth, precalculate it here bwp->P_CMIN = nr_get_Pcmin(bw_index); + bwp->srs_power_control_initialized = false; if (bwp_id == 0) { mac->sc_info.initial_ul_BWPSize = bwp->BWPSize; mac->sc_info.initial_ul_BWPStart = bwp->BWPStart; diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index aed42e6c53..c913321f80 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -609,8 +609,6 @@ typedef struct NR_UE_MAC_INST_s { bool pucch_power_control_initialized; int f_b_f_c; bool pusch_power_control_initialized; - int h_b_f_c; - bool srs_power_control_initialized; int delta_msg2; } NR_UE_MAC_INST_t; 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 fba8f63bd4..70d3aacb66 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_power_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_power_procedures.c @@ -653,22 +653,22 @@ int get_srs_tx_power_ue(NR_UE_MAC_INST_t *mac, == NR_SRS_ResourceSet__srs_PowerControlAdjustmentStates_separateClosedLoop; if (!is_tpc_accumulation_provided && (!is_configured_for_pusch_on_current_bwp || separate_pc_adjustment_state)) { - if (!mac->srs_power_control_initialized) { + if (!current_UL_BWP->srs_power_control_initialized) { NR_PRACH_RESOURCES_t *prach_resources = &mac->ra.prach_resources; float DELTA_P_rampup_requested = (prach_resources->RA_PREAMBLE_POWER_RAMPING_COUNTER - 1) * prach_resources->RA_PREAMBLE_POWER_RAMPING_STEP; float DELTA_P_rampup = P_CMAX - (P_0_SRS + m_srs_component + alpha * pathloss); DELTA_P_rampup = min(DELTA_P_rampup_requested, max(0, DELTA_P_rampup)); - mac->srs_power_control_initialized = true; - mac->h_b_f_c = DELTA_P_rampup + mac->delta_msg2; + current_UL_BWP->srs_power_control_initialized = true; + current_UL_BWP->h_b_f_c = DELTA_P_rampup + mac->delta_msg2; } else { int P_CMIN = mac->current_UL_BWP->P_CMIN; - if (!((srs_power_without_h_b_f_c + mac->h_b_f_c >= P_CMAX && delta_srs > 0) - || (srs_power_without_h_b_f_c + mac->h_b_f_c <= P_CMIN && delta_srs < 0))) { - mac->h_b_f_c += delta_srs; + if (!((srs_power_without_h_b_f_c + current_UL_BWP->h_b_f_c >= P_CMAX && delta_srs > 0) + || (srs_power_without_h_b_f_c + current_UL_BWP->h_b_f_c <= P_CMIN && delta_srs < 0))) { + current_UL_BWP->h_b_f_c += delta_srs; } } - h_b_f_c = mac->h_b_f_c; + h_b_f_c = current_UL_BWP->h_b_f_c; } else { // Case 3: No accumulation h_b_f_c = delta_srs; 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 26f9681079..760de0df3d 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 @@ -695,8 +695,7 @@ TEST(test_srs_power, tpc_accumulation) mac.nr_band = 78; mac.f_b_f_c = 0; mac.pusch_power_control_initialized = true; - mac.srs_power_control_initialized = true; - mac.h_b_f_c = 0; + current_UL_BWP.srs_power_control_initialized = true; NR_SRS_Config_t srs_Config = {0}; current_UL_BWP.srs_Config = &srs_Config;