Commit 3521765b authored by lukashov's avatar lukashov

Changes:

1. Fixing a bug in dlsch_channel_level_TM56.
avg128D = _mm_setzero_si128() must be done inside the rx_antennas loop and not before

2. Cleaning up code in dlsch_demodulation.c

3. Offsets for TM5 and TM6 still must be validated.

4. Right now IA and I-UA receivers for TM4 have the same offset -
validate if any additional penalty/gain is needed.

5. Shortened file names in dlsim.c since matlab can read only 63-characters file names.

6. Tested: TM4 U2 -gS perfect CE works fine for EESM and MIESM abstraction (MCS 4 MSE= 0.007 dB on both streams).
parent 80cb1912
......@@ -197,6 +197,10 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
return(-1);
}
}
#ifdef DEBUG_PHY
LOG_D(PHY,"[DLSCH] mimo_mode = %d\n", dlsch0_harq->mimo_mode);
#endif
//printf("rx_pdsch: harq_pid=%d, round=%d\n",harq_pid,round);
......@@ -296,70 +300,35 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
return(-1);
}
/*
// DL power control: Scaling of Channel estimates for PDSCH
dlsch_scale_channel(lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext,
frame_parms,
dlsch_ue,
symbol,
nb_rb);
aatx = frame_parms->nb_antennas_tx_eNB;
aarx = frame_parms->nb_antennas_rx;
if (dlsch0_harq->mimo_mode<LARGE_CDD) {// SISO or ALAMOUTI
dlsch_scale_channel(lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext,
frame_parms,
dlsch_ue,
symbol,
nb_rb);
if (first_symbol_flag==1) {
if (first_symbol_flag==1) {
dlsch_channel_level(lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext,
frame_parms,
avg,
symbol,
nb_rb);
#ifdef DEBUG_PHY
LOG_D(PHY,"[DLSCH] avg[0] %d\n",avg[0]);
#endif
// the channel gain should be the effective gain of precoding + channel
// however lets be more conservative and set maxh = nb_tx*nb_rx*max(h_i)
// in case of precoding we add an additional factor of two for the precoding gain
avgs = 0;
for (aatx=0;aatx<frame_parms->nb_antennas_tx_eNB;aatx++)
for (aarx=0;aarx<frame_parms->nb_antennas_rx;aarx++)
avgs = cmax(avgs,avg[(aatx<<1)+aarx]);
// avgs = cmax(avgs,avg[(aarx<<1)+aatx]);
lte_ue_pdsch_vars[eNB_id]->log2_maxh = (log2_approx(avgs)/2) + interf_unaw_shift_tm1_mcs[dlsch0_harq->mcs];
// printf(" TM1 shift = %d\n",interf_unaw_shift_tm1_mcs[dlsch0_harq->mcs]);
// + log2_approx(frame_parms->nb_antennas_tx_eNB-1) //-1 because log2_approx counts the number of bits
// + log2_approx(frame_parms->nb_antennas_rx-1);
if ((dlsch0_harq->mimo_mode>=UNIFORM_PRECODING11) &&
(dlsch0_harq->mimo_mode< DUALSTREAM_UNIFORM_PRECODING1) &&
(dlsch0_harq->dl_power_off==1)) // we are in TM 6
lte_ue_pdsch_vars[eNB_id]->log2_maxh++;
//printf("log2_maxh =%d\n",lte_ue_pdsch_vars[eNB_id]->log2_maxh);
// this version here applies the factor .5 also to the extra terms. however, it does not work so well as the one above
/* K = Nb_rx in TM1
Nb_tx*Nb_rx in TM2,4,5
Nb_tx^2*Nb_rx in TM6 */
/*
K = frame_parms->nb_antennas_rx*frame_parms->nb_antennas_tx_eNB; //that also covers TM1 since Nb_tx=1
if ((dlsch0_harq->mimo_mode>=UNIFORM_PRECODING11) &&
(dlsch0_harq->mimo_mode< DUALSTREAM_UNIFORM_PRECODING1) &&
(dlsch0_harq->dl_power_off==1)) // we are in TM 6
K *= frame_parms->nb_antennas_tx_eNB;
lte_ue_pdsch_vars[eNB_id]->log2_maxh = (log2_approx(avgs)/2) + interf_unaw_shift_tm1_mcs[dlsch0_harq->mcs];
// printf(" TM1 shift = %d\n",interf_unaw_shift_tm1_mcs[dlsch0_harq->mcs]);
lte_ue_pdsch_vars[eNB_id]->log2_maxh = (log2_approx(K*avgs)/2);
*/
#ifdef DEBUG_PHY
LOG_D(PHY,"[DLSCH] log2_maxh = %d (%d,%d)\n",lte_ue_pdsch_vars[eNB_id]->log2_maxh,avg[0],avgs);
LOG_D(PHY,"[DLSCH] mimo_mode = %d\n", dlsch0_harq->mimo_mode);
#endif
// }
aatx = frame_parms->nb_antennas_tx_eNB;
aarx = frame_parms->nb_antennas_rx;
if (dlsch0_harq->mimo_mode<LARGE_CDD) {// SISO or ALAMOUTI
}
dlsch_channel_compensation(lte_ue_pdsch_vars[eNB_id]->rxdataF_ext,
lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext,
......@@ -419,14 +388,12 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
// LOG_I(PHY,"Running PDSCH RX for TM3\n");
if (frame_parms->nb_antennas_tx_eNB == 2) {
// scaling interfering channel (following for TM56)
/*dlsch_scale_channel(lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext,
dlsch_scale_channel(lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext,
frame_parms,
dlsch_ue,
symbol,
nb_rb);*/
nb_rb);
if (first_symbol_flag==1) {
......@@ -441,46 +408,30 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
dlsch0_harq->mimo_mode);
if (rx_type>rx_standard) {
// !!!!! Right now in testing mode for -gS channel ONLY. We investigate if any
// additional gain/penalty needs to be introduced in comparison with I-UA receiver
// by comparing performances if run with -u2 and -u0.
// this is valid only if same mcs are used. We calibrate for mcs 4. Best shift value is 13.
// MCS-dependent LUT will be introduced.
if (rx_type>rx_standard) {
// Shifts are needed to avoid tails in SNR/BLER curves.
// LUT will be introduced with mcs-dependent shift
avg_0[0] = (log2_approx(avg_0[0])/2) -13 + interf_unaw_shift;
avg_1[0] = (log2_approx(avg_1[0])/2) -13 + interf_unaw_shift;
lte_ue_pdsch_vars[eNB_id]->log2_maxh0 = cmax(avg_0[0],0);
lte_ue_pdsch_vars[eNB_id]->log2_maxh1 = cmax(avg_1[0],0);
//printf("log2_maxh0 = %d\n", lte_ue_pdsch_vars[eNB_id]->log2_maxh0);
//printf("log2_maxh1 = %d\n", lte_ue_pdsch_vars[eNB_id]->log2_maxh1);
//avg[0] = log2_approx(avg[0]) - 13 + offset_mumimo_llr_drange[dlsch0_harq->mcs][(dlsch1_harq->Qm>>1)-1];
//lte_ue_pdsch_vars[eNB_id]->log2_maxh0 = (log2_approx(avg[0])/2) +interf_unaw_shift_tm4_mcs[dlsch0_harq->mcs];//+offset_mumimo_llr_drange[dlsch0_harq->mcs][(get_Qm(dlsch1_harq->mcs)>>1)-1];
//lte_ue_pdsch_vars[eNB_id]->log2_maxh1 = (log2_approx(avg[0])/2) +interf_unaw_shift_tm4_mcs[dlsch1_harq->mcs];//+offset_mumimo_llr_drange[dlsch1_harq->mcs][(get_Qm(dlsch0_harq->mcs)>>1)-1];
//printf("TM4 I-A shift layer1 = %d\n",interf_unaw_shift_tm4_mcs[dlsch0_harq->mcs]);
//printf("TM4 I-A shift layer2 = %dlsch_channel_level_TM34d\n",interf_unaw_shift_tm4_mcs[dlsch1_harq->mcs] );
//printf("TM4 I-A log2_maxh0 = %d\n", lte_ue_pdsch_vars[eNB_id]->log2_maxh0);
//printf("TM4 I-A log2_maxh1 = %d\n", lte_ue_pdsch_vars[eNB_id]->log2_maxh1);
}
}
else {
// to avoid tails in SNR/BLER curves. -13 is needed to make shift a positive number.
// this is valid only if same mcs are used. We calibrate for mcs 4. Best shift value is 13.
// MCS-dependent LUT will be introduced.
// Shifts are needed to avoid tails in SNR/BLER curves.
// LUT will be introduced with mcs-dependent shift
avg_0[0] = (log2_approx(avg_0[0])/2) - 13 + interf_unaw_shift;
avg_1[0] = (log2_approx(avg_1[0])/2) - 13 + interf_unaw_shift;
lte_ue_pdsch_vars[eNB_id]->log2_maxh0 = cmax(avg_0[0],0);
lte_ue_pdsch_vars[eNB_id]->log2_maxh1 = cmax(avg_1[0],0);
//printf("log2_maxh0 = %d\n", lte_ue_pdsch_vars[eNB_id]->log2_maxh0);
//printf("log2_maxh1 = %d\n", lte_ue_pdsch_vars[eNB_id]->log2_maxh1);
}
//printf("TM4 I-UA log2_maxh0 = %d\n", lte_ue_pdsch_vars[eNB_id]->log2_maxh0);
//printf("TM4 I-UA log2_maxh1 = %d\n", lte_ue_pdsch_vars[eNB_id]->log2_maxh1);
}
//printf("TM4 I-UA shift = %d\n",interf_unaw_shift);
//lte_ue_pdsch_vars[eNB_id]->log2_maxh0 = (log2_approx(avg[0])/2) +interf_unaw_shift_tm4_mcs[dlsch0_harq->mcs];
//lte_ue_pdsch_vars[eNB_id]->log2_maxh1 = (log2_approx(avg[0])/2) +interf_unaw_shift_tm4_mcs[dlsch1_harq->mcs];
//printf("TM4 I-UA shift layer1 = %d\n",interf_unaw_shift_tm4_mcs[dlsch0_harq->mcs]);
//printf("TM4 I-UA shift layer2 = %d\n",interf_unaw_shift_tm4_mcs[dlsch1_harq->mcs]);
}
}
dlsch_channel_compensation_TM34(frame_parms,
lte_ue_pdsch_vars[eNB_id],
......@@ -633,7 +584,40 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
lte_ue_pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round],
lte_ue_pdsch_vars[eNB_id]->log2_maxh);
} else {
}
else {
dlsch_scale_channel(lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext,
frame_parms,
dlsch_ue,
symbol,
nb_rb);
if (first_symbol_flag==1) {
dlsch_channel_level_TM56(lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext,
frame_parms,
lte_ue_pdsch_vars[eNB_id]->pmi_ext,
avg,
symbol,
nb_rb);
avgs = 0;
for (aatx=0;aatx<frame_parms->nb_antennas_tx_eNB;aatx++)
for (aarx=0;aarx<frame_parms->nb_antennas_rx;aarx++)
avgs = cmax(avgs,avg[(aatx<<1)+aarx]);
lte_ue_pdsch_vars[eNB_id]->log2_maxh = (log2_approx(avgs)/2) + interf_unaw_shift_tm1_mcs[dlsch0_harq->mcs];
if ((dlsch0_harq->mimo_mode>=UNIFORM_PRECODING11) &&
(dlsch0_harq->mimo_mode< DUALSTREAM_UNIFORM_PRECODING1) &&
(dlsch0_harq->dl_power_off==1)) // we are in TM 6
lte_ue_pdsch_vars[eNB_id]->log2_maxh++;
// printf(" TM6 log2_maxh = %d\n",lte_ue_pdsch_vars[eNB_id]->log2_maxh);
}
dlsch_channel_compensation_TM56(lte_ue_pdsch_vars[eNB_id]->rxdataF_ext,
lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext,
lte_ue_pdsch_vars[eNB_id]->dl_ch_mag0,
......@@ -3313,8 +3297,6 @@ void dlsch_channel_level_TM56(int **dl_ch_estimates_ext,
symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol;
//clear average level
avg128D = _mm_setzero_si128();
avg[0] = 0;
avg[1] = 0;
// 5 is always a symbol with no pilots for both normal and extended prefix
......@@ -3329,7 +3311,9 @@ void dlsch_channel_level_TM56(int **dl_ch_estimates_ext,
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
dl_ch0_128 = (__m128i *)&dl_ch_estimates_ext[aarx][symbol*frame_parms->N_RB_DL*12];
dl_ch1_128 = (__m128i *)&dl_ch_estimates_ext[2+aarx][symbol*frame_parms->N_RB_DL*12];
avg128D = _mm_setzero_si128();
for (rb=0; rb<nb_rb; rb++) {
dl_ch0_128_tmp = _mm_load_si128(&dl_ch0_128[0]);
......
......@@ -790,14 +790,14 @@ int main(int argc, char **argv)
sprintf(bler_fname,"bler_tx%d_rec%d_chan%d_nrx%d_mcs%d_mcsi%d_u%d_imod%d.csv",transmission_mode,rx_type,channel_model,n_rx,mcs1,mcs_i,rx_type,i_mod);
else if (abstx == 1)
if (perfect_ce==1)
sprintf(bler_fname,"bler_tx%d_rec%d_chan%d_%d_nrx%d_mcs%d_mcsi%d_ab_perf_ce_sh%d_div2.csv",transmission_mode,rx_type,channel_model,n_frames, n_rx,mcs1, mcs2,interf_unaw_shift );
sprintf(bler_fname,"bler_tx%d_r%d_ch%d_%d_nrx%d_mcs%d_mcsi%d_ab_pce_sh%d_d2.csv",transmission_mode,rx_type,channel_model,n_frames, n_rx,mcs1, mcs2,interf_unaw_shift );
else
sprintf(bler_fname,"bler_tx%d_rec%d_chan%d_%d_nrx%d_mcs%d_mcsi%d_ab_sh%d_div2.csv",transmission_mode,rx_type,channel_model, n_frames, n_rx,mcs1, mcs2,interf_unaw_shift );
sprintf(bler_fname,"bler_tx%d_r%d_ch%d_%d_nrx%d_mcs%d_mcsi%d_ab_sh%d_d2.csv",transmission_mode,rx_type,channel_model, n_frames, n_rx,mcs1, mcs2,interf_unaw_shift );
else //abstx=0
if (perfect_ce==1)
sprintf(bler_fname,"bler_tx%d_rec%d_chan%d_%d_nrx%d_mcs%d_mcsi%d_perf_ce_sh%d_div2.csv",transmission_mode,rx_type,channel_model,n_frames, n_rx,mcs1, mcs2, interf_unaw_shift);
sprintf(bler_fname,"bler_tx%d_r%d_ch%d_%d_nrx%d_mcs%d_mcsi%d_pce_sh%d_d2.csv",transmission_mode,rx_type,channel_model,n_frames, n_rx,mcs1, mcs2, interf_unaw_shift);
else
sprintf(bler_fname,"bler_tx%d_rec%d_chan%d_%d_nrx%d_mcs%d_mcsi%d_sh%d_div2.csv",transmission_mode,rx_type,channel_model,n_frames,n_rx,mcs1, mcs2, interf_unaw_shift);
sprintf(bler_fname,"bler_tx%d_r%d_ch%d_%d_nrx%d_mcs%d_mcsi%d_sh%d_d2.csv",transmission_mode,rx_type,channel_model,n_frames,n_rx,mcs1, mcs2, interf_unaw_shift);
bler_fd = fopen(bler_fname,"w");
if (bler_fd==NULL) {
......@@ -833,11 +833,10 @@ int main(int argc, char **argv)
else
if (perfect_ce==1)
sprintf(csv_fname,"dataout_tx%d_rec%d_mcs%d_mcsi%d_chan%d_ns%d_R%d_ab_perf_ce_sh%d_div2_%d.m",transmission_mode,rx_type,mcs1,mcs2,channel_model,n_frames,num_rounds, interf_unaw_shift, n_ch_rlz);
sprintf(csv_fname,"dout_tx%d_r%d_mcs%d_mcsi%d_ch%d_ns%d_R%d_ab_pce_sh%d_d2_%d.m",transmission_mode,rx_type,mcs1,mcs2,channel_model,n_frames,num_rounds, interf_unaw_shift, n_ch_rlz);
else
sprintf(csv_fname,"dataout_tx%d_rec%d_mcs%d_mcsi%d_chan%d_ns%d_R%d_ab_sh%d_div2_%d.m",transmission_mode,rx_type,mcs1,mcs2,channel_model,n_frames,num_rounds, interf_unaw_shift, n_ch_rlz);
sprintf(csv_fname,"dout_tx%d_r%d_mcs%d_mcsi%d_ch%d_ns%d_R%d_ab_sh%d_d2_%d.m",transmission_mode,rx_type,mcs1,mcs2,channel_model,n_frames,num_rounds, interf_unaw_shift, n_ch_rlz);
// sprintf(csv_fname,"dataout_tx%d_mcs%d_mcs_interf%d_chan%d_nsimus%d_R%d_abstr_old.m",transmission_mode,mcs1,mcs2,channel_model,n_frames,num_rounds);
csv_fd = fopen(csv_fname,"w");
fprintf(csv_fd,"data_all%d=[",mcs1);
if (csv_fd==NULL) {
......
......@@ -308,8 +308,8 @@ double pbch_bler(double sinr)
//printf ("sinr %f bler %f\n",sinr,bler);
return(bler);
}
*/
}*/
#include <math.h>
#include <cblas.h>
#include <stdio.h>
......
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