Commit fa677d5c authored by Xiwen JIANG's avatar Xiwen JIANG

beamforming based on calibrated DLCSI (performance poor, to understand why)

parent 54c99719
......@@ -154,6 +154,7 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_
dlsch->ue_spec_bf_weights[layer][aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t));
for (re=0;re<OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; re++) {
dlsch->ue_spec_bf_weights[layer][aa][re] = 0x00007fff;
//dlsch->ue_spec_bf_weights[layer][aa][re] = 0xd27Cdab3;//0x2d842570;//0xaD84a570;//0x2d842570;//0x2416b191;//0x3d432a22;
}
}
}
......
......@@ -1408,7 +1408,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_off+re] = phy_vars_eNB->dlsch[0][0]->ue_spec_bf_weights[0][aa][re_off+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];
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][385];
//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]);
}
......
......@@ -48,7 +48,7 @@ Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 069
int beam_precoding(int32_t **txdataF,
int32_t **txdataF_BF,
LTE_DL_FRAME_PARMS *frame_parms,
LTE_DL_FRAME_PARMS *fp,
int32_t ***beam_weights,
int slot,
int symbol,
......@@ -58,33 +58,34 @@ int beam_precoding(int32_t **txdataF,
uint16_t re=0;
int slot_offset_F;
slot_offset_F = slot*(frame_parms->ofdm_symbol_size)*((frame_parms->Ncp==1) ? 6 : 7);
slot_offset_F = slot*(fp->ofdm_symbol_size)*((fp->Ncp==1) ? 6 : 7);
// clear txdata_BF[aa][re] for each call of ue_spec_beamforming
memset(txdataF_BF[aa],0,sizeof(int32_t)*(frame_parms->ofdm_symbol_size));
memset(txdataF_BF[aa],0,sizeof(int32_t)*(fp->ofdm_symbol_size));
for (p=0; p<14; p++) {
if (p==0 || p==1 || p==5) {
multadd_cpx_vector((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size],(int16_t*)beam_weights[p][aa], (int16_t*)txdataF_BF[aa], 0, frame_parms->ofdm_symbol_size, 15);
//mult_cpx_conj_vector((int16_t*)beam_weights[p][aa], (int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size], (int16_t*)txdataF_BF[aa], frame_parms->ofdm_symbol_size, 15, 1);
//One way to furthur optimise the multiplication is to perform only on useful data, but for some bandwidth, 6*fp->N_RB_DL
//is not a multiplies of 4
multadd_cpx_vector((int16_t*)&txdataF[p][slot_offset_F+symbol*fp->ofdm_symbol_size],(int16_t*)beam_weights[p][aa], (int16_t*)txdataF_BF[aa], 0, fp->ofdm_symbol_size, 15);
// if check version
/*for (re=0;re<frame_parms->ofdm_symbol_size;re++) {
if (txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re]!=0) {
((int16_t*)&txdataF_BF[aa][re])[0] += (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0]*((int16_t*)&beam_weights[p][aa][re])[0])>>15);
((int16_t*)&txdataF_BF[aa][re])[0] -= (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1]*((int16_t*)&beam_weights[p][aa][re])[1])>>15);
((int16_t*)&txdataF_BF[aa][re])[1] += (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0]*((int16_t*)&beam_weights[p][aa][re])[1])>>15);
((int16_t*)&txdataF_BF[aa][re])[1] += (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1]*((int16_t*)&beam_weights[p][aa][re])[0])>>15);
/* // if check version
for (re=0;re<fp->ofdm_symbol_size;re++) {
if (txdataF[p][slot_offset_F+symbol*fp->ofdm_symbol_size+re]!=0) {
((int16_t*)&txdataF_BF[aa][re])[0] += (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*fp->ofdm_symbol_size+re])[0]*((int16_t*)&beam_weights[p][aa][re])[0])>>15);
((int16_t*)&txdataF_BF[aa][re])[0] -= (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*fp->ofdm_symbol_size+re])[1]*((int16_t*)&beam_weights[p][aa][re])[1])>>15);
((int16_t*)&txdataF_BF[aa][re])[1] += (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*fp->ofdm_symbol_size+re])[0]*((int16_t*)&beam_weights[p][aa][re])[1])>>15);
((int16_t*)&txdataF_BF[aa][re])[1] += (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*fp->ofdm_symbol_size+re])[1]*((int16_t*)&beam_weights[p][aa][re])[0])>>15);
printf("beamforming.c:txdataF[%d][%d]=%d+j%d, beam_weights[%d][%d][%d]=%d+j%d,txdata_BF[%d][%d]=%d+j%d\n",
p,slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re,
((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0],
((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1],
p,aa,re,
((int16_t*)&beam_weights[p][aa][re])[0],((int16_t*)&beam_weights[p][aa][re])[1],
aa,re,
((int16_t*)&txdataF_BF[aa][re])[0],
((int16_t*)&txdataF_BF[aa][re])[1]);
printf("beamforming.c:txdataF[%d][%d]=%d+j%d, beam_weights[%d][%d][%d]=%d+j%d,txdata_BF[%d][%d]=%d+j%d\n",
p,slot_offset_F+symbol*fp->ofdm_symbol_size+re,
((int16_t*)&txdataF[p][slot_offset_F+symbol*fp->ofdm_symbol_size+re])[0],
((int16_t*)&txdataF[p][slot_offset_F+symbol*fp->ofdm_symbol_size+re])[1],
p,aa,re,
((int16_t*)&beam_weights[p][aa][re])[0],((int16_t*)&beam_weights[p][aa][re])[1],
aa,re,
((int16_t*)&txdataF_BF[aa][re])[0],
((int16_t*)&txdataF_BF[aa][re])[1]);
}
}*/
}
......
......@@ -3,6 +3,7 @@
#include <string.h>
#include "UTIL/LOG/log.h"
#include "PHY/impl_defs_lte.h"
#include "PHY/TOOLS/defs.h"
extern char tdd_recip_calib_file[1024];
......@@ -11,21 +12,11 @@ int read_calibration_matrix(int32_t **tdd_calib_coeffs, char *calibF_fname, LTE_
FILE *calibF_fd;
int aa,re,calibF_e ;
//char calibF_file_name[1024];
//char* openair_dir = getenv("OPENAIR_DIR");
//if (openair_dir == NULL) {
// printf("ERR: OPENAIR_DIR not defined (did you source oaienv?)\n");
// return(1);
//}
//sprintf(calibF_file_name, "%s/targets/PROJECTS/TDDREC/result/%s", openair_dir, calibF_fname);
//calibF_fd = fopen(calibF_file_name,"r") ;
calibF_fd = fopen(tdd_recip_calib_file, "r");
if (calibF_fd == NULL) {
//printf("Warning: %s not found, running with defaults\n", calibF_file_name);
printf("Warning: %s not found, running with defaults\n", tdd_recip_calib_file);
return(1);
}
......@@ -46,46 +37,77 @@ int read_calibration_matrix(int32_t **tdd_calib_coeffs, char *calibF_fname, LTE_
}
}
void 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) {
//TODO: ULCSI should be obtained from SRS in order to ensure ULCSI covers all freq band
void estimate_DLCSI_from_ULCSI(int32_t **calib_dl_ch_estimates, LTE_eNB_PUSCH *pusch_vars, int32_t **tdd_calib_coeffs, LTE_DL_FRAME_PARMS *frame_parms, int eNB_id) {
int aa,re;
uint8_t shift;
int32_t **ul_ch_estimates = pusch_vars->drs_ch_estimates[eNB_id];
int *ulsch_power = pusch_vars->ulsch_power;
int beta = 1.2;
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);
shift = log2_approx(ulsch_power[aa]*beta)>>1;
//printf("ulsch_power[%d]=%d\n", aa, ulsch_power[aa]);
// Temporal implementation for 5MHz band
multadd_cpx_vector((int16_t*)(&tdd_calib_coeffs[aa][12]),(int16_t*)(&ul_ch_estimates[aa][12]),(int16_t*)(&calib_dl_ch_estimates[aa][12]),1,20*12,shift);
//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;
for (re=12; re<20*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])>>shift;
((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])>>shift;
((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])>>shift;
((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])>>shift;
}
*/
/*
for (re=12; re<20*12; re++) {
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]);
}
*/
/*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]);*/
//}
}
}
void compute_BF_weights(int32_t **beam_weights, int32_t **calib_dl_ch_estimates, PRECODE_TYPE_t precode_type, LTE_DL_FRAME_PARMS *frame_parms) {
int aa, re;
int norm_factor = 5;
int norm_factor = 0;
switch (precode_type) {
//case MRT
case MRT :
for (aa=0 ; aa<frame_parms->nb_antennas_tx ; aa++) {
for (re=0; re<frame_parms->N_RB_DL*6; re++) {
//for (re=0; re<frame_parms->N_RB_DL*6; re++) {
for (re=12; re<frame_parms->N_RB_DL*6; re++) {
//normalisation simplied by a constent shift
((int16_t*)(&beam_weights[aa][frame_parms->first_carrier_offset+re]))[0] = ((int16_t*)(&calib_dl_ch_estimates[aa][re]))[0]<<norm_factor;
((int16_t*)(&beam_weights[aa][frame_parms->first_carrier_offset+re]))[1] = -((int16_t*)(&calib_dl_ch_estimates[aa][re]))[1]<<norm_factor;
/* printf("calib_dl_ch_estimates[%d][%d]=(%d,%d),beam_weight[%d][%d]=(%d,%d)\n",
aa, re,
((int16_t*)(&calib_dl_ch_estimates[aa][re]))[0],
((int16_t*)(&calib_dl_ch_estimates[aa][re]))[1],
aa, frame_parms->first_carrier_offset+re,
((int16_t*)(&beam_weights[aa][frame_parms->first_carrier_offset+re]))[0],
((int16_t*)(&beam_weights[aa][frame_parms->first_carrier_offset+re]))[1]);*/
}
for (re=frame_parms->N_RB_DL*6; re<frame_parms->N_RB_DL*12; re++) {
//for (re=frame_parms->N_RB_DL*6; re<frame_parms->N_RB_DL*12; re++) {
for (re=frame_parms->N_RB_DL*6; re<20*12; re++) {
//normalisation simplied by a constent shift
((int16_t*)(&beam_weights[aa][re-frame_parms->N_RB_DL*6+1]))[0] = ((int16_t*)(&calib_dl_ch_estimates[aa][re]))[0]<<norm_factor;
((int16_t*)(&beam_weights[aa][re-frame_parms->N_RB_DL*6+1]))[1] = -((int16_t*)(&calib_dl_ch_estimates[aa][re]))[1]<<norm_factor;
/*printf("calib_dl_ch_estimates[%d][%d]=(%d,%d),beam_weight[%d][%d]=(%d,%d)\n",
aa, re,
((int16_t*)(&calib_dl_ch_estimates[aa][re]))[0],
((int16_t*)(&calib_dl_ch_estimates[aa][re]))[1],
aa, frame_parms->first_carrier_offset+re,
((int16_t*)(&beam_weights[aa][re-frame_parms->N_RB_DL*6+1]))[0],
((int16_t*)(&beam_weights[aa][re-frame_parms->N_RB_DL*6+1]))[1]);*/
}
}
break ;
......
......@@ -125,7 +125,8 @@ int beam_precoding(int32_t **txdataF,
int read_calibration_matrix(int32_t **tdd_calib_coeffs, char *calibF_fname, LTE_DL_FRAME_PARMS *frame_parms);
void 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);
void estimate_DLCSI_from_ULCSI(int32_t **calib_dl_ch_estimates, LTE_eNB_PUSCH *pusch_vars, int32_t **tdd_calib_coeffs,
LTE_DL_FRAME_PARMS *frame_parms, int eNB_id);
int compute_BF_weights(int32_t **beam_weights, int32_t **calib_dl_ch_estimates, PRECODE_TYPE_t precode_type, LTE_DL_FRAME_PARMS *frame_parms);
......
......@@ -138,11 +138,12 @@ int mult_cpx_conj_vector(int16_t *x1,
@param output_shift - shift to be applied to generate output
*/
int multiadd_cpx_vector(int16_t *x1,
int16_t *x2,
int16_t *y,
uint32_t N,
int output_shift);
int multadd_cpx_vector(int16_t *x1,
int16_t *x2,
int16_t *y,
uint8_t zero_flag,
uint32_t N,
int output_shift);
// lte_dfts.c
......
......@@ -96,21 +96,28 @@ FD_lte_phy_scope_enb *create_lte_phy_scope_enb( void )
fl_set_object_lcolor( fdui->chest_f, FL_WHITE ); // Label color
fl_set_xyplot_ybounds( fdui->chest_f,30,70);
// Frequency-domain beamforming weights
fdui->bf_weights = fl_add_xyplot( FL_IMPULSE_XYPLOT, 20, 260, 760, 100, "Frequency Domain Beamforming Weight (RE, dB)" );
fl_set_object_boxtype( fdui->bf_weights, FL_EMBOSSED_BOX );
fl_set_object_color( fdui->bf_weights, FL_BLACK, FL_RED );
fl_set_object_lcolor( fdui->bf_weights, FL_WHITE ); // Label color
fl_set_xyplot_ybounds( fdui->bf_weights,30,100);
// LLR of PUSCH
fdui->pusch_llr = fl_add_xyplot( FL_POINTS_XYPLOT, 20, 260, 500, 200, "PUSCH Log-Likelihood Ratios (LLR, mag)" );
fdui->pusch_llr = fl_add_xyplot( FL_POINTS_XYPLOT, 20, 380, 500, 200, "PUSCH Log-Likelihood Ratios (LLR, mag)" );
fl_set_object_boxtype( fdui->pusch_llr, FL_EMBOSSED_BOX );
fl_set_object_color( fdui->pusch_llr, FL_BLACK, FL_YELLOW );
fl_set_object_lcolor( fdui->pusch_llr, FL_WHITE ); // Label color
fl_set_xyplot_symbolsize( fdui->pusch_llr,2);
// I/Q PUSCH comp
fdui->pusch_comp = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 260, 240, 200, "PUSCH I/Q of MF Output" );
fdui->pusch_comp = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 380, 240, 200, "PUSCH I/Q of MF Output" );
fl_set_object_boxtype( fdui->pusch_comp, FL_EMBOSSED_BOX );
fl_set_object_color( fdui->pusch_comp, FL_BLACK, FL_YELLOW );
fl_set_object_lcolor( fdui->pusch_comp, FL_WHITE ); // Label color
fl_set_xyplot_symbolsize( fdui->pusch_comp,2);
fl_set_xyplot_xgrid( fdui->pusch_llr,FL_GRID_MAJOR);
/*
// I/Q PUCCH comp (format 1)
fdui->pucch_comp1 = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 480, 240, 100, "PUCCH1 Energy (SR)" );
fl_set_object_boxtype( fdui->pucch_comp1, FL_EMBOSSED_BOX );
......@@ -118,7 +125,7 @@ FD_lte_phy_scope_enb *create_lte_phy_scope_enb( void )
fl_set_object_lcolor( fdui->pucch_comp1, FL_WHITE ); // Label color
fl_set_xyplot_symbolsize( fdui->pucch_comp1,2);
// fl_set_xyplot_xgrid( fdui->pusch_llr,FL_GRID_MAJOR);
*/
// I/Q PUCCH comp (fromat 1a/b)
fdui->pucch_comp = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 600, 240, 100, "PUCCH I/Q of MF Output" );
fl_set_object_boxtype( fdui->pucch_comp, FL_EMBOSSED_BOX );
......@@ -126,13 +133,13 @@ FD_lte_phy_scope_enb *create_lte_phy_scope_enb( void )
fl_set_object_lcolor( fdui->pucch_comp, FL_WHITE ); // Label color
fl_set_xyplot_symbolsize( fdui->pucch_comp,2);
// fl_set_xyplot_xgrid( fdui->pusch_llr,FL_GRID_MAJOR);
/*
// Throughput on PUSCH
fdui->pusch_tput = fl_add_xyplot( FL_NORMAL_XYPLOT, 20, 480, 500, 100, "PUSCH Throughput [frame]/[kbit/s]" );
fl_set_object_boxtype( fdui->pusch_tput, FL_EMBOSSED_BOX );
fl_set_object_color( fdui->pusch_tput, FL_BLACK, FL_WHITE );
fl_set_object_lcolor( fdui->pusch_tput, FL_WHITE ); // Label color
*/
// Generic eNB Button
fdui->button_0 = fl_add_button( FL_PUSH_BUTTON, 20, 600, 240, 40, "" );
fl_set_object_lalign(fdui->button_0, FL_ALIGN_CENTER );
......@@ -161,6 +168,7 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form,
int16_t **rxsig_t;
int16_t **chest_t;
int16_t **chest_f;
int16_t **bf_weights;
int16_t *pusch_llr;
int16_t *pusch_comp;
int32_t *pucch1_comp;
......@@ -173,6 +181,7 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form,
float rxsig_t_dB[nb_antennas_rx][FRAME_LENGTH_COMPLEX_SAMPLES];
float chest_t_abs[nb_antennas_rx][frame_parms->ofdm_symbol_size];
float *chest_f_abs;
float *bf_weights_abs;
float time[FRAME_LENGTH_COMPLEX_SAMPLES];
float time2[2048];
float freq[nsymb_ce*nb_antennas_rx*nb_antennas_tx];
......@@ -192,12 +201,14 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form,
coded_bits_per_codeword = frame_parms->N_RB_UL*12*get_Qm(mcs)*frame_parms->symbols_per_tti;
chest_f_abs = (float*) calloc(nsymb_ce*nb_antennas_rx*nb_antennas_tx,sizeof(float));
bf_weights_abs = (float*) calloc(nsymb_ce*nb_antennas_rx,sizeof(float));
llr = (float*) calloc(coded_bits_per_codeword,sizeof(float)); // init to zero
bit = malloc(coded_bits_per_codeword*sizeof(float));
rxsig_t = (int16_t**) phy_vars_enb->common_vars.rxdata[eNB_id];
chest_t = (int16_t**) phy_vars_enb->pusch_vars[UE_id]->drs_ch_estimates_time[eNB_id];
chest_f = (int16_t**) phy_vars_enb->pusch_vars[UE_id]->drs_ch_estimates[eNB_id];
bf_weights = (int16_t**) phy_vars_enb->common_vars.beam_weights[eNB_id][5]; //Illustration UE spec BF weights for TM7
pusch_llr = (int16_t*) phy_vars_enb->pusch_vars[UE_id]->llr;
pusch_comp = (int16_t*) phy_vars_enb->pusch_vars[UE_id]->rxdataF_comp[eNB_id][0];
pucch1_comp = (int32_t*) phy_vars_enb->pucch1_stats[UE_id];
......@@ -217,7 +228,7 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form,
for (arx=1; arx<nb_antennas_rx; arx++) {
if (rxsig_t[arx] != NULL) {
for (i=0; i<FRAME_LENGTH_COMPLEX_SAMPLES; i++) {
for (i=0;i<FRAME_LENGTH_COMPLEX_SAMPLES; i++) {
rxsig_t_dB[arx][i] = 10*log10(1.0+(float) ((rxsig_t[arx][2*i])*(rxsig_t[arx][2*i])+(rxsig_t[arx][2*i+1])*(rxsig_t[arx][2*i+1])));
}
......@@ -285,10 +296,10 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form,
fl_set_xyplot_xbounds(form->chest_f,0,nb_antennas_rx*nb_antennas_tx*nsymb_ce);
fl_set_xyplot_xtics(form->chest_f,nb_antennas_rx*nb_antennas_tx*frame_parms->symbols_per_tti,3);
fl_set_xyplot_xgrid(form->chest_f,FL_GRID_MAJOR);
fl_set_xyplot_data(form->chest_f,freq,chest_f_abs,nsymb_ce,"","","");
fl_set_xyplot_data(form->chest_f,freq,chest_f_abs,nsymb_ce*nb_antennas_rx,"","","");
for (arx=1; arx<nb_antennas_rx; arx++) {
fl_add_xyplot_overlay(form->chest_f,1,&freq[arx*nsymb_ce],&chest_f_abs[arx*nsymb_ce],nsymb_ce,rx_antenna_colors[arx]);
fl_add_xyplot_overlay(form->chest_f,arx,&freq[arx*nsymb_ce],&chest_f_abs[arx*nsymb_ce],nsymb_ce,rx_antenna_colors[arx]);
}
// other tx antennas
......@@ -306,6 +317,47 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form,
}
}
}
// Beamforming weights
if (bf_weights != NULL) {
ind = 0;
for (arx=0; arx<nb_antennas_rx; arx++) {
if (bf_weights[arx] != NULL) {
for (k=0; k<6*frame_parms->N_RB_DL; k++) {
freq[ind] = (float)ind;
Re = (float)(bf_weights[arx][2*(k+frame_parms->first_carrier_offset)]);
Im = (float)(bf_weights[arx][2*(k+frame_parms->first_carrier_offset)+1]);
//printf("bf_weights[%d][%d]=(%f,%f)\n", arx, k+frame_parms->first_carrier_offset, Re, Im);
bf_weights_abs[ind] = (short)10*log10(1.0+((double)Re*Re + (double)Im*Im));
ind++;
}
for (k=0; k<6*frame_parms->N_RB_DL; k++) {
freq[ind] = (float)ind;
Re = (float)(bf_weights[arx][(2*k)]);
Im = (float)(bf_weights[arx][(2*k)+1]);
//printf("bf_weights[%d][%d]=(%f,%f)\n", arx, k, Re, Im);
bf_weights_abs[ind] = (short)10*log10(1.0+((double)Re*Re + (double)Im*Im));
//printf("bf_weights_abs[%d][%d]=%d\n", arx, k, bf_weights_abs[ind]);
ind++;
}
}
}
// tx antenna 0
fl_set_xyplot_xbounds(form->bf_weights,0,nb_antennas_rx*nb_antennas_tx*12*frame_parms->N_RB_DL);
fl_set_xyplot_xtics(form->bf_weights,nb_antennas_rx*nb_antennas_tx,3);
fl_set_xyplot_xgrid(form->bf_weights,FL_GRID_MAJOR);
fl_set_xyplot_data(form->bf_weights,freq,bf_weights_abs,12*frame_parms->N_RB_DL*nb_antennas_rx,"","","");
for (arx=1; arx<nb_antennas_rx; arx++) {
fl_add_xyplot_overlay(form->bf_weights,arx,&freq[arx*12*frame_parms->N_RB_DL],&bf_weights_abs[arx*12*frame_parms->N_RB_DL],nsymb_ce,rx_antenna_colors[arx]);
}
}
// PUSCH LLRs
if (pusch_llr != NULL) {
......@@ -332,7 +384,7 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form,
fl_set_xyplot_data(form->pusch_comp,I,Q,ind,"","","");
}
// PUSCH I/Q of MF Output
/* // PUSCH I/Q of MF Output
if (pucch1ab_comp!=NULL) {
for (ind=0; ind<10240; ind++) {
......@@ -350,9 +402,9 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form,
fl_set_xyplot_ybounds(form->pucch_comp1,0,80);
}
*/
// PUSCH Throughput
/* // PUSCH Throughput
memmove( tput_time_enb[UE_id], &tput_time_enb[UE_id][1], (TPUT_WINDOW_LENGTH-1)*sizeof(float) );
memmove( tput_enb[UE_id], &tput_enb[UE_id][1], (TPUT_WINDOW_LENGTH-1)*sizeof(float) );
......@@ -363,7 +415,7 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form,
// fl_get_xyplot_ybounds(form->pusch_tput,&ymin,&ymax);
// fl_set_xyplot_ybounds(form->pusch_tput,0,ymax);
*/
fl_check_forms();
free(llr);
......
......@@ -37,6 +37,7 @@ typedef struct {
FL_OBJECT * rxsig_t;
FL_OBJECT * chest_f;
FL_OBJECT * chest_t;
FL_OBJECT * bf_weights;
FL_OBJECT * pusch_comp;
FL_OBJECT * pucch_comp;
FL_OBJECT * pucch_comp1;
......
......@@ -767,11 +767,12 @@ typedef struct {
/// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
int32_t **ul_ch_magb_1[3];
/// measured RX power based on DRS
int ulsch_power[2];
/// -first index: rx antenna id [0..nb_antennas_rx]
int ulsch_power[NB_ANTENNAS_RX];
/// measured RX power based on DRS for UE0 in case of Distributed Alamouti Scheme
int ulsch_power_0[2];
int ulsch_power_0[NB_ANTENNAS_RX];
/// measured RX power based on DRS for UE0 in case of Distributed Alamouti Scheme
int ulsch_power_1[2];
int ulsch_power_1[NB_ANTENNAS_RX];
/// \brief llr values.
/// - first index: ? [0..1179743] (hard coded)
int16_t *llr;
......
......@@ -2991,30 +2991,35 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,const
// TDD reciprocity DL CSIT estimation based on calibraton
start_meas(&eNB->dl_ch_calib_stats);
/* if ((fp->frame_type == TDD) &&
(((fp->tdd_config == 0) && ((subframe == 4) || (subframe == 9))) ||
((fp->tdd_config == 1) && ((subframe == 3) || (subframe == 8))) ||
((fp->tdd_config == 2) && ((subframe == 2) || (subframe == 7))) ||
((fp->tdd_config == 3) && (subframe == 4)) ||
((fp->tdd_config == 4) && (subframe == 3)) ||
((fp->tdd_config == 5) && (subframe == 2)) ||
((fp->tdd_config == 6) && ((subframe == 4) || (subframe == 8))))) {
if ((fp->frame_type == TDD) && (eNB->rfdevice.openair0_cfg[0].tdd_recip_calib == 1) &&
(((fp->tdd_config == 0) && ((subframe == 4) || (subframe == 9))) ||
((fp->tdd_config == 1) && ((subframe == 3) || (subframe == 8))) ||
((fp->tdd_config == 2) && ((subframe == 2) || (subframe == 7))) ||
((fp->tdd_config == 3) && (subframe == 4)) ||
((fp->tdd_config == 4) && (subframe == 3)) ||
((fp->tdd_config == 5) && (subframe == 2)) ||
((fp->tdd_config == 6) && ((subframe == 4) || (subframe == 8))))) {
//LOG_I(PHY, "UE %d: Estimating DLSCI from ULCSI based on TDD reciprocity calibration: Estimating DLSCI from ULCSI based on TDD reciprocity calibration\n", i);
printf(PHY, "UE %d: Estimating DLSCI from ULCSI based on TDD reciprocity calibration: Estimating DLSCI from ULCSI based on TDD reciprocity calibration\n", i);
LOG_I(PHY, "UE %d: Estimating DLSCI from ULCSI based on TDD reciprocity calibration: Estimating DLSCI from ULCSI based on TDD reciprocity calibration\n", i);
//printf(PHY, "UE %d: Estimating DLSCI from ULCSI based on TDD reciprocity calibration: Estimating DLSCI from ULCSI based on TDD reciprocity calibration\n", i);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_ULCSI_TO_DLCSI,1);
estimate_DLCSI_from_ULCSI(eNB->dlsch[i][0]->calib_dl_ch_estimates,
&eNB->pusch_vars[i]->drs_ch_estimates[eNB->UE_stats[i].sector][0],
eNB->pusch_vars[i],
eNB->common_vars.tdd_calib_coeffs[eNB->UE_stats[i].sector],
fp);
fp,
eNB->UE_stats[i].sector);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_ULCSI_TO_DLCSI,0);
// only calculate for port 5
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_COMPUTE_BF_WEIGHT,1);
compute_BF_weights(eNB->dlsch[i][0]->ue_spec_bf_weights[0],
eNB->dlsch[i][0]->calib_dl_ch_estimates,
MRT,
fp);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_COMPUTE_BF_WEIGHT,0);
} */
}
stop_meas(&eNB->dl_ch_calib_stats);
start_meas(&eNB->ulsch_decoding_stats);
......@@ -3038,7 +3043,7 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,const
#endif
stop_meas(&eNB->ulsch_decoding_stats);
LOG_D(PHY,"[eNB %d][PUSCH %d] frame %d subframe %d RNTI %x RX power (%d,%d) RSSI (%d,%d) N0 (%d,%d) dB ACK (%d,%d), decoding iter %d\n",
LOG_G(PHY,"[eNB %d][PUSCH %d] frame %d subframe %d RNTI %x RX power (%d,%d) RSSI (%d,%d) N0 (%d,%d) dB ACK (%d,%d), decoding iter %d\n",
eNB->Mod_id,harq_pid,
frame,subframe,
eNB->ulsch[i]->rnti,
......
......@@ -858,7 +858,8 @@ void schedule_ulsch_rnti(module_id_t module_idP,
rb_table_index=UE_template->pre_allocated_rb_table_index_ul;
} else {
mcs=10;//cmin (10, openair_daq_vars.target_ue_ul_mcs);
rb_table_index=5; // for PHR
//rb_table_index=5; // for PHR
rb_table_index=13; // allocate 20 RBs in order to have the most RB allocate, this is used for TDD calibration
}
UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs2=mcs;
......
......@@ -37,10 +37,10 @@ eNBs =
N_RB_DL = 25;
Nid_cell_mbsfn = 0;
nb_antenna_ports = 1;
nb_antennas_tx = 1;
nb_antennas_rx = 1;
nb_antennas_tx = 3;
nb_antennas_rx = 3;
tx_gain = 10; //25;
rx_gain = 120; //20;
rx_gain = 110; //20;
prach_root = 0;
prach_config_index = 0;
prach_high_speed = "DISABLE";
......@@ -147,10 +147,10 @@ eNBs =
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.146/24";
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.212/24";
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.146/24";
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.212/24";
ENB_PORT_FOR_S1U = 2152; # Spec 2152
};
......
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