From 142249d84b8e6e0db3288f506214a35e09f05db2 Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Wed, 2 Sep 2020 22:11:04 +0200 Subject: [PATCH] added ulsch statistics --- openair1/PHY/NR_TRANSPORT/nr_dlsch.c | 4 +-- openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c | 2 +- openair1/PHY/NR_TRANSPORT/nr_ulsch.c | 30 +++++++++++++++++++ openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c | 25 ++++++++++------ openair1/PHY/defs_gNB.h | 3 +- openair1/SCHED_NR/phy_procedures_nr_gNB.c | 2 ++ openair1/SIMULATION/NR_PHY/ulsim.c | 7 +++-- 7 files changed, 58 insertions(+), 15 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index 81b6c8fc87..5a11fc1266 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -340,7 +340,7 @@ void dump_pdsch_stats(PHY_VARS_gNB *gNB) { for (int i=0;idlsch[i][0]->harq_mask > 0) - LOG_I(PHY,"DLSCH RNTI %x: round_trials %d(%1.1e)/%d(%1.1e)/%d(%1.1e)/%d/%d/%d/%d/%d, current_Qm %d, current_RI %d, total_bytes %d\n", + LOG_I(PHY,"DLSCH RNTI %x: round_trials %d(%1.1e)/%d(%1.1e)/%d(%1.1e)/%d/%d/%d/%d/%d, current_Qm %d, current_RI %d, total_bytes TX %d\n", gNB->dlsch[i][0]->rnti, gNB->dlsch[i][0]->stats.round_trials[0], (double)gNB->dlsch[i][0]->stats.round_trials[1]/gNB->dlsch[i][0]->stats.round_trials[0], @@ -355,7 +355,7 @@ void dump_pdsch_stats(PHY_VARS_gNB *gNB) { gNB->dlsch[i][0]->stats.round_trials[7], gNB->dlsch[i][0]->stats.current_Qm, gNB->dlsch[i][0]->stats.current_RI, - gNB->dlsch[i][0]->stats.total_bytes); + gNB->dlsch[i][0]->stats.total_bytes_tx); } diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c index 3c8961781c..1c4c4e374b 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c @@ -355,7 +355,7 @@ int nr_dlsch_encoding(unsigned char *a, A = rel15->TBSize[0]<<3; if (dlsch->harq_processes[harq_pid]->round == 0){ - dlsch->stats.total_bytes += rel15->TBSize[0]; + dlsch->stats.total_bytes_tx += rel15->TBSize[0]; dlsch->stats.current_RI = rel15->nrOfLayers; dlsch->stats.current_Qm = rel15->qamModOrder[0]; } diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch.c index 9928f3f604..51a1e9e074 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch.c @@ -137,3 +137,33 @@ void nr_ulsch_unscrambling_optim(int16_t* llr, n_RNTI); #endif } + +void dump_pusch_stats(PHY_VARS_gNB *gNB) { + + for (int i=0;iulsch[i][0]->rnti>0) + LOG_I(PHY,"ULSCH RNTI %x: round_trials %d(%1.1e)/%d(%1.1e)/%d(%1.1e)/%d/%d/%d/%d/%d, current_Qm %d, current_RI %d, total_bytes RX/TX %d/%d\n", + gNB->ulsch[i][0]->rnti, + gNB->ulsch[i][0]->stats.round_trials[0], + (double)gNB->ulsch[i][0]->stats.round_trials[1]/gNB->ulsch[i][0]->stats.round_trials[0], + gNB->ulsch[i][0]->stats.round_trials[1], + (double)gNB->ulsch[i][0]->stats.round_trials[2]/gNB->ulsch[i][0]->stats.round_trials[1], + gNB->ulsch[i][0]->stats.round_trials[2], + (double)gNB->ulsch[i][0]->stats.round_trials[3]/gNB->ulsch[i][0]->stats.round_trials[2], + gNB->ulsch[i][0]->stats.round_trials[3], + gNB->ulsch[i][0]->stats.round_trials[4], + gNB->ulsch[i][0]->stats.round_trials[5], + gNB->ulsch[i][0]->stats.round_trials[6], + gNB->ulsch[i][0]->stats.round_trials[7], + gNB->ulsch[i][0]->stats.current_Qm, + gNB->ulsch[i][0]->stats.current_RI, + gNB->ulsch[i][0]->stats.total_bytes_rx, + gNB->ulsch[i][0]->stats.total_bytes_tx); + +} + +void clear_pusch_stats(PHY_VARS_gNB *gNB) { + + for (int i=0;iulsch[i][0]->stats,0,sizeof(gNB->ulsch[i][0]->stats)); +} diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c index d2fda49873..802aab3c93 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c @@ -363,15 +363,14 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, LOG_D(PHY,"ULSCH Decoding, harq_pid %d TBS %d G %d mcs %d Nl %d nb_rb %d, Qm %d, n_layers %d\n",harq_pid,A,G, mcs, n_layers, nb_rb, Qm, n_layers); - - if (R<1024) - Coderate = (float) R /(float) 1024; - else - Coderate = (float) R /(float) 2048; - - if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25){ - p_decParams->BG = 2; - if (Coderate < 0.3333) { + if (R<1024) + Coderate = (float) R /(float) 1024; + else + Coderate = (float) R /(float) 2048; + + if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25){ + p_decParams->BG = 2; + if (Coderate < 0.3333) { p_decParams->R = 15; kc = 52; } @@ -398,8 +397,15 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, kc = 27; } } + + ulsch->stats.round_trials[harq_process->round]++; if (harq_process->round == 0) { + + ulsch->stats.current_Qm = Qm; + ulsch->stats.current_RI = n_layers; + ulsch->stats.total_bytes_tx += harq_process->TBS; + // This is a new packet, so compute quantities regarding segmentation if (A > 3824) harq_process->B = A+24; @@ -597,6 +603,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, LOG_I(PHY, "Segment %d CRC OK\n",r); #endif ret = no_iteration_ldpc; + ulsch->stats.total_bytes_rx += harq_process->TBS; } else { #ifdef PRINT_CRC_CHECK //if (prnt_crc_cnt%10 == 0) diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index cb6b3ad118..0a24b364d4 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -126,7 +126,8 @@ typedef struct { typedef struct { int round_trials[8]; - int total_bytes; + int total_bytes_tx; + int total_bytes_rx; int current_Qm; int current_RI; } NR_gNB_SCH_STATS_t; diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 028edd01a2..02d2a6b718 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -574,5 +574,7 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) } } } + if ((frame_rx&127) == 0) dump_pusch_stats(gNB); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_UESPEC_RX,0); } diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 66053ff4d6..17f76e2bf2 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -55,7 +55,6 @@ //#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c" #include "openair2/LAYER2/NR_MAC_UE/mac_proto.h" #include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h" -#include "openair1/NR_REFSIG/pss_nr.h" #define inMicroS(a) (((double)(a))/(cpu_freq_GHz*1000.0)) #include "SIMULATION/LTE_PHY/common_sim.h" @@ -119,7 +118,7 @@ int main(int argc, char **argv) double sigma, sigma_dB; double snr_step = .2; uint8_t snr1set = 0; - int slot = 8, frame = 0; + int slot = 8, frame = 1; FILE *output_fd = NULL; double *s_re[2]= {s_re0,s_re1}; double *s_im[2]= {s_im0,s_im1}; @@ -702,6 +701,7 @@ int main(int argc, char **argv) int round_trials[4]={0,0,0,0}; uint32_t errors_scrambling[4] = {0,0,0,0}; + clear_pusch_stats(gNB); for (trial = 0; trial < n_trials; trial++) { uint8_t round = 0; @@ -1040,6 +1040,9 @@ int main(int argc, char **argv) (double)errors_scrambling[2]/available_bits/round_trials[0], (double)errors_scrambling[3]/available_bits/round_trials[0], roundStats[snrRun],effRate,effRate/TBS*100,TBS); + + dump_pusch_stats(gNB); + printf("*****************************************\n"); printf("\n");