From e2c3a304b7c04d1d06ffa50b2f999712f0018b30 Mon Sep 17 00:00:00 2001 From: Ismael Gomez Date: Thu, 1 Feb 2018 18:17:40 +0100 Subject: [PATCH] In-sync and out-of-sync after 100 and 200 ms. Use RSRP -124 dBm as per the specs instead of SNR --- srsue/hdr/phy/phch_recv.h | 7 +++++++ srsue/src/phy/phch_recv.cc | 20 ++++++++++++++++++-- srsue/src/phy/phch_worker.cc | 16 +++++++--------- 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/srsue/hdr/phy/phch_recv.h b/srsue/hdr/phy/phch_recv.h index 0530459df..50ea28f96 100644 --- a/srsue/hdr/phy/phch_recv.h +++ b/srsue/hdr/phy/phch_recv.h @@ -291,6 +291,13 @@ private: // Sync metrics sync_metrics_t metrics; + // in-sync / out-of-sync counters + uint32_t out_of_sync_cnt; + uint32_t in_sync_cnt; + + const static uint32_t NOF_OUT_OF_SYNC_SF = 200; + const static uint32_t NOF_IN_SYNC_SF = 100; + // State for primary cell enum { IDLE = 0, diff --git a/srsue/src/phy/phch_recv.cc b/srsue/src/phy/phch_recv.cc index 7d89892c9..de80d53c7 100644 --- a/srsue/src/phy/phch_recv.cc +++ b/srsue/src/phy/phch_recv.cc @@ -124,6 +124,8 @@ void phch_recv::stop() void phch_recv::reset() { + in_sync_cnt = 0; + out_of_sync_cnt = 0; tx_mutex_cnt = 0; phy_state = IDLE; time_adv_sec = 0; @@ -713,6 +715,7 @@ void phch_recv::run_thread() intra_freq_meas.write(tti, buffer[0], SRSLTE_SF_LEN_PRB(cell.nof_prb)); break; case 0: + Warning("SYNC: Out-of-sync detected in PSS/SSS\n"); out_of_sync(); worker->release(); worker_com->reset_ul(); @@ -742,11 +745,24 @@ void phch_recv::run_thread() } void phch_recv::in_sync() { - rrc->in_sync(); + out_of_sync_cnt = 0; + in_sync_cnt++; + // Send RRC in-sync signal after 100 ms consecutive subframes + if (in_sync_cnt == NOF_IN_SYNC_SF) { + rrc->in_sync(); + in_sync_cnt = 0; + } } +// Out of sync called by worker or phch_recv every 1 or 5 ms void phch_recv::out_of_sync() { - rrc->out_of_sync(); + in_sync_cnt = 0; + // Send RRC out-of-sync signal after 200 ms consecutive subframes + out_of_sync_cnt++; + if (out_of_sync_cnt >= NOF_OUT_OF_SYNC_SF) { + rrc->out_of_sync(); + out_of_sync_cnt = 0; + } } diff --git a/srsue/src/phy/phch_worker.cc b/srsue/src/phy/phch_worker.cc index ebb8710d5..8644beee6 100644 --- a/srsue/src/phy/phch_worker.cc +++ b/srsue/src/phy/phch_worker.cc @@ -241,15 +241,12 @@ void phch_worker::work_imp() /* Do FFT and extract PDCCH LLR, or quit if no actions are required in this subframe */ bool chest_ok = extract_fft_and_pdcch_llr(); - bool snr_th_err = 10*log10(srslte_chest_dl_get_snr(&ue_dl.chest))<-20.0; - bool snr_th_ok = 10*log10(srslte_chest_dl_get_snr(&ue_dl.chest))>-15.0; - // Call feedback loop for chest if (chest_loop && ((1<<(tti%10)) & phy->args->cfo_ref_mask)) { chest_loop->set_cfo(srslte_chest_dl_get_cfo(&ue_dl.chest)); } - if (chest_ok && !snr_th_err) { + if (chest_ok) { /***** Downlink Processing *******/ @@ -370,12 +367,13 @@ void phch_worker::work_imp() update_measurements(); if (chest_ok) { - if (snr_th_ok) { - log_h->debug("SNR=%.1f dB sync=in-sync from channel estimator\n", 10*log10(srslte_chest_dl_get_snr(&ue_dl.chest))); + if (phy->avg_rsrp_dbm > -124.0) { + log_h->debug("SNR=%.1f dB, RSRP=%.1f dBm sync=in-sync from channel estimator\n", + 10*log10(srslte_chest_dl_get_snr(&ue_dl.chest)), phy->avg_rsrp_dbm); chest_loop->in_sync(); - } else if (snr_th_err) { - log_h->info("SNR=%.1f dB sync=out-of-sync from channel estimator\n", - 10*log10(srslte_chest_dl_get_snr(&ue_dl.chest))); + } else { + log_h->warning("SNR=%.1f dB RSRP=%.1f dBm, sync=out-of-sync from channel estimator\n", + 10*log10(srslte_chest_dl_get_snr(&ue_dl.chest)), phy->avg_rsrp_dbm); chest_loop->out_of_sync(); } }