diff --git a/openair1/PHY/defs_nr_common.h b/openair1/PHY/defs_nr_common.h index 199877d738..2543eb6650 100644 --- a/openair1/PHY/defs_nr_common.h +++ b/openair1/PHY/defs_nr_common.h @@ -305,6 +305,29 @@ typedef struct { int32_t reserved; } prs_meas_t; +// Configuration parameters required for 5G Positioning +// TRP Cartesian Coordinate information +typedef struct trp_s { + // TRP id + uint32_t id; + // TRP x-axis value + uint32_t x_axis; + // TRP y-axis value + uint32_t y_axis; + // TRP z-axis value + uint32_t z_axis; + // 0 = mm, 1 = cm, 2 = dm + uint8_t unit; +} trp_t; + +#define MAX_NUM_TRPs 8 +typedef struct { + trp_t trps[MAX_NUM_TRPs]; + uint8_t num_trp; + // Serving gNB indicator + bool is_serving_gNB; +} positioning_config_t; + // rel16 prs k_prime table as per ts138.211 sec.7.4.1.7.2 #define K_PRIME_TABLE_ROW_SIZE 4 #define K_PRIME_TABLE_COL_SIZE 12 diff --git a/openair2/COMMON/positioning_nr_paramdef.h b/openair2/COMMON/positioning_nr_paramdef.h new file mode 100644 index 0000000000..6861db6778 --- /dev/null +++ b/openair2/COMMON/positioning_nr_paramdef.h @@ -0,0 +1,62 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#ifndef __POSITIONING_NR_PARAMDEF__H__ +#define __POSITIONING_NR_PARAMDEF__H__ + +/* Positioning configuration section names */ +#define CONFIG_STRING_POSITIONING_CONFIG "positioning_config" + +/* Global parameters */ + +/* TRP configuration parameters names */ +#define CONFIG_STRING_POSITIONING_NUM_TRPS "NumTRPs" +#define CONFIG_STRING_POSITIONING_TRP_IDS_LIST "TRPIDs" +#define CONFIG_STRING_POSITIONING_TRP_X_AXIS_LIST "TRPxAxis" +#define CONFIG_STRING_POSITIONING_TRP_Y_AXIS_LIST "TRPyAxis" +#define CONFIG_STRING_POSITIONING_TRP_Z_AXIS_LIST "TRPzAxis" +#define CONFIG_STRING_POSITIONING_TRP_UNIT_LIST "Units" + +/* Help string for Positioning parameters */ +#define HELP_STRING_POSITIONING_NUM_TRPS "Number of TRPs connected with gNB(max 4)\n" +#define HELP_STRING_POSITIONING_TRP_IDS_LIST "User defined IDs for each TRP \n" +#define HELP_STRING_POSITIONING_TRP_X_AXIS_LIST "x-axis value of each TRP \n" +#define HELP_STRING_POSITIONING_TRP_Y_AXIS_LIST "y-axis value of each TRP \n" +#define HELP_STRING_POSITIONING_TRP_Z_AXIS_LIST "z-axis value of each TRP \n" +#define HELP_STRING_POSITIONING_TRP_UNIT_LIST "XYZ unit value of each TRP \n" + +/*----------------------------------------------------------------------------------------------------------------------------------------------------------------*/ +/* TRP configuration parameters */ +/* optname helpstr paramflags XXXptr defXXXval type + * numelt */ +/*----------------------------------------------------------------------------------------------------------------------------------------------------------------*/ +// clang-format off +#define POSITIONING_PARAMS_DESC { \ + {CONFIG_STRING_POSITIONING_NUM_TRPS, HELP_STRING_POSITIONING_NUM_TRPS, 0, .uptr=NULL, .defuintval=0, TYPE_UINT, 0}, \ + {CONFIG_STRING_POSITIONING_TRP_IDS_LIST, HELP_STRING_POSITIONING_TRP_IDS_LIST, 0, .uptr=NULL, .defintarrayval=0, TYPE_UINTARRAY, 0}, \ + {CONFIG_STRING_POSITIONING_TRP_X_AXIS_LIST, HELP_STRING_POSITIONING_TRP_X_AXIS_LIST, 0, .uptr=NULL, .defintarrayval=0, TYPE_UINTARRAY, 0}, \ + {CONFIG_STRING_POSITIONING_TRP_Y_AXIS_LIST, HELP_STRING_POSITIONING_TRP_Y_AXIS_LIST, 0, .uptr=NULL, .defintarrayval=0, TYPE_UINTARRAY, 0}, \ + {CONFIG_STRING_POSITIONING_TRP_Z_AXIS_LIST, HELP_STRING_POSITIONING_TRP_Z_AXIS_LIST, 0, .uptr=NULL, .defintarrayval=0, TYPE_UINTARRAY, 0}, \ + {CONFIG_STRING_POSITIONING_TRP_UNIT_LIST, HELP_STRING_POSITIONING_TRP_UNIT_LIST, 0, .uptr=NULL, .defintarrayval=0, TYPE_UINTARRAY, 0}, \ +} +// clang-format on + +#endif diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index d6d370fe70..3262f851a5 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -80,6 +80,7 @@ #include "utils.h" #include "x2ap_messages_types.h" #include "gnb_config_common.h" +#include "positioning_nr_paramdef.h" static int DEFBANDS[] = {7}; static int DEFENBS[] = {0}; diff --git a/openair3/NRPPA/nrppa_gNB_config.c b/openair3/NRPPA/nrppa_gNB_config.c new file mode 100644 index 0000000000..dc0590f603 --- /dev/null +++ b/openair3/NRPPA/nrppa_gNB_config.c @@ -0,0 +1,84 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#include "nrppa_gNB_config.h" +#include "assertions.h" +#include "openair1/PHY/defs_nr_common.h" +#include "openair1/PHY/defs_gNB.h" +#include "common/ran_context.h" +#include "positioning_nr_paramdef.h" + +positioning_config_t RCconfig_nr_positioning(void) +{ + positioning_config_t positioning_config = {0}; + paramdef_t positioning_params_desc[] = POSITIONING_PARAMS_DESC; + int num_params = sizeofArray(positioning_params_desc); + GET_PARAMS_LIST(POSITIONING_ParamList, POSITIONING_Params, POSITIONING_PARAMS_DESC, CONFIG_STRING_POSITIONING_CONFIG, NULL); + + if (POSITIONING_ParamList.numelt > 0) { + paramdef_t *params = POSITIONING_ParamList.paramarray[0]; + + uint8_t num_trp = *gpd(params, num_params, CONFIG_STRING_POSITIONING_NUM_TRPS)->uptr; + if (num_trp == 0) { + LOG_E(NR_PHY, "No TRP configuration found..!!!\n"); + return positioning_config; + } else if (num_trp > MAX_NUM_TRPs) { + AssertFatal(false, "Exceeded MAX number of TRPs\n"); + } + + uint8_t num_ids = gpd(params, num_params, CONFIG_STRING_POSITIONING_TRP_IDS_LIST)->numelt; + uint8_t num_x = gpd(params, num_params, CONFIG_STRING_POSITIONING_TRP_X_AXIS_LIST)->numelt; + uint8_t num_y = gpd(params, num_params, CONFIG_STRING_POSITIONING_TRP_Y_AXIS_LIST)->numelt; + uint8_t num_z = gpd(params, num_params, CONFIG_STRING_POSITIONING_TRP_Z_AXIS_LIST)->numelt; + uint8_t num_unit = gpd(params, num_params, CONFIG_STRING_POSITIONING_TRP_UNIT_LIST)->numelt; + + if (num_trp != num_ids || num_trp != num_x || num_trp != num_y || num_trp != num_z || num_trp != num_unit) { + AssertFatal(false, "Mismatch in the number of TRPs with the number of ids, x-axis, y-axis, z-axis, units\n"); + } + + positioning_config.num_trp = num_trp; + for (int l = 0; l < num_trp; l++) { + positioning_config.trps[l].id = gpd(params, num_params, CONFIG_STRING_POSITIONING_TRP_IDS_LIST)->uptr[l]; + positioning_config.trps[l].x_axis = gpd(params, num_params, CONFIG_STRING_POSITIONING_TRP_X_AXIS_LIST)->uptr[l]; + positioning_config.trps[l].y_axis = gpd(params, num_params, CONFIG_STRING_POSITIONING_TRP_Y_AXIS_LIST)->uptr[l]; + positioning_config.trps[l].z_axis = gpd(params, num_params, CONFIG_STRING_POSITIONING_TRP_Z_AXIS_LIST)->uptr[l]; + positioning_config.trps[l].unit = gpd(params, num_params, CONFIG_STRING_POSITIONING_TRP_UNIT_LIST)->uptr[l]; + } + } else { + LOG_I(NR_PHY, "No " CONFIG_STRING_POSITIONING_CONFIG " configuration found..!!\n"); + } + return positioning_config; +} + +void dump_positioning_config(const positioning_config_t *positioning_config) +{ + uint8_t num_trp = positioning_config->num_trp; + LOG_I(NR_PHY, "-----------------------------------------\n"); + LOG_I(NR_PHY, "Positioning Config\n"); + LOG_I(NR_PHY, "-----------------------------------------\n"); + LOG_I(NR_PHY, "Number of TRPs \t\t%d\n", num_trp); + for (int i = 0; i < num_trp; i++) { + LOG_I(NR_PHY, "X-axis of TRP ID %d \t\t%d\n", positioning_config->trps[i].id, positioning_config->trps[i].x_axis); + LOG_I(NR_PHY, "Y-axis of TRP ID %d \t\t%d\n", positioning_config->trps[i].id, positioning_config->trps[i].y_axis); + LOG_I(NR_PHY, "Z-axis of TRP ID %d \t\t%d\n", positioning_config->trps[i].id, positioning_config->trps[i].z_axis); + } + LOG_I(NR_PHY, "-----------------------------------------\n"); +} diff --git a/openair3/NRPPA/nrppa_gNB_config.h b/openair3/NRPPA/nrppa_gNB_config.h new file mode 100644 index 0000000000..3ae710a62c --- /dev/null +++ b/openair3/NRPPA/nrppa_gNB_config.h @@ -0,0 +1,30 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#ifndef GNB_CONFIG_POSITIONING_H_ +#define GNB_CONFIG_POSITIONING_H_ + +#include "openair1/PHY/defs_nr_common.h" + +positioning_config_t RCconfig_nr_positioning(void); +void dump_positioning_config(const positioning_config_t *positioning_config); + +#endif /* GNB_CONFIG_POSITIONING_H_ */ diff --git a/tests/nr-cu-nrppa/nr-cu-nrppa.c b/tests/nr-cu-nrppa/nr-cu-nrppa.c index 1436b7cd27..2c29ce6258 100644 --- a/tests/nr-cu-nrppa/nr-cu-nrppa.c +++ b/tests/nr-cu-nrppa/nr-cu-nrppa.c @@ -27,6 +27,7 @@ #include "openair2/GNB_APP/gnb_config_ng.h" #include "openair2/GNB_APP/gnb_paramdef.h" #include "openair3/SCTP/sctp_default_values.h" +#include "openair3/NRPPA/nrppa_gNB_config.h" RAN_CONTEXT_t RC; THREAD_STRUCT thread_struct; diff --git a/tests/nr-cu-nrppa/nr-nrppa-test.conf b/tests/nr-cu-nrppa/nr-nrppa-test.conf index f5d6ea673a..aaaa45f176 100644 --- a/tests/nr-cu-nrppa/nr-nrppa-test.conf +++ b/tests/nr-cu-nrppa/nr-nrppa-test.conf @@ -38,6 +38,27 @@ gNBs = } ); +positioning_config = ( + { + NumTRPs = 4; # number of TRPs + TRPIDs = [1,2,3,4]; # userdefined distinct IDs + TRPxAxis = [71,21,10,45]; # X-axis value of each TRP + TRPyAxis = [11,22,62,14]; # Y-axis value of each TRP + TRPzAxis = [41,22,33,42]; # Z-axis value of each TRP + Units = [0, 0, 0, 0]; # 0 = mm, 1 = cm, 2 = dm + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + prach_dtx_threshold = 120; + pucch0_dtx_threshold = 150; + ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 + } +); + log_config : { global_log_level ="info";