Commit 834af3d5 authored by francescomani's avatar francescomani

Merge remote-tracking branch 'origin/fix-513-duplicate-complex-structure' into integration_2021_w33

parents 4cba1a2b c310d246
......@@ -264,7 +264,7 @@ double signal_energy_fp(double *s_re[2],double *s_im[2],uint32_t nb_antennas,uin
return(V/length/nb_antennas);
}
double signal_energy_fp2(struct complex *s,uint32_t length)
double signal_energy_fp2(struct complexd *s,uint32_t length)
{
int32_t i;
......@@ -273,7 +273,7 @@ double signal_energy_fp2(struct complex *s,uint32_t length)
for (i=0; i<length; i++) {
// printf("signal_energy_fp2 : %f,%f => %f\n",s[i].x,s[i].y,V);
// V= V + (s[i].y*s[i].x) + (s[i].y*s[i].x);
V= V + (s[i].x*s[i].x) + (s[i].y*s[i].y);
V= V + (s[i].r*s[i].r) + (s[i].i*s[i].i);
}
return(V/length);
......
......@@ -39,11 +39,6 @@ extern "C" {
#define CEILIDIV(a,b) ((a+b-1)/b)
#define ROUNDIDIV(a,b) (((a<<1)+b)/(b<<1))
struct complex {
double x;
double y;
};
struct complexd {
double r;
double i;
......@@ -468,7 +463,7 @@ double signal_energy_fp(double *s_re[2], double *s_im[2], uint32_t nb_antennas,
/*!\fn double signal_energy_fp2(struct complex *, uint32_t);
\brief Computes the signal energy per subcarrier
*/
double signal_energy_fp2(struct complex *s, uint32_t length);
double signal_energy_fp2(struct complexd *s, uint32_t length);
int32_t iSqrt(int32_t value);
......
......@@ -200,8 +200,8 @@ void DL_channel(RU_t *ru,PHY_VARS_UE *UE,uint subframe,int awgn_flag,double SNR,
for (u=0; u<2*ru->frame_parms->N_RB_DL; u++) {
for (aarx=0; aarx<eNB2UE[0]->nb_rx; aarx++) {
for (aatx=0; aatx<eNB2UE[0]->nb_tx; aatx++) {
channelx = eNB2UE[0]->chF[aarx+(aatx*eNB2UE[0]->nb_rx)][u].x;
channely = eNB2UE[0]->chF[aarx+(aatx*eNB2UE[0]->nb_rx)][u].y;
channelx = eNB2UE[0]->chF[aarx+(aatx*eNB2UE[0]->nb_rx)][u].r;
channely = eNB2UE[0]->chF[aarx+(aatx*eNB2UE[0]->nb_rx)][u].i;
fprintf(csv_fd,"%e+i*(%e),",channelx,channely);
}
}
......@@ -213,8 +213,8 @@ void DL_channel(RU_t *ru,PHY_VARS_UE *UE,uint subframe,int awgn_flag,double SNR,
for (u=0; u<2*ru->frame_parms->N_RB_DL; u++) {
for (aarx=0; aarx<eNB2UE[1]->nb_rx; aarx++) {
for (aatx=0; aatx<eNB2UE[1]->nb_tx; aatx++) {
channelx = eNB2UE[1]->chF[aarx+(aatx*eNB2UE[1]->nb_rx)][u].x;
channely = eNB2UE[1]->chF[aarx+(aatx*eNB2UE[1]->nb_rx)][u].y;
channelx = eNB2UE[1]->chF[aarx+(aatx*eNB2UE[1]->nb_rx)][u].r;
channely = eNB2UE[1]->chF[aarx+(aatx*eNB2UE[1]->nb_rx)][u].i;
fprintf(csv_fd,"%e+i*(%e),",channelx,channely);
}
}
......@@ -225,8 +225,8 @@ void DL_channel(RU_t *ru,PHY_VARS_UE *UE,uint subframe,int awgn_flag,double SNR,
for (u=0; u<2*ru->frame_parms->N_RB_DL; u++) {
for (aarx=0; aarx<eNB2UE[2]->nb_rx; aarx++) {
for (aatx=0; aatx<eNB2UE[2]->nb_tx; aatx++) {
channelx = eNB2UE[2]->chF[aarx+(aatx*eNB2UE[2]->nb_rx)][u].x;
channely = eNB2UE[2]->chF[aarx+(aatx*eNB2UE[2]->nb_rx)][u].y;
channelx = eNB2UE[2]->chF[aarx+(aatx*eNB2UE[2]->nb_rx)][u].r;
channely = eNB2UE[2]->chF[aarx+(aatx*eNB2UE[2]->nb_rx)][u].i;
fprintf(csv_fd,"%e+i*(%e),",channelx,channely);
}
}
......@@ -237,8 +237,8 @@ void DL_channel(RU_t *ru,PHY_VARS_UE *UE,uint subframe,int awgn_flag,double SNR,
for (u=0; u<2*ru->frame_parms->N_RB_DL; u++) {
for (aarx=0; aarx<eNB2UE[3]->nb_rx; aarx++) {
for (aatx=0; aatx<eNB2UE[3]->nb_tx; aatx++) {
channelx = eNB2UE[3]->chF[aarx+(aatx*eNB2UE[3]->nb_rx)][u].x;
channely = eNB2UE[3]->chF[aarx+(aatx*eNB2UE[3]->nb_rx)][u].y;
channelx = eNB2UE[3]->chF[aarx+(aatx*eNB2UE[3]->nb_rx)][u].r;
channely = eNB2UE[3]->chF[aarx+(aatx*eNB2UE[3]->nb_rx)][u].i;
fprintf(csv_fd,"%e+i*(%e),",channelx,channely);
}
}
......
......@@ -75,7 +75,7 @@ int main(int argc, char **argv)
double rx_gain;
int rx_pwr2, target_rx_pwr_dB;
struct complex **ch;
struct complexd **ch;
unsigned char first_call = 1;
LTE_DL_FRAME_PARMS frame_parms;
......@@ -169,10 +169,10 @@ int main(int argc, char **argv)
channel_length = (int) 11+2*BW*Td;
ch = (struct complex**) malloc(4 * sizeof(struct complex*));
ch = (struct complexd**) malloc(4 * sizeof(struct complexd*));
for (i = 0; i<4; i++)
ch[i] = (struct complex*) malloc(channel_length * sizeof(struct complex));
ch[i] = (struct complexd*) malloc(channel_length * sizeof(struct complexd));
randominit(0);
set_taus_seed(0);
......
......@@ -1111,8 +1111,8 @@ int main(int argc, char **argv) {
for (aarx=0; aarx<UE2eNB->nb_rx; aarx++) {
for (aatx=0; aatx<UE2eNB->nb_tx; aatx++) {
// abs_channel = (eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][u].x*eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][u].x + eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][u].y*eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][u].y);
channelx = UE2eNB->chF[aarx+(aatx*UE2eNB->nb_rx)][u].x;
channely = UE2eNB->chF[aarx+(aatx*UE2eNB->nb_rx)][u].y;
channelx = UE2eNB->chF[aarx+(aatx*UE2eNB->nb_rx)][u].r;
channely = UE2eNB->chF[aarx+(aatx*UE2eNB->nb_rx)][u].i;
// if(transmission_m==5){
fprintf(csv_fdUL,"%e+i*(%e),",channelx,channely);
// }
......
......@@ -49,7 +49,7 @@ int main(int argc, char **argv)
double amps[8] = {0.3868472 , 0.3094778 , 0.1547389 , 0.0773694 , 0.0386847 , 0.0193424 , 0.0096712 , 0.0038685};
double aoa=.03,ricean_factor=1; //0.0000005;
int channel_length;
struct complex **ch;
struct complexd **ch;
unsigned char pbch_pdu[6];
int sync_pos, sync_pos_slot;
FILE *rx_frame_file;
......@@ -170,10 +170,10 @@ int main(int argc, char **argv)
bzero(r_im[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
}
ch = (struct complex**) malloc(4 * sizeof(struct complex*));
ch = (struct complexd**) malloc(4 * sizeof(struct complexd*));
for (i = 0; i<4; i++)
ch[i] = (struct complex*) malloc(channel_length * sizeof(struct complex));
ch[i] = (struct complexd*) malloc(channel_length * sizeof(struct complexd));
generate_srs_tx(lte_frame_parms,lte_ue_common_vars->txdataF[0],AMP,0);
generate_drs_puch(lte_frame_parms,lte_ue_common_vars->txdataF[0],AMP,0,first_rb,nb_rb);
......
......@@ -111,14 +111,14 @@ 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++) {
desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].x=0.0;
desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].y=0.0;
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;
for (l=0; l<(int)desc->nb_taps; l++) {
desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].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[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].y+=(-desc->a[l][aarx+(aatx*desc->nb_rx)].x*slut[l]+
desc->a[l][aarx+(aatx*desc->nb_rx)].y*clut[l]);
desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].r+=(desc->a[l][aarx+(aatx*desc->nb_rx)].r*clut[l]+
desc->a[l][aarx+(aatx*desc->nb_rx)].i*slut[l]);
desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].i+=(-desc->a[l][aarx+(aatx*desc->nb_rx)].r*slut[l]+
desc->a[l][aarx+(aatx*desc->nb_rx)].i*clut[l]);
}
}
}
......@@ -138,42 +138,42 @@ double compute_pbch_sinr(channel_desc_t *desc,
uint16_t f;
uint8_t aarx,aatx;
double S;
struct complex S_i1;
struct complex S_i2;
struct complexd S_i1;
struct complexd S_i2;
avg_sinr=0.0;
// printf("nb_rb %d\n",nb_rb);
for (f=(nb_rb-6); f<(nb_rb+6); f++) {
S = 0.0;
S_i1.x =0.0;
S_i1.y =0.0;
S_i2.x =0.0;
S_i2.y =0.0;
S_i1.r =0.0;
S_i1.i =0.0;
S_i2.r =0.0;
S_i2.i =0.0;
for (aarx=0; aarx<desc->nb_rx; aarx++) {
for (aatx=0; aatx<desc->nb_tx; aatx++) {
S += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc->chF[aarx+(aatx*desc->nb_rx)][f].x +
desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc->chF[aarx+(aatx*desc->nb_rx)][f].y);
S += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc->chF[aarx+(aatx*desc->nb_rx)][f].r +
desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc->chF[aarx+(aatx*desc->nb_rx)][f].i);
// printf("%d %d chF[%d] => (%f,%f)\n",aarx,aatx,f,desc->chF[aarx+(aatx*desc->nb_rx)][f].x,desc->chF[aarx+(aatx*desc->nb_rx)][f].y);
if (desc_i1) {
S_i1.x += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].x +
desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].y);
S_i1.y += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].y -
desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].x);
S_i1.r += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].r +
desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].i);
S_i1.i += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].i -
desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].r);
}
if (desc_i2) {
S_i2.x += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].x +
desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].y);
S_i2.y += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].y -
desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].x);
S_i2.r += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].r +
desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].i);
S_i2.r += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].i -
desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].r);
}
}
}
// printf("snr %f f %d : S %f, S_i1 %f, S_i2 %f\n",snr,f-nb_rb,S,snr_i1*sqrt(S_i1.x*S_i1.x + S_i1.y*S_i1.y),snr_i2*sqrt(S_i2.x*S_i2.x + S_i2.y*S_i2.y));
avg_sinr += (snr*S/(desc->nb_tx+snr_i1*sqrt(S_i1.x*S_i1.x + S_i1.y*S_i1.y)+snr_i2*sqrt(S_i2.x*S_i2.x + S_i2.y*S_i2.y)));
avg_sinr += (snr*S/(desc->nb_tx+snr_i1*sqrt(S_i1.r*S_i1.r + S_i1.i*S_i1.i)+snr_i2*sqrt(S_i2.r*S_i2.r + S_i2.i*S_i2.i)));
}
// printf("avg_sinr %f (%f,%f,%f)\n",avg_sinr/12.0,snr,snr_i1,snr_i2);
......@@ -191,42 +191,42 @@ double compute_sinr(channel_desc_t *desc,
uint16_t f;
uint8_t aarx,aatx;
double S;
struct complex S_i1;
struct complex S_i2;
struct complexd S_i1;
struct complexd S_i2;
DevAssert( nb_rb > 0 );
avg_sinr=0.0;
// printf("nb_rb %d\n",nb_rb);
for (f=0; f<2*nb_rb; f++) {
S = 0.0;
S_i1.x =0.0;
S_i1.y =0.0;
S_i2.x =0.0;
S_i2.y =0.0;
S_i1.r =0.0;
S_i1.i =0.0;
S_i2.r =0.0;
S_i2.i =0.0;
for (aarx=0; aarx<desc->nb_rx; aarx++) {
for (aatx=0; aatx<desc->nb_tx; aatx++) {
S += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc->chF[aarx+(aatx*desc->nb_rx)][f].x +
desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc->chF[aarx+(aatx*desc->nb_rx)][f].y);
S += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc->chF[aarx+(aatx*desc->nb_rx)][f].r +
desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc->chF[aarx+(aatx*desc->nb_rx)][f].i);
if (desc_i1) {
S_i1.x += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].x +
desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].y);
S_i1.y += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].y -
desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].x);
S_i1.r += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].r +
desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].i);
S_i1.i += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].i -
desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].r);
}
if (desc_i2) {
S_i2.x += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].x +
desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].y);
S_i2.y += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].y -
desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].x);
S_i2.r += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].r +
desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].i);
S_i2.i += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].i -
desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].r);
}
}
}
// printf("f %d : S %f, S_i1 %f, S_i2 %f\n",f-nb_rb,snr*S,snr_i1*sqrt(S_i1.x*S_i1.x + S_i1.y*S_i1.y),snr_i2*sqrt(S_i2.x*S_i2.x + S_i2.y*S_i2.y));
avg_sinr += (snr*S/(desc->nb_tx+snr_i1*sqrt(S_i1.x*S_i1.x + S_i1.y*S_i1.y)+snr_i2*sqrt(S_i2.x*S_i2.x + S_i2.y*S_i2.y)));
avg_sinr += (snr*S/(desc->nb_tx+snr_i1*sqrt(S_i1.r*S_i1.r + S_i1.i*S_i1.i)+snr_i2*sqrt(S_i2.r*S_i2.r + S_i2.i*S_i2.i)));
}
// printf("avg_sinr %f (%f,%f,%f)\n",avg_sinr/12.0,snr,snr_i1,snr_i2);
......
......@@ -156,7 +156,7 @@ void multipath_channel(channel_desc_t *desc,
{
int i,ii,j,l;
struct complex rx_tmp,tx;
struct complexd rx_tmp,tx;
double path_loss = pow(10,desc->path_loss_dB/20);
int dd;
......@@ -183,32 +183,32 @@ void multipath_channel(channel_desc_t *desc,
for (i=0; i<((int)length-dd); i++) {
for (ii=0; ii<desc->nb_rx; ii++) {
rx_tmp.x = 0;
rx_tmp.y = 0;
rx_tmp.r = 0;
rx_tmp.i = 0;
for (j=0; j<desc->nb_tx; j++) {
for (l = 0; l<(int)desc->channel_length; l++) {
if ((i>=0) && (i-l)>=0) {
tx.x = tx_sig_re[j][i-l];
tx.y = tx_sig_im[j][i-l];
tx.r = tx_sig_re[j][i-l];
tx.i = tx_sig_im[j][i-l];
} else {
tx.x =0;
tx.y =0;
tx.r =0;
tx.i =0;
}
rx_tmp.x += (tx.x * desc->ch[ii+(j*desc->nb_rx)][l].x) - (tx.y * desc->ch[ii+(j*desc->nb_rx)][l].y);
rx_tmp.y += (tx.y * desc->ch[ii+(j*desc->nb_rx)][l].x) + (tx.x * desc->ch[ii+(j*desc->nb_rx)][l].y);
rx_tmp.r += (tx.r * desc->ch[ii+(j*desc->nb_rx)][l].r) - (tx.i * desc->ch[ii+(j*desc->nb_rx)][l].i);
rx_tmp.i += (tx.i * desc->ch[ii+(j*desc->nb_rx)][l].r) + (tx.r * desc->ch[ii+(j*desc->nb_rx)][l].i);
if (i==0 && log_channel == 1) {
printf("channel[%d][%d][%d] = %f dB (%e,%e)\n",ii,j,l,10*log10(pow(desc->ch[ii+(j*desc->nb_rx)][l].x,2.0)+pow(desc->ch[ii+(j*desc->nb_rx)][l].y,2.0)),
desc->ch[ii+(j*desc->nb_rx)][l].x,
desc->ch[ii+(j*desc->nb_rx)][l].y);
printf("channel[%d][%d][%d] = %f dB (%e,%e)\n",ii,j,l,10*log10(pow(desc->ch[ii+(j*desc->nb_rx)][l].r,2.0)+pow(desc->ch[ii+(j*desc->nb_rx)][l].i,2.0)),
desc->ch[ii+(j*desc->nb_rx)][l].r,
desc->ch[ii+(j*desc->nb_rx)][l].i);
}
} //l
} // j
rx_sig_re[ii][i+dd] = rx_tmp.x*path_loss;
rx_sig_im[ii][i+dd] = rx_tmp.y*path_loss;
rx_sig_re[ii][i+dd] = rx_tmp.r*path_loss;
rx_sig_im[ii][i+dd] = rx_tmp.i*path_loss;
#ifdef DEBUG_CHANNEL
if ((i%32)==0) {
printf("rx aa %d: %p %p %f,%f => %e,%e\n",ii,rx_sig_re[ii],rx_sig_im[ii],rx_tmp.x,rx_tmp.y,rx_sig_re[ii][i-dd],rx_sig_im[ii][i-dd]);
......
This diff is collapsed.
......@@ -64,11 +64,11 @@ typedef struct {
///length of impulse response. should be set to 11+2*bw*t_max
uint8_t channel_length;
///channel state vector. size(state) = nb_taps * (n_tx * n_rx);
struct complex **a;
struct complexd **a;
///interpolated (sample-spaced) channel impulse response. size(ch) = (n_tx * n_rx) * channel_length. ATTENTION: the dimensions of ch are the transposed ones of a. This is to allow the use of BLAS when applying the correlation matrices to the state.
struct complex **ch;
struct complexd **ch;
///Sampled frequency response (90 kHz resolution)
struct complex **chF;
struct complexd **chF;
///Maximum path delay in mus.
double Td;
///Channel bandwidth in MHz.
......@@ -84,7 +84,7 @@ typedef struct {
///in Hz. if >0 generate a channel with a Clarke's Doppler profile with a maximum Doppler bandwidth max_Doppler. CURRENTLY NOT IMPLEMENTED!
double max_Doppler;
///Square root of the full correlation matrix size(R_tx) = nb_taps * (n_tx * n_rx) * (n_tx * n_rx).
struct complex **R_sqrt;
struct complexd **R_sqrt;
///path loss including shadow fading in dB
double path_loss_dB;
///additional delay of channel in samples.
......
......@@ -74,10 +74,10 @@ void rxAddInput( struct complex16 *input_sig, struct complex16 *after_channel_si
for (int i=0; i<((int)nbSamples-dd); i++) {
struct complex16 *out_ptr=after_channel_sig+dd+i;
struct complex rx_tmp= {0};
struct complexd rx_tmp= {0};
for (int txAnt=0; txAnt < nbTx; txAnt++) {
const struct complex *channelModel= channelDesc->ch[rxAnt+(txAnt*channelDesc->nb_rx)];
const struct complexd *channelModel= channelDesc->ch[rxAnt+(txAnt*channelDesc->nb_rx)];
//const struct complex *channelModelEnd=channelModel+channelDesc->channel_length;
for (int l = 0; l<(int)channelDesc->channel_length; l++) {
......@@ -88,14 +88,14 @@ void rxAddInput( struct complex16 *input_sig, struct complex16 *after_channel_si
// it would be better to split out each antenna in a separate flow
// that will allow to mix ru antennas freely
struct complex16 tx16=input_sig[((TS+i-l)*nbTx+txAnt)%CirSize];
rx_tmp.x += tx16.r * channelModel[l].x - tx16.i * channelModel[l].y;
rx_tmp.y += tx16.i * channelModel[l].x + tx16.r * channelModel[l].y;
rx_tmp.r += tx16.r * channelModel[l].r - tx16.i * channelModel[l].i;
rx_tmp.i += tx16.i * channelModel[l].r + tx16.r * channelModel[l].i;
} //l
}
// Fixme: lround(), rount(), ... is detected by valgrind as error, not found why
out_ptr->r += lround(rx_tmp.x*pathLossLinear + noise_per_sample*gaussZiggurat(0.0,1.0));
out_ptr->i += lround(rx_tmp.y*pathLossLinear + noise_per_sample*gaussZiggurat(0.0,1.0));
out_ptr->r += lround(rx_tmp.r*pathLossLinear + noise_per_sample*gaussZiggurat(0.0,1.0));
out_ptr->i += lround(rx_tmp.i*pathLossLinear + noise_per_sample*gaussZiggurat(0.0,1.0));
out_ptr++;
}
......
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