diff --git a/doc/SystemX-tutorial-design.md b/doc/SystemX-tutorial-design.md index 9feaf189c5..3e4496f7de 100644 --- a/doc/SystemX-tutorial-design.md +++ b/doc/SystemX-tutorial-design.md @@ -1,18 +1,10 @@ # OpenAirInterface for SystemX -<<<<<<< HEAD -#Terminology - -****This document use the 5G terminology**** - -**Central Unit (CU): **It is a logical node that includes the gNB -======= # Terminology ****This document use the 5G terminology**** **Central Unit (CU):** It is a logical node that includes the gNB ->>>>>>> da54778c4ab381743c388078676103663addafcc functions like Transfer of user data, Mobility control, Radio access network sharing, Positioning, Session Management etc., except those functions allocated exclusively to the DU. CU controls the operation of @@ -27,13 +19,9 @@ names like RRH/RRU/RE/RU/PNF. In OpenAir code, the terminology is often RU and BBU. # OpenAirUsage -<<<<<<< HEAD -##EPC and general environment -======= ## EPC and general environment ->>>>>>> da54778c4ab381743c388078676103663addafcc ### OAI EPC Use the stable OAI EPC, that can run in one machine (VM or standalone) @@ -41,16 +29,10 @@ Use the stable OAI EPC, that can run in one machine (VM or standalone) Draft description: -<<<<<<< HEAD -##Standalone 4G - -EPC+eNB on one machine, the UE can be commercial or OAI UE. -======= ## Standalone 4G EPC+eNB on one machine, the UE can be commercial or OAI UE. ->>>>>>> da54778c4ab381743c388078676103663addafcc ### USRP B210 Main current issue: traffic is good only on coaxial link between UE and @@ -76,12 +58,8 @@ the same IP tunnel end point as the UE. So, we have to create a network namespace for the UE and to route data in/out of the namespace. -<<<<<<< HEAD -``` bash -======= ```bash ->>>>>>> da54778c4ab381743c388078676103663addafcc ip netns delete aNameSpace 2> /dev/null ip link delete v-eth1 2> /dev/null @@ -96,11 +74,7 @@ ip addr add 10.200.1.1/24 dev v-eth1 ip link set v-eth1 up -<<<<<<< HEAD -iptables -t nat -A POSTROUTING -s 10.200.1.0/255.255.255.0 -o enp0s31f6 -======= iptables -t nat -A POSTROUTING -s 10.200.1.0/255.255.255.0 -o enp0s31f6 \ ->>>>>>> da54778c4ab381743c388078676103663addafcc -j MASQUERADE iptables -A FORWARD -i enp0s31f6 -o v-eth1 -j ACCEPT @@ -122,15 +96,6 @@ to run the UE. To make user plan traffic, the traffic generator has to run in the same namespace -<<<<<<< HEAD -`ip netns exec aNameSpace bash -` - -The traffic genenrator has to specify the interface: - -`route add default oaitun_ue1 -` -======= ```bash ip netns exec aNameSpace bash ``` @@ -140,7 +105,6 @@ The traffic genenrator has to specify the interface: ```bash route add default oaitun_ue1 ``` ->>>>>>> da54778c4ab381743c388078676103663addafcc or specify the outgoing route in the traffic generator (like option “-I” in ping command). @@ -153,10 +117,7 @@ is this work the downlink “functional split 6”. The customer required after signature to develop also the uplink functional split 6. This is accepted, as long as the whole work is research with no delivery completeness warranty. -<<<<<<< HEAD -======= ->>>>>>> da54778c4ab381743c388078676103663addafcc ### Simulation To be able to verify the new features and to help in all future @@ -165,19 +126,12 @@ during this contract. We added the channel modeling simulation, that offer to simulate various 3GPP defined channels. -<<<<<<< HEAD -======= ->>>>>>> da54778c4ab381743c388078676103663addafcc ### Main loop The main log is in RF simulator is in -<<<<<<< HEAD - targets/RT/USER/lte-ru.c and targets/RT/USER/lte-enb.c -======= `targets/RT/USER/lte-ru.c and targets/RT/USER/lte-enb.c` ->>>>>>> da54778c4ab381743c388078676103663addafcc As this piece of SW is very complex and doesn’t meet our goals (functional split 6), a cleaned version replaces these 2 files in @@ -196,13 +150,8 @@ The reworked main loop take care of a uniq variable that comes directly from har To use OAI, we need to set all OAI variables that derivates from this timestamp value. The function setAllfromTS() implements this. -<<<<<<< HEAD - -### Splitted main level -======= ### Splitted main level ->>>>>>> da54778c4ab381743c388078676103663addafcc When FS6 is actived, a main loop for DU (du_fs6()) a main loop for CU case replaces the uniq eNB main loop. Each of these main loops calls initialization of OAI LTE data and the FS6 transport layer initialization. @@ -321,31 +270,6 @@ The end line option “--split73” enables the fs6 (also called split 7.3) mode Example: -<<<<<<< HEAD -./ocp-softmodem -O $OPENAIR_DIR/enb.fs6.example.conf --rfsim --log_config.phy_log_level debug --split73 cu:127.0.0.1 -` -Run the CU init of the split 6 eNB, that will call du on 127.0.0.1 address - -./ocp-softmodem -O $OPENAIR_DIR/enb.fs6.example.conf --rfsim --log_config.phy_log_level debug --split73 du:127.0.0.1 - -will run the du, calling the cu on 127.0.0.1 -` -If the CU and the DU are not on the same machine, the remote address of each side need to be specified as per this example - -./ocp-softmodem -O $OPENAIR_DIR/enb.fs6.example.conf --rfsim --log_config.phy_log_level debug --split73 du:192.168.1.55 -` -runs the functional split 6 DU - -`./lte-uesoftmodem -C 2685000000 -r 50 --rfsim --rfsimulator.serveraddr 192.168.1.1 -d -` - -Runs the UE (to have the UE signal scope, compile it with make uescope) - -CU+DU+UE can run with option --noS1 to avoid to use a EPC and/or with --rfsim to simulate RF board - - -##5G and F1 -======= ```bash ./ocp-softmodem -O $OPENAIR_DIR/enb.fs6.example.conf --rfsim --log_config.phy_log_level debug --split73 cu:127.0.0.1 ``` @@ -376,7 +300,6 @@ CU+DU+UE can run with option `--noS1` to avoid to use a EPC and/or with `--rfsim ## 5G and F1 ->>>>>>> da54778c4ab381743c388078676103663addafcc Today 5G achievement is limited to physical layer. @@ -397,18 +320,6 @@ frames). Usage with RFsimulator: -<<<<<<< HEAD -gNB - -`sudo RFSIMULATOR=server ./nr-softmodem -O -../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf ---parallel-config PARALLEL\_SINGLE\_THREAD` - -nrUE - -`sudo RFSIMULATOR=127.0.0.1 ./nr-uesoftmodem --numerology 1 -r 106 -C -3510000000 -d` -======= **gNB** ```bash @@ -423,4 +334,3 @@ sudo RFSIMULATOR=server ./nr-softmodem -O \ sudo RFSIMULATOR=127.0.0.1 ./nr-uesoftmodem --numerology 1 -r 106 -C \ 3510000000 -d ``` ->>>>>>> da54778c4ab381743c388078676103663addafcc diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index f473d0161b..1f291cfc19 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -954,7 +954,9 @@ if(!IS_SOFTMODEM_NOS1) scopeParms_t p; p.argc=&argc; p.argv=argv; - startScope(&p); + p.gNB=RC.gNB[0]; + p.ru=RC.ru[0]; + gNBinitScope(&p); } if (nfapi_mode != 1 && nfapi_mode != 2) { diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 2eaf624404..9c33f2d360 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -249,7 +249,7 @@ void exit_function(const char *file, const char *function, const int line, const } -void reset_stats(FL_OBJECT *button, long arg) { +void reset_stats(long arg) { //int i,j,k; /*PHY_VARS_eNB *phy_vars_eNB = PHY_vars_eNB_g[0][0]; @@ -729,7 +729,7 @@ int main( int argc, char **argv ) { configure_linux(); mlockall(MCL_CURRENT | MCL_FUTURE); if (do_forms) - init_scope(PHY_vars_UE_g[0][0]); + nrUEinitScope(PHY_vars_UE_g[0][0]); number_of_cards = 1; for(int CC_id=0; CC_idulsch_llr_stats); + AssertFatal(gNB->pusch_vars[UE_id]->rxdataF_ext_offset * rel15_ul->qam_mod_order+nb_re_pusch*rel15_ul->qam_mod_order < (8*((3*8*6144)+12)) , "Mysterious llr buffer size check"); nr_ulsch_compute_llr(&gNB->pusch_vars[UE_id]->rxdataF_comp[0][symbol * rel15_ul->rb_size * NR_NB_SC_PER_RB], gNB->pusch_vars[UE_id]->ul_ch_mag0, gNB->pusch_vars[UE_id]->ul_ch_magb0, diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index fcd61b33bf..3af9280d30 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -669,13 +669,11 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, pdsch_vars[eNB_id]->llr_offset[symbol] = len*dlsch0_harq->Qm + llr_offset_symbol; - LOG_I(PHY,"compute LLRs [symbol %d] NbRB %d Qm %d LLRs-Length %d LLR-Offset %d @LLR Buff %x @LLR Buff(symb) %x energy %d\n", + LOG_I(PHY,"compute LLRs [symbol %d] NbRB %d Qm %d LLRs-Length %d LLR-Offset %d energy %d\n", symbol, nb_rb,dlsch0_harq->Qm, pdsch_vars[eNB_id]->llr_length[symbol], pdsch_vars[eNB_id]->llr_offset[symbol], - (int16_t*)pdsch_vars[eNB_id]->llr[0], - pllr_symbol_cw0, signal_energy(pdsch_vars[eNB_id]->rxdataF_comp0[0], 7*2*frame_parms->N_RB_DL*12)); //if (ue->current_thread_id[nr_tti_rx] ==0 ) //phy_scope_nrUE(NULL, ue, 0, 0, 0); diff --git a/openair1/PHY/TOOLS/nr_phy_scope.c b/openair1/PHY/TOOLS/nr_phy_scope.c index 02cf000f37..24b7be74d1 100644 --- a/openair1/PHY/TOOLS/nr_phy_scope.c +++ b/openair1/PHY/TOOLS/nr_phy_scope.c @@ -26,6 +26,7 @@ #include #include "nr_phy_scope.h" #include "executables/nr-softmodem-common.h" +#include #define TPUT_WINDOW_LENGTH 100 #define localBuff(NaMe,SiZe) float NaMe[SiZe]; memset(NaMe,0,sizeof(NaMe)); @@ -39,6 +40,12 @@ float tput_time_ue[NUMBER_OF_UE_MAX][TPUT_WINDOW_LENGTH] = {{0}}; float tput_ue[NUMBER_OF_UE_MAX][TPUT_WINDOW_LENGTH] = {{0}}; float tput_ue_max[NUMBER_OF_UE_MAX] = {0}; +typedef struct { + int16_t r; + int16_t i; +} scopeSample_t; +#define SquaredNorm(VaR) ((VaR).r*(VaR).r+(VaR).i*(VaR).i) + typedef struct OAIgraph { FL_OBJECT *graph; void (*gNBfunct) (FL_OBJECT *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int UE_id); @@ -62,7 +69,7 @@ typedef struct { } FD_stats_form; static void drawsymbol(FL_OBJECT *obj, int id, - FL_POINT *p, int n, int w, int h) { + FL_POINT *p, int n, int w, int h) { fl_points( p, n, FL_YELLOW); } @@ -91,7 +98,7 @@ static void dl_traffic_on_off( FL_OBJECT *button, long arg) { } static FL_OBJECT *commonGraph( int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h, const char *label, FL_COLOR pointColor) { - FL_OBJECT * graph; + FL_OBJECT *graph; graph=fl_add_xyplot(type, x, y, w, h, label); fl_set_object_boxtype(graph, FL_EMBOSSED_BOX ); fl_set_object_lcolor(graph, FL_WHITE ); // Label color @@ -101,7 +108,7 @@ static FL_OBJECT *commonGraph( int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_ } static OAIgraph_t gNBcommonGraph( void (*funct) (FL_OBJECT *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int UE_id), - int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h, const char *label, FL_COLOR pointColor) { + int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h, const char *label, FL_COLOR pointColor) { OAIgraph_t graph; graph.graph=commonGraph(type, x, y, w, h, label, pointColor); graph.gNBfunct=funct; @@ -110,7 +117,7 @@ static OAIgraph_t gNBcommonGraph( void (*funct) (FL_OBJECT *graph, PHY_VARS_gNB } static OAIgraph_t nrUEcommonGraph( void (*funct) (FL_OBJECT *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id), - int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h, const char *label, FL_COLOR pointColor) { + int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h, const char *label, FL_COLOR pointColor) { OAIgraph_t graph; graph.graph=commonGraph(type, x, y, w, h, label, pointColor); graph.gNBfunct=NULL; @@ -122,13 +129,15 @@ void phy_scope_gNB(FD_phy_scope_t *form, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int UE_id) { - static FD_phy_scope_t *remeberForm=NULL; + static FD_phy_scope_t *remeberForm=NULL; if (form==NULL) form=remeberForm; else remeberForm=form; + if (form==NULL) return; + int i=0; while (form->graph[i].graph) { @@ -146,70 +155,51 @@ static void timeSignal (FL_OBJECT *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_ NR_DL_FRAME_PARMS *frame_parms=&phy_vars_gnb->frame_parms; uint8_t nb_antennas_rx = frame_parms->nb_antennas_rx; - int16_t **rxsig_t = phy_vars_ru->common.rxdata; - float rxsig_t_dB[nb_antennas_rx][frame_parms->samples_per_frame]; + scopeSample_t **rxsig_t = (scopeSample_t **)phy_vars_ru->common.rxdata; + float rxsig_t_dB[frame_parms->samples_per_frame]; float time[frame_parms->samples_per_frame]; - if (rxsig_t[0] != NULL) { - for (int i=0; isamples_per_frame; i++) { - rxsig_t_dB[0][i] = 10*log10(1.0+(float) ((rxsig_t[0][2*i])*(rxsig_t[0][2*i])+ - (rxsig_t[0][2*i+1])*(rxsig_t[0][2*i+1]))); - time[i] = (float) i; - } - - fl_set_xyplot_data(graph,time,rxsig_t_dB[0],frame_parms->samples_per_frame,"","",""); - } - - for (int arx=1; arxsamples_per_frame; i++) { - rxsig_t_dB[arx][i] = 10*log10(1.0+(float) ((rxsig_t[arx][2*i])*(rxsig_t[arx][2*i])+ - (rxsig_t[arx][2*i+1])*(rxsig_t[arx][2*i+1]))); + rxsig_t_dB[i] = 10*log10(1.0+SquaredNorm(rxsig_t[arx][i])); } - fl_add_xyplot_overlay(graph,arx,time,rxsig_t_dB[arx],frame_parms->samples_per_frame,rx_antenna_colors[arx]); + if (arx==0) + fl_set_xyplot_data(graph,time,rxsig_t_dB, frame_parms->samples_per_frame,"","",""); + else + fl_add_xyplot_overlay(graph,arx,time,rxsig_t_dB,frame_parms->samples_per_frame,rx_antenna_colors[arx]); } } } static void timeResponse (FL_OBJECT *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int UE_id) { - // Channel Impulse Response if (!phy_vars_gnb->pusch_vars[UE_id]->ul_ch_estimates_time) return; NR_DL_FRAME_PARMS *frame_parms=&phy_vars_gnb->frame_parms; uint8_t nb_antennas_rx = frame_parms->nb_antennas_rx; - int16_t **chest_t = (int16_t **) phy_vars_gnb->pusch_vars[UE_id]->ul_ch_estimates_time; + scopeSample_t **chest_t = (scopeSample_t **) phy_vars_gnb->pusch_vars[UE_id]->ul_ch_estimates_time; int ymax = 0; float time2[2*frame_parms->ofdm_symbol_size]; - float chest_t_abs[nb_antennas_rx][2*frame_parms->ofdm_symbol_size]; + float chest_t_abs[2*frame_parms->ofdm_symbol_size]; - if (chest_t[0] !=NULL) { - for (int i=0; i<(2*frame_parms->ofdm_symbol_size); i++) { - //i2 = (i+(frame_parms->ofdm_symbol_size>>1))%frame_parms->ofdm_symbol_size; - int i2=i; - //time2[i] = (float)(i-(frame_parms->ofdm_symbol_size>>1)); - time2[i] = (float)i; - chest_t_abs[0][i] = 10*log10((float) (1+chest_t[0][2*i2]*chest_t[0][2*i2]+chest_t[0][2*i2+1]*chest_t[0][2*i2+1])); - - if (chest_t_abs[0][i] > ymax) - ymax = chest_t_abs[0][i]; - } - - fl_set_xyplot_data(graph,time2,chest_t_abs[0],(2*frame_parms->ofdm_symbol_size),"","",""); - } - - for (int arx=1; arxofdm_symbol_size>>3); i++) { - chest_t_abs[arx][i] = 10*log10((float) (1+chest_t[arx][2*i]*chest_t[arx][2*i]+chest_t[arx][2*i+1]*chest_t[arx][2*i+1])); + for (int i=0; i<(2*frame_parms->ofdm_symbol_size); i++) { + time2[i] = (float)i; + chest_t_abs[i] = 10*log10(1.0 + SquaredNorm(chest_t[0][i])); - if (chest_t_abs[arx][i] > ymax) - ymax = chest_t_abs[arx][i]; + if (chest_t_abs[i] > ymax) + ymax = chest_t_abs[i]; } - fl_add_xyplot_overlay(graph,arx,time2,chest_t_abs[arx],(frame_parms->ofdm_symbol_size>>3),rx_antenna_colors[arx]); - fl_set_xyplot_overlay_type(graph,arx,FL_DASHED_XYPLOT); + if (arx==0) + fl_set_xyplot_data(graph,time2,chest_t_abs,(2*frame_parms->ofdm_symbol_size),"","",""); + else { + fl_add_xyplot_overlay(graph,arx,time2,chest_t_abs,(frame_parms->ofdm_symbol_size>>3),rx_antenna_colors[arx]); + fl_set_xyplot_overlay_type(graph,arx,FL_DASHED_XYPLOT); + } } } @@ -224,58 +214,38 @@ static void frequencyResponse (FL_OBJECT *graph, PHY_VARS_gNB *phy_vars_gnb, RU_ return; NR_DL_FRAME_PARMS *frame_parms=&phy_vars_gnb->frame_parms; - uint8_t nb_antennas_rx = frame_parms->nb_antennas_rx; - int16_t **rxsig_f = (int16_t **) phy_vars_ru->common.rxdataF; - float rxsig_f_dB[nb_antennas_rx][frame_parms->samples_per_slot_wCP]; + //uint8_t nb_antennas_rx = frame_parms->nb_antennas_rx; + scopeSample_t **rxsig_f = (scopeSample_t **) phy_vars_ru->common.rxdataF; + float rxsig_f_dB[frame_parms->samples_per_slot_wCP]; float time[frame_parms->samples_per_slot_wCP]; if (rxsig_f[0] != NULL) { for (int i=0; isamples_per_slot_wCP; i++) { - rxsig_f_dB[0][i] = 10*log10(1.0+(float) ((rxsig_f[0][2*i])*(rxsig_f[0][2*i])+(rxsig_f[0][2*i+1])*(rxsig_f[0][2*i+1]))); + rxsig_f_dB[i] = 10*log10(1.0+ SquaredNorm(rxsig_f[0][i])); time[i] = (float) i; } - fl_set_xyplot_data(graph,time,rxsig_f_dB[0],frame_parms->samples_per_slot_wCP,"","",""); + fl_set_xyplot_data(graph,time,rxsig_f_dB,frame_parms->samples_per_slot_wCP,"","",""); } /* - for (arx=0; arxchest_f,1,time,chest_f_abs,nsymb_ce,rx_antenna_colors[arx]); } - } - } - + } + */ + /* // tx antenna 0 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,3); fl_set_xyplot_xgrid(form->chest_f,FL_GRID_MAJOR); fl_set_xyplot_data(form->chest_f,freq,chest_f_abs,nsymb_ce,"","",""); - - for (arx=1; arxchest_f,1,&freq[arx*nsymb_ce],&chest_f_abs[arx*nsymb_ce],nsymb_ce,rx_antenna_colors[arx]); - } - - // other tx antennas - if (nb_antennas_tx > 1) { - if (nb_antennas_rx > 1) { - for (atx=1; atxchest_f,(atx<<1)+arx,&freq[((atx<<1)+arx)*nsymb_ce],&chest_f_abs[((atx<<1)+arx)*nsymb_ce],nsymb_ce,rx_antenna_colors[arx]); - } - } - } else { // 1 rx antenna - atx=1; - arx=0; - fl_add_xyplot_overlay(form->chest_f,atx,&freq[atx*nsymb_ce],&chest_f_abs[atx*nsymb_ce],nsymb_ce,rx_antenna_colors[arx]); - } - } */ } @@ -284,10 +254,10 @@ static void puschLLR (FL_OBJECT *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_va if (!phy_vars_gnb->pusch_vars[UE_id]->llr) return; - NR_DL_FRAME_PARMS *frame_parms=&phy_vars_gnb->frame_parms; - int Qm = 2; + //NR_DL_FRAME_PARMS *frame_parms=&phy_vars_gnb->frame_parms; + //int Qm = 2; int16_t *pusch_llr = (int16_t *) phy_vars_gnb->pusch_vars[UE_id]->llr; - int coded_bits_per_codeword = frame_parms->N_RB_UL*12*Qm*frame_parms->symbols_per_tti; + int coded_bits_per_codeword =3*8*6144+12; // (8*((3*8*6144)+12)); // frame_parms->N_RB_UL*12*Qm*frame_parms->symbols_per_tti; float llr[coded_bits_per_codeword]; float bit[coded_bits_per_codeword]; @@ -305,20 +275,16 @@ static void puschIQ (FL_OBJECT *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_var return; NR_DL_FRAME_PARMS *frame_parms=&phy_vars_gnb->frame_parms; - int32_t *pusch_comp = (int32_t *) phy_vars_gnb->pusch_vars[UE_id]->rxdataF_comp; - int sz=frame_parms->symbols_per_tti*12*frame_parms->N_RB_UL; + scopeSample_t *pusch_comp = (scopeSample_t *) phy_vars_gnb->pusch_vars[UE_id]->rxdataF_comp[0]; + int sz=frame_parms->N_RB_UL*12*frame_parms->symbols_per_slot; float I[sz], Q[sz]; - int ind=0; - for (int k=0; ksymbols_per_tti; k++) { - for (int i=0; i<12*frame_parms->N_RB_UL; i++) { - I[ind] = pusch_comp[(2*frame_parms->N_RB_UL*12*k)+2*i]; - Q[ind] = pusch_comp[(2*frame_parms->N_RB_UL*12*k)+2*i+1]; - ind++; - } + for (int k=0; kargc, p->argv, NULL, 0, 0); + /* form_stats_l2 = create_form_stats_form(); fl_show_form (form_stats_l2->stats_form, FL_PLACE_HOTSPOT, FL_FULLBORDER, "l2 stats"); form_stats = create_form_stats_form(); fl_show_form (form_stats->stats_form, FL_PLACE_HOTSPOT, FL_FULLBORDER, "stats"); */ - for(int UE_id=0; UE_idframe_parms; uint8_t nb_antennas_rx = frame_parms->nb_antennas_rx; int samples_per_frame = frame_parms->samples_per_frame; - int16_t **rxsig_t = (int16_t **) phy_vars_ue->common_vars.rxdata; - float rxsig_t_dB[nb_antennas_rx][samples_per_frame]; + scopeSample_t **rxsig_t = (scopeSample_t **) phy_vars_ue->common_vars.rxdata; + float rxsig_t_dB[samples_per_frame]; float time[samples_per_frame]; if (rxsig_t[0] != NULL) { for (int i=0; iframe_parms; uint8_t nb_antennas_rx = frame_parms->nb_antennas_rx; - int16_t **chest_t = (int16_t **) phy_vars_ue->pbch_vars[eNB_id]->dl_ch_estimates_time; + scopeSample_t **chest_t = (scopeSample_t **) phy_vars_ue->pbch_vars[eNB_id]->dl_ch_estimates_time; int ymax = 0; - float chest_t_abs[nb_antennas_rx][frame_parms->ofdm_symbol_size]; + float chest_t_abs[frame_parms->ofdm_symbol_size]; float time[frame_parms->ofdm_symbol_size>>3]; if (chest_t[0] !=NULL) { for (int i=0; i<(frame_parms->ofdm_symbol_size>>3); i++) { - 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]); + chest_t_abs[i] = SquaredNorm(chest_t[0][i]); time[i] = (float) i; - if (chest_t_abs[0][i] > ymax) - ymax = chest_t_abs[0][i]; + if (chest_t_abs[i] > ymax) + ymax = chest_t_abs[i]; } - fl_set_xyplot_data(graph,time,chest_t_abs[0],(frame_parms->ofdm_symbol_size>>3),"","",""); + fl_set_xyplot_data(graph,time,chest_t_abs,(frame_parms->ofdm_symbol_size>>3),"","",""); } for (int arx=1; arxofdm_symbol_size>>3); i++) { - chest_t_abs[arx][i] = (float) (chest_t[arx][4*i]*chest_t[arx][4*i]+chest_t[arx][4*i+1]*chest_t[arx][4*i+1]); + chest_t_abs[i] = SquaredNorm(chest_t[arx][i]); - if (chest_t_abs[arx][i] > ymax) - ymax = chest_t_abs[arx][i]; + if (chest_t_abs[i] > ymax) + ymax = chest_t_abs[i]; } - fl_add_xyplot_overlay(graph,arx,time,chest_t_abs[arx],(frame_parms->ofdm_symbol_size>>3),rx_antenna_colors[arx]); + fl_add_xyplot_overlay(graph,arx,time,chest_t_abs,(frame_parms->ofdm_symbol_size>>3),rx_antenna_colors[arx]); fl_set_xyplot_overlay_type(graph,arx,FL_DASHED_XYPLOT); } } @@ -577,7 +550,7 @@ static void uePbchFrequencyResp (FL_OBJECT *graph, PHY_VARS_NR_UE *phy_vars_ue, NR_DL_FRAME_PARMS *frame_parms = &phy_vars_ue->frame_parms; uint8_t nb_antennas_rx = frame_parms->nb_antennas_rx; uint8_t nb_antennas_tx = frame_parms->nb_antenna_ports_gNB; - int16_t **chest_f = (int16_t **) phy_vars_ue->pbch_vars[eNB_id]->dl_ch_estimates; + scopeSample_t **chest_f = (scopeSample_t **) phy_vars_ue->pbch_vars[eNB_id]->dl_ch_estimates; int ind = 0; float chest_f_abs[frame_parms->ofdm_symbol_size]; float freq[frame_parms->ofdm_symbol_size]; @@ -587,9 +560,7 @@ static void uePbchFrequencyResp (FL_OBJECT *graph, PHY_VARS_NR_UE *phy_vars_ue, if (chest_f[(atx<<1)+arx] != NULL) { for (int k=0; kofdm_symbol_size; k++) { freq[ind] = (float)ind; - float Re = (float)(chest_f[(atx<<1)+arx][6144+(2*k)]); - float Im = (float)(chest_f[(atx<<1)+arx][6144+(2*k)+1]); - chest_f_abs[ind] = (short)10*log10(1.0+((double)Re*Re + (double)Im*Im)); + chest_f_abs[ind] = (short)10*log10(1.0+SquaredNorm(chest_f[(atx<<1)+arx][6144+k])); ind++; } } @@ -610,7 +581,7 @@ static void uePbchLLR (FL_OBJECT *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_i return; int16_t *pbch_llr = (int16_t *) phy_vars_ue->pbch_vars[eNB_id]->llr; - float llr_pbch[1920], bit_pbch[1920]; + float llr_pbch[864], bit_pbch[864]; for (int i=0; i<864; i++) { llr_pbch[i] = (float) pbch_llr[i]; @@ -653,7 +624,6 @@ static void uePbchIQ (FL_OBJECT *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id } static void uePcchLLR (FL_OBJECT *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { - // PDCCH LLRs if (!phy_vars_ue->pdcch_vars[0][eNB_id]->llr) return; @@ -661,7 +631,7 @@ static void uePcchLLR (FL_OBJECT *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_i NR_DL_FRAME_PARMS *frame_parms = &phy_vars_ue->frame_parms; uint8_t nb_antennas_rx = frame_parms->nb_antennas_rx; uint8_t nb_antennas_tx = frame_parms->nb_antennas_tx; - int16_t **chest_f = (int16_t **) phy_vars_ue->pbch_vars[eNB_id]->dl_ch_estimates; + scopeSample_t **chest_f = (scopeSample_t **) phy_vars_ue->pbch_vars[eNB_id]->dl_ch_estimates; int ind = 0; float chest_f_abs[frame_parms->ofdm_symbol_size]; float freq[frame_parms->ofdm_symbol_size]; @@ -671,9 +641,7 @@ static void uePcchLLR (FL_OBJECT *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_i if (chest_f[(atx<<1)+arx] != NULL) { for (int k=0; kofdm_symbol_size; k++) { freq[ind] = (float)ind; - float Re = (float)(chest_f[(atx<<1)+arx][6144+(2*k)]); - float Im = (float)(chest_f[(atx<<1)+arx][6144+(2*k)+1]); - chest_f_abs[ind] = (short)10*log10(1.0+((double)Re*Re + (double)Im*Im)); + chest_f_abs[ind] = (short)10*log10(1.0+SquaredNorm(chest_f[(atx<<1)+arx][6144+k])); ind++; } } @@ -689,7 +657,6 @@ static void uePcchLLR (FL_OBJECT *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_i } static void uePcchIQ (FL_OBJECT *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { - // PDCCH I/Q of MF Output if (!phy_vars_ue->pdcch_vars[0][eNB_id]->rxdataF_comp[0]) return; @@ -836,7 +803,7 @@ static FD_phy_scope_t *create_phy_scope_nrue( int ID ) { fl_hide_object(fdui->button_0); fl_end_form( ); fdui->phy_scope->fdui = fdui; - char buf[100]; + char buf[100]; sprintf(buf,"NR DL SCOPE UE %d", ID); fl_show_form (fdui->phy_scope, FL_PLACE_HOTSPOT, FL_FULLBORDER, buf); return fdui; @@ -852,23 +819,55 @@ void phy_scope_nrUE(FD_phy_scope_t *form, form=remeberForm; else remeberForm=form; + if (form==NULL) return; + int i=0; while (form->graph[i].graph) { form->graph[i].nrUEfunct(form->graph[i].graph, phy_vars_ue, eNB_id, UE_id); i++; } - + fl_check_forms(); } +static FD_phy_scope_t *form_nrue[NUMBER_OF_UE_MAX]; +static pthread_t forms_thread; + +static void *nrUEscopeThread(void *arg) { + PHY_VARS_NR_UE *ue=(PHY_VARS_NR_UE *)arg; + size_t stksize; + pthread_attr_t atr; + pthread_attr_getstacksize(&atr, &stksize); + pthread_attr_setstacksize(&atr,32*1024*1024 ); + + while (!oai_exit) { + phy_scope_nrUE(form_nrue[0], + ue, + 0,0); + usleep(99*1000); + } + + pthread_exit((void *)arg); +} + +void nrUEinitScope(PHY_VARS_NR_UE *ue) { + int fl_argc=1; + char *name="5G-UE-scope"; + fl_initialize (&fl_argc, &name, NULL, 0, 0); + form_nrue[0] = create_phy_scope_nrue(0); + threadCreate(&forms_thread, nrUEscopeThread, ue, "scope", -1, OAI_PRIORITY_RT_LOW); +} + +// Kept to put back the functionality soon +#if 0 //FD_stats_form *form_stats=NULL,*form_stats_l2=NULL; //char title[255]; //static pthread_t forms_thread; //xforms static void reset_stats_gNB(FL_OBJECT *button, - long arg) { + long arg) { int i,k; //PHY_VARS_gNB *phy_vars_gNB = RC.gNB[0][0]; @@ -907,32 +906,7 @@ static FD_stats_form *create_form_stats_form(int ID) { fdui->stats_form->fdui = fdui; return fdui; } - -static FD_phy_scope_t *form_nrue[NUMBER_OF_UE_MAX]; -static pthread_t forms_thread; - -static void *scope_thread(void *arg) { - PHY_VARS_NR_UE *ue=(PHY_VARS_NR_UE *)arg; - - while (!oai_exit) { - phy_scope_nrUE(form_nrue[0], - ue, - 0,0); - sleep(100*1000); - } - - pthread_exit((void *)arg); -} - -void init_scope(PHY_VARS_NR_UE *ue) { - int fl_argc=1; - char *name="5G-UE-scope"; - fl_initialize (&fl_argc, &name, NULL, 0, 0); - form_nrue[0] = create_phy_scope_nrue(0); - threadCreate(&forms_thread, scope_thread, ue, "scope", -1, OAI_PRIORITY_RT_LOW); -} - - +#endif diff --git a/openair1/PHY/TOOLS/nr_phy_scope.h b/openair1/PHY/TOOLS/nr_phy_scope.h index 31353f180c..ff347f53bb 100644 --- a/openair1/PHY/TOOLS/nr_phy_scope.h +++ b/openair1/PHY/TOOLS/nr_phy_scope.h @@ -29,7 +29,6 @@ #include #include "common/ran_context.h" #include -#include #include "PHY/defs_gNB.h" //#include "PHY/defs_nrUE.h" //#include "PHY/impl_defs_top.h" @@ -38,12 +37,12 @@ typedef struct { int *argc; char **argv; - RU_t* ru; + RU_t *ru; PHY_VARS_gNB *gNB; } scopeParms_t; -void startScope(scopeParms_t * p); -void init_scope(PHY_VARS_NR_UE *ue); +void gNBinitScope(scopeParms_t *p); +void nrUEinitScope(PHY_VARS_NR_UE *ue); extern RAN_CONTEXT_t RC; #endif