diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools.c b/openair1/PHY/LTE_TRANSPORT/dci_tools.c index 0f489742971931f02f38bb8460e22bfa75a3840c..c2fb90585fdd78dc94f0a7db1b3dfa32d006f2c4 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/dci_tools.c @@ -2563,138 +2563,59 @@ uint16_t quantize_wideband_pmi(PHY_MEASUREMENTS *meas,uint8_t eNB_id) { return(3+(sinr>>1)); } */ -// sinr => MCS => CQI -// 15.5 => 25 => 12 -// 15 => 24 => 12 -// 14 => 23 => 11 -// 13 => 22 => 11 -// 12 => 21 => 10 -// 11 => 20 => 10 -// 10 => 19 => 9 -// 9 => 18 => 9 -// 8.5 => 17 => 8 -// 8 => 16 => 8 -// 7 => 15 => 7 -// 6 => 14 => 7 -// 5 => 13 => 6 -// 4.5 => 12 => 6 -// 4 => 11 => 5 -// 3 => 10 => 5 -// 2.5 => 9 => 4 -// 1.5 => 8 => 4 -// 1 => 7 => 3 -// 0 => 6 => 3 -// -.5 => 5 => 2 -// -1.5 => 4 => 2 -// -2.5 => 3 => 1 -// -3.5 => 2 => 1 -// -4 => 1 => 0 -// -4.5 => 0 => 0 uint8_t sinr2cqi(int sinr,uint8_t trans_mode) { // int flag_LA=0; - if(flag_LA==0){ + +if(flag_LA==0){ // Ideal Channel Estimation - if (sinr<=-8) + if (sinr<=-4.89) return(0); - else if (sinr < -6) + else if (sinr < -3.53) return(3); - else if (sinr <= -4) + else if (sinr <= -1.93) return(4); - else if (sinr <= -2) + else if (sinr <= -0.43) return(5); - else if (sinr <= 0) + else if (sinr <= 1.11) return(6); - else if (sinr <= 2) + else if (sinr <= 3.26) return(7); - else if (sinr <= 4) + else if (sinr <= 5) return(8); - else if (sinr <= 6.5) + else if (sinr <= 7) return(9); - else if (sinr <= 7.5) + else if (sinr <= 9) return(10); - else if (sinr <= 9.5) - return(11); else if (sinr <= 11) + return(11); + else if (sinr <= 13) return(12); - else if (sinr <= 14) + else if (sinr <= 15.5) return(13); - else if (sinr <= 16) + else if (sinr <= 17.5) return(14); - else if (sinr > 16) + else if (sinr > 19.5) return(15); } - else{ - if(trans_mode==1 || trans_mode ==2){ - if (sinr<-6) - return(0); - else if (sinr < -5.5) - return(1); - else if (sinr <= -4.89) - return(2); - else if (sinr <= -3.53) - return(3); - else if (sinr <= -1.93) - return(4); - else if (sinr <= -0.43) - return(5); - else if (sinr <= 1.11) - return(6); - else if (sinr <= 3.26) - return(7); - else if (sinr <= 5) - return(8); - else if (sinr <= 6.94) - return(9); - else if (sinr <= 8.92) - return(10); - else if (sinr <= 10.87) - return(11); - else if (sinr <= 12.45) - return(12); - else if (sinr <= 15.25) - return(13); - else if (sinr <= 17.11) - return(14); - else return(15); - } else - if(trans_mode==5 || trans_mode==6){ - if (sinr<=-8) - return(0); - else if (sinr < -7) - return(1); - else if (sinr <= -6) - return(2); - else if (sinr <= -5.25) - return(3); - else if (sinr <= -3.95) - return(4); - else if (sinr <= -2.60) - return(5); - else if (sinr <= -1.10) - return(6); - else if (sinr <= 0.87) - return(7); - else if (sinr <= 2.59) - return(8); - else if (sinr <= 4.79) - return(9); - else if (sinr <= 6.71) - return(10); - else if (sinr <= 8) - return(11); - else if (sinr <= 10.59) - return(12); - else if (sinr <= 13.28) - return(13); - else if (sinr <= 15.74) - return(14); - else return(15); - } - } - return(0); + else{ + int h=0; + int trans_mode_tmp; + if (trans_mode ==5) + trans_mode_tmp=2; + else + if(trans_mode ==6) + trans_mode_tmp=3; + else + trans_mode_tmp = trans_mode-1; + + for(h=0;h<16;h++){ + if(sinr<=sinr_to_cqi[trans_mode_tmp][h]) + return(h); + } + } + return(0); } - //uint32_t fill_subband_cqi(PHY_MEASUREMENTS *meas,uint8_t eNB_id) { // // uint8_t i; @@ -3667,7 +3588,11 @@ double sinr_eff_cqi_calc(PHY_VARS_UE *phy_vars_ue, u8 eNB_id){ // LTE_UE_ULSCH_t *ulsch = phy_vars_ue->ulsch_ue[eNB_id]; //for the calculation of SINR_eff for CQI calculation int count,a_rx,a_tx; - double abs_channel,channelx, channely,channelx_i, channely_i; + double abs_channel=0; + double channelx=0; + double channely=0; + double channelx_i=0; + double channely_i=0; u16 q = quantize_subband_pmi(meas,eNB_id); u8 qq; @@ -3675,11 +3600,11 @@ double sinr_eff_cqi_calc(PHY_VARS_UE *phy_vars_ue, u8 eNB_id){ case 1: for (count=0;count<frame_parms->N_RB_DL*12;count++) { - for(a_tx=0;a_tx<frame_parms->nb_antennas_tx;a_tx++) + for(a_tx=0;a_tx<frame_parms->nb_antennas_tx_eNB;a_tx++) { for (a_rx=0;a_rx<frame_parms->nb_antennas_rx;a_rx++) { - s_dB[count] = 10*log10(pow(((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2],2) + pow(((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2],2)) - meas->n0_power_avg_dB; + s_dB[count] = 10*log10(pow(((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2],2) + pow(((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2],2)) - meas->n0_power_avg_dB; } } } @@ -3687,11 +3612,11 @@ double sinr_eff_cqi_calc(PHY_VARS_UE *phy_vars_ue, u8 eNB_id){ case 2: for (count=0;count<frame_parms->N_RB_DL*12;count++) {abs_channel=0; - for(a_tx=0;a_tx<frame_parms->nb_antennas_tx;a_tx++) + for(a_tx=0;a_tx<frame_parms->nb_antennas_tx_eNB;a_tx++) { for (a_rx=0;a_rx<frame_parms->nb_antennas_rx;a_rx++) { - abs_channel += (pow(((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2],2) + pow(((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2],2)); + abs_channel += (pow(((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2],2) + pow(((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2],2)); } } s_dB[count] = 10*log10(abs_channel/2) - meas->n0_power_avg_dB; @@ -3705,69 +3630,69 @@ double sinr_eff_cqi_calc(PHY_VARS_UE *phy_vars_ue, u8 eNB_id){ channely_i=0; qq = (q>>(((count/12)>>2)<<1))&3; //printf("pmi_alloc %d: rb %d, pmi %d\n",q,count/12,qq); - for(a_tx=0;a_tx<frame_parms->nb_antennas_tx;a_tx++) + for(a_tx=0;a_tx<frame_parms->nb_antennas_tx_eNB;a_tx++) { for (a_rx=0;a_rx<frame_parms->nb_antennas_rx;a_rx++) { switch(qq){ case 0: if (channelx==0 || channely==0){ - channelx = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; - channely = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; - channelx_i = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; - channely_i = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; + channelx = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; + channely = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; + channelx_i = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; + channely_i = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; } else { - channelx += ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; - channely += ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; - channelx_i -= ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; - channely_i -= ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; + channelx += ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; + channely += ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; + channelx_i -= ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; + channely_i -= ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; } break; case 1: if (channelx==0 || channely==0){ - channelx = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; - channely = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; - channelx_i = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; - channely_i = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; + channelx = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; + channely = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; + channelx_i = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; + channely_i = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; } else { - channelx -= ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; - channely -= ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; - channelx_i += ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; - channely_i += ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; + channelx -= ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; + channely -= ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; + channelx_i += ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; + channely_i += ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; } break; case 2: if (channelx==0 || channely==0){ - channelx = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; - channely = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; - channelx_i = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; - channely_i = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; + channelx = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; + channely = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; + channelx_i = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; + channely_i = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; } else { - channelx -= ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; - channely += ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; - channelx_i += ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; - channely_i -= ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; + channelx -= ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; + channely += ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; + channelx_i += ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; + channely_i -= ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; } break; case 3: if (channelx==0 || channely==0){ - channelx = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; - channely = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; - channelx_i = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; - channely_i = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; + channelx = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; + channely = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; + channelx_i = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; + channely_i = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; } else { - channelx += ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; - channely -= ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; - channelx_i -= ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; - channely_i += ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; + channelx += ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; + channely -= ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; + channelx_i -= ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; + channely_i += ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; } break; default: @@ -3786,53 +3711,53 @@ double sinr_eff_cqi_calc(PHY_VARS_UE *phy_vars_ue, u8 eNB_id){ channely=0; qq = (q>>(((count/12)>>2)<<1))&3; //printf("pmi_alloc %d: rb %d, pmi %d\n",q,count/12,qq); - for(a_tx=0;a_tx<frame_parms->nb_antennas_tx;a_tx++) + for(a_tx=0;a_tx<frame_parms->nb_antennas_tx_eNB;a_tx++) { for (a_rx=0;a_rx<frame_parms->nb_antennas_rx;a_rx++) { switch(qq){ case 0: if (channelx==0 || channely==0){ - channelx = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; - channely = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; + channelx = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; + channely = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; } else { - channelx += ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; - channely += ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; + channelx += ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; + channely += ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; } break; case 1: if (channelx==0 || channely==0){ - channelx = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; - channely = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; + channelx = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; + channely = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; } else { - channelx -= ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; - channely -= ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; + channelx -= ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; + channely -= ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; } break; case 2: if (channelx==0 || channely==0){ - channelx = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; - channely = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; + channelx = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; + channely = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; } else { - channelx -= ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; - channely += ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; + channelx -= ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; + channely += ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; } break; case 3: if (channelx==0 || channely==0){ - channelx = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; - channely = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; + channelx = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; + channely = ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; } else { - channelx += ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; - channely -= ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]; + channelx += ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; + channely -= ((s16 *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; } break; default: @@ -3849,13 +3774,18 @@ double sinr_eff_cqi_calc(PHY_VARS_UE *phy_vars_ue, u8 eNB_id){ msg("Problem in SINR Calculation for CQI \n"); break; } - - - int ii; + int ii; double sinr_eff = 0; - double sinr_eff_qpsk,sinr_eff_qam16,sinr_eff_qam64; + double sinr_eff_qpsk=0; + double sinr_eff_qam16=0; + double sinr_eff_qam64=0; double x = 0; - double I_qpsk, I_qpsk_avg,I_qam16, I_qam16_avg,I_qam64, I_qam64_avg; + double I_qpsk=0; + double I_qam16=0; + double I_qam64=0; + double I_qpsk_avg=0; + double I_qam16_avg=0; + double I_qam64_avg=0; double qpsk_max=12.2; double qam16_max=19.2; double qam64_max=25.2; @@ -3906,7 +3836,7 @@ double sinr_eff_cqi_calc(PHY_VARS_UE *phy_vars_ue, u8 eNB_id){ sinr_eff_qam64 = (p_qam64[0]*pow(I_qam64_avg,7) + p_qam64[1]*pow(I_qam64_avg,6) + p_qam64[2]*pow(I_qam64_avg,5) + p_qam64[3]*pow(I_qam64_avg,4) + p_qam64[4]*pow(I_qam64_avg,3) + p_qam64[5]*pow(I_qam64_avg,2) + p_qam64[6]*I_qam64_avg + p_qam64[7]); sinr_eff = cmax3(sinr_eff_qpsk,sinr_eff_qam16,sinr_eff_qam64); - //printf("SINR_Eff = %e\n",sinr_eff); + printf("SINR_Eff = %e\n",sinr_eff); return(sinr_eff); } diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c b/openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c index a661519aff6009451282e4fa3fb89bb08b2e8676..be0cbe12d9eeac004e843fee98a8a7b6890e7d8d 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c @@ -693,7 +693,7 @@ uint32_t dlsch_decoding_emul(PHY_VARS_UE *phy_vars_ue, LOG_T(PHY,"\n current harq pid is %d ue id %d \n", harq_pid, ue_id); #endif - if (dlsch_abstraction_EESM(phy_vars_ue->sinr_dB, phy_vars_ue->transmission_mode[eNB_id], dlsch_eNB->rb_alloc, dlsch_eNB->harq_processes[harq_pid]->mcs,PHY_vars_eNB_g[eNB_id]->mu_mimo_mode[ue_id].dl_pow_off) == 1) { + if (dlsch_abstraction_MIESM(phy_vars_ue->sinr_dB, phy_vars_ue->transmission_mode[eNB_id], dlsch_eNB->rb_alloc, dlsch_eNB->harq_processes[harq_pid]->mcs,PHY_vars_eNB_g[eNB_id]->mu_mimo_mode[ue_id].dl_pow_off) == 1) { // reset HARQ dlsch_ue->harq_processes[harq_pid]->status = SCH_IDLE; dlsch_ue->harq_processes[harq_pid]->round = 0; diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c index c2c3add4e72515e2825580ca95e3835d64036aca..503b75597685e7a82b70bf9173ef9f4d64f7551e 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c @@ -356,7 +356,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, frame_parms, dlsch_ue, symbol, - nb_rb); + nb_rb); /* compute new log2_maxh for effective channel */ if (first_symbol_flag==1) { diff --git a/openair1/PHY/extern.h b/openair1/PHY/extern.h index 17ffbf5f544c49de30f483e4e542f27915142b70..aec88c566f78f78ea343dc25e30b969a700e2b94 100755 --- a/openair1/PHY/extern.h +++ b/openair1/PHY/extern.h @@ -62,6 +62,8 @@ extern int flag_LA; extern double sinr_bler_map[MCS_COUNT][2][20]; extern double sinr_bler_map_up[MCS_COUNT][2][16]; extern int table_length[MCS_COUNT]; +extern double sinr_to_cqi[4][16]; +extern int cqi_to_mcs[16]; //for MU-MIMO abstraction using MIESM //this 2D arrarays contains SINR, MI and RBIR in rows 1, 2, and 3 respectively diff --git a/openair1/PHY/vars.h b/openair1/PHY/vars.h index cd1aba925702366703d6b52b558a078e3d2f01c1..03f91963daffcf17a2f7ec44ac2a8caa0b04ba7e 100755 --- a/openair1/PHY/vars.h +++ b/openair1/PHY/vars.h @@ -80,6 +80,14 @@ double MI_map_4qam[3][162]; double MI_map_16qam[3][197]; double MI_map_64qam[3][227]; +// here the first index is for transmission mode 1, 2, 5 and 6 whereas the second index is for the 16 sinr vaues corresponding to 16 CQIs +double sinr_to_cqi[4][16]={ {-2.5051, -2.5051, -1.7451, -0.3655, 1.0812, 2.4012, 3.6849, 6.6754, 8.3885, 8.7970, 12.0437, 14.4709, 15.7281, 17.2424, 17.2424, 17.2424}, + {-2.2360, -2.2360, -1.3919, -0.0218, 1.5319, 2.9574, 4.3234, 6.3387, 8.9879, 9.5096, 12.6609, 14.0116, 16.4984, 18.1572, 18.1572, 18.1572}, + {-1, -1.0000, -0.4198, -0.0140, 1.0362, 2.3520, 3.5793, 6.1136, 8.4836, 9.0858, 12.4723, 13.9128, 16.2054, 17.7392, 17.7392, 17.7392}, + { -4.1057, -4.1057, -3.3768, -2.2916, -1.1392, 0.1236, 1.2849, 3.1933, 5.9298, 6.4052, 9.6245, 10.9414, 13.5166, 14.9545, 14.9545, 14.9545} }; + +int cqi_to_mcs[16]={0, 0, 1, 3, 5, 7, 9, 13, 15, 16, 20, 23, 25, 27, 27, 27}; + //for SNR to MI conversion 7 th order Polynomial coeff double q_qam16[8]={3.21151853033897e-10,5.55435952230651e-09,-2.30760065362117e-07,-6.25587743817859e-06,4.62251036452795e-06,0.00224150813158937,0.0393723140344367,0.245486379182639}; double q_qpsk[8]={1.94491167814437e-09,8.40494123817774e-08,4.75527131198034e-07,-2.48946285301621e-05,-0.000347614016158364,0.00209252225437100,0.0742986115462510,0.488297879889425}; @@ -90,17 +98,26 @@ double p_qpsk[8]= {5982.42405670359,-21568.1135917693,31293.9987036905,-23394.67 double p_qam16[8]={7862.12690694170,-28510.3207048338,41542.2150287122,-31088.3036957379,12690.1982361016,-2785.66604739984,326.595462489375,-18.9911849872089}; double p_qam64[8]={8832.57933013696,-32119.1802555952,46914.2578990397,-35163.8150557183,14343.7419388853,-3126.61025510092,360.954930562237,-18.0358548533343}; -double beta1_dlsch_MI[6][MCS_COUNT] = { {1.17, 1.11, 1.04, 1.05, 1.09, 1.09, 1.10, 1.10, 1.09, 1.03, 1.04, 1.04, 1.05, 1.07, 1.07, 1.06, 1, 1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1},{1.808065416202085, 1.754544945430673,1.902272019362616, 1.790054645392961, 1.563204092967629, 1.585258289348813, 1.579349443720310, 1.570650121437345, 1.545055626608596, 1.362229442426877, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33, 1,1,1,1,1,1,1},{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}}; -//double beta1_dlsch_MI[6][28] = { {1.17, 1.11, 1.04, 1.05, 1.09, 1.09, 1.10, 1.10, 1.09, 1.03, 1.04, 1.04, 1.05, 1.07, 1.07, 1.06, 1, 1,1,1,1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1,1,1,1,1},{1.808065416202085, 1.754544945430673,1.902272019362616, 1.790054645392961, 1.563204092967629, 1.585258289348813, 1.579349443720310, 1.570650121437345, 1.545055626608596, 1.362229442426877, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33, 1,1,1,1,1,1,1,1,1,1,1},{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1,1,1,1,1}}; -double beta2_dlsch_MI[6][MCS_COUNT] = { {1.17, 1.11, 1.04, 1.05, 1.09, 1.09, 1.10, 1.10, 1.09, 1.03, 1.04, 1.04, 1.05, 1.07, 1.07, 1.06, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1},{1.079518113138858, 1.105622953570353, 1.031337449900606, 1.073342032668810, 1.242636589110353, 1.255054927783647, 1.291463834317768, 1.317048698347491, 1.354485054187984, 0.338534029291017, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33,1, 1,1,1,1,1,1},{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}}; -//double beta2_dlsch_MI[6][28] = { {1.17, 1.11, 1.04, 1.05, 1.09, 1.09, 1.10, 1.10, 1.09, 1.03, 1.04, 1.04, 1.05, 1.07, 1.07, 1.06, 1, 1,1,1,1,1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1,1,1,1,1}, {1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1,1,1,1}, {1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1,1,1,1},{1.079518113138858, 1.105622953570353, 1.031337449900606, 1.073342032668810, 1.242636589110353, 1.255054927783647, 1.291463834317768, 1.317048698347491, 1.354485054187984, 0.338534029291017, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33,1, 1,1,1,1,1,1,1,1,1,1},{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1,1,1,1,1}}; +// ideal CE MIESM + +double beta1_dlsch_MI[6][MCS_COUNT] = { {1.1188, 0.3720, 0.3755, 0.9453, 0.5799, 0.5256, 0.5485, 0.5340, 0.5165, 0.5300, 0.6594, 0.5962, 0.4884, 0.4927, 0.3687, 0.4614, 0.4081, 0.2639,0.2935,0.2520,0.3709,0.2906,0.2612,0.2390}, {0.7138, 0.5533, 0.5533, 0.4828, 0.4998, 0.4843, 0.4942, 0.5323, 0.5142, 0.4756, 0.5792, 0.4167, 0.4445, 0.3942, 0.3789, 0.2756, 0.4456, 0.1650, 0.2254, 0.2353, 0.2097,0.2517,0.3242,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1},{1.808065416202085, 1.754544945430673,1.902272019362616, 1.790054645392961, 1.563204092967629, 1.585258289348813, 1.579349443720310, 1.570650121437345, 1.545055626608596, 1.362229442426877, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33, 1,1,1,1,1,1,1},{0.7146, 0.4789, 0.5392, 0.5556, 0.4975, 0.4847, 0.4691, 0.5261, 0.5278, 0.4962, 0.4468, 0.4113, 0.4622, 0.4609, 0.3946, 0.3991, 0.3532, 0.2439, 0.1898, 0.2929, 0.2712, 0.3367, 0.3591, 0.2571}}; +double beta2_dlsch_MI[6][MCS_COUNT] = { {1.1293, 0.3707, 0.3722, 0.9310, 0.5808, 0.5265, 0.5404, 0.5279, 0.5210, 0.5226, 0.6438, 0.5827, 0.4804, 0.4830, 0.3638, 0.4506, 0.4107, 0.2547, 0.2797, 0.2413, 0.3351, 0.2750, 0.2568, 0.2273}, {0.7028, 0.5503, 0.5503, 0.4815, 0.5006, 0.4764, 0.4810, 0.5124, 0.4964, 0.4485, 0.5497, 0.3971, 0.4239, 0.3701, 0.3494, 0.2630, 0.4053, 0.1505, 0.2001,0.2024,0.1788,0.2124,0.2668,1}, {1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1},{1.079518113138858, 1.105622953570353, 1.031337449900606, 1.073342032668810, 1.242636589110353, 1.255054927783647, 1.291463834317768, 1.317048698347491, 1.354485054187984, 0.338534029291017, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33,1, 1,1,1,1,1,1},{0.6980, 0.4694, 0.5379, 0.5483, 0.4982, 0.4737, 0.4611, 0.5051, 0.5020, 0.4672, 0.4357, 0.3957, 0.4389, 0.4344, 0.3645, 0.3661, 0.3301, 0.2179, 0.1730, 0.2536, 0.2389,0.2884,0.2936,0.2226}}; +//real CE MIESM +/* +double beta1_dlsch_MI[6][MCS_COUNT] = { {1.32955, 0.59522, 0.54024, 0.98698, 0.81305, 0.76976, 0.69258, 0.69713, 0.70546, 0.69111, 0.81904, 0.72664, 0.79491, 0.72562, 0.53980, 0.33134, 0.50550, 0.40602,0.40281,0.47012,0.50510,0.23540,0.32045,1}, {0.59632, 1.08475, 1.02431, 1.07020, 0.90170, 0.97719, 0.95464, 0.92764, 0.86721, 0.85986, 0.64558, 0.80631, 0.82673, 0.82888, 0.87122, 0.77245, 0.29771, 0.43477, 0.55321, 0.61027, 0.56111, 0.57292, 0.39737,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1},{1.808065416202085, 1.754544945430673,1.902272019362616, 1.790054645392961, 1.563204092967629, 1.585258289348813, 1.579349443720310, 1.570650121437345, 1.545055626608596, 1.362229442426877, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33, 1,1,1,1,1,1,1},{0.77532, 1.07544, 1.10571, 1.04099, 0.91638, 0.88644, 0.96405, 0.86709, 0.94066, 0.84430, 1.24478, 1.09665, 1.42604, 0.79541, 0.71847, 0.71604, 0.74561, 0.36431, 0.41536, 0.52175, 0.47096, 0.49977, 0.59728,1}}; +double beta2_dlsch_MI[6][MCS_COUNT] = { {1.36875, 0.59304, 0.53870, 0.98239, 0.81637, 0.76847, 0.69842, 0.69885, 0.69967, 0.69826, 0.82660, 0.70559, 0.78404, 0.70670, 0.55393, 0.36893, 0.52225, 0.39752, 0.40494, 0.46239, 0.49247,0.26900,0.34504,1}, {0.43775, 0.78208, 0.72875, 0.77458, 0.64485, 0.69174, 0.66097, 0.63289, 0.59652, 0.61175, 0.44551, 0.56047, 0.57314, 0.57553, 0.58849, 0.52159, 0.21241, 0.30139, 0.37373, 0.32029, 0.37067, 0.36706, 0.27118,1}, {1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1},{1.079518113138858, 1.105622953570353, 1.031337449900606, 1.073342032668810, 1.242636589110353, 1.255054927783647, 1.291463834317768, 1.317048698347491, 1.354485054187984, 0.338534029291017, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33,1, 1,1,1,1,1,1},{0.54448, 0.73731, 0.79165, 0.74407, 0.68042, 0.64906, 0.71349, 0.62109, 0.65815, 0.60940, 0.90549, 0.78708, 1.03176, 0.58431, 0.53379, 0.51224, 0.52767, 0.26848, 0.29642, 0.36879, 0.34148, 0.35279,0.40633,1}}; +*/ //ideal channel estimation values double beta1_dlsch[6][MCS_COUNT] = { {2.3814, 0.4956, 0.5273, 1.1708, 0.8014, 0.7889, 0.8111, 0.8139, 0.8124, 0.8479, 1.9280, 1.9664, 2.3857, 2.5147, 2.4511, 3.0158, 2.8643, 5.3013, 5.8594, 6.5372, 7.8073, 7.8030, 7.5295, 7.1320}, {0.5146, 0.5549, 0.7405, 0.6913, 0.7349, 0.7000, 0.7539, 0.7955, 0.8074, 0.7760, 1.8150, 1.6561, 1.9280, 2.3563, 2.6699, 2.3086, 3.1601, 4.5316, 5.2870, 6.0983, 6.5635, 7.7024, 9.9592, 6.6173}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {1.79358, 1.17908, 2.02600, 1.72040, 1.58618, 1.59039, 1.68111, 1.67062, 1.64911, 1.33274, 4.87800, 3.58797, 3.72338, 5.35700, 2.81752, 1.93472, 2.23259, 1,1,1,1,1,1,1}, {0.4445, 0.5918, 0.7118, 0.7115, 0.7284, 0.7202, 0.7117, 0.8111, 0.8239, 0.7907, 1.8456, 1.8144, 2.3830, 2.6634, 2.6129, 2.8127, 2.7372, 4.9424, 4.8763, 6.8413, 7.1493, 9.4180, 10.1230, 8.9613}}; double beta2_dlsch[6][MCS_COUNT] = { {2.3639, 0.4952, 0.5207, 1.1572, 0.8026, 0.7864, 0.7996, 0.8034, 0.8200, 0.8367, 1.8701, 1.9212, 2.2947, 2.4472, 2.4091, 2.9479, 2.8973, 5.0591, 5.5134, 6.1483, 7.2166, 7.5177, 7.5704, 7.2248}, {0.5113, 0.5600, 0.7359, 0.6860, 0.7344, 0.6902, 0.7315, 0.7660, 0.7817, 0.7315, 1.7268, 1.5912, 1.8519, 2.2115, 2.4580, 2.1879, 2.9015, 4.1543, 4.6986, 5.3193, 5.6319, 6.5640, 8.2421, 5.6393}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {0.79479, 0.52872, 0.90005, 0.77170, 0.73220, 0.72060, 0.75433, 0.75451, 0.75989, 0.67655, 1.68525, 1.31100, 1.46573, 1.99843, 1.57293, 1.62852, 2.10636, 1,1,1,1,1,1,1}, {0.4398, 0.5823, 0.7094, 0.7043, 0.7282, 0.7041, 0.6979, 0.7762, 0.7871, 0.7469, 1.7752, 1.7443, 2.2266, 2.4767, 2.4146, 2.6040, 2.5708, 4.4488, 4.4944, 5.9630, 6.3740, 8.1097, 8.4210, 7.8027}}; + //real channel estimation valus -//double beta1_dlsch[6][MCS_COUNT] = { {2.50200, 0.84047, 0.78195, 1.37929, 1.16871, 1.11906, 1.06303, 1.07447, 1.11403, 1.09223, 2.82502, 2.87556, 3.51254, 3.62920, 3.53638, 2.35980, 3.74126, 8.66532, 7.31772, 9.86882, 10.64939, 6.75208, 9.50664, 13.63057}, {0.92257, 1, 1.80445, 1.43175, 1.42093, 1.37381, 1.45392, 1.47255, 1.47451, 1.41235, 3.9079, 3.38557, 4.13059, 4.93355, 4.97277, 6.04951, 5.88896, 8.68076, 10.23746, 12.37069, 5.50538, 17.29612, 17.95050, 13.27095}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {1.79255, 1.88213, 4.44226, 2.25150, 1.93710, 2.18504, 2.57389, 1.94322, 1.78515, 2.09265, 2.37459, 1.74442, 1.74346, 1.19705, 1.56149, 1.59604, 1.6, 1,1,1,1,1,1,1}, {0.93374, 1.40389, 1.36670, 1.38679, 1.35707, 1.26353, 1.32360, 1.40164, 1.51843, 1.34863, 3.45839, 3.13726, 3.94768, 4.21966, 4.60750, 4.97894, 5.40755, 8.12814, 10.59221, 12.96427, 13.37323, 14.27206, 16.61779, 17.19656}}; -//double beta2_dlsch[6][MCS_COUNT] = { {2.52163, 0.83231, 0.77472, 1.36536, 1.16829, 1.11186, 1.06287, 1.07292, 1.09946, 1.10650, 2.79174, 2.75655, 3.36651, 3.49011, 3.60903, 2.73517, 3.84009, 8.20312, 7.41739, 9.64081, 10.40911, 8.11765, 10.41923, 9.34300}, {0.67252, 0.8600, 1.28633, 1.01624, 1.03066, 0.97590, 1.02560, 1.01840, 1.00547, 0.97093, 2.72573, 2.33283, 2.86181, 3.40452, 3.47957, 4.08916, 3.97628, 6.14541, 7.11017, 8.42369, 4.04812, 11.42082, 11.57171, 9.28462}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {0.85784, 0.90361, 2.09766, 1.08385, 0.96300, 1.04432, 1.22763, 0.99249, 0.95544, 1.12333, 1.37924, 1.12913, 1.30644, 1.19253, 1.75488, 2.13813, 2.10636, 1,1,1,1,1,1,1}, {0.66288, 0.96402, 0.98545, 0.99386, 0.99981, 0.92678, 0.98978, 0.99600, 1.05538, 0.97777, 2.52504, 2.29338, 2.89631, 3.10812, 3.41916, 3.58671, 3.84166, 6.05254, 7.45821, 9.15812, 9.66330, 10.17852, 11.50519, 11.16299}}; +/* +double beta1_dlsch[6][MCS_COUNT] = { {2.50200, 0.84047, 0.78195, 1.37929, 1.16871, 1.11906, 1.06303, 1.07447, 1.11403, 1.09223, 2.82502, 2.87556, 3.51254, 3.62920, 3.53638, 2.35980, 3.74126, 8.66532, 7.31772, 9.86882, 10.64939, 6.75208, 9.50664, 13.63057}, {0.92257, 1, 1.80445, 1.43175, 1.42093, 1.37381, 1.45392, 1.47255, 1.47451, 1.41235, 3.9079, 3.38557, 4.13059, 4.93355, 4.97277, 6.04951, 5.88896, 8.68076, 10.23746, 12.37069, 5.50538, 17.29612, 17.95050, 13.27095}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {1.79255, 1.88213, 4.44226, 2.25150, 1.93710, 2.18504, 2.57389, 1.94322, 1.78515, 2.09265, 2.37459, 1.74442, 1.74346, 1.19705, 1.56149, 1.59604, 1.6, 1,1,1,1,1,1,1}, {0.93374, 1.40389, 1.36670, 1.38679, 1.35707, 1.26353, 1.32360, 1.40164, 1.51843, 1.34863, 3.45839, 3.13726, 3.94768, 4.21966, 4.60750, 4.97894, 5.40755, 8.12814, 10.59221, 12.96427, 13.37323, 14.27206, 16.61779, 17.19656}}; +double beta2_dlsch[6][MCS_COUNT] = { {2.52163, 0.83231, 0.77472, 1.36536, 1.16829, 1.11186, 1.06287, 1.07292, 1.09946, 1.10650, 2.79174, 2.75655, 3.36651, 3.49011, 3.60903, 2.73517, 3.84009, 8.20312, 7.41739, 9.64081, 10.40911, 8.11765, 10.41923, 9.34300}, {0.67252, 0.8600, 1.28633, 1.01624, 1.03066, 0.97590, 1.02560, 1.01840, 1.00547, 0.97093, 2.72573, 2.33283, 2.86181, 3.40452, 3.47957, 4.08916, 3.97628, 6.14541, 7.11017, 8.42369, 4.04812, 11.42082, 11.57171, 9.28462}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {0.85784, 0.90361, 2.09766, 1.08385, 0.96300, 1.04432, 1.22763, 0.99249, 0.95544, 1.12333, 1.37924, 1.12913, 1.30644, 1.19253, 1.75488, 2.13813, 2.10636, 1,1,1,1,1,1,1}, {0.66288, 0.96402, 0.98545, 0.99386, 0.99981, 0.92678, 0.98978, 0.99600, 1.05538, 0.97777, 2.52504, 2.29338, 2.89631, 3.10812, 3.41916, 3.58671, 3.84166, 6.05254, 7.45821, 9.15812, 9.66330, 10.17852, 11.50519, 11.16299}}; + +*/ diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 5bf5d45d16a9387f61961dcdf817b0ec800031ca..9cfc9df372d27c039777fe982f073d8ee8de55ee 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -773,7 +773,7 @@ int main(int argc, char **argv) { forgetting_factor, rx_sample_offset, 0); - if(abstx==1){ + if(abstx==1 && num_rounds>1){ for(n=1;n<4;n++) eNB2UE[n] = new_channel_desc_scm(PHY_vars_eNB->lte_frame_parms.nb_antennas_tx, PHY_vars_UE->lte_frame_parms.nb_antennas_rx, @@ -1655,7 +1655,7 @@ int main(int argc, char **argv) { multipath_channel(eNB2UE[0],s_re,s_im,r_re,r_im, 2*frame_parms->samples_per_tti,hold_channel); // printf("amc: ****************** eNB2UE[%d]->n_rx = %d,dd %d\n",round,eNB2UE[round]->nb_rx,eNB2UE[round]->channel_offset); - if(abstx==1) + if(abstx==1 && num_rounds>1) if(round==0 && hold_channel==0){ random_channel(eNB2UE[1]); random_channel(eNB2UE[2]); @@ -1682,7 +1682,7 @@ int main(int argc, char **argv) { } } - if(num_rounds>2){ + if(num_rounds>1){ freq_channel(eNB2UE[1], NB_RB,2*NB_RB + 1); for (u=0;u<2*NB_RB;u++){ @@ -2422,7 +2422,7 @@ int main(int argc, char **argv) { } } //ABStraction - if(num_rounds==1){ + if(num_rounds==1){ bler= (double)errs[0]/(round_trials[0]); if (bler<1) {snr_step = input_snr_step; saving_bler = 0;} diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index a9e0c185e364be0b9027158157089c49d0aa5ed1..5f9f32f191f1082cb9d2dcea2862ab56597b98b4 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -58,12 +58,6 @@ //#include "LAYER2/MAC/pre_processor.c" #include "pdcp.h" -double snr_mcs[28]={-4.1130, -3.3830, -2.8420, -2.0480, -1.3230, -0.6120, 0.1080, 0.977, 1.7230, 2.7550, 3.1960, 3.8080, 4.6870, 5.6840, 6.6550, 7.7570, 8.3730, 9.3040, 9.5990, 10.9020, 11.7220, 12.5950, 13.4390, 14.8790, 15.8800, 16.4800, 17.8690, 18.7690}; -int cqi_mcs[3][16] = {{0, 0, 0, 2, 4, 6, 8, 11, 13, 15, 18, 20, 22, 25, 27, 27},{0, 0, 0, 2, 4, 6, 8, 11, 13, 15, 18, 20, 22, 25, 27, 27},{0, 0, 0, 2, 4, 6, 8, 11, 13, 15, 18, 19, 22, 24, 26, 27}}; -double cqi_snr[16] = {-8, -7, -6.08, -5.252, -3.956, -2.604, -1.107, 0.87, 2.599, 4.79, 6.716, 8, 10.593, 13.286, 15.745, 18.5}; -double snr_tm6=0; - - #define ENABLE_MAC_PAYLOAD_DEBUG #define DEBUG_eNB_SCHEDULER 1 //#define DEBUG_HEADER_PARSING 1 @@ -3473,90 +3467,10 @@ void schedule_ue_spec(unsigned char Mod_id, //eNB_UE_stats->dlsch_mcs1 = openair_daq_vars.target_ue_dl_mcs; // int flag_LA=0; //printf("CQI %d\n",eNB_UE_stats->DL_cqi[0]); - if (flag_LA==0){ - - switch(eNB_UE_stats->DL_cqi[0]) { - case 0: - eNB_UE_stats->dlsch_mcs1 = 0; - break; - case 1: - eNB_UE_stats->dlsch_mcs1 = 0; - break; - case 2: - eNB_UE_stats->dlsch_mcs1 = 0; - break; - case 3: - eNB_UE_stats->dlsch_mcs1 = 2; - break; - case 4: - eNB_UE_stats->dlsch_mcs1 = 4; - break; - case 5: - eNB_UE_stats->dlsch_mcs1 = 6; - break; - case 6: - eNB_UE_stats->dlsch_mcs1 = 8; - break; - case 7: - eNB_UE_stats->dlsch_mcs1 = 11; - break; - case 8: - eNB_UE_stats->dlsch_mcs1 = 13; - break; - case 9: - eNB_UE_stats->dlsch_mcs1 = 16; - break; - case 10: - eNB_UE_stats->dlsch_mcs1 = 18; - break; - case 11: - eNB_UE_stats->dlsch_mcs1 = 20; - break; - case 12: - eNB_UE_stats->dlsch_mcs1 = 22; - break; - case 13: - eNB_UE_stats->dlsch_mcs1 = 22;//25 - break; - case 14: - eNB_UE_stats->dlsch_mcs1 = 22;//27 - break; - case 15: - eNB_UE_stats->dlsch_mcs1 = 22;//28 - break; - default: - LOG_E(MAC,"Invalid CQI"); - exit(-1); - } - } - else { - // begin CQI to MCS mapping - if(mac_xface->get_transmission_mode(Mod_id,rnti)==1) - eNB_UE_stats->dlsch_mcs1 = cqi_mcs[0][eNB_UE_stats->DL_cqi[0]]; - else - if(mac_xface->get_transmission_mode(Mod_id,rnti)==2) - eNB_UE_stats->dlsch_mcs1 = cqi_mcs[1][eNB_UE_stats->DL_cqi[0]]; - else - if(mac_xface->get_transmission_mode(Mod_id,rnti)==6 || mac_xface->get_transmission_mode(Mod_id,rnti)==5) - eNB_UE_stats->dlsch_mcs1 = cqi_mcs[2][eNB_UE_stats->DL_cqi[0]]; - // end CQI Mapping - // if MUMIMO is enabled with two UEs then adjust the CQI and MCS mapping - if(mac_xface->get_transmission_mode(Mod_id,rnti)==5 && dl_pow_off[UE_id]==0){ - snr_tm6 = cqi_snr[eNB_UE_stats->DL_cqi[0]]; - if (snr_tm6<snr_mcs[0]) - eNB_UE_stats->dlsch_mcs1 = 0; - else - if(snr_tm6>snr_mcs[27]) - eNB_UE_stats->dlsch_mcs1 = 27; - else - for (i=0;i<27;i++){ - if(snr_tm6 > snr_mcs[i] && snr_tm6 < snr_mcs[i+1]) - eNB_UE_stats->dlsch_mcs1 = i; - } - } - } - if(eNB_UE_stats->dlsch_mcs1>22) + eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; + + if(eNB_UE_stats->dlsch_mcs1>22) eNB_UE_stats->dlsch_mcs1=22; diff --git a/targets/SIMU/EXAMPLES/OSD/WEBXML/template_40.xml b/targets/SIMU/EXAMPLES/OSD/WEBXML/template_40.xml index b3b47d7e17d37a278d848eb29c05b462b82f7bdd..566a230bf1a1600923de7af955ab5c307c70f2b0 100644 --- a/targets/SIMU/EXAMPLES/OSD/WEBXML/template_40.xml +++ b/targets/SIMU/EXAMPLES/OSD/WEBXML/template_40.xml @@ -6,11 +6,11 @@ <PATHLOSS_EXPONENT>3.67</PATHLOSS_EXPONENT> <PATHLOSS_0_dB>-128</PATHLOSS_0_dB><!--pathloss at 1km --> </FREE_SPACE_MODEL_PARAMETERS> - <SMALL_SCALE>Rayleigh8</SMALL_SCALE> + <SMALL_SCALE>Rayleigh1</SMALL_SCALE> </FADING> <SYSTEM_BANDWIDTH_MB>7.68</SYSTEM_BANDWIDTH_MB> <SYSTEM_FREQUENCY_GHz>1.9</SYSTEM_FREQUENCY_GHz> - <TRANSMISSION_MODE>2</TRANSMISSION_MODE> <!-- validavalue: 1, 2, 5, 6 --> + <TRANSMISSION_MODE>6</TRANSMISSION_MODE> <!-- validavalue: 1, 2, 5, 6 --> <ANTENNA> <eNB_ANTENNA> <RX_NOISE_LEVEL_dB>0</RX_NOISE_LEVEL_dB> diff --git a/targets/SIMU/USER/oaisim_functions.c b/targets/SIMU/USER/oaisim_functions.c index 5b11575a012a3e6e514692651b8aef7696d7b539..4721fa47c1efbe6410ca81c745885a1075eb4291 100644 --- a/targets/SIMU/USER/oaisim_functions.c +++ b/targets/SIMU/USER/oaisim_functions.c @@ -110,7 +110,7 @@ void get_simulation_options(int argc, char *argv[]) { {NULL, 0, NULL, 0} }; - while ((c = getopt_long (argc, argv, "aA:b:B:c:C:D:d:eE:f:FGg:hi:j:IJ:k:l:m:M:n:N:oO:p:P:rR:s:S:Q:t:T:u:U:vVx:y:w:W:X:z:Z:", long_options, &option_index)) != -1) { + while ((c = getopt_long (argc, argv, "aA:b:B:c:C:D:d:eE:f:FGg:hi:IJ:k:L:l:m:M:n:N:oO:p:P:rR:s:S:t:T:u:U:vVx:y:w:W:X:z:Z:", long_options, &option_index)) != -1) { switch (c) { case 0: if (! strcmp(long_options[option_index].name, "pdcp_period")) { @@ -567,14 +567,13 @@ void init_ocm() { s32 UE_id, eNB_id; /* Added for PHY abstraction */ if (abstraction_flag) { - if (0) { //the values of beta and awgn tables are hard coded in PHY/vars.h + get_beta_map(); #ifdef PHY_ABSTRACTION_UL get_beta_map_up(); #endif get_MIESM_param(); } - } for (eNB_id = 0; eNB_id < NB_eNB_INST; eNB_id++) { enb_data[eNB_id] = (node_desc_t *)malloc(sizeof(node_desc_t)); diff --git a/targets/SIMU/USER/plot_results.m b/targets/SIMU/USER/plot_results.m index 6d311c1fecf6752b4122214b3e529369a3b05a0d..73ac501f6f7d3bd26e92bc5e440d16c53b2d264d 100644 --- a/targets/SIMU/USER/plot_results.m +++ b/targets/SIMU/USER/plot_results.m @@ -1,6 +1,6 @@ function plot_results(tm) -data_abs = dlmread(sprintf('eNB_stats_abs_th_tx%d.txt',tm)); -data = dlmread(sprintf('eNB_stats_th_tx%d.txt',tm)); +data_abs = dlmread(sprintf('UE_stats_abs_th0_tx%d.txt',tm)); +data = dlmread(sprintf('UE_stats_th0_tx%d.txt',tm)); figure plot(data(:,1),data(:,2)) hold on @@ -54,4 +54,4 @@ hold off %ylabel('Throughput [kbps]') %legend('Full PHY','PHY ABSTRACTION') %hold off -%end \ No newline at end of file +%end diff --git a/targets/SIMU/USER/sinr_sim.c b/targets/SIMU/USER/sinr_sim.c index 14e721bde827332cef6511e44dc969bcdb0edadc..8b41e3f2390e69e218d4e6c3d93cddc75b294cae 100644 --- a/targets/SIMU/USER/sinr_sim.c +++ b/targets/SIMU/USER/sinr_sim.c @@ -495,16 +495,17 @@ void calculate_sinr(channel_desc_t* eNB2UE, node_desc_t *enb_data, node_desc_t * void get_beta_map() { char *file_path = NULL; //int table_len = 0; - int t; + int t,u; int mcs = 0; char *sinr_bler; char buffer[1000]; FILE *fp; + double perf_array[13]; file_path = (char*) malloc(512); for (mcs = 0; mcs < MCS_COUNT; mcs++) { - sprintf(file_path,"%s/SIMULATION/LTE_PHY/BLER_SIMULATIONS/AWGN/awgn_abst/awgn_snr_bler_mcs%d.csv",getenv("OPENAIR1_DIR"),mcs); + sprintf(file_path,"%s/SIMULATION/LTE_PHY/BLER_SIMULATIONS/AWGN/Perf_Curves_Abs/awgn_bler_tx1_mcs%d.csv",getenv("OPENAIR1_DIR"),mcs); fp = fopen(file_path,"r"); if (fp == NULL) { LOG_W(OCM,"ERROR: Unable to open the file %s, try an alternative path\n", file_path); @@ -518,21 +519,32 @@ void get_beta_map() { } } // else { + fgets(buffer, 1000, fp); fgets(buffer, 1000, fp); table_length[mcs]=0; while (!feof(fp)) { - sinr_bler = strtok(buffer, ","); - sinr_bler_map[mcs][0][table_length[mcs]] = atof(sinr_bler); - sinr_bler = strtok(NULL,","); - sinr_bler_map[mcs][1][table_length[mcs]] = atof(sinr_bler); - table_length[mcs]++; - fgets(buffer, 1000, fp); + u=0; + sinr_bler = strtok(buffer, ";"); + while(sinr_bler != NULL){ + perf_array[u]=atof(sinr_bler); + u++; + sinr_bler = strtok(NULL,";"); + } + if((perf_array[4]/perf_array[5]) < 1){ + sinr_bler_map[mcs][0][table_length[mcs]] = perf_array[0]; + sinr_bler_map[mcs][1][table_length[mcs]] = (perf_array[4]/perf_array[5]); + table_length[mcs]++; + } + fgets(buffer, 1000, fp); + } fclose(fp); // } - LOG_D(OCM,"Print the table for mcs %d\n",mcs); + // LOG_D(OCM,"Print the table for mcs %d\n",mcs); +printf("Print the table for mcs %d\n",mcs); for (t = 0; t<table_length[mcs]; t++) - LOG_D(OCM,"%lf %lf \n ",sinr_bler_map[mcs][0][t],sinr_bler_map[mcs][1][t]); + // LOG_D(OCM,"%lf %lf \n ",sinr_bler_map[mcs][0][t],sinr_bler_map[mcs][1][t]); +printf("%lf %lf \n ",sinr_bler_map[mcs][0][t],sinr_bler_map[mcs][1][t]); } free(file_path); }