Fix PUCCH DMRS correlation

master
Xavier Arteaga 5 years ago committed by Xavier Arteaga
parent 7c7c83b9ad
commit 2c93f6d20a

@ -91,6 +91,7 @@ typedef struct SRSLTE_API {
typedef struct SRSLTE_API {
srslte_uci_value_t uci_data;
float dmrs_correlation;
float correlation;
bool detected;
} srslte_pucch_res_t;
@ -184,7 +185,7 @@ SRSLTE_API void
srslte_pucch_tx_info(srslte_pucch_cfg_t* cfg, srslte_uci_value_t* uci_data, char* str, uint32_t str_len);
SRSLTE_API void
srslte_pucch_rx_info(srslte_pucch_cfg_t* cfg, srslte_uci_value_t* uci_data, char* str, uint32_t str_len);
srslte_pucch_rx_info(srslte_pucch_cfg_t* cfg, srslte_pucch_res_t* pucch_res, char* str, uint32_t str_len);
SRSLTE_API bool srslte_pucch_cfg_isvalid(srslte_pucch_cfg_t* cfg, uint32_t nof_prb);

@ -185,8 +185,8 @@ static int get_pucch(srslte_enb_ul_t* q, srslte_ul_sf_cfg_t* ul_sf, srslte_pucch
// Get possible resources
int nof_resources = srslte_pucch_proc_get_resources(&q->cell, cfg, &cfg->uci_cfg, NULL, n_pucch_i);
if (nof_resources < SRSLTE_SUCCESS || nof_resources > SRSLTE_PUCCH_CS_MAX_ACK) {
ERROR("No PUCCH resource could be calculated\n");
if (nof_resources < 1 || nof_resources > SRSLTE_PUCCH_CS_MAX_ACK) {
ERROR("No PUCCH resource could be calculated (%d)\n", nof_resources);
return SRSLTE_ERROR;
}
@ -216,12 +216,8 @@ static int get_pucch(srslte_enb_ul_t* q, srslte_ul_sf_cfg_t* ul_sf, srslte_pucch
srslte_pucch_cs_get_ack(cfg, &cfg->uci_cfg, i, b, &pucch_res.uci_data);
}
char txt[256];
srslte_pucch_rx_info(cfg, &pucch_res.uci_data, txt, sizeof(txt));
INFO("[ENB_UL/PUCCH] Decoded %s, corr=%.3f\n", txt, pucch_res.correlation);
// Check correlation value, keep maximum
if (pucch_res.correlation > res->correlation) {
if (i == 0 || pucch_res.correlation > res->correlation) {
*res = pucch_res;
}
}

@ -912,17 +912,19 @@ int srslte_pucch_decode(srslte_pucch_t* q,
// Equalization
srslte_predecoding_single(q->z_tmp, q->ce, q->z, NULL, nof_re, 1.0f, channel->noise_estimate);
// DMRS Detection
cf_t _dmrs_corr = srslte_vec_acc_cc(q->ce, nof_re) / nof_re;
float _rms = __real__(conjf(_dmrs_corr) * _dmrs_corr);
float _pow = srslte_vec_avg_power_cf(q->ce, nof_re);
float _r = _rms / _pow;
// Return not detected if the ratio is 0, NAN, +/- Infinity or below threshold
if (!isnormal(_r) || _r < cfg->threshold_dmrs_detection) {
data->detected = false;
data->correlation = NAN;
return SRSLTE_SUCCESS;
// Perform DMRS Detection, if enabled
if (isnormal(cfg->threshold_dmrs_detection)) {
cf_t _dmrs_corr = srslte_vec_acc_cc(q->ce, SRSLTE_NRE) / SRSLTE_NRE;
float rms = __real__(conjf(_dmrs_corr) * _dmrs_corr);
float power = srslte_vec_avg_power_cf(q->ce, SRSLTE_NRE);
data->dmrs_correlation = rms / power;
// Return not detected if the ratio is 0, NAN, +/- Infinity or below threshold
if (!isnormal(data->dmrs_correlation) || data->dmrs_correlation < cfg->threshold_dmrs_detection) {
data->correlation = 0.0f;
data->detected = false;
return SRSLTE_SUCCESS;
}
}
// Perform ML-decoding
@ -1368,7 +1370,7 @@ void srslte_pucch_tx_info(srslte_pucch_cfg_t* cfg, srslte_uci_value_t* uci_data,
}
}
void srslte_pucch_rx_info(srslte_pucch_cfg_t* cfg, srslte_uci_value_t* uci_data, char* str, uint32_t str_len)
void srslte_pucch_rx_info(srslte_pucch_cfg_t* cfg, srslte_pucch_res_t* pucch_res, char* str, uint32_t str_len)
{
uint32_t n = srslte_print_check(str,
str_len,
@ -1378,7 +1380,13 @@ void srslte_pucch_rx_info(srslte_pucch_cfg_t* cfg, srslte_uci_value_t* uci_data,
srslte_pucch_format_text_short(cfg->format),
cfg->n_pucch);
if (uci_data) {
srslte_uci_data_info(&cfg->uci_cfg, uci_data, &str[n], str_len - n);
if (pucch_res) {
if (isnormal(cfg->threshold_dmrs_detection)) {
n = srslte_print_check(str, str_len, n, ", dmrs_corr=%.3f", pucch_res->dmrs_correlation);
}
n = srslte_print_check(str, str_len, n, ", corr=%.3f", pucch_res->correlation);
srslte_uci_data_info(&cfg->uci_cfg, &pucch_res->uci_data, &str[n], str_len - n);
}
}

@ -422,8 +422,8 @@ int cc_worker::decode_pucch()
// Logging
char str[512];
srslte_pucch_rx_info(&ul_cfg.pucch, &pucch_res.uci_data, str, 512);
Info("PUCCH: cc=%d; %s, corr=%.1f\n", cc_idx, str, pucch_res.correlation);
srslte_pucch_rx_info(&ul_cfg.pucch, &pucch_res, str, 512);
Info("PUCCH: cc=%d; %s\n", cc_idx, str);
}
}
}

Loading…
Cancel
Save