Commit 7e9dfefb authored by rdoost's avatar rdoost

merging eurecom into my branch, changes after scan carrier mode

parents d08675d8 2fa26a00
......@@ -476,7 +476,7 @@ include_directories ("${X2AP_DIR}")
# Hardware dependant options
###################################
add_list1_option(NB_ANTENNAS_RX "2" "Number of antennas in reception" "1" "2" "4")
add_list1_option(NB_ANTENNAS_RX "4" "Number of antennas in reception" "1" "2" "4")
add_list1_option(NB_ANTENNAS_TX "4" "Number of antennas in transmission" "1" "2" "4")
add_list1_option(NB_ANTENNAS_TXRX "2" "Number of antennas in ????" "1" "2" "4")
......
......@@ -1339,6 +1339,10 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
common_vars->beam_weights[eNB_id][i] = (int32_t **)malloc16_clear(fp->nb_antennas_tx*sizeof(int32_t*));
for (j=0; j<fp->nb_antennas_tx; j++) {
common_vars->beam_weights[eNB_id][i][j] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t));
for (re=0; re<fp->ofdm_symbol_size; re++)
common_vars->beam_weights[eNB_id][i][j][re] = 0x00007fff;
//common_vars->beam_weights[eNB_id][i][j][re] = 0x14147fff;//0x434e434e; //0x3d432a22;
/*
// antenna ports 0-3 are mapped on antennas 0-3
// antenna port 4 is mapped on antenna 0
// antenna ports 5-14 are mapped on all antennas
......@@ -1348,8 +1352,9 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
}
else if (i>4) {
for (re=0; re<fp->ofdm_symbol_size; re++)
common_vars->beam_weights[eNB_id][i][j][re] = 0x00007fff/sqrt(fp->nb_antennas_tx);
}
//common_vars->beam_weights[eNB_id][i][j][re] = 0x00007fff/sqrt(fp->nb_antennas_tx);
common_vars->beam_weights[eNB_id][i][j][re] = 0x00007fff;
}*/
#ifdef DEBUG_PHY
msg("[openair][LTE_PHY][INIT] lte_common_vars->beam_weights[%d][%d][%d] = %p (%d bytes)\n",
eNB_id,i,j,common_vars->beam_weights[eNB_id][i][j],
......
......@@ -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][395];
//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,28 +58,29 @@ 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,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,
......
......@@ -3,31 +3,26 @@
#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];
int read_calibration_matrix(int32_t **tdd_calib_coeffs, char *calibF_fname, LTE_DL_FRAME_PARMS *frame_parms) {
FILE *calibF_fd;
char calibF_file_name[1024];
int aa,re,calibF_e ;
char* openair_dir = getenv("OPENAIR_DIR");
//printf("Number of antennas = %d\n", frame_parms->nb_antennas_tx) ;
//printf("OFDM symbol size = %d\n", frame_parms->ofdm_symbol_size) ;
if (openair_dir == NULL) {
printf("ERR: OPENAIR_DIR not defined (did you source oaienv?)\n");
return(1);
}
//char* openair_dir = getenv("OPENAIR_DIR");
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);
}
printf("Loading Calibration matrix from %s\n", calibF_file_name);
//printf("Loading Calibration matrix from %s\n", calibF_file_name);
printf("Loading Calibration matrix from %s\n", tdd_recip_calib_file);
for (aa=0;aa<frame_parms->nb_antennas_tx;aa++) {
for(re=0;re<frame_parms->N_RB_DL*12;re++) {
......@@ -42,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;
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=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=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++) {
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,9 +138,10 @@ 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,
int multadd_cpx_vector(int16_t *x1,
int16_t *x2,
int16_t *y,
uint8_t zero_flag,
uint32_t N,
int output_shift);
......
......@@ -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
......@@ -307,6 +318,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) {
for (i=0; i<coded_bits_per_codeword; i++) {
......@@ -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;
......
......@@ -226,8 +226,9 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],(void *)&DLSCH_alloc_pdu1,sizeof(DCI2_5MHz_2A_M10PRB_TDD_t));
break;
*/
case 8:
case 9:
case 0:
DCI_pdu->Num_ue_spec_dci = 1;
//user 1
......@@ -244,7 +245,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
UL_alloc_pdu.type = 0;
UL_alloc_pdu.hopping = 0;
UL_alloc_pdu.rballoc = computeRIV(25,2,eNB->ue_ul_nb_rb);
UL_alloc_pdu.rballoc = computeRIV(25,0,25);
UL_alloc_pdu.mcs = eNB->target_ue_ul_mcs;
UL_alloc_pdu.ndi = proc->frame_tx&1;
UL_alloc_pdu.TPC = 0;
......@@ -254,8 +255,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],(void *)&UL_alloc_pdu,sizeof(DCI0_5MHz_TDD_1_6_t));
break;
default:
case 6:
case 7:
DCI_pdu->Num_ue_spec_dci = 1;
DCI_pdu->dci_alloc[0].L = 2;
......@@ -611,8 +611,8 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
break;
*/
/*default:
break;*/
default:
break;
}
/*
......
......@@ -2017,7 +2017,7 @@ void prach_procedures(PHY_VARS_eNB *eNB) {
eNB->UE_stats[(uint32_t)UE_id].UE_timing_offset = preamble_delay_list[preamble_max]&0x1FFF; //limit to 13 (=11+2) bits
eNB->UE_stats[(uint32_t)UE_id].sector = 0;
LOG_D(PHY,"[eNB %d/%d][RAPROC] Frame %d, subframe %d Initiating RA procedure (UE_id %d) with preamble %d, energy %d.%d dB, delay %d\n",
LOG_I(PHY,"[eNB %d/%d][RAPROC] Frame %d, subframe %d Initiating RA procedure (UE_id %d) with preamble %d, energy %d.%d dB, delay %d\n",
eNB->Mod_id,
eNB->CC_id,
frame,
......@@ -2991,7 +2991,7 @@ 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) &&
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))) ||
......@@ -3001,20 +3001,24 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,const
((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);
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 +3042,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,
......
......@@ -67,6 +67,8 @@ double t_rx_min = 1000000000; /*!< \brief initial min process time for rx */
int n_tx_dropped = 0; /*!< \brief initial max process time for tx */
int n_rx_dropped = 0; /*!< \brief initial max process time for rx */
char tdd_recip_calib_file[1024];
void handler(int sig)
{
void *array[10];
......
......@@ -124,6 +124,7 @@ int main(int argc, char **argv)
//int32_t **cell_spec_bf_weights;
int32_t *ue_spec_bf_weights;
uint8_t tdd_calib=0;
char tdd_recip_calib_file[1024];
int eNB_id = 0, eNB_id_i = 1;
unsigned char mcs1=0,mcs2=0,mcs_i=0,dual_stream_UE = 0,awgn_flag=0,round,dci_flag=0;
......@@ -2170,10 +2171,16 @@ PMI_FEEDBACK:
}
estimate_DLCSI_from_ULCSI(eNB->dlsch[0][0]->calib_dl_ch_estimates,
/*estimate_DLCSI_from_ULCSI(eNB->dlsch[0][0]->calib_dl_ch_estimates,
&eNB->pusch_vars[0]->drs_ch_estimates[0][0],//position of second DMRS
eNB->common_vars.tdd_calib_coeffs[0],
frame_parms);
frame_parms);*/
estimate_DLCSI_from_ULCSI(eNB->dlsch[0][0]->calib_dl_ch_estimates,
eNB->pusch_vars[0],//position of second DMRS
eNB->common_vars.tdd_calib_coeffs[0],
frame_parms,
0);
compute_BF_weights(eNB->dlsch[0][0]->ue_spec_bf_weights[0],
eNB->dlsch[0][0]->calib_dl_ch_estimates,
......
......@@ -853,12 +853,13 @@ void schedule_ulsch_rnti(module_id_t module_idP,
UE_list->eNB_UE_stats[CC_id][UE_id].normalized_rx_power=normalized_rx_power;
UE_list->eNB_UE_stats[CC_id][UE_id].target_rx_power=target_rx_power;
UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs1=UE_template->pre_assigned_mcs_ul;
mcs = UE_template->pre_assigned_mcs_ul;//cmin (UE_template->pre_assigned_mcs_ul, openair_daq_vars.target_ue_ul_mcs); // adjust, based on user-defined MCS
mcs = cmin (UE_template->pre_assigned_mcs_ul, 10); // adjust, based on user-defined MCS
if (UE_template->pre_allocated_rb_table_index_ul >=0) {
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;
......
......@@ -290,6 +290,8 @@ const char* eurecomFunctionsNames[] = {
"phy_eNB_dlsch_scrambling",
"phy_eNB_beam_precoding",
"phy_eNB_ofdm_mod_l",
"phy_eNB_ulcsi_to_dlsci",
"phy_eNB_compute_bf_weight",
/* MAC signals */
"macxface_macphy_init",
......
......@@ -264,6 +264,8 @@ typedef enum {
VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_SCRAMBLING,
VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_BEAM_PRECODING,
VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_OFDM_MODULATION,
VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_ULCSI_TO_DLCSI,
VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_COMPUTE_BF_WEIGHT,
/* MAC signals */
VCD_SIGNAL_DUMPER_FUNCTIONS_MACPHY_INIT,
......
......@@ -70,7 +70,9 @@ typedef enum {
#include <enums.h>
#else
typedef enum {
duplex_mode_TDD=1,duplex_mode_FDD=0
duplex_mode_FDD=0,
duplex_mode_TDD=1,
duplex_mode_TDD_workaround=2 // TDD workaround flag for EXMIMO2 card because of the PLL limitation in TDD mode for Lms6002D
} duplex_mode_t;
#endif
......@@ -205,6 +207,9 @@ typedef struct {
unsigned int my_port;
//! Configuration file for LMS7002M
char *configFilename;
//! TDD Reciprocity calibration, when equals 1, card
//config by Octave rather than by softmodem
int tdd_recip_calib;
} openair0_config_t;
/*! \brief RF mapping */
......
......@@ -80,7 +80,6 @@ static uint32_t rf_vcocal_850[4] = {2015, 2015, 2015, 2015
static uint32_t rf_rxdc[4] = {32896,32896,32896,32896};
extern volatile int oai_exit;
......@@ -654,6 +653,9 @@ void trx_exmimo_end(openair0_device *device) {
exmimo_state_t *exm=device->priv;
exm->daq_state = idle;
if (device->openair0_cfg[0].tdd_recip_calib == 1)
openair0_stop_without_reset(0);
else
openair0_stop(0);
}
......@@ -676,6 +678,9 @@ int trx_exmimo_stop(openair0_device* device) {
printf("Stopping ...\n");
exm->daq_state = idle;
if (device->openair0_cfg[0].tdd_recip_calib == 1)
openair0_stop_without_reset(0);
else
openair0_stop(0);
return(0);
......@@ -800,6 +805,18 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag)
return(-1);
}
/* device specific */
for (card=0; card<openair0_num_detected_cards; card++) {
openair0_cfg[card].iq_txshift = 4;//shift
openair0_cfg[card].iq_rxrescale = 15;//rescale iqs
}
if (openair0_cfg[0].tdd_recip_calib == 1) {
printf("Warning, doing TDD reciprocity calibration, configuration has been done in Octave!!\n");
return(-1);
}
for (card=0; card<openair0_num_detected_cards; card++) {
ACTIVE_RF=0;
......@@ -818,28 +835,24 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag)
else
p_exmimo_config->framing.multicard_syncmode=SYNCMODE_SLAVE;
/* device specific */
openair0_cfg[card].iq_txshift = 4;//shift
openair0_cfg[card].iq_rxrescale = 15;//rescale iqs
if (openair0_cfg[card].sample_rate==30.72e6) {
resampling_factor = 0;
if (openair0_cfg[card].duplex_mode==duplex_mode_TDD) {
if (openair0_cfg[card].duplex_mode==duplex_mode_TDD_workaround) {
printf("Warning: TDD workaround may not work for bw 20");
}
rx_filter = RXLPF10;
tx_filter = TXLPF10;
} else if (openair0_cfg[card].sample_rate==15.36e6) {
resampling_factor = 1;
if (openair0_cfg[card].duplex_mode==duplex_mode_TDD)
if (openair0_cfg[card].duplex_mode==duplex_mode_TDD_workaround)
rx_filter = RXLPF10;
else
rx_filter = RXLPF5;
tx_filter = TXLPF5;
} else if (openair0_cfg[card].sample_rate==7.68e6) {
resampling_factor = 2;
if (openair0_cfg[card].duplex_mode==duplex_mode_TDD) // TDD workaround for EXMIMO
if (openair0_cfg[card].duplex_mode==duplex_mode_TDD_workaround)
rx_filter = RXLPF5;
else
rx_filter = RXLPF25;
......@@ -847,7 +860,7 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag)
} else {
printf("Sampling rate not supported, using default 7.68MHz");
resampling_factor = 2;
if (openair0_cfg[card].duplex_mode==duplex_mode_TDD)
if (openair0_cfg[card].duplex_mode==duplex_mode_TDD_workaround)
rx_filter = RXLPF5;
else
rx_filter = RXLPF25;
......@@ -899,7 +912,7 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag)
p_exmimo_config->rf.rf_freq_rx[ant] = (unsigned int)openair0_cfg[card].rx_freq[ant];
// TDD workaround
if (openair0_cfg[card].duplex_mode==duplex_mode_TDD)
if (openair0_cfg[card].duplex_mode==duplex_mode_TDD_workaround)
p_exmimo_config->rf.rf_freq_rx[ant] += openair0_cfg[card].sample_rate/4;
switch (openair0_cfg[card].rxg_mode[ant]) {
......@@ -963,11 +976,12 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag)
p_exmimo_config->framing.tdd_config = DUPLEXMODE_FDD;// + TXRXSWITCH_LSB + TXRXSWITCH_LSB + ACTIVE_RF+ ACTIVE_RF;
printf("!!!!!setting FDD (tdd_config=%d)\n",p_exmimo_config->framing.tdd_config);
}
else {
// TDD workaround
//p_exmimo_config->framing.tdd_config = DUPLEXMODE_TDD + TXRXSWITCH_LSB + ACTIVE_RF;
p_exmimo_config->framing.tdd_config = DUPLEXMODE_FDD + TXRXSWITCH_LSB;
else if (openair0_cfg[card].duplex_mode==duplex_mode_TDD) {
p_exmimo_config->framing.tdd_config = DUPLEXMODE_TDD + TXRXSWITCH_LSB + ACTIVE_RF;
printf("!!!!!setting TDD (tdd_config=%d)\n",p_exmimo_config->framing.tdd_config);
} else {
p_exmimo_config->framing.tdd_config = DUPLEXMODE_FDD + TXRXSWITCH_LSB;
printf("!!!!!setting TDD WORKAROUND (tdd_config=%d)\n",p_exmimo_config->framing.tdd_config);
}
ret = ioctl(openair0_fd, openair_DUMP_CONFIG, card);
......
Active_eNBs = ( "eNB_Eurecom_LTEBox");
# Asn1_verbosity, choice in: none, info, annoying
Asn1_verbosity = "none";
eNBs =
(
{
////////// Identification parameters:
eNB_ID = 0xe00;
cell_type = "CELL_MACRO_ENB";
eNB_name = "eNB_Eurecom_LTEBox";
// Tracking area code, 0x0000 and 0xfffe are reserved values
tracking_area_code = "1";
mobile_country_code = "208";
mobile_network_code = "94";
////////// Physical parameters:
component_carriers = (
{
node_function = "eNodeB_3GPP";
node_timing = "synch_to_ext_device";
node_synch_ref = 0;
frame_type = "TDD";
tdd_config = 3;
tdd_config_s = 0;
prefix_type = "NORMAL";
eutra_band = 38;
downlink_frequency = 2580000000L;
uplink_frequency_offset = 0;
Nid_cell = 0;
N_RB_DL = 25;
Nid_cell_mbsfn = 0;
nb_antenna_ports = 1;
nb_antennas_tx = 1;
nb_antennas_rx = 1;
tx_gain = 90;
rx_gain = 125;
prach_root = 0;
prach_config_index = 0;
prach_high_speed = "DISABLE";
prach_zero_correlation = 1;
prach_freq_offset = 2;
pucch_delta_shift = 1;
pucch_nRB_CQI = 1;
pucch_nCS_AN = 0;
pucch_n1_AN = 32;
pdsch_referenceSignalPower = -24;
pdsch_p_b = 0;
pusch_n_SB = 1;
pusch_enable64QAM = "DISABLE";
pusch_hoppingMode = "interSubFrame";
pusch_hoppingOffset = 0;
pusch_groupHoppingEnabled = "ENABLE";
pusch_groupAssignment = 0;
pusch_sequenceHoppingEnabled = "DISABLE";
pusch_nDMRS1 = 1;
phich_duration = "NORMAL";
phich_resource = "ONESIXTH";
srs_enable = "DISABLE";
/* srs_BandwidthConfig =;
srs_SubframeConfig =;
srs_ackNackST =;
srs_MaxUpPts =;*/
pusch_p0_Nominal = -90;
pusch_alpha = "AL1";
pucch_p0_Nominal = -96;
msg3_delta_Preamble = 6;
pucch_deltaF_Format1 = "deltaF2";
pucch_deltaF_Format1b = "deltaF3";
pucch_deltaF_Format2 = "deltaF0";
pucch_deltaF_Format2a = "deltaF0";
pucch_deltaF_Format2b = "deltaF0";
rach_numberOfRA_Preambles = 64;
rach_preamblesGroupAConfig = "DISABLE";
/*
rach_sizeOfRA_PreamblesGroupA = ;
rach_messageSizeGroupA = ;
rach_messagePowerOffsetGroupB = ;
*/
rach_powerRampingStep = 4;
rach_preambleInitialReceivedTargetPower = -104;
rach_preambleTransMax = 10;
rach_raResponseWindowSize = 10;
rach_macContentionResolutionTimer = 48;
rach_maxHARQ_Msg3Tx = 4;
pcch_default_PagingCycle = 128;
pcch_nB = "oneT";
bcch_modificationPeriodCoeff = 2;
ue_TimersAndConstants_t300 = 1000;
ue_TimersAndConstants_t301 = 1000;
ue_TimersAndConstants_t310 = 1000;
ue_TimersAndConstants_t311 = 10000;
ue_TimersAndConstants_n310 = 20;
ue_TimersAndConstants_n311 = 1;
ue_TransmissionMode = 1;
}
);
srb1_parameters :
{
# timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500]
timer_poll_retransmit = 80;
# timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200]
timer_reordering = 35;
# timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500]
timer_status_prohibit = 0;
# poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)]
poll_pdu = 4;
# poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)]
poll_byte = 99999;
# max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32]
max_retx_threshold = 4;
}
# ------- SCTP definitions
SCTP :
{
# Number of streams to use in input/output
SCTP_INSTREAMS = 2;
SCTP_OUTSTREAMS = 2;
};
////////// MME parameters:
mme_ip_address = ( { ipv4 = "192.168.12.70";
ipv6 = "192:168:30::17";
active = "yes";
preference = "ipv4";
}
);
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth1";
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.146/24";
ENB_INTERFACE_NAME_FOR_S1U = "eth1";
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.146/24";
ENB_PORT_FOR_S1U = 2152; # Spec 2152
};
log_config :
{
global_log_level ="info";
global_log_verbosity ="medium";
hw_log_level ="info";
hw_log_verbosity ="medium";
phy_log_level ="info";
phy_log_verbosity ="medium";
mac_log_level ="info";
mac_log_verbosity ="high";
rlc_log_level ="info";
rlc_log_verbosity ="medium";
pdcp_log_level ="info";
pdcp_log_verbosity ="medium";
rrc_log_level ="info";
rrc_log_verbosity ="medium";
};
}
);
......@@ -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
};
......
%
% PURPOSE : channel estimation using least square method
%
% ARGUMENTS :
%
% m_sym_T : transmitted symbol, d_N_f x d_N_ofdm x d_N_ant_act x d_N_meas
% m_sym_R : received symbol, d_N_f x d_N_ofdm x d_N_ant_act x d_N_meas
% d_N_meas : number of measurements
%
% OUTPUTS :
%
% m_H_est : estimation of sub-channels, d_N_antR x d_N_antT x d_N_f x d_N_meas
%
%**********************************************************************************************
% EURECOM - All rights reserved
%
% AUTHOR : Xiwen JIANG, Florian Kaltenberger
%
% DEVELOPMENT HISTORY :
%
% Date Name(s) Version Description
% ----------- ------------- ------- ------------------------------------------------------
% Apr-29-2014 X. JIANG 0.1 creation of code
%
% REFERENCES/NOTES/COMMENTS :
%
% - Based on the function "runmeas_full_duplex" created by Mirsad Cirkic, Florian Kaltenberger.
%
%**********************************************************************************************
function m_H_est = f_ch_est(m_sym_T, m_sym_R)
%% ** initialisation **
[d_N_f,d_N_OFDM,d_N_antT,d_N_meas] = size(m_sym_T);
d_N_antR = size(m_sym_R,3);
m_H_est = zeros(d_N_antR,d_N_antT,d_N_f,d_N_meas);
%% ** estimate the subband channel for each measurement and antenna **
for d_n_meas = 1:d_N_meas
for d_n_f = 1:d_N_f
m_y = reshape(m_sym_R(d_n_f,:,:,d_n_meas),d_N_OFDM,d_N_antR).'; % squeeze: problem for antenna number = 1 case
m_s = reshape(m_sym_T(d_n_f,:,:,d_n_meas),d_N_OFDM,d_N_antT).';
m_H_est(:,:,d_n_f,d_n_meas) = m_y*m_s'/(m_s*m_s'); % LS channel estimation
end
end
end
function m_sig_T = f_ofdm_mod(m_sym_T, d_N_FFT, d_N_CP, d_N_OFDM, v_active_rf, d_amp)
d_N_ant_act = sum(v_active_rf);
%** mapping useful data to favorable carriers **
m_sym_T_ext = zeros(d_N_FFT,d_N_OFDM,d_N_ant_act);
m_sym_T_ext(363:512,:,:) = m_sym_T(1:150,:,:);
m_sym_T_ext(2:151,:,:) = m_sym_T(151:300,:,:);
%** ifft **
m_sig_T_ = sqrt(d_N_FFT)*ifft(m_sym_T_ext,d_N_FFT,1);
%** add cyclic prefix **
m_sig_T_ = [m_sig_T_(end-d_N_CP+1:end,:,:); m_sig_T_];
d_L = (d_N_FFT+d_N_CP)*d_N_OFDM;
m_sig_T = floor(reshape(m_sig_T_,d_L,d_N_ant_act)*d_amp);
end
%
% PURPOSE : OFDM Receiver
%
% ARGUMENTS :
%
% m_sig_R : received signal with dimension ((d_N_FFT+d_N_CP)*d_N_ofdm) x d_N
% d_N_FFT : total carrier number
% d_N_CP : extented cyclic prefix
% d_N_OFDM : OFDM symbol number per frame
% v_active_rf : active RF antenna indicator
%
% OUTPUTS :
%
% m_sym_R : transmitted signal before IFFT with dimension d_N_f x d_N_ofdm x d_N_ant_act
%
%**********************************************************************************************
% EURECOM - All rights reserved
%
% AUTHOR : Xiwen JIANG, Florian Kaltenberger
%
% DEVELOPMENT HISTORY :
%
% Date Name(s) Version Description
% ----------- ------------- ------- ------------------------------------------------------
% Apr-29-2014 X. JIANG 0.1 creation of code
%
% REFERENCES/NOTES/COMMENTS :
%
% - Based on the function "genrandpskseq" created by Mirsad Cirkic, Florian Kaltenberger.
%
%**********************************************************************************************
function m_sym_R = f_ofdm_rx(m_sig_R, d_N_FFT, d_N_CP, d_N_OFDM, v_active_rf)
d_N_ant_act = sum(v_active_rf);
m_sig_R_eff = m_sig_R(:,find(v_active_rf));
m_sig_R_f = reshape(m_sig_R_eff,(d_N_FFT+d_N_CP),d_N_OFDM,d_N_ant_act);
%** delete the CP **
m_sig_R_noCP = m_sig_R_f(d_N_CP+1:end,:,:);
%** fft **
%m_sym_R_fft = fft(m_sig_R_noCP,d_N_FFT,1);
m_sym_R_fft = 1/sqrt(d_N_FFT)*fft(m_sig_R_noCP,d_N_FFT,1);
m_sym_R = m_sym_R_fft([363:512 2:151],:,:);
end
%
% PURPOSE : OFDM Transmitter
%
% ARGUMENTS :
%
% d_M : modulation order
% d_N_f : carrier number carrying data
% d_N_FFT : total carrier number
% d_N_CP : extented cyclic prefix
% d_N_OFDM : OFDM symbol number per frame
% d_N_ant : antenna number
% v_active_rf : active RF antenna indicator
% d_amp : amplitude
%
% OUTPUTS :
%
% m_sym_T : transmitted signal before IFFT with dimension d_N_f x d_N_OFDM x d_N_ant_act
% m_sig_T : OFDM signal with dimension ((d_N_FFT+d_N_CP)*d_N_OFDM) x d_N_ant
%
%**********************************************************************************************
% EURECOM - All rights reserved
%
% AUTHOR : Xiwen JIANG, Florian Kaltenberger
%
% DEVELOPMENT HISTORY :
%
% Date Name(s) Version Description
% ----------- ------------- ------- ------------------------------------------------------
% Apr-29-2014 X. JIANG 0.1 creation of code
%
% REFERENCES/NOTES/COMMENTS :
%
% - Based on the function "genrandpskseq" created by Mirsad Cirkic, Florian Kaltenberger.
%
%**********************************************************************************************
function [m_sym_T, m_sig_T] = f_ofdm_tx(d_M, d_N_f, d_N_FFT, d_N_CP, d_N_OFDM, d_N_ant, v_active_rf, d_amp)
d_N_ant_act = sum(v_active_rf);
%** constellation table **
v_MPSK = exp(sqrt(-1)*([1:d_M]*2*pi/d_M+pi/d_M));
%** transmitted symbol **
m_sym_T = v_MPSK(ceil(rand(d_N_f, d_N_OFDM, d_N_ant_act)*d_M));
%** mapping useful data to favorable carriers **
m_sym_T_ext = zeros(d_N_FFT,d_N_OFDM,d_N_ant_act);
m_sym_T_ext(363:512,:,:) = m_sym_T(1:150,:,:);
m_sym_T_ext(2:151,:,:) = m_sym_T(151:300,:,:);
%** ifft **
m_sig_T_ = sqrt(d_N_FFT)*ifft(m_sym_T_ext,d_N_FFT,1);
%m_sig_T_ = ifft(m_sym_T_ext,d_N_FFT,1);
%** add cyclic prefix **
m_sig_T_ = [m_sig_T_(end-d_N_CP+1:end,:,:); m_sig_T_];
d_L = (d_N_FFT+d_N_CP)*d_N_OFDM;
m_sig_T_temp = reshape(m_sig_T_,d_L,d_N_ant_act);
%** mapping to active antennas **
m_sig_T = zeros(d_L,d_N_ant);
m_sig_T(:,find(v_active_rf)) = floor(m_sig_T_temp*d_amp);
end
%
% PURPOSE : TLS solution for AX = B based on SVD
%
% ARGUMENTS :
%
% A : observation of A
% B : observation of B
%
% OUTPUTS :
%
% X : TLS solution for X
%
%**********************************************************************************************
% EURECOM - All rights reserved
%
% AUTHOR : Xiwen JIANG, Florian Kaltenberger
%
% DEVELOPMENT HISTORY :
%
% Date Name(s) Version Description
% ----------- ------------- ------- ------------------------------------------------------
% Apr-30-2014 X. JIANG 0.1 creation of code
%
% REFERENCES/NOTES/COMMENTS :
%
% - I. Markovsky and S. V. Huffel, Overview of total least-squares methods, Signal Processing, vol. 87, pp.
% 22832302, 2007
%
%**********************************************************************************************
function [X_est A_est B_est]= f_tls_svd(A,B)
C = [A B];
n = size(A,2);
d = size(B,2);
[U S V] = svd(C,0);
V12 = V(1:n,n+1:end);
V22 = V(n+1:end,n+1:end);
S1 = S(1:n,1:n);
Z12 = zeros(n,d);
Z22 = zeros(d);
Z21 = zeros(d,n);
X_est = - V12/V22;
C_est = U*[S1 Z12;Z21 Z22]*V';
A_est = C_est(:,n);
B_est = C_est(:,n+1:end);
% delta_C = -U*diag([0,0,S(3,3),S(4,4)])*V';
end
\ No newline at end of file
-32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196 -32419 -1196
31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310 31357 -8310
32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3 32440 3
32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0
32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0
32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0 32767 0
d_N_antM = 3;
d_N_f = 300;
m_F_norm = ones(d_N_antM, d_N_f)*(1+0*1i);
m_F_Q15 = zeros(d_N_antM, d_N_f*2);
m_F_Q15(:,1:2:end-1) = floor(real(m_F_norm)*(2^15))-1;
m_F_Q15(:,2:2:end) = floor(imag(m_F_norm)*(2^15));
%%save('-ascii','calibF.mtx','m_F2_diag_Q14');
dlmwrite('result/calibF_iden.mtx', m_F_Q15,' ');
%
% SCRIPT ID : s_beamforming
%
% PROJECT NAME : TDD Recoprocity
%
% PURPOSE : perform beamforming based on TDD calibration
%
%**********************************************************************************************
% Eurecom - All rights reserved
%
% AUTHOR(s) : Xiwen JIANG, Florian Kaltenberger
%
% DEVELOPMENT HISTORY :
%
% Date Name(s) Version Description
% ----------- ------------- ------- ------------------------------------------------------
% Apr-30-2014 X. JIANG 0.1 script creation v0.1
%
% REFERENCES/NOTES/COMMENTS :
%
% - Based on the script "beamforming" created by Mirsad Cirkic, Florian Kaltenberger.
%
%**********************************************************************************************
clear all
%% -------- initilisation --------
d_M = 4; % modulation order, e.g. 4 means QPSK
%** frequency **
d_fc = 2580000000; %1907600000;
d_delta_f = 15000;
d_N_f = 301; % carrier number carrying data
d_N_FFT = 512; % total carrier number
d_N_CP = 128; % extented cyclic prefix
%%** time **
d_N_OFDM = 120; % number of ofdm symbol per frame
d_N_meas = 1; % measuement number
%%** space **
d_N_antA = 4; % antenna number at site a
d_N_antB = 4; % antenna number at site b
v_active_rfA = [1 1 0 0];
v_active_rfB = [0 0 0 1];
active_rf = v_active_rfA | v_active_rfB;
v_indA = find(v_active_rfA); % active antenna index at site a
v_indB = find(v_active_rfB); % active antenna index at site b
d_N_antA_act = length(v_indA);
d_N_antB_act = length(v_indB);
%
%%** amplitude **
d_amp = pow2(13);
d_n_bit = 16;
card = 0;
%% -------- load F --------
o_result = load('result/m_F.mat');
m_F = o_result.m_F;
%% -------- channel measurement --------
s_run_meas;
%% -------- signal precoding --------
v_MPSK = exp(sqrt(-1)*([1:d_M]*2*pi/d_M+pi/d_M));
m_sym_TA = v_MPSK(ceil(rand(d_N_f, d_N_OFDM)*d_M));
m_sym_TA_ideal = zeros(d_N_f,d_N_OFDM,d_N_antA_act);
m_sym_TA_iden = zeros(d_N_f,d_N_OFDM,d_N_antA_act);
m_sym_TA_diag = zeros(d_N_f,d_N_OFDM,d_N_antA_act);
d_N_sig = (d_N_FFT + d_N_CP)*d_N_OFDM;
m_sig_TA_ideal = ones(d_N_sig,4)*(1+1i);
m_sig_TA_iden = ones(d_N_sig,4)*(1+1i);
m_sig_TA_diag = ones(d_N_sig,4)*(1+1i);
m_sig_TB = ones(d_N_sig,4)*(1+1i);
m_H_calib_A2B = zeros(1,2, d_N_f);
for d_f = 1:d_N_f
%** ideal case **
v_H_A2B_ideal = squeeze(m_H_est_A2B(:,:,d_f));
v_P_ideal = v_H_A2B_ideal'/norm(v_H_A2B_ideal);
m_sym_TA_ideal(d_f,:,:) = (v_P_ideal*m_sym_TA(d_f,:)).';
%** identity matrix **
v_H_A2B_iden = squeeze(m_H_est_B2A(:,:,d_f)).';
v_P_iden = v_H_A2B_iden'/norm(v_H_A2B_iden);
m_sym_TA_iden(d_f,:,:) = (v_P_iden*m_sym_TA(d_f,:)).';
%** diagonal calibration **
v_H_A2B_diag = squeeze(m_H_est_B2A(:,:,d_f).')*diag(m_F(:,d_f));
v_P_diag = v_H_A2B_diag'/norm(v_H_A2B_diag);
m_sym_TA_diag(d_f,:,:) = (v_P_diag*m_sym_TA(d_f,:)).';
m_H_calib_A2B(:,:,d_f) = v_H_A2B_diag;
end
%% -------- signal transmission --------
m_sig_TA_ideal(:,v_indA) = f_ofdm_mod(m_sym_TA_ideal,d_N_FFT,d_N_CP,d_N_OFDM,v_active_rfA,d_amp)*2;
m_sig_TA_iden(:,v_indA) = f_ofdm_mod(m_sym_TA_iden,d_N_FFT,d_N_CP,d_N_OFDM,v_active_rfA,d_amp)*2;
m_sig_TA_diag(:,v_indA) = f_ofdm_mod(m_sym_TA_diag,d_N_FFT,d_N_CP,d_N_OFDM,v_active_rfA,d_amp)*2;
d_N_sig_R = d_N_OFDM*(d_N_FFT+d_N_CP);
v_P = exp(1i*2*pi*(0:(d_N_sig_R-1))/4).';
m_P = repmat(v_P,1,4);
oarf_send_frame(card,m_sig_TB,d_n_bit);
m_noise_RB_ = oarf_get_frame(-2);
m_noise_RB = m_noise_RB_(1:d_N_sig,:).*m_P;
m_n_sym_RB = f_ofdm_rx(m_noise_RB, d_N_FFT, d_N_CP, d_N_OFDM, v_active_rfB);
oarf_send_frame(card,m_sig_TA_ideal,d_n_bit);
m_sig_RB_ideal_ = oarf_get_frame(-2);
m_sig_RB_ideal = m_sig_RB_ideal_(1:d_N_sig,:).*m_P;
m_sym_RB_ideal = f_ofdm_rx(m_sig_RB_ideal, d_N_FFT, d_N_CP, d_N_OFDM, v_active_rfB);
oarf_send_frame(card,m_sig_TA_iden,d_n_bit);
m_sig_RB_iden_ = oarf_get_frame(-2);
m_sig_RB_iden = m_sig_RB_iden_(1:d_N_sig,:).*m_P;
m_sym_RB_iden = f_ofdm_rx(m_sig_RB_iden, d_N_FFT, d_N_CP, d_N_OFDM, v_active_rfB);
oarf_send_frame(card,m_sig_TA_diag,d_n_bit);
m_sig_RB_diag_ = oarf_get_frame(-2);
m_sig_RB_diag = m_sig_RB_diag_(1:d_N_sig,:).*m_P;
m_sym_RB_diag = f_ofdm_rx(m_sig_RB_diag, d_N_FFT, d_N_CP, d_N_OFDM, v_active_rfB);
%% -------- SNR measurement --------
%** noise measurment **
v_P_n = mean(var(squeeze(m_n_sym_RB),0,2));
%** SNR caculation
%v_P_s_ideal = zeros(301,1);
%for d_f=1:d_N_f
% v_H_A2B_ideal = squeeze(m_H_est_A2B(:,:,d_f));
% v_P_s_ideal(d_f) = norm(v_H_A2B_ideal)^2;
%end
%keyboard;
v_P_s_ideal = var(squeeze(m_sym_RB_ideal),0,2);
v_P_s_iden = var(squeeze(m_sym_RB_iden),0,2);
v_P_s_diag = var(squeeze(m_sym_RB_diag),0,2);
v_SNR_ideal_ = 10*log10((v_P_s_ideal-v_P_n)./v_P_n);
v_SNR_iden_ = 10*log10((v_P_s_iden-v_P_n)./v_P_n);
v_SNR_diag_ = 10*log10((v_P_s_diag-v_P_n)./v_P_n);
v_SNR_ideal = nan(d_N_f+1,1);
v_SNR_iden = nan(d_N_f+1,1);
v_SNR_diag = nan(d_N_f+1,1) ;
v_SNR_ideal([1:150 152:301]) = v_SNR_ideal_([1:150 152:301]);
v_SNR_iden([1:150 152:301]) = v_SNR_iden_([1:150 152:301]) ;
v_SNR_diag([1:150 152:301]) = v_SNR_diag_([1:150 152:301]) ;
%save('-v7','result/bf_gain_4x1_t3.mat','v_SNR_ideal','v_SNR_iden','v_SNR_diag','v_SNR_full');
%% -------- plot --------
v_f = d_fc-floor(d_N_f/2)*d_delta_f:d_delta_f:d_fc+ceil(d_N_f/2)*d_delta_f;
figure(6)
hold on
plot(v_f,v_SNR_ideal,'k-o')
plot(v_f,v_SNR_iden,'g-')
plot(v_f,v_SNR_diag,'r-*')
hold off
%ylim([30 40])
%%------------- Calibration ---------------
m_F_test = zeros(2, d_N_f);
for d_f = 1:d_N_f
m_F_test(:,d_f) = (squeeze(m_H_est_A2B(:,:,d_f)).')./squeeze(m_H_est_B2A(:,:,d_f));
end
%figure(12)
%subplot(2,1,1)
%hold on;
%for d_f=1:d_N_f
% plot(m_F_test(1,d_f),'bo')
% plot(m_F_test(2,d_f),'ro')
%end
%hold off;
%title('Diagonal F');
%axis([-2 2 -2 2])
%grid on
%
%subplot(2,1,2)
%hold on;
%for d_f=1:d_N_f
% plot(m_F(1,d_f),'bo')
% plot(m_F(2,d_f),'ro')
%end
%hold off;
%title('Diagonal F');
%axis([-2 2 -2 2])
%grid on
figure(13)
subplot(2,2,1)
plot(20*log10(abs(squeeze(m_H_est_A2B).')),'-');
ylim([0 100])
subplot(2,2,2)
plot(20*log10(abs(squeeze(m_H_calib_A2B).')),'-');
ylim([0 100])
subplot(2,2,3)
plot(angle(squeeze(m_H_est_A2B).'),'-');
subplot(2,2,4)
plot(angle(squeeze(m_H_calib_A2B).'),'-');
%
% SCRIPT ID : s_run_calib
%
% PROJECT NAME : TDD Recoprocity
%
% PURPOSE : channel calibration for MISO case
%
%**********************************************************************************************
% Eurecom - All rights reserved
%
% AUTHOR(s) : Xiwen JIANG, Florian Kaltenberger
%
% DEVELOPMENT HISTORY :
%
% Date Name(s) Version Description
% ----------- ------------- ------- ------------------------------------------------------
% Apr-30-2014 X. JIANG 0.1 script creation v0.1
% Feb-21-2017 X. JIANG 0.2 script adaption for WSA demo at Berlin
%
% REFERENCES/NOTES/COMMENTS :
%
% - Based on the script "calibration" created by Mirsad Cirkic, Florian Kaltenberger.
%
%**********************************************************************************************
%% ** initilisation **
%---------- to change in experiement ---------
%clc
%clear all
%close all
%d_N_f = 301; % carrier number carrying data
%d_N_meas = 10; % measuement number
%d_N_loc = 5; % Rx locations
%d_N_antM = 2; % max active antenna number for site a and site b
%----------------------------------------------
%% -------- System parameters --------
d_M = 4; % modulation order, e.g. 4 means QPSK
%** frequency **
d_N_f = 300; % carrier number carrying data
d_N_FFT = 512; % total carrier number
d_N_CP = 128; % extented cyclic prefix
%** time **
d_N_OFDM = 120; % number of ofdm symbol per frame
d_N_meas = 1; % measuement number
%** space **
d_N_antA = 4; % antenna number at site a
d_N_antB = 4; % antenna number at site b
v_indA = find(v_active_rfA); % active antenna index at site a
v_indB = find(v_active_rfB); % active antenna index at site b
%** amplitude **
d_amp = pow2(13)-1; % to see how to be used??
%% -------- calibration parameters -------
d_N_loc = 1; % Rx locations
d_N_antM = max(sum(v_active_rfA),sum(v_active_rfB)); % max active antenna number for site a and site b
m_H_A2B = zeros(d_N_antM,d_N_meas*d_N_loc, d_N_f); % d_N_antA x (d_N_meas*d_N_loc) x d_N_f
m_H_B2A = zeros(d_N_antM,d_N_meas*d_N_loc, d_N_f); % d_N_antA x (d_N_meas*d_N_loc) x d_N_f
m_F = zeros(d_N_antM,d_N_f);
m_F_ = zeros(d_N_antM,d_N_meas,d_N_f);
%% ** collect the measurement data from different locations **
d_loc = 1;
while(d_loc <= d_N_loc)
% run measurement, note: uncomment "clear all"
s_run_meas;
% -----------------------------------------------------
d_yes = yes_or_no('valid measurement?');
if d_yes == 1
m_H_A2Bi = permute(squeeze(m_H_est_A2B),[1 3 2]);
m_H_B2Ai = permute(squeeze(m_H_est_B2A),[1 3 2]);
m_H_A2B(:,(d_loc-1)*d_N_meas+1:d_loc*d_N_meas,:) = m_H_A2Bi;
m_H_B2A(:,(d_loc-1)*d_N_meas+1:d_loc*d_N_meas,:) = m_H_B2Ai;
d_loc = d_loc +1
end
%keyboard;
pause
end
%s_run_meas;
%% --- the following part is dedicated to B2A MISO -----
%m_H_A2B = squeeze(m_H_est_A2B);
%m_H_B2A = squeeze(m_H_est_B2A);
%% -----------------------------------------------------
%% ** calibration **
for d_f = 1:d_N_f
m_F(:,d_f) = mean(m_H_A2B(:,:,d_f)./m_H_B2A(:,:,d_f),2);
end
m_F_norm = zeros(d_N_antM+1, d_N_f);
m_F_norm(1, :) = mean(m_F(1, :),2);
m_F_norm(2, :) = mean(m_F(2, :),2);
m_F_norm(3, :) = 1+0.0001i;
m_F_norm = m_F_norm./abs(m_F_norm)*0.99;
%keyboard
save('-v7','result/m_F.mat','m_F');
%% ** transform the data to Q2.14 format and store it in a .mtx file
m_F_Q15 = zeros(d_N_antM+1,d_N_f*2);
m_F_Q15(:,1:2:end-1) = floor(real(m_F_norm)*(2^15));
m_F_Q15(:,2:2:end) = floor(imag(m_F_norm)*(2^15));
%%save('-ascii','calibF.mtx','m_F2_diag_Q14');
dlmwrite('result/calibF.mtx', m_F_Q15,' ');
%% ** plot **
figure(11)
hold on;
for d_f=1:d_N_f
plot(m_F(1,d_f),'bo')
plot(m_F(2,d_f),'ro')
end
hold off;
title('Diagonal F');
axis([-3 3 -3 3])
grid on
figure(12)
hold on;
for d_f=1:d_N_f
plot(m_F_norm(1,d_f),'bo')
plot(m_F_norm(2,d_f),'ro')
plot(m_F_norm(3,d_f),'ko')
end
hold off;
title('Diagonal F');
axis([-2 2 -2 2])
grid on
close all
m_H_B2A = load('m_H_B2A_1card_test1.mat');
m_H_B2A = m_H_B2A.m_H_B2A;
m_H_A2B = load('m_H_A2B_1card_test1.mat');
m_H_A2B = m_H_A2B.m_H_A2B;
%% ** normalisation **
%for d_f = 1:d_N_f
% for d_n_meas = 1:d_N_meas
% m_H_B2A(:,d_n_meas,d_f) = m_H_B2A(:,d_n_meas,d_f)/max(abs(m_H_B2A(:,d_n_meas,d_f)));
% m_H_A2B(:,d_n_meas,d_f) = m_H_A2B(:,d_n_meas,d_f)/max(abs(m_H_A2B(:,d_n_meas,d_f)));
% end
%end
%keyboard;
%% ** average **
%m_H_B2A_ = zeros(size(m_H_B2A,1),15,size(m_H_B2A,3));
%m_H_A2B_ = zeros(size(m_H_A2B,1),15,size(m_H_A2B,3));
%for d_f = 1:d_N_f
% for d_l = 1:d_N_loc
% m_H_B2A_(:,d_l,d_f) = mean(m_H_B2A(:,(d_l-1)*10+1:d_l*10,d_f),2);
% m_H_A2B_(:,d_l,d_f) = mean(m_H_A2B(:,(d_l-1)*10+1:d_l*10,d_f),2);
% end
%end
%keyboard;
%% ** calibration **
for d_f = 1:d_N_f
[m_F0(:,:,d_f),m_A0_est,m_B0_est] = f_tls_svd(m_H_B2A(:,:,d_f).',m_H_A2B(:,:,d_f).');
% [m_F1(:,:,d_f),m_A0_est,m_B0_est] = f_tls_svd(m_H_B2A(:,:,d_f).',m_H_A2B(:,51:100,d_f).');
% [m_F2(:,:,d_f),m_A0_est,m_B0_est] = f_tls_svd(m_H_B2A(:,:,d_f).',m_H_A2B(:,101:150,d_f).');
[m_F3(:,:,d_f),m_A1_est,m_B1_est] = f_tls_ap(m_H_B2A(:,:,d_f).',m_H_A2B(:,:,d_f).');
%[m_F0(:,:,d_f),m_A0_est,m_B0_est] = f_tls_svd(m_H_B2A_(:,1:50,d_f).',m_H_A2B_(:,1:50,d_f).');
%[m_F1(:,:,d_f),m_A0_est,m_B0_est] = f_tls_svd(m_H_B2A_(:,51:100,d_f).',m_H_A2B_(:,51:100,d_f).');
%[m_F2(:,:,d_f),m_A0_est,m_B0_est] = f_tls_svd(m_H_B2A_(:,101:150,d_f).',m_H_A2B_(:,101:150,d_f).');
%[m_F3(:,:,d_f),m_A1_est,m_B1_est] = f_tls_ap(m_H_B2A_(:,:,d_f).',m_H_A2B_(:,:,d_f).');
end
%oarf_stop(cardA);
%oarf_stop(cardB);
%% ** plot **
figure(10)
hold on;
for d_f=1:size(m_F0,3);
m_F= m_F0(:,:,d_f);
plot(m_F(1,1),'bo')
plot(m_F(2,2),'ko')
plot(diag(m_F,1),'r+')
plot(diag(m_F,-1),'gx')
end
hold off;
title('F0');
axis([-10 10 -10 10])
grid on
figure(11)
hold on;
for d_f=1:size(m_F1,3);
m_F= m_F1(:,:,d_f);
plot(m_F(1,1),'bo')
plot(m_F(2,2),'ko')
plot(diag(m_F,1),'r+')
plot(diag(m_F,-1),'gx')
end
hold off;
title('F1');
axis([-10 10 -10 10])
grid on
figure(12)
hold on;
for d_f=1:size(m_F2,3);
m_F= m_F2(:,:,d_f);
plot(m_F(1,1),'bo')
plot(m_F(2,2),'ko')
plot(diag(m_F,1),'r+')
plot(diag(m_F,-1),'gx')
end
hold off;
title('F2');
axis([-10 10 -10 10])
grid on;
figure(13)
hold on;
for d_f=1:size(m_F3,3);
m_F= m_F3(:,:,d_f);
plot(m_F(1,1),'bo')
plot(m_F(2,2),'ko')
plot(diag(m_F,1),'r+')
plot(diag(m_F,-1),'gx')
end
hold off;
title('F3');
axis([-10 10 -10 10])
grid on
clear all
close all
addpath([getenv('OPENAIR_TARGETS') '/ARCH/EXMIMO/USERSPACE/OCTAVE']);
addpath([getenv('OPENAIR_DIR') '/cmake_targets/lte_build_oai/build']);
%% -------- ExpressMIMO2 configuration --------
limeparms;
card = 0;
v_active_rfA = [1 1 0 0];
v_active_rfB = [0 0 1 0];
active_rf = v_active_rfA | v_active_rfB;
if(v_active_rfA*v_active_rfB'~=0)
error('The A and B transceive chains must be orthogonal./n')
end
fc = 2580000000; %1907600000; %1912600000; %fc = 859.5e6;
fs = 7.68e6;
freq_tx = fc*active_rf;
freq_rx = (fc+fs/4)*active_rf;
tdd_config = DUPLEXMODE_FDD+TXRXSWITCH_LSB; %we need the LSB switching for the woduplex script, otherwise we don't receive anything
rx_gain = 5*active_rf;
tx_gain = [10 0 5 0];%5*active_rf;
%rx_gain = 20*active_rf;
%tx_gain = 20*active_rf;
syncmode = SYNCMODE_FREE;
eNB_flag = 0;
%rf_mode=(RXEN+TXEN+TXLPFNORM+TXLPFEN+TXLPF25+RXLPFNORM+RXLPFEN+RXLPF25+LNA1ON+LNAByp+RFBBLNA1) * active_rf;
%rf_mode=(TXLPFNORM+TXLPFEN+TXLPF25+RXLPFNORM+RXLPFEN+RXLPF25+LNA1ON+LNAMax+RFBBNORM) * active_rf;
% we have to enable both DMA transfers so that the switching signal in the LSB of the TX buffer gets set
rf_mode = (TXLPFNORM+TXLPFEN+TXLPF25+RXLPFNORM+RXLPFEN+RXLPF5+LNA1ON+LNAMax+RFBBNORM+DMAMODE_TX+TXEN+DMAMODE_RX+RXEN) * active_rf;
rf_rxdc = rf_rxdc*active_rf; %???
rf_vcocal = rf_vcocal_19G*active_rf;
rf_local = [8254744 8255063 8257340 8257340]; %eNB2tx 1.9GHz
rffe_rxg_low = 31*active_rf;
rffe_rxg_final = 63*active_rf;
rffe_band = B19G_TDD*active_rf;
autocal_mode = active_rf;
resampling_factor = [2 2 2 2];
oarf_stop(card);
sleep(0.1);
oarf_config_exmimo(0,freq_rx,freq_tx,tdd_config,syncmode,rx_gain,tx_gain,eNB_flag,rf_mode,rf_rxdc,rf_local,rf_vcocal,rffe_rxg_low,rffe_rxg_final,rffe_band,autocal_mode,resampling_factor);
d_n_bit = 16;
%
% SCRIPT ID : s_run_meas
%
% PROJECT NAME : TDD Recoprocity
%
% PURPOSE : full transmission and receive train for TDD reciprocity calibration
%
%**********************************************************************************************
% Eurecom - All rights reserved
%
% AUTHOR(s) : Xiwen JIANG, Florian Kaltenberger
%
% DEVELOPMENT HISTORY :
%
% Date Name(s) Version Description
% ----------- ------------- ------- ------------------------------------------------------
% Apr-29-2014 X. JIANG 0.1 script creation v0.1
%
% REFERENCES/NOTES/COMMENTS :
%
% - Based on the script "run_full_duplex" created by Mirsad Cirkic, Florian Kaltenberger.
%
%**********************************************************************************************
%% ** initialisation **
%% ------------- to change in experiment ------------
%clc
close all
%clear all
%
%d_M = 4; % modulation order, e.g. 4 means QPSK
%
%%%** frequency **
%d_N_f = 301; % carrier number carrying data
%d_N_FFT = 512; % total carrier number
%d_N_CP = 128; % extented cyclic prefix
%%** time **
%d_N_OFDM = 120; % number of ofdm symbol per frame
%d_N_meas = 10; % measuement number
%%** antenna **
%d_N_antA = 4; % antenna number at site a
%d_N_antB = 4; % antenna number at site b
%v_active_rfA=[0 0 1 0]; %temp
%v_active_rfB=[1 1 0 0];
%v_indA = find(v_active_rfA); % active antenna index at site a
%v_indB = find(v_active_rfB); % active antenna index at site b
%d_amp = 10;
%% ----------------------------------------------------
m_sym_T = zeros(d_N_f,d_N_OFDM,3,d_N_meas);
m_sym_TA = zeros(d_N_f,d_N_OFDM/2,length(v_indA),d_N_meas);
m_sym_TB = zeros(d_N_f,d_N_OFDM/2,length(v_indB),d_N_meas);
m_sym_RA = zeros(d_N_f,d_N_OFDM/2,length(v_indA),d_N_meas);
m_sym_RB = zeros(d_N_f,d_N_OFDM/2,length(v_indB),d_N_meas);
%** simulation**
%m_sig_R = zeros((d_N_FFT+d_N_CP)*d_N_OFDM,4);
for d_n_meas = 1:d_N_meas
%% -------- tx --------
%** tx of site A **
[m_sym_T(:,:,:,d_n_meas), m_sig_T] = f_ofdm_tx(d_M, d_N_f, d_N_FFT, d_N_CP, d_N_OFDM, d_N_antA, active_rf, d_amp);
m_sym_TA(:,:,:,d_n_meas) = m_sym_T(:,1:end/2,1:end-1,d_n_meas);
m_sym_TB(:,:,:,d_n_meas) = m_sym_T(:,end/2+1:end,end,d_n_meas);
%** simulation
%m_sym_TA(:,d_N_OFDM/4+1:d_N_OFDM/2,1,d_n_meas) = 0;
%m_sig_T(end/4+1:end/2,v_indA(1)) = 0;
%m_sym_TA(:,1:d_N_OFDM/4,2,d_n_meas) = 0;
%m_sig_T(1:end/4,v_indA(2)) = 0;
%m_sig_T(1:end/2, v_indA) = m_sig_T(1:end/2,v_indA);
%m_sig_T(end/2+1:end, v_indA) = 0;
%m_sig_T(end/2+1:end, v_indB) = m_sig_T(end/2+1:end,v_indB);
%m_sig_T(1:end/2, v_indB) = 0;
%m_sig_R(end/2+1:end,1) = m_sig_T(end/2+1:end,4);
%m_sig_R(end/2+1:end,2) = m_sig_T(end/2+1:end,4);
%m_sig_R(1:end/2,4) = m_sig_T(1:end/2,1)+m_sig_T(1:end/2,2);
%** prepare the signal **
m_sym_TA(:,d_N_OFDM/4+1:d_N_OFDM/2,v_indA(1),d_n_meas) = 0;
m_sym_TA(:,1:d_N_OFDM/4,v_indA(2),d_n_meas) = 0;
m_sig_T(1:end/2, v_indA) = m_sig_T(1:end/2,v_indA)*2;
m_sig_T(end/2+1:end, v_indB) = m_sig_T(end/2+1:end,v_indB)*2;
m_sig_T(end/2+1:end, v_indA) = 1+1i;
m_sig_T(1:end/2, v_indB) = 1+1i;
m_sig_T(end/4+1:end/2,v_indA(1)) = 1+1i;
m_sig_T(1:end/4,v_indA(2)) = 1+1i;
%% -------- channel --------
%** Transmission from A to B **
oarf_send_frame(card,m_sig_T,d_n_bit);
m_sig_R_ = oarf_get_frame(-2);
d_N_sig_R = d_N_OFDM*(d_N_FFT+d_N_CP);
v_P = exp(1i*2*pi*(0:(d_N_sig_R-1))/4).';
m_sig_R = m_sig_R_(1:d_N_sig_R,:) .* repmat(v_P,1,size(m_sig_R_,2));
m_sig_RA = m_sig_R(end/2+1:end,:);
m_sig_RB = m_sig_R(1:end/2,:);
%% -------- rx --------
m_sym_RB(:,:,:,d_n_meas) = f_ofdm_rx(m_sig_RB, d_N_FFT, d_N_CP, d_N_OFDM/2, v_active_rfB);
m_sym_RA(:,:,:,d_n_meas) = f_ofdm_rx(m_sig_RA, d_N_FFT, d_N_CP, d_N_OFDM/2, v_active_rfA);
end
% keyboard;
%** channel estimation **
m_H_est_A2B = f_ch_est(m_sym_TA, m_sym_RB); %dimension: d_N_antR x d_N_antT x d_N_f x d_N_meas
m_H_est_B2A = f_ch_est(m_sym_TB, m_sym_RA);
%% -------- plot --------
%** channel estimation in frequency domain **
m_H_A2B_draw = squeeze(m_H_est_A2B(1,:,:,1)).';
m_H_B2A_draw = squeeze(m_H_est_B2A(:,1,:,1)).';
%keyboard
figure(1)
subplot(2,1,1)
plot(real(m_sig_RA(:,v_indA)),'-');
title('m_sig_RA')
subplot(2,1,2)
plot(real(m_sig_RB(:,v_indB)),'b-');
hold on
plot(real(m_sig_RB(end-100:end,v_indB)),'r-')
title('m_sig_RB')
figure(2)
subplot(2,2,1)
plot(20*log10(abs(m_H_A2B_draw)),'-');
title('|h| vs. freq (A2B)')
xlabel('freq')
ylabel('|h|')
ylim([0 100])
subplot(2,2,2)
plot(20*log10(abs(m_H_B2A_draw)),'-');
title('|h| vs. freq (B2A)')
xlabel('freq')
ylabel('|h|')
ylim([0 100])
subplot(2,2,3)
plot(angle(m_H_A2B_draw),'-');
title('angle(h) vs. freq (A2B)')
xlabel('freq')
ylabel('angle(h)')
subplot(2,2,4)
plot(angle(m_H_B2A_draw),'-');
title('angle(h) vs. freq (B2A)')
xlabel('freq')
ylabel('angle(h)')
figure(3)
plot(m_sym_RA(1,:,1,1),'b*')
% hold on
% plot(m_sym_RA(1,:,1,3),'r*')
% hold on
% plot(m_sym_RA(1,:,1,5),'g*')
title('m sym RA 1')
figure(4)
plot(m_sym_RA(1,:,2,1),'b*')
% hold on
% plot(m_sym_RA(1,:,2,3),'r*')
% hold on
% plot(m_sym_RA(1,:,2,5),'g*')
title('m sym RA 2')
figure(5)
subplot(2,1,1)
plot(m_sym_RB(1,1:end/2,1,1),'b*')
% hold on
% plot(m_sym_RB(1,1:end/2,1,3),'r*')
% hold on
% plot(m_sym_RB(1,1:end/2,1,5),'g*')
title('m sym RB ant 2')
subplot(2,1,2)
plot(m_sym_RB(1,end/2+1:end,1,1),'b*')
% hold on
% plot(m_sym_RB(1,end/2+1:end,1,3),'r*')
% hold on
% plot(m_sym_RB(1,end/2+1:end,1,5),'g*')
title('m sym RB ant 2')
[*]
[*] GTKWave Analyzer v3.3.58 (w)1999-2014 BSI
[*] Wed Jan 18 09:49:05 2017
[*] Mon Mar 13 16:06:02 2017
[*]
[dumpfile] "/tmp/openair_dump_eNB.vcd"
[dumpfile_mtime] "Wed Jan 18 09:43:36 2017"
[dumpfile_size] 892531
[dumpfile_mtime] "Mon Mar 13 15:17:44 2017"
[dumpfile_size] 718017266
[savefile] "/homes/jiangx/openair5G/openairinterface5g/targets/RT/USER/eNB_exmimo2.gtkw"
[timestart] 21256800000
[size] 1615 1026
[pos] -1 -1
*-22.787832 21257630000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
[timestart] 0
[size] 1301 744
[pos] -1 -117
*-36.091209 21257630000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
[sst_width] 374
[signals_width] 262
[sst_expanded] 1
[sst_vpaned_height] 262
@25
@24
variables.frame_number_TX0_eNB[63:0]
variables.frame_number_TX1_eNB[63:0]
variables.subframe_number_TX0_eNB[63:0]
......@@ -42,5 +42,8 @@ functions.udp_enb_task
functions.phy_eNB_slot_fep
functions.phy_eNB_ofdm_mod_l
functions.phy_eNB_beam_precoding
functions.phy_eNB_ulcsi_to_dlsci
@29
functions.phy_eNB_compute_bf_weight
[pattern_trace] 1
[pattern_trace] 0
......@@ -573,9 +573,9 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam
start_meas(&softmodem_stats_rxtx_sf);
// ****************************************
// TDD workaround
if ((eNB->rfdevice.type == EXMIMO_DEV) && (eNB->frame_parms.frame_type == TDD) && subframe_select(&eNB->frame_parms,proc->subframe_rx)==SF_UL) {
remove_1_4_fs(eNB,proc->subframe_rx<<1); // TDD workaround for EXMIMO2 card
// TDD workaround for EXMIMO card
if ((eNB->rfdevice.openair0_cfg->duplex_mode == duplex_mode_TDD_workaround) && (eNB->frame_parms.frame_type == TDD) && subframe_select(&eNB->frame_parms,proc->subframe_rx)==SF_UL) {
remove_1_4_fs(eNB,proc->subframe_rx<<1);
remove_1_4_fs(eNB,1+(proc->subframe_rx<<1));
}
......
......@@ -128,7 +128,7 @@ FD_lte_phy_scope_ue *form_ue[NUMBER_OF_UE_MAX];
FD_lte_phy_scope_enb *form_enb[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
FD_stats_form *form_stats=NULL,*form_stats_l2=NULL;
char title[255];
unsigned char scope_enb_num_ue = 2;
unsigned char scope_enb_num_ue = 1;//2;
#endif //XFORMS
......@@ -164,6 +164,7 @@ volatile int oai_exit = 0;
static char UE_flag=0;
unsigned int mmapped_dma=0;
int single_thread_flag=1;
int exmimo_tdd_workaround=0;
static char threequarter_fs=0;
......@@ -202,6 +203,9 @@ static int tx_max_power[MAX_NUM_CCs]; /* = {0,0}*/;
char rf_config_file[1024];
int tdd_recip_calib = 0;
char tdd_recip_calib_file[1024];
int chain_offset=0;
int phy_test = 0;
uint8_t usim_test = 0;
......@@ -382,6 +386,8 @@ void help (void) {
printf(" --mmapped-dma sets flag for improved EXMIMO UE performance\n");
printf(" --usim-test use XOR autentication algo in case of test usim mode\n");
printf(" --single-thread-disable. Disables single-thread mode in lte-softmodem\n");
printf(" --tdd-recip-calib. Enable TDD channel reciprocity calibration by giving a calibration file\n");
printf(" --exmimo-tdd-workaround. Enable EXMIMO2 TDD workaround\n");
printf(" -C Set the downlink frequency for all component carriers\n");
printf(" -d Enable soft scope and L1 and L2 stats (Xforms)\n");
printf(" -F Calibrate the EXMIMO borad, available files: exmimo2_2arxg.lime exmimo2_2brxg.lime \n");
......@@ -693,6 +699,8 @@ static void get_options (int argc, char **argv)
LONG_OPTION_USIMTEST,
LONG_OPTION_MMAPPED_DMA,
LONG_OPTION_SINGLE_THREAD_DISABLE,
LONG_OPTION_TDD_RECIP_CALIB,
LONG_OPTION_EXMIMO_TDD_WORKAROUND,
LONG_OPTION_RRH_REMOTE_ADDRESS,
LONG_OPTION_TX_SAMPLE_ADVANCE,
#if T_TRACER
......@@ -722,6 +730,8 @@ static void get_options (int argc, char **argv)
{"usim-test", no_argument, NULL, LONG_OPTION_USIMTEST},
{"mmapped-dma", no_argument, NULL, LONG_OPTION_MMAPPED_DMA},
{"single-thread-disable", no_argument, NULL, LONG_OPTION_SINGLE_THREAD_DISABLE},
{"tdd-recip-calib", required_argument, NULL, LONG_OPTION_TDD_RECIP_CALIB},
{"exmimo-tdd-workaround", no_argument, NULL, LONG_OPTION_EXMIMO_TDD_WORKAROUND},
{"rrh-remote-address", required_argument, NULL, LONG_OPTION_RRH_REMOTE_ADDRESS},
{"tx-sample-advance", required_argument, NULL, LONG_OPTION_TX_SAMPLE_ADVANCE},
#if T_TRACER
......@@ -847,6 +857,23 @@ static void get_options (int argc, char **argv)
single_thread_flag = 0;
break;
case LONG_OPTION_TDD_RECIP_CALIB:
if ((strcmp("null", optarg) == 0) || (strcmp("NULL", optarg) == 0)) {
printf("No tdd reciprocity filename is provided\n");
}
else if (strlen(optarg)<=1024){
strcpy(tdd_recip_calib_file,optarg);
tdd_recip_calib = 1;
}else {
printf("TDD calibration filename is too long\n");
exit(-1);
}
break;
case LONG_OPTION_EXMIMO_TDD_WORKAROUND:
exmimo_tdd_workaround = 1;
break;
#if T_TRACER
case LONG_OPTION_T_PORT: {
extern int T_port;
......@@ -1332,10 +1359,17 @@ void init_openair0() {
}
if (frame_parms[0]->frame_type==TDD)
if (exmimo_tdd_workaround == 1)
openair0_cfg[card].duplex_mode = duplex_mode_TDD_workaround;
else
openair0_cfg[card].duplex_mode = duplex_mode_TDD;
else //FDD
openair0_cfg[card].duplex_mode = duplex_mode_FDD;
if (tdd_recip_calib == 1)
openair0_cfg[card].tdd_recip_calib = 1;
else
openair0_cfg[card].tdd_recip_calib = 0;
if (local_remote_radio == BBU_REMOTE_RADIO_HEAD) {
openair0_cfg[card].remote_addr = (eth_params+card)->remote_addr;
......@@ -1653,6 +1687,8 @@ int main( int argc, char **argv )
PHY_vars_eNB_g[0][CC_id]->target_ue_ul_mcs=target_ul_mcs;
// initialization for phy-test
if (phy_test==1) {
PHY_vars_eNB_g[0][CC_id]->mac_enabled = 0;
for (k=0;k<NUMBER_OF_UE_MAX;k++) {
PHY_vars_eNB_g[0][CC_id]->transmission_mode[k] = transmission_mode;
if (transmission_mode==7)
......@@ -1665,8 +1701,8 @@ int main( int argc, char **argv )
PHY_vars_eNB_g[0][CC_id]->common_vars.beam_weights[0][0][j][re] = 0x00007fff;
//PHY_vars_eNB_g[0][CC_id]->common_vars.beam_weights[0][0][j][re] = 0x00007fff/sqrt(frame_parms[CC_id]->nb_antennas_tx);
}
if (phy_test==1) PHY_vars_eNB_g[0][CC_id]->mac_enabled = 0;
else PHY_vars_eNB_g[0][CC_id]->mac_enabled = 1;
} else
PHY_vars_eNB_g[0][CC_id]->mac_enabled = 1;
if (PHY_vars_eNB_g[0][CC_id]->mac_enabled == 0) { //set default parameters for testing mode
for (i=0; i<NUMBER_OF_UE_MAX; i++) {
......
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