Commit 7bd048e6 authored by Bartosz Podrygajlo's avatar Bartosz Podrygajlo

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))
parent f7d3b728
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment