Commit 453b2fd2 authored by Xiwen JIANG's avatar Xiwen JIANG

add getenv for calib file

parent 32afd574
......@@ -1398,7 +1398,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
} //eNB_id
// Read TDD calibration coefficients
read_calibration_matrix(eNB->common_vars.tdd_calib_coeffs[0], "PROJECTS/TDDREC/results/calibF.m", fp);
read_calibration_matrix(eNB->common_vars.tdd_calib_coeffs[0], "calibF.m", fp);
// Create thread pool
eNB->pool = new_thread_pool(do_OFDM_mod_thread, eNB);
......
#include <stdio.h>
#include <stdlib.h> // contains the header information or prototype of the malloc
#include <string.h>
#include "UTIL/LOG/log.h"
#include "PHY/impl_defs_lte.h"
int read_calibration_matrix(int32_t **tdd_calib_coeffs, char *calibF_fname, LTE_DL_FRAME_PARMS *frame_parms) {
FILE *calibF_fd ;
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) ;
calibF_fd = fopen(calibF_fname,"r") ;
if (openair_dir == NULL) {
printf("ERR: OPENAIR_DIR not defined (did you source oaienv?)\n");
exit(1);
}
sprintf(calibF_file_name, "%s/targets/PROJECTS/TDDREC/results/%s", openair_dir, calibF_fname);
calibF_fd = fopen(calibF_file_name,"r") ;
if (calibF_fd == NULL) {
printf("ERR: %s not found, running with defaults\n", calibF_fname);
printf("Warning: %s not found, running with defaults\n", calibF_fname);
return(1);
}
printf("Loading Calibration matrix from %s\n", calibF_fname);
printf("Loading Calibration matrix from %s\n", calibF_file_name);
for (aa=0;aa<frame_parms->nb_antennas_tx;aa++) {
for(re=0;re<frame_parms->N_RB_DL*12;re++) {
......@@ -31,7 +42,7 @@ int read_calibration_matrix(int32_t **tdd_calib_coeffs, char *calibF_fname, LTE_
}
}
int estimate_DLCSI_from_ULCSI(int32_t **calib_dl_ch_estimates, int32_t **ul_ch_estimates, int32_t **tdd_calib_coeffs, LTE_DL_FRAME_PARMS *frame_parms) {
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) {
int aa,re;
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
......
......@@ -123,7 +123,7 @@ int beam_precoding(int32_t **txdataF,
int read_calibration_matrix(int32_t **tdd_calib_coeffs, char *calibF_fname, LTE_DL_FRAME_PARMS *frame_parms);
int estimate_DLCSI_from_ULCSI(int32_t **calib_dl_ch_estimates, int32_t **ul_ch_estimates, int32_t **tdd_calib_coeffs, LTE_DL_FRAME_PARMS *frame_parms);
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);
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);
......
......@@ -2160,7 +2160,7 @@ PMI_FEEDBACK:
if (awgn_flag == 0) {
((int16_t *)(eNB->pusch_vars[0]->drs_ch_estimates[0][aarx]))[(l*frame_parms->N_RB_DL*12+i)*2]=(int16_t)(eNB2UE[round]->chF[aarx][i].x*AMP);
((int16_t *)(eNB->pusch_vars[0]->drs_ch_estimates[0][aarx]))[(l*frame_parms->N_RB_DL*12+i)*2+1]=(int16_t)(eNB2UE[round]->chF[aarx][i].y*AMP);
printf("x=%d, y=%d,AMP=%d\n",eNB2UE[round]->chF[aarx][i].x,eNB2UE[round]->chF[aarx][i].y,AMP);
//printf("x=%d, y=%d,AMP=%d\n",eNB2UE[round]->chF[aarx][i].x,eNB2UE[round]->chF[aarx][i].y,AMP);
} else {
((int16_t *)(eNB->pusch_vars[0]->drs_ch_estimates[0][aarx]))[(l*frame_parms->N_RB_DL*12+i)*2]= (short)(AMP);
((int16_t*)(eNB->pusch_vars[0]->drs_ch_estimates[0][aarx]))[(l*frame_parms->N_RB_DL*12+i)*2+1]= 0/2;
......
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