Commit 7b114b08 authored by Florian Kaltenberger's avatar Florian Kaltenberger

adding functions to compute bf weights to dlsim

parent 341dde67
......@@ -242,6 +242,8 @@ typedef struct {
int32_t *txdataF[8];
/// beamforming weights for UE-spec transmission (antenna ports 5 or 7..14), for each codeword, maximum 4 layers?
int32_t **ue_spec_bf_weights[4];
/// dl channel estimates (estimated from ul channel estimates)
int32_t **calib_dl_ch_estimates;
/// Allocated RNTI (0 means DLSCH_t is not currently used)
uint16_t rnti;
/// Active flag for baseband transmitter processing
......
......@@ -47,8 +47,10 @@ int compute_BF_weights(int32_t **beam_weights, int32_t **calib_dl_ch_estimates,
}
// temporal test function
/*
void main(){
// initialization
// compare
printf("Hello world!\n");
}
\ No newline at end of file
}
*/
......@@ -641,18 +641,16 @@ typedef struct {
/// - first index: eNB id [0..2] (hard coded)
/// - second index: sample [0..samples_per_tti*10[
uint32_t *sync_corr[3];
// int32_t **beam_weights[3][15];
/// \brief Holds the beamforming weights
/// - first index: eNB id [0..2] (hard coded)
/// - second index: eNB antenna port index
/// - second index: eNB antenna port index (hard coded)
/// - third index: tx antenna [0..nb_antennas_tx[
/// - fourth index: sample [0..]
int32_t **beam_weights[3][15];
/// \brief Holds the tdd reciprocity calibration coefficients
/// - first index: eNB id [0..2] (hard coded)
/// - second index: ue specific eNB antenna port index, port5->index0, port7-15->index0-7
/// - third index: tx antenna [0..nb_antennas_tx[
/// - forth index: frenquency [0..]
/// - second index: tx antenna [0..nb_antennas_tx[
/// - third index: frequency [0..]
int32_t **tdd_calib_coeffs[3];
} LTE_eNB_COMMON;
......
......@@ -991,6 +991,9 @@ int main(int argc, char **argv)
PHY_vars_eNB->eNB_UE_stats[1].DL_pmi_single = 0;
}
//TODO: allocate memory for calibration matrix and calib_dl_ch_estimates in init_lte.c
//for first tests initialze calibration matrix with idendity
//read_calibration_matrix(calib_fname, nb_ant, nb_freq, PHY_vars_eNB->lte_eNB_common_vars.tdd_calib_coeffs[0]);
if (input_fd==NULL) {
......@@ -2142,6 +2145,32 @@ int main(int argc, char **argv)
PMI_FEEDBACK:
//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 *) PHY_vars_eNB->lte_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 *) PHY_vars_eNB->lte_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);
}
}
}
}
estimate_DLCSI_from_ULCSI(PHY_vars_eNB->dlsch_eNB[0][0]->calib_dl_ch_estimates,
&PHY_vars_eNB->lte_eNB_pusch_vars[0]->drs_ch_estimates[0][0/*position of second DMRS*/],
PHY_vars_eNB->lte_eNB_common_vars.tdd_calib_coeffs[0],
frame_parms->nb_antennas_tx,
frame_parms->N_RB_DL*12);
compute_BF_weights(PHY_vars_eNB->dlsch_eNB[0][0]->ue_spec_bf_weights[0],
PHY_vars_eNB->dlsch_eNB[0][0]->calib_dl_ch_estimates,
MRT,
frame_parms->nb_antennas_tx,
frame_parms->N_RB_DL*12);
//printf("Trial %d : Round %d, pmi_feedback %d \n",trials,round,pmi_feedback);
for (aa=0; aa<NB_ANTENNA_PORTS_ENB; aa++) {
memset(&PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id][aa][0],0,FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(int32_t));
......@@ -3088,6 +3117,7 @@ PMI_FEEDBACK:
eNB2UE[round]->chF[aarx+(aa*frame_parms->nb_antennas_rx)][i].y*AMP);
if (transmission_mode == 7){
//this should include the BF weights! Will not work for a random channel
if (PHY_vars_UE->high_speed_flag==0) {
((int16_t *)PHY_vars_UE->lte_ue_pdsch_vars[0]->dl_bf_ch_estimates[(aa<<1)+aarx])[2*i]=(int16_t)(
eNB2UE[round]->chF[aarx+(aa*frame_parms->nb_antennas_rx)][i].x*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