aboutsummaryrefslogtreecommitdiffstats
path: root/include
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 /include
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 'include')
-rw-r--r--include/osmo-bts/bts.h21
-rw-r--r--include/osmo-bts/gsm_data.h3
2 files changed, 24 insertions, 0 deletions
diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h
index 9df7f087..db8f741d 100644
--- a/include/osmo-bts/bts.h
+++ b/include/osmo-bts/bts.h
@@ -95,6 +95,12 @@ struct bts_smscb_state {
struct smscb_msg *default_msg; /* default broadcast message; NULL if none */
};
+/* Tx power filtering algorithm */
+enum ms_ul_pf_algo {
+ MS_UL_PF_ALGO_NONE = 0,
+ MS_UL_PF_ALGO_EWMA,
+};
+
/* One BTS */
struct gsm_bts {
/* list header in net->bts_list */
@@ -290,8 +296,23 @@ struct gsm_bts {
bool vty_override; /* OML value overridden by VTY */
} radio_link_timeout;
+ /* TODO: move it to bts->ul_power_ctrl struct */
int ul_power_target; /* Uplink Rx power target */
+ /* Uplink power control */
+ struct {
+ /* UL RSSI filtering algorithm */
+ enum ms_ul_pf_algo pf_algo;
+ /* (Optional) filtering parameters */
+ union {
+ /* Exponentially Weighted Moving Average */
+ struct {
+ /* Smoothing factor: higher the value - less smoothing */
+ uint8_t alpha; /* 1 .. 99 (in %) */
+ } ewma;
+ } pf;
+ } ul_power_ctrl;
+
/* used by the sysmoBTS to adjust band */
uint8_t auto_band;
diff --git a/include/osmo-bts/gsm_data.h b/include/osmo-bts/gsm_data.h
index c6fe6090..1c1c5d44 100644
--- a/include/osmo-bts/gsm_data.h
+++ b/include/osmo-bts/gsm_data.h
@@ -286,6 +286,9 @@ struct gsm_lchan {
uint8_t current;
uint8_t max;
bool fixed;
+
+ /* Scaled up (100 times) average UL RSSI */
+ int avg100_ul_rssi;
} ms_power_ctrl;
/* BTS power reduction (in dB) */