From be6dcccd931f744f89341469522b634bdec7fcb9 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Mon, 7 Oct 2024 15:27:09 +0100 Subject: [PATCH] Add CI test for SRS in nr_ulsim --- cmake_targets/autotests/test_case_list.xml | 8 +++++--- openair1/PHY/defs_gNB.h | 2 ++ openair1/SCHED_NR/phy_procedures_nr_gNB.c | 7 +++---- openair1/SIMULATION/NR_PHY/ulsim.c | 20 +++++++++++++++++--- 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml index 8ea193b816..5afe683055 100755 --- a/cmake_targets/autotests/test_case_list.xml +++ b/cmake_targets/autotests/test_case_list.xml @@ -387,7 +387,8 @@ (Test10: PUSCH Type B, 3 DMRS, 2 PTRS, 3 Interpolated Symbols), (Test11: 25 PRBs, 15 kHz SCS), (Test12: MCS 0, low SNR performance) - (Test13: MCS 28, 106 PRBs, Time shift 8) + (Test13: MCS 28, 106 PRBs, Time shift 8) + (Test14: SRS, SNR 40 dB) nr_ulsim -n100 -m9 -r106 -s5 -n100 -m16 -s10 @@ -401,8 +402,9 @@ -n100 -s5 -a4 -b8 -T 1,2 -U 1,3,1,1 -n100 -u0 -m0 -R25 -r25 -i 1,0 -n100 -m0 -S -0.6 -i 1,0 - -n100 -m 28 -R106 -r106 -t90 -s24 -S24 -d 8 - test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 test11 test12 test13 + -n100 -m 28 -R106 -r106 -t90 -s24 -S24 -d 8 + -n100 -s40 -E 1 + test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 test11 test12 test13 test14 PUSCH test OK segmentation fault|assertion|exiting|fatal 3 diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index 154f752392..fae5528364 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -258,6 +258,8 @@ typedef struct { uint32_t frame; /// Slot where current SRS pdu was received uint32_t slot; + /// Measured SNR + int8_t snr; /// ULSCH PDU nfapi_nr_srs_pdu_t srs_pdu; } NR_gNB_SRS_t; diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 7ab949bf9c..bca81f019d 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -936,7 +936,6 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) int32_t srs_estimated_channel_time[frame_parms->nb_antennas_rx][1 << srs_pdu->num_ant_ports][frame_parms->ofdm_symbol_size] __attribute__((aligned(32))); int32_t srs_estimated_channel_time_shifted[frame_parms->nb_antennas_rx][1 << srs_pdu->num_ant_ports][frame_parms->ofdm_symbol_size]; int8_t snr_per_rb[srs_pdu->bwp_size]; - int8_t snr = 0; start_meas(&gNB->generate_srs_stats); if (check_srs_pdu(srs_pdu, &gNB->nr_srs_info[i]->srs_pdu) == 0) { @@ -961,11 +960,11 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) srs_estimated_channel_time, srs_estimated_channel_time_shifted, snr_per_rb, - &snr); + &gNB->srs->snr); stop_meas(&gNB->srs_channel_estimation_stats); } - if ((snr * 10) < gNB->srs_thres) { + if ((gNB->srs->snr * 10) < gNB->srs_thres) { srs_est = -1; } @@ -1038,7 +1037,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) nfapi_nr_srs_beamforming_report_t nr_srs_bf_report; nr_srs_bf_report.prg_size = srs_pdu->beamforming.prg_size; nr_srs_bf_report.num_symbols = 1 << srs_pdu->num_symbols; - nr_srs_bf_report.wide_band_snr = srs_est >= 0 ? (snr + 64) << 1 : 0xFF; // 0xFF will be set if this field is invalid + nr_srs_bf_report.wide_band_snr = srs_est >= 0 ? (gNB->srs->snr + 64) << 1 : 0xFF; // 0xFF will be set if this field is invalid nr_srs_bf_report.num_reported_symbols = 1 << srs_pdu->num_symbols; fill_srs_reported_symbol_list(&nr_srs_bf_report.prgs, srs_pdu, frame_parms->N_RB_UL, snr_per_rb, srs_est); diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index ef0d26d235..4479406df0 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -936,6 +936,7 @@ int main(int argc, char *argv[]) } //--------------- int ret = 1; + int srs_ret = do_SRS; for (SNR = snr0; SNR <= snr1; SNR += snr_step) { varArray_t *table_rx=initVarArray(1000,sizeof(double)); @@ -971,6 +972,9 @@ int main(int argc, char *argv[]) int max_pusch_delay = INT_MIN; int delay_pusch_est_count = 0; + int64_t sum_srs_snr = 0; + int srs_snr_count = 0; + for (trial = 0; trial < n_trials; trial++) { uint8_t round = 0; @@ -1436,6 +1440,10 @@ int main(int argc, char *argv[]) max_pusch_delay = max(ulsch_gNB->delay.est_delay, max_pusch_delay); delay_pusch_est_count++; + if (do_SRS == 1) { + sum_srs_snr += gNB->srs->snr; + srs_snr_count++; + } } // trial loop roundStats/=((float)n_trials); @@ -1471,8 +1479,14 @@ int main(int argc, char *argv[]) printf(") Avg round %.2f, Eff Rate %.4f bits/slot, Eff Throughput %.2f, TBS %u bits/slot\n", roundStats,effRate,effTP,TBS); - printf("DMRS-PUSCH delay estimation: min %i, max %i, average %f\n", - min_pusch_delay >> 1, max_pusch_delay >> 1, (double)sum_pusch_delay / (2 * delay_pusch_est_count)); + double av_delay = (double)sum_pusch_delay / (2 * delay_pusch_est_count); + printf("DMRS-PUSCH delay estimation: min %i, max %i, average %2.1f\n", min_pusch_delay >> 1, max_pusch_delay >> 1, av_delay); + + if (do_SRS == 1) { + float srs_snr_av = (float)sum_srs_snr / srs_snr_count; + srs_ret = srs_snr_av >= 0.7 * SNR || srs_snr_av > 30 ? 0 : 1; + printf("SNR based on SRS: %2.1f dB\n", srs_snr_av); + } printf("*****************************************\n"); printf("\n"); @@ -1519,7 +1533,7 @@ int main(int argc, char *argv[]) if(n_trials==1) break; - if ((float)effTP >= eff_tp_check) { + if (srs_ret == 0 && (float)effTP >= eff_tp_check) { printf("*************\n"); printf("PUSCH test OK\n"); printf("*************\n");