Making sample offset as cmd line parameter
for gNB its in L1 section of config file for UE its a cmd line paramenter
This commit is contained in:
@@ -483,6 +483,7 @@ void nr_phy_config_request_sim(PHY_VARS_gNB *gNB,
|
||||
gNB_config->carrier_config.dl_bandwidth.value = config_bandwidth(mu, N_RB_DL, fp->nr_band);
|
||||
|
||||
nr_init_frame_parms(gNB_config, fp);
|
||||
fp->ofdm_offset_divisor = UINT_MAX;
|
||||
gNB->configured = 1;
|
||||
LOG_I(PHY,"gNB configured\n");
|
||||
}
|
||||
@@ -534,6 +535,7 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) {
|
||||
// }
|
||||
RC.gNB[Mod_id]->configured = 1;
|
||||
|
||||
fp->ofdm_offset_divisor = RC.gNB[Mod_id]->ofdm_offset_divisor;
|
||||
init_symbol_rotation(fp);
|
||||
init_timeshift_rotation(fp);
|
||||
|
||||
|
||||
@@ -762,7 +762,7 @@ void init_timeshift_rotation(NR_DL_FRAME_PARMS *fp)
|
||||
for (i = 0; i < fp->ofdm_symbol_size/2; i++) {
|
||||
timeshift_symbol_rotation = fp->timeshift_symbol_rotation[0];
|
||||
f = fd * i;
|
||||
t0 = Ncp0 / 8;
|
||||
t0 = Ncp0 / fp->ofdm_offset_divisor;
|
||||
poff = 2 * M_PI * -t0 * Tc * f;
|
||||
exp_re = cos(poff);
|
||||
exp_im = sin(-poff);
|
||||
@@ -770,7 +770,7 @@ void init_timeshift_rotation(NR_DL_FRAME_PARMS *fp)
|
||||
timeshift_symbol_rotation[i*2+1] = (int16_t)floor(exp_im * 32767);
|
||||
|
||||
timeshift_symbol_rotation = fp->timeshift_symbol_rotation[1];
|
||||
t0 = Ncp1 / 8;
|
||||
t0 = Ncp1 / fp->ofdm_offset_divisor;
|
||||
poff = 2 * M_PI * -t0 * Tc * f;
|
||||
exp_re = cos(poff);
|
||||
exp_im = sin(-poff);
|
||||
@@ -779,8 +779,8 @@ void init_timeshift_rotation(NR_DL_FRAME_PARMS *fp)
|
||||
|
||||
if (i < 10)
|
||||
LOG_I(PHY,"Timeshift symbol rotation %d => (%d,%d) %f\n",i,
|
||||
fp->timeshift_symbol_rotation[1][i*2],
|
||||
fp->timeshift_symbol_rotation[1][i*2+1],
|
||||
fp->timeshift_symbol_rotation[0][i*2],
|
||||
fp->timeshift_symbol_rotation[0][i*2+1],
|
||||
poff);
|
||||
|
||||
}
|
||||
@@ -789,25 +789,25 @@ void init_timeshift_rotation(NR_DL_FRAME_PARMS *fp)
|
||||
for (int j = fp->ofdm_symbol_size-1; j > fp->ofdm_symbol_size/2-1; j--) {
|
||||
timeshift_symbol_rotation = fp->timeshift_symbol_rotation[0];
|
||||
f = -fd * i;
|
||||
t0 = Ncp0 / 8;
|
||||
t0 = Ncp0 / fp->ofdm_offset_divisor;
|
||||
poff = 2 * M_PI * -t0 * Tc * f;
|
||||
exp_re = cos(poff);
|
||||
exp_im = sin(-poff);
|
||||
timeshift_symbol_rotation[j*2] = (int16_t)floor(exp_re * 32767);
|
||||
timeshift_symbol_rotation[j*2+1] = (int16_t)floor(exp_im * 32767);
|
||||
timeshift_symbol_rotation[j*2] = (int16_t)ceil(exp_re * 32767);
|
||||
timeshift_symbol_rotation[j*2+1] = (int16_t)ceil(exp_im * 32767);
|
||||
|
||||
timeshift_symbol_rotation = fp->timeshift_symbol_rotation[1];
|
||||
t0 = Ncp1 / 8;
|
||||
t0 = Ncp1 / fp->ofdm_offset_divisor;
|
||||
poff = 2 * M_PI * -t0 * Tc * f;
|
||||
exp_re = cos(poff);
|
||||
exp_im = sin(-poff);
|
||||
timeshift_symbol_rotation[j*2] = (int16_t)floor(exp_re * 32767);
|
||||
timeshift_symbol_rotation[j*2+1] = (int16_t)floor(exp_im * 32767);
|
||||
timeshift_symbol_rotation[j*2] = (int16_t)ceil(exp_re * 32767);
|
||||
timeshift_symbol_rotation[j*2+1] = (int16_t)ceil(exp_im * 32767);
|
||||
|
||||
if (j > fp->ofdm_symbol_size-10-1)
|
||||
LOG_I(PHY,"Timeshift symbol rotation %d => (%d,%d) %f\n",-i,
|
||||
fp->timeshift_symbol_rotation[1][j*2],
|
||||
fp->timeshift_symbol_rotation[1][j*2+1],
|
||||
fp->timeshift_symbol_rotation[0][j*2],
|
||||
fp->timeshift_symbol_rotation[0][j*2+1],
|
||||
poff);
|
||||
i++;
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
|
||||
rx_offset += frame_parms->ofdm_symbol_size * symbol;
|
||||
|
||||
// use OFDM symbol from within 1/8th of the CP to avoid ISI
|
||||
rx_offset -= nb_prefix_samples / 8;
|
||||
rx_offset -= (nb_prefix_samples / frame_parms->ofdm_offset_divisor);
|
||||
|
||||
#ifdef DEBUG_FEP
|
||||
// if (ue->frame <100)
|
||||
@@ -158,11 +158,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
|
||||
frame_parms->ofdm_symbol_size,
|
||||
15);
|
||||
|
||||
int16_t *shift_rot;
|
||||
if (symb_offset+symbol == (7 * (1 << frame_parms->numerology_index)))
|
||||
shift_rot = frame_parms->timeshift_symbol_rotation[0];
|
||||
else
|
||||
shift_rot = frame_parms->timeshift_symbol_rotation[1];
|
||||
int16_t *shift_rot = frame_parms->timeshift_symbol_rotation[0];
|
||||
|
||||
multadd_cpx_vector((int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],
|
||||
shift_rot,
|
||||
@@ -309,7 +305,7 @@ int nr_slot_fep_ul(NR_DL_FRAME_PARMS *frame_parms,
|
||||
// offset of n-th OFDM symbol
|
||||
rxdata_offset += symbol * (frame_parms->ofdm_symbol_size + nb_prefix_samples);
|
||||
// use OFDM symbol from within 1/8th of the CP to avoid ISI
|
||||
rxdata_offset -= nb_prefix_samples / 8;
|
||||
rxdata_offset -= (nb_prefix_samples / frame_parms->ofdm_offset_divisor);
|
||||
|
||||
int16_t *rxdata_ptr;
|
||||
|
||||
@@ -370,11 +366,7 @@ void apply_nr_rotation_ul(NR_DL_FRAME_PARMS *frame_parms,
|
||||
length,
|
||||
15);
|
||||
|
||||
int16_t *shift_rot;
|
||||
if (symb_offset+symbol == (7 * (1 << frame_parms->numerology_index)))
|
||||
shift_rot = frame_parms->timeshift_symbol_rotation[0];
|
||||
else
|
||||
shift_rot = frame_parms->timeshift_symbol_rotation[1];
|
||||
int16_t *shift_rot = frame_parms->timeshift_symbol_rotation[0];
|
||||
|
||||
multadd_cpx_vector((int16_t *)&rxdataF[frame_parms->ofdm_symbol_size*symbol],
|
||||
shift_rot,
|
||||
|
||||
@@ -45,7 +45,7 @@ int nr_est_timing_advance_pusch(PHY_VARS_gNB* gNB, int UE_id)
|
||||
NR_gNB_PUSCH *gNB_pusch_vars = gNB->pusch_vars[UE_id];
|
||||
int32_t **ul_ch_estimates_time = gNB_pusch_vars->ul_ch_estimates_time;
|
||||
|
||||
int sync_pos = frame_parms->nb_prefix_samples / 8;
|
||||
int sync_pos = frame_parms->nb_prefix_samples / frame_parms->ofdm_offset_divisor;
|
||||
|
||||
for (i = 0; i < frame_parms->ofdm_symbol_size; i++) {
|
||||
int temp = 0;
|
||||
|
||||
@@ -82,7 +82,7 @@ void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
|
||||
// do not filter to have proactive timing adjustment
|
||||
//max_pos_fil = max_pos;
|
||||
|
||||
diff = max_pos_fil - (frame_parms->nb_prefix_samples>>3);
|
||||
diff = max_pos_fil - (frame_parms->nb_prefix_samples / frame_parms->ofdm_offset_divisor);
|
||||
|
||||
if (frame_parms->freq_range==nr_FR2)
|
||||
sync_offset = 2;
|
||||
|
||||
@@ -776,6 +776,8 @@ typedef struct PHY_VARS_gNB_s {
|
||||
|
||||
uint32_t max_peak_val;
|
||||
|
||||
/// OFDM symbol offset divisor for UL
|
||||
uint32_t ofdm_offset_divisor;
|
||||
/// \brief sinr for all subcarriers of the current link (used only for abstraction).
|
||||
/// first index: ? [0..N_RB_DL*12[
|
||||
double *sinr_dB;
|
||||
|
||||
@@ -365,6 +365,8 @@ struct NR_DL_FRAME_PARMS {
|
||||
uint8_t ssb_index;
|
||||
/// PBCH polar encoder params
|
||||
t_nrPolar_params pbch_polar_params;
|
||||
/// OFDM symbol offset divisor for UL
|
||||
uint32_t ofdm_offset_divisor;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -619,6 +619,7 @@ int main(int argc, char **argv)
|
||||
memset(RC.gNB[0],0,sizeof(PHY_VARS_gNB));
|
||||
|
||||
gNB = RC.gNB[0];
|
||||
gNB->ofdm_offset_divisor = UINT_MAX;
|
||||
frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH)
|
||||
frame_parms->nb_antennas_tx = n_tx;
|
||||
frame_parms->nb_antennas_rx = n_rx;
|
||||
|
||||
@@ -109,7 +109,9 @@ void nr_phy_config_request_sim_pbchsim(PHY_VARS_gNB *gNB,
|
||||
|
||||
gNB_config->carrier_config.dl_bandwidth.value = config_bandwidth(mu, N_RB_DL, fp->nr_band);
|
||||
|
||||
fp->ofdm_offset_divisor = UINT_MAX;
|
||||
nr_init_frame_parms(gNB_config, fp);
|
||||
init_timeshift_rotation(fp);
|
||||
|
||||
init_symbol_rotation(fp);
|
||||
|
||||
@@ -405,6 +407,7 @@ int main(int argc, char **argv)
|
||||
RC.gNB = (PHY_VARS_gNB**) malloc(sizeof(PHY_VARS_gNB *));
|
||||
RC.gNB[0] = malloc(sizeof(PHY_VARS_gNB));
|
||||
gNB = RC.gNB[0];
|
||||
gNB->ofdm_offset_divisor = UINT_MAX;
|
||||
frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH)
|
||||
frame_parms->nb_antennas_tx = n_tx;
|
||||
frame_parms->nb_antennas_rx = n_rx;
|
||||
|
||||
@@ -616,6 +616,7 @@ int main(int argc, char **argv)
|
||||
RC.gNB = (PHY_VARS_gNB **) malloc(sizeof(PHY_VARS_gNB *));
|
||||
RC.gNB[0] = calloc(1,sizeof(PHY_VARS_gNB));
|
||||
gNB = RC.gNB[0];
|
||||
gNB->ofdm_offset_divisor = UINT_MAX;
|
||||
gNB->threadPool = (tpool_t*)malloc(sizeof(tpool_t));
|
||||
gNB->respDecode = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
|
||||
char tp_param[] = "n";
|
||||
|
||||
Reference in New Issue
Block a user