Commit deb443dc authored by Robert Schmidt's avatar Robert Schmidt

Merge remote-tracking branch 'origin/interns_summer23' into integration_2023_w38

parents d16c4c37 32e4d66c
...@@ -85,7 +85,6 @@ PHY_VARS_gNB *gNB; ...@@ -85,7 +85,6 @@ PHY_VARS_gNB *gNB;
PHY_VARS_NR_UE *UE; PHY_VARS_NR_UE *UE;
RAN_CONTEXT_t RC; RAN_CONTEXT_t RC;
int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
double cpuf; double cpuf;
char *uecap_file; char *uecap_file;
...@@ -275,6 +274,8 @@ int NB_UE_INST = 1; ...@@ -275,6 +274,8 @@ int NB_UE_INST = 1;
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
FILE *csv_file = NULL;
char *filename_csv = NULL;
setbuf(stdout, NULL); setbuf(stdout, NULL);
int c; int c;
int i,aa;//,l; int i,aa;//,l;
...@@ -363,7 +364,7 @@ int main(int argc, char **argv) ...@@ -363,7 +364,7 @@ int main(int argc, char **argv)
FILE *scg_fd=NULL; FILE *scg_fd=NULL;
while ((c = getopt(argc, argv, "f:hA:p:f:g:i:n:s:S:t:v:x:y:z:o:M:N:F:GR:d:PI:L:a:b:e:m:w:T:U:q:X:Y")) != -1) { while ((c = getopt(argc, argv, "f:hA:p:f:g:i:n:s:S:t:v:x:y:z:o:M:N:F:GR:d:PI:L:a:b:e:m:w:T:U:q:X:Y:Z:")) != -1) {
switch (c) { switch (c) {
case 'f': case 'f':
scg_fd = fopen(optarg,"r"); scg_fd = fopen(optarg,"r");
...@@ -374,10 +375,6 @@ int main(int argc, char **argv) ...@@ -374,10 +375,6 @@ int main(int argc, char **argv)
} }
break; break;
/*case 'd':
frame_type = 1;
break;*/
case 'g': case 'g':
switch ((char)*optarg) { switch ((char)*optarg) {
case 'A': case 'A':
...@@ -545,6 +542,10 @@ int main(int argc, char **argv) ...@@ -545,6 +542,10 @@ int main(int argc, char **argv)
//target_error_rate=0.1; //target_error_rate=0.1;
slot = 0; slot = 0;
break; break;
case 'Z' :
filename_csv = strdup(optarg);
AssertFatal(filename_csv != NULL, "strdup() error: errno %d\n", errno);
break;
case 'o': case 'o':
delay = atoi(optarg); delay = atoi(optarg);
...@@ -552,47 +553,38 @@ int main(int argc, char **argv) ...@@ -552,47 +553,38 @@ int main(int argc, char **argv)
default: default:
case 'h': case 'h':
printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -i Intefrence0 -j Interference1 -A interpolation_file -C(alibration offset dB) -N CellId\n", printf("%s -h(elp)\n", argv[0]);
argv[0]); printf("-a Start PRB for PDSCH\n");
printf("-b Number of PRB for PDSCH\n");
printf("-d number of dlsch threads, 0: no dlsch parallelization\n");
printf("-e MSC index\n");
printf("-f raw file containing RRC configuration (generated by gNB)\n");
printf("-g Channel model: [A] TDLA30, [B] TDLB100, [C] TDLC300, e.g. -g A\n");
printf("-h This message\n"); printf("-h This message\n");
printf("-L <log level, 0(errors), 1(warning), 2(analysis), 3(info), 4(debug), 5(trace)>\n"); printf("-i Change channel estimation technique. Arguments list: Frequency domain {0:Linear interpolation, 1:PRB based averaging}, Time domain {0:Estimates of last DMRS symbol, 1:Average of DMRS symbols}\n");
//printf("-p Use extended prefix mode\n"); printf("-m Numerology\n");
//printf("-d Use TDD\n");
printf("-n Number of frames to simulate\n"); printf("-n Number of frames to simulate\n");
printf("-o Introduce delay in terms of number of samples\n");
printf("-p Precoding matrix index\n");
printf("-q MCS Table index\n");
printf("-s Starting SNR, runs from SNR0 to SNR0 + 5 dB. If n_frames is 1 then just SNR is simulated\n"); printf("-s Starting SNR, runs from SNR0 to SNR0 + 5 dB. If n_frames is 1 then just SNR is simulated\n");
printf("-S Ending SNR, runs from SNR0 to SNR1\n"); printf("-S Ending SNR, runs from SNR0 to SNR1\n");
//printf("-t Delay spread for multipath channel\n"); printf("-t Acceptable effective throughput (in percentage)\n");
printf("-g Channel model: [A] TDLA30, [B] TDLB100, [C] TDLC300, e.g. -g A\n"); printf("-v Maximum number of rounds\n");
printf("-o Introduce delay in terms of number of samples\n"); printf("-w Write txdata to binary file (one frame)\n");
printf("-x Num of layer for PDSCH\n");
printf("-y Number of TX antennas used in gNB\n"); printf("-y Number of TX antennas used in gNB\n");
printf("-z Number of RX antennas used in UE\n"); printf("-z Number of RX antennas used in UE\n");
printf("-x Num of layer for PDSCH\n");
printf("-p Precoding matrix index\n");
printf("-i Change channel estimation technique. Arguments list: Frequency domain {0:Linear interpolation, 1:PRB based averaging}, Time domain {0:Estimates of last DMRS symbol, 1:Average of DMRS symbols}\n");
//printf("-j Relative strength of second intefering gNB (in dB) - cell_id mod 3 = 2\n");
printf("-R N_RB_DL\n");
printf("-O oversampling factor (1,2,4,8,16)\n");
printf("-A Interpolation_filname Run with Abstraction to generate Scatter plot using interpolation polynomial in file\n");
//printf("-C Generate Calibration information for Abstraction (effective SNR adjustment to remove Pe bias w.r.t. AWGN)\n");
printf("-f raw file containing RRC configuration (generated by gNB)\n");
printf("-F Input filename (.txt format) for RX conformance testing\n"); printf("-F Input filename (.txt format) for RX conformance testing\n");
printf("-o CORESET offset\n");
printf("-a Start PRB for PDSCH\n");
printf("-b Number of PRB for PDSCH\n");
printf("-c Start symbol for PDSCH (fixed for now)\n");
printf("-j Number of symbols for PDSCH (fixed for now)\n");
printf("-e MSC index\n");
printf("-q MCS Table index\n");
printf("-t Acceptable effective throughput (in percentage)\n");
printf("-I Maximum LDPC decoder iterations\n"); printf("-I Maximum LDPC decoder iterations\n");
printf("-L <log level, 0(errors), 1(warning), 2(analysis), 3(info), 4(debug), 5(trace)>\n");
printf("-P Print DLSCH performances\n");
printf("-R N_RB_DL\n");
printf("-T Enable PTRS, arguments list L_PTRS{0,1,2} K_PTRS{2,4}, e.g. -T 2 0 2 \n"); printf("-T Enable PTRS, arguments list L_PTRS{0,1,2} K_PTRS{2,4}, e.g. -T 2 0 2 \n");
printf("-U Change DMRS Config, arguments list DMRS TYPE{0=A,1=B} DMRS AddPos{0:2} DMRS ConfType{1:2}, e.g. -U 3 0 2 1 \n"); printf("-U Change DMRS Config, arguments list DMRS TYPE{0=A,1=B} DMRS AddPos{0:2} DMRS ConfType{1:2}, e.g. -U 3 0 2 1 \n");
printf("-P Print DLSCH performances\n");
printf("-v Maximum number of rounds\n");
printf("-w Write txdata to binary file (one frame)\n");
printf("-d number of dlsch threads, 0: no dlsch parallelization\n");
printf("-X gNB thread pool configuration, n => no threads\n"); printf("-X gNB thread pool configuration, n => no threads\n");
printf("-Y Run initial sync in UE\n"); printf("-Y Run initial sync in UE\n");
printf("-Z Output filename (.csv format) for stats\n");
exit (-1); exit (-1);
break; break;
} }
...@@ -925,6 +917,20 @@ int main(int argc, char **argv) ...@@ -925,6 +917,20 @@ int main(int argc, char **argv)
uint32_t dlsch_bytes = a_segments*1056; // allocated bytes per segment uint32_t dlsch_bytes = a_segments*1056; // allocated bytes per segment
UE->phy_sim_dlsch_b = calloc(1, dlsch_bytes); UE->phy_sim_dlsch_b = calloc(1, dlsch_bytes);
// csv file
if (filename_csv != NULL) {
csv_file = fopen(filename_csv, "a");
if (csv_file == NULL) {
printf("Can't open file \"%s\", errno %d\n", filename_csv, errno);
return 1;
}
// adding name of parameters into file
fprintf(csv_file,"SNR,false_positive,");
for (int r = 0; r < num_rounds; r++)
fprintf(csv_file,"n_errors_%d,errors_scrambling_%d,channel_bler_%d,channel_ber_%d,",r,r,r,r);
fprintf(csv_file,"avg_round,eff_rate,eff_throughput,TBS\n");
}
//---------------
for (SNR = snr0; SNR < snr1; SNR += .2) { for (SNR = snr0; SNR < snr1; SNR += .2) {
varArray_t *table_tx=initVarArray(1000,sizeof(double)); varArray_t *table_tx=initVarArray(1000,sizeof(double));
...@@ -1057,7 +1063,6 @@ int main(int argc, char **argv) ...@@ -1057,7 +1063,6 @@ int main(int argc, char **argv)
slot); slot);
} }
} }
if (n_trials==1) { if (n_trials==1) {
char filename[100];//LOG_M char filename[100];//LOG_M
for (aa=0;aa<n_tx;aa++) { for (aa=0;aa<n_tx;aa++) {
...@@ -1111,7 +1116,6 @@ int main(int argc, char **argv) ...@@ -1111,7 +1116,6 @@ int main(int argc, char **argv)
pdsch_processing(UE, pdsch_processing(UE,
&UE_proc, &UE_proc,
&phy_data); &phy_data);
//---------------------------------------------------------- //----------------------------------------------------------
//---------------------- count errors ---------------------- //---------------------- count errors ----------------------
//---------------------------------------------------------- //----------------------------------------------------------
...@@ -1163,7 +1167,6 @@ int main(int argc, char **argv) ...@@ -1163,7 +1167,6 @@ int main(int argc, char **argv)
} }
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
if (errors_bit > 0) { if (errors_bit > 0) {
...@@ -1201,7 +1204,13 @@ int main(int argc, char **argv) ...@@ -1201,7 +1204,13 @@ int main(int argc, char **argv)
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 / TBS * 100, TBS);
printf("*****************************************\n"); printf("*****************************************\n");
printf("\n"); printf("\n");
// writing to csv file
if (filename_csv != NULL) { // means we are asked to print stats to CSV
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);
}
if (print_perf==1) { if (print_perf==1) {
printf("\ngNB TX function statistics (per %d us slot, NPRB %d, mcs %d, block %d)\n", printf("\ngNB TX function statistics (per %d us slot, NPRB %d, mcs %d, block %d)\n",
1000 >> *scc->ssbSubcarrierSpacing, 1000 >> *scc->ssbSubcarrierSpacing,
...@@ -1223,7 +1232,6 @@ int main(int argc, char **argv) ...@@ -1223,7 +1232,6 @@ int main(int argc, char **argv)
printStatIndent2(&gNB->dlsch_resource_mapping_stats, "DLSCH Resource Mapping time"); printStatIndent2(&gNB->dlsch_resource_mapping_stats, "DLSCH Resource Mapping time");
printStatIndent2(&gNB->dlsch_precoding_stats,"DLSCH Layer Precoding time"); printStatIndent2(&gNB->dlsch_precoding_stats,"DLSCH Layer Precoding time");
printf("\nUE RX function statistics (per %d us slot)\n",1000>>*scc->ssbSubcarrierSpacing); printf("\nUE RX function statistics (per %d us slot)\n",1000>>*scc->ssbSubcarrierSpacing);
/* /*
printDistribution(&phy_proc_rx_tot, table_rx,"Total PHY proc rx"); printDistribution(&phy_proc_rx_tot, table_rx,"Total PHY proc rx");
...@@ -1313,6 +1321,12 @@ int main(int argc, char **argv) ...@@ -1313,6 +1321,12 @@ int main(int argc, char **argv)
if (scg_fd) if (scg_fd)
fclose(scg_fd); fclose(scg_fd);
// closing csv file
if (filename_csv != NULL) { // means we are asked to print stats to CSV
fclose(csv_file);
free(filename_csv);
}
return n_errs; return n_errs;
} }
......
This diff is collapsed.
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