Merge remote-tracking branch 'origin/ue-phy-sync-improvements' into integration_2022_wk07_c
This commit is contained in:
@@ -1069,12 +1069,12 @@
|
|||||||
<pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</pre_exec>
|
<pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</pre_exec>
|
||||||
<pre_exec_args></pre_exec_args>
|
<pre_exec_args></pre_exec_args>
|
||||||
<main_exec> $OPENAIR_DIR/targets/bin/nr_pbchsim.Rel15</main_exec>
|
<main_exec> $OPENAIR_DIR/targets/bin/nr_pbchsim.Rel15</main_exec>
|
||||||
<main_exec_args>-s0 -S1 -n1000 -R106
|
<main_exec_args>-s-11 -S-8 -n10 -R106
|
||||||
-s0 -S1 -n10 -I -R106
|
-s-11 -S-8 -n10 -o8000 -I -R106
|
||||||
-s0 -S1 -n1000 -R217
|
-s-11 -S-8 -n10 -R217
|
||||||
-s0 -S1 -n10 -I -R217
|
-s-11 -S-8 -n10 -o8000 -I -R217
|
||||||
-s0 -S1 -n1000 -R273
|
-s-11 -S-8 -n10 -R273
|
||||||
-s0 -S1 -n10 -I -R273</main_exec_args>
|
-s-11 -S-8 -n10 -o8000 -I -R273</main_exec_args>
|
||||||
<tags>nr_pbchsim.test1 nr_pbchsim.test2 nr_pbchsim.test3 nr_pbchsim.test4 nr_pbchsim.test5 nr_pbchsim.test6</tags>
|
<tags>nr_pbchsim.test1 nr_pbchsim.test2 nr_pbchsim.test3 nr_pbchsim.test4 nr_pbchsim.test5 nr_pbchsim.test6</tags>
|
||||||
<search_expr_true>PBCH test OK</search_expr_true>
|
<search_expr_true>PBCH test OK</search_expr_true>
|
||||||
<search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
|
<search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
|
||||||
|
|||||||
+6
-19
@@ -886,26 +886,13 @@ void syncInFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int computeSamplesShift(PHY_VARS_NR_UE *UE) {
|
int computeSamplesShift(PHY_VARS_NR_UE *UE) {
|
||||||
|
int samples_shift = -(UE->rx_offset>>1);
|
||||||
// compute TO compensation that should be applied for this frame
|
UE->rx_offset = 0; // reset so that it is not applied falsely in case of SSB being only in every second frame
|
||||||
if ( UE->rx_offset < UE->frame_parms.samples_per_frame/2 &&
|
UE->max_pos_fil = 0; // reset IIR filter when sample shift is applied
|
||||||
UE->rx_offset > 0 ) {
|
if (samples_shift != 0) {
|
||||||
LOG_I(PHY,"!!!adjusting -1 samples!!! rx_offset == %d\n", UE->rx_offset);
|
LOG_I(NR_PHY,"Adjusting frame in time by %i samples\n", samples_shift);
|
||||||
UE->rx_offset = 0; // reset so that it is not applied falsely in case of SSB being only in every second frame
|
|
||||||
UE->max_pos_fil = 0; // reset IIR filter when sample shift is applied
|
|
||||||
return -1 ;
|
|
||||||
}
|
}
|
||||||
|
return samples_shift;
|
||||||
if ( UE->rx_offset > UE->frame_parms.samples_per_frame/2 &&
|
|
||||||
UE->rx_offset < UE->frame_parms.samples_per_frame ) {
|
|
||||||
int rx_offset = UE->rx_offset - UE->frame_parms.samples_per_frame;
|
|
||||||
LOG_I(PHY,"!!!adjusting +1 samples!!! rx_offset == %d\n", rx_offset);
|
|
||||||
UE->rx_offset = 0; // reset so that it is not applied falsely in case of SSB being only in every second frame
|
|
||||||
UE->max_pos_fil = 0; // reset IIR filter when sample shift is applied
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int get_firstSymSamp(uint16_t slot, NR_DL_FRAME_PARMS *fp) {
|
static inline int get_firstSymSamp(uint16_t slot, NR_DL_FRAME_PARMS *fp) {
|
||||||
|
|||||||
@@ -65,6 +65,7 @@
|
|||||||
/* SS/PBCH parameters */
|
/* SS/PBCH parameters */
|
||||||
#define N_RB_SS_PBCH_BLOCK (20)
|
#define N_RB_SS_PBCH_BLOCK (20)
|
||||||
#define NB_SYMBOLS_PBCH (3)
|
#define NB_SYMBOLS_PBCH (3)
|
||||||
|
#define NR_N_SYMBOLS_SSB (4)
|
||||||
|
|
||||||
#define IQ_SIZE (sizeof(int16_t) * 2) /* I and Q are alternatively stored into buffers */
|
#define IQ_SIZE (sizeof(int16_t) * 2) /* I and Q are alternatively stored into buffers */
|
||||||
#define N_SYMB_SLOT (14)
|
#define N_SYMB_SLOT (14)
|
||||||
|
|||||||
@@ -63,18 +63,22 @@
|
|||||||
|
|
||||||
/************** VARIABLES *****************************************/
|
/************** VARIABLES *****************************************/
|
||||||
|
|
||||||
#define PHASE_HYPOTHESIS_NUMBER (7)
|
#define PHASE_HYPOTHESIS_NUMBER (16)
|
||||||
#define INDEX_NO_PHASE_DIFFERENCE (3) /* this is for no phase shift case */
|
#define INDEX_NO_PHASE_DIFFERENCE (3) /* this is for no phase shift case */
|
||||||
|
|
||||||
EXTERN const int16_t phase_re_nr[PHASE_HYPOTHESIS_NUMBER]
|
EXTERN const int16_t phase_re_nr[PHASE_HYPOTHESIS_NUMBER]
|
||||||
#ifdef INIT_VARIABLES_SSS_NR_H
|
#ifdef INIT_VARIABLES_SSS_NR_H
|
||||||
= {16383, 25101, 30791, 32767, 30791, 25101, 16383}
|
// -pi/3 ---- pi/3
|
||||||
|
= {16384,20173,23571,26509,28932,30791,32051,32687,32687,32051,30791,
|
||||||
|
28932,26509,23571,20173,16384}
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
|
|
||||||
EXTERN const int16_t phase_im_nr[PHASE_HYPOTHESIS_NUMBER]
|
EXTERN const int16_t phase_im_nr[PHASE_HYPOTHESIS_NUMBER]
|
||||||
#ifdef INIT_VARIABLES_SSS_NR_H
|
#ifdef INIT_VARIABLES_SSS_NR_H
|
||||||
= {-28378, -21063, -11208, 0, 11207, 21062, 28377};
|
// -pi/3 ---- pi/3
|
||||||
|
= {-28377,-25821,-22762,-19260,-15383,-11207,-6813,-2286,2286,6813,11207,
|
||||||
|
15383,19260,22762,25821,28377}
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -92,7 +96,7 @@ int pss_ch_est_nr(PHY_VARS_NR_UE *ue,
|
|||||||
int32_t pss_ext[NB_ANTENNAS_RX][LENGTH_PSS_NR],
|
int32_t pss_ext[NB_ANTENNAS_RX][LENGTH_PSS_NR],
|
||||||
int32_t sss_ext[NB_ANTENNAS_RX][LENGTH_SSS_NR]);
|
int32_t sss_ext[NB_ANTENNAS_RX][LENGTH_SSS_NR]);
|
||||||
|
|
||||||
int rx_sss_nr(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int32_t *tot_metric, uint8_t *phase_max);
|
int rx_sss_nr(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int32_t *tot_metric, uint8_t *phase_max, int *freq_offset_sss);
|
||||||
|
|
||||||
#undef INIT_VARIABLES_SSS_NR_H
|
#undef INIT_VARIABLES_SSS_NR_H
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
|
|||||||
@@ -115,12 +115,6 @@ void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ue->rx_offset < 0)
|
|
||||||
ue->rx_offset += frame_parms->samples_per_frame;
|
|
||||||
|
|
||||||
if (ue->rx_offset >= frame_parms->samples_per_frame)
|
|
||||||
ue->rx_offset -= frame_parms->samples_per_frame;
|
|
||||||
|
|
||||||
#ifdef DEBUG_PHY
|
#ifdef DEBUG_PHY
|
||||||
LOG_D(PHY,"AbsSubframe %d: diff = %i, rx_offset (final) = %i : clear = %d, max_pos = %d, max_pos_fil = %d, max_val = %d, sync_pos %d\n",
|
LOG_D(PHY,"AbsSubframe %d: diff = %i, rx_offset (final) = %i : clear = %d, max_pos = %d, max_pos_fil = %d, max_val = %d, sync_pos %d\n",
|
||||||
subframe,
|
subframe,
|
||||||
|
|||||||
@@ -31,8 +31,6 @@
|
|||||||
*/
|
*/
|
||||||
#include "PHY/types.h"
|
#include "PHY/types.h"
|
||||||
#include "PHY/defs_nr_UE.h"
|
#include "PHY/defs_nr_UE.h"
|
||||||
#include "PHY/phy_extern_nr_ue.h"
|
|
||||||
#include "PHY/INIT/phy_init.h"
|
|
||||||
#include "PHY/MODULATION/modulation_UE.h"
|
#include "PHY/MODULATION/modulation_UE.h"
|
||||||
#include "nr_transport_proto_ue.h"
|
#include "nr_transport_proto_ue.h"
|
||||||
#include "PHY/NR_UE_ESTIMATION/nr_estimation.h"
|
#include "PHY/NR_UE_ESTIMATION/nr_estimation.h"
|
||||||
@@ -46,7 +44,6 @@
|
|||||||
#include "PHY/NR_REFSIG/pss_nr.h"
|
#include "PHY/NR_REFSIG/pss_nr.h"
|
||||||
#include "PHY/NR_REFSIG/sss_nr.h"
|
#include "PHY/NR_REFSIG/sss_nr.h"
|
||||||
#include "PHY/NR_REFSIG/refsig_defs_ue.h"
|
#include "PHY/NR_REFSIG/refsig_defs_ue.h"
|
||||||
#include "PHY/NR_TRANSPORT/nr_dci.h"
|
|
||||||
|
|
||||||
extern openair0_config_t openair0_cfg[];
|
extern openair0_config_t openair0_cfg[];
|
||||||
//static nfapi_nr_config_request_t config_t;
|
//static nfapi_nr_config_request_t config_t;
|
||||||
@@ -200,6 +197,7 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
|
|||||||
{
|
{
|
||||||
|
|
||||||
int32_t sync_pos, sync_pos_frame; // k_ssb, N_ssb_crb, sync_pos2,
|
int32_t sync_pos, sync_pos_frame; // k_ssb, N_ssb_crb, sync_pos2,
|
||||||
|
int32_t accumulated_freq_offset = 0;
|
||||||
int32_t metric_tdd_ncp=0;
|
int32_t metric_tdd_ncp=0;
|
||||||
uint8_t phase_tdd_ncp;
|
uint8_t phase_tdd_ncp;
|
||||||
double im, re;
|
double im, re;
|
||||||
@@ -248,22 +246,30 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
|
|||||||
LOG_I(PHY,"sync_pos %d ssb_offset %d \n",sync_pos,ue->ssb_offset);
|
LOG_I(PHY,"sync_pos %d ssb_offset %d \n",sync_pos,ue->ssb_offset);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
accumulated_freq_offset += ue->common_vars.freq_offset;
|
||||||
|
|
||||||
// digital compensation of FFO for SSB symbols
|
// digital compensation of FFO for SSB symbols
|
||||||
if (ue->UE_fo_compensation){
|
if (ue->UE_fo_compensation){
|
||||||
double s_time = 1/(1.0e3*fp->samples_per_subframe); // sampling time
|
double s_time = 1/(1.0e3*fp->samples_per_subframe); // sampling time
|
||||||
double off_angle = -2*M_PI*s_time*(ue->common_vars.freq_offset); // offset rotation angle compensation per sample
|
double off_angle = -2*M_PI*s_time*(ue->common_vars.freq_offset); // offset rotation angle compensation per sample
|
||||||
|
|
||||||
int start = is*fp->samples_per_frame+ue->ssb_offset; // start for offset correction is at ssb_offset (pss time position)
|
// In SA we need to perform frequency offset correction until the end of buffer because we need to decode SIB1
|
||||||
int end = start + 4*(fp->ofdm_symbol_size + fp->nb_prefix_samples); // loop over samples in 4 symbols (ssb size), including prefix
|
// and we do not know yet in which slot it goes.
|
||||||
|
|
||||||
for(int n=start; n<end; n++){
|
// start for offset correction
|
||||||
for (int ar=0; ar<fp->nb_antennas_rx; ar++) {
|
int start = sa ? is*fp->samples_per_frame : is*fp->samples_per_frame + ue->ssb_offset;
|
||||||
re = ((double)(((short *)ue->common_vars.rxdata[ar]))[2*n]);
|
|
||||||
im = ((double)(((short *)ue->common_vars.rxdata[ar]))[2*n+1]);
|
// loop over samples
|
||||||
((short *)ue->common_vars.rxdata[ar])[2*n] = (short)(round(re*cos(n*off_angle) - im*sin(n*off_angle)));
|
int end = sa ? n_frames*fp->samples_per_frame-1 : start + NR_N_SYMBOLS_SSB*(fp->ofdm_symbol_size + fp->nb_prefix_samples);
|
||||||
((short *)ue->common_vars.rxdata[ar])[2*n+1] = (short)(round(re*sin(n*off_angle) + im*cos(n*off_angle)));
|
|
||||||
}
|
for(int n=start; n<end; n++){
|
||||||
}
|
for (int ar=0; ar<fp->nb_antennas_rx; ar++) {
|
||||||
|
re = ((double)(((short *)ue->common_vars.rxdata[ar]))[2*n]);
|
||||||
|
im = ((double)(((short *)ue->common_vars.rxdata[ar]))[2*n+1]);
|
||||||
|
((short *)ue->common_vars.rxdata[ar])[2*n] = (short)(round(re*cos(n*off_angle) - im*sin(n*off_angle)));
|
||||||
|
((short *)ue->common_vars.rxdata[ar])[2*n+1] = (short)(round(re*sin(n*off_angle) + im*cos(n*off_angle)));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check that SSS/PBCH block is continuous inside the received buffer */
|
/* check that SSS/PBCH block is continuous inside the received buffer */
|
||||||
@@ -289,7 +295,34 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
|
|||||||
LOG_I(PHY,"Calling sss detection (normal CP)\n");
|
LOG_I(PHY,"Calling sss detection (normal CP)\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
rx_sss_nr(ue, proc, &metric_tdd_ncp, &phase_tdd_ncp);
|
int freq_offset_sss = 0;
|
||||||
|
rx_sss_nr(ue, proc, &metric_tdd_ncp, &phase_tdd_ncp, &freq_offset_sss);
|
||||||
|
|
||||||
|
accumulated_freq_offset += freq_offset_sss;
|
||||||
|
|
||||||
|
// digital compensation of FFO for SSB symbols
|
||||||
|
if (ue->UE_fo_compensation){
|
||||||
|
double s_time = 1/(1.0e3*fp->samples_per_subframe); // sampling time
|
||||||
|
double off_angle = -2*M_PI*s_time*freq_offset_sss; // offset rotation angle compensation per sample
|
||||||
|
|
||||||
|
// In SA we need to perform frequency offset correction until the end of buffer because we need to decode SIB1
|
||||||
|
// and we do not know yet in which slot it goes.
|
||||||
|
|
||||||
|
// start for offset correction
|
||||||
|
int start = sa ? is*fp->samples_per_frame : is*fp->samples_per_frame + ue->ssb_offset;
|
||||||
|
|
||||||
|
// loop over samples
|
||||||
|
int end = sa ? n_frames*fp->samples_per_frame-1 : start + NR_N_SYMBOLS_SSB*(fp->ofdm_symbol_size + fp->nb_prefix_samples);
|
||||||
|
|
||||||
|
for(int n=start; n<end; n++){
|
||||||
|
for (int ar=0; ar<fp->nb_antennas_rx; ar++) {
|
||||||
|
re = ((double)(((short *)ue->common_vars.rxdata[ar]))[2*n]);
|
||||||
|
im = ((double)(((short *)ue->common_vars.rxdata[ar]))[2*n+1]);
|
||||||
|
((short *)ue->common_vars.rxdata[ar])[2*n] = (short)(round(re*cos(n*off_angle) - im*sin(n*off_angle)));
|
||||||
|
((short *)ue->common_vars.rxdata[ar])[2*n+1] = (short)(round(re*sin(n*off_angle) + im*cos(n*off_angle)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
nr_gold_pbch(ue);
|
nr_gold_pbch(ue);
|
||||||
ret = nr_pbch_detection(proc, ue, 1); // start pbch detection at first symbol after pss
|
ret = nr_pbch_detection(proc, ue, 1); // start pbch detection at first symbol after pss
|
||||||
@@ -536,6 +569,8 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
|
|||||||
}
|
}
|
||||||
if (dec == false) // sib1 not decoded
|
if (dec == false) // sib1 not decoded
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
|
||||||
|
ue->common_vars.freq_offset = accumulated_freq_offset;
|
||||||
}
|
}
|
||||||
// exit_fun("debug exit");
|
// exit_fun("debug exit");
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_INITIAL_UE_SYNC, VCD_FUNCTION_OUT);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_INITIAL_UE_SYNC, VCD_FUNCTION_OUT);
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <nr-uesoftmodem.h>
|
||||||
|
|
||||||
#include "PHY/defs_nr_UE.h"
|
#include "PHY/defs_nr_UE.h"
|
||||||
|
|
||||||
|
|||||||
@@ -420,7 +420,7 @@ int pss_sss_extract_nr(PHY_VARS_NR_UE *phy_vars_ue,
|
|||||||
*
|
*
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
int rx_sss_nr(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int32_t *tot_metric, uint8_t *phase_max)
|
int rx_sss_nr(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int32_t *tot_metric, uint8_t *phase_max, int *freq_offset_sss)
|
||||||
{
|
{
|
||||||
uint8_t i;
|
uint8_t i;
|
||||||
int32_t pss_ext[NB_ANTENNAS_RX][LENGTH_PSS_NR];
|
int32_t pss_ext[NB_ANTENNAS_RX][LENGTH_PSS_NR];
|
||||||
@@ -558,5 +558,19 @@ int rx_sss_nr(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int32_t *tot_metric,
|
|||||||
}
|
}
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
|
int re = 0;
|
||||||
|
int im = 0;
|
||||||
|
d = (int16_t *)&d_sss[Nid2][Nid1];
|
||||||
|
for(i = 0; i<LENGTH_SSS_NR; i++) {
|
||||||
|
re += d[i]*sss[2*i];
|
||||||
|
im += d[i]*sss[2*i+1];
|
||||||
|
}
|
||||||
|
double ffo_sss = atan2(im,re)/M_PI/4.3;
|
||||||
|
*freq_offset_sss = (int)(ffo_sss*frame_parms->subcarrier_spacing);
|
||||||
|
|
||||||
|
double ffo_pss = ((double)ue->common_vars.freq_offset)/frame_parms->subcarrier_spacing;
|
||||||
|
LOG_I(NR_PHY, "ffo_pss %f (%i Hz), ffo_sss %f (%i Hz), ffo_pss+ffo_sss %f (%i Hz)\n",
|
||||||
|
ffo_pss, (int)(ffo_pss*frame_parms->subcarrier_spacing), ffo_sss, *freq_offset_sss, ffo_pss+ffo_sss, (int)((ffo_pss+ffo_sss)*frame_parms->subcarrier_spacing));
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -202,15 +202,15 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
float target_error_rate = 0.01;
|
float target_error_rate = 0.01;
|
||||||
|
|
||||||
|
int seed = 0;
|
||||||
|
|
||||||
cpuf = get_cpu_freq_GHz();
|
cpuf = get_cpu_freq_GHz();
|
||||||
|
|
||||||
if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == 0) {
|
if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == 0) {
|
||||||
exit_fun("[NR_PBCHSIM] Error, configuration module init failed\n");
|
exit_fun("[NR_PBCHSIM] Error, configuration module init failed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
randominit(0);
|
while ((c = getopt (argc, argv, "F:g:hIL:m:M:n:N:o:P:r:R:s:S:x:y:z:")) != -1) {
|
||||||
|
|
||||||
while ((c = getopt (argc, argv, "f:hA:pf:g:i:j:n:o:s:S:t:x:y:z:M:N:F:GR:dP:IL:m:")) != -1) {
|
|
||||||
switch (c) {
|
switch (c) {
|
||||||
/*case 'f':
|
/*case 'f':
|
||||||
write_output_file=1;
|
write_output_file=1;
|
||||||
@@ -227,6 +227,14 @@ int main(int argc, char **argv)
|
|||||||
frame_type = 1;
|
frame_type = 1;
|
||||||
break;*/
|
break;*/
|
||||||
|
|
||||||
|
case 'F':
|
||||||
|
input_fd = fopen(optarg,"r");
|
||||||
|
if (input_fd==NULL) {
|
||||||
|
printf("Problem with filename %s. Exiting.\n", optarg);
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case 'g':
|
case 'g':
|
||||||
switch((char)*optarg) {
|
switch((char)*optarg) {
|
||||||
case 'A':
|
case 'A':
|
||||||
@@ -264,18 +272,42 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*case 'i':
|
/*
|
||||||
|
case 'i':
|
||||||
interf1=atoi(optarg);
|
interf1=atoi(optarg);
|
||||||
break;
|
break;
|
||||||
|
*/
|
||||||
|
|
||||||
|
case 'I':
|
||||||
|
run_initial_sync=1;
|
||||||
|
target_error_rate=0.1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
/*
|
||||||
case 'j':
|
case 'j':
|
||||||
interf2=atoi(optarg);
|
interf2=atoi(optarg);
|
||||||
break;*/
|
break;*/
|
||||||
|
|
||||||
|
case 'L':
|
||||||
|
loglvl = atoi(optarg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'm':
|
||||||
|
mu = atoi(optarg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'M':
|
||||||
|
SSB_positions = atoi(optarg);
|
||||||
|
break;
|
||||||
|
|
||||||
case 'n':
|
case 'n':
|
||||||
n_trials = atoi(optarg);
|
n_trials = atoi(optarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'N':
|
||||||
|
Nid_cell = atoi(optarg);
|
||||||
|
break;
|
||||||
|
|
||||||
case 'o':
|
case 'o':
|
||||||
cfo = atof(optarg);
|
cfo = atof(optarg);
|
||||||
#ifdef DEBUG_NR_PBCHSIM
|
#ifdef DEBUG_NR_PBCHSIM
|
||||||
@@ -283,6 +315,34 @@ int main(int argc, char **argv)
|
|||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
/*case 'p':
|
||||||
|
extended_prefix_flag=1;
|
||||||
|
break;*/
|
||||||
|
|
||||||
|
case 'P':
|
||||||
|
pbch_phase = atoi(optarg);
|
||||||
|
if (pbch_phase>3)
|
||||||
|
printf("Illegal PBCH phase (0-3) got %d\n",pbch_phase);
|
||||||
|
break;
|
||||||
|
|
||||||
|
/*
|
||||||
|
case 'r':
|
||||||
|
ricean_factor = pow(10,-.1*atof(optarg));
|
||||||
|
if (ricean_factor>1) {
|
||||||
|
printf("Ricean factor must be between 0 and 1\n");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
*/
|
||||||
|
|
||||||
|
case 'r':
|
||||||
|
seed = atoi(optarg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'R':
|
||||||
|
N_RB_DL = atoi(optarg);
|
||||||
|
break;
|
||||||
|
|
||||||
case 's':
|
case 's':
|
||||||
snr0 = atof(optarg);
|
snr0 = atof(optarg);
|
||||||
#ifdef DEBUG_NR_PBCHSIM
|
#ifdef DEBUG_NR_PBCHSIM
|
||||||
@@ -303,19 +363,7 @@ int main(int argc, char **argv)
|
|||||||
Td= atof(optarg);
|
Td= atof(optarg);
|
||||||
break;
|
break;
|
||||||
*/
|
*/
|
||||||
/*case 'p':
|
|
||||||
extended_prefix_flag=1;
|
|
||||||
break;*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
case 'r':
|
|
||||||
ricean_factor = pow(10,-.1*atof(optarg));
|
|
||||||
if (ricean_factor>1) {
|
|
||||||
printf("Ricean factor must be between 0 and 1\n");
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
*/
|
|
||||||
case 'x':
|
case 'x':
|
||||||
transmission_mode=atoi(optarg);
|
transmission_mode=atoi(optarg);
|
||||||
|
|
||||||
@@ -328,99 +376,58 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
case 'y':
|
case 'y':
|
||||||
n_tx=atoi(optarg);
|
n_tx=atoi(optarg);
|
||||||
|
|
||||||
if ((n_tx==0) || (n_tx>2)) {
|
if ((n_tx==0) || (n_tx>2)) {
|
||||||
printf("Unsupported number of TX antennas %d. Exiting.\n", n_tx);
|
printf("Unsupported number of TX antennas %d. Exiting.\n", n_tx);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'z':
|
case 'z':
|
||||||
n_rx=atoi(optarg);
|
n_rx=atoi(optarg);
|
||||||
|
|
||||||
if ((n_rx==0) || (n_rx>2)) {
|
if ((n_rx==0) || (n_rx>2)) {
|
||||||
printf("Unsupported number of RX antennas %d. Exiting.\n", n_rx);
|
printf("Unsupported number of RX antennas %d. Exiting.\n", n_rx);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'M':
|
|
||||||
SSB_positions = atoi(optarg);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'N':
|
|
||||||
Nid_cell = atoi(optarg);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'R':
|
|
||||||
N_RB_DL = atoi(optarg);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'F':
|
|
||||||
input_fd = fopen(optarg,"r");
|
|
||||||
|
|
||||||
if (input_fd==NULL) {
|
|
||||||
printf("Problem with filename %s. Exiting.\n", optarg);
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'P':
|
|
||||||
pbch_phase = atoi(optarg);
|
|
||||||
|
|
||||||
if (pbch_phase>3)
|
|
||||||
printf("Illegal PBCH phase (0-3) got %d\n",pbch_phase);
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'I':
|
|
||||||
run_initial_sync=1;
|
|
||||||
target_error_rate=0.1;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'L':
|
|
||||||
loglvl = atoi(optarg);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'm':
|
|
||||||
mu = atoi(optarg);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
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 -t Delayspread -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 -F input_filename -g channel_mod -h(elp) -I(nitial sync) -L log_lvl -n n_frames -M SSBs -n frames -N cell_id -o FO -P phase -r seed -R RBs -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant\n",
|
||||||
argv[0]);
|
argv[0]);
|
||||||
printf("-h This message\n");
|
//printf("-A Interpolation_filname Run with Abstraction to generate Scatter plot using interpolation polynomial in file\n");
|
||||||
//printf("-p Use extended prefix mode\n");
|
//printf("-C Generate Calibration information for Abstraction (effective SNR adjustment to remove Pe bias w.r.t. AWGN)\n");
|
||||||
//printf("-d Use TDD\n");
|
//printf("-d Use TDD\n");
|
||||||
printf("-n Number of frames to simulate\n");
|
//printf("-f Output filename (.txt format) for Pe/SNR results\n");
|
||||||
printf("-m Numerology index\n");
|
printf("-F Input filename (.txt format) for RX conformance testing\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("-t Delay spread for multipath channel\n");
|
|
||||||
printf("-g [A,B,C,D,E,F,G] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models (ignores delay spread and Ricean factor)\n");
|
printf("-g [A,B,C,D,E,F,G] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models (ignores delay spread and Ricean factor)\n");
|
||||||
|
printf("-h This message\n");
|
||||||
|
//printf("-i Relative strength of first intefering eNB (in dB) - cell_id mod 3 = 1\n");
|
||||||
|
printf("-I run initial sync with target error rate 0.1\n");
|
||||||
|
//printf("-j Relative strength of second intefering eNB (in dB) - cell_id mod 3 = 2\n");
|
||||||
|
printf("-L set the log level (-1 disable, 0 error, 1 warning, 2 info, 3 debug, 4 trace)\n");
|
||||||
|
printf("-m Numerology index\n");
|
||||||
|
printf("-M Multiple SSB positions in burst\n");
|
||||||
|
printf("-n Number of frames to simulate\n");
|
||||||
|
printf("-N Nid_cell\n");
|
||||||
|
printf("-o Carrier frequency offset in Hz\n");
|
||||||
|
//printf("-O oversampling factor (1,2,4,8,16)\n");
|
||||||
|
//printf("-p Use extended prefix mode\n");
|
||||||
|
printf("-P PBCH phase, allowed values 0-3\n");
|
||||||
|
printf("-r set the random number generator seed (default: 0 = current time)\n");
|
||||||
|
printf("-R N_RB_DL\n");
|
||||||
|
printf("-s Starting SNR, runs from SNR0 to SNR0 + 10 dB if not -S given. If -n 1, then just SNR is simulated\n");
|
||||||
|
printf("-S Ending SNR, runs from SNR0 to SNR1\n");
|
||||||
|
//printf("-t Delay spread for multipath channel\n");
|
||||||
printf("-x Transmission mode (1,2,6 for the moment)\n");
|
printf("-x Transmission mode (1,2,6 for the moment)\n");
|
||||||
printf("-y Number of TX antennas used in eNB\n");
|
printf("-y Number of TX antennas used in eNB\n");
|
||||||
printf("-z Number of RX antennas used in UE\n");
|
printf("-z Number of RX antennas used in UE\n");
|
||||||
//printf("-i Relative strength of first intefering eNB (in dB) - cell_id mod 3 = 1\n");
|
|
||||||
//printf("-j Relative strength of second intefering eNB (in dB) - cell_id mod 3 = 2\n");
|
|
||||||
printf("-o Carrier frequency offset in Hz\n");
|
|
||||||
printf("-M Multiple SSB positions in burst\n");
|
|
||||||
printf("-N Nid_cell\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 Output filename (.txt format) for Pe/SNR results\n");
|
|
||||||
printf("-F Input filename (.txt format) for RX conformance testing\n");
|
|
||||||
exit (-1);
|
exit (-1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
randominit(seed);
|
||||||
|
|
||||||
logInit();
|
logInit();
|
||||||
set_glog(loglvl);
|
set_glog(loglvl);
|
||||||
T_stdout = 1;
|
T_stdout = 1;
|
||||||
@@ -654,13 +661,6 @@ int main(int argc, char **argv)
|
|||||||
frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples);
|
frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples);
|
||||||
printf("txlev %d (%f)\n",txlev,10*log10(txlev));*/
|
printf("txlev %d (%f)\n",txlev,10*log10(txlev));*/
|
||||||
|
|
||||||
|
|
||||||
for (i=0; i<frame_length_complex_samples; i++) {
|
|
||||||
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
|
|
||||||
r_re[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)]);
|
|
||||||
r_im[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)+1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (SNR=snr0; SNR<snr1; SNR+=.2) {
|
for (SNR=snr0; SNR<snr1; SNR+=.2) {
|
||||||
|
|
||||||
@@ -668,6 +668,14 @@ int main(int argc, char **argv)
|
|||||||
n_errors_payload = 0;
|
n_errors_payload = 0;
|
||||||
|
|
||||||
for (trial=0; trial<n_trials; trial++) {
|
for (trial=0; trial<n_trials; trial++) {
|
||||||
|
|
||||||
|
for (i=0; i<frame_length_complex_samples; i++) {
|
||||||
|
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
|
||||||
|
r_re[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)]);
|
||||||
|
r_im[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)+1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// multipath channel
|
// multipath channel
|
||||||
//multipath_channel(gNB2UE,s_re,s_im,r_re,r_im,frame_length_complex_samples,0);
|
//multipath_channel(gNB2UE,s_re,s_im,r_re,r_im,frame_length_complex_samples,0);
|
||||||
|
|
||||||
@@ -696,13 +704,11 @@ int main(int argc, char **argv)
|
|||||||
0.0, // IQ imbalance (dB),
|
0.0, // IQ imbalance (dB),
|
||||||
0.0); // IQ phase imbalance (rad)
|
0.0); // IQ phase imbalance (rad)
|
||||||
|
|
||||||
|
|
||||||
for (i=0; i<frame_length_complex_samples; i++) {
|
for (i=0; i<frame_length_complex_samples; i++) {
|
||||||
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
|
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
|
||||||
|
((short*) UE->common_vars.rxdata[aa])[2*i] = (short) ((r_re[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||||
((short*) UE->common_vars.rxdata[aa])[2*i] = (short) ((r_re[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
((short*) UE->common_vars.rxdata[aa])[2*i+1] = (short) ((r_im[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||||
((short*) UE->common_vars.rxdata[aa])[2*i+1] = (short) ((r_im[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n_trials==1) {
|
if (n_trials==1) {
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ gNBs =
|
|||||||
|
|
||||||
# downlinkConfigCommon
|
# downlinkConfigCommon
|
||||||
#frequencyInfoDL
|
#frequencyInfoDL
|
||||||
# this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP)
|
# this is 2574.270 MHz + 53 PRBs@30kHz SCS (same as initial BWP)
|
||||||
absoluteFrequencySSB = 518670;
|
absoluteFrequencySSB = 518670;
|
||||||
dl_frequencyBand = 41;
|
dl_frequencyBand = 41;
|
||||||
# this is 3600 MHz
|
# this is 3600 MHz
|
||||||
@@ -67,7 +67,7 @@ gNBs =
|
|||||||
dl_carrierBandwidth = 106;
|
dl_carrierBandwidth = 106;
|
||||||
#initialDownlinkBWP
|
#initialDownlinkBWP
|
||||||
#genericParameters
|
#genericParameters
|
||||||
# this is RBstart=27,L=48 (275*(L-1))+RBstart
|
# this is RBstart=0,L=106 (275*(L-1))+RBstart
|
||||||
initialDLBWPlocationAndBandwidth = 28875; # 6366 12925 12956 28875 12952
|
initialDLBWPlocationAndBandwidth = 28875; # 6366 12925 12956 28875 12952
|
||||||
# subcarrierSpacing
|
# subcarrierSpacing
|
||||||
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
|
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
|
||||||
|
|||||||
Reference in New Issue
Block a user