Commit eccecde2 authored by francescomani's avatar francescomani

Merge remote-tracking branch 'origin/fix-SNR-based-on-SRS' into integration_2024_w41

parents e4cb68a7 be6dcccd
...@@ -387,7 +387,8 @@ ...@@ -387,7 +387,8 @@
(Test10: PUSCH Type B, 3 DMRS, 2 PTRS, 3 Interpolated Symbols), (Test10: PUSCH Type B, 3 DMRS, 2 PTRS, 3 Interpolated Symbols),
(Test11: 25 PRBs, 15 kHz SCS), (Test11: 25 PRBs, 15 kHz SCS),
(Test12: MCS 0, low SNR performance) (Test12: MCS 0, low SNR performance)
(Test13: MCS 28, 106 PRBs, Time shift 8)</desc> (Test13: MCS 28, 106 PRBs, Time shift 8)
(Test14: SRS, SNR 40 dB)</desc>
<main_exec>nr_ulsim</main_exec> <main_exec>nr_ulsim</main_exec>
<main_exec_args>-n100 -m9 -r106 -s5 <main_exec_args>-n100 -m9 -r106 -s5
-n100 -m16 -s10 -n100 -m16 -s10
...@@ -401,8 +402,9 @@ ...@@ -401,8 +402,9 @@
-n100 -s5 -a4 -b8 -T 1,2 -U 1,3,1,1 -n100 -s5 -a4 -b8 -T 1,2 -U 1,3,1,1
-n100 -u0 -m0 -R25 -r25 -i 1,0 -n100 -u0 -m0 -R25 -r25 -i 1,0
-n100 -m0 -S -0.6 -i 1,0 -n100 -m0 -S -0.6 -i 1,0
-n100 -m 28 -R106 -r106 -t90 -s24 -S24 -d 8</main_exec_args> -n100 -m 28 -R106 -r106 -t90 -s24 -S24 -d 8
<tags>test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 test11 test12 test13</tags> -n100 -s40 -E 1</main_exec_args>
<tags>test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 test11 test12 test13 test14</tags>
<search_expr_true>PUSCH test OK</search_expr_true> <search_expr_true>PUSCH test OK</search_expr_true>
<search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false> <search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
<nruns>3</nruns> <nruns>3</nruns>
......
...@@ -504,7 +504,7 @@ void init_nr_transport(PHY_VARS_gNB *gNB) ...@@ -504,7 +504,7 @@ void init_nr_transport(PHY_VARS_gNB *gNB)
gNB->max_nb_pucch = buffer_ul_slots ? MAX_MOBILES_PER_GNB * buffer_ul_slots : 1; gNB->max_nb_pucch = buffer_ul_slots ? MAX_MOBILES_PER_GNB * buffer_ul_slots : 1;
gNB->max_nb_pusch = buffer_ul_slots ? MAX_MOBILES_PER_GNB * buffer_ul_slots : 1; gNB->max_nb_pusch = buffer_ul_slots ? MAX_MOBILES_PER_GNB * buffer_ul_slots : 1;
gNB->max_nb_srs = buffer_ul_slots << 1; // assuming at most 2 SRS per slot gNB->max_nb_srs = buffer_ul_slots ? buffer_ul_slots << 1 : 1; // assuming at most 2 SRS per slot
gNB->pucch = (NR_gNB_PUCCH_t *)malloc16(gNB->max_nb_pucch * sizeof(NR_gNB_PUCCH_t)); gNB->pucch = (NR_gNB_PUCCH_t *)malloc16(gNB->max_nb_pucch * sizeof(NR_gNB_PUCCH_t));
for (int i = 0; i < gNB->max_nb_pucch; i++) { for (int i = 0; i < gNB->max_nb_pucch; i++) {
......
...@@ -111,7 +111,7 @@ int32_t signal_energy_amp_shift(int32_t *input,uint32_t length) ...@@ -111,7 +111,7 @@ int32_t signal_energy_amp_shift(int32_t *input,uint32_t length)
return((temp>0)?temp:1); return((temp>0)?temp:1);
} }
int32_t signal_energy_nodc(const c16_t *input, uint32_t length) uint32_t signal_energy_nodc(const c16_t *input, uint32_t length)
{ {
// init // init
simde__m128 mm0 = simde_mm_setzero_ps(); simde__m128 mm0 = simde_mm_setzero_ps();
...@@ -134,7 +134,7 @@ int32_t signal_energy_nodc(const c16_t *input, uint32_t length) ...@@ -134,7 +134,7 @@ int32_t signal_energy_nodc(const c16_t *input, uint32_t length)
// Ave // Ave
float sums[4]; float sums[4];
simde_mm_store_ps(sums, mm0); simde_mm_store_ps(sums, mm0);
return (int)((sums[0] + sums[1] + sums[2] + sums[3] + leftover_sum) / (float)length); return (uint32_t)((sums[0] + sums[1] + sums[2] + sums[3] + leftover_sum) / (float)length);
} }
double signal_energy_fp(double *s_re[2],double *s_im[2],uint32_t nb_antennas,uint32_t length,uint32_t offset) double signal_energy_fp(double *s_re[2],double *s_im[2],uint32_t nb_antennas,uint32_t length,uint32_t offset)
......
#include <gtest/gtest.h> #include <gtest/gtest.h>
extern "C" { extern "C" {
#include "openair1/PHY/TOOLS/tools_defs.h" #include "openair1/PHY/TOOLS/tools_defs.h"
extern int32_t signal_energy_nodc(const c16_t *input, uint32_t length); extern uint32_t signal_energy_nodc(const c16_t *input, uint32_t length);
} }
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>
......
...@@ -758,10 +758,10 @@ int32_t signal_energy_amp_shift(int32_t *input, uint32_t length); ...@@ -758,10 +758,10 @@ int32_t signal_energy_amp_shift(int32_t *input, uint32_t length);
int32_t subcarrier_energy(int32_t *,uint32_t, int32_t *subcarrier_energy, uint16_t rx_power_correction); int32_t subcarrier_energy(int32_t *,uint32_t, int32_t *subcarrier_energy, uint16_t rx_power_correction);
#endif #endif
/*!\fn int32_t signal_energy_nodc(int32_t *,uint32_t); /*!\fn uint32_t signal_energy_nodc(c16_t *,uint32_t);
\brief Computes the signal energy per subcarrier, without DC removal \brief Computes the signal energy per subcarrier, without DC removal
*/ */
int32_t signal_energy_nodc(const c16_t *input, uint32_t length); uint32_t signal_energy_nodc(const c16_t *input, uint32_t length);
int32_t signal_power(int32_t *,uint32_t); int32_t signal_power(int32_t *,uint32_t);
int32_t interference_power(int32_t *,uint32_t); int32_t interference_power(int32_t *,uint32_t);
......
...@@ -264,6 +264,8 @@ typedef struct { ...@@ -264,6 +264,8 @@ typedef struct {
uint32_t frame; uint32_t frame;
/// Slot where current SRS pdu was received /// Slot where current SRS pdu was received
uint32_t slot; uint32_t slot;
/// Measured SNR
int8_t snr;
/// ULSCH PDU /// ULSCH PDU
nfapi_nr_srs_pdu_t srs_pdu; nfapi_nr_srs_pdu_t srs_pdu;
} NR_gNB_SRS_t; } NR_gNB_SRS_t;
......
...@@ -786,7 +786,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) ...@@ -786,7 +786,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_pdu_format0 = &gNB->uci_pdu_list[num_ucis].pucch_pdu_format_0_1; nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_pdu_format0 = &gNB->uci_pdu_list[num_ucis].pucch_pdu_format_0_1;
int offset = pucch_pdu->start_symbol_index*gNB->frame_parms.ofdm_symbol_size + (gNB->frame_parms.first_carrier_offset+pucch_pdu->prb_start*12); int offset = pucch_pdu->start_symbol_index*gNB->frame_parms.ofdm_symbol_size + (gNB->frame_parms.first_carrier_offset+pucch_pdu->prb_start*12);
LOG_D(PHY, LOG_D(NR_PHY,
"frame %d, slot %d: PUCCH signal energy %d\n", "frame %d, slot %d: PUCCH signal energy %d\n",
frame_rx, frame_rx,
slot_rx, slot_rx,
...@@ -953,7 +953,6 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) ...@@ -953,7 +953,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[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]; 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_per_rb[srs_pdu->bwp_size];
int8_t snr = 0;
start_meas(&gNB->generate_srs_stats); start_meas(&gNB->generate_srs_stats);
if (check_srs_pdu(srs_pdu, &gNB->nr_srs_info[i]->srs_pdu) == 0) { if (check_srs_pdu(srs_pdu, &gNB->nr_srs_info[i]->srs_pdu) == 0) {
...@@ -978,11 +977,11 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) ...@@ -978,11 +977,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,
srs_estimated_channel_time_shifted, srs_estimated_channel_time_shifted,
snr_per_rb, snr_per_rb,
&snr); &gNB->srs->snr);
stop_meas(&gNB->srs_channel_estimation_stats); stop_meas(&gNB->srs_channel_estimation_stats);
} }
if ((snr * 10) < gNB->srs_thres) { if ((gNB->srs->snr * 10) < gNB->srs_thres) {
srs_est = -1; srs_est = -1;
} }
...@@ -1055,7 +1054,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) ...@@ -1055,7 +1054,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; 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.prg_size = srs_pdu->beamforming.prg_size;
nr_srs_bf_report.num_symbols = 1 << srs_pdu->num_symbols; 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; 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); fill_srs_reported_symbol_list(&nr_srs_bf_report.prgs, srs_pdu, frame_parms->N_RB_UL, snr_per_rb, srs_est);
......
...@@ -724,7 +724,7 @@ int main(int argc, char *argv[]) ...@@ -724,7 +724,7 @@ int main(int argc, char *argv[])
NR_gNB_ULSCH_t *ulsch_gNB = &gNB->ulsch[UE_id]; NR_gNB_ULSCH_t *ulsch_gNB = &gNB->ulsch[UE_id];
NR_Sched_Rsp_t *Sched_INFO = malloc(sizeof(*Sched_INFO)); NR_Sched_Rsp_t *Sched_INFO = malloc16_clear(sizeof(*Sched_INFO));
memset((void*)Sched_INFO,0,sizeof(*Sched_INFO)); memset((void*)Sched_INFO,0,sizeof(*Sched_INFO));
nfapi_nr_ul_tti_request_t *UL_tti_req = &Sched_INFO->UL_tti_req; nfapi_nr_ul_tti_request_t *UL_tti_req = &Sched_INFO->UL_tti_req;
Sched_INFO->sched_response_id = -1; Sched_INFO->sched_response_id = -1;
...@@ -937,6 +937,7 @@ int main(int argc, char *argv[]) ...@@ -937,6 +937,7 @@ int main(int argc, char *argv[])
} }
//--------------- //---------------
int ret = 1; int ret = 1;
int srs_ret = do_SRS;
for (SNR = snr0; SNR <= snr1; SNR += snr_step) { for (SNR = snr0; SNR <= snr1; SNR += snr_step) {
varArray_t *table_rx=initVarArray(1000,sizeof(double)); varArray_t *table_rx=initVarArray(1000,sizeof(double));
...@@ -972,6 +973,9 @@ int main(int argc, char *argv[]) ...@@ -972,6 +973,9 @@ int main(int argc, char *argv[])
int max_pusch_delay = INT_MIN; int max_pusch_delay = INT_MIN;
int delay_pusch_est_count = 0; int delay_pusch_est_count = 0;
int64_t sum_srs_snr = 0;
int srs_snr_count = 0;
for (trial = 0; trial < n_trials; trial++) { for (trial = 0; trial < n_trials; trial++) {
uint8_t round = 0; uint8_t round = 0;
...@@ -1071,6 +1075,7 @@ int main(int argc, char *argv[]) ...@@ -1071,6 +1075,7 @@ int main(int argc, char *argv[])
srs_pdu->subcarrier_spacing = frame_parms->subcarrier_spacing; srs_pdu->subcarrier_spacing = frame_parms->subcarrier_spacing;
srs_pdu->num_ant_ports = n_tx == 4 ? 2 : n_tx == 2 ? 1 : 0; srs_pdu->num_ant_ports = n_tx == 4 ? 2 : n_tx == 2 ? 1 : 0;
srs_pdu->sequence_id = 40; srs_pdu->sequence_id = 40;
srs_pdu->time_start_position = frame_parms->symbols_per_slot - 1;
srs_pdu->config_index = rrc_get_max_nr_csrs(srs_pdu->bwp_size, srs_pdu->bandwidth_index); srs_pdu->config_index = rrc_get_max_nr_csrs(srs_pdu->bwp_size, srs_pdu->bandwidth_index);
srs_pdu->resource_type = NR_SRS_Resource__resourceType_PR_periodic; srs_pdu->resource_type = NR_SRS_Resource__resourceType_PR_periodic;
srs_pdu->t_srs = 1; srs_pdu->t_srs = 1;
...@@ -1436,6 +1441,10 @@ int main(int argc, char *argv[]) ...@@ -1436,6 +1441,10 @@ int main(int argc, char *argv[])
max_pusch_delay = max(ulsch_gNB->delay.est_delay, max_pusch_delay); max_pusch_delay = max(ulsch_gNB->delay.est_delay, max_pusch_delay);
delay_pusch_est_count++; delay_pusch_est_count++;
if (do_SRS == 1) {
sum_srs_snr += gNB->srs->snr;
srs_snr_count++;
}
} // trial loop } // trial loop
roundStats/=((float)n_trials); roundStats/=((float)n_trials);
...@@ -1471,8 +1480,14 @@ int main(int argc, char *argv[]) ...@@ -1471,8 +1480,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(") 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", double av_delay = (double)sum_pusch_delay / (2 * delay_pusch_est_count);
min_pusch_delay >> 1, max_pusch_delay >> 1, (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");
printf("\n"); printf("\n");
...@@ -1519,7 +1534,7 @@ int main(int argc, char *argv[]) ...@@ -1519,7 +1534,7 @@ int main(int argc, char *argv[])
if(n_trials==1) if(n_trials==1)
break; break;
if ((float)effTP >= eff_tp_check) { if (srs_ret == 0 && (float)effTP >= eff_tp_check) {
printf("*************\n"); printf("*************\n");
printf("PUSCH test OK\n"); printf("PUSCH test OK\n");
printf("*************\n"); printf("*************\n");
......
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
{CONFIG_STRING_L1_PUCCH0_DTX_THRESHOLD, NULL, 0, .uptr=NULL, .defintval=100, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_PUCCH0_DTX_THRESHOLD, NULL, 0, .uptr=NULL, .defintval=100, TYPE_UINT, 0}, \
{CONFIG_STRING_L1_PRACH_DTX_THRESHOLD, NULL, 0, .uptr=NULL, .defintval=150, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_PRACH_DTX_THRESHOLD, NULL, 0, .uptr=NULL, .defintval=150, TYPE_UINT, 0}, \
{CONFIG_STRING_L1_PUSCH_DTX_THRESHOLD, NULL, 0, .uptr=NULL, .defintval=50, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_PUSCH_DTX_THRESHOLD, NULL, 0, .uptr=NULL, .defintval=50, TYPE_UINT, 0}, \
{CONFIG_STRING_L1_SRS_DTX_THRESHOLD, NULL, 0, .uptr=NULL, .defintval=50, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_SRS_DTX_THRESHOLD, NULL, 0, .uptr=NULL, .defintval=30, TYPE_UINT, 0}, \
{CONFIG_STRING_L1_MAX_LDPC_ITERATIONS, NULL, 0, .uptr=NULL, .defintval=8, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_MAX_LDPC_ITERATIONS, NULL, 0, .uptr=NULL, .defintval=8, TYPE_UINT, 0}, \
{CONFIG_STRING_L1_RX_THREAD_CORE, NULL, 0, .uptr=NULL, .defintval=-1, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_RX_THREAD_CORE, NULL, 0, .uptr=NULL, .defintval=-1, TYPE_UINT, 0}, \
{CONFIG_STRING_L1_TX_THREAD_CORE, NULL, 0, .uptr=NULL, .defintval=-1, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_TX_THREAD_CORE, NULL, 0, .uptr=NULL, .defintval=-1, TYPE_UINT, 0}, \
......
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