Compute per-antenna and per-port chest metrics in chest_res

master
Ismael Gomez 6 years ago
parent 2d9b7756df
commit 47acbc1e08

@ -52,12 +52,15 @@ typedef struct SRSLTE_API {
float noise_estimate; float noise_estimate;
float noise_estimate_dbm; float noise_estimate_dbm;
float snr_db; float snr_db;
float snr_ant_port_db[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS];
float rsrp; float rsrp;
float rsrp_dbm; float rsrp_dbm;
float rsrp_neigh_dbm; float rsrp_neigh_dbm;
float rsrp_port_dbm[SRSLTE_MAX_PORTS]; float rsrp_port_dbm[SRSLTE_MAX_PORTS];
float rsrp_ant_port_dbm[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS];
float rsrq; float rsrq;
float rsrq_db; float rsrq_db;
float rsrq_ant_port_db[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS];
float rssi_dbm; float rssi_dbm;
float cfo; float cfo;
} srslte_chest_dl_res_t; } srslte_chest_dl_res_t;
@ -149,8 +152,4 @@ SRSLTE_API int srslte_chest_dl_estimate_cfg(srslte_chest_dl_t* q,
cf_t* input[SRSLTE_MAX_PORTS], cf_t* input[SRSLTE_MAX_PORTS],
srslte_chest_dl_res_t* res); srslte_chest_dl_res_t* res);
/* These functions are exceptions and return values from last call to chest_dl_estimate */
SRSLTE_API float srslte_chest_dl_get_rsrq_ant_port(srslte_chest_dl_t* q, uint32_t ant_idx, uint32_t port_idx);
SRSLTE_API float srslte_chest_dl_get_rsrp_ant_port(srslte_chest_dl_t* q, uint32_t ant_idx, uint32_t port);
#endif // SRSLTE_CHEST_DL_H #endif // SRSLTE_CHEST_DL_H

@ -766,24 +766,15 @@ static float get_rsrq(srslte_chest_dl_t* q)
return n / q->nof_rx_antennas; return n / q->nof_rx_antennas;
} }
float srslte_chest_dl_get_rsrq_ant_port(srslte_chest_dl_t *q, uint32_t ant_idx, uint32_t port_idx) {
return q->cell.nof_prb*q->rsrp[ant_idx][port_idx] / q->rssi[ant_idx][port_idx];
}
float srslte_chest_dl_get_rsrp_ant_port(srslte_chest_dl_t* q, uint32_t ant_idx, uint32_t port)
{
return q->rsrp[ant_idx][port];
}
static float get_rsrp_port(srslte_chest_dl_t* q, uint32_t port) static float get_rsrp_port(srslte_chest_dl_t* q, uint32_t port)
{ {
float sum = 0.0f; float sum = 0.0f;
for (int j = 0; j < q->cell.nof_ports; ++j) { for (int j = 0; j < q->nof_rx_antennas; ++j) {
sum +=q->rsrp[port][j]; sum += q->rsrp[j][port];
} }
if (q->cell.nof_ports) { if (q->nof_rx_antennas) {
sum /= q->cell.nof_ports; sum /= q->nof_rx_antennas;
} }
return sum; return sum;
@ -855,6 +846,15 @@ static void fill_res(srslte_chest_dl_t* q, srslte_chest_dl_res_t* res)
for (uint32_t port_id = 0; port_id < q->cell.nof_ports; port_id++) { for (uint32_t port_id = 0; port_id < q->cell.nof_ports; port_id++) {
res->rsrp_port_dbm[port_id] = dbm(get_rsrp_port(q, port_id)); res->rsrp_port_dbm[port_id] = dbm(get_rsrp_port(q, port_id));
for (uint32_t a = 0; a < q->nof_rx_antennas; a++) {
if (q->noise_estimate[a]) {
res->snr_ant_port_db[a][port_id] = db(q->rsrp[a][port_id] / q->noise_estimate[a][port_id]);
} else {
res->snr_ant_port_db[a][port_id] = 0.0;
}
res->rsrp_ant_port_dbm[a][port_id] = db(q->rsrp[a][port_id]);
res->rsrq_ant_port_db[a][port_id] = db(q->cell.nof_prb * q->rsrp[a][port_id] / q->rssi[a][port_id]);
}
} }
} }

Loading…
Cancel
Save