diff options
author | Harald Welte <laforge@gnumonks.org> | 2014-08-22 02:46:15 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2014-08-24 10:46:21 +0200 |
commit | e43feaf231e08f108aafa26a7829820fad3447cb (patch) | |
tree | 06b0fe4d89e8c2c4194dcb7e1ae0378b48dae1fc /src/osmo-bts-sysmo/utils.c | |
parent | fcca2e82184f8ece6a31db48abd77d560065b31f (diff) |
New generic transmit power handling
In order to support transmit power reduction by thermal management
as well as the variety of new internal / external PA configurations
of BTSs, we need a slightly more complex system.
Also, as at high power a single dB can be quite a big difference,
we are now doing all computations in milli-dB(m), i.e. 1/10000 bel.
Ramping is now used both for up and down ramping, as that is useful in
cases where you want to gracefully shut down a cell by shrinking its
radius, gradually handing over subscribers to neighboring cells.
Furthermore, this code is becoming part of the 'common' codebase, as it
is not really specific to how sysmobts is working.
The user can specify a single aggregate value for external system
gain/attenuation. Let's say you have 1dB loss of antenna cable, so you
can put that as 'user-gain -1' into the config, which means that a
'transmit power of 20dBm' will be compensatet for that and the TRX is
instructed to output 21dBm to compensate the cable loss. Similarly,
external PAs can be described by a positive user-gain.
One of the next steps will be to communicate those values and the
nominal power capability of the specific BTS to the BSC, so the BSC will
automatically show correct signal levels in the VTY and log files.
The code includes provisions for future extensions regarding
* an external and an internal PA with calibration tables
* a thermal attenuation setting to be controlled by the site manager
Diffstat (limited to 'src/osmo-bts-sysmo/utils.c')
-rw-r--r-- | src/osmo-bts-sysmo/utils.c | 84 |
1 files changed, 0 insertions, 84 deletions
diff --git a/src/osmo-bts-sysmo/utils.c b/src/osmo-bts-sysmo/utils.c index afca7730..a636ae15 100644 --- a/src/osmo-bts-sysmo/utils.c +++ b/src/osmo-bts-sysmo/utils.c @@ -137,88 +137,4 @@ int sysmobts_get_nominal_power(struct gsm_bts_trx *trx) return -1; } -int sysmobts_get_target_power(struct gsm_bts_trx *trx) -{ - int target_power = trx->nominal_power - trx->max_power_red; - target_power -= trx->power_reduce; - - if (target_power < 0) - target_power = 0; - - return target_power; -} - -void sysmobts_pa_pwr_init(struct gsm_bts_trx *trx) -{ - int target_power = sysmobts_get_target_power(trx); - - /* Cancel any pending request */ - osmo_timer_del(&trx->pa.step_timer); - - /* is this below our initial target */ - if (target_power <= trx->pa.max_initial_power) { - LOGP(DL1C, LOGL_NOTICE, - "PA target_power(%d) is below initial power.\n", - target_power); - trx->pa.current_power = target_power; - return; - } - - /* is this below our current value? */ - if (target_power <= trx->pa.current_power) { - LOGP(DL1C, LOGL_NOTICE, - "PA target_power(%d) is below current_power.\n", - target_power); - trx->pa.current_power = target_power; - return; - } - if (trx->pa.current_power > trx->pa.max_initial_power) { - LOGP(DL1C, LOGL_NOTICE, - "PA target_power(%d) starting from current_power.\n", - target_power); - return; - } - - /* We need to step it up. Start from the initial value */ - trx->pa.current_power = trx->pa.max_initial_power; - LOGP(DL1C, LOGL_NOTICE, - "PA target_power(%d) starting with %d dBm.\n", - target_power, trx->pa.current_power); -} - -static void pa_trx_cb(void *_trx) -{ - struct gsm_bts_trx *trx = _trx; - - LOGP(DL1C, LOGL_NOTICE, - "PA raising power to %d dBm.\n", trx->pa.current_power); - l1if_set_txpower(trx_femtol1_hdl(trx), (float) trx->pa.current_power); -} - -void sysmobts_pa_maybe_step(struct gsm_bts_trx *trx) -{ - /* it can not have changed */ - int target_power = sysmobts_get_target_power(trx); - - /* We are done */ - if (trx->pa.current_power >= target_power) { - LOGP(DL1C, LOGL_NOTICE, - "PA have reached target power: %d dBm.\n", - target_power); - return; - } - - /* Step up the current power but clamp it */ - trx->pa.current_power += trx->pa.step_size; - if (trx->pa.current_power > target_power) - trx->pa.current_power = target_power; - - LOGP(DL1C, LOGL_NOTICE, - "PA scheduling to step to %d dBm.\n", - trx->pa.current_power); - - trx->pa.step_timer.data = trx; - trx->pa.step_timer.cb = pa_trx_cb; - osmo_timer_schedule(&trx->pa.step_timer, trx->pa.step_interval, 0); -} |