diff --git a/lib/src/phy/ch_estimation/chest_dl.c b/lib/src/phy/ch_estimation/chest_dl.c index 8d9125910..e719b22c0 100644 --- a/lib/src/phy/ch_estimation/chest_dl.c +++ b/lib/src/phy/ch_estimation/chest_dl.c @@ -734,7 +734,7 @@ float srslte_chest_dl_get_rsrp_neighbour_port(srslte_chest_dl_t *q, uint32_t por } float srslte_chest_dl_get_rsrp(srslte_chest_dl_t *q) { - float max = -0.0f; + float max = -1e9; for (int i = 0; i < q->last_nof_antennas; ++i) { float v = srslte_chest_dl_get_rsrp_port(q, i); if (v > max) { @@ -745,7 +745,7 @@ float srslte_chest_dl_get_rsrp(srslte_chest_dl_t *q) { } float srslte_chest_dl_get_rsrp_neighbour(srslte_chest_dl_t *q) { - float max = -0.0f; + float max = -1e9; for (int i = 0; i < q->last_nof_antennas; ++i) { float v = srslte_chest_dl_get_rsrp_neighbour_port(q, i); if (v > max) { diff --git a/srsue/hdr/phy/phch_recv.h b/srsue/hdr/phy/phch_recv.h index 8b87f0521..d71bcb1d5 100644 --- a/srsue/hdr/phy/phch_recv.h +++ b/srsue/hdr/phy/phch_recv.h @@ -171,7 +171,6 @@ private: ret_code run_multiple_subframes(cf_t *buffer, int offset, uint32_t sf_idx, uint32_t nof_sf); float rssi(); float rsrp(); - float rsrp_n(); float rsrq(); float snr(); uint32_t frame_st_idx(); @@ -184,7 +183,7 @@ private: uint32_t nof_subframes; uint32_t current_prb; float rx_gain_offset; - float mean_rsrp, mean_rsrp_n, mean_rsrq, mean_snr, mean_rssi; + float mean_rsrp, mean_rsrq, mean_snr, mean_rssi; uint32_t final_offset; const static int RSRP_MEASURE_NOF_FRAMES = 5; }; @@ -205,7 +204,6 @@ private: int find_cells(cf_t *input_buffer, float rx_gain_offset, srslte_cell_t current_cell, uint32_t nof_sf, cell_info_t found_cells[MAX_CELLS]); private: - cf_t *input_cfo_corrected; cf_t *sf_buffer[SRSLTE_MAX_PORTS]; srslte::log *log_h; srslte_sync_t sync_find; @@ -233,7 +231,7 @@ private: void write(uint32_t tti, cf_t *data, uint32_t nsamples); private: void run_thread(); - const static int INTRA_FREQ_MEAS_LEN_MS = 50; + const static int INTRA_FREQ_MEAS_LEN_MS = 20; const static int INTRA_FREQ_MEAS_PERIOD_MS = 200; const static int INTRA_FREQ_MEAS_PRIO = DEFAULT_PRIORITY + 5; diff --git a/srsue/src/phy/phch_recv.cc b/srsue/src/phy/phch_recv.cc index 9d539a02d..456f14ea0 100644 --- a/srsue/src/phy/phch_recv.cc +++ b/srsue/src/phy/phch_recv.cc @@ -1055,10 +1055,6 @@ float phch_recv::measure::rsrp() { return 10*log10(mean_rsrp) + 30 - rx_gain_offset; } -float phch_recv::measure::rsrp_n() { - return 10*log10(mean_rsrp_n) + 30 - rx_gain_offset; -} - float phch_recv::measure::rsrq() { return 10*log10(mean_rsrq); } @@ -1169,21 +1165,18 @@ phch_recv::measure::ret_code phch_recv::measure::run_subframe(uint32_t sf_idx) return ERROR; } - float rsrp = srslte_chest_dl_get_rsrp(&ue_dl.chest); - float rsrp_n = srslte_chest_dl_get_rsrp_neighbour(&ue_dl.chest); + float rsrp = srslte_chest_dl_get_rsrp_neighbour(&ue_dl.chest); float rsrq = srslte_chest_dl_get_rsrq(&ue_dl.chest); float snr = srslte_chest_dl_get_snr(&ue_dl.chest); float rssi = srslte_vec_avg_power_cf(buffer[0], SRSLTE_SF_LEN_PRB(current_prb)); if (cnt == 0) { mean_rsrp = rsrp; - mean_rsrp_n = rsrp_n; mean_rsrq = rsrq; mean_snr = snr; mean_rssi = rssi; } else { mean_rsrp = SRSLTE_VEC_CMA(rsrp, mean_rsrp, cnt); - mean_rsrp_n = SRSLTE_VEC_CMA(rsrp_n, mean_rsrp_n, cnt); mean_rsrq = SRSLTE_VEC_CMA(rsrq, mean_rsrq, cnt); mean_snr = SRSLTE_VEC_CMA(snr, mean_snr, cnt); mean_rssi = SRSLTE_VEC_CMA(rssi, mean_rssi, cnt); @@ -1191,7 +1184,7 @@ phch_recv::measure::ret_code phch_recv::measure::run_subframe(uint32_t sf_idx) cnt++; log_h->debug("SYNC: Measuring RSRP %d/%d, sf_idx=%d, RSRP=%.1f dBm, corr-RSRP=%.1f dBm, SNR=%.1f dB\n", - cnt, nof_subframes, sf_idx, rsrp, rsrp_n, snr); + cnt, nof_subframes, sf_idx, rsrp, snr); if (cnt >= nof_subframes) { return MEASURE_OK; @@ -1220,7 +1213,6 @@ void phch_recv::scell_recv::init(srslte::log *log_h, bool sic_pss_enabled, uint3 uint32_t max_sf_size = SRSLTE_SF_LEN(max_fft_sz); sf_buffer[0] = (cf_t*) srslte_vec_malloc(sizeof(cf_t)*max_sf_size); - input_cfo_corrected = (cf_t*) srslte_vec_malloc(sizeof(cf_t)*15*max_sf_size); measure_p.init(sf_buffer, log_h, 1, max_sf_window); @@ -1257,7 +1249,6 @@ void phch_recv::scell_recv::reset() void phch_recv::scell_recv::deinit() { srslte_sync_free(&sync_find); - free(input_cfo_corrected); free(sf_buffer[0]); } @@ -1335,40 +1326,23 @@ int phch_recv::scell_recv::find_cells(cf_t *input_buffer, float rx_gain_offset, found_cell.nof_ports = 1; // Use port 0 only for measurement measure_p.set_cell(found_cell); - // Correct CFO - /* - srslte_cfo_correct(&sync_find.cfo_corr_frame, - input_buffer, - input_cfo_corrected, - -srslte_sync_get_cfo(&sync_find)/sync_find.fft_size); - */ - switch(measure_p.run_multiple_subframes(input_buffer, peak_idx, sf_idx, nof_sf)) { case measure::MEASURE_OK: // Consider a cell to be detectable 8.1.2.2.1.1 from 36.133. Currently only using first condition if (measure_p.rsrp() > ABSOLUTE_RSRP_THRESHOLD_DBM) { - // Check the cell id has been correctly identified by using the correlation of the RS sequences - // By experimentation, typically the cross-correlation is ~3/4 dB less - if (measure_p.rsrp_n() > measure_p.rsrp() - 6) { - cells[nof_cells].pci = found_cell.id; - cells[nof_cells].rsrp = measure_p.rsrp(); - cells[nof_cells].rsrq = measure_p.rsrq(); - cells[nof_cells].offset = measure_p.frame_st_idx(); - - Info( - "INTRA: Found neighbour cell %d: PCI=%03d, RSRP=%5.1f dBm, corr-RSRP=%5.1f dBm, peak_idx=%5d, peak_value=%3.2f, sf=%d, max_sf=%d, n_id_2=%d, CFO=%6.1f Hz\n", - nof_cells, cell_id, measure_p.rsrp(), measure_p.rsrp_n(), measure_p.frame_st_idx(), sync_find.peak_value, - sf_idx, max_sf5, n_id_2, 15000 * srslte_sync_get_cfo(&sync_find)); - - nof_cells++; - } else { - Info( - "INTRA: Found phantom cell %d: PCI=%03d, RSRP=%5.1f dBm, corr-RSRP=%5.1f dBm, peak_idx=%5d, peak_value=%3.2f, sf=%d, max_sf=%d, n_id_2=%d, CFO=%6.1f Hz\n", - nof_cells, cell_id, measure_p.rsrp(), measure_p.rsrp_n(), measure_p.frame_st_idx(), sync_find.peak_value, - sf_idx, max_sf5, n_id_2, 15000 * srslte_sync_get_cfo(&sync_find)); - } + cells[nof_cells].pci = found_cell.id; + cells[nof_cells].rsrp = measure_p.rsrp(); + cells[nof_cells].rsrq = measure_p.rsrq(); + cells[nof_cells].offset = measure_p.frame_st_idx(); + + Info( + "INTRA: Found neighbour cell %d: PCI=%03d, RSRP=%5.1f dBm, peak_idx=%5d, peak_value=%3.2f, sf=%d, nof_sf=%d, n_id_2=%d, CFO=%6.1f Hz\n", + nof_cells, cell_id, measure_p.rsrp(), measure_p.frame_st_idx(), sync_find.peak_value, + sf_idx, nof_sf, n_id_2, 15000 * srslte_sync_get_cfo(&sync_find)); + + nof_cells++; /* if (sic_pss_enabled) {