From 9b113d2cce9ce0836484fcc888d2936dd7a8551f Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Sun, 8 Oct 2023 18:45:25 +0200 Subject: [PATCH] Add configuration for phase compensation For 7.2 FH, some RUs do phase compensation, whereas for others, the DU does it. In fact, this can be "negotiated" using the M plane. Since we don't have the M plane yet, add a configuration option to set where phase compensation is performed. --- executables/nr-gnb.c | 2 +- openair1/PHY/defs_gNB.h | 4 ++++ openair1/SCHED_NR/phy_procedures_nr_gNB.c | 24 ++++++++++++----------- openair1/SIMULATION/NR_PHY/dlsim.c | 1 + openair2/GNB_APP/L1_nr_paramdef.h | 4 ++++ openair2/GNB_APP/gnb_config.c | 1 + 6 files changed, 24 insertions(+), 12 deletions(-) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index ef38a8ee1f..e6aa2e635a 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -235,7 +235,7 @@ void rx_func(void *param) L1_nr_prach_procedures(gNB,frame_rx,slot_rx); //WA: comment rotation in tx/rx - if((gNB->num_RU == 1) && (gNB->RU_list[0]->if_south != REMOTE_IF4p5)) { + if (gNB->phase_comp) { //apply the rx signal rotation here int soffset = (slot_rx & 3) * gNB->frame_parms.symbols_per_slot * gNB->frame_parms.ofdm_symbol_size; for (int aa = 0; aa < gNB->frame_parms.nb_antennas_rx; aa++) { diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index d66a1e4520..b5f830df19 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -604,6 +604,10 @@ typedef struct PHY_VARS_gNB_s { // reference amplitude for TX int16_t TX_AMP; + + // flag to activate 3GPP phase symbolwise rotation + bool phase_comp; + // PUCCH0 Look-up table for cyclic-shifts NR_gNB_PUCCH0_LUT_t pucch0_lut; diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index a31112c90d..47c0821b7d 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -221,18 +221,20 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx, // if ((frame&127) == 0) dump_pdsch_stats(gNB); //apply the OFDM symbol rotation here - for (aa=0; aacarrier_config.num_tx_ant.value; aa++) { - apply_nr_rotation_TX(fp, - &gNB->common_vars.txdataF[aa][txdataF_offset], - fp->symbol_rotation[0], - slot, - fp->N_RB_DL, - 0, - fp->Ncp == EXTENDED ? 12 : 14); + if (gNB->phase_comp) { + for (aa=0; aacarrier_config.num_tx_ant.value; aa++) { + apply_nr_rotation_TX(fp, + &gNB->common_vars.txdataF[aa][txdataF_offset], + fp->symbol_rotation[0], + slot, + fp->N_RB_DL, + 0, + fp->Ncp == EXTENDED ? 12 : 14); - T(T_GNB_PHY_DL_OUTPUT_SIGNAL, T_INT(0), - T_INT(frame), T_INT(slot), - T_INT(aa), T_BUFFER(&gNB->common_vars.txdataF[aa][txdataF_offset], fp->samples_per_slot_wCP*sizeof(int32_t))); + T(T_GNB_PHY_DL_OUTPUT_SIGNAL, T_INT(0), + T_INT(frame), T_INT(slot), + T_INT(aa), T_BUFFER(&gNB->common_vars.txdataF[aa][txdataF_offset], fp->samples_per_slot_wCP*sizeof(int32_t))); + } } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_TX + gNB->CC_id, 0); diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 8ce2e3f116..51da3088fa 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -610,6 +610,7 @@ int main(int argc, char **argv) gNB = RC.gNB[0]; gNB->ofdm_offset_divisor = UINT_MAX; gNB->ldpc_offload_flag = ldpc_offload_flag; + gNB->phase_comp = true; // we need to perform phase compensation, otherwise everything will fail 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; diff --git a/openair2/GNB_APP/L1_nr_paramdef.h b/openair2/GNB_APP/L1_nr_paramdef.h index dcd734847d..1b367ec064 100644 --- a/openair2/GNB_APP/L1_nr_paramdef.h +++ b/openair2/GNB_APP/L1_nr_paramdef.h @@ -58,6 +58,8 @@ #define HLP_TP_SIZ "thread_pool_size paramter removed, please use --thread-pool" #define CONFIG_STRING_L1_TX_AMP_BACKOFF_dB "tx_amp_backoff_dB" #define HLP_L1TX_BO "Backoff from full-scale output at the L1 entity(frequency domain), ex. 12 would corresponding to 14-bit input level (6 dB/bit). Default 36 dBFS for OAI RU entity" +#define CONFIG_STRING_L1_PHASE_COMP "phase_compensation" +#define HLP_L1_PHASE_COMP "Apply NR symbolwise phase rotation" /*----------------------------------------------------------------------------------------------------------------------------------------------------*/ /* L1 configuration parameters */ /* optname helpstr paramflags XXXptr defXXXval type numelt */ @@ -83,6 +85,7 @@ {CONFIG_STRING_L1_RX_THREAD_CORE, NULL, 0, .uptr=NULL, .defintval=-1, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_TX_THREAD_CORE, NULL, 0, .uptr=NULL, .defintval=-1, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_TX_AMP_BACKOFF_dB, HLP_L1TX_BO,0, .uptr=NULL, .defintval=36, TYPE_UINT, 0}, \ + {CONFIG_STRING_L1_PHASE_COMP, HLP_L1_PHASE_COMP,PARAMFLAG_BOOL, .uptr=NULL,.defintval=1, TYPE_UINT, 0}, \ } // clang-format on #define L1_CC_IDX 0 @@ -104,6 +107,7 @@ #define L1_RX_THREAD_CORE 16 #define L1_TX_THREAD_CORE 17 #define L1_TX_AMP_BACKOFF_dB 18 +#define L1_PHASE_COMP 19 /*----------------------------------------------------------------------------------------------------------------------------------------------------*/ #endif diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index d2e384fcb1..61af471e9d 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -885,6 +885,7 @@ void RCconfig_NR_L1(void) RC.gNB[j]->L1_tx_thread_core = *(L1_ParamList.paramarray[j][L1_TX_THREAD_CORE].iptr); LOG_I(PHY,"L1_RX_THREAD_CORE %d (%d)\n",*(L1_ParamList.paramarray[j][L1_RX_THREAD_CORE].iptr),L1_RX_THREAD_CORE); RC.gNB[j]->TX_AMP = (int16_t)(32767.0 / pow(10.0, .05 * (double)(*L1_ParamList.paramarray[j][L1_TX_AMP_BACKOFF_dB].uptr))); + RC.gNB[j]->phase_comp = *L1_ParamList.paramarray[j][L1_PHASE_COMP].uptr; LOG_I(PHY, "TX_AMP = %d (-%d dBFS)\n", RC.gNB[j]->TX_AMP, *L1_ParamList.paramarray[j][L1_TX_AMP_BACKOFF_dB].uptr); AssertFatal(RC.gNB[j]->TX_AMP > 300, "TX_AMP is too small, must be larger than 300 (is %d)\n", RC.gNB[j]->TX_AMP); if (strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "local_mac") == 0) {