Commit 8cc39130 authored by lukashov's avatar lukashov

Now dlsim computes throughput for both streams.

parent 4e8e7079
...@@ -142,7 +142,7 @@ int main(int argc, char **argv) ...@@ -142,7 +142,7 @@ int main(int argc, char **argv)
int s,Kr,Kr_bytes; int s,Kr,Kr_bytes;
double sigma2, sigma2_dB=10,SNR,snr0=-2.0,snr1,rate; double sigma2, sigma2_dB=10,SNR,snr0=-2.0,snr1,rate[2];
double snr_step=1,input_snr_step=1, snr_int=30; double snr_step=1,input_snr_step=1, snr_int=30;
LTE_DL_FRAME_PARMS *frame_parms; LTE_DL_FRAME_PARMS *frame_parms;
...@@ -170,7 +170,7 @@ int main(int argc, char **argv) ...@@ -170,7 +170,7 @@ int main(int argc, char **argv)
unsigned char *input_buffer0[2],*input_buffer1[2]; unsigned char *input_buffer0[2],*input_buffer1[2];
unsigned short input_buffer_length0,input_buffer_length1; unsigned short input_buffer_length0,input_buffer_length1;
unsigned int ret[2]; unsigned int ret[2];
unsigned int coded_bits_per_codeword=0,nsymb,dci_cnt,tbs=0; unsigned int coded_bits_per_codeword[2],nsymb,dci_cnt,tbs[2];
unsigned int tx_lev=0,tx_lev_dB=0,trials,errs[2][4],round_trials[4]={0,0,0,0},dci_errors=0,dlsch_active=0,num_layers; unsigned int tx_lev=0,tx_lev_dB=0,trials,errs[2][4],round_trials[4]={0,0,0,0},dci_errors=0,dlsch_active=0,num_layers;
...@@ -736,7 +736,7 @@ int main(int argc, char **argv) ...@@ -736,7 +736,7 @@ int main(int argc, char **argv)
exit(-1); exit(-1);
} }
fprintf(bler_fd,"SNR; MCS1; MCS2; TBS1; TBS2; rate; err0_st1; err0_st2 trials0; err1_st1; err1_st2; trials1; err2_st1; err2_st2; trials2; err3_st1; err3_st2; trials3; dci_err\n"); fprintf(bler_fd,"SNR; MCS1; MCS2; TBS1; TBS2; rate 0; rate 1; err0_st1; err0_st2 trials0; err1_st1; err1_st2; trials1; err2_st1; err2_st2; trials2; err3_st1; err3_st2; trials3; throug 0; throug 1; sum throug; dci_err\n");
if (test_perf != 0) { if (test_perf != 0) {
char hostname[1024]; char hostname[1024];
...@@ -2705,7 +2705,7 @@ n(tikz_fname,"w"); ...@@ -2705,7 +2705,7 @@ n(tikz_fname,"w");
for (k=0;k<n_users;k++) { for (k=0;k<n_users;k++) {
for (int cw=0; cw<Kmimo; cw++) { for (int cw=0; cw<Kmimo; cw++) {
coded_bits_per_codeword = get_G(&PHY_vars_eNB->lte_frame_parms, coded_bits_per_codeword[cw] = get_G(&PHY_vars_eNB->lte_frame_parms,
PHY_vars_eNB->dlsch_eNB[k][cw]->harq_processes[0]->nb_rb, PHY_vars_eNB->dlsch_eNB[k][cw]->harq_processes[0]->nb_rb,
PHY_vars_eNB->dlsch_eNB[k][cw]->harq_processes[0]->rb_alloc, PHY_vars_eNB->dlsch_eNB[k][cw]->harq_processes[0]->rb_alloc,
get_Qm(PHY_vars_eNB->dlsch_eNB[k][cw]->harq_processes[0]->mcs), get_Qm(PHY_vars_eNB->dlsch_eNB[k][cw]->harq_processes[0]->mcs),
...@@ -2715,18 +2715,18 @@ n(tikz_fname,"w"); ...@@ -2715,18 +2715,18 @@ n(tikz_fname,"w");
#ifdef TBS_FIX // This is for MESH operation!!! #ifdef TBS_FIX // This is for MESH operation!!!
tbs = (double)3*TBStable[get_I_TBS(PHY_vars_eNB->dlsch_eNB[k][cw]->harq_processes[0]->mcs)][PHY_vars_eNB->dlsch_eNB[k][cw]->nb_rb-1]/4; tbs[cw] = (double)3*TBStable[get_I_TBS(PHY_vars_eNB->dlsch_eNB[k][cw]->harq_processes[0]->mcs)][PHY_vars_eNB->dlsch_eNB[k][cw]->nb_rb-1]/4;
#else #else
tbs = PHY_vars_eNB->dlsch_eNB[k][cw]->harq_processes[0]->TBS; tbs[cw] = PHY_vars_eNB->dlsch_eNB[k][cw]->harq_processes[0]->TBS;
#endif #endif
rate = (double)tbs/(double)coded_bits_per_codeword; rate[cw] = (double)tbs[cw]/(double)coded_bits_per_codeword[cw];
if ((SNR==snr0) && (trials==0) && (round==0) && (pmi_feedback==0)) if ((SNR==snr0) && (trials==0) && (round==0) && (pmi_feedback==0))
printf("User %d, cw %d: Rate = %f (%f bits/dim) (G %d, TBS %d, mod %d, pdcch_sym %d, ndi %d)\n", printf("User %d, cw %d: Rate = %f (%f bits/dim) (G %d, TBS %d, mod %d, pdcch_sym %d, ndi %d)\n",
k,cw,rate,rate*get_Qm(PHY_vars_eNB->dlsch_eNB[k][cw]->harq_processes[0]->mcs), k,cw,rate[cw],rate[cw]*get_Qm(PHY_vars_eNB->dlsch_eNB[k][cw]->harq_processes[0]->mcs),
coded_bits_per_codeword, coded_bits_per_codeword[cw],
tbs, tbs[cw],
get_Qm(PHY_vars_eNB->dlsch_eNB[k][cw]->harq_processes[0]->mcs), get_Qm(PHY_vars_eNB->dlsch_eNB[k][cw]->harq_processes[0]->mcs),
num_pdcch_symbols, num_pdcch_symbols,
PHY_vars_eNB->dlsch_eNB[k][cw]->harq_processes[0]->round); PHY_vars_eNB->dlsch_eNB[k][cw]->harq_processes[0]->round);
...@@ -2789,7 +2789,7 @@ n(tikz_fname,"w"); ...@@ -2789,7 +2789,7 @@ n(tikz_fname,"w");
dlsch_scrambling(&PHY_vars_eNB->lte_frame_parms, dlsch_scrambling(&PHY_vars_eNB->lte_frame_parms,
0, 0,
PHY_vars_eNB->dlsch_eNB[k][cw], PHY_vars_eNB->dlsch_eNB[k][cw],
coded_bits_per_codeword, coded_bits_per_codeword[cw],
cw, cw,
subframe<<1); subframe<<1);
stop_meas(&PHY_vars_eNB->dlsch_scrambling_stats); stop_meas(&PHY_vars_eNB->dlsch_scrambling_stats);
...@@ -3230,7 +3230,7 @@ n(tikz_fname,"w"); ...@@ -3230,7 +3230,7 @@ n(tikz_fname,"w");
0, 0,
P_RNTI)==0)) { P_RNTI)==0)) {
dump_dci(&PHY_vars_UE->lte_frame_parms,&dci_alloc_rx[i]); dump_dci(&PHY_vars_UE->lte_frame_parms,&dci_alloc_rx[i]);
coded_bits_per_codeword = get_G(&PHY_vars_eNB->lte_frame_parms, coded_bits_per_codeword[0]= get_G(&PHY_vars_eNB->lte_frame_parms,
PHY_vars_UE->dlsch_ue[0][0]->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid]->nb_rb, PHY_vars_UE->dlsch_ue[0][0]->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid]->nb_rb,
PHY_vars_UE->dlsch_ue[0][0]->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid]->rb_alloc_even, PHY_vars_UE->dlsch_ue[0][0]->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid]->rb_alloc_even,
get_Qm(PHY_vars_UE->dlsch_ue[0][0]->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid]->mcs), get_Qm(PHY_vars_UE->dlsch_ue[0][0]->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid]->mcs),
...@@ -3242,7 +3242,7 @@ n(tikz_fname,"w"); ...@@ -3242,7 +3242,7 @@ n(tikz_fname,"w");
rate = (double)dlsch_tbs25[get_I_TBS(PHY_vars_UE->dlsch_ue[0][0]->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid]->mcs)][PHY_vars_UE->dlsch_ue[0][0]->nb_rb-1]/(coded_bits_per_codeword); rate = (double)dlsch_tbs25[get_I_TBS(PHY_vars_UE->dlsch_ue[0][0]->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid]->mcs)][PHY_vars_UE->dlsch_ue[0][0]->nb_rb-1]/(coded_bits_per_codeword);
rate*=get_Qm(PHY_vars_UE->dlsch_ue[0][0]->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid]->mcs); rate*=get_Qm(PHY_vars_UE->dlsch_ue[0][0]->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid]->mcs);
*/ */
printf("num_pdcch_symbols %d, G %d, TBS %d\n",PHY_vars_UE->lte_ue_pdcch_vars[0]->num_pdcch_symbols,coded_bits_per_codeword,PHY_vars_UE->dlsch_ue[0][0]->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid]->TBS); printf("num_pdcch_symbols %d, G %d, TBS %d\n",PHY_vars_UE->lte_ue_pdcch_vars[0]->num_pdcch_symbols,coded_bits_per_codeword [0],PHY_vars_UE->dlsch_ue[0][0]->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid]->TBS);
dlsch_active = 1; dlsch_active = 1;
} else { } else {
...@@ -3429,31 +3429,31 @@ n(tikz_fname,"w"); ...@@ -3429,31 +3429,31 @@ n(tikz_fname,"w");
for (cw_non_sic=0; cw_non_sic<cw_to_decode_interf; cw_non_sic++){ for (cw_non_sic=0; cw_non_sic<cw_to_decode_interf; cw_non_sic++){
PHY_vars_UE->dlsch_ue[0][cw_non_sic]->rnti = (common_flag==0) ? n_rnti: SI_RNTI; PHY_vars_UE->dlsch_ue[0][cw_non_sic]->rnti = (common_flag==0) ? n_rnti: SI_RNTI;
coded_bits_per_codeword = get_G(&PHY_vars_eNB->lte_frame_parms, coded_bits_per_codeword[cw_non_sic] = get_G(&PHY_vars_eNB->lte_frame_parms,
PHY_vars_eNB->dlsch_eNB[0][cw_non_sic]->harq_processes[0]->nb_rb, PHY_vars_eNB->dlsch_eNB[0][cw_non_sic]->harq_processes[0]->nb_rb,
PHY_vars_eNB->dlsch_eNB[0][cw_non_sic]->harq_processes[0]->rb_alloc, PHY_vars_eNB->dlsch_eNB[0][cw_non_sic]->harq_processes[0]->rb_alloc,
get_Qm(PHY_vars_eNB->dlsch_eNB[0][cw_non_sic]->harq_processes[0]->mcs), get_Qm(PHY_vars_eNB->dlsch_eNB[0][cw_non_sic]->harq_processes[0]->mcs),
PHY_vars_eNB->dlsch_eNB[0][cw_non_sic]->harq_processes[0]->Nl, PHY_vars_eNB->dlsch_eNB[0][cw_non_sic]->harq_processes[0]->Nl,
num_pdcch_symbols, num_pdcch_symbols,
0,subframe); 0,subframe);
PHY_vars_UE->dlsch_ue[0][cw_non_sic]->harq_processes[PHY_vars_UE->dlsch_ue[0][cw_non_sic]->current_harq_pid]->G = coded_bits_per_codeword; PHY_vars_UE->dlsch_ue[0][cw_non_sic]->harq_processes[PHY_vars_UE->dlsch_ue[0][cw_non_sic]->current_harq_pid]->G = coded_bits_per_codeword[cw_non_sic];
PHY_vars_UE->dlsch_ue[0][cw_non_sic]->harq_processes[PHY_vars_UE->dlsch_ue[0][cw_non_sic]->current_harq_pid]->Qm = get_Qm(PHY_vars_eNB->dlsch_eNB[0][cw_non_sic]->harq_processes[0]->mcs); PHY_vars_UE->dlsch_ue[0][cw_non_sic]->harq_processes[PHY_vars_UE->dlsch_ue[0][cw_non_sic]->current_harq_pid]->Qm = get_Qm(PHY_vars_eNB->dlsch_eNB[0][cw_non_sic]->harq_processes[0]->mcs);
if (n_frames==2) { if (n_frames==2) {
printf("Kmimo=%d, cw=%d, G=%d, TBS=%d\n",Kmimo,cw_non_sic,coded_bits_per_codeword, printf("Kmimo=%d, cw=%d, G=%d, TBS=%d\n",Kmimo,cw_non_sic,coded_bits_per_codeword[cw_non_sic],
PHY_vars_UE->dlsch_ue[0][cw_non_sic]->harq_processes[PHY_vars_UE->dlsch_ue[0][cw_non_sic]->current_harq_pid]->TBS); PHY_vars_UE->dlsch_ue[0][cw_non_sic]->harq_processes[PHY_vars_UE->dlsch_ue[0][cw_non_sic]->current_harq_pid]->TBS);
// calculate uncoded BER // calculate uncoded BER
uncoded_ber_bit = (short*) malloc(sizeof(short)*coded_bits_per_codeword); uncoded_ber_bit = (short*) malloc(sizeof(short)*coded_bits_per_codeword[cw_non_sic]);
AssertFatal(uncoded_ber_bit, "uncoded_ber_bit==NULL"); AssertFatal(uncoded_ber_bit, "uncoded_ber_bit==NULL");
sprintf(fname,"dlsch%d_rxF_r%d_cw%d_llr.m",eNB_id,round, cw_non_sic); sprintf(fname,"dlsch%d_rxF_r%d_cw%d_llr.m",eNB_id,round, cw_non_sic);
sprintf(vname,"dl%d_r%d_cw%d_llr",eNB_id,round, cw_non_sic); sprintf(vname,"dl%d_r%d_cw%d_llr",eNB_id,round, cw_non_sic);
write_output(fname,vname, PHY_vars_UE->lte_ue_pdsch_vars[0]->llr[cw_non_sic],coded_bits_per_codeword,1,0); write_output(fname,vname, PHY_vars_UE->lte_ue_pdsch_vars[0]->llr[cw_non_sic],coded_bits_per_codeword[cw_non_sic],1,0);
sprintf(fname,"dlsch_cw%d_e.m", cw_non_sic); sprintf(fname,"dlsch_cw%d_e.m", cw_non_sic);
sprintf(vname,"dlschcw%d_e", cw_non_sic); sprintf(vname,"dlschcw%d_e", cw_non_sic);
write_output(fname, vname,PHY_vars_eNB->dlsch_eNB[0][cw_non_sic]->harq_processes[0]->e,coded_bits_per_codeword,1,4); write_output(fname, vname,PHY_vars_eNB->dlsch_eNB[0][cw_non_sic]->harq_processes[0]->e,coded_bits_per_codeword[cw_non_sic],1,4);
uncoded_ber=0; uncoded_ber=0;
printf("trials=%d\n", trials); printf("trials=%d\n", trials);
for (i=0;i<coded_bits_per_codeword;i++) for (i=0;i<coded_bits_per_codeword[cw_non_sic];i++)
if (PHY_vars_eNB->dlsch_eNB[0][cw_non_sic]->harq_processes[0]->e[i] != (PHY_vars_UE->lte_ue_pdsch_vars[0]->llr[cw_non_sic][i]<0)) { if (PHY_vars_eNB->dlsch_eNB[0][cw_non_sic]->harq_processes[0]->e[i] != (PHY_vars_UE->lte_ue_pdsch_vars[0]->llr[cw_non_sic][i]<0)) {
uncoded_ber_bit[i] = 1; uncoded_ber_bit[i] = 1;
uncoded_ber++; uncoded_ber++;
...@@ -3461,11 +3461,11 @@ n(tikz_fname,"w"); ...@@ -3461,11 +3461,11 @@ n(tikz_fname,"w");
else else
uncoded_ber_bit[i] = 0; uncoded_ber_bit[i] = 0;
uncoded_ber/=coded_bits_per_codeword; uncoded_ber/=coded_bits_per_codeword[cw_non_sic];
avg_ber += uncoded_ber; avg_ber += uncoded_ber;
sprintf(fname,"cw%d_uncoded_ber_bit.m", cw_non_sic); sprintf(fname,"cw%d_uncoded_ber_bit.m", cw_non_sic);
sprintf(vname,"uncoded_ber_bit_cw%d", cw_non_sic); sprintf(vname,"uncoded_ber_bit_cw%d", cw_non_sic);
write_output(fname, vname,uncoded_ber_bit,coded_bits_per_codeword,1,0); write_output(fname, vname,uncoded_ber_bit,coded_bits_per_codeword[cw_non_sic],1,0);
printf("cw %d, uncoded ber %f\n",cw_non_sic,uncoded_ber); printf("cw %d, uncoded ber %f\n",cw_non_sic,uncoded_ber);
...@@ -3478,7 +3478,7 @@ n(tikz_fname,"w"); ...@@ -3478,7 +3478,7 @@ n(tikz_fname,"w");
dlsch_unscrambling(&PHY_vars_UE->lte_frame_parms, dlsch_unscrambling(&PHY_vars_UE->lte_frame_parms,
0, 0,
PHY_vars_UE->dlsch_ue[0][cw_non_sic], PHY_vars_UE->dlsch_ue[0][cw_non_sic],
coded_bits_per_codeword, coded_bits_per_codeword[cw_non_sic],
PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->llr[cw_non_sic], PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->llr[cw_non_sic],
cw_non_sic, cw_non_sic,
subframe<<1); subframe<<1);
...@@ -3656,7 +3656,7 @@ n(tikz_fname,"w"); ...@@ -3656,7 +3656,7 @@ n(tikz_fname,"w");
&PHY_vars_UE->dlsch_interleaving_stats); &PHY_vars_UE->dlsch_interleaving_stats);
coded_bits_per_codeword = get_G(&PHY_vars_UE->lte_frame_parms, coded_bits_per_codeword[cw_non_sic]= get_G(&PHY_vars_UE->lte_frame_parms,
PHY_vars_UE->dlsch_eNB[eNB_id]->harq_processes[PHY_vars_UE->dlsch_eNB[eNB_id]->current_harq_pid]->nb_rb, PHY_vars_UE->dlsch_eNB[eNB_id]->harq_processes[PHY_vars_UE->dlsch_eNB[eNB_id]->current_harq_pid]->nb_rb,
PHY_vars_UE->dlsch_eNB[eNB_id]->harq_processes[PHY_vars_UE->dlsch_eNB[eNB_id]->current_harq_pid]->rb_alloc, PHY_vars_UE->dlsch_eNB[eNB_id]->harq_processes[PHY_vars_UE->dlsch_eNB[eNB_id]->current_harq_pid]->rb_alloc,
get_Qm(PHY_vars_UE->dlsch_eNB[eNB_id]->harq_processes[PHY_vars_UE->dlsch_eNB[eNB_id]->current_harq_pid]->mcs), get_Qm(PHY_vars_UE->dlsch_eNB[eNB_id]->harq_processes[PHY_vars_UE->dlsch_eNB[eNB_id]->current_harq_pid]->mcs),
...@@ -3668,7 +3668,7 @@ n(tikz_fname,"w"); ...@@ -3668,7 +3668,7 @@ n(tikz_fname,"w");
dlsch_scrambling(&PHY_vars_UE->lte_frame_parms, dlsch_scrambling(&PHY_vars_UE->lte_frame_parms,
0, 0,
PHY_vars_UE->dlsch_eNB[eNB_id], PHY_vars_UE->dlsch_eNB[eNB_id],
coded_bits_per_codeword, coded_bits_per_codeword[cw_non_sic],
0, 0,
subframe<<1); subframe<<1);
...@@ -3678,7 +3678,7 @@ n(tikz_fname,"w"); ...@@ -3678,7 +3678,7 @@ n(tikz_fname,"w");
num_pdcch_symbols, num_pdcch_symbols,
&PHY_vars_UE->dlsch_eNB[0][0], &PHY_vars_UE->dlsch_eNB[0][0],
NULL, NULL,
coded_bits_per_codeword); coded_bits_per_codeword[cw_non_sic]);
// write_output("sic_buffer.m","sic", *sic_buffer,re_allocated,1,1); // write_output("sic_buffer.m","sic", *sic_buffer,re_allocated,1,1);
// write_output("rxdataF_comp1.m","rxF_comp1", *PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->rxdataF_comp1[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid][round],14*12*25,1,1); // write_output("rxdataF_comp1.m","rxF_comp1", *PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->rxdataF_comp1[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid][round],14*12*25,1,1);
...@@ -3737,7 +3737,7 @@ n(tikz_fname,"w"); ...@@ -3737,7 +3737,7 @@ n(tikz_fname,"w");
for (cw_sic=cw_to_decode_interf_free; cw_sic<cw_to_decode_interf_free+1;cw_sic++){ for (cw_sic=cw_to_decode_interf_free; cw_sic<cw_to_decode_interf_free+1;cw_sic++){
PHY_vars_UE->dlsch_ue[0][cw_sic]->rnti = (common_flag==0) ? n_rnti: SI_RNTI; PHY_vars_UE->dlsch_ue[0][cw_sic]->rnti = (common_flag==0) ? n_rnti: SI_RNTI;
coded_bits_per_codeword = get_G(&PHY_vars_eNB->lte_frame_parms, coded_bits_per_codeword[cw_sic]= get_G(&PHY_vars_eNB->lte_frame_parms,
PHY_vars_eNB->dlsch_eNB[0][cw_sic]->harq_processes[0]->nb_rb, PHY_vars_eNB->dlsch_eNB[0][cw_sic]->harq_processes[0]->nb_rb,
PHY_vars_eNB->dlsch_eNB[0][cw_sic]->harq_processes[0]->rb_alloc, PHY_vars_eNB->dlsch_eNB[0][cw_sic]->harq_processes[0]->rb_alloc,
get_Qm(PHY_vars_eNB->dlsch_eNB[0][cw_sic]->harq_processes[0]->mcs), get_Qm(PHY_vars_eNB->dlsch_eNB[0][cw_sic]->harq_processes[0]->mcs),
...@@ -3746,36 +3746,36 @@ n(tikz_fname,"w"); ...@@ -3746,36 +3746,36 @@ n(tikz_fname,"w");
0, 0,
subframe); subframe);
PHY_vars_UE->dlsch_ue[0][cw_sic]->harq_processes[PHY_vars_UE->dlsch_ue[0][cw_sic]->current_harq_pid]->G = coded_bits_per_codeword; PHY_vars_UE->dlsch_ue[0][cw_sic]->harq_processes[PHY_vars_UE->dlsch_ue[0][cw_sic]->current_harq_pid]->G = coded_bits_per_codeword[cw_sic];
PHY_vars_UE->dlsch_ue[0][cw_sic]->harq_processes[PHY_vars_UE->dlsch_ue[0][cw_sic]->current_harq_pid]->Qm = get_Qm(PHY_vars_eNB->dlsch_eNB[0][cw_sic]->harq_processes[0]->mcs); PHY_vars_UE->dlsch_ue[0][cw_sic]->harq_processes[PHY_vars_UE->dlsch_ue[0][cw_sic]->current_harq_pid]->Qm = get_Qm(PHY_vars_eNB->dlsch_eNB[0][cw_sic]->harq_processes[0]->mcs);
if (n_frames==2) { if (n_frames==2) {
printf("Kmimo=%d, cw=%d, G=%d, TBS=%d\n",Kmimo,cw_sic,coded_bits_per_codeword, printf("Kmimo=%d, cw=%d, G=%d, TBS=%d\n",Kmimo,cw_sic,coded_bits_per_codeword[cw_sic],
PHY_vars_UE->dlsch_ue[0][cw_sic]->harq_processes[PHY_vars_UE->dlsch_ue[0][cw_sic]->current_harq_pid]->TBS); PHY_vars_UE->dlsch_ue[0][cw_sic]->harq_processes[PHY_vars_UE->dlsch_ue[0][cw_sic]->current_harq_pid]->TBS);
// calculate uncoded BER // calculate uncoded BER
uncoded_ber_bit = (short*) malloc(sizeof(short)*coded_bits_per_codeword); uncoded_ber_bit = (short*) malloc(sizeof(short)*coded_bits_per_codeword[cw_sic]);
AssertFatal(uncoded_ber_bit, "uncoded_ber_bit==NULL"); AssertFatal(uncoded_ber_bit, "uncoded_ber_bit==NULL");
sprintf(fname,"dlsch%d_rxF_r%d_cw%d_llr.m",eNB_id,round, cw_sic); sprintf(fname,"dlsch%d_rxF_r%d_cw%d_llr.m",eNB_id,round, cw_sic);
sprintf(vname,"dl%d_r%d_cw%d_llr",eNB_id,round, cw_sic); sprintf(vname,"dl%d_r%d_cw%d_llr",eNB_id,round, cw_sic);
write_output(fname,vname, PHY_vars_UE->lte_ue_pdsch_vars[0]->llr[cw_sic],coded_bits_per_codeword,1,0); write_output(fname,vname, PHY_vars_UE->lte_ue_pdsch_vars[0]->llr[cw_sic],coded_bits_per_codeword[cw_sic],1,0);
sprintf(fname,"dlsch_cw%d_e.m", cw_sic); sprintf(fname,"dlsch_cw%d_e.m", cw_sic);
sprintf(vname,"dlschcw%d_e", cw_sic); sprintf(vname,"dlschcw%d_e", cw_sic);
write_output(fname, vname,PHY_vars_eNB->dlsch_eNB[0][cw_sic]->harq_processes[0]->e,coded_bits_per_codeword,1,4); write_output(fname, vname,PHY_vars_eNB->dlsch_eNB[0][cw_sic]->harq_processes[0]->e,coded_bits_per_codeword[cw_sic],1,4);
uncoded_ber=0; uncoded_ber=0;
printf("trials=%d\n", trials); printf("trials=%d\n", trials);
for (i=0;i<coded_bits_per_codeword;i++) for (i=0;i<coded_bits_per_codeword[cw_sic];i++)
if (PHY_vars_eNB->dlsch_eNB[0][cw_sic]->harq_processes[0]->e[i] != (PHY_vars_UE->lte_ue_pdsch_vars[0]->llr[cw_sic][i]<0)) { if (PHY_vars_eNB->dlsch_eNB[0][cw_sic]->harq_processes[0]->e[i] != (PHY_vars_UE->lte_ue_pdsch_vars[0]->llr[cw_sic][i]<0)) {
uncoded_ber_bit[i] = 1; uncoded_ber_bit[i] = 1;
uncoded_ber++; uncoded_ber++;
} else } else
uncoded_ber_bit[i] = 0; uncoded_ber_bit[i] = 0;
uncoded_ber/=coded_bits_per_codeword; uncoded_ber/=coded_bits_per_codeword[cw_sic];
avg_ber += uncoded_ber; avg_ber += uncoded_ber;
sprintf(fname,"cw%d_uncoded_ber_bit.m", cw_sic); sprintf(fname,"cw%d_uncoded_ber_bit.m", cw_sic);
sprintf(vname,"uncoded_ber_bit_cw%d", cw_sic); sprintf(vname,"uncoded_ber_bit_cw%d", cw_sic);
write_output(fname, vname,uncoded_ber_bit,coded_bits_per_codeword,1,0); write_output(fname, vname,uncoded_ber_bit,coded_bits_per_codeword[cw_sic],1,0);
printf("cw %d, uncoded ber %f\n",cw_sic,uncoded_ber); printf("cw %d, uncoded ber %f\n",cw_sic,uncoded_ber);
free(uncoded_ber_bit); free(uncoded_ber_bit);
uncoded_ber_bit = NULL; uncoded_ber_bit = NULL;
...@@ -3785,7 +3785,7 @@ n(tikz_fname,"w"); ...@@ -3785,7 +3785,7 @@ n(tikz_fname,"w");
dlsch_unscrambling(&PHY_vars_UE->lte_frame_parms, dlsch_unscrambling(&PHY_vars_UE->lte_frame_parms,
0, 0,
PHY_vars_UE->dlsch_ue[0][cw_sic], PHY_vars_UE->dlsch_ue[0][cw_sic],
coded_bits_per_codeword, coded_bits_per_codeword[cw_sic],
PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->llr[cw_sic], PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->llr[cw_sic],
cw_sic, cw_sic,
subframe<<1); subframe<<1);
...@@ -3970,7 +3970,7 @@ n(tikz_fname,"w"); ...@@ -3970,7 +3970,7 @@ n(tikz_fname,"w");
PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb,1,1); PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb,1,1);
} }
//pdsch_vars //pdsch_vars
dump_dlsch2(PHY_vars_UE,eNB_id,coded_bits_per_codeword,round,PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid); dump_dlsch2(PHY_vars_UE,eNB_id,coded_bits_per_codeword[0],round,PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid);
/* /*
write_output("dlsch_e.m","e",PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->e,coded_bits_per_codeword,1,4); write_output("dlsch_e.m","e",PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->e,coded_bits_per_codeword,1,4);
write_output("dlsch_ber_bit.m","ber_bit",uncoded_ber_bit,coded_bits_per_codeword,1,0); write_output("dlsch_ber_bit.m","ber_bit",uncoded_ber_bit,coded_bits_per_codeword,1,0);
...@@ -4150,7 +4150,9 @@ n(tikz_fname,"w"); ...@@ -4150,7 +4150,9 @@ n(tikz_fname,"w");
(double)tx_lev_dB+10*log10(PHY_vars_UE->lte_frame_parms.ofdm_symbol_size/(NB_RB*12)), (double)tx_lev_dB+10*log10(PHY_vars_UE->lte_frame_parms.ofdm_symbol_size/(NB_RB*12)),
sigma2_dB); sigma2_dB);
printf("Errors (%d(%d)/%d %d(%d)/%d %d(%d)/%d %d(%d)/%d), Pe = (%e(%e),%e(%e),%e(%e),%e(%e)), dci_errors %d/%d, Pe = %e => effective rate %f (%2.1f%%,%f, %f), normalized delay %f (%f)\n", printf("Errors (%d(%d)/%d %d(%d)/%d %d(%d)/%d %d(%d)/%d), Pe = (%e(%e),%e(%e),%e(%e),%e(%e)),"
"dci_errors %d/%d, Pe = %e => effective rate %f (%2.1f%%,%f, %f), normalized delay %f (%f), "
"throughput stream 0 = %f , throughput stream 1 = %f, system throughput = %f , rate 0 = %f , rate 1 = %f \n",
errs[0][0], errs[0][0],
errs[1][0], errs[1][0],
round_trials[0], round_trials[0],
...@@ -4174,12 +4176,21 @@ n(tikz_fname,"w"); ...@@ -4174,12 +4176,21 @@ n(tikz_fname,"w");
dci_errors, dci_errors,
round_trials[0], round_trials[0],
(double)dci_errors/(round_trials[0]), (double)dci_errors/(round_trials[0]),
rate*effective_rate, rate[0]*effective_rate,
100*effective_rate, 100*effective_rate,
rate, rate[0],
rate*get_Qm(PHY_vars_UE->dlsch_ue[0][0]->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid]->mcs), rate[0]*get_Qm(PHY_vars_UE->dlsch_ue[0][0]->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid]->mcs),
(1.0*(round_trials[0]-errs[0][0])+2.0*(round_trials[1]-errs[0][1])+3.0*(round_trials[2]-errs[0][2])+4.0*(round_trials[3]-errs[0][3]))/((double)round_trials[0])/(double)PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->TBS, (1.0*(round_trials[0]-errs[0][0])+2.0*(round_trials[1]-errs[0][1])+3.0*(round_trials[2]-errs[0][2])+
(1.0*(round_trials[0]-errs[0][0])+2.0*(round_trials[1]-errs[0][1])+3.0*(round_trials[2]-errs[0][2])+4.0*(round_trials[3]-errs[0][3]))/((double)round_trials[0])); 4.0*(round_trials[3]-errs[0][3]))/((double)round_trials[0])/(double)PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->TBS,
(1.0*(round_trials[0]-errs[0][0])+2.0*(round_trials[1]-errs[0][1])+3.0*(round_trials[2]-errs[0][2])
+4.0*(round_trials[3]-errs[0][3]))/((double)round_trials[0]),
rate[0]*get_Qm(PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->mcs)*(1-((double)errs[0][0]/(double)round_trials[0])),
rate[1]*get_Qm(PHY_vars_eNB->dlsch_eNB[0][1]->harq_processes[0]->mcs)*(1-((double)errs[1][0]/(double)round_trials[0])),
rate[0]*get_Qm(PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->mcs)*(1-((double)errs[0][0]/(double)round_trials[0]))+
rate[1]*get_Qm(PHY_vars_eNB->dlsch_eNB[0][1]->harq_processes[0]->mcs)*(1-((double)errs[1][0]/(double)round_trials[0])),
rate[0],
rate[1]);
if (print_perf==1) { if (print_perf==1) {
...@@ -4290,7 +4301,7 @@ n(tikz_fname,"w"); ...@@ -4290,7 +4301,7 @@ n(tikz_fname,"w");
SNR, SNR,
mcs1, mcs1,
PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->TBS, PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->TBS,
rate, rate[0],
errs[0][0], errs[0][0],
round_trials[0], round_trials[0],
errs[0][1], errs[0][1],
...@@ -4302,12 +4313,14 @@ n(tikz_fname,"w"); ...@@ -4302,12 +4313,14 @@ n(tikz_fname,"w");
dci_errors); dci_errors);
} }
else { else {
fprintf(bler_fd,"%f;%d;%d;%d;%d;%f;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d\n", fprintf(bler_fd,"%f;%d;%d;%d;%d;%f;%f;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%f;%f;%f;%d\n",
SNR, SNR,
mcs1,mcs2, mcs1,
mcs2,
PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->TBS, PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->TBS,
PHY_vars_eNB->dlsch_eNB[0][1]->harq_processes[0]->TBS, PHY_vars_eNB->dlsch_eNB[0][1]->harq_processes[0]->TBS,
rate, rate[0],
rate[1],
errs[0][0], errs[0][0],
errs[1][0], errs[1][0],
round_trials[0], round_trials[0],
...@@ -4320,6 +4333,10 @@ n(tikz_fname,"w"); ...@@ -4320,6 +4333,10 @@ n(tikz_fname,"w");
errs[0][3], errs[0][3],
errs[1][3], errs[1][3],
round_trials[3], round_trials[3],
rate[0]*get_Qm(PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->mcs)*(1-((double)errs[0][0]/(double)round_trials[0])),
rate[1]*get_Qm(PHY_vars_eNB->dlsch_eNB[0][1]->harq_processes[0]->mcs)*(1-((double)errs[1][0]/(double)round_trials[0])),
rate[0]*get_Qm(PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->mcs)*(1-((double)errs[0][0]/(double)round_trials[0]))+
rate[1]*get_Qm(PHY_vars_eNB->dlsch_eNB[0][1]->harq_processes[0]->mcs)*(1-((double)errs[1][0]/(double)round_trials[0])),
dci_errors); dci_errors);
} }
...@@ -4382,7 +4399,7 @@ n(tikz_fname,"w"); ...@@ -4382,7 +4399,7 @@ n(tikz_fname,"w");
SNR, SNR,
mcs1, mcs1,
PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->TBS, PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->TBS,
rate*effective_rate, rate[0]*effective_rate,
100*effective_rate, 100*effective_rate,
rate, rate,
(double)avg_iter[0]/iter_trials[0], (double)avg_iter[0]/iter_trials[0],
...@@ -4427,7 +4444,7 @@ n(tikz_fname,"w"); ...@@ -4427,7 +4444,7 @@ n(tikz_fname,"w");
mcs1,mcs2, mcs1,mcs2,
PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->TBS, PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->TBS,
PHY_vars_eNB->dlsch_eNB[0][1]->harq_processes[0]->TBS, PHY_vars_eNB->dlsch_eNB[0][1]->harq_processes[0]->TBS,
rate*effective_rate, rate[0]*effective_rate,
100*effective_rate, 100*effective_rate,
rate, rate,
(double)avg_iter[0]/iter_trials[0], (double)avg_iter[0]/iter_trials[0],
...@@ -4516,10 +4533,10 @@ n(tikz_fname,"w"); ...@@ -4516,10 +4533,10 @@ n(tikz_fname,"w");
PHY_vars_UE->dlsch_unscrambling_stats.trials, PHY_vars_UE->dlsch_unscrambling_stats.trials,
PHY_vars_UE->dlsch_decoding_stats.trials); PHY_vars_UE->dlsch_decoding_stats.trials);
*/ */
printf("[passed] effective rate : %f (%2.1f%%,%f)): log and break \n",rate*effective_rate, 100*effective_rate, rate ); printf("[passed] effective rate : %f (%2.1f%%,%f)): log and break \n",rate[0]*effective_rate, 100*effective_rate, rate );
break; break;
} else if (test_perf !=0 ){ } else if (test_perf !=0 ){
printf("[continue] effective rate : %f (%2.1f%%,%f)): increase snr \n",rate*effective_rate, 100*effective_rate, rate); printf("[continue] effective rate : %f (%2.1f%%,%f)): increase snr \n",rate[0]*effective_rate, 100*effective_rate, rate);
} }
if (abstx == 1) { if (abstx == 1) {
if ((rx_type==rx_IC_dual_stream) || (rx_type==rx_standard)) { if ((rx_type==rx_IC_dual_stream) || (rx_type==rx_standard)) {
......
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