Commit 6f9a17cb authored by Rohit Gupta's avatar Rohit Gupta

Merge branch 'develop' into feature-34-test_framework

parents 2eaafd8d e3a8e68e
......@@ -72,8 +72,11 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint8_t N_RB_DL, ui
*/
void free_ue_dlsch(LTE_UE_DLSCH_t *dlsch);
LTE_eNB_ULSCH_t *new_eNB_ulsch(uint8_t Mdlharq,uint8_t max_turbo_iterations,uint8_t N_RB_UL, uint8_t abstraction_flag);
LTE_UE_DLSCH_t *new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint8_t max_turbo_iterations,uint8_t N_RB_DL, uint8_t abstraction_flag);
LTE_UE_ULSCH_t *new_ue_ulsch(unsigned char Mdlharq,unsigned char N_RB_UL, uint8_t abstraction_flag);
void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch, uint8_t abstraction_flag);
......@@ -84,9 +87,6 @@ LTE_eNB_ULSCH_t *new_eNB_ulsch(uint8_t Mdlharq,uint8_t max_turbo_iterations,uint
LTE_UE_ULSCH_t *new_ue_ulsch(uint8_t Mdlharq, unsigned char N_RB_UL, uint8_t abstraction_flag);
uint8_t ul_subframe2pdcch_alloc_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n);
/** \fn dlsch_encoding(uint8_t *input_buffer,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t num_pdcch_symbols,
......@@ -1769,5 +1769,7 @@ double computeRhoB_UE(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
uint8_t get_prach_prb_offset(LTE_DL_FRAME_PARMS *frame_parms, uint8_t tdd_mapindex, uint16_t Nf);
uint8_t ul_subframe2pdcch_alloc_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n);
/**@}*/
#endif
......@@ -326,7 +326,7 @@ int main(int argc, char **argv)
uint32_t DLSCH_RB_ALLOC = 0x1fff;
int numCCE=0;
int dci_length_bytes=0,dci_length=0;
double BW = 5.0;
//double channel_bandwidth = 5.0, sampling_rate=7.68;
int common_flag=0,TPC=0;
double cpu_freq_GHz;
......@@ -680,27 +680,19 @@ int main(int argc, char **argv)
switch (N_RB_DL) {
case 6:
if (rballocset==0) DLSCH_RB_ALLOC = 0x3f;
BW = 1.25;
num_pdcch_symbols = 3;
break;
case 25:
if (rballocset==0) DLSCH_RB_ALLOC = 0x1fff;
BW = 5.00;
break;
case 50:
if (rballocset==0) DLSCH_RB_ALLOC = 0x1ffff;
BW = 10.00;
break;
case 100:
if (rballocset==0) DLSCH_RB_ALLOC = 0x1ffffff;
BW = 20.00;
break;
}
......@@ -708,8 +700,6 @@ int main(int argc, char **argv)
} else
NB_RB = 4;
NB_RB=conv_nprb(0,DLSCH_RB_ALLOC,N_RB_DL);
if ((transmission_mode > 1) && (n_tx != 2))
printf("n_tx must be >1 for transmission_mode %d\n",transmission_mode);
......@@ -967,7 +957,8 @@ int main(int argc, char **argv)
eNB2UE[0] = new_channel_desc_scm(PHY_vars_eNB->lte_frame_parms.nb_antennas_tx,
PHY_vars_UE->lte_frame_parms.nb_antennas_rx,
channel_model,
BW,
N_RB2sampling_rate(PHY_vars_eNB->lte_frame_parms.N_RB_DL),
N_RB2channel_bandwidth(PHY_vars_eNB->lte_frame_parms.N_RB_DL),
forgetting_factor,
rx_sample_offset,
0);
......@@ -977,8 +968,9 @@ int main(int argc, char **argv)
eNB2UE[n] = new_channel_desc_scm(PHY_vars_eNB->lte_frame_parms.nb_antennas_tx,
PHY_vars_UE->lte_frame_parms.nb_antennas_rx,
channel_model,
BW,
forgetting_factor,
N_RB2sampling_rate(PHY_vars_eNB->lte_frame_parms.N_RB_DL),
N_RB2channel_bandwidth(PHY_vars_eNB->lte_frame_parms.N_RB_DL),
forgetting_factor,
rx_sample_offset,
0);
}
......@@ -2789,7 +2781,7 @@ PMI_FEEDBACK:
// Multipath channel
if (awgn_flag == 0) {
multipath_channel(eNB2UE[0],s_re,s_im,r_re,r_im,
multipath_channel(eNB2UE[round],s_re,s_im,r_re,r_im,
2*frame_parms->samples_per_tti,hold_channel);
// printf("amc: ****************** eNB2UE[%d]->n_rx = %d,dd %d\n",round,eNB2UE[round]->nb_rx,eNB2UE[round]->channel_offset);
......
......@@ -54,8 +54,6 @@
#include "OCG_vars.h"
//#define BW 5.0
PHY_VARS_eNB *PHY_vars_eNB;
PHY_VARS_UE *PHY_vars_UE;
......@@ -131,7 +129,7 @@ int main(int argc, char **argv)
char c;
int i,l,aa,aarx;
int i,l,aa,aarx,k;
double sigma2, sigma2_dB=0,SNR,snr0=-2.0,snr1=0.0;
uint8_t snr1set=0;
double snr_step=1,input_snr_step=1;
......@@ -172,7 +170,6 @@ int main(int argc, char **argv)
unsigned int trials,errs[4]= {0,0,0,0}; //,round_trials[4]={0,0,0,0};
uint8_t N_RB_DL=25,osf=1;
double BW=5.0;
uint32_t perfect_ce = 0;
lte_frame_type_t frame_type = FDD;
......@@ -255,27 +252,9 @@ int main(int argc, char **argv)
case 'R':
N_RB_DL = atoi(optarg);
switch (N_RB_DL) {
case 6:
BW=1.25;
break;
case 25:
BW=5.0;
break;
case 50:
BW=10.0;
break;
case 100:
BW=20.0;
break;
default:
if ((N_RB_DL!=6) && (N_RB_DL!=25) && (N_RB_DL!=50) && (N_RB_DL!=100)) {
printf("Unsupported Bandwidth %d\n",N_RB_DL);
exit(-1);
break;
}
break;
......@@ -397,7 +376,8 @@ int main(int argc, char **argv)
eNB2UE = new_channel_desc_scm(PHY_vars_eNB->lte_frame_parms.nb_antennas_tx,
PHY_vars_UE->lte_frame_parms.nb_antennas_rx,
channel_model,
BW,
N_RB2sampling_rate(PHY_vars_eNB->lte_frame_parms.N_RB_DL),
N_RB2channel_bandwidth(PHY_vars_eNB->lte_frame_parms.N_RB_DL),
0,
0,
0);
......@@ -541,15 +521,26 @@ int main(int argc, char **argv)
subframe%10,
0,
0);
}
for (l=2; l<12; l++) {
rx_pmch(PHY_vars_UE,
if (PHY_vars_UE->perfect_ce==1) {
// fill in perfect channel estimates
freq_channel(eNB2UE,PHY_vars_UE->lte_frame_parms.N_RB_DL,12*PHY_vars_UE->lte_frame_parms.N_RB_DL + 1);
for(k=0; k<NUMBER_OF_eNB_MAX; k++) {
for(aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
for (i=0; i<frame_parms->N_RB_DL*12; i++) {
((int16_t *) PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[k][(aa<<1)+aarx])[2*i+(l*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=(int16_t)(eNB2UE->chF[aarx+(aa*frame_parms->nb_antennas_rx)][i].x*AMP);
((int16_t *) PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[k][(aa<<1)+aarx])[2*i+1+(l*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=(int16_t)(eNB2UE->chF[aarx+(aa*frame_parms->nb_antennas_rx)][i].y*AMP);
}
}
}
}
}
rx_pmch(PHY_vars_UE,
0,
subframe%10,
l);
}
PHY_vars_UE->dlsch_ue_MCH[0]->harq_processes[0]->G = get_G(&PHY_vars_UE->lte_frame_parms,
......
......@@ -53,9 +53,6 @@
#include "OCG_vars.h"
#define BW 5.0
PHY_VARS_eNB *PHY_vars_eNb,*PHY_vars_eNb1,*PHY_vars_eNb2;
PHY_VARS_UE *PHY_vars_UE;
......@@ -485,7 +482,8 @@ int main(int argc, char **argv)
eNB2UE = new_channel_desc_scm(PHY_vars_eNb->lte_frame_parms.nb_antennas_tx,
PHY_vars_UE->lte_frame_parms.nb_antennas_rx,
channel_model,
BW,
N_RB2sampling_rate(PHY_vars_eNb->lte_frame_parms.N_RB_DL),
N_RB2channel_bandwidth(PHY_vars_eNb->lte_frame_parms.N_RB_DL),
0,
0,
0);
......@@ -494,7 +492,8 @@ int main(int argc, char **argv)
eNB2UE1 = new_channel_desc_scm(PHY_vars_eNb->lte_frame_parms.nb_antennas_tx,
PHY_vars_UE->lte_frame_parms.nb_antennas_rx,
channel_model,
BW,
N_RB2sampling_rate(PHY_vars_eNb->lte_frame_parms.N_RB_DL),
N_RB2channel_bandwidth(PHY_vars_eNb->lte_frame_parms.N_RB_DL),
0,
4,
0);
......@@ -503,7 +502,8 @@ int main(int argc, char **argv)
eNB2UE2 = new_channel_desc_scm(PHY_vars_eNb->lte_frame_parms.nb_antennas_tx,
PHY_vars_UE->lte_frame_parms.nb_antennas_rx,
channel_model,
BW,
N_RB2sampling_rate(PHY_vars_eNb->lte_frame_parms.N_RB_DL),
N_RB2channel_bandwidth(PHY_vars_eNb->lte_frame_parms.N_RB_DL),
0,
8,
0);
......
......@@ -552,7 +552,6 @@ int main(int argc, char **argv)
uint32_t *txptr;
int aarx;
int k;
double BW=5.0;
uint32_t perfect_ce = 0;
number_of_cards = 1;
......@@ -840,28 +839,11 @@ int main(int argc, char **argv)
subframe,NUMBER_OF_OFDM_CARRIERS,
PHY_vars_eNB->lte_frame_parms.Ncp,PHY_vars_eNB->lte_frame_parms.samples_per_tti,nsymb);
switch (N_RB_DL) {
case 6:
BW = 1.25;
break;
case 25:
BW = 5.00;
break;
case 50:
BW = 10.00;
break;
case 100:
BW = 20.00;
break;
}
eNB2UE = new_channel_desc_scm(PHY_vars_eNB->lte_frame_parms.nb_antennas_tx_eNB,
PHY_vars_UE->lte_frame_parms.nb_antennas_rx,
channel_model,
BW,
N_RB2sampling_rate(PHY_vars_eNB->lte_frame_parms.N_RB_DL),
N_RB2channel_bandwidth(PHY_vars_eNB->lte_frame_parms.N_RB_DL),
0,
0,
0);
......
......@@ -47,8 +47,6 @@
#include "OCG_vars.h"
#define BW 5.0
int current_dlsch_cqi; //FIXME!
PHY_VARS_eNB *PHY_vars_eNB;
......@@ -412,7 +410,8 @@ int main(int argc, char **argv)
UE2eNB = new_channel_desc_scm(PHY_vars_UE->lte_frame_parms.nb_antennas_tx,
PHY_vars_eNB->lte_frame_parms.nb_antennas_rx,
channel_model,
BW,
N_RB2sampling_rate(PHY_vars_eNB->lte_frame_parms.N_RB_UL),
N_RB2channel_bandwidth(PHY_vars_eNB->lte_frame_parms.N_RB_UL),
0.0,
delay,
0);
......
......@@ -49,8 +49,6 @@
#include "OCG_vars.h"
#include "UTIL/LOG/log_extern.h"
#define BW 5.0
int current_dlsch_cqi; //FIXME!
PHY_VARS_eNB *PHY_vars_eNB;
......@@ -418,7 +416,8 @@ int main(int argc, char **argv)
UE2eNB = new_channel_desc_scm(PHY_vars_eNB->lte_frame_parms.nb_antennas_tx,
PHY_vars_UE->lte_frame_parms.nb_antennas_rx,
channel_model,
BW,
N_RB2sampling_rate(PHY_vars_eNB->lte_frame_parms.N_RB_UL),
N_RB2channel_bandwidth(PHY_vars_eNB->lte_frame_parms.N_RB_UL),
0.0,
0,
0);
......
......@@ -58,23 +58,11 @@
extern unsigned short dftsizes[33];
extern short *ul_ref_sigs[30][2][33];
//#define AWGN
//#define NO_DCI
#define BW 7.68
//#define ABSTRACTION
//#define PERFECT_CE
/*
#define RBmask0 0x00fc00fc
#define RBmask1 0x0
#define RBmask2 0x0
#define RBmask3 0x0
*/
PHY_VARS_eNB *PHY_vars_eNB;
PHY_VARS_UE *PHY_vars_UE;
#define MCS_COUNT 23//added for PHY abstraction
//#define MCS_COUNT 23//added for PHY abstraction
channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX];
channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX];
......@@ -155,11 +143,6 @@ void lte_param_init(unsigned char N_tx, unsigned char N_rx,unsigned char transmi
#define UL_RB_ALLOC 0x1ff;
int main(int argc, char **argv)
{
......@@ -172,8 +155,6 @@ int main(int argc, char **argv)
double input_snr_step=.2,snr_int=30;
double blerr;
//int **txdataF, **txdata;
int **txdata;
LTE_DL_FRAME_PARMS *frame_parms;
......@@ -695,7 +676,8 @@ int main(int argc, char **argv)
UE2eNB = new_channel_desc_scm(PHY_vars_eNB->lte_frame_parms.nb_antennas_tx,
PHY_vars_UE->lte_frame_parms.nb_antennas_rx,
channel_model,
BW,
N_RB2sampling_rate(PHY_vars_eNB->lte_frame_parms.N_RB_UL),
N_RB2channel_bandwidth(PHY_vars_eNB->lte_frame_parms.N_RB_UL),
forgetting_factor,
delay,
0);
......
......@@ -73,7 +73,7 @@ void init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
if (desc->nb_taps==1)
delay = desc->delays[l];
else
delay = desc->delays[l]+NB_SAMPLES_CHANNEL_OFFSET/desc->BW;
delay = desc->delays[l]+NB_SAMPLES_CHANNEL_OFFSET/desc->sampling_rate;
cos_lut[f+(n_samples>>1)][l] = cos(2*M_PI*freq*delay);
sin_lut[f+(n_samples>>1)][l] = sin(2*M_PI*freq*delay);
......
......@@ -69,7 +69,9 @@ typedef struct {
///Maximum path delay in mus.
double Td;
///Channel bandwidth in MHz.
double BW;
double channel_bandwidth;
///System sampling rate in Msps.
double sampling_rate;
///Ricean factor of first tap wrt other taps (0..1, where 0 means AWGN and 1 means Rayleigh channel).
double ricean_factor;
///Angle of arrival of wavefront (in radians). For Ricean channel only. This assumes that both RX and TX have linear antenna arrays with lambda/2 antenna spacing. Furhter it is assumed that the arrays are parallel to each other and that they are far enough apart so that we can safely assume plane wave propagation.
......@@ -202,7 +204,8 @@ typedef enum {
channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
uint8_t nb_rx,
SCM_t channel_model,
double BW,
double sampling_rate,
double channel_bandwidth,
double forgetting_factor,
int32_t channel_offset,
double path_loss_dB);
......@@ -364,6 +367,10 @@ void multipath_tv_channel(channel_desc_t *desc,
/**@} */
/**@} */
double N_RB2sampling_rate(uint16_t N_RB);
double N_RB2channel_bandwidth(uint16_t N_RB);
#endif
......@@ -175,13 +175,13 @@ void tv_channel(channel_desc_t *desc,double complex ***H,uint16_t length)
{
for(p=0;p<desc->nb_paths;p++)
{
H[i][j] += sqrt(desc->amps[j]/2)*alpha[p]*cexp(-I*(2*pi*w_Hz[p]*i*(1/(desc->BW*1e6))+phi_rad[p]));
H[i][j] += sqrt(desc->amps[j]/2)*alpha[p]*cexp(-I*(2*pi*w_Hz[p]*i*(1/(desc->sampling_rate*1e6))+phi_rad[p]));
}
}
}
for(j=0;j<desc->nb_paths;j++)
{
phi_rad[j] = fmod(2*pi*w_Hz[j]*(length-1)*(1/desc->BW)+phi_rad[j],2*pi);
phi_rad[j] = fmod(2*pi*w_Hz[j]*(length-1)*(1/desc->sampling_rate)+phi_rad[j],2*pi);
}
*/
......@@ -193,13 +193,13 @@ void tv_channel(channel_desc_t *desc,double complex ***H,uint16_t length)
H[i+(j*desc->nb_rx)][k][l] = 0;
for(p=0; p<desc->nb_paths; p++) {
H[i+(j*desc->nb_rx)][k][l] += sqrt(desc->amps[l]/2)*alpha[p]*cexp(I*(2*pi*w_Hz[p]*k*(1/(desc->BW*1e6))+phi_rad[p]));
H[i+(j*desc->nb_rx)][k][l] += sqrt(desc->amps[l]/2)*alpha[p]*cexp(I*(2*pi*w_Hz[p]*k*(1/(desc->sampling_rate*1e6))+phi_rad[p]));
}
}
}
for(j=0; j<desc->nb_paths; j++) {
phi_rad[j] = fmod(2*pi*w_Hz[j]*(length-1)*(1/desc->BW)+phi_rad[j],2*pi);
phi_rad[j] = fmod(2*pi*w_Hz[j]*(length-1)*(1/desc->sampling_rate)+phi_rad[j],2*pi);
}
}
}
......
This diff is collapsed.
......@@ -52,7 +52,7 @@ int openair0_device_init(openair0_device *device, openair0_config_t *openair0_cf
openair0_dev_init_exmimo(device, openair0_cfg);
printf("openair0_dev_init_exmimo...\n");
#elif OAI_USRP
device->type=USRP_IF;
device->type=USRP_B200_IF;
openair0_dev_init_usrp(device, openair0_cfg);
printf("openair0_dev_init_usrp ...\n");
#elif OAI_BLADERF
......
......@@ -84,10 +84,10 @@ typedef struct {
double sample_rate;
//! number of samples per RX/TX packet (USRP + Ethernet)
int samples_per_packet;
// delay in sending samples (write) due to hardware access, softmodem processing and fronthaul delay if exist
int tx_delay;
//! adjust the position of the samples after delay when sending
unsigned int tx_forward_nsamps;
//! delay in sending samples (write) due to hardware access, softmodem processing and fronthaul delay if exist
int tx_scheduling_advance;
//! offset in samples between TX and RX paths
int tx_sample_advance;
//! number of RX channels (=RX antennas)
int rx_num_channels;
//! number of TX channels (=TX antennas)
......@@ -98,6 +98,10 @@ typedef struct {
//! \brief Center frequency in Hz for TX.
//! index: [0..rx_num_channels[ !!! see lte-ue.c:427 FIXME iterates over rx_num_channels
double tx_freq[4];
//! \brief Pointer to Calibration table for RX gains
rx_gain_calib_table_t *rx_gain_calib_table;
//! mode for rxgain (ExpressMIMO2)
rx_gain_t rxg_mode[4];
//! \brief Gain for RX in dB.
......@@ -147,8 +151,10 @@ typedef enum {
ETH_IF,
/*!\brief device is ExpressMIMO */
EXMIMO_IF,
/*!\brief device is USRP*/
USRP_IF,
/*!\brief device is USRP B200/B210*/
USRP_B200_IF,
/*!\brief device is USRP X300/X310*/
USRP_X300_IF,
/*!\brief device is BLADE RF*/
BLADERF_IF,
/*!\brief device is NONE*/
......
......@@ -171,31 +171,45 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp
#endif
if (cc>1) {
if (device->type == USRP_B200_IF) {
if (cc>1) {
// receive multiple channels (e.g. RF A and RF B)
std::vector<void *> buff_ptrs;
for (int i=0;i<cc;i++) buff_ptrs.push_back(buff_tmp[i]);
samples_received = s->rx_stream->recv(buff_ptrs, nsamps, s->rx_md);
} else {
std::vector<void *> buff_ptrs;
for (int i=0;i<cc;i++) buff_ptrs.push_back(buff_tmp[i]);
samples_received = s->rx_stream->recv(buff_ptrs, nsamps, s->rx_md);
} else {
// receive a single channel (e.g. from connector RF A)
samples_received = s->rx_stream->recv(buff_tmp[0], nsamps, s->rx_md);
}
samples_received = s->rx_stream->recv(buff_tmp[0], nsamps, s->rx_md);
}
// bring RX data into 12 LSBs for softmodem RX
for (int i=0;i<cc;i++) {
for (int j=0; j<nsamps2; j++) {
for (int i=0;i<cc;i++) {
for (int j=0; j<nsamps2; j++) {
#if defined(__x86_64__) || defined(__i386__)
#ifdef __AVX2__
((__m256i *)buff[i])[j] = _mm256_srai_epi16(buff_tmp[i][j],4);
((__m256i *)buff[i])[j] = _mm256_srai_epi16(buff_tmp[i][j],4);
#else
((__m128i *)buff[i])[j] = _mm_srai_epi16(buff_tmp[i][j],4);
((__m128i *)buff[i])[j] = _mm_srai_epi16(buff_tmp[i][j],4);
#endif
#elif defined(__arm__)
((int16x8_t*)buff[i])[j] = vshrq_n_s16(buff_tmp[i][j],4);
((int16x8_t*)buff[i])[j] = vshrq_n_s16(buff_tmp[i][j],4);
#endif
}
}
} else if (device->type == USRP_X300_IF) {
if (cc>1) {
// receive multiple channels (e.g. RF A and RF B)
std::vector<void *> buff_ptrs;
for (int i=0;i<cc;i++) buff_ptrs.push_back(buff[i]);
samples_received = s->rx_stream->recv(buff_ptrs, nsamps, s->rx_md);
} else {
// receive a single channel (e.g. from connector RF A)
samples_received = s->rx_stream->recv(buff[0], nsamps, s->rx_md);
}
}
if (samples_received < nsamps) {
printf("[recv] received %d samples out of %d\n",samples_received,nsamps);
......@@ -279,7 +293,7 @@ int trx_usrp_set_gains(openair0_device* device,
exit(-1);
}
s->usrp->set_rx_gain(openair0_cfg[0].rx_gain[0]-openair0_cfg[0].rx_gain_offset[0]);
printf("Setting USRP RX gain to %f\n", openair0_cfg[0].rx_gain[0]-openair0_cfg[0].rx_gain_offset[0]);
printf("Setting USRP RX gain to %f (rx_gain %f,gain_range.stop() %f)\n", openair0_cfg[0].rx_gain[0]-openair0_cfg[0].rx_gain_offset[0],openair0_cfg[0].rx_gain[0],gain_range.stop());
return(0);
}
......@@ -289,7 +303,7 @@ int trx_usrp_stop(int card) {
}
rx_gain_calib_table_t calib_table[] = {
rx_gain_calib_table_t calib_table_b210[] = {
{3500000000.0,46.0},
{2660000000.0,53.0},
{2300000000.0,54.0},
......@@ -297,19 +311,29 @@ rx_gain_calib_table_t calib_table[] = {
{816000000.0,62.0},
{-1,0}};
rx_gain_calib_table_t calib_table_x310[] = {
{3500000000.0,77.0},
{2660000000.0,80.0},
{2300000000.0,81.0},
{1880000000.0,82.0},
{816000000.0,85.0},
{-1,0}};
void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index) {
int i=0;
// loop through calibration table to find best adjustment factor for RX frequency
double min_diff = 6e9,diff;
while (calib_table[i].freq>0) {
diff = fabs(openair0_cfg->rx_freq[chain_index] - calib_table[i].freq);
while (openair0_cfg->rx_gain_calib_table[i].freq>0) {
diff = fabs(openair0_cfg->rx_freq[chain_index] - openair0_cfg->rx_gain_calib_table[i].freq);
printf("cal %d: freq %f, offset %f, diff %f\n",
i,calib_table[i].freq,calib_table[i].offset,diff);
i,
openair0_cfg->rx_gain_calib_table[i].freq,
openair0_cfg->rx_gain_calib_table[i].offset,diff);
if (min_diff > diff) {
min_diff = diff;
openair0_cfg->rx_gain_offset[chain_index] = calib_table[i].offset;
openair0_cfg->rx_gain_offset[chain_index] = openair0_cfg->rx_gain_calib_table[i].offset;
}
i++;
}
......@@ -372,9 +396,43 @@ int openair0_dev_init_usrp(openair0_device* device, openair0_config_t *openair0_
// lock mboard clocks
s->usrp->set_clock_source("internal");
//Setting device type to USRP X300/X310
device->type=USRP_X300_IF;
// this is not working yet, master clock has to be set via constructor
// set master clock rate and sample rate for tx & rx for streaming
//s->usrp->set_master_clock_rate(usrp_master_clock);
openair0_cfg[0].rx_gain_calib_table = calib_table_x310;
switch ((int)openair0_cfg[0].sample_rate) {
case 30720000:
// from usrp_time_offset
openair0_cfg[0].samples_per_packet = 2048;
openair0_cfg[0].tx_sample_advance = 15;
openair0_cfg[0].tx_scheduling_advance = 8*openair0_cfg[0].samples_per_packet;
break;
case 15360000:
openair0_cfg[0].samples_per_packet = 2048;
openair0_cfg[0].tx_sample_advance = 45;
openair0_cfg[0].tx_scheduling_advance = 5*openair0_cfg[0].samples_per_packet;
break;
case 7680000:
openair0_cfg[0].samples_per_packet = 1024;
openair0_cfg[0].tx_sample_advance = 50;
openair0_cfg[0].tx_scheduling_advance = 5*openair0_cfg[0].samples_per_packet;
break;
case 1920000:
openair0_cfg[0].samples_per_packet = 256;
openair0_cfg[0].tx_sample_advance = 50;
openair0_cfg[0].tx_scheduling_advance = 8*openair0_cfg[0].samples_per_packet;
break;
default:
printf("Error: unknown sampling rate %f\n",openair0_cfg[0].sample_rate);
exit(-1);
break;
}
} else {
printf("Found USRP B200");
s->usrp = uhd::usrp::multi_usrp::make(args);
......@@ -386,10 +444,42 @@ int openair0_dev_init_usrp(openair0_device* device, openair0_config_t *openair0_
// // lock mboard clocks
// s->usrp->set_clock_source("internal");
// set master clock rate and sample rate for tx & rx for streaming
device->type = USRP_B200_IF;
s->usrp->set_master_clock_rate(30.72e6);
}
openair0_cfg[0].rx_gain_calib_table = calib_table_b210;
switch ((int)openair0_cfg[0].sample_rate) {
case 30720000:
// from usrp_time_offset
openair0_cfg[0].samples_per_packet = 2048;
openair0_cfg[0].tx_sample_advance = 115;
openair0_cfg[0].tx_scheduling_advance = 11*openair0_cfg[0].samples_per_packet;
break;
case 15360000:
openair0_cfg[0].samples_per_packet = 2048;
openair0_cfg[0].tx_sample_advance = 113;
openair0_cfg[0].tx_scheduling_advance = 5*openair0_cfg[0].samples_per_packet;
break;
case 7680000:
openair0_cfg[0].samples_per_packet = 1024;
openair0_cfg[0].tx_sample_advance = 103;
openair0_cfg[0].tx_scheduling_advance = 5*openair0_cfg[0].samples_per_packet;
break;
case 1920000:
openair0_cfg[0].samples_per_packet = 256;
openair0_cfg[0].tx_sample_advance = 40;
openair0_cfg[0].tx_scheduling_advance = 8*openair0_cfg[0].samples_per_packet;
break;
default:
printf("Error: unknown sampling rate %f\n",openair0_cfg[0].sample_rate);
exit(-1);
break;
}
}
for(i=0;i<s->usrp->get_rx_num_channels();i++) {
if (i<openair0_cfg[0].rx_num_channels) {
......
......@@ -35,7 +35,7 @@ eNBs =
nb_antennas_tx = 1;
nb_antennas_rx = 1;
tx_gain = 32;
rx_gain = 84;
rx_gain = 116;
prach_root = 0;
prach_config_index = 0;
prach_high_speed = "DISABLE";
......
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 = "92";
////////// Physical parameters:
component_carriers = (
{
frame_type = "FDD";
tdd_config = 3;
tdd_config_s = 0;
prefix_type = "NORMAL";
eutra_band = 7;
downlink_frequency = 2660000000L;
uplink_frequency_offset = -120000000;
Nid_cell = 0;
N_RB_DL = 25;
Nid_cell_mbsfn = 0;
nb_antennas_tx = 1;
nb_antennas_rx = 1;
tx_gain = 32;
rx_gain = 116;
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 = -16;
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 = -108;
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 = -108;
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;
}
);
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.26";
ipv6 = "192:168:30::17";
active = "yes";
preference = "ipv4";
}
);
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24";
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24";
ENB_PORT_FOR_S1U = 2152; # Spec 2152
};
log_config :
{
global_log_level ="debug";
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";
};
}
);
......@@ -35,7 +35,7 @@ eNBs =
nb_antennas_tx = 1;
nb_antennas_rx = 1;
tx_gain = 32;
rx_gain = 82;
rx_gain = 120;
prach_root = 0;
prach_config_index = 0;
prach_high_speed = "DISABLE";
......
......@@ -16,7 +16,7 @@ eNBs =
tracking_area_code = "1";
mobile_country_code = "208";
mobile_network_code = "95";
mobile_network_code = "92";
////////// Physical parameters:
......@@ -30,12 +30,12 @@ eNBs =
downlink_frequency = 2660000000L;
uplink_frequency_offset = -120000000;
Nid_cell = 0;
N_RB_DL = 25;
N_RB_DL = 100;
Nid_cell_mbsfn = 0;
nb_antennas_tx = 1;
nb_antennas_rx = 1;
tx_gain = 90;
rx_gain = 120;
rx_gain = 119;
prach_root = 0;
prach_config_index = 0;
prach_high_speed = "DISABLE";
......@@ -130,12 +130,10 @@ eNBs =
};
////////// MME parameters:
mme_ip_address = ( { ipv4 = "192.168.12.62";
ipv6 = "192:168:30::17";
active = "yes";
preference = "ipv4";
}
);
mme_ip_address = ( {ipv4 = "192.168.12.26";
ipv6="192:168:30::17";
active="yes";
preference="ipv4";});
NETWORK_INTERFACES :
{
......
......@@ -35,7 +35,7 @@ eNBs =
nb_antennas_tx = 1;
nb_antennas_rx = 1;
tx_gain = 32;
rx_gain = 84;
rx_gain = 116;
prach_root = 0;
prach_config_index = 0;
prach_high_speed = "DISABLE";
......
......@@ -172,7 +172,7 @@ void config_BBU_mod( rrh_module_t *mod_enb, uint8_t RT_flag, uint8_t NRT_flag) {
mod_enb->devs->openair0_cfg.tx_delay = 8;
}
}
else if (mod_enb->devs->type == USRP_IF) {
else if ((mod_enb->devs->type == USRP_B200_IF )||(mod_enb->devs->type == USRP_X300_IF )) {
if ( mod_enb->devs->openair0_cfg.num_rb_dl == 100 ) {
mod_enb->devs->openair0_cfg.samples_per_packet = 2048;
mod_enb->devs->openair0_cfg.tx_forward_nsamps = 175;
......
......@@ -293,10 +293,6 @@ static int tx_max_power[MAX_NUM_CCs]; /* = {0,0}*/;
char ref[128] = "internal";
char channels[128] = "0";
//unsigned int samples_per_frame = 307200;
//unsigned int tx_forward_nsamps=0;
//int tx_delay;
#endif
int rx_input_level_dBm;
......@@ -1559,7 +1555,7 @@ static void* eNB_thread( void* arg )
int hw_subframe = 0; // 0..NUM_ENB_THREADS-1 => 0..9
unsigned int rx_pos = 0;
unsigned int tx_pos = 0; //spp*tx_delay;
unsigned int tx_pos = 0;
#endif
int CC_id=0;
struct timespec trx_time0, trx_time1, trx_time2;
......@@ -1634,8 +1630,8 @@ static void* eNB_thread( void* arg )
int frame = 0;
#ifndef EXMIMO
spp = openair0_cfg[0].samples_per_packet;
tx_pos=spp*openair0_cfg[0].tx_delay;
spp = openair0_cfg[0].samples_per_packet;
tx_pos = openair0_cfg[0].tx_scheduling_advance;
#endif
while (!oai_exit) {
......@@ -1796,11 +1792,10 @@ static void* eNB_thread( void* arg )
// prepare tx buffer pointers
for (i=0; i<PHY_vars_eNB_g[0][0]->lte_frame_parms.nb_antennas_tx; i++)
txp[i] = (void*)&txdata[i][tx_pos];
//printf("tx_pos %d ts %d, ts_offset %d txp[i] %p, ap %d\n", tx_pos, timestamp, (timestamp+(tx_delay*spp)-tx_forward_nsamps),txp[i], i);
// if symb_written < spp ==> error
if (frame > 50) {
openair0.trx_write_func(&openair0,
(timestamp+(openair0_cfg[card].tx_delay*spp)-openair0_cfg[card].tx_forward_nsamps),
(timestamp+(openair0_cfg[card].tx_scheduling_advance)-openair0_cfg[card].tx_sample_advance),
txp,
spp,
PHY_vars_eNB_g[0][0]->lte_frame_parms.nb_antennas_tx,
......@@ -1808,7 +1803,7 @@ static void* eNB_thread( void* arg )
}
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TS, timestamp&0xffffffff );
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, (timestamp+(openair0_cfg[card].tx_delay*spp)-openair0_cfg[card].tx_forward_nsamps)&0xffffffff );
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, (timestamp+(openair0_cfg[card].tx_scheduling_advance)-openair0_cfg[card].tx_sample_advance)&0xffffffff );
stop_meas( &softmodem_stats_mt );
clock_gettime( CLOCK_MONOTONIC, &trx_time2 );
......@@ -2847,66 +2842,33 @@ int main( int argc, char **argv )
for (card=0; card<MAX_CARDS; card++) {
if(frame_parms[0]->N_RB_DL == 100) {
sample_rate = 30.72e6;
bw = 10.0e6;
#ifndef EXMIMO
openair0_cfg[card].sample_rate=30.72e6;
openair0_cfg[card].samples_per_packet = 2048;
openair0_cfg[card].samples_per_frame = 307200;
openair0_cfg[card].tx_bw = 10e6;
openair0_cfg[card].rx_bw = 10e6;
// from usrp_time_offset
openair0_cfg[card].tx_forward_nsamps = 175;
openair0_cfg[card].tx_delay = 8;
#endif
} else if(frame_parms[0]->N_RB_DL == 50) {
sample_rate = 15.36e6;
bw = 5.0e6;
#ifndef EXMIMO
openair0_cfg[card].sample_rate=15.36e6;
openair0_cfg[card].samples_per_packet = 2048;
openair0_cfg[card].samples_per_frame = 153600;
openair0_cfg[card].tx_bw = 5e6;
openair0_cfg[card].rx_bw = 5e6;
openair0_cfg[card].tx_forward_nsamps = 95;
openair0_cfg[card].tx_delay = 5;
#endif
} else if (frame_parms[0]->N_RB_DL == 25) {
sample_rate = 7.68e6;
bw = 2.5e6;
#ifndef EXMIMO
openair0_cfg[card].sample_rate=7.68e6;
openair0_cfg[card].samples_per_frame = 76800;
openair0_cfg[card].tx_bw = 2.5e6;
openair0_cfg[card].rx_bw = 2.5e6;
openair0_cfg[card].samples_per_packet = 1024;
#ifdef OAI_USRP
openair0_cfg[card].tx_forward_nsamps = 70;
openair0_cfg[card].tx_delay = 5;
#elif OAI_BLADERF
openair0_cfg[card].tx_forward_nsamps = 0;
openair0_cfg[card].tx_delay = 8;
#endif
#endif
} else if (frame_parms[0]->N_RB_DL == 6) {
sample_rate = 1.92e6;
bw = 0.96e6;
#ifndef EXMIMO
openair0_cfg[card].sample_rate=1.92e6;
openair0_cfg[card].samples_per_packet = 256;
openair0_cfg[card].samples_per_frame = 19200;
openair0_cfg[card].tx_bw = 1.5e6;
openair0_cfg[card].rx_bw = 1.5e6;
openair0_cfg[card].tx_forward_nsamps = 40;
openair0_cfg[card].tx_delay = 8;
#endif
}
#ifdef ETHERNET
//calib needed
openair0_cfg[card].tx_delay = 0;
openair0_cfg[card].tx_forward_nsamps = 0;
openair0_cfg[card].tx_scheduling_advance = 0;
openair0_cfg[card].tx_sample_advance = 0;
if (frame_parms[0]->N_RB_DL == 6)
openair0_cfg[card].samples_per_packet = 256;
......@@ -2917,9 +2879,6 @@ int main( int argc, char **argv )
#endif
#ifndef EXMIMO
openair0_cfg[card].samples_per_packet = openair0_cfg[0].samples_per_packet;
#endif
printf("HW: Configuring card %d, nb_antennas_tx/rx %d/%d\n",card,
((UE_flag==0) ? PHY_vars_eNB_g[0][0]->lte_frame_parms.nb_antennas_tx : PHY_vars_UE_g[0][0]->lte_frame_parms.nb_antennas_tx),
((UE_flag==0) ? PHY_vars_eNB_g[0][0]->lte_frame_parms.nb_antennas_rx : PHY_vars_UE_g[0][0]->lte_frame_parms.nb_antennas_rx));
......@@ -2935,11 +2894,9 @@ int main( int argc, char **argv )
openair0_cfg[card].remote_ip = &rrh_eNB_ip[0];
openair0_cfg[card].remote_port = rrh_eNB_port;
}
openair0_cfg[card].num_rb_dl=frame_parms[0]->N_RB_DL;
openair0_cfg[card].num_rb_dl=frame_parms[0]->N_RB_DL;
#endif
openair0_cfg[card].sample_rate = sample_rate;
openair0_cfg[card].tx_bw = bw;
openair0_cfg[card].rx_bw = bw;
// in the case of the USRP, the following variables need to be initialized before the init
// since the USRP only supports one CC (for the moment), we initialize all the cards with first CC.
// in the case of EXMIMO2, these values are overwirtten in the function setup_eNB/UE_buffer
......@@ -2965,24 +2922,28 @@ openair0_cfg[card].num_rb_dl=frame_parms[0]->N_RB_DL;
else {
openair0_cfg[card].rx_gain[i] = PHY_vars_UE_g[0][0]->rx_total_gain_dB;// - USRP_GAIN_OFFSET; // calibrated for USRP B210 @ 2.6 GHz, 30.72 MS/s
}
switch(frame_parms[0]->N_RB_DL) {
case 6:
openair0_cfg[card].rx_gain[i] -= 6;
openair0_cfg[card].rx_gain[i] -= 12;
break;
case 25:
openair0_cfg[card].rx_gain[i] += 6;
openair0_cfg[card].rx_gain[i] -= 6;
break;
case 50:
openair0_cfg[card].rx_gain[i] += 8;
openair0_cfg[card].rx_gain[i] -= 3;
break;
case 100:
openair0_cfg[card].rx_gain[i] -= 0;
break;
default:
break;
}
}
......@@ -3070,7 +3031,7 @@ openair0_cfg[card].num_rb_dl=frame_parms[0]->N_RB_DL;
// connect the TX/RX buffers
if (UE_flag==1) {
#ifdef OAI_USRP
openair_daq_vars.timing_advance = 160;
openair_daq_vars.timing_advance = 0;
#else
openair_daq_vars.timing_advance = 160;
#endif
......
......@@ -410,6 +410,7 @@ static void *UE_thread_synch(void *arg)
UE->UE_scan_carrier = 0;
// rerun with new cell parameters and frequency-offset
for (i=0;i<openair0_cfg[0].rx_num_channels;i++) {
openair0_cfg[0].rx_gain[i] = UE->rx_total_gain_dB;//-USRP_GAIN_OFFSET;
openair0_cfg[0].rx_freq[i] -= UE->lte_ue_common_vars.freq_offset;
openair0_cfg[0].tx_freq[i] = openair0_cfg[0].rx_freq[i]+uplink_frequency_offset[0][i];
downlink_frequency[0][i] = openair0_cfg[0].rx_freq[i];
......@@ -1002,7 +1003,7 @@ void *UE_thread(void *arg)
static int UE_thread_retval;
PHY_VARS_UE *UE = PHY_vars_UE_g[0][0];
int spp = openair0_cfg[0].samples_per_packet;
int slot=1, frame=0, hw_subframe=0, rxpos=0, txpos=spp*openair0_cfg[0].tx_delay;
int slot=1, frame=0, hw_subframe=0, rxpos=0, txpos=spp*openair0_cfg[0].tx_scheduling_advance;
#ifdef __AVX2__
int dummy[2][spp] __attribute__((aligned(32)));
#else
......@@ -1127,7 +1128,7 @@ void *UE_thread(void *arg)
txp[i] = (void*)&txdata[i][txpos];
openair0.trx_write_func(&openair0,
(timestamp+spp*openair0_cfg[0].tx_delay-openair0_cfg[0].tx_forward_nsamps),
(timestamp+openair0_cfg[0].tx_scheduling_advance-openair0_cfg[0].tx_sample_advance),
txp,
spp - ((first_rx==1) ? rx_off_diff : 0),
UE->lte_frame_parms.nb_antennas_tx,
......
......@@ -216,7 +216,7 @@ static rrh_module_t new_module (unsigned int id) {
LOG_I(RRH,"Setting RF device to EXMIMO\n");
#elif OAI_USRP
rrh_mod.devs=oai_dv;
rrh_mod.devs->type=USRP_IF;
rrh_mod.devs->type=USRP_B200_IF;
LOG_I(RRH,"Setting RF device to USRP\n");
#elif OAI_BLADERF
rrh_mod.devs=oai_dv;
......
......@@ -51,7 +51,7 @@
/*! \brief RRH supports two types of modules: eNB and UE
each module is associated with an ethernet device (device of ETH_IF)
and optionally with a RF device (device type can be USRP_IF/BLADERF_IF/EXMIMO_IF/NONE_IF)
and optionally with a RF device (device type can be USRP_B200/USRP_X300/BLADERF_IF/EXMIMO_IF/NONE_IF)
UE modules will always have RF device type NONE_IF */
typedef struct {
/*! \brief module id */
......
......@@ -303,8 +303,8 @@ void do_DL_sig(double **r_re0,double **r_im0,
10*log10(rx_pwr*(double)frame_parms->N_RB_DL*12),next_slot,next_slot>>1);
LOG_D(OCM,"[SIM][DL] UE %d : rx_pwr (noise) -132 dBm/RE (N0fs = %.1f dBm, N0B = %.1f dBm) for slot %d (subframe %d)\n",
UE_id,
10*log10(eNB2UE[eNB_id][UE_id][CC_id]->BW*1e6)-174,
10*log10(eNB2UE[eNB_id][UE_id][CC_id]->BW*1e6*12*frame_parms->N_RB_DL/(double)frame_parms->ofdm_symbol_size)-174,
10*log10(eNB2UE[eNB_id][UE_id][CC_id]->sampling_rate*1e6)-174,
10*log10(eNB2UE[eNB_id][UE_id][CC_id]->sampling_rate*1e6*12*frame_parms->N_RB_DL/(double)frame_parms->ofdm_symbol_size)-174,
next_slot,next_slot>>1);
#endif
......@@ -342,7 +342,7 @@ void do_DL_sig(double **r_re0,double **r_im0,
r_im0,
nb_antennas_rx,
frame_parms->samples_per_tti>>1,
1e3/eNB2UE[eNB_id][UE_id][CC_id]->BW, // sampling time (ns)
1e3/eNB2UE[eNB_id][UE_id][CC_id]->sampling_rate, // sampling time (ns)
(double)PHY_vars_UE_g[UE_id][CC_id]->rx_total_gain_dB - 66.227); // rx_gain (dB) (66.227 = 20*log10(pow2(11)) = gain from the adc that will be applied later)
#ifdef DEBUG_SIM
......@@ -584,7 +584,7 @@ void do_UL_sig(double **r_re0,double **r_im0,double **r_re,double **r_im,double
r_im,
nb_antennas_rx,
frame_parms->samples_per_tti>>1,
1e3/UE2eNB[0][eNB_id][CC_id]->BW, // sampling time (ns)
1e3/UE2eNB[0][eNB_id][CC_id]->sampling_rate, // sampling time (ns)
(double)PHY_vars_eNB_g[eNB_id][CC_id]->rx_total_gain_eNB_dB - 66.227); // rx_gain (dB) (66.227 = 20*log10(pow2(11)) = gain from the adc that will be applied later)
#ifdef DEBUG_SIM
......
......@@ -1122,24 +1122,28 @@ void init_ocm(void)
else
*/
eNB2UE[eNB_id][UE_id][CC_id] = new_channel_desc_scm(PHY_vars_eNB_g[eNB_id][CC_id]->lte_frame_parms.nb_antennas_tx,
PHY_vars_UE_g[UE_id][CC_id]->lte_frame_parms.nb_antennas_rx,
map_str_to_int(small_scale_names,oai_emulation.environment_system_config.fading.small_scale.selected_option),
oai_emulation.environment_system_config.system_bandwidth_MB,
forgetting_factor,
0,
0);
eNB2UE[eNB_id][UE_id][CC_id] =
new_channel_desc_scm(PHY_vars_eNB_g[eNB_id][CC_id]->lte_frame_parms.nb_antennas_tx,
PHY_vars_UE_g[UE_id][CC_id]->lte_frame_parms.nb_antennas_rx,
map_str_to_int(small_scale_names,oai_emulation.environment_system_config.fading.small_scale.selected_option),
N_RB2sampling_rate(PHY_vars_eNB_g[eNB_id][CC_id]->lte_frame_parms.N_RB_DL),
N_RB2channel_bandwidth(PHY_vars_eNB_g[eNB_id][CC_id]->lte_frame_parms.N_RB_DL),
forgetting_factor,
0,
0);
random_channel(eNB2UE[eNB_id][UE_id][CC_id],abstraction_flag);
LOG_D(OCM,"[SIM] Initializing channel (%s, %d) from UE %d to eNB %d\n", oai_emulation.environment_system_config.fading.small_scale.selected_option,
map_str_to_int(small_scale_names, oai_emulation.environment_system_config.fading.small_scale.selected_option),UE_id, eNB_id);
UE2eNB[UE_id][eNB_id][CC_id] = new_channel_desc_scm(PHY_vars_UE_g[UE_id][CC_id]->lte_frame_parms.nb_antennas_tx,
PHY_vars_eNB_g[eNB_id][CC_id]->lte_frame_parms.nb_antennas_rx,
map_str_to_int(small_scale_names, oai_emulation.environment_system_config.fading.small_scale.selected_option),
oai_emulation.environment_system_config.system_bandwidth_MB,
forgetting_factor,
0,
0);
UE2eNB[UE_id][eNB_id][CC_id] =
new_channel_desc_scm(PHY_vars_UE_g[UE_id][CC_id]->lte_frame_parms.nb_antennas_tx,
PHY_vars_eNB_g[eNB_id][CC_id]->lte_frame_parms.nb_antennas_rx,
map_str_to_int(small_scale_names, oai_emulation.environment_system_config.fading.small_scale.selected_option),
N_RB2sampling_rate(PHY_vars_eNB_g[eNB_id][CC_id]->lte_frame_parms.N_RB_UL),
N_RB2channel_bandwidth(PHY_vars_eNB_g[eNB_id][CC_id]->lte_frame_parms.N_RB_UL),
forgetting_factor,
0,
0);
random_channel(UE2eNB[UE_id][eNB_id][CC_id],abstraction_flag);
......
......@@ -254,7 +254,7 @@ void init_snr(channel_desc_t* eNB2UE, node_desc_t *enb_data, node_desc_t *ue_dat
uint8_t qq;
/* Thermal noise is calculated using 10log10(K*T*B) K = Boltzmann's constant T = room temperature B = bandwidth */
thermal_noise = -174 + 10*log10(eNB2UE->BW*1e6); //value in dBm
thermal_noise = -174 + 10*log10(eNB2UE->sampling_rate*1e6); //value in dBm
//for (aarx=0; aarx<eNB2UE->nb_rx; aarx++)
*N0 = thermal_noise + ue_data->rx_noise_level;//? all the element have the same noise level?????
......@@ -496,7 +496,7 @@ void init_snr_up(channel_desc_t* UE2eNB, node_desc_t *enb_data, node_desc_t *ue_
// nb_rb = phy_vars_eNB->ulsch_eNB[UE_id]->harq_processes[harq_pid]->nb_rb;
/* Thermal noise is calculated using 10log10(K*T*B) K = Boltzmann's constant T = room temperature B = bandwidth */
thermal_noise = -174 + 10*log10(UE2eNB->BW*1e6); //value in dBm
thermal_noise = -174 + 10*log10(UE2eNB->sampling_rate*1e6); //value in dBm
*N0 = thermal_noise + enb_data->rx_noise_level;//? all the element have the same noise level?????
double lambda ;
double residual;
......@@ -557,7 +557,7 @@ void calculate_sinr(channel_desc_t* eNB2UE, node_desc_t *enb_data, node_desc_t *
short count;
/* Thermal noise is calculated using 10log10(K*T*B) K = Boltzmann's constant T = room temperature B = bandwidth */
thermal_noise = -174 + 10*log10(eNB2UE->BW*1e6); //value in dBm
thermal_noise = -174 + 10*log10(eNB2UE->sampling_rate*1e6); //value in dBm
for (count = 0; count < 12 * nb_rb; count++) {
sir = enb_data->tx_power_dBm
......
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