From 656a87bb8a5f5d13c5e1469d05bc14af6f7f5668 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Fri, 27 Sep 2024 12:08:55 +0200 Subject: [PATCH 1/9] gNB: make sure not to write behind end of prach_pdu_indication_list in L1_nr_prach_procedures() --- openair1/SCHED_NR/nr_prach_procedures.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openair1/SCHED_NR/nr_prach_procedures.c b/openair1/SCHED_NR/nr_prach_procedures.c index dd77115817..426b25638d 100644 --- a/openair1/SCHED_NR/nr_prach_procedures.c +++ b/openair1/SCHED_NR/nr_prach_procedures.c @@ -151,7 +151,8 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot) { 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 == 100) && (max_preamble_energy[0] > gNB->measurements.prach_I0 + gNB->prach_thres) + && (pdu_index < MAX_NUM_NR_RX_RACH_PDUS)) { LOG_I(NR_PHY, "[RAPROC] %d.%d Initiating RA procedure with preamble %d, energy %d.%d dB (I0 %d, thres %d), delay %d start symbol " "%u freq index %u\n", From 0ecf35de8495bca316a2da97c38aa5bb433ab842 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Fri, 27 Sep 2024 12:11:00 +0200 Subject: [PATCH 2/9] gNB: print error message if PRACH resources are already occupied in schedule_nr_prach() --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 160cde63f5..50c71b3c08 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -435,8 +435,12 @@ void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP const int16_t n_ra_rb = get_N_RA_RB(cfg->prach_config.prach_sub_c_spacing.value, mu_pusch); index = ul_buffer_index(frameP, slotP, mu, gNB->vrb_map_UL_size); uint16_t *vrb_map_UL = &cc->vrb_map_UL[beam.idx][index * MAX_BWP_SIZE]; - for (int i = 0; i < n_ra_rb * fdm; ++i) + for (int i = 0; i < n_ra_rb * fdm; ++i) { + AssertFatal( + !(vrb_map_UL[bwp_start + rach_ConfigGeneric->msg1_FrequencyStart + i] & SL_to_bitmap(start_symbol, N_t_slot * N_dur)), + "PRACH resources are already occupied!\n"); vrb_map_UL[bwp_start + rach_ConfigGeneric->msg1_FrequencyStart + i] |= SL_to_bitmap(start_symbol, N_t_slot * N_dur); + } } } } From 64380eaca2add4f4b6b4d4af6211ed53267651f0 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Fri, 27 Sep 2024 12:13:52 +0200 Subject: [PATCH 3/9] gNB: consider NTN_Koffset when scheduling PRACH --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index ad18ead1f4..03119052f8 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -274,7 +274,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, sub_frame_ slot, because otherwise we would allocate the current slot in UL_tti_req_ahead), but be aware that, e.g., K2 is allowed to be larger (schedule_nr_prach will assert if resources are not free). */ - const sub_frame_t n_slots_ahead = nr_slots_per_frame[*scc->ssbSubcarrierSpacing] - 1; + const sub_frame_t n_slots_ahead = nr_slots_per_frame[*scc->ssbSubcarrierSpacing] - 1 + get_NTN_Koffset(scc); const frame_t f = (frame + (slot + n_slots_ahead) / nr_slots_per_frame[*scc->ssbSubcarrierSpacing]) % 1024; const sub_frame_t s = (slot + n_slots_ahead) % nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; schedule_nr_prach(module_idP, f, s); From 791cc4f64803d22eb0352b376906c9724078485e Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Fri, 27 Sep 2024 12:19:25 +0200 Subject: [PATCH 4/9] NR UE: set time sync PI controller integral weight to 0.0 by default Experiments did show that the time sync is less stable in terrestrial mode if the integral part of the PI controller is used. So set it to 0.0 by default. For NTN LEO use case we can still use it by providing the command line parameter --time-sync-I 0.2 . fixes #846 --- doc/RUNMODEM.md | 2 +- executables/nr-ue.c | 6 +++++- executables/nr-uesoftmodem.h | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/doc/RUNMODEM.md b/doc/RUNMODEM.md index 1bc6268199..fef128e2f7 100644 --- a/doc/RUNMODEM.md +++ b/doc/RUNMODEM.md @@ -298,7 +298,7 @@ Also, to perform an autonomous TA update based on the DL drift, the boolean para So an example NR UE command for FDD, 5MHz BW, 15 kHz SCS, transparent LEO satellite 5G NR NTN is this: ``` cd cmake_targets -sudo ./ran_build/build/nr-uesoftmodem --band 66 -C 2152680000 --CO -400000000 -r 25 --numerology 0 --ssb 48 --sa --rfsim --rfsimulator.prop_delay 20 --rfsimulator.options chanmod -O ../targets/PROJECTS/GENERIC-NR-5GC/CONF/channelmod_rfsimu_LEO_satellite.conf --ntn-koffset 40 --ntn-ta-common 37.74 --ntn-ta-commondrift -50 --autonomous-ta +sudo ./ran_build/build/nr-uesoftmodem --band 66 -C 2152680000 --CO -400000000 -r 25 --numerology 0 --ssb 48 --sa --rfsim --rfsimulator.prop_delay 20 --rfsimulator.options chanmod -O ../targets/PROJECTS/GENERIC-NR-5GC/CONF/channelmod_rfsimu_LEO_satellite.conf --time-sync-I 0.2 --ntn-koffset 40 --ntn-ta-common 37.74 --ntn-ta-commondrift -50 --autonomous-ta ``` # Specific OAI modes diff --git a/executables/nr-ue.c b/executables/nr-ue.c index a742ea2e9d..d26547b14b 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -883,7 +883,11 @@ void *UE_thread(void *arg) stream_status = STREAM_STATUS_SYNCING; syncInFrame(UE, &sync_timestamp, intialSyncOffset); openair0_write_reorder_clear_context(&UE->rfdevice); - UE->max_pos_acc = get_nrUE_params()->ntn_ta_commondrift * 1e-6 * fp->samples_per_frame / get_nrUE_params()->time_sync_I; // ntn_ta_commondrift is in µs/s, max_pos_acc * time_sync_I is in samples/frame + if (get_nrUE_params()->time_sync_I) + // ntn_ta_commondrift is in µs/s, max_pos_acc * time_sync_I is in samples/frame + UE->max_pos_acc = get_nrUE_params()->ntn_ta_commondrift * 1e-6 * fp->samples_per_frame / get_nrUE_params()->time_sync_I; + else + UE->max_pos_acc = 0; shiftForNextFrame = -(UE->init_sync_frame + trashed_frames + 2) * UE->max_pos_acc * get_nrUE_params()->time_sync_I; // compensate for the time drift that happened during initial sync LOG_D(PHY, "max_pos_acc = %d, shiftForNextFrame = %d\n", UE->max_pos_acc, shiftForNextFrame); // TODO: remove this autonomous TA and use up-to-date values of ta-Common, ta-CommonDrift and ta-CommonDriftVariant from received SIB19 instead diff --git a/executables/nr-uesoftmodem.h b/executables/nr-uesoftmodem.h index 797b5d8f49..65327cc3b2 100644 --- a/executables/nr-uesoftmodem.h +++ b/executables/nr-uesoftmodem.h @@ -65,7 +65,7 @@ {"SLC", CONFIG_HLP_SLF, 0, .u64ptr=&(sidelink_frequency[0][0]), .defuintval=2600000000,TYPE_UINT64,0}, \ {"num-ues", NULL, 0, .iptr=&(NB_UE_INST), .defuintval=1, TYPE_INT, 0}, \ {"time-sync-P", CONFIG_HLP_TIME_SYNC_P, 0, .dblptr=&(nrUE_params.time_sync_P), .defdblval=0.5, TYPE_DOUBLE, 0}, \ - {"time-sync-I", CONFIG_HLP_TIME_SYNC_I, 0, .dblptr=&(nrUE_params.time_sync_I), .defdblval=0.2, TYPE_DOUBLE, 0}, \ + {"time-sync-I", CONFIG_HLP_TIME_SYNC_I, 0, .dblptr=&(nrUE_params.time_sync_I), .defdblval=0.0, TYPE_DOUBLE, 0}, \ {"ntn-koffset", CONFIG_HLP_NTN_KOFFSET, 0, .uptr=&(nrUE_params.ntn_koffset), .defuintval=0, TYPE_UINT, 0}, \ {"ntn-ta-common", CONFIG_HLP_NTN_TA_COMMON, 0, .dblptr=&(nrUE_params.ntn_ta_common), .defdblval=0.0, TYPE_DOUBLE, 0}, \ {"ntn-ta-commondrift", CONFIG_HLP_NTN_TA_COMMONDRIFT, 0, .dblptr=&(nrUE_params.ntn_ta_commondrift), .defdblval=0.0, TYPE_DOUBLE, 0}, \ From b0eedd3bbd28c5f7b9177b36f1327456fb39c773 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Fri, 27 Sep 2024 12:26:01 +0200 Subject: [PATCH 5/9] gNB: fix a comment - current TA interval is 100 frames, not 10 --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 334c263501..7a93586378 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -980,7 +980,7 @@ void nr_schedule_ue_spec(module_id_t module_id, UE->mac_stats.dl.current_bytes = 0; UE->mac_stats.dl.current_rbs = 0; - /* update TA and set ta_apply every 10 frames. + /* update TA and set ta_apply every 100 frames. * Possible improvement: take the periodicity from input file. * If such UE is not scheduled now, it will be by the preprocessor later. * If we add the CE, ta_apply will be reset */ From d9940b1bc430c1f653b8f75f0c80cdf3de965835 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Fri, 27 Sep 2024 12:28:02 +0200 Subject: [PATCH 6/9] NR UE: fix logical error in nr_ue_process_dci_dl_10() Fixing this avoids the theoretical possibility of dereferencing a NULL pointer. --- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index ccfa861587..28f485312a 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -685,7 +685,7 @@ static int nr_ue_process_dci_dl_10(NR_UE_MAC_INST_t *mac, dlsch_pdu->pduBitmap = 0; NR_UE_DL_BWP_t *current_DL_BWP = mac->current_DL_BWP; - NR_PDSCH_Config_t *pdsch_config = (current_DL_BWP || !mac->get_sib1) ? current_DL_BWP->pdsch_Config : NULL; + NR_PDSCH_Config_t *pdsch_config = (current_DL_BWP && !mac->get_sib1) ? current_DL_BWP->pdsch_Config : NULL; if (dci_ind->ss_type == NR_SearchSpace__searchSpaceType_PR_common) { dlsch_pdu->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs ? mac->type0_PDCCH_CSS_config.num_rbs : mac->sc_info.initial_dl_BWPSize; From 60ca088e51318bc5a248d1d292324fb048a824b9 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Fri, 27 Sep 2024 14:35:17 +0200 Subject: [PATCH 7/9] gNB: respect config value dl_max_mcs also in case of harq_round_max == 1 --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 7a93586378..d6829c1ba2 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -684,7 +684,7 @@ static void pf_dl(module_id_t module_id, const int max_mcs_table = current_BWP->mcsTableIdx == 1 ? 27 : 28; const int max_mcs = min(sched_ctrl->dl_max_mcs, max_mcs_table); if (bo->harq_round_max == 1) - sched_pdsch->mcs = max_mcs; + sched_pdsch->mcs = min(bo->max_mcs, max_mcs); else sched_pdsch->mcs = get_mcs_from_bler(bo, stats, &sched_ctrl->dl_bler_stats, max_mcs, frame); sched_pdsch->nrOfLayers = get_dl_nrOfLayers(sched_ctrl, current_BWP->dci_format); From 9f8a2573ee14a5897f04426396ded49c6090b767 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Fri, 27 Sep 2024 14:38:28 +0200 Subject: [PATCH 8/9] gNB: update DL and UL bler_stats.mcs for logging also in case of harq_round_max == 1 --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 5 +++-- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index d6829c1ba2..96e0e54827 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -683,9 +683,10 @@ static void pf_dl(module_id_t module_id, const NR_bler_options_t *bo = &mac->dl_bler; const int max_mcs_table = current_BWP->mcsTableIdx == 1 ? 27 : 28; const int max_mcs = min(sched_ctrl->dl_max_mcs, max_mcs_table); - if (bo->harq_round_max == 1) + if (bo->harq_round_max == 1) { sched_pdsch->mcs = min(bo->max_mcs, max_mcs); - else + sched_ctrl->dl_bler_stats.mcs = sched_pdsch->mcs; + } else sched_pdsch->mcs = get_mcs_from_bler(bo, stats, &sched_ctrl->dl_bler_stats, max_mcs, frame); sched_pdsch->nrOfLayers = get_dl_nrOfLayers(sched_ctrl, current_BWP->dci_format); sched_pdsch->pm_index = diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index d091d486ff..596c293ebd 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -1848,9 +1848,10 @@ static void pf_ul(module_id_t module_id, const NR_bler_options_t *bo = &nrmac->ul_bler; const int max_mcs_table = (current_BWP->mcs_table == 0 || current_BWP->mcs_table == 2) ? 28 : 27; const int max_mcs = min(bo->max_mcs, max_mcs_table); /* no per-user maximum MCS yet */ - if (bo->harq_round_max == 1) + if (bo->harq_round_max == 1) { sched_pusch->mcs = max_mcs; - else { + sched_ctrl->ul_bler_stats.mcs = sched_pusch->mcs; + } else { sched_pusch->mcs = get_mcs_from_bler(bo, stats, &sched_ctrl->ul_bler_stats, max_mcs, frame); LOG_D(NR_MAC,"%d.%d starting mcs %d bleri %f\n",frame,slot,sched_pusch->mcs,sched_ctrl->ul_bler_stats.bler); } From 60c2b3fe00b12880209d3d26db2df40c6f1c63f7 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Fri, 27 Sep 2024 14:58:18 +0200 Subject: [PATCH 9/9] nrscope: fix label on gNB scope - it is NR not LTE ;-) --- openair1/PHY/TOOLS/nr_phy_scope.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair1/PHY/TOOLS/nr_phy_scope.c b/openair1/PHY/TOOLS/nr_phy_scope.c index c6a9b796c0..a661fb892b 100644 --- a/openair1/PHY/TOOLS/nr_phy_scope.c +++ b/openair1/PHY/TOOLS/nr_phy_scope.c @@ -686,7 +686,7 @@ STATICFORXSCOPE OAI_phy_scope_t *create_phy_scope_gnb(void) fl_end_form( ); if (fdui->phy_scope) fdui->phy_scope->fdui = fdui; - fl_show_form (fdui->phy_scope, FL_PLACE_HOTSPOT, FL_FULLBORDER, "LTE UL SCOPE gNB"); + fl_show_form (fdui->phy_scope, FL_PLACE_HOTSPOT, FL_FULLBORDER, "NR UL SCOPE gNB"); return fdui; }