diff --git a/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c b/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c index 33ba3e0829..764fbbabc6 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c +++ b/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c @@ -592,7 +592,33 @@ int nr_csi_rs_pmi_estimation(const PHY_VARS_NR_UE *ue, // The first column is applicable if the UE is reporting a Rank = 1, whereas the second column is applicable if the // UE is reporting a Rank = 2. - if(N_ports == 1 || interference_plus_noise_power == 0) { + if (interference_plus_noise_power == 0) { + return 0; + } + + if (N_ports == 1) { + // SISO case: SINR = E[|h|^2] / noise_power. No PMI to estimate. + int64_t signal_power = 0; + int count = 0; + + for (int rb = csirs_config_pdu->start_rb; rb < (csirs_config_pdu->start_rb + csirs_config_pdu->nr_of_rbs); rb++) { + if (csirs_config_pdu->freq_density <= 1 && csirs_config_pdu->freq_density != (rb % 2)) { + continue; + } + uint16_t k = (frame_parms->first_carrier_offset + rb * NR_NB_SC_PER_RB) % frame_parms->ofdm_symbol_size; + uint16_t k_offset = k + mem_offset; + + const c16_t h = csi_rs_estimated_channel_freq[0][0][k_offset]; + signal_power += (int64_t)h.r * h.r + (int64_t)h.i * h.i; + count++; + } + + if (count > 0) { + const int64_t avg_signal_power = signal_power / count; + const uint32_t sinr = avg_signal_power / interference_plus_noise_power; + *precoded_sinr_dB = dB_fixed(sinr); + } + return 0; } diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index b435e9e265..cd51f6a48f 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -4480,7 +4480,7 @@ static uint8_t compute_ri_bitlen(const NR_CSI_ReportConfig_t *csi_reportconfig, if (codebookConfig == NULL) { csi_report->csi_meas_bitlen.ri_bitlen = 0; - return 0; + return 1; } struct NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel *type1single = NULL;