ssb: avoid NaN when SSB can't be detected

when PSS+SSS can't be detected the RSRP was 0 and
the resulting conversion to dB resulted in NaN.
This commit is contained in:
Andre Puschmann 2021-09-06 21:30:40 +02:00 committed by Xavier Arteaga
parent 5798f09252
commit 6745eced49
1 changed files with 5 additions and 0 deletions

View File

@ -704,6 +704,11 @@ ssb_measure(srsran_ssb_t* q, const cf_t ssb_grid[SRSRAN_SSB_NOF_RE], uint32_t N_
float rsrp_sss = SRSRAN_CSQABS(corr_sss);
float rsrp = (rsrp_pss + rsrp_sss) / 2.0f;
// avoid taking log of 0 (NaN)
if (rsrp == 0.0) {
rsrp = 1.0;
}
// Compute Noise
float n0_pss = 1e-9; // Almost 0
float n0_sss = 1e-9; // Almost 0