Per-antenna SNR

This commit is contained in:
Ismael Gomez 2017-12-29 00:23:53 +01:00
parent 143bec18e3
commit a08c662028
2 changed files with 8 additions and 10 deletions

View File

@ -159,10 +159,6 @@ SRSLTE_API void srslte_chest_dl_average_subframe(srslte_chest_dl_t *q,
SRSLTE_API float srslte_chest_dl_get_noise_estimate(srslte_chest_dl_t *q);
SRSLTE_API float srslte_chest_dl_get_noise_estimate_ant_port(srslte_chest_dl_t *q,
uint32_t ant_idx,
uint32_t port_idx);
SRSLTE_API float srslte_chest_dl_get_cfo(srslte_chest_dl_t *q);
SRSLTE_API float srslte_chest_dl_get_snr(srslte_chest_dl_t *q);

View File

@ -596,22 +596,24 @@ float srslte_chest_dl_get_noise_estimate(srslte_chest_dl_t *q) {
return n/q->last_nof_antennas;
}
float srslte_chest_dl_get_noise_estimate_ant_port(srslte_chest_dl_t *q, uint32_t ant_idx, uint32_t port_idx) {
return q->noise_estimate[ant_idx][port_idx];
}
float srslte_chest_dl_get_snr(srslte_chest_dl_t *q) {
#ifdef FREQ_SEL_SNR
int nref=SRSLTE_REFSIGNAL_NUM_SF(q->cell.nof_prb, 0);
return srslte_vec_acc_ff(q->snr_vector, nref)/nref;
#else
return srslte_chest_dl_get_rsrp(q)/srslte_chest_dl_get_noise_estimate(q);
float rsrp = 0;
for (int i=0;i<q->last_nof_antennas;i++) {
for (int j=0;j<q->cell.nof_ports;j++) {
rsrp += q->rsrp[i][j]/q->cell.nof_ports;
}
}
return rsrp/srslte_chest_dl_get_noise_estimate(q);
#endif
}
float srslte_chest_dl_get_snr_ant_port(srslte_chest_dl_t *q, uint32_t ant_idx, uint32_t port_idx) {
return srslte_chest_dl_get_rsrp_ant_port(q, ant_idx, port_idx)/srslte_chest_dl_get_noise_estimate_ant_port(q, ant_idx, port_idx);
return srslte_chest_dl_get_rsrp_ant_port(q, ant_idx, port_idx)/srslte_chest_dl_get_noise_estimate(q);
}
float srslte_chest_dl_get_rssi(srslte_chest_dl_t *q) {