diff --git a/common/platform_constants.h b/common/platform_constants.h index 3b59068a1f..00c68bd5b8 100644 --- a/common/platform_constants.h +++ b/common/platform_constants.h @@ -95,5 +95,6 @@ #define RETURNerror (-1) #define DEFAULT_NAS_PATH "PWD" #define UNUSED_VARIABLE(vARIABLE) (void)(vARIABLE) +#define NUM_PRACH_RX_FOR_NOISE_ESTIMATE 100 #endif /* __PLATFORM_CONSTANTS_H__ */ diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 0641a89ad9..229ebc7c19 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -458,10 +458,6 @@ int main(int argc, char **argv) get_channel_model_mode(uniqCfg); } - // Delay to allow the convergence of the IIR filter on PRACH noise measurements at gNB side - if (IS_SOFTMODEM_RFSIM && !get_softmodem_params()->phy_test) - sleep(3); - // start time manager with some reasonable default for the running mode // (may be overwritten in configuration file or command line) void nr_pdcp_ms_tick(void); diff --git a/openair1/SCHED/prach_procedures.c b/openair1/SCHED/prach_procedures.c index e4d4bff17e..968a94eeb0 100644 --- a/openair1/SCHED/prach_procedures.c +++ b/openair1/SCHED/prach_procedures.c @@ -120,7 +120,8 @@ void prach_procedures(PHY_VARS_eNB *eNB, */ if (eNB->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[0] == 1) { - if ((eNB->prach_energy_counter == 100) && (max_preamble_energy[0] > eNB->measurements.prach_I0 + eNB->prach_DTX_threshold_emtc[0])) { + if ((eNB->prach_energy_counter == NUM_PRACH_RX_FOR_NOISE_ESTIMATE) + && (max_preamble_energy[0] > eNB->measurements.prach_I0 + eNB->prach_DTX_threshold_emtc[0])) { eNB->UL_INFO.rach_ind_br.rach_indication_body.number_of_preambles++; eNB->preamble_list_br[ind].preamble_rel8.timing_advance = max_preamble_delay[ind]; // eNB->preamble_list_br[ind].preamble_rel8.preamble = max_preamble[ind]; @@ -142,7 +143,7 @@ void prach_procedures(PHY_VARS_eNB *eNB, } } */// ce_level } else { - if ((eNB->prach_energy_counter == 100) && + if ((eNB->prach_energy_counter == NUM_PRACH_RX_FOR_NOISE_ESTIMATE) && (max_preamble_energy[0] > eNB->measurements.prach_I0+eNB->prach_DTX_threshold)) { LOG_D(PHY,"[eNB %d/%d][RAPROC] Frame %d, subframe %d Initiating RA procedure with preamble %d, energy %d.%d dB, delay %d\n", eNB->Mod_id, @@ -186,7 +187,8 @@ void prach_procedures(PHY_VARS_eNB *eNB, if (frame==0) LOG_D(PHY,"prach_I0 = %d.%d dB\n",eNB->measurements.prach_I0/10,eNB->measurements.prach_I0%10); - if (eNB->prach_energy_counter < 100) eNB->prach_energy_counter++; + if (eNB->prach_energy_counter < NUM_PRACH_RX_FOR_NOISE_ESTIMATE) + eNB->prach_energy_counter++; } } // else br_flag diff --git a/openair1/SCHED_NR/nr_prach_procedures.c b/openair1/SCHED_NR/nr_prach_procedures.c index ad4204bdee..5ee397aa11 100644 --- a/openair1/SCHED_NR/nr_prach_procedures.c +++ b/openair1/SCHED_NR/nr_prach_procedures.c @@ -145,7 +145,8 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB, int frame, int slot, nfapi_nr_rac max_preamble_delay[0], gNB->prach_energy_counter); - if ((gNB->prach_energy_counter == 100) && (max_preamble_energy[0] > gNB->measurements.prach_I0 + gNB->prach_thres) + if ((gNB->prach_energy_counter == NUM_PRACH_RX_FOR_NOISE_ESTIMATE) + && (max_preamble_energy[0] > gNB->measurements.prach_I0 + gNB->prach_thres) && (rach_ind->number_of_pdus < MAX_NUM_NR_RX_RACH_PDUS)) { LOG_A(NR_PHY, "[RAPROC] %d.%d Initiating RA procedure with preamble %d, energy %d.%d dB (I0 %d, thres %d), delay %d start symbol " @@ -185,7 +186,8 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB, int frame, int slot, nfapi_nr_rac } gNB->measurements.prach_I0 = ((gNB->measurements.prach_I0*900)>>10) + ((max_preamble_energy[0]*124)>>10); if (frame==0) LOG_I(PHY,"prach_I0 = %d.%d dB\n",gNB->measurements.prach_I0/10,gNB->measurements.prach_I0%10); - if (gNB->prach_energy_counter < 100) gNB->prach_energy_counter++; + if (gNB->prach_energy_counter < NUM_PRACH_RX_FOR_NOISE_ESTIMATE) + gNB->prach_energy_counter++; } //if prach_id>0 rach_ind->slot = prach_start_slot; } // for NUMBER_OF_NR_PRACH_OCCASION_MAX diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index ab34ce551c..24bc3901ed 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -202,14 +202,16 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, slot_t slo nr_mac_update_timers(module_idP, frame, slot); - // This schedules MIB - schedule_nr_mib(module_idP, frame, slot, &sched_info->DL_req); + if (gNB->num_scheduled_prach_rx >= NUM_PRACH_RX_FOR_NOISE_ESTIMATE || get_softmodem_params()->phy_test) { + // This schedules MIB + schedule_nr_mib(module_idP, frame, slot, &sched_info->DL_req); - // This schedules SIB1 - // SIB19 will be scheduled if ntn_Config_r17 is initialized - if (IS_SA_MODE(get_softmodem_params())) { - schedule_nr_sib1(module_idP, frame, slot, &sched_info->DL_req, &sched_info->TX_req); - schedule_nr_other_sib(module_idP, frame, slot, &sched_info->DL_req, &sched_info->TX_req); + // This schedules SIB1 + // SIB19 will be scheduled if ntn_Config_r17 is initialized + if (IS_SA_MODE(get_softmodem_params())) { + schedule_nr_sib1(module_idP, frame, slot, &sched_info->DL_req, &sched_info->TX_req); + schedule_nr_other_sib(module_idP, frame, slot, &sched_info->DL_req, &sched_info->TX_req); + } } // This schedule PRACH if we are not in phy_test mode diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 017dc3cd4f..cb27fa4ae3 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -430,6 +430,7 @@ void schedule_nr_prach(module_id_t module_idP, frame_t frameP, slot_t slotP) } } if(td_index == 0) { + gNB->num_scheduled_prach_rx++; AssertFatal(UL_tti_req->n_pdus < sizeof(UL_tti_req->pdus_list) / sizeof(UL_tti_req->pdus_list[0]), "Invalid UL_tti_req->n_pdus %d\n", UL_tti_req->n_pdus); diff --git a/openair2/LAYER2/NR_MAC_gNB/main.c b/openair2/LAYER2/NR_MAC_gNB/main.c index 1d9bb3245d..acf0658e4c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/main.c +++ b/openair2/LAYER2/NR_MAC_gNB/main.c @@ -275,6 +275,7 @@ void mac_top_init_gNB(ngran_node_t node_type, RC.nrmac[i]->common_channels[0].pre_ServingCellConfig = scd; RC.nrmac[i]->first_MIB = true; + RC.nrmac[i]->num_scheduled_prach_rx = 0; RC.nrmac[i]->common_channels[0].mib = get_new_MIB_NR(scc); RC.nrmac[i]->cset0_bwp_start = 0; diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 0553464338..83802182e0 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -939,7 +939,7 @@ typedef struct gNB_MAC_INST_s { pthread_mutex_t sched_lock; mac_stats_t mac_stats; - + uint64_t num_scheduled_prach_rx; } gNB_MAC_INST; #endif /*__LAYER2_NR_MAC_GNB_H__ */