Commit 2e1a003b authored by Rodolphe BERTOLINI's avatar Rodolphe BERTOLINI

removed duplicate structure, changed 'x' to 'r' and 'y' to 'i'

parent 69577717
...@@ -264,7 +264,7 @@ double signal_energy_fp(double *s_re[2],double *s_im[2],uint32_t nb_antennas,uin ...@@ -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); 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; int32_t i;
...@@ -273,7 +273,7 @@ double signal_energy_fp2(struct complex *s,uint32_t length) ...@@ -273,7 +273,7 @@ double signal_energy_fp2(struct complex *s,uint32_t length)
for (i=0; i<length; i++) { for (i=0; i<length; i++) {
// printf("signal_energy_fp2 : %f,%f => %f\n",s[i].x,s[i].y,V); // 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].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); return(V/length);
......
...@@ -39,11 +39,6 @@ extern "C" { ...@@ -39,11 +39,6 @@ extern "C" {
#define CEILIDIV(a,b) ((a+b-1)/b) #define CEILIDIV(a,b) ((a+b-1)/b)
#define ROUNDIDIV(a,b) (((a<<1)+b)/(b<<1)) #define ROUNDIDIV(a,b) (((a<<1)+b)/(b<<1))
struct complex {
double x;
double y;
};
struct complexd { struct complexd {
double r; double r;
double i; double i;
...@@ -468,7 +463,7 @@ double signal_energy_fp(double *s_re[2], double *s_im[2], uint32_t nb_antennas, ...@@ -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); /*!\fn double signal_energy_fp2(struct complex *, uint32_t);
\brief Computes the signal energy per subcarrier \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); int32_t iSqrt(int32_t value);
......
...@@ -156,7 +156,7 @@ void multipath_channel(channel_desc_t *desc, ...@@ -156,7 +156,7 @@ void multipath_channel(channel_desc_t *desc,
{ {
int i,ii,j,l; 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); double path_loss = pow(10,desc->path_loss_dB/20);
int dd; int dd;
......
This diff is collapsed.
...@@ -64,11 +64,11 @@ typedef struct { ...@@ -64,11 +64,11 @@ typedef struct {
///length of impulse response. should be set to 11+2*bw*t_max ///length of impulse response. should be set to 11+2*bw*t_max
uint8_t channel_length; uint8_t channel_length;
///channel state vector. size(state) = nb_taps * (n_tx * n_rx); ///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. ///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) ///Sampled frequency response (90 kHz resolution)
struct complex **chF; struct complexd **chF;
///Maximum path delay in mus. ///Maximum path delay in mus.
double Td; double Td;
///Channel bandwidth in MHz. ///Channel bandwidth in MHz.
...@@ -84,7 +84,7 @@ typedef struct { ...@@ -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! ///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; double max_Doppler;
///Square root of the full correlation matrix size(R_tx) = nb_taps * (n_tx * n_rx) * (n_tx * n_rx). ///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 ///path loss including shadow fading in dB
double path_loss_dB; double path_loss_dB;
///additional delay of channel in samples. ///additional delay of channel in samples.
......
...@@ -74,10 +74,10 @@ void rxAddInput( struct complex16 *input_sig, struct complex16 *after_channel_si ...@@ -74,10 +74,10 @@ void rxAddInput( struct complex16 *input_sig, struct complex16 *after_channel_si
for (int i=0; i<((int)nbSamples-dd); i++) { for (int i=0; i<((int)nbSamples-dd); i++) {
struct complex16 *out_ptr=after_channel_sig+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++) { 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; //const struct complex *channelModelEnd=channelModel+channelDesc->channel_length;
for (int l = 0; l<(int)channelDesc->channel_length; l++) { 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 ...@@ -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 // it would be better to split out each antenna in a separate flow
// that will allow to mix ru antennas freely // that will allow to mix ru antennas freely
struct complex16 tx16=input_sig[((TS+i-l)*nbTx+txAnt)%CirSize]; 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.r += tx16.r * channelModel[l].r - tx16.i * channelModel[l].i;
rx_tmp.y += tx16.i * channelModel[l].x + tx16.r * channelModel[l].y; rx_tmp.i += tx16.i * channelModel[l].r + tx16.r * channelModel[l].i;
} //l } //l
} }
// Fixme: lround(), rount(), ... is detected by valgrind as error, not found why // 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->r += lround(rx_tmp.r*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->i += lround(rx_tmp.i*pathLossLinear + noise_per_sample*gaussZiggurat(0.0,1.0));
out_ptr++; 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