Commit 5720d7f5 authored by lfarizav's avatar lfarizav

New random_channel_freq function.

parent e4f9becc
......@@ -37,7 +37,7 @@ static double **cos_lut=NULL,**sin_lut=NULL;
//#if 1
//#define abstraction_SSE
#ifdef abstraction_SSE//abstraction_SSE is not working.
/*#ifdef abstraction_SSE//abstraction_SSE is not working.
int init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
{
......@@ -116,7 +116,7 @@ int init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
}
return(0);
}
#else
#else*/
int init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
{
......@@ -162,7 +162,6 @@ int init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
//printf("count %d\n",count);
return(0);
}
#endif
#ifdef abstraction_SSE
int freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
{
......@@ -290,7 +289,7 @@ int 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 n_ra_prb)
{
static int first_run=1;
double delta_f,freq; // 90 kHz spacing
double delay;
int16_t f,f1;
......@@ -306,9 +305,19 @@ int init_freq_channel_prach(channel_desc_t *desc,uint16_t nb_rb,int16_t n_sample
return(-1);
}
prach_samples = (prach_fmt<4)?13+839+12:3+139+2;
cos_lut = (double **)malloc(prach_samples*sizeof(double*));
sin_lut = (double **)malloc(prach_samples*sizeof(double*));
if (first_run)
{
cos_lut = (double **)malloc16(prach_samples*sizeof(double*));
sin_lut = (double **)malloc16(prach_samples*sizeof(double*));
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++) {
cos_lut[f1] = (double *)malloc16_clear((int)desc->nb_taps*sizeof(double));
sin_lut[f1] = (double *)malloc16_clear((int)desc->nb_taps*sizeof(double));
}
first_run=0;
}
//cos_lut = (double **)malloc(prach_samples*sizeof(double*));
//sin_lut = (double **)malloc(prach_samples*sizeof(double*));
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
......@@ -317,8 +326,8 @@ int init_freq_channel_prach(channel_desc_t *desc,uint16_t nb_rb,int16_t n_sample
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
//printf("[init_freq_channel_prach] freq %e\n",freq);
cos_lut[f1] = (double *)malloc((int)desc->nb_taps*sizeof(double));
sin_lut[f1] = (double *)malloc((int)desc->nb_taps*sizeof(double));
//cos_lut[f1] = (double *)malloc((int)desc->nb_taps*sizeof(double));
//sin_lut[f1] = (double *)malloc((int)desc->nb_taps*sizeof(double));
for (l=0; l<(int)desc->nb_taps; l++) {
......@@ -336,6 +345,7 @@ int init_freq_channel_prach(channel_desc_t *desc,uint16_t nb_rb,int16_t n_sample
return(0);
}
#ifdef abstraction_SSE
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)
{
......@@ -345,6 +355,7 @@ int freq_channel_prach(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples,int
int prach_samples;
static int freq_channel_init=0;
static int n_samples_max=0;
__m128d clut128,slut128,chFx_128,chFy_128;
prach_samples = (prach_fmt<4)?13+839+12:3+139+2;
......@@ -363,7 +374,64 @@ int freq_channel_prach(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples,int
return(-1);
}
start_meas(&desc->interp_freq);
start_meas(&desc->interp_freq_PRACH);
for (f=0; f<(prach_samples>>1); f++) {
//clut = cos_lut[f];
//slut = sin_lut[f];
for (aarx=0; aarx<desc->nb_rx; aarx++) {
for (aatx=0; aatx<desc->nb_tx; aatx++) {
//desc->chF_prach[aarx+(aatx*desc->nb_rx)][f].x=0.0;
//desc->chF_prach[aarx+(aatx*desc->nb_rx)][f].y=0.0;
chFx_128=_mm_setzero_pd();
chFy_128=_mm_setzero_pd();
for (l=0; l<(int)desc->nb_taps; l++) {
//desc->chF_prach[aarx+(aatx*desc->nb_rx)][f].x+=(desc->a[l][aarx+(aatx*desc->nb_rx)].x*clut[l]+
// desc->a[l][aarx+(aatx*desc->nb_rx)].y*slut[l]);
//desc->chF_prach[aarx+(aatx*desc->nb_rx)][f].y+=(-desc->a[l][aarx+(aatx*desc->nb_rx)].x*slut[l]+
// desc->a[l][aarx+(aatx*desc->nb_rx)].y*clut[l]);
chFx_128=_mm_add_pd(chFx_128,_mm_add_pd(_mm_mul_pd(_mm_set1_pd(desc->a[l][aarx+(aatx*desc->nb_rx)].x),_mm_loadu_pd(&cos_lut[2*f][l])),_mm_mul_pd(_mm_set1_pd(desc->a[l][aarx+(aatx*desc->nb_rx)].y),_mm_loadu_pd(&sin_lut[2*f][l]))));
chFy_128=_mm_add_pd(chFy_128,_mm_sub_pd(_mm_mul_pd(_mm_set1_pd(desc->a[l][aarx+(aatx*desc->nb_rx)].y),_mm_loadu_pd(&cos_lut[2*f][l])),_mm_mul_pd(_mm_set1_pd(desc->a[l][aarx+(aatx*desc->nb_rx)].x),_mm_loadu_pd(&sin_lut[2*f][l]))));
}
_mm_storeu_pd(&desc->chF_prach[aarx+(aatx*desc->nb_rx)][2*f].x,chFx_128);
_mm_storeu_pd(&desc->chF_prach[aarx+(aatx*desc->nb_rx)][2*f].y,chFy_128);
}
}
//if (f<10 || (f>829&&f<839))
// printf("chF_prach[0][%d], (x,y) = (%e,%e)\n",f,desc->chF_prach[0][f].x,desc->chF_prach[0][f].y);
}
stop_meas(&desc->interp_freq_PRACH);
return(0);
}
#else
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;
int prach_samples;
static int freq_channel_init=0;
static int n_samples_max=0;
prach_samples = (prach_fmt<4)?13+839+12:3+139+2;
// do some error checking
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,n_ra_prb)==0)
freq_channel_init=1;
else
return(-1);
}
start_meas(&desc->interp_freq_PRACH);
for (f=0; f<prach_samples; f++) {
clut = cos_lut[f];
slut = sin_lut[f];
......@@ -383,10 +451,10 @@ int freq_channel_prach(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples,int
//if (f<10 || (f>829&&f<839))
// printf("chF_prach[0][%d], (x,y) = (%e,%e)\n",f,desc->chF_prach[0][f].x,desc->chF_prach[0][f].y);
}
stop_meas(&desc->interp_freq);
stop_meas(&desc->interp_freq_PRACH);
return(0);
}
#endif
double compute_pbch_sinr(channel_desc_t *desc,
channel_desc_t *desc_i1,
channel_desc_t *desc_i2,
......
......@@ -93,6 +93,7 @@ typedef struct {
time_stats_t random_channel;
time_stats_t interp_time;
time_stats_t interp_freq;
time_stats_t interp_freq_PRACH;
time_stats_t convolution;
/// frequency measurements
time_stats_t DL_multipath_channel_freq;
......@@ -110,6 +111,10 @@ typedef struct {
time_stats_t rf_rx_simple_freq_PRACH;
time_stats_t adc_PRACH;
time_stats_t UL_PRACH_channel;
time_stats_t UL_channel;
time_stats_t DL_channel;
} channel_desc_t;
typedef struct {
......@@ -237,6 +242,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
\param desc Pointer to the channel descriptor
*/
int random_channel(channel_desc_t *desc, uint8_t abstraction_flag);
int random_channel_freq(channel_desc_t *desc, uint8_t abstraction_flag);
/**\fn void multipath_channel(channel_desc_t *desc,
double tx_sig_re[2],
double tx_sig_im[2],
......
......@@ -292,7 +292,7 @@ void multipath_channel_freq(channel_desc_t *desc,
/*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);*/
random_channel(desc,0);
random_channel_freq(desc,0);
freq_channel(desc,nb_rb,n_samples);//Find desc->chF
//freq_channel_prach(desc,nb_rb,n_samples,1,44);//Find desc->chF
}
......@@ -425,7 +425,7 @@ void multipath_channel_freq(channel_desc_t *desc,
if (keep_channel) {
// do nothing - keep channel
} else {
random_channel(desc,0);
random_channel_freq(desc,0);
freq_channel(desc,nb_rb,n_samples);//Find desc->chF
}
//clock_t start=clock();
......@@ -525,7 +525,7 @@ void multipath_channel_freq_SSE_float(channel_desc_t *desc,
if (keep_channel) {
// do nothing - keep channel
} else {
random_channel(desc,0);
random_channel_freq(desc,0);
freq_channel(desc,nb_rb,n_samples);//Find desc->chF
}
for (j=0;j<(symbols_per_tti>>2);j++){
......@@ -644,7 +644,7 @@ void multipath_channel_prach(channel_desc_t *desc,
if (keep_channel) {
// do nothing - keep channel
} else {
random_channel(desc,0);
random_channel_freq(desc,0);
freq_channel_prach(desc,nb_rb,n_samples,prach_fmt,n_ra_prb);//Find desc->chF_prach
}
for (f=0;f<(length>>1); f++) {
......@@ -712,7 +712,7 @@ void multipath_channel_prach(channel_desc_t *desc,
if (keep_channel) {
// do nothing - keep channel
} else {
random_channel(desc,0);//Find a(l)
random_channel_freq(desc,0);//Find a(l)
freq_channel_prach(desc,nb_rb,n_samples,prach_fmt,n_ra_prb);//Find desc->chF_prach
}
for (f=0;f<length; f++) {
......@@ -762,7 +762,7 @@ void multipath_channel_prach_SSE_float(channel_desc_t *desc,
if (keep_channel) {
// do nothing - keep channel
} else {
random_channel(desc,0);
random_channel_freq(desc,0);
freq_channel_prach(desc,nb_rb,n_samples,prach_fmt,n_ra_prb);//Find desc->chF_prach
}
for (f=0;f<(length>>2); f++) {
......
......@@ -1248,7 +1248,6 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
return(chan_desc);
}
int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) {
double s;
......@@ -1397,6 +1396,115 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) {
return (0);
}
int random_channel_freq(channel_desc_t *desc, uint8_t abstraction_flag) {
int i,k,l,aarx,aatx;
struct complex anew[NB_ANTENNAS_TX*NB_ANTENNAS_RX],acorr[NB_ANTENNAS_TX*NB_ANTENNAS_RX];
struct complex phase, alpha, beta;
if ((desc->nb_tx>NB_ANTENNAS_TX) || (desc->nb_rx > NB_ANTENNAS_RX)) {
msg("random_channel.c: Error: temporary buffer for channel not big enough (%d,%d)\n",desc->nb_tx,desc->nb_rx);
return(-1);
}
start_meas(&desc->random_channel);
for (i=0;i<(int)desc->nb_taps;i++) {
for (aarx=0;aarx<desc->nb_rx;aarx++) {
for (aatx=0;aatx<desc->nb_tx;aatx++) {
anew[aarx+(aatx*desc->nb_rx)].x = sqrt(desc->ricean_factor*desc->amps[i]/2) * ziggurat(0.0,1.0);
anew[aarx+(aatx*desc->nb_rx)].y = sqrt(desc->ricean_factor*desc->amps[i]/2) * ziggurat(0.0,1.0);
if ((i==0) && (desc->ricean_factor != 1.0)) {
if (desc->random_aoa==1) {
desc->aoa = uniformrandom()*2*M_PI;
}
// this assumes that both RX and TX have linear antenna arrays with lambda/2 antenna spacing.
// Furhter it is assumed that the arrays are parallel to each other and that they are far enough apart so
// that we can safely assume plane wave propagation.
phase.x = cos(M_PI*((aarx-aatx)*sin(desc->aoa)));
phase.y = sin(M_PI*((aarx-aatx)*sin(desc->aoa)));
anew[aarx+(aatx*desc->nb_rx)].x += phase.x * sqrt(1.0-desc->ricean_factor);
anew[aarx+(aatx*desc->nb_rx)].y += phase.y * sqrt(1.0-desc->ricean_factor);
}
#ifdef DEBUG_CH
printf("(%d,%d,%d) %f->(%f,%f) (%f,%f) phase (%f,%f)\n",aarx,aatx,i,desc->amps[i],anew[aarx+(aatx*desc->nb_rx)].x,anew[aarx+(aatx*desc->nb_rx)].y,desc->aoa,desc->ricean_factor,phase.x,phase.y);
#endif
} //aatx
} //aarx
/*
// for debugging set a=anew;
for (aarx=0;aarx<desc->nb_rx;aarx++) {
for (aatx=0;aatx<desc->nb_tx;aatx++) {
desc->a[i][aarx+(aatx*desc->nb_rx)].x = anew[aarx+(aatx*desc->nb_rx)].x;
desc->a[i][aarx+(aatx*desc->nb_rx)].y = anew[aarx+(aatx*desc->nb_rx)].y;
printf("anew(%d,%d) = %f+1j*%f\n",aatx,aarx,anew[aarx+(aatx*desc->nb_rx)].x, anew[aarx+(aatx*desc->nb_rx)].y);
}
}
*/
//apply correlation matrix
//compute acorr = R_sqrt[i] * anew
alpha.x = 1.0;
alpha.y = 0.0;
beta.x = 0.0;
beta.y = 0.0;
cblas_zgemv(CblasRowMajor, CblasNoTrans, desc->nb_tx*desc->nb_rx, desc->nb_tx*desc->nb_rx,
(void*) &alpha, (void*) desc->R_sqrt[i/3], desc->nb_rx*desc->nb_tx,
(void*) anew, 1, (void*) &beta, (void*) acorr, 1);
/*
for (aarx=0;aarx<desc->nb_rx;aarx++) {
for (aatx=0;aatx<desc->nb_tx;aatx++) {
desc->a[i][aarx+(aatx*desc->nb_rx)].x = acorr[aarx+(aatx*desc->nb_rx)].x;
desc->a[i][aarx+(aatx*desc->nb_rx)].y = acorr[aarx+(aatx*desc->nb_rx)].y;
printf("tap %d, acorr1(%d,%d) = %f+1j*%f\n",i,aatx,aarx,acorr[aarx+(aatx*desc->nb_rx)].x, acorr[aarx+(aatx*desc->nb_rx)].y);
}
}
*/
if (desc->first_run==1){
cblas_zcopy(desc->nb_tx*desc->nb_rx, (void*) acorr, 1, (void*) desc->a[i], 1);
}
else {
// a = alpha*acorr+beta*a
// a = beta*a
// a = a+alpha*acorr
alpha.x = sqrt(1-desc->forgetting_factor);
alpha.y = 0;
beta.x = sqrt(desc->forgetting_factor);
beta.y = 0;
cblas_zscal(desc->nb_tx*desc->nb_rx, (void*) &beta, (void*) desc->a[i], 1);
cblas_zaxpy(desc->nb_tx*desc->nb_rx, (void*) &alpha, (void*) acorr, 1, (void*) desc->a[i], 1);
// desc->a[i][aarx+(aatx*desc->nb_rx)].x = (sqrt(desc->forgetting_factor)*desc->a[i][aarx+(aatx*desc->nb_rx)].x) + sqrt(1-desc->forgetting_factor)*anew.x;
// desc->a[i][aarx+(aatx*desc->nb_rx)].y = (sqrt(desc->forgetting_factor)*desc->a[i][aarx+(aatx*desc->nb_rx)].y) + sqrt(1-desc->forgetting_factor)*anew.y;
}
/*
for (aarx=0;aarx<desc->nb_rx;aarx++) {
for (aatx=0;aatx<desc->nb_tx;aatx++) {
//desc->a[i][aarx+(aatx*desc->nb_rx)].x = acorr[aarx+(aatx*desc->nb_rx)].x;
//desc->a[i][aarx+(aatx*desc->nb_rx)].y = acorr[aarx+(aatx*desc->nb_rx)].y;
printf("tap %d, a(%d,%d) = %f+1j*%f\n",i,aatx,aarx,desc->a[i][aarx+(aatx*desc->nb_rx)].x, desc->a[i][aarx+(aatx*desc->nb_rx)].y);
}
}
*/
} //nb_taps
stop_meas(&desc->random_channel);
//memset((void *)desc->ch[aarx+(aatx*desc->nb_rx)],0,(int)(desc->channel_length)*sizeof(struct complex));
if (desc->first_run==1)
desc->first_run = 0;
return (0);
}
double N_RB2sampling_rate(uint16_t N_RB)
{
double sampling_rate;
......
......@@ -144,7 +144,7 @@ double uniformrandom(void)
return;
}*/
/*!\brief Ziggurat random number generator based on rejection sampling. It returns a pseudorandom normally distributed double number between -4.5 and 4.5*/
/*!\brief Ziggurat random number generator based on rejection sampling. It returns a pseudorandom normally distributed double number with x=0 and variance=1*/
//Procedure to create tables for normal distribution kn,wn and fn
#define SHR3 (jz=jsr, jsr^=(jsr<<13),jsr^=(jsr>>17),jsr^=(jsr<<5),jz+jsr)
......
......@@ -1372,7 +1372,7 @@ void do_UL_sig_freq_prach(channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB
//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 {
start_meas(&UE2eNB[UE_id][eNB_id][CC_id]->dac_fixed_gain_PRACH);
start_meas(&UE2eNB[0][eNB_id][CC_id]->dac_fixed_gain_PRACH);
#ifdef SSE_float
tx_pwr = dac_fixed_gain_prach_SSE_float((float**)s_re_f_prach,
(float**)s_im_f_prach,
......@@ -1400,7 +1400,7 @@ void do_UL_sig_freq_prach(channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB
PHY_vars_UE_g[UE_id][CC_id]->tx_total_RE[subframe],
PHY_vars_UE_g[UE_id][CC_id]->frame_parms.ofdm_symbol_size); // This make the previous argument the total power
#endif
stop_meas(&UE2eNB[UE_id][eNB_id][CC_id]->dac_fixed_gain_PRACH);
stop_meas(&UE2eNB[0][eNB_id][CC_id]->dac_fixed_gain_PRACH);
//for (int idx=0;idx<10;idx++) printf("dumping raw PRACH UL tx subframe (input) %d: s_f[%d] = (%f,%f)\n", subframe, idx, s_re_f_prach[0][idx],s_im_f_prach[0][idx]);
//for (int idx=829;idx<839;idx++) printf("dumping raw PRACH UL tx subframe (input) %d: s_f[%d] = (%f,%f)\n", subframe, idx, s_re_f_prach[0][idx],s_im_f_prach[0][idx]);
LOG_D(OCM,"[SIM][UL] UE %d tx_pwr %f dBm (target %d dBm, num_RE %d) for subframe %d (sf_offset %d)\n",
......@@ -1505,8 +1505,9 @@ void do_UL_sig_freq_prach(channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB
#endif
rx_prachF = PHY_vars_eNB_g[eNB_id][CC_id]->prach_vars.rxsigF;
sf_offset = pointer_firstvalue_PRACH;
//start_meas(&UE2eNB[UE_id][eNB_id][CC_id]->adc_PRACH);
start_meas(&UE2eNB[0][eNB_id][CC_id]->adc_PRACH);
#ifdef SSE_float
adc_prach_SSE_float(r_re_p_f_prach,
r_im_p_f_prach,
0,
......
......@@ -1481,6 +1481,7 @@ reset_opp_meas_oaisim (void)
reset_meas (&UE2eNB[UE_id][eNB_id][0]->random_channel);
reset_meas (&UE2eNB[UE_id][eNB_id][0]->interp_time);
reset_meas (&UE2eNB[UE_id][eNB_id][0]->interp_freq);
reset_meas (&UE2eNB[UE_id][eNB_id][0]->interp_freq_PRACH);
reset_meas (&UE2eNB[UE_id][eNB_id][0]->convolution);
//Time consuming in Frequency analysis
//Downlink
......@@ -1498,6 +1499,10 @@ reset_opp_meas_oaisim (void)
reset_meas (&UE2eNB[UE_id][eNB_id][0]->dac_fixed_gain_PRACH);
reset_meas (&UE2eNB[UE_id][eNB_id][0]->rf_rx_simple_freq_PRACH);
reset_meas (&UE2eNB[UE_id][eNB_id][0]->adc_PRACH);
//DL-UL Frequency Channel
reset_meas (&eNB2UE[eNB_id][UE_id][0]->DL_channel);
reset_meas (&UE2eNB[UE_id][eNB_id][0]->UL_channel);
reset_meas (&UE2eNB[UE_id][eNB_id][0]->UL_PRACH_channel);
}
reset_meas (&PHY_vars_eNB_g[eNB_id][0]->phy_proc);
......@@ -1593,6 +1598,8 @@ print_opp_meas_oaisim (void)
"[UL][interp_time]", &oaisim_stats, &oaisim_stats_f);
print_meas (&UE2eNB[UE_id][eNB_id][0]->interp_freq,
"[UL][interp_freq]", &oaisim_stats, &oaisim_stats_f);
print_meas (&UE2eNB[UE_id][eNB_id][0]->interp_freq_PRACH,
"[UL][interp_freq_PRACH]", &oaisim_stats, &oaisim_stats_f);
print_meas (&UE2eNB[UE_id][eNB_id][0]->convolution,
"[UL][convolution]", &oaisim_stats, &oaisim_stats_f);
......@@ -1624,6 +1631,14 @@ print_opp_meas_oaisim (void)
"[UL_PRACH][rf_rx_simple_freq]", &oaisim_stats, &oaisim_stats_f);
print_meas (&UE2eNB[UE_id][eNB_id][0]->adc_PRACH,
"[UL_PRACH][adc]", &oaisim_stats, &oaisim_stats_f);
//Dl/UL Frequency Channel
print_meas (&UE2eNB[UE_id][eNB_id][0]->UL_channel,
"[UL_channel]", &oaisim_stats, &oaisim_stats_f);
print_meas (&UE2eNB[UE_id][eNB_id][0]->UL_PRACH_channel,
"[UL_PRACH_channel]", &oaisim_stats, &oaisim_stats_f);
print_meas (&eNB2UE[eNB_id][UE_id][0]->DL_channel,
"[DL_channel]", &oaisim_stats, &oaisim_stats_f);
}
}
......
......@@ -1043,6 +1043,15 @@ extern int subframe_eNB_mask,subframe_UE_mask;
int eNB_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int cc)
{
static int first_run=0;
static double sum;
static int count1;
if (!first_run)
{
first_run=1;
sum=0;
count1=0;
}
static int count=0;
if (count==500)
{
......@@ -1120,6 +1129,8 @@ int eNB_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void *
for (UE_id=0; UE_id<NB_UE_INST; UE_id++){
if (is_prach_subframe(&PHY_vars_UE_g[UE_id][CC_id]->frame_parms,frame,subframe) && PHY_vars_UE_g[UE_id][CC_id]->generate_prach)
{
start_meas(&UE2eNB[UE_id][eNB_id][CC_id]->UL_PRACH_channel);
clock_t start=clock();
do_UL_sig_freq_prach(UE2eNB,
enb_data,
ue_data,
......@@ -1129,10 +1140,16 @@ 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_DL_sig time_prach is %f s, AVERAGE time is %f s, count %d, sum %e\n",(float) (stop-start)/CLOCKS_PER_SEC,(float) (sum+stop-start)/(count1*CLOCKS_PER_SEC),count1,sum+stop-start);
sum=(sum+stop-start);
count1++;
stop_meas(&UE2eNB[UE_id][eNB_id][CC_id]->UL_PRACH_channel);
//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);
break;
}
}
start_meas(&UE2eNB[0][eNB_id][CC_id]->UL_channel);
do_UL_sig_freq(UE2eNB,
enb_data,
ue_data,
......@@ -1142,6 +1159,7 @@ int eNB_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void *
0, // frame is only used for abstraction
eNB_id,
CC_id);
stop_meas(&UE2eNB[0][eNB_id][CC_id]->UL_channel);
}
else
{
......@@ -1167,15 +1185,6 @@ 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)
{
static int first_run=0;
static double sum;
static int count;
if (!first_run)
{
first_run=1;
sum=0;
count=0;
}
int ret = nsamps;
int UE_id = device->Mod_id;
......@@ -1242,8 +1251,8 @@ int UE_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void **
(unsigned long long)current_UE_rx_timestamp[UE_id][CC_id]);
if (do_ofdm_mod)
{
//start_meas(&dl_chan_stats_f);
clock_t start=clock();
start_meas(&eNB2UE[0][UE_id][CC_id]->DL_channel);
//clock_t start=clock();
do_DL_sig_freq(eNB2UE,
enb_data,
ue_data,
......@@ -1252,10 +1261,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);
clock_t stop=clock();
stop_meas(&eNB2UE[0][UE_id][CC_id]->DL_channel);
/*clock_t stop=clock();
printf("do_DL_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);
count++;
count++;*/
//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);
}
......
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