From d2aa25d451304f691c5b5014faf02fb198d0c6b2 Mon Sep 17 00:00:00 2001 From: David Rupprecht Date: Tue, 20 Apr 2021 16:20:48 +0200 Subject: [PATCH] Added option for simulated measurement --- srsue/hdr/stack/rrc/rrc_nr.h | 5 +++-- srsue/src/main.cc | 17 +++++++++-------- srsue/src/stack/rrc/rrc_nr.cc | 36 +++++++++++++++++------------------ srsue/ue.conf.example | 15 ++++++++------- 4 files changed, 38 insertions(+), 35 deletions(-) diff --git a/srsue/hdr/stack/rrc/rrc_nr.h b/srsue/hdr/stack/rrc/rrc_nr.h index 50830b008..cf9783ebf 100644 --- a/srsue/hdr/stack/rrc/rrc_nr.h +++ b/srsue/hdr/stack/rrc/rrc_nr.h @@ -40,6 +40,7 @@ struct core_less_args_t { struct rrc_nr_args_t { core_less_args_t coreless; + uint32_t sim_nr_meas_pci; std::string supported_bands_nr_str; std::vector supported_bands_nr; std::vector supported_bands_eutra; @@ -154,8 +155,8 @@ private: usim_interface_rrc_nr* usim = nullptr; stack_interface_rrc* stack = nullptr; - uint32_t fake_measurement_carrier_freq_r15; - srsran::timer_handler::unique_timer fake_measurement_timer; + uint32_t sim_measurement_carrier_freq_r15; + srsran::timer_handler::unique_timer sim_measurement_timer; /// RRC states (3GPP 38.331 v15.5.1 Sec 4.2.1) enum rrc_nr_state_t { diff --git a/srsue/src/main.cc b/srsue/src/main.cc index 64dd90d7f..6b1f3d68e 100644 --- a/srsue/src/main.cc +++ b/srsue/src/main.cc @@ -121,14 +121,15 @@ static int parse_args(all_args_t* args, int argc, char* argv[]) ("rat.nr.nof_carriers", bpo::value(&args->phy.nof_nr_carriers)->default_value(0), "Number of NR carriers") ("rat.nr.nof_prb", bpo::value(&args->phy.nr_nof_prb)->default_value(52), "NR carrier bandwidth") - ("rrc.feature_group", bpo::value(&args->stack.rrc.feature_group)->default_value(0xe6041000), "Hex value of the featureGroupIndicators field in the" - "UECapabilityInformation message. Default 0xe6041000") - ("rrc.ue_category", bpo::value(&args->stack.rrc.ue_category_str)->default_value(SRSRAN_UE_CATEGORY_DEFAULT), "UE Category (1 to 10)") - ("rrc.ue_category_dl", bpo::value(&args->stack.rrc.ue_category_dl)->default_value(-1), "UE Category DL v12 (valid values: 0, 4, 6, 7, 9 to 16)") - ("rrc.ue_category_ul", bpo::value(&args->stack.rrc.ue_category_ul)->default_value(-1), "UE Category UL v12 (valid values: 0, 3, 5, 7, 8 and 13)") - ("rrc.release", bpo::value(&args->stack.rrc.release)->default_value(SRSRAN_RELEASE_DEFAULT), "UE Release (8 to 15)") - ("rrc.mbms_service_id", bpo::value(&args->stack.rrc.mbms_service_id)->default_value(-1), "MBMS service id for autostart (-1 means disabled)") - ("rrc.mbms_service_port", bpo::value(&args->stack.rrc.mbms_service_port)->default_value(4321), "Port of the MBMS service") + ("rrc.feature_group", bpo::value(&args->stack.rrc.feature_group)->default_value(0xe6041000), "Hex value of the featureGroupIndicators field in the" + "UECapabilityInformation message. Default 0xe6041000") + ("rrc.ue_category", bpo::value(&args->stack.rrc.ue_category_str)->default_value(SRSRAN_UE_CATEGORY_DEFAULT), "UE Category (1 to 10)") + ("rrc.ue_category_dl", bpo::value(&args->stack.rrc.ue_category_dl)->default_value(-1), "UE Category DL v12 (valid values: 0, 4, 6, 7, 9 to 16)") + ("rrc.ue_category_ul", bpo::value(&args->stack.rrc.ue_category_ul)->default_value(-1), "UE Category UL v12 (valid values: 0, 3, 5, 7, 8 and 13)") + ("rrc.release", bpo::value(&args->stack.rrc.release)->default_value(SRSRAN_RELEASE_DEFAULT), "UE Release (8 to 15)") + ("rrc.mbms_service_id", bpo::value(&args->stack.rrc.mbms_service_id)->default_value(-1), "MBMS service id for autostart (-1 means disabled)") + ("rrc.mbms_service_port", bpo::value(&args->stack.rrc.mbms_service_port)->default_value(4321), "Port of the MBMS service") + ("rrc.nr_measurement_pci", bpo::value(&args->stack.rrc_nr.sim_nr_meas_pci)->default_value(500), "NR PCI for the simulated NR measurement") ("nas.apn", bpo::value(&args->stack.nas.apn_name)->default_value(""), "Set Access Point Name (APN) for data services") ("nas.apn_protocol", bpo::value(&args->stack.nas.apn_protocol)->default_value(""), "Set Access Point Name (APN) protocol for data services") diff --git a/srsue/src/stack/rrc/rrc_nr.cc b/srsue/src/stack/rrc/rrc_nr.cc index 24f55f3af..639416482 100644 --- a/srsue/src/stack/rrc/rrc_nr.cc +++ b/srsue/src/stack/rrc/rrc_nr.cc @@ -58,7 +58,7 @@ void rrc_nr::init(phy_interface_rrc_nr* phy_, args = args_; running = true; - fake_measurement_timer = task_sched.get_unique_timer(); + sim_measurement_timer = task_sched.get_unique_timer(); } void rrc_nr::stop() @@ -103,22 +103,22 @@ const char* rrc_nr::get_rb_name(uint32_t lcid) void rrc_nr::timer_expired(uint32_t timeout_id) { logger.debug("Handling Timer Expired"); - if (timeout_id == fake_measurement_timer.id()) { - logger.debug("Triggered Fake Measurement"); + if (timeout_id == sim_measurement_timer.id()) { + logger.debug("Triggered simulated measurement"); - phy_meas_nr_t fake_meas = {}; + phy_meas_nr_t sim_meas = {}; std::vector phy_meas_nr; - fake_meas.rsrp = -60.0; - fake_meas.rsrq = -60.0; - fake_meas.cfo_hz = 1.0; - fake_meas.arfcn_nr = fake_measurement_carrier_freq_r15; - fake_meas.pci_nr = 500; - phy_meas_nr.push_back(fake_meas); + sim_meas.rsrp = -60.0; + sim_meas.rsrq = -60.0; + sim_meas.cfo_hz = 1.0; + sim_meas.arfcn_nr = sim_measurement_carrier_freq_r15; + sim_meas.pci_nr = args.sim_nr_meas_pci; + phy_meas_nr.push_back(sim_meas); rrc_eutra->new_cell_meas_nr(phy_meas_nr); auto timer_expire_func = [this](uint32_t tid) { timer_expired(tid); }; - fake_measurement_timer.set(10, timer_expire_func); - fake_measurement_timer.run(); + sim_measurement_timer.set(10, timer_expire_func); + sim_measurement_timer.run(); } } @@ -405,10 +405,10 @@ void rrc_nr::get_nr_capabilities(srsran::byte_buffer_t* nr_caps_pdu) void rrc_nr::phy_meas_stop() { - // possbile race condition for fake_measurement timer, which might be set at the same moment as stopped => fix with + // possbile race condition for sim_measurement timer, which might be set at the same moment as stopped => fix with // phy integration - logger.debug("Stopping fake measurements"); - fake_measurement_timer.stop(); + logger.debug("Stopping simulated measurements"); + sim_measurement_timer.stop(); } void rrc_nr::phy_set_cells_to_meas(uint32_t carrier_freq_r15) @@ -416,9 +416,9 @@ void rrc_nr::phy_set_cells_to_meas(uint32_t carrier_freq_r15) logger.debug("Measuring phy cell %d ", carrier_freq_r15); // Start timer for fake measurements auto timer_expire_func = [this](uint32_t tid) { timer_expired(tid); }; - fake_measurement_carrier_freq_r15 = carrier_freq_r15; - fake_measurement_timer.set(10, timer_expire_func); - fake_measurement_timer.run(); + sim_measurement_carrier_freq_r15 = carrier_freq_r15; + sim_measurement_timer.set(10, timer_expire_func); + sim_measurement_timer.run(); } bool rrc_nr::configure_sk_counter(uint16_t sk_counter) diff --git a/srsue/ue.conf.example b/srsue/ue.conf.example index 3632f9c05..ce10510be 100644 --- a/srsue/ue.conf.example +++ b/srsue/ue.conf.example @@ -147,13 +147,14 @@ imei = 353490069873319 ##################################################################### # RRC configuration # -# ue_category: Sets UE category (range 1-5). Default: 4 -# release: UE Release (8 to 15) -# feature_group: Hex value of the featureGroupIndicators field in the -# UECapabilityInformation message. Default 0xe6041000 -# mbms_service_id: MBMS service id for autostarting MBMS reception -# (default -1 means disabled) -# mbms_service_port: Port of the MBMS service +# ue_category: Sets UE category (range 1-5). Default: 4 +# release: UE Release (8 to 15) +# feature_group: Hex value of the featureGroupIndicators field in the +# UECapabilityInformation message. Default 0xe6041000 +# mbms_service_id: MBMS service id for autostarting MBMS reception +# (default -1 means disabled) +# mbms_service_port: Port of the MBMS service +# nr_measurement_pci: NR PCI for the simulated NR measurement. Default: 500 ##################################################################### [rrc] #ue_category = 4