From 8cfd5f29f6805a55838ce75f9e1f2b993f3457bc Mon Sep 17 00:00:00 2001 From: Elena_Lukashova Date: Thu, 24 Nov 2016 15:00:14 +0100 Subject: [PATCH] Adding spatial low, medium and high correlation matrices for 2x2 EPA channel model. -gV, -gW, -gX. --- openair1/SIMULATION/LTE_PHY/dlsim.c | 11 +- openair1/SIMULATION/TOOLS/defs.h | 3 + openair1/SIMULATION/TOOLS/random_channel.c | 153 +++++++++++++++++++++ 3 files changed, 166 insertions(+), 1 deletion(-) diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 178b58a755..58aae368ce 100755 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -517,6 +517,15 @@ int main(int argc, char **argv) case 'U': channel_model = TS_SHIFT; break; + case 'V': + channel_model=EPA_low; + break; + case 'W': + channel_model=EPA_medium; + break; + case 'X': + channel_model=EPA_high; + break; default: msg("Unsupported channel model!\n"); exit(-1); @@ -618,7 +627,7 @@ int main(int argc, char **argv) printf("-s Starting SNR, runs from SNR to SNR+%.1fdB in steps of %.1fdB. If n_frames is 1 then just SNR is simulated and MATLAB/OCTAVE output is generated\n", snr_int, snr_step); printf("-f step size of SNR, default value is 1.\n"); printf("-r resource block allocation (see section 7.1.6.3 in 36.213\n"); - printf("-g Channel model, possible values are 3GPP 25.814 SCM-A/B/C/D('A','B','C','D'), 36-101 EPA('E'), EVA ('F'),ETU('G'), Rayghleigh8 ('H'), Rayleigh1('I'), Rayleigh1_corr('J'), Rayleigh1_anticorr('K'), Rice8('L'), Rice1('M'), AWGN('N'), Rayleigh1_orthogonal('P'), Rayleigh1_orth_eff_ch_TM4_prec_real ('Q'), Rayleigh1_orth_eff_ch_TM4_prec_imag ('R'), Rayleigh8_orth_eff_ch_TM4_prec_real ('S'),Rayleigh8_orth_eff_ch_TM4_prec_imag ('T') \n"); + printf("-g Channel model, possible values are 3GPP 25.814 SCM-A/B/C/D('A','B','C','D'), 36-101 EPA('E'), EVA ('F'),ETU('G'), Rayghleigh8 ('H'), Rayleigh1('I'), Rayleigh1_corr('J'), Rayleigh1_anticorr('K'), Rice8('L'), Rice1('M'), AWGN('N'), Rayleigh1_orthogonal('P'), Rayleigh1_orth_eff_ch_TM4_prec_real ('Q'), Rayleigh1_orth_eff_ch_TM4_prec_imag ('R'), Rayleigh8_orth_eff_ch_TM4_prec_real ('S'),Rayleigh8_orth_eff_ch_TM4_prec_imag ('T'), EPA_low ('V'), EPA_medium ('W'), EPA_high ('X') \n"); printf("-F forgetting factor (0 new channel every trial, 1 channel constant\n"); printf("-x Transmission mode (1,2,6 for the moment)\n"); printf("-y Number of TX antennas used in eNB\n"); diff --git a/openair1/SIMULATION/TOOLS/defs.h b/openair1/SIMULATION/TOOLS/defs.h index 64e8d0561c..ca2f515d20 100644 --- a/openair1/SIMULATION/TOOLS/defs.h +++ b/openair1/SIMULATION/TOOLS/defs.h @@ -183,6 +183,9 @@ typedef enum { Rayleigh8_orth_eff_ch_TM4_prec_real, Rayleigh8_orth_eff_ch_TM4_prec_imag, TS_SHIFT, + EPA_low, + EPA_medium, + EPA_high, } SCM_t; /** diff --git a/openair1/SIMULATION/TOOLS/random_channel.c b/openair1/SIMULATION/TOOLS/random_channel.c index 8f3cc7c8bd..bb7125840d 100644 --- a/openair1/SIMULATION/TOOLS/random_channel.c +++ b/openair1/SIMULATION/TOOLS/random_channel.c @@ -224,6 +224,25 @@ struct complex R_sqrt_22_orth_eff_ch_TM4_prec_imag_tap[16] = {{0.70711,0.0}, {0. {0.0, 0.0}, {0.0,0.70711}, {0.0, 0.0}, {-0.70711,0.0}}; struct complex *R_sqrt_22_orth_eff_ch_TM4_prec_imag[1] = {R_sqrt_22_orth_eff_ch_TM4_prec_imag_tap}; +//Correlation matrix for EPA channel +struct complex R_sqrt_22_EPA_low_tap[16] = {{1.0,0.0}, {0.0,0.0}, {0.0,0.0}, {0.0,0.0}, + {0.0,0.0}, {1.0,0.0}, {0.0,0.0}, {0.0,0.0}, + {0.0,0.0}, {0.0,0.0}, {1.0,0.0}, {0.0,0.0}, + {0.0,0.0}, {0.0,0.0}, {0.0,0.0}, {1.0,0.0}}; +struct complex *R_sqrt_22_EPA_low[1] = {R_sqrt_22_EPA_low_tap}; + +struct complex R_sqrt_22_EPA_high_tap[16] = {{0.7179,0.0}, {0.4500,0.0}, {0.4500,0.0}, {0.2821,0.0}, + {0.4500,0.0}, {0.7179,0.0}, {0.2821,0.0}, {0.4500,0.0}, + {0.4500,0.0}, {0.2821,0.0}, {0.7179,0.0}, {0.4500,0.0}, + {0.2821,0.0}, {0.4500,0.0}, {0.4500,0.0}, {0.7179,0.0}}; +struct complex *R_sqrt_22_EPA_high[1] = {R_sqrt_22_EPA_high_tap}; + +struct complex R_sqrt_22_EPA_medium_tap[16] = {{0.8375,0.0}, {0.5249,0.0}, {0.1286,0.0}, {0.0806,0.0}, + {0.5249,0.0}, {0.8375,0.0}, {0.0806,0.0}, {0.1286,0.0}, + {0.1286,0.0}, {0.0806,0.0}, {0.8375,0.0}, {0.5249,0.0}, + {0.0806,0.0}, {0.1286,0.0}, {0.5249,0.0}, {0.8375,0.0}}; +struct complex *R_sqrt_22_EPA_medium[1] = {R_sqrt_22_EPA_medium_tap}; + //Rayleigh1_orth_eff_ch_TM4 @@ -408,6 +427,140 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, } } break; + case EPA_low: + chan_desc->nb_taps = 7; + chan_desc->Td = .410; + chan_desc->channel_length = (int) (2*chan_desc->sampling_rate*chan_desc->Td + 1 + 2/(M_PI*M_PI)*log(4*M_PI*chan_desc->sampling_rate*chan_desc->Td)); + sum_amps = 0; + chan_desc->amps = (double*) malloc(chan_desc->nb_taps*sizeof(double)); + for (i = 0; inb_taps; i++) { + chan_desc->amps[i] = pow(10,.1*epa_amps_dB[i]); + sum_amps += chan_desc->amps[i]; + } + for (i = 0; inb_taps; i++) + chan_desc->amps[i] /= sum_amps; + chan_desc->delays = epa_delays; + chan_desc->ricean_factor = 1; + chan_desc->aoa = 0; + chan_desc->random_aoa = 0; + chan_desc->ch = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*)); + chan_desc->chF = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*)); + chan_desc->a = (struct complex**) malloc(chan_desc->nb_taps*sizeof(struct complex*)); + for (i = 0; ich[i] = (struct complex*) malloc(chan_desc->channel_length * sizeof(struct complex)); + for (i = 0; ichF[i] = (struct complex*) malloc(1200 * sizeof(struct complex)); + for (i = 0; inb_taps; i++) + chan_desc->a[i] = (struct complex*) malloc(nb_tx*nb_rx * sizeof(struct complex)); + if (nb_tx==2 && nb_rx==2) { + chan_desc->R_sqrt = (struct complex**) malloc(chan_desc->nb_taps*sizeof(struct complex**)); + for (i = 0; inb_taps; i++) + chan_desc->R_sqrt[i] = R_sqrt_22_EPA_low[0]; + } + else { + printf("Correlation matrices are implemented for 2 x 2 only"); + } + /*else { + chan_desc->R_sqrt = (struct complex**) malloc(6*sizeof(struct complex**)); + for (i = 0; i<6; i++) { + chan_desc->R_sqrt[i] = (struct complex*) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex)); + for (j = 0; jR_sqrt[i][j].x = 1.0; + chan_desc->R_sqrt[i][j].y = 0.0; + } + LOG_W(OCM,"correlation matrix only implemented for nb_tx==2 and nb_rx==2, using identity\n"); + } + }*/ + break; + case EPA_high: + chan_desc->nb_taps = 7; + chan_desc->Td = .410; + chan_desc->channel_length = (int) (2*chan_desc->sampling_rate*chan_desc->Td + 1 + 2/(M_PI*M_PI)*log(4*M_PI*chan_desc->sampling_rate*chan_desc->Td)); + sum_amps = 0; + chan_desc->amps = (double*) malloc(chan_desc->nb_taps*sizeof(double)); + for (i = 0; inb_taps; i++) { + chan_desc->amps[i] = pow(10,.1*epa_amps_dB[i]); + sum_amps += chan_desc->amps[i]; + } + for (i = 0; inb_taps; i++) + chan_desc->amps[i] /= sum_amps; + chan_desc->delays = epa_delays; + chan_desc->ricean_factor = 1; + chan_desc->aoa = 0; + chan_desc->random_aoa = 0; + chan_desc->ch = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*)); + chan_desc->chF = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*)); + chan_desc->a = (struct complex**) malloc(chan_desc->nb_taps*sizeof(struct complex*)); + for (i = 0; ich[i] = (struct complex*) malloc(chan_desc->channel_length * sizeof(struct complex)); + for (i = 0; ichF[i] = (struct complex*) malloc(1200 * sizeof(struct complex)); + for (i = 0; inb_taps; i++) + chan_desc->a[i] = (struct complex*) malloc(nb_tx*nb_rx * sizeof(struct complex)); + if (nb_tx==2 && nb_rx==2) { + chan_desc->R_sqrt = (struct complex**) malloc(chan_desc->nb_taps*sizeof(struct complex**)); + for (i = 0; inb_taps; i++) + chan_desc->R_sqrt[i] = R_sqrt_22_EPA_high[0]; + } + else { + printf("Correlation matrices are implemented for 2 x 2 only"); + } + /*else { + chan_desc->R_sqrt = (struct complex**) malloc(6*sizeof(struct complex**)); + for (i = 0; i<6; i++) { + chan_desc->R_sqrt[i] = (struct complex*) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex)); + for (j = 0; jR_sqrt[i][j].x = 1.0; + chan_desc->R_sqrt[i][j].y = 0.0; + } + LOG_W(OCM,"correlation matrix only implemented for nb_tx==2 and nb_rx==2, using identity\n"); + } + }*/ + break; + case EPA_medium: + chan_desc->nb_taps = 7; + chan_desc->Td = .410; + chan_desc->channel_length = (int) (2*chan_desc->sampling_rate*chan_desc->Td + 1 + 2/(M_PI*M_PI)*log(4*M_PI*chan_desc->sampling_rate*chan_desc->Td)); + sum_amps = 0; + chan_desc->amps = (double*) malloc(chan_desc->nb_taps*sizeof(double)); + for (i = 0; inb_taps; i++) { + chan_desc->amps[i] = pow(10,.1*epa_amps_dB[i]); + sum_amps += chan_desc->amps[i]; + } + for (i = 0; inb_taps; i++) + chan_desc->amps[i] /= sum_amps; + chan_desc->delays = epa_delays; + chan_desc->ricean_factor = 1; + chan_desc->aoa = 0; + chan_desc->random_aoa = 0; + chan_desc->ch = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*)); + chan_desc->chF = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*)); + chan_desc->a = (struct complex**) malloc(chan_desc->nb_taps*sizeof(struct complex*)); + for (i = 0; ich[i] = (struct complex*) malloc(chan_desc->channel_length * sizeof(struct complex)); + for (i = 0; ichF[i] = (struct complex*) malloc(1200 * sizeof(struct complex)); + for (i = 0; inb_taps; i++) + chan_desc->a[i] = (struct complex*) malloc(nb_tx*nb_rx * sizeof(struct complex)); + if (nb_tx==2 && nb_rx==2) { + chan_desc->R_sqrt = (struct complex**) malloc(chan_desc->nb_taps*sizeof(struct complex**)); + for (i = 0; inb_taps; i++) + chan_desc->R_sqrt[i] = R_sqrt_22_EPA_medium[0]; + } else { + printf("Correlation matrices are implemented for 2 x 2 only"); + } + /*else { + chan_desc->R_sqrt = (struct complex**) malloc(6*sizeof(struct complex**)); + for (i = 0; i<6; i++) { + chan_desc->R_sqrt[i] = (struct complex*) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex)); + for (j = 0; jR_sqrt[i][j].x = 1.0; + chan_desc->R_sqrt[i][j].y = 0.0; + } + LOG_W(OCM,"correlation matrix only implemented for nb_tx==2 and nb_rx==2, using identity\n"); + } + }*/ + break; case EVA: chan_desc->nb_taps = 9; chan_desc->Td = 2.51;