From 7bd048e6afe1f2d50ffbc8e0105728915bd2aad8 Mon Sep 17 00:00:00 2001 From: Bartosz Podrygajlo Date: Wed, 15 Jan 2025 12:55:39 +0100 Subject: [PATCH] Fix calculation of RSSI in pucch_rx.c Fix two issues with RSSI calculation in PUCCH: - RSSI was calculated using partial sum instead of average of squared samples. - There was a missing parentheses pair which causes the RSSI value to underflow. The proper way to calculate power in dBFS is let signal_energy = average of squared samples of received signal over resource elements, antennas and symbols under measurement then: rssi[dBFS] = -10log10(max_sample^2 / signal_energy), or (to avoid division): rssi[dBFS] = -(10log10(max_sample^2) - 10log10(signal_energy)) --- openair1/PHY/NR_TRANSPORT/pucch_rx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index e545766206..1f65467d20 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -280,6 +280,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, } } signal_energy /= (pucch_pdu->nr_of_symbols * frame_parms->nb_antennas_rx); + signal_energy_ant0 /= pucch_pdu->nr_of_symbols; int pucch_power_dBtimes10 = 10 * dB_fixed(signal_energy); //int32_t no_corr = 0; @@ -403,7 +404,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, uci_pdu->rnti = pucch_pdu->rnti; uci_pdu->ul_cqi = cqi; uci_pdu->timing_advance = 0xffff; // currently not valid - uci_pdu->rssi = 1280 - (10 * dB_fixed(32767 * 32767)) - dB_fixed_times10(signal_energy_ant0); + uci_pdu->rssi = 1280 - (10 * dB_fixed(32767 * 32767) - dB_fixed_times10(signal_energy_ant0)); if (pucch_pdu->bit_len_harq==0) { uci_pdu->sr.sr_confidence_level = SNRtimes10 < gNB->pucch0_thres;