From 49e7b8e36e55ea1783e3f7059a6ca2869e535857 Mon Sep 17 00:00:00 2001 From: Francisco Paisana Date: Thu, 8 Oct 2020 17:45:16 +0100 Subject: [PATCH] - Change periodicity of cell reselection after a new serving cell has been selected - Enable PHY intra measurements during RRC_IDLE --- srsue/hdr/stack/rrc/rrc_procedures.h | 3 ++- srsue/src/stack/rrc/rrc_procedures.cc | 23 ++++++++++++++++------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/srsue/hdr/stack/rrc/rrc_procedures.h b/srsue/hdr/stack/rrc/rrc_procedures.h index f56160b12..bdef71168 100644 --- a/srsue/hdr/stack/rrc/rrc_procedures.h +++ b/srsue/hdr/stack/rrc/rrc_procedures.h @@ -263,7 +263,7 @@ private: class rrc::cell_reselection_proc { public: - const static uint32_t cell_reselection_periodicity_ms = 20; + const static uint32_t cell_reselection_periodicity_ms = 20, cell_reselection_periodicity_long_ms = 1000; cell_reselection_proc(rrc* rrc_); srslte::proc_outcome_t init(); @@ -276,6 +276,7 @@ private: srslte::timer_handler::unique_timer reselection_timer; srslte::proc_future_t cell_selection_fut; + cs_result_t cell_sel_result; }; class rrc::connection_reest_proc diff --git a/srsue/src/stack/rrc/rrc_procedures.cc b/srsue/src/stack/rrc/rrc_procedures.cc index 95d3a4a2e..ff4531b17 100644 --- a/srsue/src/stack/rrc/rrc_procedures.cc +++ b/srsue/src/stack/rrc/rrc_procedures.cc @@ -1203,12 +1203,6 @@ rrc::cell_reselection_proc::cell_reselection_proc(srsue::rrc* rrc_) : rrc_ptr(rr proc_outcome_t rrc::cell_reselection_proc::init() { - if (rrc_ptr->meas_cells.nof_neighbours() == 0 and rrc_ptr->phy_ctrl->is_in_sync() and - rrc_ptr->phy->cell_is_camping()) { - // don't bother with cell selection if there are no neighbours and we are already camping - return proc_outcome_t::success; - } - Info("Starting...\n"); if (not rrc_ptr->cell_selector.launch(&cell_selection_fut)) { Error("Failed to initiate a Cell Selection procedure...\n"); @@ -1227,9 +1221,10 @@ proc_outcome_t rrc::cell_reselection_proc::step() Error("Error while selecting a cell\n"); return srslte::proc_outcome_t::error; } + cell_sel_result = *cell_selection_fut.value(); Info("Cell Selection completed. Handling its result...\n"); - switch (*cell_selection_fut.value()) { + switch (cell_sel_result) { case cs_result_t::changed_cell: if (rrc_ptr->state == rrc_state_t::RRC_STATE_IDLE) { Info("New cell has been selected, start receiving PCCH\n"); @@ -1253,6 +1248,20 @@ void rrc::cell_reselection_proc::then(const srslte::proc_state_t& result) { // Schedule cell reselection periodically, while rrc is idle if (not rrc_ptr->is_connected() and rrc_ptr->nas->is_attached()) { + if (cell_sel_result == cs_result_t::changed_cell) { + // TS 36.304 5.2.4.6 - Intra-frequency and equal priority inter-frequency Cell Reselection criteria + // the UE shall reselect a new cell if more than 1 second has elapsed since the UE camped + // on the current serving cell. + reselection_timer.set(cell_reselection_periodicity_long_ms); + + // start intra-frequency measurements if necessary + // UE must start intra-frequency measurements + auto pci = rrc_ptr->meas_cells.get_neighbour_pcis(rrc_ptr->meas_cells.serving_cell().get_earfcn()); + rrc_ptr->phy->set_cells_to_meas(rrc_ptr->meas_cells.serving_cell().get_earfcn(), pci); + } else { + reselection_timer.set(cell_reselection_periodicity_ms); + } + reselection_timer.run(); } }