Commit 762dfbe3 authored by villa's avatar villa

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4001 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 56c66c09
......@@ -39,6 +39,7 @@ void _parseOptions(options_t *opts, int argc, char ** argv) {
{"g", required_argument, 0, 'g'},
{"f", no_argument, 0, 'f'},
{"a", no_argument, 0, 'a'},
{"i", no_argument, 0, 'i'},
{"b", required_argument, 0, 'b'},
{"w", required_argument, 0, 'w'},
{"k", required_argument, 0, 'k'},
......@@ -57,7 +58,7 @@ void _parseOptions(options_t *opts, int argc, char ** argv) {
int option_index = 0;
while ((c = getopt_long (argc, argv, "hs:S:T:n:xdt:y:z:I:j:N:o:g:fab:r:R:w:c:em:A:Dp:B:k:Q:",long_options, &option_index)) != -1)
while ((c = getopt_long (argc, argv, "hs:S:T:n:xdt:y:z:I:j:N:o:g:faib:r:R:w:c:em:A:Dp:B:k:Q:",long_options, &option_index)) != -1)
{
//printf("%c %s\n",c,optarg);
switch (c)
......@@ -67,6 +68,11 @@ void _parseOptions(options_t *opts, int argc, char ** argv) {
opts->channel_model=AWGN;
sprintf(opts->parameters,"%s -a",opts->parameters);
break;
case 'i':
opts->awgn_flagi=1;
opts->channel_modeli=AWGN;
sprintf(opts->parameters,"%s -i",opts->parameters);
break;
case 'B':
opts->N_RB_DL=atoi(optarg);
break;
......@@ -286,6 +292,7 @@ void _parseOptions(options_t *opts, int argc, char ** argv) {
printf("-g [A,B,C,D,E,F,G] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models (ignores delay spread and Ricean factor), default value is AWGN\n");
// printf("-f Output filename (.txt format) for Pe/SNR results\n");
printf("-a Use AWGN channel and not multipath\n");
printf("-i Use AWGN channel for the interference\n");
printf("-b Test Number\n");
printf("-c CellId Number for interferer\n");
printf("-r ressource block allocation (see section 7.1.6.3 in 36.213\n");
......@@ -498,7 +505,7 @@ void _makeOutputDir(options_t *opts)
sprintf(auxFile,"OutputBlerRound_%d.m",opts->testNumber);
opts->outputBler =fopen(auxFile,"w");
fprintf( opts->outputBler,"SNR; MCS; TBS; rate; err0; trials0; err1; trials1; err2; trials2; err3; trials3; dci_err\n");
fprintf( opts->outputBler,"SNR; rate1; MCS; TBS; rate; err0; trials0; err1; trials1; err2; trials2; err3; trials3; dci_err\n");
sprintf(auxFile,"OutputBER_%d.m",opts->testNumber);
opts->outputBer =fopen(auxFile,"w");
......
......@@ -153,7 +153,7 @@ u32 _allocRBs(options_t *opts, int ind);
void _freeMemory(data_t data,options_t opts);
void _makeSimulation(data_t data,options_t opts,DCI_ALLOC_t *dci_alloc,DCI_ALLOC_t *dci_alloc_rx,u32 *NB_RB2,LTE_DL_FRAME_PARMS *frame_parms,u8 num_pdcch_symbols);
void _printResults(u32 *errs,u32 *round_trials,u32 dci_errors,double rate);
void _printFileResults(double SNR, double rate,u32 *errs,u32 *round_trials,u32 dci_errors,options_t opts,double BER);
void _printFileResults(double SNR, double rate1, double rate,u32 *errs,u32 *round_trials,u32 dci_errors,options_t opts,double BER);
void _initErrsRoundsTrials(u32 **errs,u32 **trials,int allocFlag,options_t opts);
void _fillData(options_t opts,data_t data,int numSubFrames);
void _applyNoise(options_t opts,data_t data,double sigma2,double iqim,int numSubFrames);
......
......@@ -85,8 +85,9 @@ int main(int argc,char **argv)
DCI_ALLOC_t dci_alloc[8],dci_alloc_rx[8];
//Init LOG
logInit();
//svcd_signal_dumper_init();//TVT:Navid
//vcd_signal_dumper_init();
set_comp_log(PHY,LOG_DEBUG,LOG_LOW,1);
//Parse options
......@@ -453,7 +454,7 @@ void _allocDLSChannel(options_t opts) {
for (i=0; i<2; i++)
{
//eNB
PHY_vars_eNB->dlsch_eNB[0][i] = new_eNB_dlsch(1,8,0);
PHY_vars_eNB->dlsch_eNB[0][i] = new_eNB_dlsch(1,8,opts.N_RB_DL,0);
PHY_vars_eNB->dlsch_eNB[0][i]->dl_power_off =1;
if (!PHY_vars_eNB->dlsch_eNB[0][i]) {
......@@ -469,7 +470,7 @@ void _allocDLSChannel(options_t opts) {
for(j=0;j<opts.nInterf;j++)
{
interf_PHY_vars_eNB[j]->dlsch_eNB[0][i]=new_eNB_dlsch(1,8,0);
interf_PHY_vars_eNB[j]->dlsch_eNB[0][i]=new_eNB_dlsch(1,8,opts.N_RB_DL,0);
interf_PHY_vars_eNB[j]->dlsch_eNB[0][i]->dl_power_off =1;
if (!interf_PHY_vars_eNB[j]->dlsch_eNB[0][i]) {
printf("Can't get interferer eNB dlsch structures\n");
......@@ -483,7 +484,7 @@ void _allocDLSChannel(options_t opts) {
}
//UE
PHY_vars_UE->dlsch_ue[0][i] = new_ue_dlsch(1,8,MAX_TURBO_ITERATIONS,0);
PHY_vars_UE->dlsch_ue[0][i] = new_ue_dlsch(1,8,MAX_TURBO_ITERATIONS,opts.N_RB_DL,0);
// PHY_vars_UE->dlsch_ue[0][i] = new_ue_dlsch(1,8,MAX_TURBO_ITERATIONS,0);
if (!PHY_vars_UE->dlsch_ue[0][i]) {
printf("Can't get ue dlsch structures\n");
......@@ -712,13 +713,14 @@ void _printResults(u32 *errs,u32 *round_trials,u32 dci_errors,double rate)
}
void _printFileResults(double SNR, double rate,u32 *errs,u32 *round_trials,u32 dci_errors,options_t opts,double BER)
void _printFileResults(double SNR,double rate1, double rate,u32 *errs,u32 *round_trials,u32 dci_errors,options_t opts,double BER)
{
fprintf(opts.outputFile,"%f %f;\n", SNR, (float)errs[0]/round_trials[0]);
fprintf(opts.outputBler,"%f;%d;%d;%f;%d;%d;%d;%d;%d;%d;%d;%d;%d\n",
fprintf(opts.outputBler,"%f;%f;%d;%d;%f;%d;%d;%d;%d;%d;%d;%d;%d;%d\n",
SNR,
rate1,
opts.mcs,
PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->TBS,
rate,
......@@ -1029,7 +1031,7 @@ void _makeSimulation(data_t data,options_t opts,DCI_ALLOC_t *dci_alloc,DCI_ALLOC
//Variables
u32 tbs,coded_bits_per_codeword;
int num_common_dci=0,num_ue_spec_dci=1;
double rate=0, sigma2, sigma2_dB=10,uncoded_ber,avg_ber;
double rate=0,rate1=0, sigma2, sigma2_dB=10,uncoded_ber,avg_ber;
short *uncoded_ber_bit;
unsigned int dci_cnt,dlsch_active=0;
unsigned int tx_lev,tx_lev_dB=0,*itx_lev=null,*itxlev_dB=null; // Signal Power
......@@ -1331,13 +1333,16 @@ void _makeSimulation(data_t data,options_t opts,DCI_ALLOC_t *dci_alloc,DCI_ALLOC
tbs = (double)dlsch_tbs25[get_I_TBS(PHY_vars_eNB->dlsch_eNB[idUser][0]->harq_processes[0]->mcs)][PHY_vars_eNB->dlsch_eNB[idUser][0]->nb_rb-1];
// printf("\nround: %d dlsch_enB=->nb_rb: %d mcs: %d\n",round,PHY_vars_eNB->dlsch_eNB[idUser][0]->nb_rb,opts.mcs);
//printf("PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->MCS %d\n",PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->mcs);
//printf("tbs= %d, G=%d \n",tbs,coded_bits_per_codeword);
rate = (double)tbs/(double)coded_bits_per_codeword;
uncoded_ber_bit = (short*) malloc(2*coded_bits_per_codeword);
if (cont_frames==0 && round==0)
if (cont_frames==0 && round==0){
printf("\tRate = %f (%f bits/dim) (G %d, TBS %d, mod %d, pdcch_sym %d)\n",
rate,rate*i_mod,coded_bits_per_codeword,tbs,i_mod,num_pdcch_symbols);
rate1=rate*i_mod;}
//TVT: no tpmi in DCI format 1 --------------
// use the PMI from previous trial
......@@ -1882,7 +1887,7 @@ void _makeSimulation(data_t data,options_t opts,DCI_ALLOC_t *dci_alloc,DCI_ALLOC
fprintf(opts.outputTrougput,"%f %f;\n",SNR, rate*((double)(round_trials[0]-dci_errors)/((double)round_trials[0] + round_trials[1] + round_trials[2] + round_trials[3])));
_printResults(errs,round_trials,dci_errors,rate);
_printFileResults( SNR, rate,errs,round_trials, dci_errors, opts,avg_ber/numresults);
_printFileResults( SNR, rate1, rate,errs,round_trials, dci_errors, opts,avg_ber/numresults);
if (((double)errs[0]/(round_trials[0]))<1e-2) break;//IF erros > 10% by standar
......@@ -2174,9 +2179,20 @@ void _fillPerfectChannelDescription(options_t opts,u8 l)
if(opts.nInterf>0)//Max num interferer
{
if(j==opts.Nid_cell) continue;
/*if(j==opts.Nid_cell) continue;
((s16 *) PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[1][(aa<<1)+aarx])[2*i+(l*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=(short)((AMP/2)*(pow(10.0,.05*opts.dbInterf[0])));
((s16 *) PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[1][(aa<<1)+aarx])[2*i+1+(l*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=0;
*/
if(opts.awgn_flagi==0){
if(j==opts.Nid_cell) continue;
((s16 *) PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[1][(aa<<1)+aarx])[2*i+(l*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=(s16)(interf_eNB2UE[0]->chF[aarx+(aa*frame_parms->nb_antennas_rx)][i].x*AMP/2)*pow(10.0,.05*opts.dbInterf[0]);
((s16 *) PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[1][(aa<<1)+aarx])[2*i+1+(l*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=(s16)(interf_eNB2UE[0]->chF[aarx+(aa*frame_parms->nb_antennas_rx)][i].y*AMP/2)*pow(10.0,.05*opts.dbInterf[0]) ;
}
else{
if(j==opts.Nid_cell) continue;
((s16 *) PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[1][(aa<<1)+aarx])[2*i+(l*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=(short)((AMP/2)*(pow(10.0,.05*opts.dbInterf[0])));
((s16 *) PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[1][(aa<<1)+aarx])[2*i+1+(l*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=0;
}
}
}
......
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