laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/21568 )
Change subject: power_control: make raise/lower step limitation configurable ...................................................................... power_control: make raise/lower step limitation configurable Change-Id: Ic37742f46f533865043b3dbcf16ea702e1746f98 Related: SYS#4918 --- M include/osmo-bts/bts.h M include/osmo-bts/power_control.h M src/common/bts.c M src/common/power_control.c M tests/power/bs_power_loop_test.c M tests/power/bs_power_loop_test.err M tests/power/bs_power_loop_test.ok M tests/power/ms_power_loop_test.c 8 files changed, 64 insertions(+), 36 deletions(-) Approvals: laforge: Looks good to me, approved pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h index 48f404c..2edc20e 100644 --- a/include/osmo-bts/bts.h +++ b/include/osmo-bts/bts.h @@ -107,6 +107,10 @@ int target_dbm; /* Tolerated deviation from target */ int hysteresis_db; + /* How many dB do we raise power at maximum */ + int raise_step_max_db; + /* How many dB do we lower power at maximum */ + int lower_step_max_db; /* RxLev filtering algorithm */ enum bts_pf_algo pf_algo; /* (Optional) filtering parameters */ diff --git a/include/osmo-bts/power_control.h b/include/osmo-bts/power_control.h index f2e14cf..ab107b8 100644 --- a/include/osmo-bts/power_control.h +++ b/include/osmo-bts/power_control.h @@ -3,6 +3,10 @@ #include <stdint.h> #include <osmo-bts/gsm_data.h> +/* How many dB do we raise/lower power as maximum */ +#define PWR_RAISE_MAX_DB 4 +#define PWR_LOWER_MAX_DB 8 + int lchan_ms_pwr_ctrl(struct gsm_lchan *lchan, const uint8_t ms_power_lvl, const int8_t ul_rssi_dbm); diff --git a/src/common/bts.c b/src/common/bts.c index e021864..ba24497 100644 --- a/src/common/bts.c +++ b/src/common/bts.c @@ -53,6 +53,7 @@ #include <osmo-bts/cbch.h> #include <osmo-bts/bts_shutdown_fsm.h> #include <osmo-bts/nm_common_fsm.h> +#include <osmo-bts/power_control.h> #define MIN_QUAL_RACH 50 /* minimum link quality (in centiBels) for Access Bursts */ #define MIN_QUAL_NORM -5 /* minimum link quality (in centiBels) for Normal Bursts */ @@ -334,6 +335,8 @@ (struct bts_power_ctrl_params) { .target_dbm = -75, .hysteresis_db = 3, /* -78 .. -72 dBm */ + .raise_step_max_db = PWR_RAISE_MAX_DB, + .lower_step_max_db = PWR_LOWER_MAX_DB, .pf_algo = BTS_PF_ALGO_EWMA, .pf = { .ewma = { diff --git a/src/common/power_control.c b/src/common/power_control.c index d458a92..a616f18 100644 --- a/src/common/power_control.c +++ b/src/common/power_control.c @@ -33,10 +33,6 @@ #include <osmo-bts/l1sap.h> #include <osmo-bts/power_control.h> -/* how many dB do we raise/lower as maximum (1 ms power level = 2 dB) */ -#define PWR_RAISE_MAX_DB 4 -#define PWR_LOWER_MAX_DB 8 - /* We don't want to deal with floating point, so we scale up */ #define EWMA_SCALE_FACTOR 100 @@ -122,10 +118,10 @@ /* Don't ever change more than PWR_{LOWER,RAISE}_MAX_DBM during one loop * iteration, i.e. reduce the speed at which the MS transmit power can * change. A higher value means a lower level (and vice versa) */ - if (delta > PWR_RAISE_MAX_DB) - delta = PWR_RAISE_MAX_DB; - else if (delta < -PWR_LOWER_MAX_DB) - delta = -PWR_LOWER_MAX_DB; + if (delta > params->raise_step_max_db) + delta = params->raise_step_max_db; + else if (delta < -params->lower_step_max_db) + delta = -params->lower_step_max_db; return delta; } diff --git a/tests/power/bs_power_loop_test.c b/tests/power/bs_power_loop_test.c index 2f60cc0..fd93183 100644 --- a/tests/power/bs_power_loop_test.c +++ b/tests/power/bs_power_loop_test.c @@ -31,6 +31,15 @@ #define PWR_TEST_RXLEV_TARGET 30 +#define PWR_TEST_CFG_RXLEV_TARGET \ + .target_dbm = -110 + PWR_TEST_RXLEV_TARGET + +/* NOTE: raise/lower values are intentionally swapped here, + * as it makes more sense in the context of BS Power Control. */ +#define PWR_TEST_CFG_RAISE_LOWER_MAX \ + .raise_step_max_db = PWR_LOWER_MAX_DB, \ + .lower_step_max_db = PWR_RAISE_MAX_DB + #define DL_MEAS_FULL(rxqual, rxlev) \ .rxqual_full = rxqual, \ .rxlev_full = rxlev @@ -95,10 +104,15 @@ g_trx = gsm_bts_trx_alloc(g_bts); OSMO_ASSERT(g_trx != NULL); - g_bts->dl_power_ctrl.target_dbm = rxlev2dbm(PWR_TEST_RXLEV_TARGET); g_bts->band = GSM_BAND_900; g_bts->c0 = g_trx; + g_bts->dl_power_ctrl = g_bts->ul_power_ctrl = \ + (struct bts_power_ctrl_params) { + PWR_TEST_CFG_RXLEV_TARGET, + PWR_TEST_CFG_RAISE_LOWER_MAX, + }; + printf("\nStarting test case '%s'\n", name); } @@ -326,7 +340,8 @@ /* Enable hysteresis */ { .type = PWR_TEST_ST_SET_PARAMS, .params = { - .target_dbm = -110 + PWR_TEST_RXLEV_TARGET, + PWR_TEST_CFG_RXLEV_TARGET, + PWR_TEST_CFG_RAISE_LOWER_MAX, .hysteresis_db = 3, } }, @@ -347,7 +362,8 @@ /* Enable EWMA based power filtering */ { .type = PWR_TEST_ST_SET_PARAMS, .params = { - .target_dbm = -110 + PWR_TEST_RXLEV_TARGET, /* RxLev 30 */ + PWR_TEST_CFG_RXLEV_TARGET, + PWR_TEST_CFG_RAISE_LOWER_MAX, .pf_algo = BTS_PF_ALGO_EWMA, .pf.ewma.alpha = 50, } diff --git a/tests/power/bs_power_loop_test.err b/tests/power/bs_power_loop_test.err index 44d996e..43063c0 100644 --- a/tests/power/bs_power_loop_test.err +++ b/tests/power/bs_power_loop_test.err @@ -7,29 +7,29 @@ (bts=0,trx=0,ts=0,ss=0) Rx DL Measurement Report: RXLEV-FULL(30), RXQUAL-FULL(0), RXLEV-SUB(30), RXQUAL-SUB(0), DTx is disabled => using FULL (bts=0,trx=0,ts=0,ss=0) Keeping Downlink attenuation at 0 dB (maximum 20 dB, target -80 dBm, delta 0 dB) (bts=0,trx=0,ts=0,ss=0) Rx DL Measurement Report: RXLEV-FULL(60), RXQUAL-FULL(0), RXLEV-SUB(60), RXQUAL-SUB(0), DTx is disabled => using FULL -(bts=0,trx=0,ts=0,ss=0) Changing Downlink attenuation: 0 -> 8 dB (maximum 20 dB, target -80 dBm, delta -8 dB) +(bts=0,trx=0,ts=0,ss=0) Changing Downlink attenuation: 0 -> 4 dB (maximum 20 dB, target -80 dBm, delta -4 dB) (bts=0,trx=0,ts=0,ss=0) Rx DL Measurement Report: RXLEV-FULL(60), RXQUAL-FULL(0), RXLEV-SUB(60), RXQUAL-SUB(0), DTx is disabled => using FULL -(bts=0,trx=0,ts=0,ss=0) Changing Downlink attenuation: 8 -> 16 dB (maximum 20 dB, target -80 dBm, delta -8 dB) +(bts=0,trx=0,ts=0,ss=0) Changing Downlink attenuation: 4 -> 8 dB (maximum 20 dB, target -80 dBm, delta -4 dB) (bts=0,trx=0,ts=0,ss=0) Rx DL Measurement Report: RXLEV-FULL(60), RXQUAL-FULL(0), RXLEV-SUB(60), RXQUAL-SUB(0), DTx is disabled => using FULL -(bts=0,trx=0,ts=0,ss=0) Changing Downlink attenuation: 16 -> 20 dB (maximum 20 dB, target -80 dBm, delta -8 dB) +(bts=0,trx=0,ts=0,ss=0) Changing Downlink attenuation: 8 -> 12 dB (maximum 20 dB, target -80 dBm, delta -4 dB) (bts=0,trx=0,ts=0,ss=0) Rx DL Measurement Report: RXLEV-FULL(60), RXQUAL-FULL(0), RXLEV-SUB(60), RXQUAL-SUB(0), DTx is disabled => using FULL -(bts=0,trx=0,ts=0,ss=0) Keeping Downlink attenuation at 20 dB (maximum 20 dB, target -80 dBm, delta -8 dB) +(bts=0,trx=0,ts=0,ss=0) Changing Downlink attenuation: 12 -> 16 dB (maximum 20 dB, target -80 dBm, delta -4 dB) (bts=0,trx=0,ts=0,ss=0) Rx DL Measurement Report: RXLEV-FULL(60), RXQUAL-FULL(0), RXLEV-SUB(60), RXQUAL-SUB(0), DTx is disabled => using FULL -(bts=0,trx=0,ts=0,ss=0) Keeping Downlink attenuation at 20 dB (maximum 20 dB, target -80 dBm, delta -8 dB) +(bts=0,trx=0,ts=0,ss=0) Changing Downlink attenuation: 16 -> 20 dB (maximum 20 dB, target -80 dBm, delta -4 dB) (bts=0,trx=0,ts=0,ss=0) Rx DL Measurement Report: RXLEV-FULL(60), RXQUAL-FULL(0), RXLEV-SUB(60), RXQUAL-SUB(0), DTx is disabled => using FULL -(bts=0,trx=0,ts=0,ss=0) Keeping Downlink attenuation at 20 dB (maximum 20 dB, target -80 dBm, delta -8 dB) +(bts=0,trx=0,ts=0,ss=0) Keeping Downlink attenuation at 20 dB (maximum 20 dB, target -80 dBm, delta -4 dB) (bts=0,trx=0,ts=0,ss=0) Rx DL Measurement Report: RXLEV-FULL(60), RXQUAL-FULL(0), RXLEV-SUB(60), RXQUAL-SUB(0), DTx is disabled => using FULL -(bts=0,trx=0,ts=0,ss=0) Keeping Downlink attenuation at 20 dB (maximum 20 dB, target -80 dBm, delta -8 dB) +(bts=0,trx=0,ts=0,ss=0) Keeping Downlink attenuation at 20 dB (maximum 20 dB, target -80 dBm, delta -4 dB) (bts=0,trx=0,ts=0,ss=0) Rx DL Measurement Report: RXLEV-FULL(10), RXQUAL-FULL(0), RXLEV-SUB(10), RXQUAL-SUB(0), DTx is disabled => using FULL -(bts=0,trx=0,ts=0,ss=0) Changing Downlink attenuation: 20 -> 16 dB (maximum 20 dB, target -80 dBm, delta 4 dB) +(bts=0,trx=0,ts=0,ss=0) Changing Downlink attenuation: 20 -> 12 dB (maximum 20 dB, target -80 dBm, delta 8 dB) (bts=0,trx=0,ts=0,ss=0) Rx DL Measurement Report: RXLEV-FULL(10), RXQUAL-FULL(0), RXLEV-SUB(10), RXQUAL-SUB(0), DTx is disabled => using FULL -(bts=0,trx=0,ts=0,ss=0) Changing Downlink attenuation: 16 -> 12 dB (maximum 20 dB, target -80 dBm, delta 4 dB) +(bts=0,trx=0,ts=0,ss=0) Changing Downlink attenuation: 12 -> 4 dB (maximum 20 dB, target -80 dBm, delta 8 dB) (bts=0,trx=0,ts=0,ss=0) Rx DL Measurement Report: RXLEV-FULL(10), RXQUAL-FULL(0), RXLEV-SUB(10), RXQUAL-SUB(0), DTx is disabled => using FULL -(bts=0,trx=0,ts=0,ss=0) Changing Downlink attenuation: 12 -> 8 dB (maximum 20 dB, target -80 dBm, delta 4 dB) +(bts=0,trx=0,ts=0,ss=0) Changing Downlink attenuation: 4 -> 0 dB (maximum 20 dB, target -80 dBm, delta 8 dB) (bts=0,trx=0,ts=0,ss=0) Rx DL Measurement Report: RXLEV-FULL(10), RXQUAL-FULL(0), RXLEV-SUB(10), RXQUAL-SUB(0), DTx is disabled => using FULL -(bts=0,trx=0,ts=0,ss=0) Changing Downlink attenuation: 8 -> 4 dB (maximum 20 dB, target -80 dBm, delta 4 dB) +(bts=0,trx=0,ts=0,ss=0) Keeping Downlink attenuation at 0 dB (maximum 20 dB, target -80 dBm, delta 8 dB) (bts=0,trx=0,ts=0,ss=0) Rx DL Measurement Report: RXLEV-FULL(10), RXQUAL-FULL(0), RXLEV-SUB(10), RXQUAL-SUB(0), DTx is disabled => using FULL -(bts=0,trx=0,ts=0,ss=0) Changing Downlink attenuation: 4 -> 0 dB (maximum 20 dB, target -80 dBm, delta 4 dB) +(bts=0,trx=0,ts=0,ss=0) Keeping Downlink attenuation at 0 dB (maximum 20 dB, target -80 dBm, delta 8 dB) (bts=0,trx=0,ts=0,ss=0) Rx DL Measurement Report: RXLEV-FULL(30), RXQUAL-FULL(0), RXLEV-SUB(30), RXQUAL-SUB(0), DTx is disabled => using FULL (bts=0,trx=0,ts=0,ss=0) Keeping Downlink attenuation at 0 dB (maximum 20 dB, target -80 dBm, delta 0 dB) (bts=0,trx=0,ts=0,ss=0) Rx DL Measurement Report: RXLEV-FULL(30), RXQUAL-FULL(0), RXLEV-SUB(30), RXQUAL-SUB(0), DTx is disabled => using FULL diff --git a/tests/power/bs_power_loop_test.ok b/tests/power/bs_power_loop_test.ok index fe2eb78..acaad82 100644 --- a/tests/power/bs_power_loop_test.ok +++ b/tests/power/bs_power_loop_test.ok @@ -39,19 +39,19 @@ #00 exec_power_step() <- State (re)set (current 0 dB, max 20 dB) #01 enc_meas_rep() -> Measurement Results (valid): RXLEV-FULL(60), RXQUAL-FULL(0), RXLEV-SUB(60), RXQUAL-SUB(0) #01 lchan_bs_pwr_ctrl() <- UL SACCH: 06 15 3c 3c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -#01 lchan_bs_pwr_ctrl() -> BS power reduction: 0 -> 8 (expected 4) +#01 lchan_bs_pwr_ctrl() -> BS power reduction: 0 -> 4 (expected 4) #02 enc_meas_rep() -> Measurement Results (valid): RXLEV-FULL(60), RXQUAL-FULL(0), RXLEV-SUB(60), RXQUAL-SUB(0) #02 lchan_bs_pwr_ctrl() <- UL SACCH: 06 15 3c 3c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -#02 lchan_bs_pwr_ctrl() -> BS power reduction: 8 -> 16 (expected 8) +#02 lchan_bs_pwr_ctrl() -> BS power reduction: 4 -> 8 (expected 8) #03 enc_meas_rep() -> Measurement Results (valid): RXLEV-FULL(60), RXQUAL-FULL(0), RXLEV-SUB(60), RXQUAL-SUB(0) #03 lchan_bs_pwr_ctrl() <- UL SACCH: 06 15 3c 3c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -#03 lchan_bs_pwr_ctrl() -> BS power reduction: 16 -> 20 (expected 12) +#03 lchan_bs_pwr_ctrl() -> BS power reduction: 8 -> 12 (expected 12) #04 enc_meas_rep() -> Measurement Results (valid): RXLEV-FULL(60), RXQUAL-FULL(0), RXLEV-SUB(60), RXQUAL-SUB(0) #04 lchan_bs_pwr_ctrl() <- UL SACCH: 06 15 3c 3c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -#04 lchan_bs_pwr_ctrl() -> BS power reduction: 20 -> 20 (expected 16) +#04 lchan_bs_pwr_ctrl() -> BS power reduction: 12 -> 16 (expected 16) #05 enc_meas_rep() -> Measurement Results (valid): RXLEV-FULL(60), RXQUAL-FULL(0), RXLEV-SUB(60), RXQUAL-SUB(0) #05 lchan_bs_pwr_ctrl() <- UL SACCH: 06 15 3c 3c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -#05 lchan_bs_pwr_ctrl() -> BS power reduction: 20 -> 20 (expected 20) +#05 lchan_bs_pwr_ctrl() -> BS power reduction: 16 -> 20 (expected 20) #06 enc_meas_rep() -> Measurement Results (valid): RXLEV-FULL(60), RXQUAL-FULL(0), RXLEV-SUB(60), RXQUAL-SUB(0) #06 lchan_bs_pwr_ctrl() <- UL SACCH: 06 15 3c 3c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 #06 lchan_bs_pwr_ctrl() -> BS power reduction: 20 -> 20 (expected 20) @@ -60,20 +60,20 @@ #07 lchan_bs_pwr_ctrl() -> BS power reduction: 20 -> 20 (expected 20) #08 enc_meas_rep() -> Measurement Results (valid): RXLEV-FULL(10), RXQUAL-FULL(0), RXLEV-SUB(10), RXQUAL-SUB(0) #08 lchan_bs_pwr_ctrl() <- UL SACCH: 06 15 0a 0a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -#08 lchan_bs_pwr_ctrl() -> BS power reduction: 20 -> 16 (expected 12) +#08 lchan_bs_pwr_ctrl() -> BS power reduction: 20 -> 12 (expected 12) #09 enc_meas_rep() -> Measurement Results (valid): RXLEV-FULL(10), RXQUAL-FULL(0), RXLEV-SUB(10), RXQUAL-SUB(0) #09 lchan_bs_pwr_ctrl() <- UL SACCH: 06 15 0a 0a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -#09 lchan_bs_pwr_ctrl() -> BS power reduction: 16 -> 12 (expected 4) +#09 lchan_bs_pwr_ctrl() -> BS power reduction: 12 -> 4 (expected 4) #10 enc_meas_rep() -> Measurement Results (valid): RXLEV-FULL(10), RXQUAL-FULL(0), RXLEV-SUB(10), RXQUAL-SUB(0) #10 lchan_bs_pwr_ctrl() <- UL SACCH: 06 15 0a 0a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -#10 lchan_bs_pwr_ctrl() -> BS power reduction: 12 -> 8 (expected 0) +#10 lchan_bs_pwr_ctrl() -> BS power reduction: 4 -> 0 (expected 0) #11 enc_meas_rep() -> Measurement Results (valid): RXLEV-FULL(10), RXQUAL-FULL(0), RXLEV-SUB(10), RXQUAL-SUB(0) #11 lchan_bs_pwr_ctrl() <- UL SACCH: 06 15 0a 0a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -#11 lchan_bs_pwr_ctrl() -> BS power reduction: 8 -> 4 (expected 0) +#11 lchan_bs_pwr_ctrl() -> BS power reduction: 0 -> 0 (expected 0) #12 enc_meas_rep() -> Measurement Results (valid): RXLEV-FULL(10), RXQUAL-FULL(0), RXLEV-SUB(10), RXQUAL-SUB(0) #12 lchan_bs_pwr_ctrl() <- UL SACCH: 06 15 0a 0a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -#12 lchan_bs_pwr_ctrl() -> BS power reduction: 4 -> 0 (expected 0) -Test case verdict: FAIL +#12 lchan_bs_pwr_ctrl() -> BS power reduction: 0 -> 0 (expected 0) +Test case verdict: SUCCESS Starting test case 'TC_dtxd_mode' #00 exec_power_step() <- State (re)set (current 0 dB, max 20 dB) diff --git a/tests/power/ms_power_loop_test.c b/tests/power/ms_power_loop_test.c index 4f4f746..ea3c249 100644 --- a/tests/power/ms_power_loop_test.c +++ b/tests/power/ms_power_loop_test.c @@ -47,11 +47,16 @@ g_trx->ms_pwr_ctl_soft = true; - g_bts->ul_power_ctrl.target_dbm = -75; - g_bts->dl_power_ctrl.target_dbm = -75; g_bts->band = GSM_BAND_1800; g_bts->c0 = g_trx; + g_bts->ul_power_ctrl = g_bts->dl_power_ctrl = \ + (struct bts_power_ctrl_params) { + .target_dbm = -75, + .raise_step_max_db = PWR_RAISE_MAX_DB, + .lower_step_max_db = PWR_LOWER_MAX_DB, + }; + printf("\nStarting test case '%s'\n", name); } -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/21568 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: Ic37742f46f533865043b3dbcf16ea702e1746f98 Gerrit-Change-Number: 21568 Gerrit-PatchSet: 3 Gerrit-Owner: fixeria <vyanits...@sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <lafo...@osmocom.org> Gerrit-Reviewer: pespin <pes...@sysmocom.de> Gerrit-MessageType: merged