aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/vty.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/vty.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/vty.c')
-rw-r--r--src/common/vty.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/common/vty.c b/src/common/vty.c
index 534b6328..16ffe729 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -256,6 +256,19 @@ static void config_write_bts_single(struct vty *vty, const struct gsm_bts *bts)
vty_out(vty, " paging lifetime %u%s", paging_get_lifetime(bts->paging_state),
VTY_NEWLINE);
vty_out(vty, " uplink-power-target %d%s", bts->ul_power_target, VTY_NEWLINE);
+
+ /* MS Tx power filtering algorithm and parameters */
+ switch (bts->ul_power_ctrl.pf_algo) {
+ case MS_UL_PF_ALGO_EWMA:
+ vty_out(vty, " uplink-power-filtering algo ewma beta %u%s",
+ 100 - bts->ul_power_ctrl.pf.ewma.alpha, VTY_NEWLINE);
+ break;
+ case MS_UL_PF_ALGO_NONE:
+ default:
+ vty_out(vty, " no uplink-power-filtering%s", VTY_NEWLINE);
+ break;
+ }
+
if (bts->agch_queue.thresh_level != GSM_BTS_AGCH_QUEUE_THRESH_LEVEL_DEFAULT
|| bts->agch_queue.low_level != GSM_BTS_AGCH_QUEUE_LOW_LEVEL_DEFAULT
|| bts->agch_queue.high_level != GSM_BTS_AGCH_QUEUE_HIGH_LEVEL_DEFAULT)
@@ -615,6 +628,37 @@ DEFUN_ATTR(cfg_bts_ul_power_target, cfg_bts_ul_power_target_cmd,
return CMD_SUCCESS;
}
+DEFUN_ATTR(cfg_no_bts_ul_power_filter,
+ cfg_bts_no_ul_power_filter_cmd,
+ "no uplink-power-filtering",
+ NO_STR "Disable filtering for uplink power control loop\n",
+ CMD_ATTR_IMMEDIATE)
+{
+ struct gsm_bts *bts = vty->index;
+
+ bts->ul_power_ctrl.pf_algo = MS_UL_PF_ALGO_NONE;
+
+ return CMD_SUCCESS;
+}
+
+DEFUN_ATTR(cfg_bts_ul_power_filter_ewma,
+ cfg_bts_ul_power_filter_ewma_cmd,
+ "uplink-power-filtering algo ewma beta <1-99>",
+ "Configure filtering for uplink power control loop\n"
+ "Select the filtering algorithm\n"
+ "Exponentially Weighted Moving Average (EWMA)\n"
+ "Smoothing factor (in %%): beta = (100 - alpha)\n"
+ "1%% - lowest smoothing, 99%% - highest smoothing\n",
+ CMD_ATTR_IMMEDIATE)
+{
+ struct gsm_bts *bts = vty->index;
+
+ bts->ul_power_ctrl.pf_algo = MS_UL_PF_ALGO_EWMA;
+ bts->ul_power_ctrl.pf.ewma.alpha = 100 - atoi(argv[0]);
+
+ return CMD_SUCCESS;
+}
+
DEFUN_ATTR(cfg_bts_min_qual_rach, cfg_bts_min_qual_rach_cmd,
"min-qual-rach <-100-100>",
"Set the minimum link quality level of Access Bursts to be accepted\n"
@@ -1805,6 +1849,8 @@ int bts_vty_init(struct gsm_bts *bts)
install_element(BTS_NODE, &cfg_bts_agch_queue_mgmt_default_cmd);
install_element(BTS_NODE, &cfg_bts_agch_queue_mgmt_params_cmd);
install_element(BTS_NODE, &cfg_bts_ul_power_target_cmd);
+ install_element(BTS_NODE, &cfg_bts_no_ul_power_filter_cmd);
+ install_element(BTS_NODE, &cfg_bts_ul_power_filter_ewma_cmd);
install_element(BTS_NODE, &cfg_bts_min_qual_rach_cmd);
install_element(BTS_NODE, &cfg_bts_min_qual_norm_cmd);
install_element(BTS_NODE, &cfg_bts_max_ber_rach_cmd);