NR UE: use shorter member names for position_t structure

This commit is contained in:
Thomas Schlichter
2025-06-20 11:18:59 +00:00
parent f1d612c01b
commit ece430b6c3
2 changed files with 12 additions and 20 deletions
+6 -6
View File
@@ -41,16 +41,16 @@
/*----------------------------------------------------------------------------------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------------------------------------------------------------------------------*/
// clang-format off // clang-format off
#define POSITION_CONFIG_PARAMS_DEF { \ #define POSITION_CONFIG_PARAMS_DEF { \
{CONFIG_STRING_POSITION_X, HELP_STRING_POSITION, 0, .dblptr=&(position->positionX), .defuintval=0, TYPE_DOUBLE, 0}, \ {CONFIG_STRING_POSITION_X, HELP_STRING_POSITION, 0, .dblptr=&(position->X), .defuintval=0, TYPE_DOUBLE, 0}, \
{CONFIG_STRING_POSITION_Y, HELP_STRING_POSITION, 0, .dblptr=&(position->positionY), .defuintval=0, TYPE_DOUBLE, 0}, \ {CONFIG_STRING_POSITION_Y, HELP_STRING_POSITION, 0, .dblptr=&(position->Y), .defuintval=0, TYPE_DOUBLE, 0}, \
{CONFIG_STRING_POSITION_Z, HELP_STRING_POSITION, 0, .dblptr=&(position->positionZ), .defuintval=0, TYPE_DOUBLE, 0} \ {CONFIG_STRING_POSITION_Z, HELP_STRING_POSITION, 0, .dblptr=&(position->Z), .defuintval=0, TYPE_DOUBLE, 0} \
} }
// clang-format on // clang-format on
typedef struct position { typedef struct position {
double positionX; double X;
double positionY; double Y;
double positionZ; double Z;
} position_t; } position_t;
void get_position_coordinates(int Mod_id, position_t *position); void get_position_coordinates(int Mod_id, position_t *position);
+6 -14
View File
@@ -272,30 +272,22 @@ static void calculate_ue_sat_ta(const position_t *position_params,
ntn_timing_advance_componets_t *ntn_ta) ntn_timing_advance_componets_t *ntn_ta)
{ {
// get UE position coordinates // get UE position coordinates
double pos_ue_x = position_params->positionX; const position_t pos_ue = *position_params;
double pos_ue_y = position_params->positionY;
double pos_ue_z = position_params->positionZ;
// get sat position coordinates // get sat position coordinates
double pos_sat_x = (double)sat_pos->positionX_r17 * 1.3; const position_t pos_sat = {sat_pos->positionX_r17 * 1.3, sat_pos->positionY_r17 * 1.3, sat_pos->positionZ_r17 * 1.3};
double pos_sat_y = (double)sat_pos->positionY_r17 * 1.3;
double pos_sat_z = (double)sat_pos->positionZ_r17 * 1.3;
// calculate directional vector from SAT to UE // calculate directional vector from SAT to UE
double dir_sat_ue_x = pos_ue_x - pos_sat_x; const position_t dir_sat_ue = {pos_ue.X - pos_sat.X, pos_ue.Y - pos_sat.Y, pos_ue.Z - pos_sat.Z};
double dir_sat_ue_y = pos_ue_y - pos_sat_y;
double dir_sat_ue_z = pos_ue_z - pos_sat_z;
// calculate distance between SAT and UE // calculate distance between SAT and UE
double distance = sqrt(dir_sat_ue_x * dir_sat_ue_x + dir_sat_ue_y * dir_sat_ue_y + dir_sat_ue_z * dir_sat_ue_z); double distance = sqrt(dir_sat_ue.X * dir_sat_ue.X + dir_sat_ue.Y * dir_sat_ue.Y + dir_sat_ue.Z * dir_sat_ue.Z);
// get sat velocity vector // get sat velocity vector
double vel_sat_x = (double)sat_pos->velocityVX_r17 * 0.06; const position_t vel_sat = {sat_pos->velocityVX_r17 * 0.06, sat_pos->velocityVY_r17 * 0.06, sat_pos->velocityVZ_r17 * 0.06};
double vel_sat_y = (double)sat_pos->velocityVY_r17 * 0.06;
double vel_sat_z = (double)sat_pos->velocityVZ_r17 * 0.06;
// calculate SAT velocity towards UE // calculate SAT velocity towards UE
double velocity = (vel_sat_x * dir_sat_ue_x + vel_sat_y * dir_sat_ue_y + vel_sat_z * dir_sat_ue_z) / distance; double velocity = (vel_sat.X * dir_sat_ue.X + vel_sat.Y * dir_sat_ue.Y + vel_sat.Z * dir_sat_ue.Z) / distance;
ntn_ta->N_UE_TA_adj = (2 * distance / SPEED_OF_LIGHT) * 1e3; // in ms ntn_ta->N_UE_TA_adj = (2 * distance / SPEED_OF_LIGHT) * 1e3; // in ms
ntn_ta->N_UE_TA_drift = (2 * -velocity / SPEED_OF_LIGHT) * 1e6; // in µs/s ntn_ta->N_UE_TA_drift = (2 * -velocity / SPEED_OF_LIGHT) * 1e6; // in µs/s