Revert "Use CP-based CFO estimation only for DL and UL. Estimate every subframe. Calibrated EMA to 0.3 highest valid for low SNR"

This reverts commit 6196c096af.
This commit is contained in:
Ismael Gomez 2017-11-27 18:27:48 +01:00
parent e035e248b8
commit aacd9e1e5b
7 changed files with 13 additions and 61 deletions

View File

@ -139,10 +139,6 @@ SRSLTE_API srslte_sync_find_ret_t srslte_sync_find(srslte_sync_t *q,
uint32_t find_offset,
uint32_t *peak_position);
SRSLTE_API float srslte_sync_cfo_estimate(srslte_sync_t *q,
cf_t *input,
int find_offset);
/* Estimates the CP length */
SRSLTE_API srslte_cp_t srslte_sync_detect_cp(srslte_sync_t *q,
cf_t *input,

View File

@ -88,12 +88,7 @@ typedef struct SRSLTE_API {
bool file_mode;
float file_cfo;
srslte_cfo_t file_cfo_correct;
bool mean_cfo_isunset;
float cfo;
float mean_cfo;
float cfo_ema_alpha;
srslte_ue_sync_state_t state;
uint32_t frame_len;

View File

@ -581,29 +581,25 @@ srslte_sync_find_ret_t srslte_sync_find(srslte_sync_t *q, cf_t *input, uint32_t
/* If peak is over threshold, compute CFO and SSS */
if (q->peak_value >= q->threshold) {
ret = SRSLTE_SYNC_FOUND;
if (q->detect_cp) {
if (peak_pos + find_offset >= 2*(q->fft_size + SRSLTE_CP_LEN_EXT(q->fft_size))) {
srslte_sync_set_cp(q, srslte_sync_detect_cp(q, input_cfo, peak_pos + find_offset));
} else {
DEBUG("Not enough room to detect CP length. Peak position: %d\n", peak_pos);
ret = SRSLTE_SYNC_FOUND_NOSPACE;
}
}
if (q->enable_cfo_corr) {
if (peak_pos + find_offset >= 2*(q->fft_size + SRSLTE_CP_LEN_EXT(q->fft_size))) {
float cfo2 = srslte_pss_synch_cfo_compute(&q->pss, &input[find_offset + peak_pos - q->fft_size]);
if (q->mean_cfo2_isunset) {
q->mean_cfo2 = cfo2;
q->mean_cfo2_isunset = true;
} else {
q->mean_cfo2 = SRSLTE_VEC_EMA(cfo2, q->mean_cfo2, q->cfo_ema_alpha);
}
if (peak_pos + find_offset >= 2*(q->fft_size + SRSLTE_CP_LEN_EXT(q->fft_size))) {
float cfo2 = srslte_pss_synch_cfo_compute(&q->pss, &input[find_offset + peak_pos - q->fft_size]);
if (q->mean_cfo2_isunset) {
q->mean_cfo2 = cfo2;
q->mean_cfo2_isunset = true;
} else {
ret = SRSLTE_SYNC_FOUND_NOSPACE;
q->mean_cfo2 = SRSLTE_VEC_EMA(cfo2, q->mean_cfo2, q->cfo_ema_alpha);
}
ret = SRSLTE_SYNC_FOUND;
} else {
ret = SRSLTE_SYNC_FOUND_NOSPACE;
}
} else {
ret = SRSLTE_SYNC_NOFOUND;

View File

@ -47,10 +47,6 @@
#define DEFAULT_SAMPLE_OFFSET_CORRECT_PERIOD 0
#define DEFAULT_SFO_EMA_COEFF 0.1
//#define DO_CFO_IN_SYNC
cf_t dummy_buffer0[15*2048/2];
cf_t dummy_buffer1[15*2048/2];
@ -188,9 +184,6 @@ int srslte_ue_sync_init_multi_decim(srslte_ue_sync_t *q,
q->sample_offset_correct_period = DEFAULT_SAMPLE_OFFSET_CORRECT_PERIOD;
q->sfo_ema = DEFAULT_SFO_EMA_COEFF;
q->mean_cfo_isunset = true;
q->mean_cfo = 0;
q->cfo_ema_alpha = 0.4;
q->max_prb = max_prb;
if (search_cell) {
@ -227,11 +220,6 @@ int srslte_ue_sync_init_multi_decim(srslte_ue_sync_t *q,
}
}
#ifndef DO_CFO_IN_SYNC
// Disable CFO correction in sync object and do it here every subframe
srslte_sync_set_cfo_enable(&q->strack, false);
#endif
ret = SRSLTE_SUCCESS;
}
@ -376,7 +364,6 @@ uint32_t srslte_ue_sync_peak_idx(srslte_ue_sync_t *q) {
void srslte_ue_sync_set_cfo_ema(srslte_ue_sync_t *q, float ema) {
srslte_sync_set_cfo_ema_alpha(&q->sfind, ema);
srslte_sync_set_cfo_ema_alpha(&q->strack, ema);
q->cfo_ema_alpha = ema;
}
srslte_ue_sync_state_t srslte_ue_sync_get_state(srslte_ue_sync_t *q) {
@ -392,11 +379,7 @@ void srslte_ue_sync_cfo_i_detec_en(srslte_ue_sync_t *q, bool enable) {
}
float srslte_ue_sync_get_cfo(srslte_ue_sync_t *q) {
#ifdef DO_CFO_IN_SYNC
return 15000 * srslte_sync_get_cfo(&q->strack);
#else
return 15000 * q->mean_cfo;
#endif
}
void srslte_ue_sync_set_cfo(srslte_ue_sync_t *q, float cfo) {
@ -681,23 +664,6 @@ int srslte_ue_sync_zerocopy_multi(srslte_ue_sync_t *q, cf_t *input_buffer[SRSLTE
q->sf_idx = (q->sf_idx + q->nof_recv_sf) % 10;
#ifndef DO_CFO_IN_SYNC
/* We found that CP-based correction performs better in low SNR than PSS-based.
*
* Estimate, average and correct here instead of inside sync object
*/
q->cfo = srslte_sync_cfo_estimate(&q->strack, input_buffer[0], 0);
if (q->mean_cfo_isunset) {
q->mean_cfo = q->cfo;
q->mean_cfo_isunset = false;
} else {
/* compute exponential moving average CFO */
q->mean_cfo = SRSLTE_VEC_EMA(q->cfo, q->mean_cfo, q->cfo_ema_alpha);
}
srslte_cfo_correct(&q->strack.cfocorr2, input_buffer[0], input_buffer[0], -q->mean_cfo / q->fft_size);
#endif
/* Every SF idx 0 and 5, find peak around known position q->peak_idx */
if (q->sf_idx == 0 || q->sf_idx == 5) {

View File

@ -203,7 +203,7 @@ void parse_args(all_args_t *args, int argc, char *argv[]) {
"Tolerance (in Hz) for digial CFO compensation.")
("expert.cfo_ema",
bpo::value<float>(&args->expert.phy.cfo_ema)->default_value(0.3),
bpo::value<float>(&args->expert.phy.cfo_ema)->default_value(0.4),
"CFO Exponential Moving Average coefficient. Lower makes it more robust to noise "
"but vulnerable to periodic interruptions due to VCO corrections.")

View File

@ -128,7 +128,6 @@ bool phch_worker::init(uint32_t max_prb, srslte::log *log_h)
srslte_ue_ul_set_normalization(&ue_ul, true);
srslte_ue_ul_set_cfo_enable(&ue_ul, true);
srslte_ue_ul_set_cfo_tol(&ue_ul, phy->args->cfo_correct_tol_hz);
mem_initiated = true;

View File

@ -172,7 +172,7 @@ enable = false
#attach_enable_64qam = false
#nof_phy_threads = 2
#equalizer_mode = mmse
#cfo_ema = 0.3
#cfo_ema = 0.4
#cfo_integer_enabled = false
#cfo_correct_tol_hz = 50
#time_correct_period = 5