nr_dlsim: several fixes for low SNR scenarios
If the DCI in PDCCH is not correctly received, no PDSCH would be decoded but counted as no error. Also if the DCI was not correctly received, a TBS of 0 would be used in some computations and memory allocations. Fix these not counting if there is no PDSCH decoding, and by using the known TBS instead of the one received from the DCI.
This commit is contained in:
@@ -311,9 +311,9 @@ int main(int argc, char **argv)
|
||||
int i,aa;//,l;
|
||||
double sigma2, sigma2_dB=10, SNR, snr0=-2.0, snr1=2.0;
|
||||
uint8_t snr1set=0;
|
||||
float effRate;
|
||||
double effRate;
|
||||
//float psnr;
|
||||
float eff_tp_check = 0.7;
|
||||
double eff_tp_check = 0.7;
|
||||
uint32_t TBS = 0;
|
||||
c16_t **txdata;
|
||||
double **s_re,**s_im,**r_re,**r_im;
|
||||
@@ -547,7 +547,7 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
|
||||
case 't':
|
||||
eff_tp_check = (float)atoi(optarg)/100;
|
||||
eff_tp_check = atof(optarg) / 100.0;
|
||||
break;
|
||||
|
||||
case 'w':
|
||||
@@ -1081,8 +1081,6 @@ printf("%d\n", slot);
|
||||
Sched_INFO->sched_response_id = -1;
|
||||
|
||||
while (round < num_rounds && !UE_harq_process->decodeResult && !stop) {
|
||||
round_trials[round]++;
|
||||
|
||||
clear_nr_nfapi_information(RC.nrmac[0], 0, frame, slot, &Sched_INFO->DL_req, &Sched_INFO->TX_req, &Sched_INFO->UL_dci_req);
|
||||
UE_info->UE_sched_ctrl.harq_processes[harq_pid].ndi = !(trial&1);
|
||||
UE_info->UE_sched_ctrl.harq_processes[harq_pid].round = round;
|
||||
@@ -1235,6 +1233,9 @@ printf("%d\n", slot);
|
||||
if (dlsch0->last_iteration_cnt >= dlsch0->max_ldpc_iterations)
|
||||
n_errors[round]++;
|
||||
|
||||
if (dlsch0->active)
|
||||
round_trials[round]++;
|
||||
|
||||
int16_t *UE_llr = (int16_t*)UE->phy_sim_pdsch_llr;
|
||||
|
||||
TBS = dlsch0->dlsch_config.TBS;//rel15->TBSize[0];
|
||||
@@ -1266,8 +1267,8 @@ printf("%d\n", slot);
|
||||
} // round
|
||||
|
||||
if (test_input_bit == NULL) {
|
||||
test_input_bit = (unsigned char *)malloc16(sizeof(unsigned char) * TBS);
|
||||
estimated_output_bit = (unsigned char *)malloc16(sizeof(unsigned char) * TBS);
|
||||
test_input_bit = (unsigned char *)malloc16(8 * rel15->TBSize[0]);
|
||||
estimated_output_bit = (unsigned char *)malloc16(8 * rel15->TBSize[0]);
|
||||
}
|
||||
for (i = 0; i < TBS; i++) {
|
||||
|
||||
@@ -1288,12 +1289,12 @@ printf("%d\n", slot);
|
||||
if (n_trials == 1)
|
||||
printf("errors_bit = %u (trial %d)\n", errors_bit, trial);
|
||||
}
|
||||
roundStats += ((float)round);
|
||||
roundStats += round;
|
||||
if (UE_harq_process->decodeResult)
|
||||
effRate += ((float)TBS) / round;
|
||||
effRate += ((double)TBS) / round;
|
||||
} // noise trials
|
||||
|
||||
roundStats /= ((float)n_trials);
|
||||
roundStats /= n_trials;
|
||||
|
||||
for (int r = 0; r < num_rounds; r++) {
|
||||
blerStats[r] = (double)n_errors[r] / round_trials[r];
|
||||
@@ -1316,7 +1317,7 @@ printf("%d\n", slot);
|
||||
printf("), Channel BER (%e", berStats[0]);
|
||||
for (int r = 1; r < num_rounds; r++)
|
||||
printf(",%e", berStats[r]);
|
||||
printf(") Avg round %.2f, Eff Rate %.4f bits/slot, Eff Throughput %.2f, TBS %u bits/slot\n", roundStats, effRate, effRate / TBS * 100, TBS);
|
||||
printf(") Avg round %.2f, Eff Rate %.4f bits/slot, Eff Throughput %.2f, TBS %u bits/slot\n", roundStats, effRate, effRate / (8 * rel15->TBSize[0]) * 100, 8 * rel15->TBSize[0]);
|
||||
printf("*****************************************\n");
|
||||
printf("\n");
|
||||
// writing to csv file
|
||||
@@ -1324,7 +1325,7 @@ printf("%d\n", slot);
|
||||
fprintf(csv_file,"%f,%d/%d,",SNR,n_false_positive,n_trials);
|
||||
for (int r = 0; r < num_rounds; r++)
|
||||
fprintf(csv_file,"%d/%d,%u/%u,%f,%e,",n_errors[r], round_trials[r], errors_scrambling[r], available_bits * round_trials[r],blerStats[r],berStats[r]);
|
||||
fprintf(csv_file,"%.2f,%.4f,%.2f,%u\n", roundStats, effRate, effRate / TBS * 100, TBS);
|
||||
fprintf(csv_file,"%.2f,%.4f,%.2f,%u\n", roundStats, effRate, effRate / (8 * rel15->TBSize[0]) * 100, 8 * rel15->TBSize[0]);
|
||||
}
|
||||
if (print_perf==1) {
|
||||
printf("\ngNB TX function statistics (per %d us slot, NPRB %d, mcs %d, C %d, block %d)\n",
|
||||
@@ -1332,7 +1333,7 @@ printf("%d\n", slot);
|
||||
g_rbSize,
|
||||
g_mcsIndex,
|
||||
UE->dl_harq_processes[0][slot].C,
|
||||
msgDataTx->dlsch[0][0].harq_process.pdsch_pdu.pdsch_pdu_rel15.TBSize[0] << 3);
|
||||
8 * rel15->TBSize[0]);
|
||||
printDistribution(&gNB->phy_proc_tx,table_tx,"PHY proc tx");
|
||||
printStatIndent2(&gNB->dci_generation_stats, "DCI encoding time");
|
||||
printStatIndent2(&gNB->dlsch_encoding_stats,"DLSCH encoding time");
|
||||
@@ -1406,7 +1407,7 @@ printf("%d\n", slot);
|
||||
break;
|
||||
}
|
||||
|
||||
if (effRate > (eff_tp_check*TBS)) {
|
||||
if (effRate >= (eff_tp_check * 8 * rel15->TBSize[0])) {
|
||||
printf("PDSCH test OK\n");
|
||||
ret = 0;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user