From 17f9ff326bf7bc65002f167acfcfb661607201aa Mon Sep 17 00:00:00 2001 From: Ismael Gomez Date: Thu, 16 Jan 2020 12:16:28 +0100 Subject: [PATCH] Expose in-sync and out-of-sync constants to ue.conf --- lib/include/srslte/interfaces/ue_interfaces.h | 5 +++++ srsue/hdr/phy/sync.h | 3 --- srsue/src/main.cc | 16 ++++++++++++++++ srsue/src/phy/sf_worker.cc | 2 +- srsue/src/phy/sync.cc | 6 +++--- srsue/ue.conf.example | 10 ++++++++++ 6 files changed, 35 insertions(+), 7 deletions(-) diff --git a/lib/include/srslte/interfaces/ue_interfaces.h b/lib/include/srslte/interfaces/ue_interfaces.h index 95afe44bb..64bdcb510 100644 --- a/lib/include/srslte/interfaces/ue_interfaces.h +++ b/lib/include/srslte/interfaces/ue_interfaces.h @@ -522,6 +522,11 @@ typedef struct { bool pregenerate_signals = false; float force_ul_amplitude = 0.0f; + float in_sync_rsrp_dbm_th = -130.0f; + float in_sync_snr_db_th = 1.0f; + uint32_t nof_in_sync_events = 10; + uint32_t nof_out_of_sync_events = 20; + srslte::channel::args_t dl_channel_args; srslte::channel::args_t ul_channel_args; } phy_args_t; diff --git a/srsue/hdr/phy/sync.h b/srsue/hdr/phy/sync.h index 274b6edee..e9370e29e 100644 --- a/srsue/hdr/phy/sync.h +++ b/srsue/hdr/phy/sync.h @@ -202,9 +202,6 @@ private: uint32_t out_of_sync_cnt = 0; uint32_t in_sync_cnt = 0; - const static uint32_t NOF_OUT_OF_SYNC_SF = 20; - const static uint32_t NOF_IN_SYNC_SF = 10; - // State machine for SYNC thread class sync_state { diff --git a/srsue/src/main.cc b/srsue/src/main.cc index fa8fc344f..0bf9fe4d8 100644 --- a/srsue/src/main.cc +++ b/srsue/src/main.cc @@ -337,6 +337,22 @@ static int parse_args(all_args_t* args, int argc, char* argv[]) bpo::value(&args->phy.force_ul_amplitude)->default_value(0.0), "Forces the peak amplitude in the PUCCH, PUSCH and SRS (set 0.0 to 1.0, set to 0 or negative for disabling)") + ("phy.in_sync_rsrp_dbm_th", + bpo::value(&args->phy.in_sync_rsrp_dbm_th)->default_value(-130.0f), + "RSRP threshold (in dBm) above which the UE considers to be in-sync") + + ("phy.in_sync_snr_db_th", + bpo::value(&args->phy.in_sync_snr_db_th)->default_value(1.0f), + "SNR threshold (in dB) above which the UE considers to be in-sync") + + ("phy.nof_in_sync_events", + bpo::value(&args->phy.nof_in_sync_events)->default_value(10), + "Number of PHY in-sync events before sending an in-sync event to RRC") + + ("phy.nof_out_of_sync_events", + bpo::value(&args->phy.nof_out_of_sync_events)->default_value(20), + "Number of PHY out-sync events before sending an out-sync event to RRC") + /* general options */ ("general.metrics_period_secs", bpo::value(&args->general.metrics_period_secs)->default_value(1.0), diff --git a/srsue/src/phy/sf_worker.cc b/srsue/src/phy/sf_worker.cc index 127bfbe55..e41937717 100644 --- a/srsue/src/phy/sf_worker.cc +++ b/srsue/src/phy/sf_worker.cc @@ -333,7 +333,7 @@ void sf_worker::update_measurements() } // Check in-sync / out-sync conditions - if (phy->avg_rsrp_dbm[0] > -130.0 && phy->avg_snr_db_cqi[0] > -6.0) { + if (phy->avg_rsrp_dbm[0] > phy->args->in_sync_rsrp_dbm_th && phy->avg_snr_db_cqi[0] > phy->args->in_sync_snr_db_th) { log_h->debug("SNR=%.1f dB, RSRP=%.1f dBm sync=in-sync from channel estimator\n", phy->avg_snr_db_cqi[0], phy->avg_rsrp_dbm[0]); diff --git a/srsue/src/phy/sync.cc b/srsue/src/phy/sync.cc index 4d6f6b493..aa2e8941a 100644 --- a/srsue/src/phy/sync.cc +++ b/srsue/src/phy/sync.cc @@ -681,7 +681,7 @@ void sync::in_sync() { in_sync_cnt++; // Send RRC in-sync signal after 100 ms consecutive subframes - if (in_sync_cnt == NOF_IN_SYNC_SF) { + if (in_sync_cnt == worker_com->args->nof_in_sync_events) { stack->in_sync(); in_sync_cnt = 0; out_of_sync_cnt = 0; @@ -692,9 +692,9 @@ void sync::in_sync() void sync::out_of_sync() { // Send RRC out-of-sync signal after NOF_OUT_OF_SYNC_SF consecutive subframes - Info("Out-of-sync %d/%d\n", out_of_sync_cnt, NOF_OUT_OF_SYNC_SF); + Info("Out-of-sync %d/%d\n", out_of_sync_cnt, worker_com->args->nof_out_of_sync_events); out_of_sync_cnt++; - if (out_of_sync_cnt == NOF_OUT_OF_SYNC_SF) { + if (out_of_sync_cnt == worker_com->args->nof_out_of_sync_events) { Info("Sending to RRC\n"); stack->out_of_sync(); out_of_sync_cnt = 0; diff --git a/srsue/ue.conf.example b/srsue/ue.conf.example index 0afa78bdb..c000a2f68 100644 --- a/srsue/ue.conf.example +++ b/srsue/ue.conf.example @@ -306,6 +306,11 @@ enable = false # pdsch_8bit_decoder: Use 8-bit for LLR representation and turbo decoder trellis computation (Experimental) # force_ul_amplitude: Forces the peak amplitude in the PUCCH, PUSCH and SRS (set 0.0 to 1.0, set to 0 or negative for disabling) # +# in_sync_rsrp_dbm_th: RSRP threshold (in dBm) above which the UE considers to be in-sync +# in_sync_snr_db_th: SNR threshold (in dB) above which the UE considers to be in-sync +# nof_in_sync_events: Number of PHY in-sync events before sending an in-sync event to RRC +# nof_out_of_sync_events: Number of PHY out-sync events before sending an out-sync event to RRC +# ##################################################################### [phy] #rx_gain_offset = 62 @@ -331,6 +336,11 @@ enable = false #pdsch_8bit_decoder = false #force_ul_amplitude = 0 +#in_sync_rsrp_dbm_th = -130.0 +#in_sync_snr_db_th = 1.0 +#nof_in_sync_events = 10 +#nof_out_of_sync_events = 20 + ##################################################################### # General configuration options #