converted member method of list of cells in the enb to a free function

master
Francisco Paisana 4 years ago
parent 3a924a1d80
commit 942c28881d

@ -77,13 +77,16 @@ public:
const cell_info_common* get_pci(uint32_t pci) const; const cell_info_common* get_pci(uint32_t pci) const;
size_t nof_cells() const { return cell_list.size(); } size_t nof_cells() const { return cell_list.size(); }
std::vector<const cell_info_common*> get_potential_cells(uint32_t enb_cc_idx) const;
private: private:
const rrc_cfg_t& cfg; const rrc_cfg_t& cfg;
std::vector<std::unique_ptr<cell_info_common> > cell_list; std::vector<std::unique_ptr<cell_info_common> > cell_list;
}; };
// Helper methods
std::vector<const cell_info_common*> get_available_intraenb_cells(const cell_info_common_list& list,
uint32_t pcell_enb_cc_idx);
std::vector<uint32_t> get_available_intraenb_earfcns(const cell_info_common_list& list, uint32_t pcell_enb_cc_idx);
/** Class used to store all the resources specific to a UE's cell */ /** Class used to store all the resources specific to a UE's cell */
struct cell_ctxt_dedicated { struct cell_ctxt_dedicated {
uint32_t ue_cc_idx; uint32_t ue_cc_idx;

@ -68,7 +68,7 @@ public:
std::string to_string() const; std::string to_string() const;
static var_meas_cfg_t make(const asn1::rrc::meas_cfg_s& meas_cfg); static var_meas_cfg_t make(const asn1::rrc::meas_cfg_s& meas_cfg);
static var_meas_cfg_t make(std::vector<const cell_info_common*> active_cells, const rrc_cfg_t& cfg); static var_meas_cfg_t make(const std::vector<uint32_t>& active_earfcns, const rrc_cfg_t& cfg);
private: private:
asn1::rrc::var_meas_cfg_s var_meas; asn1::rrc::var_meas_cfg_s var_meas;
@ -105,7 +105,7 @@ public:
private: private:
// helper methods // helper methods
bool update_ue_var_meas_cfg(uint32_t src_earfcn, bool update_ue_var_meas_cfg(uint32_t src_earfcn,
std::vector<const cell_info_common*> target_cells, std::vector<uint32_t> target_earfcns,
asn1::rrc::meas_cfg_s* diff_meas_cfg); asn1::rrc::meas_cfg_s* diff_meas_cfg);
// Handover from source cell // Handover from source cell

@ -95,18 +95,33 @@ const cell_info_common* cell_info_common_list::get_pci(uint32_t pci) const
return it == cell_list.end() ? nullptr : it->get(); return it == cell_list.end() ? nullptr : it->get();
} }
std::vector<const cell_info_common*> cell_info_common_list::get_potential_cells(uint32_t enb_cc_idx) const std::vector<const cell_info_common*> get_available_intraenb_cells(const cell_info_common_list& list,
uint32_t pcell_enb_cc_idx)
{ {
const cell_info_common* pcell = get_cc_idx(enb_cc_idx); const cell_info_common* pcell = list.get_cc_idx(pcell_enb_cc_idx);
std::vector<const cell_info_common*> cells(pcell->cell_cfg.scell_list.size() + 1); std::vector<const cell_info_common*> cells(pcell->cell_cfg.scell_list.size() + 1);
cells[0] = pcell; cells[0] = pcell;
for (uint32_t i = 0; i < pcell->cell_cfg.scell_list.size(); ++i) { for (uint32_t i = 0; i < pcell->cell_cfg.scell_list.size(); ++i) {
uint32_t cell_id = pcell->cell_cfg.scell_list[i].cell_id; uint32_t cell_id = pcell->cell_cfg.scell_list[i].cell_id;
cells[i + 1] = get_cell_id(cell_id); cells[i + 1] = list.get_cell_id(cell_id);
} }
return cells; return cells;
} }
std::vector<uint32_t> get_available_intraenb_earfcns(const cell_info_common_list& list, uint32_t pcell_enb_cc_idx)
{
std::vector<const cell_info_common*> cells = get_available_intraenb_cells(list, pcell_enb_cc_idx);
std::vector<uint32_t> earfcns(cells.size());
for (uint32_t i = 0; i < cells.size(); ++i) {
earfcns[i] = cells[i]->cell_cfg.dl_earfcn;
}
// sort by earfcn
std::sort(earfcns.begin(), earfcns.end());
// remove duplicates
earfcns.erase(std::unique(earfcns.begin(), earfcns.end()), earfcns.end());
return earfcns;
}
/************************* /*************************
* cell ctxt dedicated * cell ctxt dedicated
************************/ ************************/

@ -453,26 +453,18 @@ var_meas_cfg_t var_meas_cfg_t::make(const asn1::rrc::meas_cfg_s& meas_cfg)
return var; return var;
} }
var_meas_cfg_t var_meas_cfg_t::make(std::vector<const cell_info_common*> active_cells, const rrc_cfg_t& cfg) var_meas_cfg_t var_meas_cfg_t::make(const std::vector<uint32_t>& active_earfcns, const rrc_cfg_t& cfg)
{ {
var_meas_cfg_t var_meas; var_meas_cfg_t var_meas;
// sort by earfcn, and remove duplicates. This avoids unnecessary measObjects/measIds transmissions
auto cmp_freq = [](const cell_info_common* lhs, const cell_info_common* rhs) {
return lhs->cell_cfg.dl_earfcn < rhs->cell_cfg.dl_earfcn;
};
auto equal_freq = [](const cell_info_common* lhs, const cell_info_common* rhs) {
return lhs->cell_cfg.dl_earfcn == rhs->cell_cfg.dl_earfcn;
};
std::sort(active_cells.begin(), active_cells.end(), cmp_freq);
active_cells.erase(std::unique(active_cells.begin(), active_cells.end(), equal_freq), active_cells.end());
// Add PCell+Scells as MeasObjs
for (const cell_info_common* c : active_cells) {
var_meas.add_meas_obj(c->cell_cfg.dl_earfcn);
}
if (not cfg.meas_cfg_present) { if (not cfg.meas_cfg_present) {
return var_meas; return var_meas;
} }
// Add PCell+Scells as MeasObjs
for (uint32_t earfcn : active_earfcns) {
var_meas.add_meas_obj(earfcn);
}
for (const auto& cell_cfg : cfg.cell_list) { for (const auto& cell_cfg : cfg.cell_list) {
// inserts all neighbor cells // inserts all neighbor cells
for (const meas_cell_cfg_t& meascell : cell_cfg.meas_cfg.meas_cells) { for (const meas_cell_cfg_t& meascell : cell_cfg.meas_cfg.meas_cells) {
@ -585,8 +577,8 @@ bool rrc::ue::rrc_mobility::fill_conn_recfg_no_ho_cmd(asn1::rrc::rrc_conn_recfg_
// Check if there has been any update in ue_var_meas based on UE current cell list // Check if there has been any update in ue_var_meas based on UE current cell list
cell_ctxt_dedicated* pcell = rrc_ue->cell_ded_list.get_ue_cc_idx(UE_PCELL_CC_IDX); cell_ctxt_dedicated* pcell = rrc_ue->cell_ded_list.get_ue_cc_idx(UE_PCELL_CC_IDX);
uint32_t src_earfcn = pcell->get_dl_earfcn(); uint32_t src_earfcn = pcell->get_dl_earfcn();
auto target_cells = rrc_enb->cell_common_list->get_potential_cells(pcell->cell_common->enb_cc_idx); auto target_earfcns = get_available_intraenb_earfcns(*rrc_enb->cell_common_list, pcell->cell_common->enb_cc_idx);
conn_recfg->meas_cfg_present = update_ue_var_meas_cfg(src_earfcn, target_cells, &conn_recfg->meas_cfg); conn_recfg->meas_cfg_present = update_ue_var_meas_cfg(src_earfcn, target_earfcns, &conn_recfg->meas_cfg);
return conn_recfg->meas_cfg_present; return conn_recfg->meas_cfg_present;
} }
@ -794,12 +786,12 @@ bool rrc::ue::rrc_mobility::start_s1_tenb_ho(
} }
bool rrc::ue::rrc_mobility::update_ue_var_meas_cfg(uint32_t src_earfcn, bool rrc::ue::rrc_mobility::update_ue_var_meas_cfg(uint32_t src_earfcn,
std::vector<const cell_info_common*> target_cells, std::vector<uint32_t> target_earfcns,
asn1::rrc::meas_cfg_s* diff_meas_cfg) asn1::rrc::meas_cfg_s* diff_meas_cfg)
{ {
// Make UE Target VarMeasCfg based on active cells and parsed Config files // Make UE Target VarMeasCfg based on active cells and parsed Config files
var_meas_cfg_t target_var_meas = var_meas_cfg_t::make(target_cells, rrc_enb->cfg); var_meas_cfg_t target_var_meas = var_meas_cfg_t::make(target_earfcns, rrc_enb->cfg);
uint32_t target_earfcn = target_cells[0]->cell_cfg.dl_earfcn; uint32_t target_earfcn = target_earfcns[0];
// Apply TS 36.331 5.5.6.1 - If Source and Target eNB EARFCNs do no match, update SourceVarMeasCfg.MeasIdList // Apply TS 36.331 5.5.6.1 - If Source and Target eNB EARFCNs do no match, update SourceVarMeasCfg.MeasIdList
if (target_earfcn != src_earfcn) { if (target_earfcn != src_earfcn) {
@ -917,8 +909,8 @@ void rrc::ue::rrc_mobility::fill_mobility_reconf_common(asn1::rrc::dl_dcch_msg_s
ant_info.ue_tx_ant_sel.set(setup_e::release); ant_info.ue_tx_ant_sel.set(setup_e::release);
// Add MeasConfig of target cell // Add MeasConfig of target cell
auto target_cells = rrc_enb->cell_common_list->get_potential_cells(target_cell.enb_cc_idx); auto target_earfcns = get_available_intraenb_earfcns(*rrc_enb->cell_common_list, target_cell.enb_cc_idx);
recfg_r8.meas_cfg_present = update_ue_var_meas_cfg(src_dl_earfcn, target_cells, &recfg_r8.meas_cfg); recfg_r8.meas_cfg_present = update_ue_var_meas_cfg(src_dl_earfcn, target_earfcns, &recfg_r8.meas_cfg);
} }
/** /**

Loading…
Cancel
Save