laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/21499 )
Change subject: power_control: clarify units in 'struct bts_power_ctrl_params' ...................................................................... power_control: clarify units in 'struct bts_power_ctrl_params' Change-Id: Icb059ca1f555397be116a424800e4536883b9106 Related: SYS#4918 --- M include/osmo-bts/bts.h M src/common/bts.c M src/common/power_control.c M src/common/vty.c M src/osmo-bts-lc15/oml.c M src/osmo-bts-oc2g/oml.c M src/osmo-bts-sysmo/oml.c M src/osmo-bts-sysmo/sysmobts_vty.c M src/osmo-bts-trx/trx_vty.c M tests/power/bs_power_loop_test.c M tests/power/ms_power_loop_test.c 11 files changed, 42 insertions(+), 42 deletions(-) Approvals: Jenkins Builder: Verified pespin: Looks good to me, but someone else must approve laforge: Looks good to me, approved diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h index 3847a26..48f404c 100644 --- a/include/osmo-bts/bts.h +++ b/include/osmo-bts/bts.h @@ -104,9 +104,9 @@ /* UL/DL power control parameters */ struct bts_power_ctrl_params { /* Target value to strive to */ - int target; + int target_dbm; /* Tolerated deviation from target */ - int hysteresis; + int hysteresis_db; /* RxLev filtering algorithm */ enum bts_pf_algo pf_algo; /* (Optional) filtering parameters */ diff --git a/src/common/bts.c b/src/common/bts.c index a974b9f..e021864 100644 --- a/src/common/bts.c +++ b/src/common/bts.c @@ -332,8 +332,8 @@ /* Default UL/DL power control parameters */ bts->ul_power_ctrl = bts->dl_power_ctrl = \ (struct bts_power_ctrl_params) { - .target = -75, /* dBm default */ - .hysteresis = 3, /* -78 .. -72 dBm */ + .target_dbm = -75, + .hysteresis_db = 3, /* -78 .. -72 dBm */ .pf_algo = BTS_PF_ALGO_EWMA, .pf = { .ewma = { diff --git a/src/common/power_control.c b/src/common/power_control.c index a8bf031..d458a92 100644 --- a/src/common/power_control.c +++ b/src/common/power_control.c @@ -113,10 +113,10 @@ /* How many dBs measured power should be increased (+) or decreased (-) * to reach expected power. */ - delta = params->target - rxlev_dbm_avg; + delta = params->target_dbm - rxlev_dbm_avg; /* Tolerate small deviations from 'rx-target' */ - if (abs(delta) <= params->hysteresis) + if (abs(delta) <= params->hysteresis_db) return 0; /* Don't ever change more than PWR_{LOWER,RAISE}_MAX_DBM during one loop @@ -192,7 +192,7 @@ LOGPLCHAN(lchan, DLOOP, LOGL_INFO, "Keeping MS power at control level %d, %d dBm " "(rx-ms-pwr-lvl %" PRIu8 ", max-ms-pwr-lvl %" PRIu8 ", rx-current %d dBm, rx-target %d dBm)\n", new_power_lvl, new_dbm, ms_power_lvl, state->max, - ul_rssi_dbm, params->target); + ul_rssi_dbm, params->target_dbm); return 0; } @@ -201,7 +201,7 @@ "(rx-ms-pwr-lvl %" PRIu8 ", max-ms-pwr-lvl %" PRIu8 ", rx-current %d dBm, rx-target %d dBm)\n", (new_dbm > current_dbm) ? "Raising" : "Lowering", state->current, current_dbm, new_power_lvl, new_dbm, - ms_power_lvl, state->max, ul_rssi_dbm, params->target); + ms_power_lvl, state->max, ul_rssi_dbm, params->target_dbm); /* store the resulting new MS power level in the lchan */ state->current = new_power_lvl; @@ -301,13 +301,13 @@ if (state->current != new) { LOGPLCHAN(lchan, DLOOP, LOGL_INFO, "Changing Downlink attenuation: " "%u -> %u dB (maximum %u dB, target %d dBm, delta %d dB)\n", - state->current, new, state->max, params->target, delta); + state->current, new, state->max, params->target_dbm, delta); state->current = new; return 1; } else { LOGPLCHAN(lchan, DLOOP, LOGL_INFO, "Keeping Downlink attenuation " "at %u dB (maximum %u dB, target %d dBm, delta %d dB)\n", - state->current, state->max, params->target, delta); + state->current, state->max, params->target_dbm, delta); return 0; } } diff --git a/src/common/vty.c b/src/common/vty.c index 5d21e58..bbb0ba1 100644 --- a/src/common/vty.c +++ b/src/common/vty.c @@ -255,9 +255,9 @@ VTY_NEWLINE); vty_out(vty, " paging lifetime %u%s", paging_get_lifetime(bts->paging_state), VTY_NEWLINE); - vty_out(vty, " uplink-power-target %d", bts->ul_power_ctrl.target); - if (bts->ul_power_ctrl.hysteresis > 0) - vty_out(vty, " hysteresis %d", bts->ul_power_ctrl.hysteresis); + vty_out(vty, " uplink-power-target %d", bts->ul_power_ctrl.target_dbm); + if (bts->ul_power_ctrl.hysteresis_db > 0) + vty_out(vty, " hysteresis %d", bts->ul_power_ctrl.hysteresis_db); vty_out(vty, "%s", VTY_NEWLINE); /* MS Tx power filtering algorithm and parameters */ @@ -633,8 +633,8 @@ { struct gsm_bts *bts = vty->index; - bts->ul_power_ctrl.target = atoi(argv[0]); - bts->ul_power_ctrl.hysteresis = 0; + bts->ul_power_ctrl.target_dbm = atoi(argv[0]); + bts->ul_power_ctrl.hysteresis_db = 0; return CMD_SUCCESS; } @@ -650,8 +650,8 @@ { struct gsm_bts *bts = vty->index; - bts->ul_power_ctrl.target = atoi(argv[0]); - bts->ul_power_ctrl.hysteresis = atoi(argv[1]); + bts->ul_power_ctrl.target_dbm = atoi(argv[0]); + bts->ul_power_ctrl.hysteresis_db = atoi(argv[1]); return CMD_SUCCESS; } diff --git a/src/osmo-bts-lc15/oml.c b/src/osmo-bts-lc15/oml.c index 0fb9d00..4c71790 100644 --- a/src/osmo-bts-lc15/oml.c +++ b/src/osmo-bts-lc15/oml.c @@ -434,7 +434,7 @@ dev_par->u16BcchArfcn = trx->bts->c0->arfcn; dev_par->u8NbTsc = trx->bts->bsic & 7; dev_par->fRxPowerLevel = trx_ms_pwr_ctrl_is_osmo(trx) - ? 0.0 : trx->bts->ul_power_ctrl.target; + ? 0.0 : trx->bts->ul_power_ctrl.target_dbm; dev_par->fTxPowerLevel = 0.0; LOGP(DL1C, LOGL_NOTICE, "Init TRX (Band %d, ARFCN %u, TSC %u, RxPower % 2f dBm, " diff --git a/src/osmo-bts-oc2g/oml.c b/src/osmo-bts-oc2g/oml.c index be0ec30..b62e61c 100644 --- a/src/osmo-bts-oc2g/oml.c +++ b/src/osmo-bts-oc2g/oml.c @@ -449,7 +449,7 @@ dev_par->u16BcchArfcn = trx->bts->c0->arfcn; dev_par->u8NbTsc = trx->bts->bsic & 7; dev_par->fRxPowerLevel = trx_ms_pwr_ctrl_is_osmo(trx) - ? 0.0 : trx->bts->ul_power_ctrl.target; + ? 0.0 : trx->bts->ul_power_ctrl.target_dbm; dev_par->fTxPowerLevel = 0.0; LOGP(DL1C, LOGL_NOTICE, "Init TRX (Band %d, ARFCN %u, TSC %u, RxPower % 2f dBm, " diff --git a/src/osmo-bts-sysmo/oml.c b/src/osmo-bts-sysmo/oml.c index 5f638e6..b79f731 100644 --- a/src/osmo-bts-sysmo/oml.c +++ b/src/osmo-bts-sysmo/oml.c @@ -429,7 +429,7 @@ dev_par->u16BcchArfcn = trx->bts->c0->arfcn; dev_par->u8NbTsc = trx->bts->bsic & 7; dev_par->fRxPowerLevel = trx_ms_pwr_ctrl_is_osmo(trx) - ? 0.0 : trx->bts->ul_power_ctrl.target; + ? 0.0 : trx->bts->ul_power_ctrl.target_dbm; dev_par->fTxPowerLevel = ((float) initial_mdBm) / 1000; LOGP(DL1C, LOGL_NOTICE, "Init TRX (ARFCN %u, TSC %u, RxPower % 2f dBm, " diff --git a/src/osmo-bts-sysmo/sysmobts_vty.c b/src/osmo-bts-sysmo/sysmobts_vty.c index 1f2aefb..65edbf0 100644 --- a/src/osmo-bts-sysmo/sysmobts_vty.c +++ b/src/osmo-bts-sysmo/sysmobts_vty.c @@ -154,7 +154,7 @@ { struct gsm_bts_trx *trx = vty->index; - trx->bts->ul_power_ctrl.target = atoi(argv[0]); + trx->bts->ul_power_ctrl.target_dbm = atoi(argv[0]); return CMD_SUCCESS; } diff --git a/src/osmo-bts-trx/trx_vty.c b/src/osmo-bts-trx/trx_vty.c index 0353064..55a7ee7 100644 --- a/src/osmo-bts-trx/trx_vty.c +++ b/src/osmo-bts-trx/trx_vty.c @@ -198,7 +198,7 @@ { vty_out (vty, "'osmotrx ms-power-loop' is deprecated, use 'uplink-power-target' instead%s", VTY_NEWLINE); - g_bts->ul_power_ctrl.target = atoi(argv[0]); + g_bts->ul_power_ctrl.target_dbm = atoi(argv[0]); return CMD_SUCCESS; } diff --git a/tests/power/bs_power_loop_test.c b/tests/power/bs_power_loop_test.c index bc6b815..2f60cc0 100644 --- a/tests/power/bs_power_loop_test.c +++ b/tests/power/bs_power_loop_test.c @@ -95,7 +95,7 @@ g_trx = gsm_bts_trx_alloc(g_bts); OSMO_ASSERT(g_trx != NULL); - g_bts->dl_power_ctrl.target = rxlev2dbm(PWR_TEST_RXLEV_TARGET); + g_bts->dl_power_ctrl.target_dbm = rxlev2dbm(PWR_TEST_RXLEV_TARGET); g_bts->band = GSM_BAND_900; g_bts->c0 = g_trx; @@ -147,7 +147,7 @@ case PWR_TEST_ST_SET_PARAMS: printf("#%02u %s() <- Param (re)set (target %d dBm, hysteresis %u dB, " "filtering is %sabled)\n", - n, __func__, step->params.target, step->params.hysteresis, + n, __func__, step->params.target_dbm, step->params.hysteresis_db, step->params.pf_algo != BTS_PF_ALGO_NONE ? "en" : "dis"); g_bts->dl_power_ctrl = step->params; return 0; /* we're done */ @@ -326,8 +326,8 @@ /* Enable hysteresis */ { .type = PWR_TEST_ST_SET_PARAMS, .params = { - .target = -110 + PWR_TEST_RXLEV_TARGET, - .hysteresis = 3, + .target_dbm = -110 + PWR_TEST_RXLEV_TARGET, + .hysteresis_db = 3, } }, @@ -347,7 +347,7 @@ /* Enable EWMA based power filtering */ { .type = PWR_TEST_ST_SET_PARAMS, .params = { - .target = -110 + PWR_TEST_RXLEV_TARGET, /* RxLev 30 */ + .target_dbm = -110 + PWR_TEST_RXLEV_TARGET, /* RxLev 30 */ .pf_algo = BTS_PF_ALGO_EWMA, .pf.ewma.alpha = 50, } diff --git a/tests/power/ms_power_loop_test.c b/tests/power/ms_power_loop_test.c index 147c725..4f4f746 100644 --- a/tests/power/ms_power_loop_test.c +++ b/tests/power/ms_power_loop_test.c @@ -47,8 +47,8 @@ g_trx->ms_pwr_ctl_soft = true; - g_bts->ul_power_ctrl.target = -75; - g_bts->dl_power_ctrl.target = -75; + 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; @@ -99,7 +99,7 @@ apply_power_test(lchan, -90, 1, 5); /* Check good RSSI value keeps it at same power level: */ - apply_power_test(lchan, g_bts->ul_power_ctrl.target, 0, 5); + apply_power_test(lchan, g_bts->ul_power_ctrl.target_dbm, 0, 5); apply_power_test(lchan, -90, 1, 3); apply_power_test(lchan, -90, 1, 2); /* .max is pwr lvl 2 */ @@ -117,7 +117,7 @@ apply_power_test(lchan, -90, 0, 29); /* Check good RSSI value keeps it at same power level: */ - apply_power_test(lchan, g_bts->ul_power_ctrl.target, 0, 29); + apply_power_test(lchan, g_bts->ul_power_ctrl.target_dbm, 0, 29); /* Now go down, steps are double size in this direction: */ apply_power_test(lchan, -45, 1, 1); @@ -125,13 +125,13 @@ apply_power_test(lchan, -45, 1, 9); /* Go down only one level down and up: */ - apply_power_test(lchan, g_bts->ul_power_ctrl.target + 2, 1, 10); - apply_power_test(lchan, g_bts->ul_power_ctrl.target - 2, 1, 9); + apply_power_test(lchan, g_bts->ul_power_ctrl.target_dbm + 2, 1, 10); + apply_power_test(lchan, g_bts->ul_power_ctrl.target_dbm - 2, 1, 9); /* Check if BSC requesting a low max power is applied after loop calculation: */ lchan->ms_power_ctrl.max = ms_pwr_ctl_lvl(GSM_BAND_1800, 2); OSMO_ASSERT(lchan->ms_power_ctrl.max == 14); - apply_power_test(lchan, g_bts->ul_power_ctrl.target + 2, 1, 14); + apply_power_test(lchan, g_bts->ul_power_ctrl.target_dbm + 2, 1, 14); /* Set back a more normal max: */ lchan->ms_power_ctrl.max = ms_pwr_ctl_lvl(GSM_BAND_1800, 30); OSMO_ASSERT(lchan->ms_power_ctrl.max == 0); @@ -215,22 +215,22 @@ lchan = &g_trx->ts[0].lchan[0]; /* Tolerate power deviations in range -80 .. -70 */ - g_bts->ul_power_ctrl.hysteresis = 5; + g_bts->ul_power_ctrl.hysteresis_db = 5; lchan->ms_power_ctrl.current = ms_pwr_ctl_lvl(GSM_BAND_1800, 0); OSMO_ASSERT(lchan->ms_power_ctrl.current == 15); lchan->ms_power_ctrl.max = ms_pwr_ctl_lvl(GSM_BAND_1800, 26); OSMO_ASSERT(lchan->ms_power_ctrl.max == 2); - apply_power_test(lchan, g_bts->ul_power_ctrl.target, 0, 15); - apply_power_test(lchan, g_bts->ul_power_ctrl.target + 3, 0, 15); - apply_power_test(lchan, g_bts->ul_power_ctrl.target - 3, 0, 15); + apply_power_test(lchan, g_bts->ul_power_ctrl.target_dbm, 0, 15); + apply_power_test(lchan, g_bts->ul_power_ctrl.target_dbm + 3, 0, 15); + apply_power_test(lchan, g_bts->ul_power_ctrl.target_dbm - 3, 0, 15); - apply_power_test(lchan, g_bts->ul_power_ctrl.target, 0, 15); - apply_power_test(lchan, g_bts->ul_power_ctrl.target + 5, 0, 15); - apply_power_test(lchan, g_bts->ul_power_ctrl.target - 5, 0, 15); + apply_power_test(lchan, g_bts->ul_power_ctrl.target_dbm, 0, 15); + apply_power_test(lchan, g_bts->ul_power_ctrl.target_dbm + 5, 0, 15); + apply_power_test(lchan, g_bts->ul_power_ctrl.target_dbm - 5, 0, 15); - apply_power_test(lchan, g_bts->ul_power_ctrl.target - 10, 1, 13); + apply_power_test(lchan, g_bts->ul_power_ctrl.target_dbm - 10, 1, 13); } int main(int argc, char **argv) -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/21499 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: Icb059ca1f555397be116a424800e4536883b9106 Gerrit-Change-Number: 21499 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