From fefa42c889ac8d52e28a86b0ad27e3da090dfd33 Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Fri, 3 Dec 2021 18:13:52 +0100 Subject: [PATCH] phy simulators remove measurments printf and check/allow log level config --- openair1/PHY/CODING/TESTBENCH/ldpctest.c | 18 ++++++++++++++---- .../NR_UE_TRANSPORT/nr_dlsch_demodulation.c | 6 +++--- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 15 ++++++++------- openair1/SIMULATION/NR_PHY/dlsim.c | 1 + openair1/SIMULATION/NR_PHY/ulsim.c | 3 ++- 5 files changed, 28 insertions(+), 15 deletions(-) diff --git a/openair1/PHY/CODING/TESTBENCH/ldpctest.c b/openair1/PHY/CODING/TESTBENCH/ldpctest.c index aff707a1d5..371deba3f2 100644 --- a/openair1/PHY/CODING/TESTBENCH/ldpctest.c +++ b/openair1/PHY/CODING/TESTBENCH/ldpctest.c @@ -514,7 +514,7 @@ int main(int argc, char *argv[]) unsigned char qbits=8; unsigned int decoded_errors[10000]; // initiate the size of matrix equivalent to size of SNR int c,i=0, i1 = 0; - + int loglvl=OAILOG_WARNING; int n_trials = 1; double SNR_step = 0.1; @@ -525,8 +525,11 @@ int main(int argc, char *argv[]) n_iter_stats_t dec_iter[3]; short BG=0,Zc,Kb=0; - - while ((c = getopt (argc, argv, "q:r:s:S:l:G:n:d:i:t:u:hv:")) != -1) + if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == 0) { + exit_fun(" Error, configuration module init failed\n"); + } // must be done before specific options parsing to prevent errasing them + + while ((c = getopt (argc, argv, "q:r:s:S:l:L:G:n:d:i:t:u:hv:")) != -1) switch (c) { case 'q': @@ -544,6 +547,10 @@ int main(int argc, char *argv[]) case 'l': block_length = atoi(optarg); break; + + case 'L': + loglvl = atoi(optarg); + break; case 'G': ldpc_version="_cuda"; @@ -581,10 +588,11 @@ int main(int argc, char *argv[]) printf("BG1 (blocklength > 3840): 1/3, 2/3, 22/25 (8/9) \n"); printf("BG2 (blocklength <= 3840): 1/5, 1/3, 2/3 \n\n"); printf("-h This message\n"); + printf("-L \n"); printf("-q Quantization bits, Default: 8\n"); printf("-r Nominator rate, (1, 2, 22), Default: 1\n"); printf("-d Denominator rate, (3, 5, 25), Default: 1\n"); - printf("-l Block length (l > 3840 -> BG1, rest BG2 ), Default: 8448\n"); + printf("-l Block length (l > 3840 -> BG1, rest BG2 ), Default: 8448\n"); printf("-G give 1 to run cuda for LDPC, Default: 0\n"); printf("-n Number of simulation trials, Default: 1\n"); //printf("-M MCS2 for TB 2\n"); @@ -603,6 +611,8 @@ int main(int argc, char *argv[]) printf("n_trials %d: \n", n_trials); printf("SNR0 %f: \n", SNR0); + logInit(); + set_glog(loglvl); if (ldpc_version != NULL) load_nrLDPClib(ldpc_version); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index 31b3f8896a..1e031d531c 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -399,8 +399,8 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, nb_rb_pdsch); stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]); - if (cpumeas(CPUMEAS_GETSTATE)) - LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: Channel Scale %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); + if (cpumeas(CPUMEAS_GETSTATE)) + LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: Channel Scale %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); start_meas(&ue->generic_stat_bis[proc->thread_id][slot]); if (first_symbol_flag==1) { @@ -509,7 +509,6 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]); if (cpumeas(CPUMEAS_GETSTATE)) LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d log2_maxh %d channel_level %d: Channel Comp %5.2f \n", frame, nr_slot_rx, slot, symbol, pdsch_vars[gNB_id]->log2_maxh, proc->channel_level, ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); - start_meas(&ue->generic_stat_bis[proc->thread_id][slot]); if (frame_parms->nb_antennas_rx > 1) { @@ -566,6 +565,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]); if (cpumeas(CPUMEAS_GETSTATE)) LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: Channel Combine %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); + start_meas(&ue->generic_stat_bis[proc->thread_id][slot]); /* Store the valid DL RE's */ pdsch_vars[gNB_id]->dl_valid_re[symbol-1] = len; diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 3b4c3657df..b65cb333f7 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -1025,7 +1025,6 @@ bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, stop_meas(&ue->dlsch_decoding_stats[proc->thread_id]); - if (cpumeas(CPUMEAS_GETSTATE)) { LOG_D(PHY, " --> Unscrambling for CW0 %5.3f\n", (ue->dlsch_unscrambling_stats.p_time)/(cpuf*1000.0)); @@ -1083,12 +1082,12 @@ bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, LOG_T(PHY,"CWW sequential dlsch decoding, ret1 = %d\n", ret1); } - stop_meas(&ue->dlsch_decoding_stats[proc->thread_id]); + stop_meas(&ue->dlsch_decoding_stats[proc->thread_id]); if (cpumeas(CPUMEAS_GETSTATE)) { - LOG_D(PHY, " --> Unscrambling for CW1 %5.3f\n", - (ue->dlsch_unscrambling_stats.p_time)/(cpuf*1000.0)); - LOG_D(PHY, "AbsSubframe %d.%d --> ldpc Decoding for CW1 %5.3f\n", - frame_rx%1024, nr_slot_rx,(ue->dlsch_decoding_stats[proc->thread_id].p_time)/(cpuf*1000.0)); + LOG_D(PHY, " --> Unscrambling for CW1 %5.3f\n", + (ue->dlsch_unscrambling_stats.p_time)/(cpuf*1000.0)); + LOG_D(PHY, "AbsSubframe %d.%d --> ldpc Decoding for CW1 %5.3f\n", + frame_rx%1024, nr_slot_rx,(ue->dlsch_decoding_stats[proc->thread_id].p_time)/(cpuf*1000.0)); } LOG_D(PHY, "harq_pid: %d, TBS expected dlsch1: %d \n", harq_pid, dlsch1->harq_processes[harq_pid]->TBS); } @@ -1859,7 +1858,6 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, LOG_D(PHY, "[SFN %d] Slot1: Pdsch Proc %5.2f\n",nr_slot_rx,ue->pdsch_procedures_stat[proc->thread_id].p_time/(cpuf*1000.0)); LOG_D(PHY, "[SFN %d] Slot0 Slot1: Dlsch Proc %5.2f\n",nr_slot_rx,ue->dlsch_procedures_stat[proc->thread_id].p_time/(cpuf*1000.0)); } - // deactivate dlsch once dlsch proc is done ue->dlsch[proc->thread_id][gNB_id][0]->active = 0; @@ -1933,6 +1931,8 @@ if (nr_slot_rx==9) { } stop_meas(&ue->generic_stat); +if (cpumeas(CPUMEAS_GETSTATE)) + LOG_D(PHY,"after tubo until end of Rx %5.2f \n",ue->generic_stat.p_time/(cpuf*1000.0)); #ifdef EMOS phy_procedures_emos_UE_RX(ue,slot,gNB_id); @@ -1944,6 +1944,7 @@ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDUR stop_meas(&ue->phy_proc_rx[proc->thread_id]); if (cpumeas(CPUMEAS_GETSTATE)) LOG_D(PHY, "------FULL RX PROC [SFN %d]: %5.2f ------\n",nr_slot_rx,ue->phy_proc_rx[proc->thread_id].p_time/(cpuf*1000.0)); + //#endif //pdsch LOG_D(PHY," ****** end RX-Chain for AbsSubframe %d.%d ****** \n", frame_rx%1024, nr_slot_rx); diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index fa868a6896..80d1a512b1 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -645,6 +645,7 @@ int main(int argc, char **argv) printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t Delayspread -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -i Intefrence0 -j Interference1 -A interpolation_file -C(alibration offset dB) -N CellId\n", argv[0]); printf("-h This message\n"); + printf("-L \n"); //printf("-p Use extended prefix mode\n"); //printf("-d Use TDD\n"); printf("-n Number of frames to simulate\n"); diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 97c753d455..9be5a18805 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -600,6 +600,7 @@ int main(int argc, char **argv) //printf("-C Generate Calibration information for Abstraction (effective SNR adjustment to remove Pe bias w.r.t. AWGN)\n"); printf("-F Input filename (.txt format) for RX conformance testing\n"); printf("-G Offset of samples to read from file (0 default)\n"); + printf("-L \n"); printf("-M Multiple SSB positions in burst\n"); printf("-N Nid_cell\n"); printf("-O oversampling factor (1,2,4,8,16)\n"); @@ -640,7 +641,7 @@ int main(int argc, char **argv) else if (N_RB_UL == 106) bandwidth = 40; else if (N_RB_UL == 32) bandwidth = 50; else { printf("Add N_RB_UL %d\n",N_RB_UL); exit(-1); } - + LOG_I( PHY,"++++++++++++++++++++++++++++++++++++++++++++++%i+++++++++++++++++++++++++++++++++++++++++",loglvl); if (openair0_cfg[0].threequarter_fs == 1) sampling_frequency*=.75; UE2gNB = new_channel_desc_scm(n_tx, n_rx, channel_model,