Commit 7359c6b6 authored by Bartosz Podrygajlo's avatar Bartosz Podrygajlo

Move h_b_f_c to UL BWP

Move h_b_f_c (or SRS power control adjustment state) to UL BWP structure. This is a per
bwp parameter so it makes sense to make its lifetime the same as BWP, even if we dont support
>1 UL BWPs.
parent bfc47445
......@@ -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
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment