Commit 06c0374e authored by Roberto Rosca's avatar Roberto Rosca

Added UE support for position coordinates taken from conf files

parent 054506f5
...@@ -2079,6 +2079,7 @@ add_executable(nr-uesoftmodem ...@@ -2079,6 +2079,7 @@ add_executable(nr-uesoftmodem
${rrc_h} ${rrc_h}
${s1ap_h} ${s1ap_h}
${OPENAIR_DIR}/executables/nr-uesoftmodem.c ${OPENAIR_DIR}/executables/nr-uesoftmodem.c
${OPENAIR_DIR}/executables/position_interface.c
${OPENAIR_DIR}/executables/nr-ue.c ${OPENAIR_DIR}/executables/nr-ue.c
${OPENAIR_DIR}/executables/softmodem-common.c ${OPENAIR_DIR}/executables/softmodem-common.c
${OPENAIR_DIR}/radio/COMMON/common_lib.c ${OPENAIR_DIR}/radio/COMMON/common_lib.c
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include "PHY/MODULATION/nr_modulation.h" #include "PHY/MODULATION/nr_modulation.h"
#include "instrumentation.h" #include "instrumentation.h"
#include "common/utils/threadPool/notified_fifo.h" #include "common/utils/threadPool/notified_fifo.h"
#include "position_interface.h"
/* /*
* NR SLOT PROCESSING SEQUENCE * NR SLOT PROCESSING SEQUENCE
...@@ -157,6 +158,7 @@ void init_nr_ue_vars(PHY_VARS_NR_UE *ue, uint8_t UE_id) ...@@ -157,6 +158,7 @@ void init_nr_ue_vars(PHY_VARS_NR_UE *ue, uint8_t UE_id)
ue->target_Nid_cell = -1; ue->target_Nid_cell = -1;
ue->timing_advance = ue->frame_parms.samples_per_subframe * get_nrUE_params()->ntn_ta_common; ue->timing_advance = ue->frame_parms.samples_per_subframe * get_nrUE_params()->ntn_ta_common;
check_position(UE_id);
// initialize all signal buffers // initialize all signal buffers
init_nr_ue_signal(ue, nb_connected_gNB); init_nr_ue_signal(ue, nb_connected_gNB);
......
#include "position_interface.h"
extern uint16_t NB_UE_INST;
static position_t **positionArray = 0;
position_t *check_position(int Mod_id)
{
AssertFatal(Mod_id < NB_UE_INST, "Mod_id must be less than NB_UE_INST. Mod_id:%d NB_UE_INST:%d", Mod_id, NB_UE_INST);
if (positionArray == NULL) {
positionArray = (position_t **)calloc(1, sizeof(position_t *) * NB_UE_INST);
}
if (!positionArray[Mod_id]) {
char positionName[64];
sprintf(positionName, "position%d", Mod_id);
positionArray[Mod_id] = (void *)init_position(positionName);
}
return (position_t *)positionArray[Mod_id];
}
position_t *init_position(char *sectionName)
{
position_t *position = (position_t *)calloc(sizeof(position_t), 1);
paramdef_t position_params[] = POSITION_CONFIG_PARAMS_DEF;
int ret = config_get(config_get_if(), position_params, sizeofArray(position_params), sectionName);
AssertFatal(ret >= 0, "configuration couldn't be performed for position name: %s", sectionName);
return position;
}
position_t *get_position(int Mod_id)
{
return positionArray[Mod_id];
}
\ No newline at end of file
#ifndef __POSITION_INTERFACE__H__
#define __POSITION_INTERFACE__H__
#include <executables/nr-softmodem-common.h>
#include <executables/softmodem-common.h>
#include "PHY/defs_nr_UE.h"
#include "executables/nr-uesoftmodem.h"
/* position configuration parameters name */
#define CONFIG_STRING_POSITION_X "x"
#define CONFIG_STRING_POSITION_Y "y"
#define CONFIG_STRING_POSITION_Z "z"
#define HELP_STRING_POSITION "Postion coordinates (x, y, z) config params"
// Position parameters config
/*----------------------------------------------------------------------------------------------------------------------------------------------------*/
/* position configuration parameters */
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/*----------------------------------------------------------------------------------------------------------------------------------------------------*/
// clang-format off
#define POSITION_CONFIG_PARAMS_DEF { \
{CONFIG_STRING_POSITION_X, HELP_STRING_POSITION, 0, .dblptr=&(position->positionX), .defuintval=0, TYPE_DOUBLE, 0}, \
{CONFIG_STRING_POSITION_Y, HELP_STRING_POSITION, 0, .dblptr=&(position->positionY), .defuintval=0, TYPE_DOUBLE, 0}, \
{CONFIG_STRING_POSITION_Z, HELP_STRING_POSITION, 0, .dblptr=&(position->positionZ), .defuintval=0, TYPE_DOUBLE, 0} \
}
// clang-format on
typedef struct {
double positionX;
double positionY;
double positionZ;
} position_t;
position_t *check_position(int Mod_id);
position_t *init_position(char *sectionName);
position_t *get_position(int Mod_id);
#endif
\ No newline at end of file
...@@ -41,10 +41,14 @@ ...@@ -41,10 +41,14 @@
#include <executables/softmodem-common.h> #include <executables/softmodem-common.h>
#include "openair2/LAYER2/RLC/rlc.h" #include "openair2/LAYER2/RLC/rlc.h"
#include "nr-uesoftmodem.h"
static double get_ta_Common_ms(NR_NTN_Config_r17_t *ntn_Config_r17) static double get_ta_Common_ms(NR_NTN_Config_r17_t *ntn_Config_r17)
{ {
if (ntn_Config_r17 && ntn_Config_r17->ta_Info_r17) if (ntn_Config_r17 && ntn_Config_r17->ta_Info_r17) {
return ntn_Config_r17->ta_Info_r17->ta_Common_r17 * 4.072e-6; // ta_Common_r17 is in units of 4.072e-3 µs // ta_Common_r17 is in units of 4.072e-3 µs
return (ntn_Config_r17->ta_Info_r17->ta_Common_r17 * 4.072e-6 + get_nrUE_params()->ntn_ta_common) * 2;
}
return 0.0; return 0.0;
} }
......
...@@ -6,3 +6,9 @@ dnn= "oai"; ...@@ -6,3 +6,9 @@ dnn= "oai";
nssai_sst=1; nssai_sst=1;
nssai_sd=1; nssai_sd=1;
} }
position0 = {
x = 0.0;
y = 0.0;
z = 6371400.0;
}
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment