Added UL EARFCN map and UE PHY interface cleanup

master
Xavier Arteaga 5 years ago committed by Xavier Arteaga
parent 7291a5db91
commit 58803d1b3e

@ -460,8 +460,10 @@ typedef struct {
std::string type = "lte"; std::string type = "lte";
srslte::phy_log_args_t log; srslte::phy_log_args_t log;
std::string dl_earfcn = "3400"; // comma-separated list of EARFCNs std::string dl_earfcn = "3400"; // comma-separated list of DL EARFCNs
std::vector<uint32_t> earfcn_list = {3400}; // vectorized version of dl_earfcn that gets populated during init std::string ul_earfcn = ""; // comma-separated list of UL EARFCNs
std::vector<uint32_t> dl_earfcn_list = {3400}; // vectorized version of dl_earfcn that gets populated during init
std::map<uint32_t, uint32_t> ul_earfcn_map; // Map linking DL EARFCN and UL EARFCN
float dl_freq = -1.0f; float dl_freq = -1.0f;
float ul_freq = -1.0f; float ul_freq = -1.0f;

@ -61,8 +61,6 @@ public:
void enable_pregen_signals(bool enable) final; void enable_pregen_signals(bool enable) final;
void set_earfcn(std::vector<uint32_t> earfcns) final;
void radio_overflow() final; void radio_overflow() final;
void radio_failure() final; void radio_failure() final;

@ -168,6 +168,15 @@ public:
bool is_mbsfn_sf(srslte_mbsfn_cfg_t* cfg, uint32_t tti); bool is_mbsfn_sf(srslte_mbsfn_cfg_t* cfg, uint32_t tti);
void set_mch_period_stop(uint32_t stop); void set_mch_period_stop(uint32_t stop);
/**
* Deduces the UL EARFCN from a DL EARFCN. If the UL-EARFCN was defined in the UE PHY arguments it will use the
* corresponding UL-EARFCN to the DL-EARFCN. Otherwise, it will use default.
*
* @param dl_earfcn
* @return the deduced UL EARFCN
*/
uint32_t get_ul_earfcn(uint32_t dl_earfcn);
private: private:
bool have_mtch_stop = false; bool have_mtch_stop = false;
std::mutex mtch_mutex; std::mutex mtch_mutex;

@ -83,7 +83,6 @@ public:
// From UE configuration // From UE configuration
void set_agc_enable(bool enable); void set_agc_enable(bool enable);
void set_earfcn(std::vector<uint32_t> earfcn);
void force_freq(float dl_freq, float ul_freq); void force_freq(float dl_freq, float ul_freq);
// Other functions // Other functions
@ -155,8 +154,6 @@ private:
* measurements offline using sync object and finding multiple cells for each N_id_2 * measurements offline using sync object and finding multiple cells for each N_id_2
*/ */
std::vector<uint32_t> earfcn;
void reset(); void reset();
void radio_error(); void radio_error();
void set_ue_sync_opts(srslte_ue_sync_t* q, float cfo); void set_ue_sync_opts(srslte_ue_sync_t* q, float cfo);

@ -45,8 +45,6 @@ public:
virtual int init(const phy_args_t& args_, stack_interface_phy_lte* stack_, srslte::radio_interface_phy* radio_) = 0; virtual int init(const phy_args_t& args_, stack_interface_phy_lte* stack_, srslte::radio_interface_phy* radio_) = 0;
virtual void stop() = 0; virtual void stop() = 0;
virtual void set_earfcn(std::vector<uint32_t> earfcns) = 0;
virtual void wait_initialize() = 0; virtual void wait_initialize() = 0;
virtual void start_plot() = 0; virtual void start_plot() = 0;

@ -45,8 +45,6 @@ public:
virtual void stop() = 0; virtual void stop() = 0;
virtual void set_earfcn(std::vector<uint32_t> earfcns) = 0;
virtual void wait_initialize() = 0; virtual void wait_initialize() = 0;
virtual void start_plot() = 0; virtual void start_plot() = 0;

@ -72,6 +72,7 @@ static int parse_args(all_args_t* args, int argc, char* argv[])
("ue.stack", bpo::value<string>(&args->stack.type)->default_value("lte"), "Type of the upper stack [lte]") ("ue.stack", bpo::value<string>(&args->stack.type)->default_value("lte"), "Type of the upper stack [lte]")
("rf.dl_earfcn", bpo::value<string>(&args->phy.dl_earfcn)->default_value("3400"), "Downlink EARFCN list") ("rf.dl_earfcn", bpo::value<string>(&args->phy.dl_earfcn)->default_value("3400"), "Downlink EARFCN list")
("rf.ul_earfcn", bpo::value<string>(&args->phy.ul_earfcn), "Uplink EARFCN list. Optional.")
("rf.freq_offset", bpo::value<float>(&args->rf.freq_offset)->default_value(0), "(optional) Frequency offset") ("rf.freq_offset", bpo::value<float>(&args->rf.freq_offset)->default_value(0), "(optional) Frequency offset")
("rf.dl_freq", bpo::value<float>(&args->phy.dl_freq)->default_value(-1), "Downlink Frequency (if positive overrides EARFCN)") ("rf.dl_freq", bpo::value<float>(&args->phy.dl_freq)->default_value(-1), "Downlink Frequency (if positive overrides EARFCN)")
("rf.ul_freq", bpo::value<float>(&args->phy.ul_freq)->default_value(-1), "Uplink Frequency (if positive overrides EARFCN)") ("rf.ul_freq", bpo::value<float>(&args->phy.ul_freq)->default_value(-1), "Uplink Frequency (if positive overrides EARFCN)")

@ -126,8 +126,6 @@ int phy::init(const phy_args_t& args_)
args = args_; args = args_;
set_earfcn(args.earfcn_list);
// Force frequency if given as argument // Force frequency if given as argument
if (args.dl_freq > 0 && args.ul_freq > 0) { if (args.dl_freq > 0 && args.ul_freq > 0) {
sfsync.force_freq(args.dl_freq, args.ul_freq); sfsync.force_freq(args.dl_freq, args.ul_freq);
@ -382,11 +380,6 @@ int phy::sr_last_tx_tti()
return common.sr_last_tx_tti; return common.sr_last_tx_tti;
} }
void phy::set_earfcn(vector<uint32_t> earfcns)
{
sfsync.set_earfcn(earfcns);
}
void phy::set_rar_grant(uint8_t grant_payload[SRSLTE_RAR_GRANT_LEN], uint16_t rnti) void phy::set_rar_grant(uint8_t grant_payload[SRSLTE_RAR_GRANT_LEN], uint16_t rnti)
{ {
common.set_rar_grant(grant_payload, rnti, tdd_config); common.set_rar_grant(grant_payload, rnti, tdd_config);
@ -454,7 +447,7 @@ void phy::set_config(srslte::phy_cfg_t& config_, uint32_t cc_idx, uint32_t earfc
// Change frequency only if the earfcn was modified // Change frequency only if the earfcn was modified
if (common.scell_cfg[cc_idx].earfcn != earfcn) { if (common.scell_cfg[cc_idx].earfcn != earfcn) {
double dl_freq = srslte_band_fd(earfcn) * 1e6; double dl_freq = srslte_band_fd(earfcn) * 1e6;
double ul_freq = srslte_band_fu(srslte_band_ul_earfcn(earfcn)) * 1e6; double ul_freq = srslte_band_fu(common.get_ul_earfcn(earfcn)) * 1e6;
radio->set_rx_freq(cc_idx, dl_freq); radio->set_rx_freq(cc_idx, dl_freq);
radio->set_tx_freq(cc_idx, ul_freq); radio->set_tx_freq(cc_idx, ul_freq);
} }

@ -742,6 +742,21 @@ void phy_common::set_mch_period_stop(uint32_t stop)
mtch_cvar.notify_one(); mtch_cvar.notify_one();
} }
uint32_t phy_common::get_ul_earfcn(uint32_t dl_earfcn)
{
// Set default UL-EARFCN
uint32_t ul_earfcn = srslte_band_ul_earfcn(dl_earfcn);
// Try to find current DL-EARFCN in the map
auto it = args->ul_earfcn_map.find(dl_earfcn);
if (it != args->ul_earfcn_map.end()) {
// If found UL EARFCN in the map, use it
ul_earfcn = it->second;
}
return ul_earfcn;
}
bool phy_common::is_mch_subframe(srslte_mbsfn_cfg_t* cfg, uint32_t phy_tti) bool phy_common::is_mch_subframe(srslte_mbsfn_cfg_t* cfg, uint32_t phy_tti)
{ {
uint32_t sfn; // System Frame Number uint32_t sfn; // System Frame Number

@ -185,7 +185,7 @@ phy_interface_rrc_lte::cell_search_ret_t sync::cell_search(phy_interface_rrc_lte
ret.last_freq = phy_interface_rrc_lte::cell_search_ret_t::NO_MORE_FREQS; ret.last_freq = phy_interface_rrc_lte::cell_search_ret_t::NO_MORE_FREQS;
// Move state to IDLE // Move state to IDLE
Info("Cell Search: Start EARFCN index=%u/%zd\n", cellsearch_earfcn_index, earfcn.size()); Info("Cell Search: Start EARFCN index=%u/%zd\n", cellsearch_earfcn_index, worker_com->args->dl_earfcn_list.size());
phy_state.go_idle(); phy_state.go_idle();
worker_com->reset(); worker_com->reset();
@ -200,8 +200,8 @@ phy_interface_rrc_lte::cell_search_ret_t sync::cell_search(phy_interface_rrc_lte
} }
try { try {
if (current_earfcn != (int)earfcn.at(cellsearch_earfcn_index)) { if (current_earfcn != (int)worker_com->args->dl_earfcn_list.at(cellsearch_earfcn_index)) {
current_earfcn = (int)earfcn[cellsearch_earfcn_index]; current_earfcn = (int)worker_com->args->dl_earfcn_list[cellsearch_earfcn_index];
Info("Cell Search: changing frequency to EARFCN=%d\n", current_earfcn); Info("Cell Search: changing frequency to EARFCN=%d\n", current_earfcn);
set_frequency(); set_frequency();
} }
@ -236,7 +236,7 @@ phy_interface_rrc_lte::cell_search_ret_t sync::cell_search(phy_interface_rrc_lte
} }
cellsearch_earfcn_index++; cellsearch_earfcn_index++;
if (cellsearch_earfcn_index >= earfcn.size()) { if (cellsearch_earfcn_index >= worker_com->args->dl_earfcn_list.size()) {
Info("Cell Search: No more frequencies in the current EARFCN set\n"); Info("Cell Search: No more frequencies in the current EARFCN set\n");
cellsearch_earfcn_index = 0; cellsearch_earfcn_index = 0;
ret.last_freq = phy_interface_rrc_lte::cell_search_ret_t::NO_MORE_FREQS; ret.last_freq = phy_interface_rrc_lte::cell_search_ret_t::NO_MORE_FREQS;
@ -735,11 +735,6 @@ bool sync::set_cell(float cfo)
return true; return true;
} }
void sync::set_earfcn(std::vector<uint32_t> earfcn_)
{
earfcn = earfcn_;
}
void sync::force_freq(float dl_freq_, float ul_freq_) void sync::force_freq(float dl_freq_, float ul_freq_)
{ {
dl_freq = dl_freq_; dl_freq = dl_freq_;
@ -759,7 +754,7 @@ bool sync::set_frequency()
if (srslte_band_is_tdd(srslte_band_get_band(current_earfcn))) { if (srslte_band_is_tdd(srslte_band_get_band(current_earfcn))) {
set_ul_freq = set_dl_freq; set_ul_freq = set_dl_freq;
} else { } else {
set_ul_freq = 1e6 * srslte_band_fu(srslte_band_ul_earfcn(current_earfcn)); set_ul_freq = 1e6 * srslte_band_fu(worker_com->get_ul_earfcn(current_earfcn));
} }
} }
if (set_dl_freq > 0 && set_ul_freq > 0) { if (set_dl_freq > 0 && set_ul_freq > 0) {

@ -173,18 +173,18 @@ int ue::parse_args(const all_args_t& args_)
args.phy.nof_rx_ant = args.rf.nof_antennas; args.phy.nof_rx_ant = args.rf.nof_antennas;
args.phy.agc_enable = args.rf.rx_gain < 0.0f; args.phy.agc_enable = args.rf.rx_gain < 0.0f;
// populate EARFCN list // populate DL EARFCN list
if (!args.phy.dl_earfcn.empty()) { if (!args.phy.dl_earfcn.empty()) {
args.phy.earfcn_list.clear(); args.phy.dl_earfcn_list.clear();
std::stringstream ss(args.phy.dl_earfcn); std::stringstream ss(args.phy.dl_earfcn);
uint32_t idx = 0; uint32_t idx = 0;
while (ss.good()) { while (ss.good()) {
std::string substr; std::string substr;
getline(ss, substr, ','); getline(ss, substr, ',');
auto earfcn = (uint32_t)strtoul(substr.c_str(), nullptr, 10); uint32_t earfcn = (uint32_t)strtoul(substr.c_str(), nullptr, 10);
args.stack.rrc.supported_bands[idx] = srslte_band_get_band(earfcn); args.stack.rrc.supported_bands[idx] = srslte_band_get_band(earfcn);
args.stack.rrc.nof_supported_bands = ++idx; args.stack.rrc.nof_supported_bands = ++idx;
args.phy.earfcn_list.push_back(earfcn); args.phy.dl_earfcn_list.push_back(earfcn);
} }
} else { } else {
log.error("Error: dl_earfcn list is empty\n"); log.error("Error: dl_earfcn list is empty\n");
@ -192,6 +192,25 @@ int ue::parse_args(const all_args_t& args_)
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
// populate UL EARFCN list
if (!args.phy.ul_earfcn.empty()) {
args.phy.ul_earfcn_map.clear();
std::stringstream ss(args.phy.ul_earfcn);
uint32_t idx = 0;
while (ss.good()) {
std::string substr;
getline(ss, substr, ',');
uint32_t ul_earfcn = (uint32_t)strtoul(substr.c_str(), nullptr, 10);
if (idx < args.phy.dl_earfcn_list.size()) {
// If it can be matched with a DL EARFCN, otherwise ignore entry
uint32_t dl_earfcn = args.phy.dl_earfcn_list[idx];
args.phy.ul_earfcn_map[dl_earfcn] = ul_earfcn;
idx++;
}
}
}
// Set UE category // Set UE category
args.stack.rrc.ue_category = (uint32_t)strtoul(args.stack.rrc.ue_category_str.c_str(), nullptr, 10); args.stack.rrc.ue_category = (uint32_t)strtoul(args.stack.rrc.ue_category_str.c_str(), nullptr, 10);

@ -49,63 +49,58 @@ public:
int init(const phy_args_t& args_, stack_interface_phy_lte* stack_, syssim_interface_phy* syssim_); int init(const phy_args_t& args_, stack_interface_phy_lte* stack_, syssim_interface_phy* syssim_);
int init(const phy_args_t& args_, stack_interface_phy_lte* stack_, radio_interface_phy* radio_); int init(const phy_args_t& args_, stack_interface_phy_lte* stack_, srslte::radio_interface_phy* radio_) override;
// ue_phy_base interface // ue_phy_base interface
int init(const phy_args_t& args_); int init(const phy_args_t& args_) override;
void stop(); void stop() override;
void set_earfcn(std::vector<uint32_t> earfcns); void wait_initialize() override;
void force_freq(float dl_freq, float ul_freq); void start_plot() override;
void wait_initialize(); void get_metrics(phy_metrics_t* m) override;
void start_plot(); std::string get_type() override;
void get_metrics(phy_metrics_t* m);
std::string get_type();
// The interface for the SS // The interface for the SS
void set_cell_map(const cell_list_t& cells_); void set_cell_map(const cell_list_t& cells_);
// phy_interface_rrc_lte // phy_interface_rrc_lte
uint32_t get_current_earfcn(); void enable_pregen_signals(bool enable) override;
uint32_t get_current_pci(); void set_activation_deactivation_scell(uint32_t cmd) override;
void set_config_scell(asn1::rrc::scell_to_add_mod_r10_s* scell_config); void set_config(srslte::phy_cfg_t& config,
void enable_pregen_signals(bool enable); uint32_t cc_idx = 0,
void set_activation_deactivation_scell(uint32_t cmd); uint32_t earfcn = 0,
void srslte_cell_t* cell_info = nullptr) override;
set_config(srslte::phy_cfg_t& config, uint32_t cc_idx = 0, uint32_t earfcn = 0, srslte_cell_t* cell_info = nullptr); void set_config_tdd(srslte_tdd_config_t& tdd_config) override;
void set_config_tdd(srslte_tdd_config_t& tdd_config); void set_config_mbsfn_sib2(srslte::mbsfn_sf_cfg_t* cfg_list, uint32_t nof_cfgs) override{};
void set_config_mbsfn_sib2(srslte::mbsfn_sf_cfg_t* cfg_list, uint32_t nof_cfgs){}; void set_config_mbsfn_sib13(const srslte::sib13_t& sib13) override{};
void set_config_mbsfn_sib13(const srslte::sib13_t& sib13){}; void set_config_mbsfn_mcch(const srslte::mcch_msg_t& mcch) override{};
void set_config_mbsfn_mcch(const srslte::mcch_msg_t& mcch){};
// Measurements interface // Measurements interface
void meas_stop(); void meas_stop() override;
int meas_start(uint32_t earfcn, int pci = -1);
int meas_stop(uint32_t earfcn, int pci = -1);
// phy_interface_mac_lte // phy_interface_mac_lte
void set_mch_period_stop(uint32_t stop){}; void set_mch_period_stop(uint32_t stop) override{};
// Cell search and selection procedures // Cell search and selection procedures
cell_search_ret_t cell_search(phy_cell_t* found_cell); cell_search_ret_t cell_search(phy_cell_t* found_cell) override;
bool cell_select(const phy_cell_t* cell) override; bool cell_select(const phy_cell_t* cell) override;
bool cell_is_camping(); bool cell_is_camping() override;
void reset(); void reset() override;
// phy_interface_mac_lte // phy_interface_mac_lte
void configure_prach_params(); void configure_prach_params() override;
void prach_send(uint32_t preamble_idx, int allowed_subframe, float target_power_dbm, float ta_base_sec); void prach_send(uint32_t preamble_idx, int allowed_subframe, float target_power_dbm, float ta_base_sec) override;
prach_info_t prach_get_info(); prach_info_t prach_get_info() override;
void sr_send(); void sr_send() override;
int sr_last_tx_tti(); int sr_last_tx_tti() override;
// phy_interface_mac_common // phy_interface_mac_common
void set_crnti(uint16_t rnti); void set_crnti(uint16_t rnti) override;
void set_timeadv_rar(uint32_t ta_cmd); void set_timeadv_rar(uint32_t ta_cmd) override;
void set_timeadv(uint32_t ta_cmd); void set_timeadv(uint32_t ta_cmd) override;
void set_rar_grant(uint8_t grant_payload[SRSLTE_RAR_GRANT_LEN], uint16_t rnti); void set_rar_grant(uint8_t grant_payload[SRSLTE_RAR_GRANT_LEN], uint16_t rnti) override;
uint32_t get_current_tti(); uint32_t get_current_tti() override;
float get_phr(); float get_phr() override;
float get_pathloss_db(); float get_pathloss_db() override;
// phy_interface_syssim // phy_interface_syssim
void set_current_tti(uint32_t tti); void set_current_tti(uint32_t tti);
@ -114,14 +109,12 @@ public:
void new_tb(const srsue::mac_interface_phy_lte::mac_grant_dl_t, const uint8_t* data); void new_tb(const srsue::mac_interface_phy_lte::mac_grant_dl_t, const uint8_t* data);
// Radio interface // Radio interface
void radio_overflow(); void radio_overflow() override;
void radio_failure(); void radio_failure() override;
void run_tti(); void run_tti();
private: private:
void select_pcell();
srslte::logger* logger = nullptr; srslte::logger* logger = nullptr;
srslte::log_filter log; srslte::log_filter log;
@ -133,10 +126,9 @@ private:
cell_t pcell = {}; cell_t pcell = {};
bool pcell_set = false; bool pcell_set = false;
phy_cfg_t phy_cfg = {}; srslte::phy_cfg_t phy_cfg = {};
uint32_t current_tti = 0; uint32_t current_tti = 0;
uint16_t current_temp_rnti = 0;
uint32_t cc_idx = 0; uint32_t cc_idx = 0;
int prach_tti_tx = -1; int prach_tti_tx = -1;

@ -36,7 +36,7 @@ int lte_ttcn3_phy::init(const phy_args_t& args_, stack_interface_phy_lte* stack_
return init(args_); return init(args_);
} }
int lte_ttcn3_phy::init(const phy_args_t& args_, stack_interface_phy_lte* stack_, radio_interface_phy* radio_) int lte_ttcn3_phy::init(const phy_args_t& args_, stack_interface_phy_lte* stack_, srslte::radio_interface_phy* radio_)
{ {
return init(args_); return init(args_);
@ -53,10 +53,6 @@ int lte_ttcn3_phy::init(const phy_args_t& args_)
void lte_ttcn3_phy::stop(){}; void lte_ttcn3_phy::stop(){};
void lte_ttcn3_phy::set_earfcn(std::vector<uint32_t> earfcns) {}
void lte_ttcn3_phy::force_freq(float dl_freq, float ul_freq) {}
void lte_ttcn3_phy::wait_initialize() {} void lte_ttcn3_phy::wait_initialize() {}
void lte_ttcn3_phy::start_plot() {} void lte_ttcn3_phy::start_plot() {}
@ -70,23 +66,8 @@ void lte_ttcn3_phy::set_cell_map(const cell_list_t& cells_)
cells = cells_; cells = cells_;
} }
uint32_t lte_ttcn3_phy::get_current_earfcn()
{
return pcell.earfcn;
}
uint32_t lte_ttcn3_phy::get_current_pci()
{
return pcell.info.id;
}
void lte_ttcn3_phy::set_config_tdd(srslte_tdd_config_t& tdd_config) {} void lte_ttcn3_phy::set_config_tdd(srslte_tdd_config_t& tdd_config) {}
void lte_ttcn3_phy::set_config_scell(asn1::rrc::scell_to_add_mod_r10_s* scell_config)
{
log.debug("%s not implemented.\n", __FUNCTION__);
}
void lte_ttcn3_phy::enable_pregen_signals(bool enable) void lte_ttcn3_phy::enable_pregen_signals(bool enable)
{ {
log.debug("%s not implemented.\n", __FUNCTION__); log.debug("%s not implemented.\n", __FUNCTION__);
@ -105,16 +86,6 @@ void lte_ttcn3_phy::set_config(srslte::phy_cfg_t& config, uint32_t cc_idx, uint3
// Measurements interface // Measurements interface
void lte_ttcn3_phy::meas_stop(){}; void lte_ttcn3_phy::meas_stop(){};
int lte_ttcn3_phy::meas_start(uint32_t earfcn, int pci)
{
return 0;
}
int lte_ttcn3_phy::meas_stop(uint32_t earfcn, int pci)
{
return 0;
};
/* Cell search and selection procedures */ /* Cell search and selection procedures */
phy_interface_rrc_lte::cell_search_ret_t lte_ttcn3_phy::cell_search(phy_cell_t* found_cell) phy_interface_rrc_lte::cell_search_ret_t lte_ttcn3_phy::cell_search(phy_cell_t* found_cell)
{ {
@ -236,7 +207,6 @@ int lte_ttcn3_phy::sr_last_tx_tti()
/* Sets a C-RNTI allowing the PHY to pregenerate signals if necessary */ /* Sets a C-RNTI allowing the PHY to pregenerate signals if necessary */
void lte_ttcn3_phy::set_crnti(uint16_t rnti) void lte_ttcn3_phy::set_crnti(uint16_t rnti)
{ {
current_temp_rnti = rnti;
log.info("Set Temp-RNTI=%d\n", rnti); log.info("Set Temp-RNTI=%d\n", rnti);
} }

Loading…
Cancel
Save