Commit 142249d8 authored by Raymond Knopp's avatar Raymond Knopp

added ulsch statistics

parent 73c7bee0
......@@ -340,7 +340,7 @@ void dump_pdsch_stats(PHY_VARS_gNB *gNB) {
for (int i=0;i<NUMBER_OF_NR_DLSCH_MAX;i++)
if (gNB->dlsch[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);
}
......
......@@ -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];
}
......
......@@ -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;i<NUMBER_OF_NR_ULSCH_MAX;i++)
if (gNB->ulsch[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;i<NUMBER_OF_NR_ULSCH_MAX;i++)
memset((void*)&gNB->ulsch[i][0]->stats,0,sizeof(gNB->ulsch[i][0]->stats));
}
......@@ -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)
......
......@@ -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;
......
......@@ -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);
}
......@@ -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");
......
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