Calling ue_dl in pdsch_ue only when pbch is decoded

master
ismagom 10 years ago
parent fded8e40d1
commit 21636025af

@ -214,6 +214,8 @@ int main(int argc, char **argv) {
// Register Ctrl+C handler // Register Ctrl+C handler
signal(SIGINT, sig_int_handler); signal(SIGINT, sig_int_handler);
bool pbch_decoded = false;
/* Main loop */ /* Main loop */
while (go_exit == false && while (go_exit == false &&
@ -240,22 +242,27 @@ int main(int argc, char **argv) {
bit_unpack_vector(bch_payload_unpacked, bch_payload, BCH_PAYLOAD_LEN); bit_unpack_vector(bch_payload_unpacked, bch_payload, BCH_PAYLOAD_LEN);
bcch_bch_unpack(bch_payload, BCH_PAYLOAD_LEN, &cell, &sfn); bcch_bch_unpack(bch_payload, BCH_PAYLOAD_LEN, &cell, &sfn);
sfn = (sfn + sfn_offset)%1024; sfn = (sfn + sfn_offset)%1024;
pbch_decoded = true;
} }
} }
/* We are looking for SI Blocks, search only in appropiate places */ if (pbch_decoded) {
if ((ue_sync_get_sfidx(&ue_sync) == 5 && (sfn%2)==0)) { /* We are looking for SI Blocks, search only in appropiate places */
n = ue_dl_decode(&ue_dl, sf_buffer, data, ue_sync_get_sfidx(&ue_sync), sfn, prog_args.rnti); if ((ue_sync_get_sfidx(&ue_sync) == 5 && (sfn%2)==0)) {
if (n < 0) { n = ue_dl_decode(&ue_dl, sf_buffer, data, ue_sync_get_sfidx(&ue_sync), sfn, prog_args.rnti);
fprintf(stderr, "Error decoding UE DL\n");fflush(stdout); if (n < 0) {
} fprintf(stderr, "Error decoding UE DL\n");fflush(stdout);
nof_trials++; }
nof_trials++;
}
snr = VEC_EMA(chest_dl_get_snr(&ue_dl.chest), snr, 0.01);
} }
snr = VEC_CMA(chest_dl_get_snr(&ue_dl.chest),snr,sf_cnt);
} }
if (ue_sync_get_sfidx(&ue_sync) == 9) { if (ue_sync_get_sfidx(&ue_sync) == 9) {
sfn++; if (pbch_decoded) {
if (sfn == 1024) { sfn++;
sfn = 0; if (sfn == 1024) {
sfn = 0;
}
} }
} }
#ifndef DISABLE_GRAPHICS #ifndef DISABLE_GRAPHICS
@ -271,6 +278,7 @@ int main(int argc, char **argv) {
10*log10f(snr), pdsch_average_noi(&ue_dl.pdsch), 10*log10f(snr), pdsch_average_noi(&ue_dl.pdsch),
100*(1-(float) ue_dl.nof_pdcch_detected/nof_trials), 100*(1-(float) ue_dl.nof_pdcch_detected/nof_trials),
(float) 100*ue_dl.pkt_errors/ue_dl.pkts_total,nof_trials, ue_dl.pkts_total); (float) 100*ue_dl.pkt_errors/ue_dl.pkts_total,nof_trials, ue_dl.pkts_total);
} }
sf_cnt++; sf_cnt++;
} // Main loop } // Main loop

Loading…
Cancel
Save