Commit 32afd574 authored by Xiwen JIANG's avatar Xiwen JIANG

tdd calibrattion working for dlsim_tm7

parent 152ecfbe
......@@ -340,18 +340,6 @@ void phy_cleanup(void);
int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf);
void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms);
void lte_param_init(unsigned char N_tx_port_eNB,
unsigned char N_tx_phy,
unsigned char N_rx,
unsigned char transmission_mode,
uint8_t extended_prefix_flag,
frame_t frame_type,
uint16_t Nid_cell,
uint8_t tdd_config,
uint8_t N_RB_DL,
uint8_t threequarter_fs,
uint8_t osf,
uint32_t perfect_ce);
/** @} */
#endif
......@@ -1324,7 +1324,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
common_vars->txdata[eNB_id][i] = (int32_t*)malloc16_clear(fp->samples_per_tti*10*sizeof(int32_t) );
// initialze calibration matrix with idendity matrix
for (re=0; re<fp->ofdm_symbol_size; re++)
for (re=0; re<fp->N_RB_DL*12; re++)
common_vars->tdd_calib_coeffs[eNB_id][i][re] = 0x00007fff;
#ifdef DEBUG_PHY
......
......@@ -552,6 +552,7 @@ int allocate_REs_in_RB_pilots_64QAM_siso(PHY_VARS_eNB* phy_vars_eNB,
return(0);
}
// TODO: The input paramters of this function should be optimised. Should we include UE_id, necessry for TM7...
int allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB,
int32_t **txdataF,
uint32_t *jj,
......@@ -1394,7 +1395,8 @@ x0[1+*jj]);
// mapping ue specific beamforming weights from UE specified DLSCH structure to common space
for (aa=0;aa<frame_parms->nb_antennas_tx;aa++) {
phy_vars_eNB->common_vars.beam_weights[0][5][aa][re_offset+re] = dlsch0->ue_spec_bf_weights[0][aa][re_offset+re];
phy_vars_eNB->common_vars.beam_weights[0][5][aa][re_off+re] = phy_vars_eNB->dlsch[0][0]->ue_spec_bf_weights[0][aa][re_off+re];
//printf("allocate_REs_in_RB: phy_vars_eNB->common_vars.beam_weights[0][5][%d][%d,%d]=%d, phy_vars_eNB->dlsch[0][0]->ue_spec_bf_weights[0][%d][%d]=%d\n", aa, re_off,re, phy_vars_eNB->common_vars.beam_weights[0][5][aa][re_off+re], aa, re_off+re, phy_vars_eNB->dlsch[0][0]->ue_spec_bf_weights[0][aa][re_off+re]);
}
......@@ -1989,12 +1991,6 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
lprime=-1;
}
// mapping ue specific beamforming weights from UE specified DLSCH structure to common space
// TO DO: this doesn't have to be done here since we do it once in one frame
for (aa=0;aa<frame_parms->nb_antennas_tx;aa++) {
memcpy(phy_vars_eNB->common_vars.beam_weights[0][5][aa],dlsch0->ue_spec_bf_weights[0][aa],frame_parms->ofdm_symbol_size*sizeof(int32_t));
}
}
Ns = 2*subframe_offset+(l>=(nsymb>>1));
......
......@@ -34,24 +34,21 @@ int read_calibration_matrix(int32_t **tdd_calib_coeffs, char *calibF_fname, LTE_
int estimate_DLCSI_from_ULCSI(int32_t **calib_dl_ch_estimates, int32_t **ul_ch_estimates, int32_t **tdd_calib_coeffs, LTE_DL_FRAME_PARMS *frame_parms) {
int aa,re;
if (frame_parms->nb_antennas_tx != frame_parms->nb_antennas_rx) {
printf("ERR : Tx and Rx antennas should be the same for TDD calibration!");
return(1);
}
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
/*multadd_cpx_vector((int16_t*)(&tdd_calib_coeffs[aa][0]),(int16_t*)(&ul_ch_estimates[aa][0]),(int16_t*)(&calib_dl_ch_estimates[aa][0]),1,frame_parms->N_RB_DL*12,15);*/
multadd_cpx_vector((int16_t*)(&tdd_calib_coeffs[aa][0]),(int16_t*)(&ul_ch_estimates[aa][0]),(int16_t*)(&calib_dl_ch_estimates[aa][0]),1,frame_parms->N_RB_DL*12,15);
/*
for (re=0; re<frame_parms->N_RB_DL*12; re++) {
((int16_t*)(&calib_dl_ch_estimates[aa][re]))[0] += (((int16_t*)(&tdd_calib_coeffs[aa][re]))[0]*((int16_t*)(&ul_ch_estimates[aa][re]))[0])>>15;
((int16_t*)(&calib_dl_ch_estimates[aa][re]))[0] = (((int16_t*)(&tdd_calib_coeffs[aa][re]))[0]*((int16_t*)(&ul_ch_estimates[aa][re]))[0])>>15;
((int16_t*)(&calib_dl_ch_estimates[aa][re]))[0] -= (((int16_t*)(&tdd_calib_coeffs[aa][re]))[1]*((int16_t*)(&ul_ch_estimates[aa][re]))[1])>>15;
((int16_t*)(&calib_dl_ch_estimates[aa][re]))[1] += (((int16_t*)(&tdd_calib_coeffs[aa][re]))[0]*((int16_t*)(&ul_ch_estimates[aa][re]))[1])>>15;
((int16_t*)(&calib_dl_ch_estimates[aa][re]))[1] = (((int16_t*)(&tdd_calib_coeffs[aa][re]))[0]*((int16_t*)(&ul_ch_estimates[aa][re]))[1])>>15;
((int16_t*)(&calib_dl_ch_estimates[aa][re]))[1] += (((int16_t*)(&tdd_calib_coeffs[aa][re]))[1]*((int16_t*)(&ul_ch_estimates[aa][re]))[0])>>15;
*/
/*printf("aa=%d, re=%d tdd_calib_coeffs= (%d, %d), ul_ch_estimates = (%d, %d), calib_dl_ch_estimates = (%d, %d)\n",
aa, re,
((int16_t*)&tdd_calib_coeffs[aa][re])[0], ((int16_t*)&tdd_calib_coeffs[aa][re])[1],
((int16_t*)&ul_ch_estimates[aa][re])[0], ((int16_t*)&ul_ch_estimates[aa][re])[1],
((int16_t*)&calib_dl_ch_estimates[aa][re])[0], ((int16_t*)&calib_dl_ch_estimates[aa][re])[1]);*/
}
//}
}
}
......@@ -64,13 +61,13 @@ void compute_BF_weights(int32_t **beam_weights, int32_t **calib_dl_ch_estimates,
case MRT :
for (aa=0 ; aa<frame_parms->nb_antennas_tx ; aa++) {
for (re=0; re<frame_parms->N_RB_DL*6; re++) {
((int16_t*)(&beam_weights[aa][frame_parms->first_carrier_offset+re]))[0] = ((int16_t*)(&calib_dl_ch_estimates[aa][re]))[0];
((int16_t*)(&beam_weights[aa][frame_parms->first_carrier_offset+re]))[1] = -((int16_t*)(&calib_dl_ch_estimates[aa][re]))[1];
((int16_t*)(&beam_weights[aa][frame_parms->first_carrier_offset+re]))[0] = ((int16_t*)(&calib_dl_ch_estimates[aa][re]))[0]<<6;
((int16_t*)(&beam_weights[aa][frame_parms->first_carrier_offset+re]))[1] = -((int16_t*)(&calib_dl_ch_estimates[aa][re]))[1]<<6;
//Normalisation not implemented
}
for (re=frame_parms->N_RB_DL*6; re<frame_parms->N_RB_DL*12; re++) {
((int16_t*)(&beam_weights[aa][re-frame_parms->N_RB_DL*6+1]))[0] = ((int16_t*)(&calib_dl_ch_estimates[aa][re]))[0];
((int16_t*)(&beam_weights[aa][re-frame_parms->N_RB_DL*6+1]))[1] = -((int16_t*)(&calib_dl_ch_estimates[aa][re]))[1];
((int16_t*)(&beam_weights[aa][re-frame_parms->N_RB_DL*6+1]))[0] = ((int16_t*)(&calib_dl_ch_estimates[aa][re]))[0]<<6;
((int16_t*)(&beam_weights[aa][re-frame_parms->N_RB_DL*6+1]))[1] = -((int16_t*)(&calib_dl_ch_estimates[aa][re]))[1]<<6;
//Normalisation not implemented
}
}
......
......@@ -2148,13 +2148,23 @@ PMI_FEEDBACK:
if (tdd_calib == 1) {
start_meas(&eNB->dl_ch_calib_stats);
//make sure dlsim is called with perfect channel estimation option (for freq_channel)
if (awgn_flag == 0) {
random_channel(eNB2UE[round],0);
freq_channel(eNB2UE[round],UE->frame_parms.N_RB_DL,12*UE->frame_parms.N_RB_DL + 1);
}
//fill drs_ch_estimates with data from eNB2UE->chF
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
for (l=0; l<frame_parms->symbols_per_tti; l++) {
for (i=0; i<frame_parms->N_RB_DL*12; i++) {
((int16_t *)(eNB->pusch_vars[0]->drs_ch_estimates[0][aarx]))[(l*frame_parms->N_RB_DL*12+i)*2]=(int16_t)(eNB2UE[round]->chF[aarx][i].x*AMP);
((int16_t *)(eNB->pusch_vars[0]->drs_ch_estimates[0][aarx]))[(l*frame_parms->N_RB_DL*12+i)*2+1]=(int16_t)(eNB2UE[round]->chF[aarx][i].y*AMP);
printf("x=%d, y=%d,AMP=%d\n",eNB2UE[round]->chF[aarx][i].x,eNB2UE[round]->chF[aarx][i].y,AMP);
if (awgn_flag == 0) {
((int16_t *)(eNB->pusch_vars[0]->drs_ch_estimates[0][aarx]))[(l*frame_parms->N_RB_DL*12+i)*2]=(int16_t)(eNB2UE[round]->chF[aarx][i].x*AMP);
((int16_t *)(eNB->pusch_vars[0]->drs_ch_estimates[0][aarx]))[(l*frame_parms->N_RB_DL*12+i)*2+1]=(int16_t)(eNB2UE[round]->chF[aarx][i].y*AMP);
printf("x=%d, y=%d,AMP=%d\n",eNB2UE[round]->chF[aarx][i].x,eNB2UE[round]->chF[aarx][i].y,AMP);
} else {
((int16_t *)(eNB->pusch_vars[0]->drs_ch_estimates[0][aarx]))[(l*frame_parms->N_RB_DL*12+i)*2]= (short)(AMP);
((int16_t*)(eNB->pusch_vars[0]->drs_ch_estimates[0][aarx]))[(l*frame_parms->N_RB_DL*12+i)*2+1]= 0/2;
}
}
}
}
......@@ -2946,6 +2956,9 @@ PMI_FEEDBACK:
// Multipath channel
if (awgn_flag == 0) {
if (tdd_calib == 1)
hold_channel = 1;
multipath_channel(eNB2UE[round],s_re,s_im,r_re,r_im,
2*frame_parms->samples_per_tti,hold_channel);
......
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