Merge remote-tracking branch 'eurecom/develop' into origin-episys-merge-nsa
This commit is contained in:
@@ -39,7 +39,7 @@ double **cos_lut=NULL,* *sin_lut=NULL;
|
||||
|
||||
|
||||
|
||||
int init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples) {
|
||||
int init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples,int scs) {
|
||||
double delta_f,freq; // 90 kHz spacing
|
||||
double delay;
|
||||
int16_t f;
|
||||
@@ -52,7 +52,7 @@ int init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples) {
|
||||
|
||||
cos_lut = (double **)malloc(n_samples*sizeof(double *));
|
||||
sin_lut = (double **)malloc(n_samples*sizeof(double *));
|
||||
delta_f = nb_rb*180000/(n_samples-1);
|
||||
delta_f = nb_rb*12*scs*1000/(n_samples-1);
|
||||
|
||||
for (f=-(n_samples>>1); f<=(n_samples>>1); f++) {
|
||||
freq=delta_f*(double)f*1e-6;// due to the fact that delays is in mus
|
||||
@@ -67,14 +67,14 @@ int init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples) {
|
||||
|
||||
cos_lut[f+(n_samples>>1)][l] = cos(2*M_PI*freq*delay);
|
||||
sin_lut[f+(n_samples>>1)][l] = sin(2*M_PI*freq*delay);
|
||||
//printf("values cos:%d, sin:%d\n", cos_lut[f][l], sin_lut[f][l]);
|
||||
// printf("values cos:%f, sin:%f\n", cos_lut[f+(n_samples>>1)][l], sin_lut[f+(n_samples>>1)][l]);
|
||||
}
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
int freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples) {
|
||||
int freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples,int scs) {
|
||||
int16_t f,f2,d;
|
||||
uint8_t aarx,aatx,l;
|
||||
double *clut,*slut;
|
||||
@@ -95,14 +95,14 @@ int freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples) {
|
||||
// if called with n_samples<12*nb_rb+1, we decimate the lut
|
||||
n_samples_max=12*nb_rb+1;
|
||||
|
||||
if (init_freq_channel(desc,nb_rb,n_samples_max)==0)
|
||||
if (init_freq_channel(desc,nb_rb,n_samples_max,scs)==0)
|
||||
freq_channel_init=1;
|
||||
else
|
||||
return(-1);
|
||||
}
|
||||
|
||||
d=(n_samples_max-1)/(n_samples-1);
|
||||
//printf("no_samples=%d, n_samples_max=%d, d=%d\n",n_samples,n_samples_max,d);
|
||||
// printf("no_samples=%d, n_samples_max=%d, d=%d,nb_taps %d\n",n_samples,n_samples_max,d,desc->nb_taps);
|
||||
start_meas(&desc->interp_freq);
|
||||
|
||||
for (f=-n_samples_max/2,f2=-n_samples/2; f<n_samples_max/2; f+=d,f2++) {
|
||||
@@ -111,6 +111,7 @@ int freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples) {
|
||||
|
||||
for (aarx=0; aarx<desc->nb_rx; aarx++) {
|
||||
for (aatx=0; aatx<desc->nb_tx; aatx++) {
|
||||
AssertFatal(n_samples/2+f2 < (2+(275*12)),"reading past chF %d (n_samples %d, f2 %d)\n",n_samples/2+f2,n_samples,f2);
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].r=0.0;
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].i=0.0;
|
||||
|
||||
|
||||
@@ -519,12 +519,12 @@ void tdlModel(int tdl_paths, double *tdl_delays, double *tdl_amps_dB, double DS
|
||||
chan_desc->ch[i] = (struct complexd *) malloc(chan_desc->channel_length * sizeof(struct complexd));
|
||||
|
||||
for (int i = 0; i<nb_tx*nb_rx; i++)
|
||||
chan_desc->chF[i] = (struct complexd *) malloc(1200 * sizeof(struct complexd));
|
||||
chan_desc->chF[i] = (struct complexd *) malloc((2+(275*12)) * sizeof(struct complexd));
|
||||
|
||||
for (int i = 0; i<chan_desc->nb_taps; i++)
|
||||
chan_desc->a[i] = (struct complexd *) malloc(nb_tx*nb_rx * sizeof(struct complexd));
|
||||
|
||||
chan_desc->R_sqrt = (struct complexd **) malloc(6*sizeof(struct complexd **));
|
||||
chan_desc->R_sqrt = (struct complexd **) malloc(tdl_pathsby3*sizeof(struct complexd **));
|
||||
|
||||
if (nb_tx==2 && nb_rx==2) {
|
||||
for (int i = 0; i<(tdl_pathsby3); i++)
|
||||
@@ -1708,10 +1708,9 @@ void set_channeldesc_name(channel_desc_t *cdesc,char *modelname) {
|
||||
int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) {
|
||||
double s;
|
||||
int i,k,l,aarx,aatx;
|
||||
struct complexd anew[NB_ANTENNAS_TX*NB_ANTENNAS_RX],acorr[NB_ANTENNAS_TX*NB_ANTENNAS_RX];
|
||||
struct complexd anew[desc->nb_tx*desc->nb_rx];
|
||||
struct complexd acorr[desc->nb_tx*desc->nb_rx];
|
||||
struct complexd phase, alpha, beta;
|
||||
AssertFatal(desc->nb_tx<=NB_ANTENNAS_TX && desc->nb_rx <= NB_ANTENNAS_RX,
|
||||
"random_channel.c: Error: temporary buffer for channel not big enough (%d,%d)\n",desc->nb_tx,desc->nb_rx);
|
||||
start_meas(&desc->random_channel);
|
||||
|
||||
for (i=0; i<(int)desc->nb_taps; i++) {
|
||||
@@ -1735,7 +1734,7 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) {
|
||||
}
|
||||
|
||||
#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);
|
||||
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)].r,anew[aarx+(aatx*desc->nb_rx)].i,desc->aoa,desc->ricean_factor,phase.r,phase.i);
|
||||
#endif
|
||||
} //aatx
|
||||
} //aarx
|
||||
@@ -1752,6 +1751,11 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) {
|
||||
*/
|
||||
//apply correlation matrix
|
||||
//compute acorr = R_sqrt[i] * anew
|
||||
bzero(acorr,desc->nb_tx*desc->nb_rx*sizeof(struct complexd));
|
||||
cblas_zaxpy(desc->nb_tx*desc->nb_rx, (void *) desc->R_sqrt[i/3], (void *) anew, 1, (void *) acorr, 1);
|
||||
|
||||
/*
|
||||
FIXME: Function cblas_zgemv has an undefined output (for the same input) after a second call in RHEL8 (acorr = nan)
|
||||
alpha.r = 1.0;
|
||||
alpha.i = 0.0;
|
||||
beta.r = 0.0;
|
||||
@@ -1759,6 +1763,7 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) {
|
||||
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++) {
|
||||
@@ -1827,7 +1832,7 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) {
|
||||
} //nb_taps
|
||||
|
||||
#ifdef DEBUG_CH
|
||||
printf("(%d,%d,%d)->(%e,%e)\n",k,aarx,aatx,desc->ch[aarx+(aatx*desc->nb_rx)][k].x,desc->ch[aarx+(aatx*desc->nb_rx)][k].y);
|
||||
printf("(%d,%d,%d)->(%e,%e)\n",k,aarx,aatx,desc->ch[aarx+(aatx*desc->nb_rx)][k].r,desc->ch[aarx+(aatx*desc->nb_rx)][k].i);
|
||||
#endif
|
||||
} //channel_length
|
||||
}
|
||||
|
||||
@@ -477,8 +477,8 @@ int gauss(unsigned int *gauss_LUT,unsigned char Nbits);
|
||||
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 init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples);
|
||||
int freq_channel(channel_desc_t *desc,uint16_t nb_rb, int16_t n_samples,int scs);
|
||||
int init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples,int scs);
|
||||
uint8_t multipath_channel_nosigconv(channel_desc_t *desc);
|
||||
void multipath_tv_channel(channel_desc_t *desc,
|
||||
double **tx_sig_re,
|
||||
|
||||
Reference in New Issue
Block a user