From c2098ad6260ee3c772c26f404314fe01c4bc5f18 Mon Sep 17 00:00:00 2001 From: Ismael Gomez Date: Tue, 13 Mar 2018 18:52:21 +0100 Subject: [PATCH] Removed unused sample offset correction --- lib/include/srslte/interfaces/ue_interfaces.h | 3 +- lib/include/srslte/phy/ue/ue_dl.h | 7 ----- lib/src/phy/ue/ue_dl.c | 30 +------------------ srsue/hdr/phy/phch_worker.h | 3 +- srsue/src/main.cc | 4 --- srsue/src/phy/phch_recv.cc | 2 -- srsue/src/phy/phch_worker.cc | 8 ----- srsue/src/phy/phy.cc | 3 +- 8 files changed, 4 insertions(+), 56 deletions(-) diff --git a/lib/include/srslte/interfaces/ue_interfaces.h b/lib/include/srslte/interfaces/ue_interfaces.h index 75acc27ea..9a7a68a34 100644 --- a/lib/include/srslte/interfaces/ue_interfaces.h +++ b/lib/include/srslte/interfaces/ue_interfaces.h @@ -487,8 +487,7 @@ typedef struct { uint32_t cfo_ref_mask; bool average_subframe_enabled; int time_correct_period; - bool sfo_correct_disable; - std::string sss_algorithm; + std::string sss_algorithm; float estimator_fil_w; bool rssi_sensor_enabled; bool sic_pss_enabled; diff --git a/lib/include/srslte/phy/ue/ue_dl.h b/lib/include/srslte/phy/ue/ue_dl.h index 6974a0b99..c5b0da52a 100644 --- a/lib/include/srslte/phy/ue/ue_dl.h +++ b/lib/include/srslte/phy/ue/ue_dl.h @@ -84,8 +84,6 @@ typedef struct SRSLTE_API { srslte_ofdm_t fft_mbsfn; srslte_chest_dl_t chest; - srslte_cfo_t sfo_correct; - srslte_pdsch_cfg_t pdsch_cfg; srslte_pdsch_cfg_t pmch_cfg; srslte_softbuffer_rx_t *softbuffers[SRSLTE_MAX_CODEWORDS]; @@ -126,8 +124,6 @@ typedef struct SRSLTE_API { srslte_dci_msg_t pending_ul_dci_msg; uint16_t pending_ul_dci_rnti; - float sample_offset; - float last_phich_corr; }srslte_ue_dl_t; @@ -195,9 +191,6 @@ SRSLTE_API int srslte_ue_dl_find_dl_dci_type(srslte_ue_dl_t *q, SRSLTE_API uint32_t srslte_ue_dl_get_ncce(srslte_ue_dl_t *q); -SRSLTE_API void srslte_ue_dl_set_sample_offset(srslte_ue_dl_t * q, - float sample_offset); - SRSLTE_API int srslte_ue_dl_decode(srslte_ue_dl_t *q, uint8_t *data[SRSLTE_MAX_CODEWORDS], uint32_t tm, diff --git a/lib/src/phy/ue/ue_dl.c b/lib/src/phy/ue/ue_dl.c index 3815041a7..98ff5c9fd 100644 --- a/lib/src/phy/ue/ue_dl.c +++ b/lib/src/phy/ue/ue_dl.c @@ -71,7 +71,6 @@ int srslte_ue_dl_init(srslte_ue_dl_t *q, q->pmch_pkt_errors = 0; q->pmch_pkts_total = 0; q->pending_ul_dci_rnti = 0; - q->sample_offset = 0; q->nof_rx_antennas = nof_rx_antennas; for (int j = 0; j < SRSLTE_MAX_PORTS; j++) { @@ -147,12 +146,7 @@ int srslte_ue_dl_init(srslte_ue_dl_t *q, goto clean_exit; } } - if (srslte_cfo_init(&q->sfo_correct, max_prb*SRSLTE_NRE)) { - fprintf(stderr, "Error initiating SFO correct\n"); - goto clean_exit; - } - srslte_cfo_set_tol(&q->sfo_correct, 1e-5f/q->fft[0].symbol_sz); - + ret = SRSLTE_SUCCESS; } else { fprintf(stderr, "Invalid parametres\n"); @@ -178,7 +172,6 @@ void srslte_ue_dl_free(srslte_ue_dl_t *q) { srslte_pdcch_free(&q->pdcch); srslte_pdsch_free(&q->pdsch); srslte_pmch_free(&q->pmch); - srslte_cfo_free(&q->sfo_correct); for (int i = 0; i < SRSLTE_MAX_TB; i++) { srslte_softbuffer_rx_free(q->softbuffers[i]); if (q->softbuffers[i]) { @@ -209,7 +202,6 @@ int srslte_ue_dl_set_cell(srslte_ue_dl_t *q, srslte_cell_t cell) q->pkt_errors = 0; q->pkts_total = 0; q->pending_ul_dci_rnti = 0; - q->sample_offset = 0; if (q->cell.id != cell.id || q->cell.nof_prb == 0) { if (q->cell.nof_prb != 0) { @@ -220,11 +212,6 @@ int srslte_ue_dl_set_cell(srslte_ue_dl_t *q, srslte_cell_t cell) fprintf(stderr, "Error resizing REGs\n"); return SRSLTE_ERROR; } - if (srslte_cfo_resize(&q->sfo_correct, q->cell.nof_prb*SRSLTE_NRE)) { - fprintf(stderr, "Error resizing SFO correct\n"); - return SRSLTE_ERROR; - } - srslte_cfo_set_tol(&q->sfo_correct, 1e-5f/q->fft[0].symbol_sz); for (int port = 0; port < q->nof_rx_antennas; port++) { if (srslte_ofdm_rx_set_prb(&q->fft[port], q->cell.cp, q->cell.nof_prb)) { fprintf(stderr, "Error resizing FFT\n"); @@ -348,10 +335,6 @@ void srslte_ue_dl_reset(srslte_ue_dl_t *q) { bzero(&q->pdsch_cfg, sizeof(srslte_pdsch_cfg_t)); } -void srslte_ue_dl_set_sample_offset(srslte_ue_dl_t * q, float sample_offset) { - q->sample_offset = sample_offset; -} - /** Applies the following operations to a subframe of synchronized samples: * - OFDM demodulation * - Channel estimation @@ -395,17 +378,6 @@ int srslte_ue_dl_decode_fft_estimate_noguru(srslte_ue_dl_t *q, cf_t *input[SRSLT /* Run FFT for all subframe data */ for (int j=0;jnof_rx_antennas;j++) { srslte_ofdm_rx_sf_ng(&q->fft[j], input[j], q->sf_symbols_m[j]); - - /* Correct SFO multiplying by complex exponential in the time domain */ - if (q->sample_offset) { - int nsym = SRSLTE_CP_NSYMB(q->cell.cp); - for (int i=0;i<2*nsym;i++) { - srslte_cfo_correct(&q->sfo_correct, - &q->sf_symbols_m[j][i*q->cell.nof_prb*SRSLTE_NRE], - &q->sf_symbols_m[j][i*q->cell.nof_prb*SRSLTE_NRE], - q->sample_offset / q->fft[j].symbol_sz); - } - } } return srslte_ue_dl_decode_estimate_mbsfn(q, sf_idx, cfi, SRSLTE_SF_NORM); } else { diff --git a/srsue/hdr/phy/phch_worker.h b/srsue/hdr/phy/phch_worker.h index 167334918..6f72285b2 100644 --- a/srsue/hdr/phy/phch_worker.h +++ b/srsue/hdr/phy/phch_worker.h @@ -54,8 +54,7 @@ public: void set_tti(uint32_t tti, uint32_t tx_tti); void set_tx_time(srslte_timestamp_t tx_time, uint32_t next_offset); void set_cfo(float cfo); - void set_sample_offset(float sample_offset); - + void set_ul_params(bool pregen_disabled = false); void set_crnti(uint16_t rnti); void enable_pregen_signals(bool enabled); diff --git a/srsue/src/main.cc b/srsue/src/main.cc index f5df0af2d..d2d029c63 100644 --- a/srsue/src/main.cc +++ b/srsue/src/main.cc @@ -258,10 +258,6 @@ void parse_args(all_args_t *args, int argc, char *argv[]) { bpo::value(&args->expert.phy.time_correct_period)->default_value(5), "Period for sampling time offset correction.") - ("expert.sfo_correct_disable", - bpo::value(&args->expert.phy.sfo_correct_disable)->default_value(false), - "Disables phase correction before channel estimation.") - ("expert.sss_algorithm", bpo::value(&args->expert.phy.sss_algorithm)->default_value("full"), "Selects the SSS estimation algorithm.") diff --git a/srsue/src/phy/phch_recv.cc b/srsue/src/phy/phch_recv.cc index a96b9c545..850294175 100644 --- a/srsue/src/phy/phch_recv.cc +++ b/srsue/src/phy/phch_recv.cc @@ -636,8 +636,6 @@ void phch_recv::run_thread() worker->set_cfo(ul_dl_factor * metrics.cfo / 15000); worker_com->set_sync_metrics(metrics); - worker->set_sample_offset(srslte_ue_sync_get_sfo(&ue_sync)/1000); - /* Compute TX time: Any transmission happens in TTI+4 thus advance 4 ms the reception time */ srslte_timestamp_t rx_time, tx_time, tx_time_prach; srslte_ue_sync_get_last_timestamp(&ue_sync, &rx_time); diff --git a/srsue/src/phy/phch_worker.cc b/srsue/src/phy/phch_worker.cc index 8a6c5cd8b..32f336f59 100644 --- a/srsue/src/phy/phch_worker.cc +++ b/srsue/src/phy/phch_worker.cc @@ -190,14 +190,6 @@ void phch_worker::set_cfo(float cfo_) cfo = cfo_; } -void phch_worker::set_sample_offset(float sample_offset) -{ - if (phy->args->sfo_correct_disable) { - sample_offset = 0; - } - srslte_ue_dl_set_sample_offset(&ue_dl, sample_offset); -} - void phch_worker::set_crnti(uint16_t rnti) { srslte_ue_dl_set_rnti(&ue_dl, rnti); diff --git a/srsue/src/phy/phy.cc b/srsue/src/phy/phy.cc index 5c69d567d..27b389a4e 100644 --- a/srsue/src/phy/phy.cc +++ b/srsue/src/phy/phy.cc @@ -97,8 +97,7 @@ void phy::set_default_args(phy_args_t *args) args->cfo_integer_enabled = false; args->cfo_correct_tol_hz = 50; args->time_correct_period = 5; - args->sfo_correct_disable = false; - args->sss_algorithm = "full"; + args->sss_algorithm = "full"; args->estimator_fil_w = 0.1; }