diff --git a/openair1/PHY/TOOLS/nr_phy_scope.c b/openair1/PHY/TOOLS/nr_phy_scope.c index 0100dd44c405665182b55445f9d9e0781dc43472..3dd16ff0dad7c738379fbab06cc3be07b752692b 100644 --- a/openair1/PHY/TOOLS/nr_phy_scope.c +++ b/openair1/PHY/TOOLS/nr_phy_scope.c @@ -498,10 +498,8 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form, float **rxsig_t_dB; float *time; float *corr; - /* int16_t **chest_t; int16_t **chest_f; - */ int16_t *pdsch_llr; int16_t *pdsch_comp; //int16_t *pdsch_mag; @@ -519,10 +517,13 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form, int coded_bits_per_codeword = num_re*Qm; int symbol, first_symbol,nb_re; int nb_rb_pdsch =50; + float ymax=1; + float **chest_t_abs; + float Re,Im; + float *chest_f_abs; + float *freq; + static int overlay = 0; /* - float Re,Im,ymax=1; - float **chest_t_abs, *chest_f_abs; - float freq[nsymb_ce*nb_antennas_rx*nb_antennas_tx]; int frame = phy_vars_ue->proc.proc_rxtx[0].frame_rx; int mcs = 0; unsigned char harq_pid = 0; @@ -565,15 +566,15 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form, */ I = (float*) calloc(frame_parms->ofdm_symbol_size*frame_parms->symbols_per_slot*2,sizeof(float)); Q = (float*) calloc(frame_parms->ofdm_symbol_size*frame_parms->symbols_per_slot*2,sizeof(float)); - /* + chest_t_abs = (float**) malloc(nb_antennas_rx*sizeof(float*)); for (arx=0; arx<nb_antennas_rx; arx++) { chest_t_abs[arx] = (float*) calloc(frame_parms->ofdm_symbol_size,sizeof(float)); } - chest_f_abs = (float*) calloc(nsymb_ce*nb_antennas_rx*nb_antennas_tx,sizeof(float)); - */ + chest_f_abs = (float*) calloc(frame_parms->ofdm_symbol_size,sizeof(float)); + freq = (float*) calloc(frame_parms->ofdm_symbol_size,sizeof(float)); llr = (float*) calloc(coded_bits_per_codeword,sizeof(float)); // init to zero bit = malloc(coded_bits_per_codeword*sizeof(float)); @@ -589,10 +590,9 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form, time = calloc(samples_per_frame,sizeof(float)); corr = calloc(samples_per_frame,sizeof(float)); - /* chest_t = (int16_t**) phy_vars_ue->common_vars.common_vars_rx_data_per_thread[phy_vars_ue->current_thread_id[subframe]].dl_ch_estimates_time[eNB_id]; chest_f = (int16_t**) phy_vars_ue->common_vars.common_vars_rx_data_per_thread[phy_vars_ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id]; - */ + pbch_llr = (int16_t*) phy_vars_ue->pbch_vars[eNB_id]->llr; pbch_comp = (int16_t*) phy_vars_ue->pbch_vars[eNB_id]->rxdataF_comp[0]; @@ -628,29 +628,37 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form, } if (phy_vars_ue->is_synchronized==0) { - for (ind=0;ind<3;ind++) { - if (pss_corr_ue[ind]) { - for (i=0; i<samples_per_frame; i++) { - corr[i] = (float) pss_corr_ue[ind][i]; - time[i] = (float) i; + for (ind=0;ind<3;ind++) { + if (pss_corr_ue[ind]) { + for (i=0; i<samples_per_frame; i++) { + corr[i] = (float) pss_corr_ue[ind][i]; + time[i] = (float) i; + } + + if (ind==0) + fl_set_xyplot_data(form->chest_t,time,corr,samples_per_frame,"","",""); + else + fl_add_xyplot_overlay(form->chest_t,ind,time,corr,samples_per_frame,rx_antenna_colors[ind]); + + overlay = 1; } - - if (ind==0) - fl_set_xyplot_data(form->chest_t,time,corr,samples_per_frame,"","",""); - else - fl_add_xyplot_overlay(form->chest_t,ind,time,corr,samples_per_frame,rx_antenna_colors[ind]); } - } + } + else { + + if (overlay) { //there was a previous overlay + fl_clear_xyplot(form->chest_t); + overlay = 0; } - /* - // Channel Impulse Response (still repeated format) + // Channel Impulse Response if (chest_t != NULL) { ymax = 0; if (chest_t[0] !=NULL) { for (i=0; i<(frame_parms->ofdm_symbol_size>>3); i++) { - chest_t_abs[0][i] = (float) (chest_t[0][4*i]*chest_t[0][4*i]+chest_t[0][4*i+1]*chest_t[0][4*i+1]); + chest_t_abs[0][i] = (float) (chest_t[0][2*i]*chest_t[0][2*i]+chest_t[0][2*i+1]*chest_t[0][2*i+1]); + time[i] = (float) i; if (chest_t_abs[0][i] > ymax) ymax = chest_t_abs[0][i]; @@ -658,7 +666,7 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form, fl_set_xyplot_data(form->chest_t,time,chest_t_abs[0],(frame_parms->ofdm_symbol_size>>3),"","",""); } - + /* for (arx=1; arx<nb_antennas_rx; arx++) { if (chest_t[arx] !=NULL) { for (i=0; i<(frame_parms->ofdm_symbol_size>>3); i++) { @@ -672,11 +680,12 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form, fl_set_xyplot_overlay_type(form->chest_t,arx,FL_DASHED_XYPLOT); } } - + */ // Avoid flickering effect // fl_get_xyplot_ybounds(form->chest_t,&ymin,&ymax); // Does not always work... fl_set_xyplot_ybounds(form->chest_t,0,(double) ymax); } + } // Channel Frequency Response (includes 5 complex sample for filter) if (chest_f != NULL) { @@ -685,7 +694,7 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form, for (atx=0; atx<nb_antennas_tx; atx++) { for (arx=0; arx<nb_antennas_rx; arx++) { if (chest_f[(atx<<1)+arx] != NULL) { - for (k=0; k<nsymb_ce; k++) { + for (k=0; k<frame_parms->ofdm_symbol_size; k++) { freq[ind] = (float)ind; Re = (float)(chest_f[(atx<<1)+arx][(2*k)]); Im = (float)(chest_f[(atx<<1)+arx][(2*k)+1]); @@ -698,12 +707,13 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form, } // tx antenna 0 - fl_set_xyplot_xbounds(form->chest_f,0,nb_antennas_rx*nb_antennas_tx*nsymb_ce); + //fl_set_xyplot_xbounds(form->chest_f,0,nb_antennas_rx*nb_antennas_tx*nsymb_ce); //fl_set_xyplot_xtics(form->chest_f,nb_antennas_rx*nb_antennas_tx*frame_parms->symbols_per_tti,2); // fl_set_xyplot_xtics(form->chest_f,nb_antennas_rx*nb_antennas_tx*2,2); - fl_set_xyplot_xgrid(form->chest_f,FL_GRID_MAJOR); - fl_set_xyplot_data(form->chest_f,freq,chest_f_abs,nsymb_ce,"","",""); + //fl_set_xyplot_xgrid(form->chest_f,FL_GRID_MAJOR); + fl_set_xyplot_data(form->chest_f,freq,chest_f_abs,frame_parms->ofdm_symbol_size,"","",""); + /* for (arx=1; arx<nb_antennas_rx; arx++) { fl_add_xyplot_overlay(form->chest_f,1,&freq[arx*nsymb_ce],&chest_f_abs[arx*nsymb_ce],nsymb_ce,rx_antenna_colors[arx]); } @@ -722,8 +732,8 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form, fl_add_xyplot_overlay(form->chest_f,atx,&freq[atx*nsymb_ce],&chest_f_abs[atx*nsymb_ce],nsymb_ce,rx_antenna_colors[arx]); } } + */ } - */ // PBCH LLRs if (pbch_llr != NULL) { @@ -735,10 +745,7 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form, fl_set_xyplot_data(form->pbch_llr,bit_pbch,llr_pbch,864,"","",""); } - if (phy_vars_ue->is_synchronized==1) - first_symbol=5; - else - first_symbol=1; + first_symbol=1; // PBCH I/Q of MF Output if (pbch_comp!=NULL) { diff --git a/targets/RT/USER/nr-ue.c b/targets/RT/USER/nr-ue.c index 1dfa3dbd4fd8019fef47d9b1baa92f268be5c476..7682b098a00d5a00550535e7b80169620e890a66 100644 --- a/targets/RT/USER/nr-ue.c +++ b/targets/RT/USER/nr-ue.c @@ -602,7 +602,7 @@ static void *UE_thread_synch(void *arg) { phy_scope_UE(form_ue[0], PHY_vars_UE_g[0][0], - 0,0,7); + 0,0,1); } #endif