From 727a9aeac86c8251332e007931cc5923833b4490 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Mon, 9 Oct 2023 14:05:23 +0200 Subject: [PATCH 1/2] Remove unnecessary include --- src/environment/global/earth_rotation.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/environment/global/earth_rotation.hpp b/src/environment/global/earth_rotation.hpp index 768104520..09fa509a8 100644 --- a/src/environment/global/earth_rotation.hpp +++ b/src/environment/global/earth_rotation.hpp @@ -9,7 +9,6 @@ #ifndef S2E_ENVIRONMENT_GLOBAL_EARTH_ROTATION_HPP_ #define S2E_ENVIRONMENT_GLOBAL_EARTH_ROTATION_HPP_ -#include "library/logger/loggable.hpp" #include "library/math/matrix.hpp" /** From f0b6590a638c0d170e9f6a932b912f15de0aef06 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Mon, 9 Oct 2023 14:09:02 +0200 Subject: [PATCH 2/2] Modify xcxf --- src/disturbances/air_drag.cpp | 2 +- src/disturbances/geopotential.cpp | 2 +- src/disturbances/lunar_gravity_field.cpp | 2 +- src/dynamics/orbit/orbit.cpp | 2 +- src/environment/global/earth_rotation.cpp | 10 +++++----- src/environment/global/earth_rotation.hpp | 16 ++++++++-------- src/simulation/ground_station/ground_station.cpp | 2 +- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/disturbances/air_drag.cpp b/src/disturbances/air_drag.cpp index 4548ebb87..df23967a7 100644 --- a/src/disturbances/air_drag.cpp +++ b/src/disturbances/air_drag.cpp @@ -27,7 +27,7 @@ void AirDrag::Update(const LocalEnvironment& local_environment, const Dynamics& double air_density_kg_m3 = local_environment.GetAtmosphere().GetAirDensity_kg_m3(); libra::Matrix<3, 3> dcm_ecef2eci = - local_environment.GetCelestialInformation().GetGlobalInformation().GetEarthRotation().GetDcmJ2000ToXcxf().Transpose(); + local_environment.GetCelestialInformation().GetGlobalInformation().GetEarthRotation().GetDcmJ2000ToEcef().Transpose(); libra::Vector<3> relative_velocity_wrt_atmosphere_i_m_s = dcm_ecef2eci * dynamics.GetOrbit().GetVelocity_ecef_m_s(); libra::Quaternion quaternion_i2b = dynamics.GetAttitude().GetQuaternion_i2b(); libra::Vector<3> velocity_b_m_s = quaternion_i2b.FrameConversion(relative_velocity_wrt_atmosphere_i_m_s); diff --git a/src/disturbances/geopotential.cpp b/src/disturbances/geopotential.cpp index 38b10ba89..39b3e4300 100644 --- a/src/disturbances/geopotential.cpp +++ b/src/disturbances/geopotential.cpp @@ -83,7 +83,7 @@ void Geopotential::Update(const LocalEnvironment &local_environment, const Dynam UNUSED(time_ms_); #endif - libra::Matrix<3, 3> trans_eci2ecef_ = local_environment.GetCelestialInformation().GetGlobalInformation().GetEarthRotation().GetDcmJ2000ToXcxf(); + libra::Matrix<3, 3> trans_eci2ecef_ = local_environment.GetCelestialInformation().GetGlobalInformation().GetEarthRotation().GetDcmJ2000ToEcef(); libra::Matrix<3, 3> trans_ecef2eci = trans_eci2ecef_.Transpose(); acceleration_i_m_s2_ = trans_ecef2eci * acceleration_ecef_m_s2_; } diff --git a/src/disturbances/lunar_gravity_field.cpp b/src/disturbances/lunar_gravity_field.cpp index 1b4bc22c5..335a0db3c 100644 --- a/src/disturbances/lunar_gravity_field.cpp +++ b/src/disturbances/lunar_gravity_field.cpp @@ -103,7 +103,7 @@ void LunarGravityField::Update(const LocalEnvironment &local_environment, const #endif libra::Matrix<3, 3> trans_eci2mcmf_ = - local_environment.GetCelestialInformation().GetGlobalInformation().GetEarthRotation().GetDcmJ2000ToXcxf(); // FIXME: use moon rotation + local_environment.GetCelestialInformation().GetGlobalInformation().GetEarthRotation().GetDcmJ2000ToEcef(); // FIXME: use moon rotation libra::Matrix<3, 3> trans_mcmf2eci = trans_eci2mcmf_.Transpose(); acceleration_i_m_s2_ = trans_mcmf2eci * acceleration_mcmf_m_s2_; } diff --git a/src/dynamics/orbit/orbit.cpp b/src/dynamics/orbit/orbit.cpp index bb5ce10c9..863fc73e7 100644 --- a/src/dynamics/orbit/orbit.cpp +++ b/src/dynamics/orbit/orbit.cpp @@ -29,7 +29,7 @@ libra::Quaternion Orbit::CalcQuaternion_i2lvlh() const { } void Orbit::TransformEciToEcef(void) { - libra::Matrix<3, 3> dcm_i_to_xcxf = celestial_information_->GetEarthRotation().GetDcmJ2000ToXcxf(); + libra::Matrix<3, 3> dcm_i_to_xcxf = celestial_information_->GetEarthRotation().GetDcmJ2000ToEcef(); spacecraft_position_ecef_m_ = dcm_i_to_xcxf * spacecraft_position_i_m_; // convert velocity vector in ECI to the vector in ECEF diff --git a/src/environment/global/earth_rotation.cpp b/src/environment/global/earth_rotation.cpp index d499bb221..cb25d6bfd 100644 --- a/src/environment/global/earth_rotation.cpp +++ b/src/environment/global/earth_rotation.cpp @@ -17,8 +17,8 @@ // Default constructor EarthRotation::EarthRotation(const EarthRotationMode rotation_mode) : rotation_mode_(rotation_mode) { - dcm_j2000_to_xcxf_ = libra::MakeIdentityMatrix<3>(); - dcm_teme_to_xcxf_ = dcm_j2000_to_xcxf_; + dcm_j2000_to_ecef_ = libra::MakeIdentityMatrix<3>(); + dcm_teme_to_ecef_ = dcm_j2000_to_ecef_; InitializeParameters(); } @@ -105,7 +105,7 @@ void EarthRotation::InitializeParameters() { c_z_rad_[2] = 0.018203 * libra::arcsec_to_rad; // [rad/century^3] } else { // If the rotation mode is neither Simple nor Full, disable the rotation calculation and make the DCM a unit matrix - dcm_j2000_to_xcxf_ = libra::MakeIdentityMatrix<3>(); + dcm_j2000_to_ecef_ = libra::MakeIdentityMatrix<3>(); } } @@ -143,11 +143,11 @@ void EarthRotation::Update(const double julian_date) { dcm_polar_motion = PolarMotion(x_p, y_p); // Total orientation - dcm_j2000_to_xcxf_ = dcm_polar_motion * dcm_rotation * dcm_nutation * dcm_precession; + dcm_j2000_to_ecef_ = dcm_polar_motion * dcm_rotation * dcm_nutation * dcm_precession; } else if (rotation_mode_ == EarthRotationMode::kSimple) { // In this case, only Axial Rotation is executed, with its argument replaced from G'A'ST to G'M'ST // FIXME: Not suitable when the center body is not the earth - dcm_j2000_to_xcxf_ = AxialRotation(gmst_rad); + dcm_j2000_to_ecef_ = AxialRotation(gmst_rad); } else { // Leave the DCM as unit Matrix(diag{1,1,1}) return; diff --git a/src/environment/global/earth_rotation.hpp b/src/environment/global/earth_rotation.hpp index 09fa509a8..c6adaa685 100644 --- a/src/environment/global/earth_rotation.hpp +++ b/src/environment/global/earth_rotation.hpp @@ -42,23 +42,23 @@ class EarthRotation { void Update(const double julian_date); /** - * @fn GetDcmJ2000ToXcxf - * @brief Return the DCM between J2000 inertial frame and the frame of fixed to the target object X (X-Centered X-Fixed) + * @fn GetDcmJ2000ToEcef + * @brief Return the DCM between J2000 inertial frame and the Earth Centered Earth Fixed frame */ - inline const libra::Matrix<3, 3> GetDcmJ2000ToXcxf() const { return dcm_j2000_to_xcxf_; }; + inline const libra::Matrix<3, 3> GetDcmJ2000ToEcef() const { return dcm_j2000_to_ecef_; }; /** - * @fn GetDcmTemeToXcxf - * @brief Return the DCM between TEME (Inertial frame used in SGP4) and the frame of fixed to the target object X (X-Centered X-Fixed) + * @fn GetDcmTemeToEcef + * @brief Return the DCM between TEME (Inertial frame used in SGP4) and the Earth Centered Earth Fixed frame */ - inline const libra::Matrix<3, 3> GetDcmTemeToXcxf() const { return dcm_teme_to_xcxf_; }; + inline const libra::Matrix<3, 3> GetDcmTemeToEcef() const { return dcm_teme_to_ecef_; }; private: double d_psi_rad_; //!< Nutation in obliquity [rad] double d_epsilon_rad_; //!< Nutation in longitude [rad] double epsilon_rad_; //!< Mean obliquity of the ecliptic [rad] - libra::Matrix<3, 3> dcm_j2000_to_xcxf_; //!< Direction Cosine Matrix J2000 to XCXF(X-Centered X-Fixed) - libra::Matrix<3, 3> dcm_teme_to_xcxf_; //!< Direction Cosine Matrix TEME to XCXF(X-Centered X-Fixed) + libra::Matrix<3, 3> dcm_j2000_to_ecef_; //!< Direction Cosine Matrix J2000 to ECEF + libra::Matrix<3, 3> dcm_teme_to_ecef_; //!< Direction Cosine Matrix TEME to ECEF EarthRotationMode rotation_mode_; //!< Designation of dynamics model // Definitions of coefficients diff --git a/src/simulation/ground_station/ground_station.cpp b/src/simulation/ground_station/ground_station.cpp index 02c7b4db1..cac7332f2 100644 --- a/src/simulation/ground_station/ground_station.cpp +++ b/src/simulation/ground_station/ground_station.cpp @@ -46,7 +46,7 @@ void GroundStation::Initialize(const SimulationConfiguration* configuration, con void GroundStation::LogSetup(Logger& logger) { logger.AddLogList(this); } void GroundStation::Update(const EarthRotation& celestial_rotation, const Spacecraft& spacecraft) { - libra::Matrix<3, 3> dcm_ecef2eci = celestial_rotation.GetDcmJ2000ToXcxf().Transpose(); + libra::Matrix<3, 3> dcm_ecef2eci = celestial_rotation.GetDcmJ2000ToEcef().Transpose(); position_i_m_ = dcm_ecef2eci * position_ecef_m_; is_visible_[spacecraft.GetSpacecraftId()] = CalcIsVisible(spacecraft.GetDynamics().GetOrbit().GetPosition_ecef_m());