Review at  https://gerrit.osmocom.org/5901

HO: Count neighbor measurements and reduce window of neigh_meas_avg

Always start with a counter of 0 for a new measurement report. If the
neigh_meas_avg is caluclated over the given window, the window is
reduced, if there are less measurement reports received so far.

Change-Id: I1c74f27f9663a3083610c985a080fca331c19bd3
---
M src/libbsc/handover_decision.c
1 file changed, 8 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/01/5901/1

diff --git a/src/libbsc/handover_decision.c b/src/libbsc/handover_decision.c
index a2abb39..04ca144 100644
--- a/src/libbsc/handover_decision.c
+++ b/src/libbsc/handover_decision.c
@@ -99,6 +99,13 @@
        unsigned int i, idx;
        int avg = 0;
 
+       /* reduce window to the actual number of existing measurements */
+       if (window < nmp->rxlev_cnt)
+               window = nmp->rxlev_cnt;
+       /* this should never happen */
+       if (window == 0)
+               return 0;
+
        idx = calc_initial_idx(ARRAY_SIZE(nmp->rxlev),
                                nmp->rxlev_cnt % ARRAY_SIZE(nmp->rxlev),
                                window);
@@ -177,6 +184,7 @@
                nmp->arfcn = mrc->arfcn;
                nmp->bsic = mrc->bsic;
 
+               nmp->rxlev_cnt = 0;
                idx = nmp->rxlev_cnt % ARRAY_SIZE(nmp->rxlev);
                nmp->rxlev[idx] = mrc->rxlev;
                nmp->rxlev_cnt++;

-- 
To view, visit https://gerrit.osmocom.org/5901
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1c74f27f9663a3083610c985a080fca331c19bd3
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <[email protected]>

Reply via email to