From 4971b1e62c2d8c4a36b7ddc11716eb8ba9094d68 Mon Sep 17 00:00:00 2001 From: Romain Beurdouche Date: Mon, 17 Mar 2025 10:57:55 +0000 Subject: [PATCH] feat(NR PHY simulators): Add a SIGINT handler to other NR PHY simulators Even though the remaining NR PHY simulators do not use the T2, we may still feature them with a SIGINT handler for proper termination on SIGINT and for a matter of completeness. The remaining NR PHY simulators are: * nr_pbchsim * nr_prachsim * nr_psbchsim * nr_pucchsim --- openair1/SIMULATION/NR_PHY/pbchsim.c | 8 ++++++-- openair1/SIMULATION/NR_PHY/prachsim.c | 10 +++++++--- openair1/SIMULATION/NR_PHY/psbchsim.c | 16 +++++++--------- openair1/SIMULATION/NR_PHY/pucchsim.c | 8 ++++++-- 4 files changed, 26 insertions(+), 16 deletions(-) diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c index b8ebf2bb30..d032a9d53c 100644 --- a/openair1/SIMULATION/NR_PHY/pbchsim.c +++ b/openair1/SIMULATION/NR_PHY/pbchsim.c @@ -126,6 +126,10 @@ int nr_ue_pdcch_procedures(PHY_VARS_NR_UE *ue, configmodule_interface_t *uniqCfg = NULL; int main(int argc, char **argv) { + stop = false; + __attribute__((unused)) struct sigaction oldaction; + sigaction(SIGINT, &sigint_action, &oldaction); + int i,aa,start_symbol; double sigma2, sigma2_dB=10,SNR,snr0=-2.0,snr1=2.0; double cfo=0; @@ -623,12 +627,12 @@ int main(int argc, char **argv) printf("txlev %d (%f)\n",txlev,10*log10(txlev));*/ - for (SNR=snr0; SNRnb_antennas_tx; aa++) { diff --git a/openair1/SIMULATION/NR_PHY/prachsim.c b/openair1/SIMULATION/NR_PHY/prachsim.c index eb3537650b..0776a6768e 100644 --- a/openair1/SIMULATION/NR_PHY/prachsim.c +++ b/openair1/SIMULATION/NR_PHY/prachsim.c @@ -129,6 +129,10 @@ int NB_UE_INST = 1; configmodule_interface_t *uniqCfg = NULL; int main(int argc, char **argv){ + stop = false; + __attribute__((unused)) struct sigaction oldaction; + sigaction(SIGINT, &sigint_action, &oldaction); + get_softmodem_params()->sl_mode = 0; double sigma2, sigma2_dB = 0, SNR, snr0 = -2.0, snr1 = 0.0, ue_speed0 = 0.0, ue_speed1 = 0.0; double **s_re, **s_im, **r_re, **r_im, iqim = 0.0, delay_avg = 0, ue_speed = 0, fs=-1, bw; @@ -716,15 +720,15 @@ int main(int argc, char **argv){ uint16_t preamble_rx, preamble_energy; - for (SNR=snr0; SNRmax_Doppler = 1.9076e9*(ue_speed/3.6)/3e8; printf("n_frames %d SNR %f\n",n_frames,SNR); prach_errors=0; - for (trial=0; trial= snr1; SNR -= 1) { - for (int trial = 0; trial < n_trials; trial++) { + for (SNR = snr0; SNR >= snr1 && !stop; SNR -= 1) { + for (int trial = 0; trial < n_trials && !stop; trial++) { for (int i = 0; i < frame_length_complex_samples; i++) { for (int aa = 0; aa < frame_parms->nb_antennas_tx; aa++) { struct complex16 *txdata_ptr = (struct complex16 *)&UE_TX->common_vars.txData[aa][i]; diff --git a/openair1/SIMULATION/NR_PHY/pucchsim.c b/openair1/SIMULATION/NR_PHY/pucchsim.c index bc022d5bc1..2d97a6a536 100644 --- a/openair1/SIMULATION/NR_PHY/pucchsim.c +++ b/openair1/SIMULATION/NR_PHY/pucchsim.c @@ -95,6 +95,10 @@ nrUE_params_t *get_nrUE_params(void) { configmodule_interface_t *uniqCfg = NULL; int main(int argc, char **argv) { + stop = false; + __attribute__((unused)) struct sigaction oldaction; + sigaction(SIGINT, &sigint_action, &oldaction); + int i;//,l; double sigma2, sigma2_dB=10,SNR,snr0=-2.0,snr1=2.0; double cfo=0; @@ -546,12 +550,12 @@ int main(int argc, char **argv) pucch_GroupHopping_t PUCCH_GroupHopping = pucch_tx_pdu.group_hop_flag + (pucch_tx_pdu.sequence_hop_flag<<1); double tx_level_fp = 100.0; c16_t **rxdataF = gNB->common_vars.rxdataF[0]; - for(SNR = snr0; SNR <= snr1; SNR += 1) { + for(SNR = snr0; SNR <= snr1 && !stop; SNR += 1) { ack_nack_errors=0; sr_errors = 0; n_errors = 0; c16_t **txdataF = gNB->common_vars.txdataF[0]; - for (trial=0; trialofdm_symbol_size*sizeof(int)); if(format==0 && do_DTX==0){