Adds best neighbour to CSV and stdout metrics (#1440)

This commit is contained in:
Ismael Gomez 2020-06-17 12:11:06 +02:00 committed by GitHub
parent 65a603f522
commit 54b331c504
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 70 additions and 6 deletions

View File

@ -23,11 +23,13 @@
#define SRSUE_RRC_METRICS_H
#include "rrc_common.h"
#include "srslte/interfaces/ue_interfaces.h"
namespace srsue {
struct rrc_metrics_t {
rrc_state_t state;
rrc_state_t state;
std::vector<rrc_interface_phy_lte::phy_meas_t> neighbour_cells;
};
} // namespace srsue

View File

@ -82,7 +82,8 @@ void metrics_csv::set_metrics(const ue_metrics_t& metrics, const uint32_t period
if (file.is_open() && ue != NULL) {
if (n_reports == 0 && !file_exists) {
file << "time;cc;pci;earfcn;rsrp;pl;cfo;dl_mcs;dl_snr;dl_turbo;dl_brate;dl_bler;ul_ta;ul_mcs;ul_buff;ul_brate;ul_"
file << "time;cc;earfcn;pci;rsrp;pl;cfo;pci_neigh;rsrp_neigh;cfo_neigh;dl_mcs;dl_snr;dl_turbo;dl_brate;dl_bler;"
"ul_ta;ul_mcs;ul_buff;ul_brate;ul_"
"bler;"
"rf_o;rf_"
"u;rf_l;is_attached\n";
@ -93,13 +94,31 @@ void metrics_csv::set_metrics(const ue_metrics_t& metrics, const uint32_t period
// CC and PCI
file << r << ";";
file << metrics.phy.info[r].pci << ";";
file << metrics.phy.info[r].dl_earfcn << ";";
file << metrics.phy.info[r].pci << ";";
// Print PHY metrics for first CC
file << float_to_string(metrics.phy.dl[r].rsrp, 2);
file << float_to_string(metrics.phy.dl[r].pathloss, 2);
file << float_to_string(metrics.phy.sync[r].cfo, 2);
// Find strongest neighbour for this EARFCN (cells are ordered)
bool has_neighbour = false;
for (auto& c : metrics.stack.rrc.neighbour_cells) {
if (c.earfcn == metrics.phy.info[r].dl_earfcn && c.pci != metrics.phy.info[r].pci) {
file << c.pci << ";";
file << float_to_string(c.rsrp, 2);
file << float_to_string(c.cfo_hz, 2);
has_neighbour = true;
break;
}
}
if (!has_neighbour) {
file << "n/a;";
file << "n/a;";
file << "n/a;";
}
file << float_to_string(metrics.phy.dl[r].mcs, 2);
file << float_to_string(metrics.phy.dl[r].sinr, 2);
file << float_to_string(metrics.phy.dl[r].turbo_iters, 2);

View File

@ -95,11 +95,25 @@ void metrics_stdout::set_metrics(const ue_metrics_t& metrics, const uint32_t per
return;
}
bool display_neighbours = false;
if (metrics.phy.nof_active_cc > 1) {
display_neighbours = metrics.stack.rrc.neighbour_cells.size() > metrics.phy.nof_active_cc - 1;
} else {
display_neighbours = metrics.stack.rrc.neighbour_cells.size() > 0;
}
if (++n_reports > 10) {
n_reports = 0;
cout << endl;
cout << "--------Signal--------------DL-------------------------------------UL----------------------" << endl;
cout << "cc pci rsrp pl cfo mcs snr turbo brate bler ta_us mcs buff brate bler" << endl;
if (display_neighbours) {
cout << "--------Signal--------------Neighbor----DL-------------------------------------UL----------------------"
<< endl;
cout << "cc pci rsrp pl cfo pci rsrp mcs snr turbo brate bler ta_us mcs buff brate bler"
<< endl;
} else {
cout << "--------Signal--------------DL-------------------------------------UL----------------------" << endl;
cout << "cc pci rsrp pl cfo mcs snr turbo brate bler ta_us mcs buff brate bler" << endl;
}
}
for (uint32_t r = 0; r < metrics.phy.nof_active_cc; r++) {
cout << std::setw(2) << r;
@ -107,6 +121,24 @@ void metrics_stdout::set_metrics(const ue_metrics_t& metrics, const uint32_t per
cout << float_to_string(metrics.phy.dl[r].rsrp, 2);
cout << float_to_string(metrics.phy.dl[r].pathloss, 2);
cout << float_to_eng_string(metrics.phy.sync[r].cfo, 2);
// Find strongest neighbour for this EARFCN (cells are ordered)
if (display_neighbours) {
bool has_neighbour = false;
for (auto& c : metrics.stack.rrc.neighbour_cells) {
if (c.earfcn == metrics.phy.info[r].dl_earfcn && c.pci != metrics.phy.info[r].pci) {
cout << std::setw(4) << c.pci << std::setw(0);
cout << float_to_string(c.rsrp, 2);
has_neighbour = true;
break;
}
}
if (!has_neighbour) {
cout << " n/a";
cout << " n/a";
}
}
cout << float_to_string(metrics.phy.dl[r].mcs, 2);
cout << float_to_string(metrics.phy.dl[r].sinr, 2);
cout << float_to_string(metrics.phy.dl[r].turbo_iters, 2);

View File

@ -200,6 +200,16 @@ void rrc::stop()
void rrc::get_metrics(rrc_metrics_t& m)
{
m.state = state;
// Save strongest cells metrics
for (auto& c : neighbour_cells) {
rrc_interface_phy_lte::phy_meas_t meas = {};
meas.cfo_hz = c->get_cfo_hz();
meas.earfcn = c->get_earfcn();
meas.rsrq = c->get_rsrq();
meas.rsrp = c->get_rsrp();
meas.pci = c->get_pci();
m.neighbour_cells.push_back(meas);
}
}
bool rrc::is_connected()
@ -381,7 +391,7 @@ void rrc::new_cell_meas(const std::vector<phy_meas_t>& meas)
cell_meas_q.push(meas);
}
/* Processes all pending PHY measurements in queue. Must be called from a mutexed function
/* Processes all pending PHY measurements in queue.
*/
void rrc::process_cell_meas()
{
@ -392,6 +402,7 @@ void rrc::process_cell_meas()
}
process_new_cell_meas(m);
}
sort_neighbour_cells();
}
void rrc::process_new_cell_meas(const std::vector<phy_meas_t>& meas)