aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/bts.c
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2020-10-13 21:40:24 +0700
committerVadim Yanitskiy <vyanitskiy@sysmocom.de>2020-10-15 19:46:11 +0700
commit967bca7b9e94a7ecb065b92da9008c8b75db9dec (patch)
tree5d85e6a995e3d971675388d0f2ba2d9e97814069 /src/common/bts.c
parent9a7acc17448e7486e41292379359239c7f5c81fe (diff)
power_control: implement EWMA based Uplink power filtering
So far the Uplink power control loop did not filter the Uplink RSSI measurements (reported by the BTS) at all. The lack of filtering makes our implementation too quick on the trigger, so in the real deployments there will be unneeded Tx power oscillations. In order to reduce this effect, let's implement a very simple EWMA (also known as Single Pole IIR) filtering that is defined as follows: Avg[n] = a * Pwr[n] + (1 - a) * Avg[n - 1] where parameter 'a' determines how much weight of the latest UL RSSI measurement result 'Pwr[n]' carries vs the weight of the average 'Avg[n - 1]'. The value of 'a' is usually a float in range 0 .. 1, so: - value 0.5 gives equal weight to both 'Pwr[n]' and 'Avg[n - 1]'; - value 1.0 means no filtering at all (pass through); - value 0.0 makes no sense. This formula was further optimized with the use of '+=' operator. The floating point math was also eliminated by scaling everything up (by 100). For more details, see: https://en.wikipedia.org/wiki/Moving_average https://en.wikipedia.org/wiki/Low-pass_filter#Simple_infinite_impulse_response_filter https://tomroelandts.com/articles/low-pass-single-pole-iir-filter The EWMA filtering is now *enabled by default*, but can be disabled or (re-)configured over the VTY at any time: ! Completely disable filtering no uplink-power-filtering ! Enable EWMA smoothing with the given parameters uplink-power-filtering algo ewma beta <1-99> Note that the VTY command expects 'beta' instead of 'alpha': alpha = (100 - beta) and the value must be in %. This is done for simplicity: 1% means lowest smoothing, 99% means highest smoothing. Let's say we have EWMA filtering enabled with alpha = 0.4, and get -98 dBm on the input, while the last output value was -60 dBm. The new output would be: Avg[n] = 0.4 * Pwr[n] + 0.6 * Avg[n - 1] Avg[n] = (0.4 * -98) + (0.6 * -60) Avg[n] = -75.2 => around -75 Of course, this is not a silver bullet, but better than nothing. Change-Id: Ib6dcadbf14ef59696c6a546bd323bda92d399f17 Related: SYS#4916
Diffstat (limited to 'src/common/bts.c')
-rw-r--r--src/common/bts.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/common/bts.c b/src/common/bts.c
index 5890c1a7..bb0795a7 100644
--- a/src/common/bts.c
+++ b/src/common/bts.c
@@ -303,6 +303,8 @@ int bts_init(struct gsm_bts *bts)
/* configurable via VTY */
bts->paging_state = paging_init(bts, 200, 0);
bts->ul_power_target = -75; /* dBm default */
+ bts->ul_power_ctrl.pf_algo = MS_UL_PF_ALGO_EWMA;
+ bts->ul_power_ctrl.pf.ewma.alpha = 20; /* 80% smoothing */
bts->rtp_jitter_adaptive = false;
bts->rtp_port_range_start = 16384;
bts->rtp_port_range_end = 17407;