Commit 7f63f23f authored by Xiwen JIANG's avatar Xiwen JIANG

TDD DL channel calibration (not finished)

parent a0ffbdd7
......@@ -1239,7 +1239,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
for (i=0; i<fp->nb_antennas_tx; i++) {
common_vars->txdataF_BF[eNB_id][i] = (int32_t*)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t) );
common_vars->tdd_calib_coeffs[eNB_id][i] = (int32_t*)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t) );
common_vars->tdd_calib_coeffs[eNB_id][i] = (int32_t*)malloc16_clear(fp->N_RB_DL*12*sizeof(int32_t) );
if (eNB->node_function != NGFI_RCC_IF4p5)
common_vars->txdata[eNB_id][i] = (int32_t*)malloc16_clear(fp->samples_per_tti*10*sizeof(int32_t) );
......
......@@ -160,7 +160,7 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_
dlsch->calib_dl_ch_estimates = (int32_t**)malloc16(frame_parms->nb_antennas_tx*sizeof(int32_t*));
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
dlsch->calib_dl_ch_estimates[aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t));
dlsch->calib_dl_ch_estimates[aa] = (int32_t *)malloc16(frame_parms->N_RB_DL*12*sizeof(int32_t));
}
for (i=0; i<10; i++)
......
......@@ -1392,6 +1392,12 @@ 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];
}
} else if (mimo_mode >= TM8) { //TM8,TM9,TM10
//uint8_t is_not_UEspecRS(int8_t lprime, uint8_t re, uint8_t nushift, uint8_t Ncp, uint8_t beamforming_mode)
......@@ -1985,7 +1991,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
// 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++){
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));
}
......
......@@ -19,7 +19,7 @@ int read_calibration_matrix(int32_t **tdd_calib_coeffs, char *calibF_fname, LTE_
printf("Loading Calibration matrix from %s\n", calibF_fname);
for (aa=0;aa<frame_parms->nb_antennas_tx;aa++) {
for(re=0;re<frame_parms->ofdm_symbol_size;re++) {
for(re=0;re<frame_parms->N_RB_DL*12;re++) {
fscanf(calibF_fd, "%d", &calibF_e) ;
//printf("aa=%d, re=%d, tdd_calib[0]=%d\n", aa, re, calibF_e);
((int16_t*)(&tdd_calib_coeffs[aa][re]))[0] = calibF_e;
......@@ -39,19 +39,19 @@ int estimate_DLCSI_from_ULCSI(int32_t **calib_dl_ch_estimates, int32_t **ul_ch_e
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->ofdm_symbol_size,15);
/*for (re=0; re<frame_parms->ofdm_symbol_size; re++) {
/*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]))[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]))[1]*((int16_t*)(&ul_ch_estimates[aa][re]))[0])>>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]);*/
//}
}
}
}
......@@ -63,9 +63,14 @@ void compute_BF_weights(int32_t **beam_weights, int32_t **calib_dl_ch_estimates,
//case MRT
case MRT :
for (aa=0 ; aa<frame_parms->nb_antennas_tx ; aa++) {
for (re=0; re<frame_parms->ofdm_symbol_size; re++) {
((int16_t*)(&beam_weights[aa][re]))[0] = ((int16_t*)(&calib_dl_ch_estimates[aa][re]))[0];
((int16_t*)(&beam_weights[aa][re]))[1] = -((int16_t*)(&calib_dl_ch_estimates[aa][re]))[1];
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];
//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];
//Normalisation not implemented
}
}
......
......@@ -2149,14 +2149,12 @@ PMI_FEEDBACK:
start_meas(&eNB->dl_ch_calib_stats);
//make sure dlsim is called with perfect channel estimation option (for freq_channel)
//fill drs_ch_estimates with data from eNB2UE->chF
for(aa=0; aa<frame_parms->nb_antenna_ports_eNB; aa++) {
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
for (i=0; i<frame_parms->N_RB_DL*12; i++) {
for (l=0; l<frame_parms->symbols_per_tti; l++) {
((int16_t *) eNB->pusch_vars[0]->drs_ch_estimates[0][(aa<<1)+aarx])[2*i+(l*frame_parms->ofdm_symbol_size)*2]=(int16_t)(eNB2UE[round]->chF[aarx+(aa*frame_parms->nb_antennas_rx)][i].x*AMP);
//printf("x=%d,AMP=%d\n",eNB2UE[round]->chF[aarx+(aa*frame_parms->nb_antennas_rx)][i].x,AMP);
((int16_t *) eNB->pusch_vars[0]->drs_ch_estimates[0][(aa<<1)+aarx])[2*i+1+(l*frame_parms->ofdm_symbol_size)*2]=(int16_t)(eNB2UE[round]->chF[aarx+(aa*frame_parms->nb_antennas_rx)][i].y*AMP);
}
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);
}
}
}
......
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