Calling ue_dl in pdsch_ue only when pbch is decoded

master
ismagom 10 years ago
parent fded8e40d1
commit 21636025af

@ -215,6 +215,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 &&
(sf_cnt < prog_args.nof_subframes || prog_args.nof_subframes == -1)) (sf_cnt < prog_args.nof_subframes || prog_args.nof_subframes == -1))
@ -240,8 +242,10 @@ 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;
} }
} }
if (pbch_decoded) {
/* We are looking for SI Blocks, search only in appropiate places */ /* We are looking for SI Blocks, search only in appropiate places */
if ((ue_sync_get_sfidx(&ue_sync) == 5 && (sfn%2)==0)) { if ((ue_sync_get_sfidx(&ue_sync) == 5 && (sfn%2)==0)) {
n = ue_dl_decode(&ue_dl, sf_buffer, data, ue_sync_get_sfidx(&ue_sync), sfn, prog_args.rnti); n = ue_dl_decode(&ue_dl, sf_buffer, data, ue_sync_get_sfidx(&ue_sync), sfn, prog_args.rnti);
@ -250,14 +254,17 @@ int main(int argc, char **argv) {
} }
nof_trials++; nof_trials++;
} }
snr = VEC_CMA(chest_dl_get_snr(&ue_dl.chest),snr,sf_cnt); snr = VEC_EMA(chest_dl_get_snr(&ue_dl.chest), snr, 0.01);
}
} }
if (ue_sync_get_sfidx(&ue_sync) == 9) { if (ue_sync_get_sfidx(&ue_sync) == 9) {
if (pbch_decoded) {
sfn++; sfn++;
if (sfn == 1024) { if (sfn == 1024) {
sfn = 0; sfn = 0;
} }
} }
}
#ifndef DISABLE_GRAPHICS #ifndef DISABLE_GRAPHICS
if (!prog_args.disable_plots && ue_sync_get_sfidx(&ue_sync) == 5) { if (!prog_args.disable_plots && ue_sync_get_sfidx(&ue_sync) == 5) {
do_plots(&ue_dl, 5); do_plots(&ue_dl, 5);
@ -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