From 898c86d95490c9e938ace88dc2a92557d5c8af14 Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Tue, 13 Feb 2018 23:28:09 +0100 Subject: [PATCH] Channel estimattor selects the strongest RSRP. --- lib/src/phy/ch_estimation/chest_dl.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/src/phy/ch_estimation/chest_dl.c b/lib/src/phy/ch_estimation/chest_dl.c index 3dae7f9e5..ba9ae40e6 100644 --- a/lib/src/phy/ch_estimation/chest_dl.c +++ b/lib/src/phy/ch_estimation/chest_dl.c @@ -691,14 +691,22 @@ float srslte_chest_dl_get_rsrp_ant_port(srslte_chest_dl_t *q, uint32_t ant_idx, } float srslte_chest_dl_get_rsrp_port(srslte_chest_dl_t *q, uint32_t port) { - float n = 0; + float max = -INFINITY; for (int i = 0; i < q->last_nof_antennas; i++) { - n += q->rsrp[i][port]; + if (q->rsrp[i][port] > max) { + max = q->rsrp[i][port]; + } } - return n / q->last_nof_antennas; + return max; } float srslte_chest_dl_get_rsrp(srslte_chest_dl_t *q) { - // Note: use only port 0 but average across antennas - return srslte_chest_dl_get_rsrp_port(q, 0); + float max = -INFINITY; + for (int i = 0; i < q->cell.nof_ports; ++i) { + float v = srslte_chest_dl_get_rsrp_port(q, i); + if (max < v) { + max = v; + } + } + return max; }