From b872f84255565db017657d7c38901af571b2fc75 Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Tue, 29 Aug 2017 16:54:33 +0200 Subject: [PATCH] Improved RI selection (cherry picked from commit 034025d) --- lib/src/phy/phch/pdsch.c | 2 +- lib/src/phy/ue/ue_dl.c | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/lib/src/phy/phch/pdsch.c b/lib/src/phy/phch/pdsch.c index bf50cb6ec..62f2834ae 100644 --- a/lib/src/phy/phch/pdsch.c +++ b/lib/src/phy/phch/pdsch.c @@ -683,7 +683,7 @@ int srslte_pdsch_pmi_select(srslte_pdsch_t *q, uint32_t pmi[SRSLTE_MAX_LAYERS], float sinr[SRSLTE_MAX_LAYERS][SRSLTE_MAX_CODEBOOKS]) { if (q->cell.nof_ports == 2 && q->nof_rx_antennas == 2) { - for (int nof_layers = 1; nof_layers <= cfg->nof_layers; nof_layers++ ) { + for (int nof_layers = 1; nof_layers <= 2; nof_layers++ ) { if (sinr[nof_layers - 1] && pmi) { if (srslte_precoding_pmi_select(ce, nof_ce, noise_estimate, nof_layers, &pmi[nof_layers - 1], sinr[nof_layers - 1]) < 0) { diff --git a/lib/src/phy/ue/ue_dl.c b/lib/src/phy/ue/ue_dl.c index 91116ab70..55f65ad3d 100644 --- a/lib/src/phy/ue/ue_dl.c +++ b/lib/src/phy/ue/ue_dl.c @@ -438,9 +438,15 @@ int srslte_ue_dl_decode_rnti_multi(srslte_ue_dl_t *q, cf_t *input[SRSLTE_MAX_POR q->sf_symbols_m, q->ce_m, noise_estimate, rnti, data, acks); - + + for (int tb = 0; tb < q->pdsch_cfg.grant.nof_tb; tb++) { + if (!acks[tb]) { + q->pkt_errors++; + } + q->pkts_total++; + } + if (ret == SRSLTE_ERROR) { - q->pkt_errors++; } else if (ret == SRSLTE_ERROR_INVALID_INPUTS) { fprintf(stderr, "Error calling srslte_pdsch_decode()\n"); } @@ -458,8 +464,6 @@ int srslte_ue_dl_decode_rnti_multi(srslte_ue_dl_t *q, cf_t *input[SRSLTE_MAX_POR } - q->pkts_total++; - if (found_dci == 1 && ret == SRSLTE_SUCCESS) { return q->pdsch_cfg.grant.mcs[0].tbs; } else { @@ -485,10 +489,11 @@ int srslte_ue_dl_ri_pmi_select(srslte_ue_dl_t *q, uint32_t *ri, uint32_t *pmi, f } /* Select the best Rank indicator (RI) and Precoding Matrix Indicator (PMI) */ - for (uint32_t nof_layers = 1; nof_layers <= q->pdsch_cfg.nof_layers; nof_layers++ ) { - if (q->sinr[nof_layers][q->pmi[nof_layers]] > best_sinr + 0.1) { - best_sinr = q->sinr[nof_layers][q->pmi[nof_layers]]*nof_layers; - best_pmi = q->pmi[nof_layers]; + for (uint32_t nof_layers = 1; nof_layers <= 2; nof_layers++) { + float _sinr = q->sinr[nof_layers - 1][q->pmi[nof_layers - 1]] * nof_layers; + if (_sinr > best_sinr + 0.1) { + best_sinr = _sinr; + best_pmi = q->pmi[nof_layers - 1]; best_ri = nof_layers; } }