Commit 2ab90d98 authored by lfarizav's avatar lfarizav

reducing time in do_UL_sig_PRACH

parent 8354cfc6
......@@ -188,7 +188,7 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
break;
}
printf("lte_parms.c: Setting N_RB_DL to %d, ofdm_symbol_size %d\n",frame_parms->N_RB_DL, frame_parms->ofdm_symbol_size);
//printf("lte_parms.c: Setting N_RB_DL to %d, ofdm_symbol_size %d\n",frame_parms->N_RB_DL, frame_parms->ofdm_symbol_size);
if (frame_parms->frame_type == TDD) set_S_config(frame_parms);
......
......@@ -786,7 +786,9 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
preamble_offset,preamble_shift);
#endif
LOG_D(PHY,"Generate PRACH for RootSeqIndex %d, Preamble Index %d, NCS %d (NCS_config %d, N_ZC/NCS %d) n_ra_prb %d: Preamble_offset %d, Preamble_shift %d\n",
rootSequenceIndex,preamble_index,NCS,Ncs_config,N_ZC/NCS,n_ra_prb,
preamble_offset,preamble_shift);
// nsymb = (frame_parms->Ncp==0) ? 14:12;
// subframe_offset = (unsigned int)frame_parms->ofdm_symbol_size*subframe*nsymb;
......
......@@ -61,7 +61,7 @@ void print_meas_now(time_stats_t *ts, const char* name, FILE* file_name){
void print_meas(time_stats_t *ts, const char* name, time_stats_t * total_exec_time, time_stats_t * sf_exec_time)
{
//printf("ts->trials is %d\n",ts->trials);
if (opp_enabled) {
static int first_time = 0;
......@@ -81,7 +81,7 @@ void print_meas(time_stats_t *ts, const char* name, time_stats_t * total_exec_ti
if (ts->trials>0) {
//printf("%20s: total: %10.3f ms, average: %10.3f us (%10d trials)\n", name, ts->diff/cpu_freq_GHz/1000000.0, ts->diff/ts->trials/cpu_freq_GHz/1000.0, ts->trials);
//printf("ts->trials>0 is %d\n",ts->trials);
if ((total_exec_time == NULL) || (sf_exec_time== NULL)) {
fprintf(stderr, "%25s: %15.3f ms ; %15.3f us; %15d;\n",
name,
......
......@@ -1174,6 +1174,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
int do_meas,
int do_pdcch_flag)
{
UNUSED(rn);
int frame=proc->frame_tx;
int subframe=proc->subframe_tx;
......@@ -1534,7 +1535,6 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_TX+offset,0);
if (do_meas==1) stop_meas(&eNB->phy_proc_tx);
}
void process_Msg3(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,uint8_t UE_id, uint8_t harq_pid)
......
......@@ -2405,7 +2405,17 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
}
void phy_procedures_UE_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,runmode_t mode,relaying_type_t r_type) {
/*static int first_run=0;
static double sum;
static int count;
if (!first_run)
{
first_run=1;
sum=0;
count=0;
}
count++;
clock_t start=clock();*/
LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms;
//int32_t ulsch_start=0;
......@@ -2582,6 +2592,9 @@ void phy_procedures_UE_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,ui
#if UE_TIMING_TRACE
stop_meas(&ue->phy_proc_tx);
#endif
/*clock_t stop=clock();
printf("UE_TX time is %f s, AVERAGE UE_TX time is %f s, frame %d, subframe %d, count %d, sum %e\n",(float) (stop-start)/CLOCKS_PER_SEC,(float) (sum+stop-start)/(count*CLOCKS_PER_SEC),frame_tx,subframe_tx,count,sum+stop-start);
sum=(sum+stop-start);*/
}
void phy_procedures_UE_S_TX(PHY_VARS_UE *ue,uint8_t eNB_id,uint8_t abstraction_flag,relaying_type_t r_type)
......@@ -5082,6 +5095,18 @@ int phy_procedures_slot_parallelization_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *pr
int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,
uint8_t abstraction_flag,uint8_t do_pdcch_flag,runmode_t mode,
relaying_type_t r_type,PHY_VARS_RN *phy_vars_rn) {
/*static int first_run=0;
static double sum;
static int count;
if (!first_run)
{
first_run=1;
sum=0;
count=0;
}
count++;
clock_t start=clock();*/
int l,l2;
int pilot1;
......@@ -5593,6 +5618,11 @@ else
#endif
LOG_D(PHY," ****** end RX-Chain for AbsSubframe %d.%d ****** \n", frame_rx%1024, subframe_rx);
/*clock_t stop=clock();
printf("UE_RX time is %f s, AVERAGE UE_RX time is %f s, frame %d, subframe %d, count %d, sum %e\n",(float) (stop-start)/CLOCKS_PER_SEC,(float) (sum+stop-start)/(count*CLOCKS_PER_SEC),frame_rx,subframe_rx,count,sum+stop-start);
sum=(sum+stop-start);*/
return (0);
}
......
......@@ -139,7 +139,7 @@ int freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
return(0);
}
int init_freq_channel_prach(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples,int16_t prach_fmt,int16_t prach_prb_offset)
int init_freq_channel_prach(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples,int16_t prach_fmt,int16_t n_ra_prb)
{
......@@ -153,8 +153,8 @@ int init_freq_channel_prach(channel_desc_t *desc,uint16_t nb_rb,int16_t n_sample
fprintf(stderr, "freq_channel_init: n_samples has to be odd\n");
return(-1);
}
if (nb_rb-prach_prb_offset<6) {
fprintf(stderr, "freq_channel_init: Impossible to allocate PRACH, check prach_prb_offset value (r_ra_prb=%d)\n",prach_prb_offset);
if (nb_rb-n_ra_prb<6) {
fprintf(stderr, "freq_channel_init: Impossible to allocate PRACH, check n_ra_prb value (r_ra_prb=%d)\n",n_ra_prb);
return(-1);
}
prach_samples = (prach_fmt<4)?13+839+12:3+139+2;
......@@ -164,7 +164,7 @@ int init_freq_channel_prach(channel_desc_t *desc,uint16_t nb_rb,int16_t n_sample
delta_f = (prach_fmt<4)?nb_rb*180000/((n_samples-1)*12):nb_rb*180000/((n_samples-1)*2);//1.25 khz for preamble format 1,2,3. 7.5 khz for preample format 4
max_nb_rb_samples = nb_rb*180000/delta_f;//7200 if prach_fmt<4
prach_pbr_offset_samples = (prach_prb_offset+6)*180000/delta_f;//864 if prach_prb_offset=0,7200 if prach_prb_offset=44=50-6
prach_pbr_offset_samples = (n_ra_prb+6)*180000/delta_f;//864 if n_ra_prb=0,7200 if n_ra_prb=44=50-6
//printf("prach_samples = %d, delta_f = %e, max_nb_rb_samples= %d, prach_pbr_offset_samples = %d, nb_taps = %d\n",prach_samples,delta_f,max_nb_rb_samples,prach_pbr_offset_samples,desc->nb_taps);
for (f=max_nb_rb_samples/2-prach_pbr_offset_samples,f1=0; f<max_nb_rb_samples/2-prach_pbr_offset_samples+prach_samples; f++,f1++) {//3600-864,3600-864+864|3600-7200,3600-7200+839
freq=delta_f*(double)f*1e-6;// due to the fact that delays is in mus
......@@ -188,10 +188,9 @@ int init_freq_channel_prach(channel_desc_t *desc,uint16_t nb_rb,int16_t n_sample
return(0);
}
int freq_channel_prach(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples,int16_t prach_fmt,int16_t prach_prb_offset)
int freq_channel_prach(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples,int16_t prach_fmt,int16_t n_ra_prb)
{
int16_t f;
uint8_t aarx,aatx,l;
double *clut,*slut;
......@@ -207,15 +206,15 @@ int freq_channel_prach(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples,int
fprintf(stderr, "freq_channel: n_samples has to be odd\n");
return(-1);
}
if (nb_rb-prach_prb_offset<6) {
fprintf(stderr, "freq_channel_init: Impossible to allocate PRACH, check r_ra_prb value (r_ra_prb=%d)\n",prach_prb_offset);
if (nb_rb-n_ra_prb<6) {
fprintf(stderr, "freq_channel_init: Impossible to allocate PRACH, check r_ra_prb value (r_ra_prb=%d)\n",n_ra_prb);
return(-1);
}
if (freq_channel_init == 0) {
// we are initializing the lut for the largets possible n_samples=12*nb_rb+1
// if called with n_samples<12*nb_rb+1, we decimate the lut
n_samples_max=12*nb_rb+1;
if (init_freq_channel_prach(desc,nb_rb,n_samples_max,prach_fmt,prach_prb_offset)==0)
if (init_freq_channel_prach(desc,nb_rb,n_samples_max,prach_fmt,n_ra_prb)==0)
freq_channel_init=1;
else
return(-1);
......
......@@ -307,13 +307,12 @@ void multipath_channel_prach(channel_desc_t *desc,
double *tx_sig_im[2],
double *rx_sig_re[2],
double *rx_sig_im[2],
LTE_DL_FRAME_PARMS* const fp,
uint32_t length,
uint8_t keep_channel,
uint8_t eNB_id,
uint8_t UE_id,
uint8_t CC_id,
uint8_t th_id,
uint8_t subframe);
uint8_t prach_fmt,
uint8_t n_ra_prb);
/*
\fn double compute_pbch_sinr(channel_desc_t *desc,
channel_desc_t *desc_i1,
......@@ -426,9 +425,9 @@ double gaussdouble(double,double);
void randominit(unsigned int seed_init);
double uniformrandom(void);
int freq_channel(channel_desc_t *desc,uint16_t nb_rb, int16_t n_samples);
int freq_channel_prach(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples,int16_t prach_fmt,int16_t prach_prb_offset);
int freq_channel_prach(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples,int16_t prach_fmt,int16_t n_ra_prb);
int init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples);
int init_freq_channel_prach(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples,int16_t prach_fmt,int16_t prach_prb_offset);
int init_freq_channel_prach(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples,int16_t prach_fmt,int16_t n_ra_prb);
uint8_t multipath_channel_nosigconv(channel_desc_t *desc);
void multipath_tv_channel(channel_desc_t *desc,
double **tx_sig_re,
......
......@@ -151,6 +151,17 @@ void multipath_channel(channel_desc_t *desc,
uint32_t length,
uint8_t keep_channel)
{
/*static int first_run=0;
static double sum;
static int count;
if (!first_run)
{
first_run=1;
sum=0;
count=0;
}
count++;
clock_t start=clock();*/
int i,ii,j,l;
struct complex rx_tmp,tx;
......@@ -166,7 +177,20 @@ void multipath_channel(channel_desc_t *desc,
if (keep_channel) {
// do nothing - keep channel
} else {
random_channel(desc,0);
/*if (!first_run)
{
first_run=1;
sum=0;
count=0;
}
count++;
clock_t start=clock();*/
random_channel(desc,0);//Find a(l)
/*clock_t stop=clock();
printf("UE_freq_channel time is %f s, AVERAGE time is %f s, count %d, sum %e\n",(float) (stop-start)/CLOCKS_PER_SEC,(float) (sum+stop-start)/(count*CLOCKS_PER_SEC),count,sum+stop-start);
sum=(sum+stop-start);*/
}
#ifdef DEBUG_CH
......@@ -210,6 +234,9 @@ void multipath_channel(channel_desc_t *desc,
} // ii
} // i
/*clock_t stop=clock();
printf("UE_channel time is %f s, AVERAGE time is %f s, count %d, sum %e\n",(float) (stop-start)/CLOCKS_PER_SEC,(float) (sum+stop-start)/(count*CLOCKS_PER_SEC),count,sum+stop-start);
sum=(sum+stop-start);*/
}
#endif
void multipath_channel_freq(channel_desc_t *desc,
......@@ -224,6 +251,17 @@ void multipath_channel_freq(channel_desc_t *desc,
uint8_t CC_id,
uint8_t th_id)
{
/*static int first_run=0;
static double sum;
static int count;
if (!first_run)
{
first_run=1;
sum=0;
count=0;
}
count++;*/
int ii,j,k,f,f2;
struct complex rx_tmp;
......@@ -249,10 +287,16 @@ void multipath_channel_freq(channel_desc_t *desc,
if (keep_channel) {
// do nothing - keep channel
} else {
random_channel(desc,0);//Find a(l)
/*clock_t stop=clock();
printf("UE_freq_channel time is %f s, AVERAGE time is %f s, count %d, sum %e\n",(float) (stop-start)/CLOCKS_PER_SEC,(float) (sum+stop-start)/(count*CLOCKS_PER_SEC),count,sum+stop-start);
sum=(sum+stop-start);*/
freq_channel(desc,nb_rb,n_samples);//Find desc->chF
//freq_channel_prach(desc,nb_rb,n_samples,1,44);//Find desc->chF
}
//clock_t start=clock();
for (k=0;k<symbols_per_tti;k++){//k = 0-13 normal cyclic prefix
f2 = 0;
for (f=0;f<ofdm_symbol_size; f++) {//f2 = 0-1023 for 10 Mhz BW
......@@ -300,7 +344,10 @@ void multipath_channel_freq(channel_desc_t *desc,
} // ii
} // f,f2,f3
}//k
//fclose(file);
/*clock_t stop=clock();
printf("UE_freq_channel time is %f s, AVERAGE time is %f s, count %d, sum %e\n",(float) (stop-start)/CLOCKS_PER_SEC,(float) (sum+stop-start)/(count*CLOCKS_PER_SEC),count,sum+stop-start);
sum=(sum+stop-start);*/
//fclose(file);
}
void multipath_channel_freq_test(channel_desc_t *desc,
double *tx_sig_re[2],
......@@ -345,20 +392,16 @@ void multipath_channel_prach(channel_desc_t *desc,
double *tx_sig_im[2],
double *rx_sig_re[2],
double *rx_sig_im[2],
LTE_DL_FRAME_PARMS* const fp,
uint32_t length,
uint8_t keep_channel,
uint8_t eNB_id,
uint8_t UE_id,
uint8_t CC_id,
uint8_t th_id,
uint8_t subframe)
uint8_t prach_fmt,
uint8_t n_ra_prb)
{
LTE_DL_FRAME_PARMS* const fp = &PHY_vars_UE_g[UE_id][CC_id]->frame_parms;
int prach_samples;
lte_frame_type_t frame_type = PHY_vars_UE_g[UE_id][CC_id]->frame_parms.frame_type;
uint8_t prach_ConfigIndex = PHY_vars_UE_g[UE_id][CC_id]->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
uint8_t prach_fmt = get_prach_fmt(prach_ConfigIndex,frame_type);
int n_ra_prb;
int ii,j,f;
struct complex rx_tmp;
double delta_f;
......@@ -366,7 +409,6 @@ void multipath_channel_prach(channel_desc_t *desc,
double path_loss = pow(10,desc->path_loss_dB/20);
int nb_rb, n_samples, ofdm_symbol_size, symbols_per_tti;
n_ra_prb = get_prach_prb_offset(fp, PHY_vars_UE_g[UE_id][CC_id]->prach_resources[eNB_id]->ra_TDD_map_index, PHY_vars_UE_g[UE_id][CC_id]->proc.proc_rxtx[th_id].frame_tx);
nb_rb=fp->N_RB_DL;
n_samples=fp->N_RB_DL*12+1;
ofdm_symbol_size=fp->ofdm_symbol_size;
......
......@@ -253,6 +253,9 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
int32_t channel_offset,
double path_loss_dB)
{
/*static int first_run=0;
static double sum;
static int count;*/
channel_desc_t *chan_desc = (channel_desc_t *)malloc(sizeof(channel_desc_t));
uint16_t i,j;
......@@ -915,6 +918,17 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
break;
case AWGN:
/*if (!first_run)
{
first_run=1;
sum=0;
count=0;
}
count++;
clock_t start=clock();*/
nb_taps = 1;
Td = 0;
channel_length = 1;
......@@ -939,8 +953,10 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
channel_offset,
path_loss_dB,
0);
printf("AWGN: ricean_factor %f\n",chan_desc->ricean_factor);
/*printf("AWGN: ricean_factor %f\n",chan_desc->ricean_factor);
clock_t stop=clock();
printf("fill_chan_desc AWGN time is %f s, AVERAGE time is %f s, count %d, sum %e\n",(float) (stop-start)/CLOCKS_PER_SEC,(float) (sum+stop-start)/(count*CLOCKS_PER_SEC),count,sum+stop-start);
sum=(sum+stop-start);*/
break;
case TS_SHIFT:
......
......@@ -183,7 +183,7 @@ ue_process_rar(
return(0xffff);
}
LOG_I(MAC,"[eNB %d][RAPROC] Frame %d Received RAR (%02x|%02x.%02x.%02x.%02x.%02x.%02x) for preamble %d/%d\n",module_idP,frameP,
LOG_I(MAC,"[UE %d][RAPROC] Frame %d Received RAR (%02x|%02x.%02x.%02x.%02x.%02x.%02x) for preamble %d/%d\n",module_idP,frameP,
*(uint8_t*)rarh,rar[0],rar[1],rar[2],rar[3],rar[4],rar[5],
rarh->RAPID,preamble_index);
#ifdef DEBUG_RAR
......
......@@ -139,7 +139,7 @@ eNBs =
////////// MME parameters:
mme_ip_address = ( { ipv4 = "172.24.10.185";
mme_ip_address = ( { ipv4 = "172.24.11.18";
ipv6 = "192:168:30::17";
active = "yes";
preference = "ipv4";
......
......@@ -1221,7 +1221,6 @@ void *UE_thread_freq(void *arg) {
}
if (UE->mode != loop_through_memory)
{
printf("[ue_thread] UE->mode != loop_through_memory: %d\n",UE->mode != loop_through_memory);
AssertFatal( UE->frame_parms.ofdm_symbol_size*UE->frame_parms.symbols_per_tti*10 ==
UE->rfdevice.trx_read_func(&UE->rfdevice,
&timestamp,
......@@ -1243,7 +1242,6 @@ void *UE_thread_freq(void *arg) {
(void)dummy_rx; /* avoid gcc warnings */
usleep(500);
#else
printf("[ue_thread] is_synchronized == 0 and instance_cnt_synch == %d\n",instance_cnt_synch);
// grab 10 ms of signal into dummy buffer
if (UE->mode != loop_through_memory) {
for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++)
......
......@@ -419,8 +419,8 @@ void do_DL_sig_freq(channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][
r_re0_f[1] = r_re01_f;
r_im0_f[1] = r_im01_f;
FILE *file1;
file1 = fopen("chsim_chF.m","w");
//FILE *file1;
//file1 = fopen("chsim_chF.m","w");
//printf("chsim thread %d. ue->proc->frame_rx %d, ue->subframe_rx %d, ue->proc->frame_tx %d, ue->subframe_tx %d\n",subframe&0x1,PHY_vars_UE_g[0][0]->proc.proc_rxtx[subframe&0x1].frame_rx,PHY_vars_UE_g[0][0]->proc.proc_rxtx[subframe&0x1].subframe_rx,PHY_vars_UE_g[0][0]->proc.proc_rxtx[subframe&0x1].frame_tx,PHY_vars_UE_g[0][0]->proc.proc_rxtx[subframe&0x1].subframe_tx);
......@@ -809,7 +809,6 @@ void do_UL_sig(channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX][MAX_N
#endif
} // abstraction_flag==0
}
void do_UL_sig_freq(channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX][MAX_NUM_CCs],
node_desc_t *enb_data[NUMBER_OF_eNB_MAX],node_desc_t *ue_data[NUMBER_OF_UE_MAX],
......@@ -831,8 +830,8 @@ void do_UL_sig_freq(channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX][
uint32_t sf_offset;
uint8_t hold_channel=0;
FILE *file1;
file1 = fopen("chsim_chF_UL.m","w");
//FILE *file1;
//file1 = fopen("chsim_chF_UL.m","w");
#ifdef PHY_ABSTRACTION_UL
double min_path_loss=-200;
......@@ -1054,7 +1053,18 @@ void do_UL_prach(channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX][MAX
uint16_t subframe,uint8_t abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms,
uint32_t frame,int eNB_id,uint8_t CC_id)
{
//int32_t **txdata,**txdataF,**rxdata,**rxdataF;
static int first_run=0;
static double sum;
static int count;
if (!first_run)
{
first_run=1;
sum=0;
count=0;
}
count++;
#ifdef PHY_ABSTRACTION_UL
int32_t att_eNB_id=-1;
#endif
......@@ -1126,15 +1136,13 @@ void do_UL_prach(channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX][MAX
pthread_mutex_unlock(&UE_output_mutex[eNB_id]);
for (int i=0;i<NB_UE_INST;i++)
printf("UE %d, PRACH TDD Resource index %d\n",i,PHY_vars_UE_g[0][CC_id]->prach_resources[eNB_id]->ra_TDD_map_index);
// Compute RX signal for eNB = eNB_id
for (UE_id=0; UE_id<NB_UE_INST; UE_id++) {
lte_frame_type_t frame_type = PHY_vars_UE_g[UE_id][CC_id]->frame_parms.frame_type;
prach_ConfigIndex = PHY_vars_UE_g[UE_id][CC_id]->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
prach_fmt = get_prach_fmt(prach_ConfigIndex,frame_type);
//printf("UE[%d], ra_TDD_map_index %d\n",UE_id,PHY_vars_UE_g[UE_id][CC_id]->prach_resources[eNB_id]->ra_TDD_map_index);
n_ra_prb = get_prach_prb_offset(frame_parms, PHY_vars_UE_g[0][CC_id]->prach_resources[eNB_id]->ra_TDD_map_index, PHY_vars_UE_g[UE_id][CC_id]->proc.proc_rxtx[subframe&0x1].frame_tx);
n_ra_prb = get_prach_prb_offset(frame_parms, PHY_vars_UE_g[UE_id][CC_id]->prach_resources[eNB_id]->ra_TDD_map_index, PHY_vars_UE_g[UE_id][CC_id]->proc.proc_rxtx[subframe&0x1].frame_tx);
tx_prachF = PHY_vars_UE_g[UE_id][CC_id]->prach_vars[eNB_id]->prachF;
//write_output("txprachF.m","prach_txF", PHY_vars_UE_g[0][0]->prach_vars[0]->prachF,frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti*12,1,1);
......@@ -1158,7 +1166,7 @@ void do_UL_prach(channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX][MAX
//printf("multipath_channel_prach, UE too weak %e\n", ((double)PHY_vars_UE_g[UE_id][CC_id]->tx_power_dBm[subframe] +
//UE2eNB[UE_id][eNB_id][CC_id]->path_loss_dB));
} else {
printf("multipath_channel_prach\n");
tx_pwr = dac_fixed_gain_prach((double**)s_re_f_prach,
(double**)s_im_f_prach,
(int *)tx_prachF,
......@@ -1180,9 +1188,12 @@ void do_UL_prach(channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX][MAX
PHY_vars_UE_g[UE_id][CC_id]->tx_total_RE[subframe],
subframe,sf_offset);
// write_output("s_re_f_prach.m","s_re_f_prach_txF", s_re_f_prach,frame_parms->ofdm_symbol_size*12,1,1);
multipath_channel_prach(UE2eNB[UE_id][eNB_id][CC_id],s_re_f_prach,s_im_f_prach,r_re0_f_prach,r_im0_f_prach,
frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti*12,hold_channel,eNB_id,UE_id,CC_id,subframe&0x1,subframe);
multipath_channel_prach(UE2eNB[UE_id][eNB_id][CC_id],s_re_f_prach,s_im_f_prach,r_re0_f_prach,r_im0_f_prach,&PHY_vars_UE_g[UE_id][CC_id]->frame_parms,
frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti*12,hold_channel,eNB_id,prach_fmt,n_ra_prb);
//for (int idx=0;idx<10;idx++) printf("dumping raw PRACH UL tx subframe (output) %d: r_f[%d] = (%f,%f)\n", subframe, idx, r_re0_f_prach[0][idx],r_im0_f_prach[0][idx]);
//for (int idx=829;idx<839;idx++) printf("dumping raw PRACH UL tx subframe (output) %d: r_f[%d] = (%f,%f)\n", subframe, idx, r_re0_f_prach[0][idx],r_im0_f_prach[0][idx]);
//write_output("txprachF.m","prach_txF", PHY_vars_UE_g[0][0]->prach_vars[0]->prachF,frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti,1,1);
......@@ -1222,14 +1233,17 @@ void do_UL_prach(channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX][MAX
double *r_im_p_f_prach[2] = {r_im_UL_f_prach[eNB_id][0],r_im_UL_f_prach[eNB_id][1]};
/*for (int idx=0;idx<10;idx++) printf("dumping raw PRACH UL tx subframe (output) %d: r_re_im_p_f_prach[%d] = (%d,%d)\n", subframe, idx, (short)(r_re_p_f_prach[0][idx]),(short)(r_im_p_f_prach[0][idx]));
for (int idx=829;idx<839;idx++) printf("dumping raw PRACH UL tx subframe (output) %d: r_re_im_p_f_prach[%d] = (%d,%d)\n", subframe, idx, (short)(r_re_p_f_prach[0][idx]),(short)(r_im_p_f_prach[0][idx]));*/
clock_t start=clock();
rf_rx_simple(r_re_p_f_prach,
r_im_p_f_prach,
nb_antennas_rx,
frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti*12,
(prach_fmt<4)?839:139,
1e3/UE2eNB[0][eNB_id][CC_id]->sampling_rate, // sampling time (ns)
(double)PHY_vars_eNB_g[eNB_id][CC_id]->rx_total_gain_dB - 66.227); // rx_gain (dB) (66.227 = 20*log10(pow2(11)) = gain from the adc that will be applied later)
clock_t stop=clock();
printf("UE_PRACH_channel time is %f s, AVERAGE time is %f s, count %d, sum %e, subframe %d\n",(float) (stop-start)/CLOCKS_PER_SEC,(float) (sum+stop-start)/(count*CLOCKS_PER_SEC),count,sum+stop-start,subframe);
sum=(sum+stop-start);
#ifdef DEBUG_SIM
rx_pwr = signal_energy_fp(r_re_p_f_prach,r_im_p_f_prach,nb_antennas_rx,frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti*12,0)*(double)frame_parms->ofdm_symbol_size/(12.0*frame_parms->N_RB_DL);
......@@ -1238,6 +1252,7 @@ void do_UL_prach(channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX][MAX
#endif
rx_prachF = PHY_vars_eNB_g[eNB_id][CC_id]->prach_vars.rxsigF;
sf_offset = pointer_firstvalue_PRACH;
adc_prach(r_re_p_f_prach,
r_im_p_f_prach,
0,
......@@ -1246,6 +1261,7 @@ void do_UL_prach(channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX][MAX
nb_antennas_rx,
(prach_fmt<4)?839:139,
12);
//write_output("chsim_rxsigF.m","chsim_rx_sigF", PHY_vars_eNB_g[eNB_id][CC_id]->prach_vars.rxsigF[0],4*frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti,1,16);
#ifdef DEBUG_SIM
......@@ -1259,7 +1275,6 @@ void do_UL_prach(channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX][MAX
#endif
} // abstraction_flag==0
}
void init_channel_vars(LTE_DL_FRAME_PARMS *frame_parms, double ***s_re,double ***s_im,double ***r_re,double ***r_im,double ***r_re0,double ***r_im0)
......
......@@ -1041,6 +1041,20 @@ extern int subframe_eNB_mask,subframe_UE_mask;
int eNB_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int cc)
{
/*time_stats_t ul_chan_stats_f;
static int first_meas=0;*/
static int first_run=0;
static double sum;
static int count;
if (!first_run)
{
first_run=1;
sum=0;
count=0;
}
count++;
int ret = nsamps;
int eNB_id = device->Mod_id;
int CC_id = device->CC_id;
......@@ -1118,11 +1132,27 @@ int eNB_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void *
eNB_id,
CC_id);
//write_output("txprachF.m","prach_txF", PHY_vars_UE_g[0][CC_id]->prach_vars[0]->prachF,12*frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti,1,16);
//generate_prach(PHY_vars_UE_g[0][0],eNB_id,subframe,frame);
//PHY_vars_UE_g[0][0]->generate_prach=1;
break;
}
}
//// oai performance profiler is disabled, opp=0. Use ./oaisim -q option
/*if (!first_meas || ul_chan_stats_f.trials<0)
{
printf("first_meas %d\n",first_meas);
reset_meas(&ul_chan_stats_f);
first_meas=1;
}
printf("trials %d, diff %d, diff_now %d, p_time %d diff_square %d, max %d, meas_flag %d\n",(int)ul_chan_stats_f.trials,
(int)ul_chan_stats_f.diff,
(int)ul_chan_stats_f.diff_now,
(int)ul_chan_stats_f.p_time,
(int)ul_chan_stats_f.diff_square,
(int)ul_chan_stats_f.max,
(int)ul_chan_stats_f.meas_flag);
start_meas(&ul_chan_stats_f);*/
do_UL_sig_freq(UE2eNB,
enb_data,
......@@ -1133,9 +1163,14 @@ int eNB_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void *
0, // frame is only used for abstraction
eNB_id,
CC_id);
/*stop_meas(&ul_chan_stats_f);
print_meas(&ul_chan_stats_f,"UL_Channel Stats Frequency Domain",&ul_chan_stats_f,&ul_chan_stats_f);*/
}
else
{
//clock_t start=clock();
do_UL_sig(UE2eNB,
enb_data,
ue_data,
......@@ -1145,6 +1180,9 @@ int eNB_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void *
0, // frame is only used for abstraction
eNB_id,
CC_id);
/*clock_t stop=clock();
printf("do_UL_sig time is %f s, AVERAGE time is %f s, count %d, sum %e\n",(float) (stop-start)/CLOCKS_PER_SEC,(float) (sum+stop-start)/(count*CLOCKS_PER_SEC),count,sum+stop-start);
sum=(sum+stop-start);*/
//if (is_prach_subframe(frame_parms,frame,subframe))
//write_output("txprachF.m","prach_txF", PHY_vars_UE_g[0][CC_id]->prach_vars[0]->prachF,12*frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti,1,16);
}
......@@ -1160,6 +1198,7 @@ int eNB_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void *
int UE_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int cc)
{
time_stats_t dl_chan_stats_f;
int ret = nsamps;
int UE_id = device->Mod_id;
int CC_id = device->CC_id;
......@@ -1224,6 +1263,8 @@ int UE_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void **
subframe,(unsigned long long)*ptimestamp,
(unsigned long long)current_UE_rx_timestamp[UE_id][CC_id]);
if (do_ofdm_mod)
{
start_meas(&dl_chan_stats_f);
do_DL_sig_freq(eNB2UE,
enb_data,
ue_data,
......@@ -1232,7 +1273,11 @@ int UE_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void **
&PHY_vars_UE_g[UE_id][CC_id]->frame_parms,
UE_id,
CC_id);
stop_meas(&dl_chan_stats_f);
print_meas(&dl_chan_stats_f,"DL_Channel Stats Frequency Domain",&dl_chan_stats_f,&dl_chan_stats_f);
}
else
{
do_DL_sig(eNB2UE,
enb_data,
ue_data,
......@@ -1241,6 +1286,7 @@ int UE_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void **
&PHY_vars_UE_g[UE_id][CC_id]->frame_parms,
UE_id,
CC_id);
}
last_UE_rx_timestamp[UE_id][CC_id] = last;
}
......
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