UE RRC NR includes cell search in the initial cell selection procedure

master
Xavier Arteaga 3 years ago committed by Xavier Arteaga
parent c26f030edb
commit 8854ba49b9

@ -87,7 +87,6 @@ public:
// PHY interface
void in_sync() final;
void out_of_sync() final;
void cell_search_found_cell(const cell_search_result_t& result) final{};
// RLC interface
void max_retx_attempted() final;
@ -122,8 +121,9 @@ public:
void rrc_release();
bool configure_sk_counter(uint16_t sk_counter);
bool is_config_pending();
// STACK interface
void cell_search_completed(const rrc_interface_phy_lte::cell_search_ret_t& cs_ret, const phy_cell_t& found_cell);
void cell_search_found_cell(const rrc_interface_phy_nr::cell_search_result_t& result) final;
void cell_select_completed(const cell_select_result_t& result) final;
void set_phy_config_complete(bool status) final;

@ -32,7 +32,8 @@ public:
srsran::proc_outcome_t step();
cell_search_result_t get_result() const { return cell_search_ret; }
static const char* name() { return "Cell Selection"; }
srsran::proc_outcome_t react(const bool& event);
srsran::proc_outcome_t react(const rrc_interface_phy_nr::cell_search_result_t& result);
srsran::proc_outcome_t react(const rrc_interface_phy_nr::cell_select_result_t& result);
void then(const srsran::proc_result_t<cell_search_result_t>& proc_result) const;
private:

@ -125,7 +125,8 @@ public:
void run_tti(uint32_t tti, uint32_t tti_jump) final;
// RRC interface for NR PHY
void cell_search_found_cell(const cell_search_result_t& result) final {}
void cell_search_found_cell(const cell_search_result_t& result) final;
void cell_select_completed(const cell_select_result_t& result) final;
// MAC Interface for NR PHY
void tb_decoded(const uint32_t cc_idx,
@ -168,7 +169,6 @@ public:
void reset_eps_bearers() final;
srsran::ext_task_sched_handle get_task_sched() { return {&task_sched}; }
void cell_select_completed(const cell_select_result_t& result) override;
private:
void run_thread() final;

@ -396,12 +396,8 @@ void rrc_nr::handle_sib1(const sib1_s& sib1)
// Apply SSB Config
fill_phy_ssb_cfg(sib1.serving_cell_cfg_common, &phy_cfg.ssb);
// Init cell selection
phy_interface_rrc_nr::cell_select_args_t cell_cfg = {};
cell_cfg.carrier = phy_cfg.carrier;
cell_cfg.ssb_cfg = phy_cfg.get_ssb_cfg();
if (not phy->start_cell_select(cell_cfg)) {
logger.warning("Could not set start cell select.");
if (not phy->set_config(phy_cfg)) {
logger.warning("Could not set phy config.");
return;
}
}
@ -1998,8 +1994,10 @@ void rrc_nr::ra_problem()
void rrc_nr::release_pucch_srs() {}
// STACK interface
void rrc_nr::cell_search_completed(const rrc_interface_phy_lte::cell_search_ret_t& cs_ret, const phy_cell_t& found_cell)
{}
void rrc_nr::cell_search_found_cell(const rrc_interface_phy_nr::cell_search_result_t& result)
{
cell_selector.trigger(result);
}
void rrc_nr::set_phy_config_complete(bool status)
{
@ -2021,10 +2019,7 @@ void rrc_nr::set_phy_config_complete(bool status)
void rrc_nr::cell_select_completed(const rrc_interface_phy_nr::cell_select_result_t& result)
{
if (not phy->set_config(phy_cfg)) {
logger.warning("Could not set phy config.");
return;
}
cell_selector.trigger(result);
}
} // namespace srsue

@ -367,18 +367,21 @@ proc_outcome_t rrc_nr::cell_selection_proc::init()
init_serv_cell = meas_cells.serving_cell().phy_cell;
// TODO: add full cell selection
phy_interface_rrc_nr::cell_select_args_t cell_cfg = {};
cell_cfg.carrier = rrc_handle.phy_cfg.carrier;
cell_cfg.ssb_cfg = rrc_handle.phy_cfg.get_ssb_cfg();
rrc_handle.phy->start_cell_select(cell_cfg);
// Skip cell selection if serving cell is suitable and there are no stronger neighbours in same earfcn
if (is_serv_cell_suitable()) {
Debug("Skipping cell selection procedure as there are no stronger neighbours in same EARFCN.");
return set_proc_complete();
// Start cell search
phy_interface_rrc_nr::cell_search_args_t cs_args = {};
cs_args.center_freq_hz = rrc_handle.phy_cfg.carrier.dl_center_frequency_hz;
cs_args.ssb_freq_hz = rrc_handle.phy_cfg.carrier.ssb_center_freq_hz;
cs_args.ssb_scs = rrc_handle.phy_cfg.ssb.scs;
cs_args.ssb_pattern = rrc_handle.phy_cfg.ssb.pattern;
cs_args.duplex_mode = rrc_handle.phy_cfg.duplex.mode;
if (not rrc_handle.phy->start_cell_search(cs_args)) {
Error("Could not set start cell search.");
return proc_outcome_t::error;
}
return set_proc_complete();
state = search_state_t::cell_search;
return proc_outcome_t::yield;
}
proc_outcome_t rrc_nr::cell_selection_proc::step()
@ -400,6 +403,61 @@ proc_outcome_t rrc_nr::cell_selection_proc::step()
return proc_outcome_t::error;
}
proc_outcome_t rrc_nr::cell_selection_proc::react(const rrc_interface_phy_nr::cell_search_result_t& result)
{
if (state != search_state_t::cell_search) {
Error("Cell search result received in wrong state");
return proc_outcome_t::error;
}
// Print result only if the cell is found
if (result.cell_found) {
// Convert Cell measurement in Text
std::array<char, 512> csi_info_str = {};
srsran_csi_meas_info_short(&result.measurements, csi_info_str.data(), (uint32_t)csi_info_str.size());
// Unpack MIB and convert to text
srsran_mib_nr_t mib = {};
std::array<char, 512> mib_info_str = {};
if (srsran_pbch_msg_nr_mib_unpack(&result.pbch_msg, &mib) == SRSASN_SUCCESS) {
// Convert to text
srsran_pbch_msg_nr_mib_info(&mib, mib_info_str.data(), (uint32_t)mib_info_str.size());
} else {
// It could be the PBCH does not carry MIB
strcpy(mib_info_str.data(), "No MIB found");
}
// Logs the PCI, cell measurements and decoded MIB
Info("Cell search found PCI=%d %s %s", result.pci, csi_info_str.data(), mib_info_str.data());
} else {
Info("Cell search did not find any cell");
}
// Transition to cell selection ignoring the cell search result
state = search_state_t::cell_selection;
phy_interface_rrc_nr::cell_select_args_t cs_args = {};
cs_args.carrier = rrc_handle.phy_cfg.carrier;
cs_args.ssb_cfg = rrc_handle.phy_cfg.get_ssb_cfg();
if (not rrc_handle.phy->start_cell_select(cs_args)) {
Error("Could not set start cell search.");
return proc_outcome_t::error;
}
return proc_outcome_t::yield;
}
proc_outcome_t rrc_nr::cell_selection_proc::react(const rrc_interface_phy_nr::cell_select_result_t& result)
{
if (state != search_state_t::cell_selection) {
Error("Cell selection result received in wrong state");
return proc_outcome_t::error;
}
return set_proc_complete();
}
void rrc_nr::cell_selection_proc::then(const srsran::proc_result_t<cell_search_result_t>& proc_result) const
{
Info("Completed with %s.", proc_result.is_success() ? "success" : "failure");

@ -510,9 +510,13 @@ void ue_stack_lte::set_phy_config_complete(bool status)
cfg_task_queue.push([this, status]() { rrc_nr.set_phy_config_complete(status); });
}
void ue_stack_lte::cell_search_found_cell(const cell_search_result_t& result)
{
cfg_task_queue.push([this, result]() { rrc_nr.cell_search_found_cell(result); });
}
void ue_stack_lte::cell_select_completed(const rrc_interface_phy_nr::cell_select_result_t& result)
{
rrc_nr.cell_select_completed(result);
cfg_task_queue.push([this, result]() { rrc_nr.cell_select_completed(result); });
}
} // namespace srsue

@ -202,6 +202,11 @@ void ue_stack_nr::set_phy_config_complete(bool status)
sync_task_queue.push([this, status]() { rrc->set_phy_config_complete(status); });
}
void ue_stack_nr::cell_search_found_cell(const cell_search_result_t& result)
{
sync_task_queue.push([this, result]() { rrc->cell_search_found_cell(result); });
}
void ue_stack_nr::cell_select_completed(const rrc_interface_phy_nr::cell_select_result_t& result)
{
sync_task_queue.push([this, result]() { rrc->cell_select_completed(result); });

Loading…
Cancel
Save