|
|
|
@ -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));
|
|
|
|
|
"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++;
|
|
|
|
|
} 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));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
if (sic_pss_enabled) {
|
|
|
|
|