osmo-bts-trx: Fix MS power control loop.

The following two commits from 2014-12-06 introduced a new variable to control
MS power - ms_power_ctrl, but kept the old ms_power variable in place. They
have also changed the meaning of the ms_power variable - it now keeps original
RSL configured value. So when much later osmo-trx-bts code was merged to master
the code was compiling fine and this change in the meaning was overlooked.

In osmo-bts:
579651bf30 power/sysmobts: Add a manual ms power level control
In OpenBSC:
f6f86b0eec18da165db136b14bf2db87fde4b4ac osmo-bts: Introduce new struct for a power loop in the BTS code

Change-Id: I713e39b882db32a0d17aa04790d16fa79afa1fb1
This commit is contained in:
Alexander Chemeris 2017-08-19 02:05:25 +03:00
parent b78fc1eeee
commit d4450051fc
2 changed files with 12 additions and 12 deletions

View File

@ -509,7 +509,7 @@ int l1if_process_meas_res(struct gsm_bts_trx *trx, uint8_t tn, uint32_t fn, uint
LOGP(DMEAS, LOGL_DEBUG, "RX L1 frame %s fn=%u chan_nr=0x%02x MS pwr=%ddBm rssi=%.1f dBFS "
"ber=%.2f%% (%d/%d bits) L1_ta=%d rqd_ta=%d toa=%.2f\n",
gsm_lchan_name(lchan), fn, chan_nr, ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power),
gsm_lchan_name(lchan), fn, chan_nr, ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power_ctrl.current),
rssi, ber*100, n_errors, n_bits_total, lchan->meas.l1_info[1], lchan->rqd_ta, toa);
l1if_fill_meas_res(&l1sap, chan_nr, lchan->rqd_ta + toa, ber, rssi, fn);

View File

@ -48,7 +48,7 @@ static int ms_power_diff(struct gsm_lchan *lchan, uint8_t chan_nr, int8_t diff)
uint16_t arfcn = trx->arfcn;
int8_t new_power;
new_power = lchan->ms_power - (diff >> 1);
new_power = lchan->ms_power_ctrl.current - (diff >> 1);
if (diff == 0)
return 0;
@ -66,12 +66,12 @@ static int ms_power_diff(struct gsm_lchan *lchan, uint8_t chan_nr, int8_t diff)
}
/* a higher value means a lower level (and vice versa) */
if (new_power > lchan->ms_power + MS_LOWER_MAX)
new_power = lchan->ms_power + MS_LOWER_MAX;
else if (new_power < lchan->ms_power - MS_RAISE_MAX)
new_power = lchan->ms_power - MS_RAISE_MAX;
if (new_power > lchan->ms_power_ctrl.current + MS_LOWER_MAX)
new_power = lchan->ms_power_ctrl.current + MS_LOWER_MAX;
else if (new_power < lchan->ms_power_ctrl.current - MS_RAISE_MAX)
new_power = lchan->ms_power_ctrl.current - MS_RAISE_MAX;
if (lchan->ms_power == new_power) {
if (lchan->ms_power_ctrl.current == new_power) {
LOGP(DLOOP, LOGL_INFO, "Keeping MS new_power of trx=%u "
"chan_nr=0x%02x at control level %d (%d dBm)\n",
trx->nr, chan_nr, new_power,
@ -83,11 +83,11 @@ static int ms_power_diff(struct gsm_lchan *lchan, uint8_t chan_nr, int8_t diff)
LOGP(DLOOP, LOGL_INFO, "%s MS new_power of trx=%u chan_nr=0x%02x from "
"control level %d (%d dBm) to %d (%d dBm)\n",
(diff > 0) ? "Raising" : "Lowering",
trx->nr, chan_nr, lchan->ms_power,
MS_PWR_DBM(arfcn, lchan->ms_power), new_power,
trx->nr, chan_nr, lchan->ms_power_ctrl.current,
MS_PWR_DBM(arfcn, lchan->ms_power_ctrl.current), new_power,
MS_PWR_DBM(arfcn, new_power));
lchan->ms_power = new_power;
lchan->ms_power_ctrl.current = new_power;
return 0;
}
@ -159,8 +159,8 @@ static int ms_power_clock(struct gsm_lchan *lchan,
/* change RSSI */
LOGP(DLOOP, LOGL_DEBUG, "Lowest RSSI: %d Target RSSI: %d Current "
"MS power: %d (%d dBm) of trx=%u chan_nr=0x%02x\n", rssi,
trx_target_rssi, lchan->ms_power,
MS_PWR_DBM(trx->arfcn, lchan->ms_power),
trx_target_rssi, lchan->ms_power_ctrl.current,
MS_PWR_DBM(trx->arfcn, lchan->ms_power_ctrl.current),
trx->nr, chan_nr);
ms_power_diff(lchan, chan_nr, trx_target_rssi - rssi);