From 294a99ff60e9d8ac9ea48f77088e5b55448599f7 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Wed, 12 Apr 2023 13:44:51 +0200 Subject: [PATCH 01/20] Update s2e-core version to v6.0.1 --- s2e-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/s2e-core b/s2e-core index 2eaf660a..e1aa9932 160000 --- a/s2e-core +++ b/s2e-core @@ -1 +1 @@ -Subproject commit 2eaf660a69a8b535abe6ebcaebf81cb1d3cb9eda +Subproject commit e1aa99320b4c7f6e5cdb3d7bbd4651723e037be7 From 53ec8385c00c5c8966a6c30ab1cc196c1038e90d Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Wed, 12 Apr 2023 13:50:40 +0200 Subject: [PATCH 02/20] Update CMakeLists --- s2e-ff/CMakeLists.txt | 75 ++++++++++--------------------------------- 1 file changed, 17 insertions(+), 58 deletions(-) diff --git a/s2e-ff/CMakeLists.txt b/s2e-ff/CMakeLists.txt index 7520ce9f..cdf8e7b7 100644 --- a/s2e-ff/CMakeLists.txt +++ b/s2e-ff/CMakeLists.txt @@ -32,55 +32,16 @@ set(NRLMSISE00_DIR ${EXT_LIB_DIR}/nrlmsise00) include_directories(${CSPICE_DIR}/include) include_directories(${NRLMSISE00_DIR}/src) include_directories(${S2E_CORE_DIR}/src) -include_directories(${S2E_CORE_DIR}/src/Library/math) -include_directories(${S2E_CORE_DIR}/src/Library/utils) -include_directories(${S2E_CORE_DIR}/src/Dynamics) -include_directories(${S2E_CORE_DIR}/src/Disturbance) -include_directories(${S2E_CORE_DIR}/src/Interface/InitInput) -include_directories(${S2E_CORE_DIR}/src/Interface/LogOutput) -include_directories(${S2E_CORE_DIR}/src/Interface/SpacecraftInOut/Ports) -include_directories(${S2E_CORE_DIR}/src/Simulation) -include_directories(${S2E_CORE_DIR}/src/Simulation/MCSim) -include_directories(${S2E_CORE_DIR}/src/Simulation/Spacecraft) -include_directories(${S2E_CORE_DIR}/src/Simulation/Spacecraft/Structure) -include_directories(${S2E_CORE_DIR}/src/Simulation/GroundStation) -include_directories(${S2E_CORE_DIR}/src/Simulation/Case) -include_directories(${S2E_CORE_DIR}/src/Disturbance) -include_directories(${S2E_CORE_DIR}/src/Environment/Global) -include_directories(${S2E_CORE_DIR}/src/Environment/Local) -include_directories(${S2E_CORE_DIR}/src/Component) -include_directories(${S2E_CORE_DIR}/src/Component/Abstract) -include_directories(${S2E_CORE_DIR}/src/Component/AOCS) -include_directories(${S2E_CORE_DIR}/src/Component/CDH) -include_directories(${S2E_CORE_DIR}/src/Component/CommGS) -include_directories(${S2E_CORE_DIR}/src/Component/Mission/Telescope) -include_directories(${S2E_CORE_DIR}/src/Component/Power) -include_directories(${S2E_CORE_DIR}/src/Component/Propulsion) -include_directories(${S2E_CORE_DIR}/src/Component/Thermal) -include_directories(${S2E_CORE_DIR}/src/RelativeInformation) ## add_subdirectories -add_subdirectory(${S2E_CORE_DIR}/src/Component S2E_CORE/Component) -add_subdirectory(${S2E_CORE_DIR}/src/Disturbance S2E_CORE/Disturbance) -add_subdirectory(${S2E_CORE_DIR}/src/Dynamics S2E_CORE/Dynamics) -add_subdirectory(${S2E_CORE_DIR}/src/Environment/Global S2E_CORE/Environment/Global) -add_subdirectory(${S2E_CORE_DIR}/src/Environment/Local S2E_CORE/Environment/Local) -add_subdirectory(${S2E_CORE_DIR}/src/RelativeInformation S2E_CORE/RelativeInformation) -add_subdirectory(${S2E_CORE_DIR}/src/Interface/InitInput S2E_CORE/InitInput) -add_subdirectory(${S2E_CORE_DIR}/src/Interface/LogOutput S2E_CORE/LogOutput) -add_subdirectory(${S2E_CORE_DIR}/src/Interface/SpacecraftInOut S2E_CORE/SpacecraftInOut) -add_subdirectory(${S2E_CORE_DIR}/src/Interface/HilsInOut S2E_CORE/HilsInOut) -add_subdirectory(${S2E_CORE_DIR}/src/Library/igrf S2E_CORE/igrf) -add_subdirectory(${S2E_CORE_DIR}/src/Library/inih S2E_CORE/inih) -add_subdirectory(${S2E_CORE_DIR}/src/Library/math S2E_CORE/math) -add_subdirectory(${S2E_CORE_DIR}/src/Library/nrlmsise00 S2E_CORE/nrlmsise00) -add_subdirectory(${S2E_CORE_DIR}/src/Library/sgp4 S2E_CORE/sgp4) -add_subdirectory(${S2E_CORE_DIR}/src/Library/utils S2E_CORE/utils) -add_subdirectory(${S2E_CORE_DIR}/src/Library/optics S2E_CORE/optics) -add_subdirectory(${S2E_CORE_DIR}/src/Library/RelativeOrbit S2E_CORE/RelativeOrbit) -add_subdirectory(${S2E_CORE_DIR}/src/Library/Orbit S2E_CORE/Orbit) -add_subdirectory(${S2E_CORE_DIR}/src/Library/Geodesy S2E_CORE/Geodesy) -add_subdirectory(${S2E_CORE_DIR}/src/Simulation S2E_CORE/Simulation) +add_subdirectory(${S2E_CORE_DIR}/src/components s2e_core/components) +add_subdirectory(${S2E_CORE_DIR}/src/disturbances s2e_core/disturbances) +add_subdirectory(${S2E_CORE_DIR}/src/dynamics s2e_core/dynamics) +add_subdirectory(${S2E_CORE_DIR}/src/environment/global s2e_core/environment/global) +add_subdirectory(${S2E_CORE_DIR}/src/environment/local s2e_core/environment/local) +add_subdirectory(${S2E_CORE_DIR}/src/library s2e_core/library) +add_subdirectory(${S2E_CORE_DIR}/src/simulation s2e_core/simulation) + set(SOURCE_FILES src/S2eFf.cpp @@ -163,22 +124,20 @@ set(S2E_LIBRARIES IGRF WRAPPER_NRLMSISE00 INIH SGP4 UTIL OPTICS RELATIVE_ORBIT_MODELS ORBIT_MODELS GEODESY MATH ) # Initialize link -target_link_libraries(COMPONENT DYNAMICS GLOBAL_ENVIRONMENT LOCAL_ENVIRONMENT SC_IO RELATIVE_INFO ${S2E_LIBRARIES}) -target_link_libraries(DYNAMICS GLOBAL_ENVIRONMENT LOCAL_ENVIRONMENT SIMULATION ${S2E_LIBRARIES}) -target_link_libraries(DISTURBANCE DYNAMICS GLOBAL_ENVIRONMENT LOCAL_ENVIRONMENT ${S2E_LIBRARIES}) -target_link_libraries(SIMULATION DYNAMICS GLOBAL_ENVIRONMENT LOCAL_ENVIRONMENT DISTURBANCE ${S2E_LIBRARIES}) -target_link_libraries(GLOBAL_ENVIRONMENT ${CSPICE_LIB} ${S2E_LIBRARIES}) -target_link_libraries(LOCAL_ENVIRONMENT GLOBAL_ENVIRONMENT ${CSPICE_LIB} ${S2E_LIBRARIES}) -target_link_libraries(WRAPPER_NRLMSISE00 ${NRLMSISE00_LIB}) +target_link_libraries(COMPONENT DYNAMICS GLOBAL_ENVIRONMENT LOCAL_ENVIRONMENT LIBRARY) +target_link_libraries(DYNAMICS GLOBAL_ENVIRONMENT LOCAL_ENVIRONMENT SIMULATION LIBRARY) +target_link_libraries(DISTURBANCE DYNAMICS GLOBAL_ENVIRONMENT LOCAL_ENVIRONMENT LIBRARY) +target_link_libraries(SIMULATION DYNAMICS GLOBAL_ENVIRONMENT LOCAL_ENVIRONMENT DISTURBANCE LIBRARY) +target_link_libraries(GLOBAL_ENVIRONMENT ${CSPICE_LIB} LIBRARY) +target_link_libraries(LOCAL_ENVIRONMENT GLOBAL_ENVIRONMENT ${CSPICE_LIB} LIBRARY) +target_link_libraries(LIBRARY ${NRLMSISE00_LIB}) target_link_libraries(${PROJECT_NAME} DYNAMICS) target_link_libraries(${PROJECT_NAME} DISTURBANCE) target_link_libraries(${PROJECT_NAME} SIMULATION) target_link_libraries(${PROJECT_NAME} GLOBAL_ENVIRONMENT LOCAL_ENVIRONMENT) -target_link_libraries(${PROJECT_NAME} RELATIVE_INFO) -target_link_libraries(${PROJECT_NAME} INI_ACC LOG_OUT SC_IO) target_link_libraries(${PROJECT_NAME} COMPONENT) -target_link_libraries(${PROJECT_NAME} HILS_IO) + ## Cmake debug message("Cspice_LIB: " ${CSPICE_LIB}) @@ -220,7 +179,7 @@ if(GOOGLE_TEST) ) add_executable(${TEST_PROJECT_NAME} ${TEST_FILES}) target_link_libraries(${TEST_PROJECT_NAME} gtest gtest_main) - target_link_libraries(${TEST_PROJECT_NAME} MATH) + target_link_libraries(${TEST_PROJECT_NAME} LIBRARY) include_directories(${TEST_PROJECT_NAME}) add_test(NAME s2e-test COMMAND ${TEST_PROJECT_NAME}) enable_testing() From 477b9b6eb0d1fb62d5c8b6099581d7c2da5db7cc Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Wed, 12 Apr 2023 14:14:14 +0200 Subject: [PATCH 03/20] Fix include path --- .../AOCS/InitializeRelativeDistanceSensor.cpp | 11 +++++------ .../AOCS/InitializeRelativePositionSensor.cpp | 7 +++---- .../AOCS/InitializeRelativeVelocitySensor.cpp | 7 +++---- .../src/Components/AOCS/RelativeDistanceSensor.cpp | 8 ++------ .../src/Components/AOCS/RelativeDistanceSensor.hpp | 12 ++++++------ .../src/Components/AOCS/RelativePositionSensor.cpp | 6 +++--- .../src/Components/AOCS/RelativePositionSensor.hpp | 12 ++++++------ .../src/Components/AOCS/RelativeVelocitySensor.cpp | 6 +++--- .../src/Components/AOCS/RelativeVelocitySensor.hpp | 12 ++++++------ .../IdealComponents/RelativeAttitudeController.cpp | 4 ++-- .../IdealComponents/RelativeAttitudeController.hpp | 8 ++++---- .../Orbit/QuasiNonsingularOrbitalElements.hpp | 4 ++-- .../QuasiNonsingularRelativeOrbitalElements.hpp | 2 +- s2e-ff/src/Library/math/DualQuaternion.hpp | 2 +- s2e-ff/src/S2eFf.cpp | 2 +- s2e-ff/src/Simulation/Case/FfCase.hpp | 5 +++-- s2e-ff/src/Simulation/Spacecraft/FfComponents.hpp | 13 ++++--------- s2e-ff/src/Simulation/Spacecraft/FfComponents2.hpp | 13 ++++--------- s2e-ff/src/Simulation/Spacecraft/FfSat.cpp | 8 ++++---- s2e-ff/src/Simulation/Spacecraft/FfSat.hpp | 5 +++-- 20 files changed, 66 insertions(+), 81 deletions(-) diff --git a/s2e-ff/src/Components/AOCS/InitializeRelativeDistanceSensor.cpp b/s2e-ff/src/Components/AOCS/InitializeRelativeDistanceSensor.cpp index a39b19ca..4056f214 100644 --- a/s2e-ff/src/Components/AOCS/InitializeRelativeDistanceSensor.cpp +++ b/s2e-ff/src/Components/AOCS/InitializeRelativeDistanceSensor.cpp @@ -1,20 +1,19 @@ #include "InitializeRelativeDistanceSensor.hpp" -#include - -#include "../Abstract/InitializeSensorBase.hpp" +#include +#include RelativeDistanceSensor InitializeRelativeDistanceSensor(ClockGenerator* clock_gen, const std::string file_name, const double compo_step_time_s, const RelativeInformation& rel_info, const int reference_sat_id_input) { // General IniAccess ini_file(file_name); - // CompoBase + // Compo int prescaler = ini_file.ReadInt("ComponentBase", "prescaler"); if (prescaler <= 1) prescaler = 1; - // SensorBase - SensorBase<1> sensor_base = ReadSensorBaseInformation<1>(file_name, compo_step_time_s * (double)(prescaler)); + // Sensor + Sensor<1> sensor_base = ReadSensorInformation<1>(file_name, compo_step_time_s * (double)(prescaler), "RelativeDistanceSensor"); // RelativeDistanceSensor char section[30] = "RelativeDistanceSensor"; diff --git a/s2e-ff/src/Components/AOCS/InitializeRelativePositionSensor.cpp b/s2e-ff/src/Components/AOCS/InitializeRelativePositionSensor.cpp index 237cdbe8..3d65401e 100644 --- a/s2e-ff/src/Components/AOCS/InitializeRelativePositionSensor.cpp +++ b/s2e-ff/src/Components/AOCS/InitializeRelativePositionSensor.cpp @@ -1,8 +1,7 @@ #include "InitializeRelativePositionSensor.hpp" -#include - -#include "../Abstract/InitializeSensorBase.hpp" +#include +#include RelativePositionSensor InitializeRelativePositionSensor(ClockGenerator* clock_gen, const std::string file_name, const double compo_step_time_s, const RelativeInformation& rel_info, const Dynamics& dynamics, @@ -15,7 +14,7 @@ RelativePositionSensor InitializeRelativePositionSensor(ClockGenerator* clock_ge if (prescaler <= 1) prescaler = 1; // SensorBase - SensorBase<3> sensor_base = ReadSensorBaseInformation<3>(file_name, compo_step_time_s * (double)(prescaler)); + Sensor<3> sensor_base = ReadSensorInformation<3>(file_name, compo_step_time_s * (double)(prescaler), "RelativePositionSensor"); // RelativePositionSensor char section[30] = "RelativePositionSensor"; diff --git a/s2e-ff/src/Components/AOCS/InitializeRelativeVelocitySensor.cpp b/s2e-ff/src/Components/AOCS/InitializeRelativeVelocitySensor.cpp index 06af6035..79efc8f0 100644 --- a/s2e-ff/src/Components/AOCS/InitializeRelativeVelocitySensor.cpp +++ b/s2e-ff/src/Components/AOCS/InitializeRelativeVelocitySensor.cpp @@ -1,8 +1,7 @@ #include "InitializeRelativeVelocitySensor.hpp" -#include - -#include "../Abstract/InitializeSensorBase.hpp" +#include +#include RelativeVelocitySensor InitializeRelativeVelocitySensor(ClockGenerator* clock_gen, const std::string file_name, const double compo_step_time_s, const RelativeInformation& rel_info, const Dynamics& dynamics, @@ -15,7 +14,7 @@ RelativeVelocitySensor InitializeRelativeVelocitySensor(ClockGenerator* clock_ge if (prescaler <= 1) prescaler = 1; // SensorBase - SensorBase<3> sensor_base = ReadSensorBaseInformation<3>(file_name, compo_step_time_s * (double)(prescaler)); + Sensor<3> sensor_base = ReadSensorInformation<3>(file_name, compo_step_time_s * (double)(prescaler), "RelativeVelocitySensor"); // RelativeVelocitySensor char section[30] = "RelativeVelocitySensor"; diff --git a/s2e-ff/src/Components/AOCS/RelativeDistanceSensor.cpp b/s2e-ff/src/Components/AOCS/RelativeDistanceSensor.cpp index 7ad22073..c67b9641 100644 --- a/s2e-ff/src/Components/AOCS/RelativeDistanceSensor.cpp +++ b/s2e-ff/src/Components/AOCS/RelativeDistanceSensor.cpp @@ -1,12 +1,8 @@ #include "RelativeDistanceSensor.hpp" -RelativeDistanceSensor::RelativeDistanceSensor(const int prescaler, ClockGenerator* clock_gen, SensorBase& sensor_base, const int target_sat_id, +RelativeDistanceSensor::RelativeDistanceSensor(const int prescaler, ClockGenerator* clock_gen, Sensor& sensor_base, const int target_sat_id, const int reference_sat_id, const RelativeInformation& rel_info) - : ComponentBase(prescaler, clock_gen), - SensorBase(sensor_base), - target_sat_id_(target_sat_id), - reference_sat_id_(reference_sat_id), - rel_info_(rel_info) {} + : Component(prescaler, clock_gen), Sensor(sensor_base), target_sat_id_(target_sat_id), reference_sat_id_(reference_sat_id), rel_info_(rel_info) {} RelativeDistanceSensor::~RelativeDistanceSensor() {} diff --git a/s2e-ff/src/Components/AOCS/RelativeDistanceSensor.hpp b/s2e-ff/src/Components/AOCS/RelativeDistanceSensor.hpp index 1604c9cd..656ef798 100644 --- a/s2e-ff/src/Components/AOCS/RelativeDistanceSensor.hpp +++ b/s2e-ff/src/Components/AOCS/RelativeDistanceSensor.hpp @@ -1,14 +1,14 @@ #ifndef RELATIVE_DISTANCE_SENSOR_H_ #define RELATIVE_DISTANCE_SENSOR_H_ -#include -#include -#include -#include +#include +#include +#include +#include -class RelativeDistanceSensor : public ComponentBase, public SensorBase<1>, public ILoggable { +class RelativeDistanceSensor : public Component, public Sensor<1>, public ILoggable { public: - RelativeDistanceSensor(const int prescaler, ClockGenerator* clock_gen, SensorBase& sensor_base, const int target_sat_id, const int reference_sat_id, + RelativeDistanceSensor(const int prescaler, ClockGenerator* clock_gen, Sensor& sensor_base, const int target_sat_id, const int reference_sat_id, const RelativeInformation& rel_info); ~RelativeDistanceSensor(); // ComponentBase diff --git a/s2e-ff/src/Components/AOCS/RelativePositionSensor.cpp b/s2e-ff/src/Components/AOCS/RelativePositionSensor.cpp index c479145b..97bc925b 100644 --- a/s2e-ff/src/Components/AOCS/RelativePositionSensor.cpp +++ b/s2e-ff/src/Components/AOCS/RelativePositionSensor.cpp @@ -1,10 +1,10 @@ #include "RelativePositionSensor.hpp" -RelativePositionSensor::RelativePositionSensor(const int prescaler, ClockGenerator* clock_gen, SensorBase& sensor_base, const int target_sat_id, +RelativePositionSensor::RelativePositionSensor(const int prescaler, ClockGenerator* clock_gen, Sensor& sensor_base, const int target_sat_id, const int reference_sat_id, const RelativePositionSensorErrorFrame error_frame, const RelativeInformation& rel_info, const Dynamics& dynamics) - : ComponentBase(prescaler, clock_gen), - SensorBase(sensor_base), + : Component(prescaler, clock_gen), + Sensor(sensor_base), target_sat_id_(target_sat_id), reference_sat_id_(reference_sat_id), error_frame_(error_frame), diff --git a/s2e-ff/src/Components/AOCS/RelativePositionSensor.hpp b/s2e-ff/src/Components/AOCS/RelativePositionSensor.hpp index 2944b47d..bdce9661 100644 --- a/s2e-ff/src/Components/AOCS/RelativePositionSensor.hpp +++ b/s2e-ff/src/Components/AOCS/RelativePositionSensor.hpp @@ -1,16 +1,16 @@ #ifndef RELATIVE_POSITION_SENSOR_H_ #define RELATIVE_POSITION_SENSOR_H_ -#include -#include -#include -#include +#include +#include +#include +#include enum class RelativePositionSensorErrorFrame { INERTIAL, RTN, BODY }; -class RelativePositionSensor : public ComponentBase, public SensorBase<3>, public ILoggable { +class RelativePositionSensor : public Component, public Sensor<3>, public ILoggable { public: - RelativePositionSensor(const int prescaler, ClockGenerator* clock_gen, SensorBase& sensor_base, const int target_sat_id, const int reference_sat_id, + RelativePositionSensor(const int prescaler, ClockGenerator* clock_gen, Sensor& sensor_base, const int target_sat_id, const int reference_sat_id, const RelativePositionSensorErrorFrame error_frame, const RelativeInformation& rel_info, const Dynamics& dynamics); ~RelativePositionSensor(); // ComponentBase diff --git a/s2e-ff/src/Components/AOCS/RelativeVelocitySensor.cpp b/s2e-ff/src/Components/AOCS/RelativeVelocitySensor.cpp index 7ac4691f..f1558568 100644 --- a/s2e-ff/src/Components/AOCS/RelativeVelocitySensor.cpp +++ b/s2e-ff/src/Components/AOCS/RelativeVelocitySensor.cpp @@ -1,10 +1,10 @@ #include "RelativeVelocitySensor.hpp" -RelativeVelocitySensor::RelativeVelocitySensor(const int prescaler, ClockGenerator* clock_gen, SensorBase& sensor_base, const int target_sat_id, +RelativeVelocitySensor::RelativeVelocitySensor(const int prescaler, ClockGenerator* clock_gen, Sensor& sensor_base, const int target_sat_id, const int reference_sat_id, const RelativeVelocitySensorErrorFrame error_frame, const RelativeInformation& rel_info, const Dynamics& dynamics) - : ComponentBase(prescaler, clock_gen), - SensorBase(sensor_base), + : Component(prescaler, clock_gen), + Sensor(sensor_base), target_sat_id_(target_sat_id), reference_sat_id_(reference_sat_id), error_frame_(error_frame), diff --git a/s2e-ff/src/Components/AOCS/RelativeVelocitySensor.hpp b/s2e-ff/src/Components/AOCS/RelativeVelocitySensor.hpp index 3f9ef631..416b46ff 100644 --- a/s2e-ff/src/Components/AOCS/RelativeVelocitySensor.hpp +++ b/s2e-ff/src/Components/AOCS/RelativeVelocitySensor.hpp @@ -1,16 +1,16 @@ #ifndef RELATIVE_VELOCITY_SENSOR_H_ #define RELATIVE_VELOCITY_SENSOR_H_ -#include -#include -#include -#include +#include +#include +#include +#include enum class RelativeVelocitySensorErrorFrame { INERTIAL, RTN }; -class RelativeVelocitySensor : public ComponentBase, public SensorBase<3>, public ILoggable { +class RelativeVelocitySensor : public Component, public Sensor<3>, public ILoggable { public: - RelativeVelocitySensor(const int prescaler, ClockGenerator* clock_gen, SensorBase& sensor_base, const int target_sat_id, const int reference_sat_id, + RelativeVelocitySensor(const int prescaler, ClockGenerator* clock_gen, Sensor& sensor_base, const int target_sat_id, const int reference_sat_id, const RelativeVelocitySensorErrorFrame error_frame, const RelativeInformation& rel_info, const Dynamics& dynamics); ~RelativeVelocitySensor(); // ComponentBase diff --git a/s2e-ff/src/Components/IdealComponents/RelativeAttitudeController.cpp b/s2e-ff/src/Components/IdealComponents/RelativeAttitudeController.cpp index 62c467e0..8dd97667 100644 --- a/s2e-ff/src/Components/IdealComponents/RelativeAttitudeController.cpp +++ b/s2e-ff/src/Components/IdealComponents/RelativeAttitudeController.cpp @@ -1,6 +1,6 @@ #include "RelativeAttitudeController.hpp" -#include +#include #define THRESHOLD_CA cos(30.0 / 180.0 * libra::pi) // fix me @@ -10,7 +10,7 @@ RelativeAttitudeController::RelativeAttitudeController(const int prescaler, Cloc const libra::Vector<3> sub_target_direction_b, const int target_sat_id, const int reference_sat_id, const RelativeInformation& rel_info, const LocalCelestialInformation& local_celes_info, const Dynamics& dynamics) - : ComponentBase(prescaler, clock_gen), + : Component(prescaler, clock_gen), main_mode_(main_mode), sub_mode_(sub_mode), target_sat_id_(target_sat_id), diff --git a/s2e-ff/src/Components/IdealComponents/RelativeAttitudeController.hpp b/s2e-ff/src/Components/IdealComponents/RelativeAttitudeController.hpp index 8b663384..98eb5723 100644 --- a/s2e-ff/src/Components/IdealComponents/RelativeAttitudeController.hpp +++ b/s2e-ff/src/Components/IdealComponents/RelativeAttitudeController.hpp @@ -1,8 +1,8 @@ #pragma once -#include -#include -#include +#include +#include +#include enum class RelativeAttitudeControlMode { TARGET_SATELLITE_POINTING, @@ -15,7 +15,7 @@ enum class RelativeAttitudeControlMode { RelativeAttitudeControlMode ConvertStringToRelativeAttitudeControlMode(const std::string mode_name); -class RelativeAttitudeController : public ComponentBase, public ILoggable { +class RelativeAttitudeController : public Component, public ILoggable { public: RelativeAttitudeController(const int prescaler, ClockGenerator* clock_gen, const RelativeAttitudeControlMode main_mode, const RelativeAttitudeControlMode sub_mode, const libra::Vector<3> main_target_direction_b, diff --git a/s2e-ff/src/Library/Orbit/QuasiNonsingularOrbitalElements.hpp b/s2e-ff/src/Library/Orbit/QuasiNonsingularOrbitalElements.hpp index 0b500f8d..8a68226e 100644 --- a/s2e-ff/src/Library/Orbit/QuasiNonsingularOrbitalElements.hpp +++ b/s2e-ff/src/Library/Orbit/QuasiNonsingularOrbitalElements.hpp @@ -6,8 +6,8 @@ #ifndef QUASI_NONSINGULAR_ORBITAL_ELEMENTS_H_ #define QUASI_NONSINGULAR_ORBITAL_ELEMENTS_H_ -#include -#include +#include +#include /** * @class QuasiNonsingularOrbitalElements diff --git a/s2e-ff/src/Library/RelativeOrbit/QuasiNonsingularRelativeOrbitalElements.hpp b/s2e-ff/src/Library/RelativeOrbit/QuasiNonsingularRelativeOrbitalElements.hpp index 627c1117..67418eb9 100644 --- a/s2e-ff/src/Library/RelativeOrbit/QuasiNonsingularRelativeOrbitalElements.hpp +++ b/s2e-ff/src/Library/RelativeOrbit/QuasiNonsingularRelativeOrbitalElements.hpp @@ -6,7 +6,7 @@ #ifndef QUASI_NONSINGULAR_RELATIVE_ORBITAL_ELEMENTS_H_ #define QUASI_NONSINGULAR_RELATIVE_ORBITAL_ELEMENTS_H_ -#include +#include #include "../Orbit/QuasiNonsingularOrbitalElements.hpp" diff --git a/s2e-ff/src/Library/math/DualQuaternion.hpp b/s2e-ff/src/Library/math/DualQuaternion.hpp index 7462134a..5abacb4b 100644 --- a/s2e-ff/src/Library/math/DualQuaternion.hpp +++ b/s2e-ff/src/Library/math/DualQuaternion.hpp @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace libra { diff --git a/s2e-ff/src/S2eFf.cpp b/s2e-ff/src/S2eFf.cpp index 491d6d7f..30494d3c 100644 --- a/s2e-ff/src/S2eFf.cpp +++ b/s2e-ff/src/S2eFf.cpp @@ -1,5 +1,5 @@ // Simulator includes -#include "Interface/LogOutput/Logger.h" +#include // Add custom include files #include "./Simulation/Case/FfCase.hpp" diff --git a/s2e-ff/src/Simulation/Case/FfCase.hpp b/s2e-ff/src/Simulation/Case/FfCase.hpp index 329161c0..fb084d58 100644 --- a/s2e-ff/src/Simulation/Case/FfCase.hpp +++ b/s2e-ff/src/Simulation/Case/FfCase.hpp @@ -1,8 +1,9 @@ #pragma once +#include +#include + #include "../Spacecraft/FfSat.hpp" -#include "RelativeInformation.h" -#include "SimulationCase.h" class FfCase : public SimulationCase { public: diff --git a/s2e-ff/src/Simulation/Spacecraft/FfComponents.hpp b/s2e-ff/src/Simulation/Spacecraft/FfComponents.hpp index f9e80159..3df7fdaa 100644 --- a/s2e-ff/src/Simulation/Spacecraft/FfComponents.hpp +++ b/s2e-ff/src/Simulation/Spacecraft/FfComponents.hpp @@ -1,20 +1,15 @@ #pragma once -#include - -#include "Dynamics.h" -#include "GlobalEnvironment.h" -#include "LocalEnvironment.h" -#include "Vector.hpp" +#include // include for components -#include +#include +#include #include "../../Components/AOCS/RelativeDistanceSensor.hpp" #include "../../Components/AOCS/RelativePositionSensor.hpp" #include "../../Components/AOCS/RelativeVelocitySensor.hpp" #include "../../Components/IdealComponents/RelativeAttitudeController.hpp" -#include "OBC.h" class FfComponents : public InstalledComponents { public: @@ -27,7 +22,7 @@ class FfComponents : public InstalledComponents { private: // Components - OBC* obc_; + OnBoardComputer* obc_; RelativeDistanceSensor* relative_distance_sensor_; RelativePositionSensor* relative_position_sensor_; RelativeVelocitySensor* relative_velocity_sensor_; diff --git a/s2e-ff/src/Simulation/Spacecraft/FfComponents2.hpp b/s2e-ff/src/Simulation/Spacecraft/FfComponents2.hpp index c3001d6a..9290a1a9 100644 --- a/s2e-ff/src/Simulation/Spacecraft/FfComponents2.hpp +++ b/s2e-ff/src/Simulation/Spacecraft/FfComponents2.hpp @@ -1,19 +1,14 @@ #pragma once -#include - -#include "Dynamics.h" -#include "GlobalEnvironment.h" -#include "LocalEnvironment.h" -#include "Vector.hpp" +#include // include for components -#include +#include +#include #include "../../Components/AOCS/RelativeDistanceSensor.hpp" #include "../../Components/AOCS/RelativePositionSensor.hpp" #include "../../Components/IdealComponents/RelativeAttitudeController.hpp" -#include "OBC.h" class FfComponents2 : public InstalledComponents { public: @@ -26,7 +21,7 @@ class FfComponents2 : public InstalledComponents { private: // Components - OBC* obc_; + OnBoardComputer* obc_; // References const Dynamics* dynamics_; diff --git a/s2e-ff/src/Simulation/Spacecraft/FfSat.cpp b/s2e-ff/src/Simulation/Spacecraft/FfSat.cpp index d99be626..f088ddc9 100644 --- a/s2e-ff/src/Simulation/Spacecraft/FfSat.cpp +++ b/s2e-ff/src/Simulation/Spacecraft/FfSat.cpp @@ -1,11 +1,11 @@ #include "FfSat.hpp" -FfSat::FfSat(SimulationConfig* sim_config, const GlobalEnvironment* glo_env, RelativeInformation* relative_information, const int sat_id) - : Spacecraft(sim_config, glo_env, relative_information, sat_id) { +FfSat::FfSat(SimulationConfiguration* sim_config, const GlobalEnvironment* glo_env, RelativeInformation* relative_information, const int sat_id) + : Spacecraft(sim_config, glo_env, sat_id, relative_information) { if (sat_id == 0) { - components_ = new FfComponents(dynamics_, structure_, local_env_, glo_env, sim_config, &clock_gen_, relative_information); + components_ = new FfComponents(dynamics_, structure_, local_environment_, glo_env, sim_config, &clock_generator_, relative_information); } else if (sat_id == 1) { - components_ = new FfComponents2(dynamics_, structure_, local_env_, glo_env, sim_config, &clock_gen_, relative_information); + components_ = new FfComponents2(dynamics_, structure_, local_environment_, glo_env, sim_config, &clock_generator_, relative_information); } else { // not reach } } diff --git a/s2e-ff/src/Simulation/Spacecraft/FfSat.hpp b/s2e-ff/src/Simulation/Spacecraft/FfSat.hpp index 8b64223c..8825875e 100644 --- a/s2e-ff/src/Simulation/Spacecraft/FfSat.hpp +++ b/s2e-ff/src/Simulation/Spacecraft/FfSat.hpp @@ -1,12 +1,13 @@ #pragma once +#include + #include "FfComponents.hpp" #include "FfComponents2.hpp" -#include "Spacecraft.h" class FfSat : public Spacecraft { public: - FfSat(SimulationConfig *sim_config, const GlobalEnvironment *glo_env, RelativeInformation *relative_information, const int sat_id); + FfSat(SimulationConfiguration *sim_config, const GlobalEnvironment *glo_env, RelativeInformation *relative_information, const int sat_id); private: }; From a5c2ace2298e73052c1153c87bc6ae90671c3e11 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Wed, 12 Apr 2023 14:16:33 +0200 Subject: [PATCH 04/20] Fix function name in relative position sensor --- .../Components/AOCS/RelativePositionSensor.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/s2e-ff/src/Components/AOCS/RelativePositionSensor.cpp b/s2e-ff/src/Components/AOCS/RelativePositionSensor.cpp index 97bc925b..d4444f95 100644 --- a/s2e-ff/src/Components/AOCS/RelativePositionSensor.cpp +++ b/s2e-ff/src/Components/AOCS/RelativePositionSensor.cpp @@ -20,28 +20,28 @@ void RelativePositionSensor::MainRoutine(int count) { measured_target_position_i_m_ = rel_info_.GetRelativePosition_i_m(target_sat_id_, reference_sat_id_); measured_target_position_rtn_m_ = rel_info_.GetRelativePosition_rtn_m(target_sat_id_, reference_sat_id_); libra::Quaternion q_i2b = dynamics_.GetAttitude().GetQuaternion_i2b(); - measured_target_position_body_m_ = q_i2b.frame_conv(measured_target_position_i_m_); + measured_target_position_body_m_ = q_i2b.FrameConversion(measured_target_position_i_m_); // Add noise at body frame and frame conversion - libra::Quaternion q_i2rtn = dynamics_.GetOrbit().CalcQuaternionI2LVLH(); + libra::Quaternion q_i2rtn = dynamics_.GetOrbit().CalcQuaternion_i2lvlh(); switch (error_frame_) { case RelativePositionSensorErrorFrame::INERTIAL: measured_target_position_i_m_ = Measure(measured_target_position_i_m_); // Frame conversion - measured_target_position_rtn_m_ = q_i2rtn.frame_conv(measured_target_position_i_m_); - measured_target_position_body_m_ = q_i2b.frame_conv(measured_target_position_i_m_); + measured_target_position_rtn_m_ = q_i2rtn.FrameConversion(measured_target_position_i_m_); + measured_target_position_body_m_ = q_i2b.FrameConversion(measured_target_position_i_m_); break; case RelativePositionSensorErrorFrame::RTN: measured_target_position_rtn_m_ = Measure(measured_target_position_rtn_m_); // Frame conversion - measured_target_position_i_m_ = q_i2rtn.frame_conv_inv(measured_target_position_rtn_m_); - measured_target_position_body_m_ = q_i2b.frame_conv(measured_target_position_i_m_); + measured_target_position_i_m_ = q_i2rtn.InverseFrameConversion(measured_target_position_rtn_m_); + measured_target_position_body_m_ = q_i2b.FrameConversion(measured_target_position_i_m_); break; case RelativePositionSensorErrorFrame::BODY: measured_target_position_body_m_ = Measure(measured_target_position_body_m_); // Frame conversion - measured_target_position_i_m_ = q_i2b.frame_conv_inv(measured_target_position_body_m_); - measured_target_position_rtn_m_ = q_i2rtn.frame_conv(measured_target_position_i_m_); + measured_target_position_i_m_ = q_i2b.InverseFrameConversion(measured_target_position_body_m_); + measured_target_position_rtn_m_ = q_i2rtn.FrameConversion(measured_target_position_i_m_); break; default: break; From df6d114d8fd001ab16e0c604d6bf54f5c0e816b3 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Wed, 12 Apr 2023 14:17:16 +0200 Subject: [PATCH 05/20] Fix function name in relative velocity sensor --- s2e-ff/src/Components/AOCS/RelativeVelocitySensor.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/s2e-ff/src/Components/AOCS/RelativeVelocitySensor.cpp b/s2e-ff/src/Components/AOCS/RelativeVelocitySensor.cpp index f1558568..c86b2564 100644 --- a/s2e-ff/src/Components/AOCS/RelativeVelocitySensor.cpp +++ b/s2e-ff/src/Components/AOCS/RelativeVelocitySensor.cpp @@ -21,13 +21,13 @@ void RelativeVelocitySensor::MainRoutine(int count) { libra::Vector<3> true_target_velocity_rtn_m_s = rel_info_.GetRelativeVelocity_rtn_m_s(target_sat_id_, reference_sat_id_); // Add noise at body frame and frame conversion - libra::Quaternion q_i2rtn = dynamics_.GetOrbit().CalcQuaternionI2LVLH(); + libra::Quaternion q_i2rtn = dynamics_.GetOrbit().CalcQuaternion_i2lvlh(); switch (error_frame_) { case RelativeVelocitySensorErrorFrame::INERTIAL: { measured_target_velocity_i_m_s_ = Measure(true_target_velocity_i_m_s); libra::Vector<3> d_vel_i_m_s = measured_target_velocity_i_m_s_ - true_target_velocity_i_m_s; // Frame conversion - libra::Vector<3> d_vel_rtn_m_s = q_i2rtn.frame_conv(d_vel_i_m_s); + libra::Vector<3> d_vel_rtn_m_s = q_i2rtn.FrameConversion(d_vel_i_m_s); measured_target_velocity_rtn_m_s_ = true_target_velocity_rtn_m_s + d_vel_rtn_m_s; break; } @@ -35,7 +35,7 @@ void RelativeVelocitySensor::MainRoutine(int count) { measured_target_velocity_rtn_m_s_ = Measure(true_target_velocity_rtn_m_s); libra::Vector<3> d_vel_rtn_m_s = measured_target_velocity_rtn_m_s_ - true_target_velocity_rtn_m_s; // Frame conversion - libra::Vector<3> d_vel_i_m_s = q_i2rtn.frame_conv_inv(d_vel_rtn_m_s); + libra::Vector<3> d_vel_i_m_s = q_i2rtn.InverseFrameConversion(d_vel_rtn_m_s); measured_target_velocity_i_m_s_ = true_target_velocity_i_m_s + d_vel_i_m_s; break; } From 72f4adcb6671b24707b3612868b7eafecfe7406c Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Wed, 12 Apr 2023 14:28:42 +0200 Subject: [PATCH 06/20] Fix function name in relative attitude controller --- .../InitializeRelativeAttitudeController.cpp | 2 +- .../RelativeAttitudeController.cpp | 35 +++++++++---------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/s2e-ff/src/Components/IdealComponents/InitializeRelativeAttitudeController.cpp b/s2e-ff/src/Components/IdealComponents/InitializeRelativeAttitudeController.cpp index ece25d8c..58475513 100644 --- a/s2e-ff/src/Components/IdealComponents/InitializeRelativeAttitudeController.cpp +++ b/s2e-ff/src/Components/IdealComponents/InitializeRelativeAttitudeController.cpp @@ -1,6 +1,6 @@ #include "InitializeRelativeAttitudeController.hpp" -#include +#include RelativeAttitudeController InitializeRelativeAttitudeController(ClockGenerator* clock_gen, const std::string file_name, const RelativeInformation& rel_info, diff --git a/s2e-ff/src/Components/IdealComponents/RelativeAttitudeController.cpp b/s2e-ff/src/Components/IdealComponents/RelativeAttitudeController.cpp index 8dd97667..5fbed1b6 100644 --- a/s2e-ff/src/Components/IdealComponents/RelativeAttitudeController.cpp +++ b/s2e-ff/src/Components/IdealComponents/RelativeAttitudeController.cpp @@ -68,9 +68,9 @@ void RelativeAttitudeController::Initialize(void) { return; } // pointing direction check - normalize(main_target_direction_b_); - normalize(sub_target_direction_b_); - double tmp = inner_product(main_target_direction_b_, sub_target_direction_b_); + main_target_direction_b_ = main_target_direction_b_.CalcNormalizedVector(); + sub_target_direction_b_ = sub_target_direction_b_.CalcNormalizedVector(); + double tmp = libra::InnerProduct(main_target_direction_b_, sub_target_direction_b_); tmp = std::abs(tmp); if (tmp > THRESHOLD_CA) { std::cout << "sub target direction should separate from the main target direction. \n"; @@ -88,24 +88,23 @@ libra::Vector<3> RelativeAttitudeController::CalcTargetDirection_i(RelativeAttit direction_i = rel_info_.GetRelativePosition_i_m(target_sat_id_, my_sat_id_); break; case RelativeAttitudeControlMode::SUN_POINTING: - direction_i = local_celes_info_.GetPosFromSC_i("SUN"); + direction_i = local_celes_info_.GetPositionFromSpacecraft_i_m("SUN"); break; case RelativeAttitudeControlMode::EARTH_CENTER_POINTING: - direction_i = local_celes_info_.GetPosFromSC_i("EARTH"); + direction_i = local_celes_info_.GetPositionFromSpacecraft_i_m("EARTH"); break; case RelativeAttitudeControlMode::VELOCITY_DIRECTION_POINTING: - direction_i = dynamics_.GetOrbit().GetSatVelocity_i(); + direction_i = dynamics_.GetOrbit().GetVelocity_i_m_s(); break; case RelativeAttitudeControlMode::ORBIT_NORMAL_POINTING: - direction_i = outer_product(dynamics_.GetOrbit().GetSatPosition_i(), dynamics_.GetOrbit().GetSatVelocity_i()); + direction_i = libra::OuterProduct(dynamics_.GetOrbit().GetPosition_i_m(), dynamics_.GetOrbit().GetVelocity_i_m_s()); break; default: // Not Reached break; } - normalize(direction_i); - return direction_i; + return direction_i.CalcNormalizedVector(); } libra::Quaternion RelativeAttitudeController::CalcTargetQuaternion(const libra::Vector<3> main_direction_i, const libra::Vector<3> sub_direction_i) { @@ -114,16 +113,16 @@ libra::Quaternion RelativeAttitudeController::CalcTargetQuaternion(const libra:: // Calc DCM Target->body libra::Matrix<3, 3> DCM_t2b = CalcDcmFromVectors(main_target_direction_b_, sub_target_direction_b_); // Calc DCM ECI->body - libra::Matrix<3, 3> DCM_i2b = DCM_t2b * transpose(DCM_t2i); + libra::Matrix<3, 3> DCM_i2b = DCM_t2b * DCM_t2i.Transpose(); // Convert to Quaternion - return libra::Quaternion::fromDCM(DCM_i2b); + return libra::Quaternion::ConvertFromDcm(DCM_i2b); } libra::Matrix<3, 3> RelativeAttitudeController::CalcDcmFromVectors(const libra::Vector<3> main_direction, const libra::Vector<3> sub_direction) { - libra::Matrix<3, 3> dcm = libra::eye<3>(); + libra::Matrix<3, 3> dcm = libra::MakeIdentityMatrix<3>(); // Check vector - double tmp = inner_product(main_direction, sub_direction); + double tmp = libra::InnerProduct(main_direction, sub_direction); tmp = std::abs(tmp); if (tmp > 0.99999) { return dcm; @@ -132,11 +131,11 @@ libra::Matrix<3, 3> RelativeAttitudeController::CalcDcmFromVectors(const libra:: // Calc basis vectors libra::Vector<3> ex, ey, ez; ex = main_direction; - libra::Vector<3> tmp1 = outer_product(ex, sub_direction); - libra::Vector<3> tmp2 = outer_product(tmp1, ex); - ey = normalize(tmp2); - libra::Vector<3> tmp3 = outer_product(ex, ey); - ez = normalize(tmp3); + libra::Vector<3> tmp1 = libra::OuterProduct(ex, sub_direction); + libra::Vector<3> tmp2 = libra::OuterProduct(tmp1, ex); + ey = tmp2.CalcNormalizedVector(); + libra::Vector<3> tmp3 = libra::OuterProduct(ex, ey); + ez = tmp3.CalcNormalizedVector(); // Generate DCM for (int i = 0; i < 3; i++) { From 169ab19795ae94a2bce7b6fb4edf1d7648c0cedb Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Wed, 12 Apr 2023 14:30:09 +0200 Subject: [PATCH 07/20] Fix function name in dual quaternion --- s2e-ff/src/Library/math/DualQuaternion.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/s2e-ff/src/Library/math/DualQuaternion.cpp b/s2e-ff/src/Library/math/DualQuaternion.cpp index cc7ef098..65f0754e 100644 --- a/s2e-ff/src/Library/math/DualQuaternion.cpp +++ b/s2e-ff/src/Library/math/DualQuaternion.cpp @@ -37,15 +37,15 @@ DualQuaternion DualQuaternion::DualNumberConjugate() const { } DualQuaternion DualQuaternion::QuaternionConjugate() const { - Quaternion q_real_out = q_real_.conjugate(); - Quaternion q_dual_out = q_dual_.conjugate(); + Quaternion q_real_out = q_real_.Conjugate(); + Quaternion q_dual_out = q_dual_.Conjugate(); DualQuaternion dq_out(q_real_out, q_dual_out); return dq_out; } DualQuaternion DualQuaternion::DualQuaternionConjugate() const { - Quaternion q_real_out = q_real_.conjugate(); - Quaternion q_dual_out = -1.0 * q_dual_.conjugate(); + Quaternion q_real_out = q_real_.Conjugate(); + Quaternion q_dual_out = -1.0 * q_dual_.Conjugate(); DualQuaternion dq_out(q_real_out, q_dual_out); return dq_out; } @@ -81,7 +81,7 @@ ScrewParameters DualQuaternion::CalcScrewParameters() const { for (int i = 0; i < 3; i++) dual_vector_part[i] = this->GetDualPart()[i]; double dual_scalar_part = this->GetDualPart()[3]; - double norm_real_vector = norm(real_vector_part); + double norm_real_vector = real_vector_part.CalcNorm(); if (norm_real_vector < 0.0 + DBL_MIN) { // We cannot define skrew parameters out.angle_rad_ = 0.0; @@ -97,7 +97,7 @@ ScrewParameters DualQuaternion::CalcScrewParameters() const { // rotation axis for (int i = 0; i < 3; i++) out.axis_[i] = real_vector_part[i]; - normalize(out.axis_); + out.axis_ = out.axis_.CalcNormalizedVector(); // rotation angle out.angle_rad_ = 2.0 * atan2(norm_real_vector, real_scalar_part); From 2d350a495b1d2d1dfa5fc7c6e7d36e4a4f9cacf5 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Wed, 12 Apr 2023 14:31:54 +0200 Subject: [PATCH 08/20] Fix function name in dual quaternion --- s2e-ff/src/Library/math/RotationFirstDualQuaternion.cpp | 8 ++++---- .../src/Library/math/TranslationFirstDualQuaternion.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/s2e-ff/src/Library/math/RotationFirstDualQuaternion.cpp b/s2e-ff/src/Library/math/RotationFirstDualQuaternion.cpp index 3ae7049a..e91f30cc 100644 --- a/s2e-ff/src/Library/math/RotationFirstDualQuaternion.cpp +++ b/s2e-ff/src/Library/math/RotationFirstDualQuaternion.cpp @@ -10,7 +10,7 @@ RotationFirstDualQuaternion::RotationFirstDualQuaternion(const DualQuaternion dq RotationFirstDualQuaternion::RotationFirstDualQuaternion(const Quaternion q_rot, const Vector<3> v_translation) { q_real_ = q_rot; - q_real_.normalize(); + q_real_.Normalize(); // TODO: Make vector * quaternion function in core's Quaternion class Quaternion q_v(v_translation[0], v_translation[1], v_translation[2], 0.0); @@ -20,7 +20,7 @@ RotationFirstDualQuaternion::RotationFirstDualQuaternion(const Quaternion q_rot, RotationFirstDualQuaternion RotationFirstDualQuaternion::CalcNormalizedRotationQauternion() const { Quaternion q_rot = q_real_; Vector<3> v_translation = this->GetTranslationVector(); - q_rot.normalize(); + q_rot.Normalize(); RotationFirstDualQuaternion dq_out(q_rot, v_translation); return dq_out; @@ -28,7 +28,7 @@ RotationFirstDualQuaternion RotationFirstDualQuaternion::CalcNormalizedRotationQ void RotationFirstDualQuaternion::NormalizeRotationQauternion() { Vector<3> v_translation = this->GetTranslationVector(); - q_real_.normalize(); + q_real_.Normalize(); RotationFirstDualQuaternion dq_out(q_real_, v_translation); q_dual_ = dq_out.GetDualPart(); @@ -55,7 +55,7 @@ RotationFirstDualQuaternion RotationFirstDualQuaternion::Integrate(const Vector< } Vector<3> RotationFirstDualQuaternion::GetTranslationVector() const { - Quaternion q_out = 2.0 * q_dual_ * q_real_.conjugate(); + Quaternion q_out = 2.0 * q_dual_ * q_real_.Conjugate(); Vector<3> v_out; for (int i = 0; i < 3; i++) v_out[i] = q_out[i]; return v_out; diff --git a/s2e-ff/src/Library/math/TranslationFirstDualQuaternion.cpp b/s2e-ff/src/Library/math/TranslationFirstDualQuaternion.cpp index 23c2a9d6..1913a87b 100644 --- a/s2e-ff/src/Library/math/TranslationFirstDualQuaternion.cpp +++ b/s2e-ff/src/Library/math/TranslationFirstDualQuaternion.cpp @@ -12,7 +12,7 @@ TranslationFirstDualQuaternion::TranslationFirstDualQuaternion(const DualQuatern TranslationFirstDualQuaternion::TranslationFirstDualQuaternion(const Vector<3> v_translation, const Quaternion q_rot) { q_real_ = q_rot; - q_real_.normalize(); + q_real_.Normalize(); // TODO: Make vector * quaternion function in core's Quaternion class Quaternion q_v(v_translation[0], v_translation[1], v_translation[2], 0.0); @@ -22,7 +22,7 @@ TranslationFirstDualQuaternion::TranslationFirstDualQuaternion(const Vector<3> v TranslationFirstDualQuaternion TranslationFirstDualQuaternion::CalcNormalizedRotationQauternion() const { Quaternion q_rot = q_real_; Vector<3> v_translation = this->GetTranslationVector(); - q_rot.normalize(); + q_rot.Normalize(); TranslationFirstDualQuaternion dq_out(v_translation, q_rot); return dq_out; @@ -30,7 +30,7 @@ TranslationFirstDualQuaternion TranslationFirstDualQuaternion::CalcNormalizedRot void TranslationFirstDualQuaternion::NormalizeRotationQauternion() { Vector<3> v_translation = this->GetTranslationVector(); - q_real_.normalize(); + q_real_.Normalize(); TranslationFirstDualQuaternion dq_out(v_translation, q_real_); q_dual_ = dq_out.GetDualPart(); @@ -57,7 +57,7 @@ TranslationFirstDualQuaternion TranslationFirstDualQuaternion::Integrate(const V } Vector<3> TranslationFirstDualQuaternion::GetTranslationVector() const { - Quaternion q_out = 2.0 * q_real_.conjugate() * q_dual_; + Quaternion q_out = 2.0 * q_real_.Conjugate() * q_dual_; Vector<3> v_out; for (int i = 0; i < 3; i++) v_out[i] = q_out[i]; return v_out; From 7377faf15c913612290140c96216f7c75a4be747 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Wed, 12 Apr 2023 14:33:03 +0200 Subject: [PATCH 09/20] Fix function name in quasi non singular OE --- .../Library/Orbit/QuasiNonsingularOrbitalElements.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/s2e-ff/src/Library/Orbit/QuasiNonsingularOrbitalElements.cpp b/s2e-ff/src/Library/Orbit/QuasiNonsingularOrbitalElements.cpp index ef32a25f..0772dd19 100644 --- a/s2e-ff/src/Library/Orbit/QuasiNonsingularOrbitalElements.cpp +++ b/s2e-ff/src/Library/Orbit/QuasiNonsingularOrbitalElements.cpp @@ -32,18 +32,18 @@ QuasiNonsingularOrbitalElements::QuasiNonsingularOrbitalElements(const double se QuasiNonsingularOrbitalElements::QuasiNonsingularOrbitalElements(const double mu_m3_s2, const libra::Vector<3> position_i_m, const libra::Vector<3> velocity_i_m_s) { // common variables - double r_m = norm(position_i_m); - double v2_m2_s2 = inner_product(velocity_i_m_s, velocity_i_m_s); + double r_m = position_i_m.CalcNorm(); + double v2_m2_s2 = libra::InnerProduct(velocity_i_m_s, velocity_i_m_s); libra::Vector<3> h; - h = outer_product(position_i_m, velocity_i_m_s); - double h_norm = norm(h); + h = libra::OuterProduct(position_i_m, velocity_i_m_s); + double h_norm = h.CalcNorm(); // semi major axis semi_major_axis_m_ = mu_m3_s2 / (2.0 * mu_m3_s2 / r_m - v2_m2_s2); // inclination libra::Vector<3> h_direction = h; - h_direction = normalize(h_direction); + h_direction = h_direction.CalcNormalizedVector(); inclination_rad_ = acos(h_direction[2]); inclination_rad_ = libra::WrapTo2Pi(inclination_rad_); From 1e8b6277278de3447ed2fcfe771fda8b2f259539 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Wed, 12 Apr 2023 14:33:52 +0200 Subject: [PATCH 10/20] Fix include path --- .../RelativeOrbit/QuasiNonsingularOrbitalElementDifferences.cpp | 2 +- .../RelativeOrbit/QuasiNonsingularOrbitalElementDifferences.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/s2e-ff/src/Library/RelativeOrbit/QuasiNonsingularOrbitalElementDifferences.cpp b/s2e-ff/src/Library/RelativeOrbit/QuasiNonsingularOrbitalElementDifferences.cpp index 573f86eb..140ab800 100644 --- a/s2e-ff/src/Library/RelativeOrbit/QuasiNonsingularOrbitalElementDifferences.cpp +++ b/s2e-ff/src/Library/RelativeOrbit/QuasiNonsingularOrbitalElementDifferences.cpp @@ -5,8 +5,8 @@ #include "QuasiNonsingularOrbitalElementDifferences.hpp" -#include #include +#include QuasiNonsingularOrbitalElementDifferences::QuasiNonsingularOrbitalElementDifferences(const QuasiNonsingularOrbitalElements qns_oe_reference, const QuasiNonsingularOrbitalElements qns_oe_target) diff --git a/s2e-ff/src/Library/RelativeOrbit/QuasiNonsingularOrbitalElementDifferences.hpp b/s2e-ff/src/Library/RelativeOrbit/QuasiNonsingularOrbitalElementDifferences.hpp index 21e202ca..ce9c145f 100644 --- a/s2e-ff/src/Library/RelativeOrbit/QuasiNonsingularOrbitalElementDifferences.hpp +++ b/s2e-ff/src/Library/RelativeOrbit/QuasiNonsingularOrbitalElementDifferences.hpp @@ -6,7 +6,7 @@ #ifndef QUASI_NONSINGULAR_ORBITAL_ELEMENT_DIFFERENCES_H_ #define QUASI_NONSINGULAR_ORBITAL_ELEMENT_DIFFERENCES_H_ -#include +#include #include "../Orbit/QuasiNonsingularOrbitalElements.hpp" From 8b4c1e23bacc1f38c364c4daa0656bf69d398887 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Wed, 12 Apr 2023 14:39:43 +0200 Subject: [PATCH 11/20] Update FfCase --- s2e-ff/src/Simulation/Case/FfCase.cpp | 43 +++++++-------------------- s2e-ff/src/Simulation/Case/FfCase.hpp | 15 ++++++++-- 2 files changed, 23 insertions(+), 35 deletions(-) diff --git a/s2e-ff/src/Simulation/Case/FfCase.cpp b/s2e-ff/src/Simulation/Case/FfCase.cpp index 06556df2..436e202f 100644 --- a/s2e-ff/src/Simulation/Case/FfCase.cpp +++ b/s2e-ff/src/Simulation/Case/FfCase.cpp @@ -8,47 +8,26 @@ FfCase::~FfCase() { } } -void FfCase::Initialize() { +void FfCase::InitializeTargetObjects() { // Instantiate the target of the simulation - for (int sat_id = 0; sat_id < sim_config_.num_of_simulated_spacecraft_; sat_id++) { - FfSat* sc = new FfSat(&sim_config_, glo_env_, &relative_information_, sat_id); + for (unsigned int sat_id = 0; sat_id < simulation_configuration_.number_of_simulated_spacecraft_; sat_id++) { + FfSat* sc = new FfSat(&simulation_configuration_, global_environment_, &relative_information_, sat_id); satellites_.push_back(sc); } // Register the log output - glo_env_->LogSetup(*(sim_config_.main_logger_)); for (auto& sc : satellites_) { - sc->LogSetup(*(sim_config_.main_logger_)); + sc->LogSetup(*(simulation_configuration_.main_logger_)); } - relative_information_.LogSetup(*(sim_config_.main_logger_)); - - // Write headers to the log - sim_config_.main_logger_->WriteHeaders(); - - // Start the simulation - std::cout << "\nSimulationDateTime \n"; - glo_env_->GetSimTime().PrintStartDateTime(); + relative_information_.LogSetup(*(simulation_configuration_.main_logger_)); } -void FfCase::Main() { - glo_env_->Reset(); // for MonteCarlo Sim - while (!glo_env_->GetSimTime().GetState().finish) { - // Logging - if (glo_env_->GetSimTime().GetState().log_output) { - sim_config_.main_logger_->WriteValues(); - } - // Global Environment Update - glo_env_->Update(); - // Spacecraft Update - for (auto& sc : satellites_) { - sc->Update(&(glo_env_->GetSimTime())); - } - // Relative Information - relative_information_.Update(); - // Debug output - if (glo_env_->GetSimTime().GetState().disp_output) { - std::cout << "Progresss: " << glo_env_->GetSimTime().GetProgressionRate() << "%\r"; - } +void FfCase::UpdateTargetObjects() { + // Spacecraft Update + for (auto& sc : satellites_) { + sc->Update(&(global_environment_->GetSimulationTime())); } + // Relative Information + relative_information_.Update(); } std::string FfCase::GetLogHeader() const { diff --git a/s2e-ff/src/Simulation/Case/FfCase.hpp b/s2e-ff/src/Simulation/Case/FfCase.hpp index fb084d58..541e1a30 100644 --- a/s2e-ff/src/Simulation/Case/FfCase.hpp +++ b/s2e-ff/src/Simulation/Case/FfCase.hpp @@ -10,13 +10,22 @@ class FfCase : public SimulationCase { FfCase(std::string ini_fname); virtual ~FfCase(); - void Initialize(); - void Main(); - virtual std::string GetLogHeader() const; virtual std::string GetLogValue() const; private: std::vector satellites_; RelativeInformation relative_information_; + + /** + * @fn InitializeTargetObjects + * @brief Override function of InitializeTargetObjects in SimulationCase + */ + void InitializeTargetObjects(); + + /** + * @fn UpdateTargetObjects + * @brief Override function of Main in SimulationCase + */ + void UpdateTargetObjects(); }; From c5f7ca0169a78891e58a207291ce56830474a53c Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Wed, 12 Apr 2023 14:43:32 +0200 Subject: [PATCH 12/20] Fix include path --- s2e-ff/src/Simulation/Spacecraft/FfComponents.cpp | 7 +++---- s2e-ff/src/Simulation/Spacecraft/FfComponents.hpp | 6 ++++-- s2e-ff/src/Simulation/Spacecraft/FfComponents2.cpp | 7 +++---- s2e-ff/src/Simulation/Spacecraft/FfComponents2.hpp | 6 ++++-- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/s2e-ff/src/Simulation/Spacecraft/FfComponents.cpp b/s2e-ff/src/Simulation/Spacecraft/FfComponents.cpp index 9d695577..82110a8d 100644 --- a/s2e-ff/src/Simulation/Spacecraft/FfComponents.cpp +++ b/s2e-ff/src/Simulation/Spacecraft/FfComponents.cpp @@ -1,8 +1,7 @@ #include "FfComponents.hpp" -#include - -#include +#include +#include #include "../../Components/AOCS/InitializeRelativeDistanceSensor.hpp" #include "../../Components/AOCS/InitializeRelativePositionSensor.hpp" @@ -10,7 +9,7 @@ #include "../../Components/IdealComponents/InitializeRelativeAttitudeController.hpp" FfComponents::FfComponents(const Dynamics* dynamics, const Structure* structure, const LocalEnvironment* local_env, const GlobalEnvironment* glo_env, - const SimulationConfig* config, ClockGenerator* clock_gen, const RelativeInformation* rel_info) + const SimulationConfiguration* config, ClockGenerator* clock_gen, const RelativeInformation* rel_info) : dynamics_(dynamics), structure_(structure), local_env_(local_env), glo_env_(glo_env), config_(config), rel_info_(rel_info) { // General const int sat_id = 0; diff --git a/s2e-ff/src/Simulation/Spacecraft/FfComponents.hpp b/s2e-ff/src/Simulation/Spacecraft/FfComponents.hpp index 3df7fdaa..5cd53613 100644 --- a/s2e-ff/src/Simulation/Spacecraft/FfComponents.hpp +++ b/s2e-ff/src/Simulation/Spacecraft/FfComponents.hpp @@ -1,5 +1,7 @@ #pragma once +#include +#include #include // include for components @@ -14,7 +16,7 @@ class FfComponents : public InstalledComponents { public: FfComponents(const Dynamics* dynamics, const Structure* structure, const LocalEnvironment* local_env, const GlobalEnvironment* glo_env, - const SimulationConfig* config, ClockGenerator* clock_gen, const RelativeInformation* rel_info); + const SimulationConfiguration* config, ClockGenerator* clock_gen, const RelativeInformation* rel_info); ~FfComponents(); libra::Vector<3> GenerateForce_N_b(); libra::Vector<3> GenerateTorque_Nm_b(); @@ -34,6 +36,6 @@ class FfComponents : public InstalledComponents { const Structure* structure_; const LocalEnvironment* local_env_; const GlobalEnvironment* glo_env_; - const SimulationConfig* config_; + const SimulationConfiguration* config_; const RelativeInformation* rel_info_; }; diff --git a/s2e-ff/src/Simulation/Spacecraft/FfComponents2.cpp b/s2e-ff/src/Simulation/Spacecraft/FfComponents2.cpp index 0a67f410..8e5e1b41 100644 --- a/s2e-ff/src/Simulation/Spacecraft/FfComponents2.cpp +++ b/s2e-ff/src/Simulation/Spacecraft/FfComponents2.cpp @@ -1,15 +1,14 @@ #include "FfComponents2.hpp" -#include - -#include +#include +#include #include "../../Components/AOCS/InitializeRelativeDistanceSensor.hpp" #include "../../Components/AOCS/InitializeRelativePositionSensor.hpp" #include "../../Components/IdealComponents/InitializeRelativeAttitudeController.hpp" FfComponents2::FfComponents2(const Dynamics* dynamics, const Structure* structure, const LocalEnvironment* local_env, - const GlobalEnvironment* glo_env, const SimulationConfig* config, ClockGenerator* clock_gen, + const GlobalEnvironment* glo_env, const SimulationConfiguration* config, ClockGenerator* clock_gen, const RelativeInformation* rel_info) : dynamics_(dynamics), structure_(structure), local_env_(local_env), glo_env_(glo_env), config_(config), rel_info_(rel_info) { // General diff --git a/s2e-ff/src/Simulation/Spacecraft/FfComponents2.hpp b/s2e-ff/src/Simulation/Spacecraft/FfComponents2.hpp index 9290a1a9..c113f1dd 100644 --- a/s2e-ff/src/Simulation/Spacecraft/FfComponents2.hpp +++ b/s2e-ff/src/Simulation/Spacecraft/FfComponents2.hpp @@ -1,5 +1,7 @@ #pragma once +#include +#include #include // include for components @@ -13,7 +15,7 @@ class FfComponents2 : public InstalledComponents { public: FfComponents2(const Dynamics* dynamics, const Structure* structure, const LocalEnvironment* local_env, const GlobalEnvironment* glo_env, - const SimulationConfig* config, ClockGenerator* clock_gen, const RelativeInformation* rel_info); + const SimulationConfiguration* config, ClockGenerator* clock_gen, const RelativeInformation* rel_info); ~FfComponents2(); libra::Vector<3> GenerateForce_N_b(); libra::Vector<3> GenerateTorque_Nm_b(); @@ -28,6 +30,6 @@ class FfComponents2 : public InstalledComponents { const Structure* structure_; const LocalEnvironment* local_env_; const GlobalEnvironment* glo_env_; - const SimulationConfig* config_; + const SimulationConfiguration* config_; const RelativeInformation* rel_info_; }; From 0413d2394f26471ffa689ba0c8b2edac2905ea0a Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Wed, 12 Apr 2023 14:46:44 +0200 Subject: [PATCH 13/20] Fix function name in FF components --- .../src/Simulation/Spacecraft/FfComponents.cpp | 18 +++++++++--------- .../Simulation/Spacecraft/FfComponents2.cpp | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/s2e-ff/src/Simulation/Spacecraft/FfComponents.cpp b/s2e-ff/src/Simulation/Spacecraft/FfComponents.cpp index 82110a8d..51d63548 100644 --- a/s2e-ff/src/Simulation/Spacecraft/FfComponents.cpp +++ b/s2e-ff/src/Simulation/Spacecraft/FfComponents.cpp @@ -13,11 +13,11 @@ FfComponents::FfComponents(const Dynamics* dynamics, const Structure* structure, : dynamics_(dynamics), structure_(structure), local_env_(local_env), glo_env_(glo_env), config_(config), rel_info_(rel_info) { // General const int sat_id = 0; - IniAccess sat_file = IniAccess(config->sat_file_[sat_id]); - double compo_step_sec = glo_env_->GetSimTime().GetCompoStepSec(); + IniAccess sat_file = IniAccess(config->spacecraft_file_list_[sat_id]); + double compo_step_sec = glo_env_->GetSimulationTime().GetComponentStepTime_s(); // Component Instantiation - obc_ = new OBC(clock_gen); + obc_ = new OnBoardComputer(clock_gen); const std::string rel_dist_file = sat_file.ReadString("COMPONENTS_FILE", "relative_distance_sensor_file"); relative_distance_sensor_ = @@ -35,8 +35,8 @@ FfComponents::FfComponents(const Dynamics* dynamics, const Structure* structure, force_generator_ = new ForceGenerator(InitializeForceGenerator(clock_gen, force_generator_file, dynamics_)); const std::string relative_attitude_controller_file = sat_file.ReadString("COMPONENTS_FILE", "relative_attitude_controller_file"); - relative_attitude_controller_ = new RelativeAttitudeController( - InitializeRelativeAttitudeController(clock_gen, relative_attitude_controller_file, *rel_info_, local_env_->GetCelesInfo(), *dynamics_, sat_id)); + relative_attitude_controller_ = new RelativeAttitudeController(InitializeRelativeAttitudeController( + clock_gen, relative_attitude_controller_file, *rel_info_, local_env_->GetCelestialInformation(), *dynamics_, sat_id)); // Debug for actuator output libra::Vector<3> force_N; @@ -69,8 +69,8 @@ Vector<3> FfComponents::GenerateTorque_Nm_b() { } void FfComponents::LogSetup(Logger& logger) { - logger.AddLoggable(relative_distance_sensor_); - logger.AddLoggable(relative_position_sensor_); - logger.AddLoggable(relative_velocity_sensor_); - logger.AddLoggable(force_generator_); + logger.AddLogList(relative_distance_sensor_); + logger.AddLogList(relative_position_sensor_); + logger.AddLogList(relative_velocity_sensor_); + logger.AddLogList(force_generator_); } diff --git a/s2e-ff/src/Simulation/Spacecraft/FfComponents2.cpp b/s2e-ff/src/Simulation/Spacecraft/FfComponents2.cpp index 8e5e1b41..882ef9d7 100644 --- a/s2e-ff/src/Simulation/Spacecraft/FfComponents2.cpp +++ b/s2e-ff/src/Simulation/Spacecraft/FfComponents2.cpp @@ -12,10 +12,10 @@ FfComponents2::FfComponents2(const Dynamics* dynamics, const Structure* structur const RelativeInformation* rel_info) : dynamics_(dynamics), structure_(structure), local_env_(local_env), glo_env_(glo_env), config_(config), rel_info_(rel_info) { // General - IniAccess sat_file = IniAccess(config->sat_file_[0]); + IniAccess sat_file = IniAccess(config->spacecraft_file_list_[0]); // Component Instantiation - obc_ = new OBC(clock_gen); + obc_ = new OnBoardComputer(clock_gen); // Debug for actuator output libra::Vector<3> force_N; From 417409ff58ea9ba813af277ff9dc5ddd77274462 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Wed, 12 Apr 2023 14:53:22 +0200 Subject: [PATCH 14/20] Fix sim base ini --- s2e-ff/data/ini/FfSimBase.ini | 87 ++++++++++++++++++----------------- 1 file changed, 44 insertions(+), 43 deletions(-) diff --git a/s2e-ff/data/ini/FfSimBase.ini b/s2e-ff/data/ini/FfSimBase.ini index ec1550fa..40b0f0ed 100644 --- a/s2e-ff/data/ini/FfSimBase.ini +++ b/s2e-ff/data/ini/FfSimBase.ini @@ -1,100 +1,101 @@ [TIME] -// Simulation start date [UTC] -StartYMDHMS=2020/01/01 12:00:00.0 +// Simulation start time [UTC] +simulation_start_time_utc = 2020/01/01 12:00:00.0 -// Simulation finish time [sec] -EndTimeSec=200 +// Simulation duration [sec] +simulation_duration_s = 200 // Simulation step time [sec] // Minimum time step for the entire simulation -StepTimeSec=0.1 +simulation_step_s = 0.1 // Attitude Update Period [sec] // Attitude is updated at the period specified here -AttitudeUpdateIntervalSec=0.1 // should be larger than StepTimeSec +attitude_update_period_s = 0.1 // should be larger than 'simulation_step_s' // Attitide Δt for Runge-Kutt method [sec] -// This must be smaller than "AttitudeUpdateIntervalSec" -AttitudeRKStepSec = 0.001 +// This must be smaller than 'attitude_update_period_s' +attitude_integral_step_s = 0.001 // Orbit Update Period [sec] // Orbit is updated at the period specified here -OrbitUpdateIntervalSec = 0.1 // should be larger than StepTimeSec +orbit_update_period_s = 0.1 // should be larger than 'simulation_step_s' // Orbit Δt for Runge-Kutta method [sec] -// This must be smaller than "OrbitUpdateIntervalSec" -OrbitRKStepSec = 0.1 +// This must be smaller than 'orbit_ppdate_period_s' +orbit_integral_step_s = 0.1 // Thermal Update Period [sec] // Thermal is updated at the period specified here -ThermalUpdateIntervalSec = 0.1 // should be larger than StepTimeSec +thermal_update_period_s = 0.1 // should be larger than 'simulation_step_s' // Thermal Δt for Runge-Kutta method [sec] -// This must be smaller than "ThermalUpdateIntervalSec" -ThermalRKStepSec = 0.1 +// This must be smaller than 'thermal_update_period_s' +thermal_integral_step_s = 0.1 // Component Update Period [sec] -CompoUpdateIntervalSec = 0.1 // should be larger than StepTimeSec +component_update_period_s = 0.1 // should be larger than 'simulation_step_s' // Log Output Period [sec] -LogOutPutIntervalSec = 0.1 // should be larger than StepTimeSec +log_output_period_s = 0.1 // should be larger than 'simulation_step_s' // Simulation speed // 0: as fast as possible, 1: real-time, >1: faster than real-time, <1: slower than real-time -SimulationSpeed = 0 +simulation_speed_setting = 0 -[PLANET_SELECTION] +[CELESTIAL_INFORMATION] // Whether global celestial information is logged or not logging = ENABLE // Definition of Inertial frame inertial_frame = J2000 -aberration_correction = NONE +// The center object is also used to define the gravity constant of the center body center_object = EARTH +aberration_correction = NONE // Earth Rotation model -// Idle:no motion,Simple:rotation only,Full:full-dynamics +// Idle:no motion, Simple:rotation only, Full:full-dynamics rotation_mode = Simple // Definition of calculation celestial bodies -num_of_selected_body = 3 -selected_body(0) = EARTH -selected_body(1) = SUN -selected_body(2) = MOON -selected_body(3) = MARS +number_of_selected_body = 3 +selected_body_name(0) = EARTH +selected_body_name(1) = SUN +selected_body_name(2) = MOON +selected_body_name(3) = MARS -[FURNSH_PATH] +[CSPICE_KERNELS] // CSPICE Kernel files definition -TLS = ../../../ExtLibraries/cspice/generic_kernels/lsk/naif0010.tls -TPC1 = ../../../ExtLibraries/cspice/generic_kernels/pck/de-403-masses.tpc -TPC2 = ../../../ExtLibraries/cspice/generic_kernels/pck/gm_de431.tpc -TPC3 = ../../../ExtLibraries/cspice/generic_kernels/pck/pck00010.tpc -BSP = ../../../ExtLibraries/cspice/generic_kernels/spk/planets/de430.bsp +tls = ../../../ExtLibraries/cspice/generic_kernels/lsk/naif0010.tls +tpc1 = ../../../ExtLibraries/cspice/generic_kernels/pck/de-403-masses.tpc +tpc2 = ../../../ExtLibraries/cspice/generic_kernels/pck/gm_de431.tpc +tpc3 = ../../../ExtLibraries/cspice/generic_kernels/pck/pck00010.tpc +bsp = ../../../ExtLibraries/cspice/generic_kernels/spk/planets/de430.bsp [HIPPARCOS_CATALOGUE] -catalogue_path = ../../../ExtLibraries/HipparcosCatalogue/hip_main.csv +catalogue_file_path = ../../../ExtLibraries/HipparcosCatalogue/hip_main.csv max_magnitude = 3.0 // Max magnitude to read from Hip catalog calculation = DISABLE logging = DISABLE -[RAND] +[RANDOMIZE] // Seed of randam. When this value is 0, the seed will be varied by time. -Rand_Seed = 0x11223344 +rand_seed = 0x11223344 -[SIM_SETTING] +[SIMULATION_SETTINGS] // Whether the ini files are saved or not -log_inifile = 1 +save_initialize_files = ENABLE // Initialize files -// File name must not over 256 characters (defined in initialize.h as MAX_CHAR_NUM) -// If you want to add a spacecraft, create the corresponding Sat.ini, and specify it as sat_file(1), sat_file(2)... . -// Reference satellites must be ordered before to use relative orbit propagation -num_of_simulated_spacecraft = 2 -sat_file(0) = ../../data/ini/FfSat.ini -sat_file(1) = ../../data/ini/FfSat2.ini -log_file_path = ../../data/logs/ +// File name must not over 1024 characters (defined in initialize_file_access.hpp as kMaxCharLength) +// If you want to add a spacecraft, create the corresponding spacecraft.ini, and specify it as spacecraft_file(1), spacecraft_file(2), ect. +// If you want to add a ground station, create the corresponding ground_station.ini, and specify it as ground_station_file(1), ground_station_file(2), ect. +number_of_simulated_spacecraft = 2 +spacecraft_file(0) = ../../data/ini/FfSat.ini +spacecraft_file(1) = ../../data/ini/FfSat2.ini +log_file_save_directory = ../../data/logs/ From e9d18e0271a764664809ad58253ada58a4d7d1d5 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Wed, 12 Apr 2023 14:54:51 +0200 Subject: [PATCH 15/20] Fix disturbance ini --- s2e-ff/data/ini/FfSatDisturbance.ini | 31 ++++++++++++++++------------ 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/s2e-ff/data/ini/FfSatDisturbance.ini b/s2e-ff/data/ini/FfSatDisturbance.ini index 9e95346b..32da0bd1 100644 --- a/s2e-ff/data/ini/FfSatDisturbance.ini +++ b/s2e-ff/data/ini/FfSatDisturbance.ini @@ -1,26 +1,29 @@ [GEOPOTENTIAL] +// Enable only when the center object is defined as the Earth calculation = DISABLE logging = ENABLE degree = 4 -file_path = ../../../ExtLibraries/GeoPotential/egm96_to360.ascii +coefficients_file_path = ../../../ExtLibraries/GeoPotential/egm96_to360.ascii -[MAG_DISTURBANCE] +[MAGNETIC_DISTURBANCE] +// Enable only when the center object is defined as the Earth calculation = ENABLE logging = ENABLE -[AIRDRAG] +[AIR_DRAG] +// Enable only when the center object is defined as the Earth calculation = ENABLE logging = ENABLE + // Condition of air drag -Temp_wall = 30 // Surface Temperature[degC] -Temp_molecular = 3 // Atmosphere Temperature[degC] -// Note: they are converted in unit [K] inside the codes -Molecular = 18.0 // Molecular weight of the thermosphere[g/mol] +wall_temperature_degC = 30 // Surface Temperature[degC] +molecular_temperature_degC = 3 // Atmosphere Temperature[degC] +molecular_weight_g_mol = 18.0 // Molecular weight of the thermosphere[g/mol] -[SRDIST] +[SOLAR_RADIATION_PRESSURE_DISTURBANCE] calculation = ENABLE logging = ENABLE @@ -33,10 +36,12 @@ logging = ENABLE [THIRD_BODY_GRAVITY] calculation = DISABLE logging = ENABLE + // The number of gravity-generating bodies other than the central body -num_of_third_body = 1 +number_of_third_body = 1 + // List of gravity-generating bodies other than the central body -// All these bodies must be included in the "selected_body" of "PlanetSelect.ini" -third_body(0) = SUN -third_body(1) = MOON -third_body(2) = MARS +// All these bodies must be included in the "selected_body_name" of "[CelestialInformation]" +third_body_name(0) = SUN +third_body_name(1) = MOON +third_body_name(2) = MARS From b06a73beaa9f5c0c15cc6c7b5f54d79d70ce5db8 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Wed, 12 Apr 2023 14:55:38 +0200 Subject: [PATCH 16/20] Fix local environment ini --- s2e-ff/data/ini/FfSatLocalEnvironment.ini | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/s2e-ff/data/ini/FfSatLocalEnvironment.ini b/s2e-ff/data/ini/FfSatLocalEnvironment.ini index 22944d49..7d2703e7 100644 --- a/s2e-ff/data/ini/FfSatLocalEnvironment.ini +++ b/s2e-ff/data/ini/FfSatLocalEnvironment.ini @@ -1,13 +1,13 @@ -[MAG_ENVIRONMENT] +[MAGNETIC_FIELD_ENVIRONMENT] calculation = ENABLE logging = ENABLE -coeff_file = ../../../s2e-core/src/Library/igrf/igrf13.coef -mag_rwdev = 10.0 //Random Walk speed[nT] -mag_rwlimit = 400.0 //Random Walk max limit[nT] -mag_wnvar = 50.0 //White noise standard deviation [nT] +coefficient_file = ../../../s2e-core/src/library/external/igrf/igrf13.coef +magnetic_field_random_walk_standard_deviation_nT = 10.0 +magnetic_field_random_walk_limit_nT = 400.0 +magnetic_field_white_noise_standard_deviation_nT = 50.0 -[SRP] +[SOLAR_RADIATION_PRESSURE_ENVIRONMENT] calculation = ENABLE logging = ENABLE @@ -19,15 +19,15 @@ logging = ENABLE // Atmosphere model // STANDARD: Model using scale height, NRLMSISE00: NRLMSISE00 model model = STANDARD -nrlmsise00_table_path = ../../../ExtLibraries/nrlmsise00/table/SpaceWeather.txt +nrlmsise00_table_file = ../../../ExtLibraries/nrlmsise00/table/SpaceWeather.txt // Whether using user-defined f10.7 and ap value // Ref of f10.7: https://www.swpc.noaa.gov/phenomena/f107-cm-radio-emissions // Ref of ap: http://wdc.kugi.kyoto-u.ac.jp/kp/kpexp-j.html -is_manual_param_used = ENABLE -manual_daily_f107 = 150.0 // User defined f10.7(1 day) -manual_average_f107 = 150.0 // User defined f10.7(30 days average) +is_manual_parameter_used = ENABLE +manual_daily_f107 = 150.0 // User defined f10.7 (1 day) +manual_average_f107 = 150.0 // User defined f10.7 (30 days average) manual_ap = 3.0 // User defined ap -rho_stddev = 0.0 // Standard deviation of the air density +air_density_standard_deviation = 0.0 // Standard deviation of the air density [LOCAL_CELESTIAL_INFORMATION] From ded8b1c9d8c3be1e031e251f7a9401c64c7fa639 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Wed, 12 Apr 2023 14:57:04 +0200 Subject: [PATCH 17/20] Fix structure ini --- s2e-ff/data/ini/FfSatStructure.ini | 136 ++++++++++++++-------------- s2e-ff/data/ini/FfSatStructure2.ini | 136 ++++++++++++++-------------- 2 files changed, 136 insertions(+), 136 deletions(-) diff --git a/s2e-ff/data/ini/FfSatStructure.ini b/s2e-ff/data/ini/FfSatStructure.ini index 7d64810d..b7c707cb 100644 --- a/s2e-ff/data/ini/FfSatStructure.ini +++ b/s2e-ff/data/ini/FfSatStructure.ini @@ -1,79 +1,79 @@ // // The origin of all vectors defined here is the body-fixed frame. // Users can define the origin of the body-fixed frame by themselves. -// If users want to define the origin as the center of gravity, they need to set cg_b = zero vector. +// If users want to define the origin as the center of gravity, they need to set center_of_gravity_b_m = zero vector. // If users want to define the origin as a specific point, they need to set all vectors to suit their definition carefully. // -[STRUCTURE] +[KINEMATIC_PARAMETERS] // Inertia Tensor @ body fixed frame [kg・m2] -Iner(0) = 0.1 //I(0,0) -Iner(1) = 0.0 //I(0,1) -Iner(2) = 0.0 //I(0,2) -Iner(3) = 0.0 //I(1,0) -Iner(4) = 0.1 //I(1,1) -Iner(5) = 0.0 //I(1,2) -Iner(6) = 0.0 //I(2,0) -Iner(7) = 0.0 //I(2,1) -Iner(8) = 0.1 //I(2,2) +inertia_tensor_kgm2(0) = 0.1 // I_xx +inertia_tensor_kgm2(1) = 0.0 // I_xy +inertia_tensor_kgm2(2) = 0.0 // I_xz +inertia_tensor_kgm2(3) = 0.0 // I_yx +inertia_tensor_kgm2(4) = 0.1 // I_yy +inertia_tensor_kgm2(5) = 0.0 // I_yz +inertia_tensor_kgm2(6) = 0.0 // I_zx +inertia_tensor_kgm2(7) = 0.0 // I_zy +inertia_tensor_kgm2(8) = 0.1 // I_zz -mass = 14 //[kg] +mass_kg = 14 // Position vector of the center of gravity @ the body frame [m] -cg_b(0) = 0.01 -cg_b(1) = 0.01 -cg_b(2) = 0.01 +center_of_gravity_b_m(0) = 0.01 +center_of_gravity_b_m(1) = 0.01 +center_of_gravity_b_m(2) = 0.01 [SURFACES] -num_of_surfaces = 6 +number_of_surfaces = 6 // Area of each surface [m^2] -area_0 = 0.25 -area_1 = 0.25 -area_2 = 0.25 -area_3 = 0.25 -area_4 = 0.25 -area_5 = 0.25 +area_0_m2 = 0.25 +area_1_m2 = 0.25 +area_2_m2 = 0.25 +area_3_m2 = 0.25 +area_4_m2 = 0.25 +area_5_m2 = 0.25 // Position vector of each surface geometric center @ body frame [m] -position_0(0) = 0.25 -position_0(1) = 0.0 -position_0(2) = 0.0 -position_1(0) = -0.25 -position_1(1) = 0.0 -position_1(2) = 0.0 -position_2(0) = 0.0 -position_2(1) = 0.25 -position_2(2) = 0.0 -position_3(0) = 0.0 -position_3(1) = -0.25 -position_3(2) = 0.0 -position_4(0) = 0.0 -position_4(1) = 0.0 -position_4(2) = 0.25 -position_5(0) = 0.0 -position_5(1) = 0.0 -position_5(2) = -0.25 +position_0_b_m(0) = 0.25 +position_0_b_m(1) = 0.0 +position_0_b_m(2) = 0.0 +position_1_b_m(0) = -0.25 +position_1_b_m(1) = 0.0 +position_1_b_m(2) = 0.0 +position_2_b_m(0) = 0.0 +position_2_b_m(1) = 0.25 +position_2_b_m(2) = 0.0 +position_3_b_m(0) = 0.0 +position_3_b_m(1) = -0.25 +position_3_b_m(2) = 0.0 +position_4_b_m(0) = 0.0 +position_4_b_m(1) = 0.0 +position_4_b_m(2) = 0.25 +position_5_b_m(0) = 0.0 +position_5_b_m(1) = 0.0 +position_5_b_m(2) = -0.25 // Normal vector of each surface @ body frame -normal_0(0) = 1.0 -normal_0(1) = 0.0 -normal_0(2) = 0.0 -normal_1(0) = -1.0 -normal_1(1) = 0.0 -normal_1(2) = 0.0 -normal_2(0) = 0.0 -normal_2(1) = 1.0 -normal_2(2) = 0.0 -normal_3(0) = 0.0 -normal_3(1) = -1.0 -normal_3(2) = 0.0 -normal_4(0) = 0.0 -normal_4(1) = 0.0 -normal_4(2) = 1.0 -normal_5(0) = 0.0 -normal_5(1) = 0.0 -normal_5(2) = -1.0 +normal_vector_0_b(0) = 1.0 +normal_vector_0_b(1) = 0.0 +normal_vector_0_b(2) = 0.0 +normal_vector_1_b(0) = -1.0 +normal_vector_1_b(1) = 0.0 +normal_vector_1_b(2) = 0.0 +normal_vector_2_b(0) = 0.0 +normal_vector_2_b(1) = 1.0 +normal_vector_2_b(2) = 0.0 +normal_vector_3_b(0) = 0.0 +normal_vector_3_b(1) = -1.0 +normal_vector_3_b(2) = 0.0 +normal_vector_4_b(0) = 0.0 +normal_vector_4_b(1) = 0.0 +normal_vector_4_b(2) = 1.0 +normal_vector_5_b(0) = 0.0 +normal_vector_5_b(1) = 0.0 +normal_vector_5_b(2) = -1.0 // Total reflectance for the Sun spectrum reflectivity_0 = 0.4 @@ -99,17 +99,17 @@ air_specularity_3 = 0.4 air_specularity_4 = 0.4 air_specularity_5 = 0.4 -[RMM] +[RESIDUAL_MAGNETIC_MOMENT] // Constant component of Residual Magnetic Moment(RMM) [A・m^2] -rmm_const_b(0) = 0.04 -rmm_const_b(1) = 0.04 -rmm_const_b(2) = 0.04 +rmm_constant_b_Am2(0) = 0.04 +rmm_constant_b_Am2(1) = 0.04 +rmm_constant_b_Am2(2) = 0.04 -// RMM Random Walk Speed [nT] -rmm_rwdev = 1.0E-5 +// RMM Random Walk Speed [A・m^2] +rmm_random_walk_speed_Am2 = 1.0E-5 -// RMM Random Walk Limit [nT] -rmm_rwlimit = 1.0E-3 +// RMM Random Walk Limit [A・m^2] +rmm_random_walk_limit_Am2 = 1.0E-3 -// RMM White Noise Standard deviation [nT] -rmm_wnvar = 5.0E-5 +// RMM White Noise Standard deviation [A・m^2] +rmm_white_noise_standard_deviation_Am2 = 5.0E-5 diff --git a/s2e-ff/data/ini/FfSatStructure2.ini b/s2e-ff/data/ini/FfSatStructure2.ini index 7d64810d..b7c707cb 100644 --- a/s2e-ff/data/ini/FfSatStructure2.ini +++ b/s2e-ff/data/ini/FfSatStructure2.ini @@ -1,79 +1,79 @@ // // The origin of all vectors defined here is the body-fixed frame. // Users can define the origin of the body-fixed frame by themselves. -// If users want to define the origin as the center of gravity, they need to set cg_b = zero vector. +// If users want to define the origin as the center of gravity, they need to set center_of_gravity_b_m = zero vector. // If users want to define the origin as a specific point, they need to set all vectors to suit their definition carefully. // -[STRUCTURE] +[KINEMATIC_PARAMETERS] // Inertia Tensor @ body fixed frame [kg・m2] -Iner(0) = 0.1 //I(0,0) -Iner(1) = 0.0 //I(0,1) -Iner(2) = 0.0 //I(0,2) -Iner(3) = 0.0 //I(1,0) -Iner(4) = 0.1 //I(1,1) -Iner(5) = 0.0 //I(1,2) -Iner(6) = 0.0 //I(2,0) -Iner(7) = 0.0 //I(2,1) -Iner(8) = 0.1 //I(2,2) +inertia_tensor_kgm2(0) = 0.1 // I_xx +inertia_tensor_kgm2(1) = 0.0 // I_xy +inertia_tensor_kgm2(2) = 0.0 // I_xz +inertia_tensor_kgm2(3) = 0.0 // I_yx +inertia_tensor_kgm2(4) = 0.1 // I_yy +inertia_tensor_kgm2(5) = 0.0 // I_yz +inertia_tensor_kgm2(6) = 0.0 // I_zx +inertia_tensor_kgm2(7) = 0.0 // I_zy +inertia_tensor_kgm2(8) = 0.1 // I_zz -mass = 14 //[kg] +mass_kg = 14 // Position vector of the center of gravity @ the body frame [m] -cg_b(0) = 0.01 -cg_b(1) = 0.01 -cg_b(2) = 0.01 +center_of_gravity_b_m(0) = 0.01 +center_of_gravity_b_m(1) = 0.01 +center_of_gravity_b_m(2) = 0.01 [SURFACES] -num_of_surfaces = 6 +number_of_surfaces = 6 // Area of each surface [m^2] -area_0 = 0.25 -area_1 = 0.25 -area_2 = 0.25 -area_3 = 0.25 -area_4 = 0.25 -area_5 = 0.25 +area_0_m2 = 0.25 +area_1_m2 = 0.25 +area_2_m2 = 0.25 +area_3_m2 = 0.25 +area_4_m2 = 0.25 +area_5_m2 = 0.25 // Position vector of each surface geometric center @ body frame [m] -position_0(0) = 0.25 -position_0(1) = 0.0 -position_0(2) = 0.0 -position_1(0) = -0.25 -position_1(1) = 0.0 -position_1(2) = 0.0 -position_2(0) = 0.0 -position_2(1) = 0.25 -position_2(2) = 0.0 -position_3(0) = 0.0 -position_3(1) = -0.25 -position_3(2) = 0.0 -position_4(0) = 0.0 -position_4(1) = 0.0 -position_4(2) = 0.25 -position_5(0) = 0.0 -position_5(1) = 0.0 -position_5(2) = -0.25 +position_0_b_m(0) = 0.25 +position_0_b_m(1) = 0.0 +position_0_b_m(2) = 0.0 +position_1_b_m(0) = -0.25 +position_1_b_m(1) = 0.0 +position_1_b_m(2) = 0.0 +position_2_b_m(0) = 0.0 +position_2_b_m(1) = 0.25 +position_2_b_m(2) = 0.0 +position_3_b_m(0) = 0.0 +position_3_b_m(1) = -0.25 +position_3_b_m(2) = 0.0 +position_4_b_m(0) = 0.0 +position_4_b_m(1) = 0.0 +position_4_b_m(2) = 0.25 +position_5_b_m(0) = 0.0 +position_5_b_m(1) = 0.0 +position_5_b_m(2) = -0.25 // Normal vector of each surface @ body frame -normal_0(0) = 1.0 -normal_0(1) = 0.0 -normal_0(2) = 0.0 -normal_1(0) = -1.0 -normal_1(1) = 0.0 -normal_1(2) = 0.0 -normal_2(0) = 0.0 -normal_2(1) = 1.0 -normal_2(2) = 0.0 -normal_3(0) = 0.0 -normal_3(1) = -1.0 -normal_3(2) = 0.0 -normal_4(0) = 0.0 -normal_4(1) = 0.0 -normal_4(2) = 1.0 -normal_5(0) = 0.0 -normal_5(1) = 0.0 -normal_5(2) = -1.0 +normal_vector_0_b(0) = 1.0 +normal_vector_0_b(1) = 0.0 +normal_vector_0_b(2) = 0.0 +normal_vector_1_b(0) = -1.0 +normal_vector_1_b(1) = 0.0 +normal_vector_1_b(2) = 0.0 +normal_vector_2_b(0) = 0.0 +normal_vector_2_b(1) = 1.0 +normal_vector_2_b(2) = 0.0 +normal_vector_3_b(0) = 0.0 +normal_vector_3_b(1) = -1.0 +normal_vector_3_b(2) = 0.0 +normal_vector_4_b(0) = 0.0 +normal_vector_4_b(1) = 0.0 +normal_vector_4_b(2) = 1.0 +normal_vector_5_b(0) = 0.0 +normal_vector_5_b(1) = 0.0 +normal_vector_5_b(2) = -1.0 // Total reflectance for the Sun spectrum reflectivity_0 = 0.4 @@ -99,17 +99,17 @@ air_specularity_3 = 0.4 air_specularity_4 = 0.4 air_specularity_5 = 0.4 -[RMM] +[RESIDUAL_MAGNETIC_MOMENT] // Constant component of Residual Magnetic Moment(RMM) [A・m^2] -rmm_const_b(0) = 0.04 -rmm_const_b(1) = 0.04 -rmm_const_b(2) = 0.04 +rmm_constant_b_Am2(0) = 0.04 +rmm_constant_b_Am2(1) = 0.04 +rmm_constant_b_Am2(2) = 0.04 -// RMM Random Walk Speed [nT] -rmm_rwdev = 1.0E-5 +// RMM Random Walk Speed [A・m^2] +rmm_random_walk_speed_Am2 = 1.0E-5 -// RMM Random Walk Limit [nT] -rmm_rwlimit = 1.0E-3 +// RMM Random Walk Limit [A・m^2] +rmm_random_walk_limit_Am2 = 1.0E-3 -// RMM White Noise Standard deviation [nT] -rmm_wnvar = 5.0E-5 +// RMM White Noise Standard deviation [A・m^2] +rmm_white_noise_standard_deviation_Am2 = 5.0E-5 From 7b096ddcb86e5bc28510329763ffa90c57332e01 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Wed, 12 Apr 2023 15:02:00 +0200 Subject: [PATCH 18/20] Fix satellite ini --- s2e-ff/data/ini/FfSat.ini | 151 ++++++++++++++++++------------------ s2e-ff/data/ini/FfSat2.ini | 152 ++++++++++++++++++------------------- 2 files changed, 147 insertions(+), 156 deletions(-) diff --git a/s2e-ff/data/ini/FfSat.ini b/s2e-ff/data/ini/FfSat.ini index c6d974e8..755ff657 100644 --- a/s2e-ff/data/ini/FfSat.ini +++ b/s2e-ff/data/ini/FfSat.ini @@ -4,24 +4,30 @@ // CONTROLLED : Attitude Calculation with Controlled Attitude mode. All disturbances and control torque are ignored. propagate_mode = CONTROLLED -// Initial angular velocity at body frame,[rad/s] -Omega_b(0) = 0.0 -Omega_b(1) = 0.0 -Omega_b(2) = 0.0 - -// Initial quaternion,i->b,(real part,imaginary part) -Quaternion_i2b(0) = 0.0 -Quaternion_i2b(1) = 0.0 -Quaternion_i2b(2) = 0.0 -Quaternion_i2b(3) = 1.0 - -// Initial torque at body frame,[Nm] +// Initialize Attitude mode +// MANUAL : Initialize Quaternion_i2b manually below +// CONTROLLED : Initialize attitude with given condition. Valid only when Attitude propagation mode is RK4. +initialize_mode = CONTROLLED + +// Initial angular velocity at body frame [rad/s] +initial_angular_velocity_b_rad_s(0) = 0.0 +initial_angular_velocity_b_rad_s(1) = 0.0 +initial_angular_velocity_b_rad_s(2) = 0.0 + +// Initial quaternion inertial frame to body frame (real part, imaginary part) +// This value also used in INERTIAL_STABILIZE mode of ControlledAttitude +initial_quaternion_i2b(0) = 0.0 +initial_quaternion_i2b(1) = 0.0 +initial_quaternion_i2b(2) = 0.0 +initial_quaternion_i2b(3) = 1.0 + +// Initial torque at body frame [Nm] // Note: The initial torque added just for the first propagation step -Torque_b(0) = +0.000 -Torque_b(1) = -0.000 -Torque_b(2) = 0.000 +initial_torque_b_Nm(0) = +0.000 +initial_torque_b_Nm(1) = -0.000 +initial_torque_b_Nm(2) = 0.000 -[ControlledAttitude] +[CONTROLLED_ATTITUDE] // Mode definitions // INERTIAL_STABILIZE // SUN_POINTING @@ -32,16 +38,15 @@ main_mode = INERTIAL_STABILIZE sub_mode = SUN_POINTING // Pointing direction @ body frame for main pointing mode -pointing_t_b(0) = 0.707 -pointing_t_b(1) = 0.707 -pointing_t_b(2) = 0.0 +main_pointing_direction_b(0) = 0.707 +main_pointing_direction_b(1) = 0.707 +main_pointing_direction_b(2) = 0.0 // Pointing direction @ body frame for sub pointing mode -// pointing_t_b and pointing_sub_t_b should separate larger than 30 degrees. -pointing_sub_t_b(0) = 0.0 -pointing_sub_t_b(1) = 0.0 -pointing_sub_t_b(2) = 1.0 - +// main_pointing_direction_b and sub_pointing_direction_b should separate larger than 30 degrees. +sub_pointing_direction_b(0) = 0.0 +sub_pointing_direction_b(1) = 0.0 +sub_pointing_direction_b(2) = 1.0 [ORBIT] calculation = ENABLE @@ -55,28 +60,42 @@ logging = ENABLE // ENCKE : Encke orbit propagation with disturbances and thruster maneuver propagate_mode = SGP4 +// Orbit initialize mode for RK4, KEPLER, and ENCKE +// DEFAULT : Use default initialize method (RK4 and ENCKE use pos/vel, KEPLER uses init_mode_kepler) +// POSITION_VELOCITY_I : Initialize with position and velocity in the inertial frame +// ORBITAL_ELEMENTS : Initialize with orbital elements +initialize_mode = POSITION_VELOCITY_I + +// Initial value definition for POSITION_VELOCITY_I initialize mode //////// +initial_position_i_m(0) = -2111769.7723711144 +initial_position_i_m(1) = -5360353.2254375768 +initial_position_i_m(2) = 3596181.6497774957 + +initial_velocity_i_m_s(0) = 4200.4344740455268 +initial_velocity_i_m_s(1) = -4637.540129059361 +initial_velocity_i_m_s(2) = -4429.2361258448807 +/////////////////////////////////////////////////////////////////////////// + +// Initial value definition for ORBITAL_ELEMENTS initialize mode //////// +semi_major_axis_m = 6794500.0 +eccentricity = 0.0015 +inclination_rad = 0.9012 +raan_rad = 0.1411 +argument_of_perigee_rad = 1.7952 +epoch_jday = 2.458940966402607e6 +/////////////////////////////////////////////////////////////////////////////// + + // Settings for SGP4 /////////////////////////////////////////////// // TLE // Example: ISS tle1=1 25544U 98067A 20076.51604214 .00016717 00000-0 10270-3 0 9005 tle2=2 25544 51.6412 86.9962 0006063 30.9353 329.2153 15.49228202 17647 +// World Geodetic System wgs = 2 // 0: wgs72old, 1: wgs72, 2: wgs84 ////////////////////////////////////////////////////////////////////////// -// Initial value definition for RK4 ////////////////////////////////////// -// *The coordinate system is defined in PlanetSelect.ini -// Initial satellite position[m] -init_position(0) = 4.2164140100E+07 // radius of GEO -init_position(1) = 0 -init_position(2) = 0 - -//initial satellite velocity[m/s] -init_velocity(0) = 0 -init_velocity(1) = 3.074661E+03 // Speed of a spacecraft in GEO -init_velocity(2) = 0 -/////////////////////////////////////////////////////////////////////////// - -// Information used for relative orbit propagation////////////////////////////// +// Settings for relative orbit propagation //////////////////////////// // Relative Orbit Update Method (0 means RK4, 1 means STM) relative_orbit_update_method = 0 // RK4 Relative Dynamics model type (only valid for RK4 update) @@ -86,57 +105,33 @@ relative_dynamics_model_type = 0 // 0: HCW stm_model_type = 0 // Initial satellite position relative to the reference satellite in LVLH frame[m] -// *The coordinate system is defined in PlanetSelect.ini -init_relative_position_lvlh(0) = 0.0 -init_relative_position_lvlh(1) = 100.0 -init_relative_position_lvlh(2) = 0.0 +// * The coordinate system is defined at [PLANET_SELECTION] in SampleSimBase.ini +initial_relative_position_lvlh_m(0) = 0.0 +initial_relative_position_lvlh_m(1) = 100.0 +initial_relative_position_lvlh_m(2) = 0.0 // initial satellite velocity relative to the reference satellite in LVLH frame[m/s] -init_relative_velocity_lvlh(0) = 0.0 -init_relative_velocity_lvlh(1) = 0.0 -init_relative_velocity_lvlh(2) = 0.0 +initial_relative_velocity_lvlh_m_s(0) = 0.0 +initial_relative_velocity_lvlh_m_s(1) = 0.0 +initial_relative_velocity_lvlh_m_s(2) = 0.0 // information of reference satellite -reference_sat_id = 1 +reference_satellite_id = 1 /////////////////////////////////////////////////////////////////////////////// - -// Information used for orbital propagation by the Kepler Motion /////////// -// initialize mode for kepler motion -// INIT_POSVEL : initialize with position and velocity defined for RK4 -// INIT_OE : initialize with the following orbital elements -init_mode_kepler = INIT_POSVEL -// Orbital Elements for INIT_OE -semi_major_axis_m = 6794500.0 -eccentricity = 0.0015 -inclination_rad = 0.9012 -raan_rad = 0.1411 -arg_perigee_rad = 1.7952 -epoch_jday = 2.458940966402607e6 -/////////////////////////////////////////////////////////////////////////////// - - -// Information used for orbital propagation by the Encke Formulation /////////// +// Settings for Encke mode /////////// error_tolerance = 0.0001 -// initialize position and vector are same with RK4 setting /////////////////////////////////////////////////////////////////////////////// -[Thermal] -IsCalcEnabled=0 -debug=0 - -[LOCAL_ENVIRONMENT] -local_env_file = ../../data/ini/FfSatLocalEnvironment.ini - +[THERMAL] +calculation = DISABLE +debug = 0 -[DISTURBANCE] -dist_file = ../../data/ini/FfSatDisturbance.ini - - -[STRUCTURE_FILE] +[SETTING_FILES] +local_environment_file = ../../data/ini/FfSatLocalEnvironment.ini +disturbance_file = ../../data/ini/FfSatDisturbance.ini structure_file = ../../data/ini/FfSatStructure.ini - -[COMPONENTS_FILE] +[COMPONENT_FILES] // Users can add the path for component initialize files here. relative_distance_sensor_file = ../../data/ini/Components/RelativeDistanceSensor.ini relative_position_sensor_file = ../../data/ini/Components/RelativePositionSensor.ini diff --git a/s2e-ff/data/ini/FfSat2.ini b/s2e-ff/data/ini/FfSat2.ini index b734e821..7f8ff181 100644 --- a/s2e-ff/data/ini/FfSat2.ini +++ b/s2e-ff/data/ini/FfSat2.ini @@ -4,24 +4,30 @@ // CONTROLLED : Attitude Calculation with Controlled Attitude mode. All disturbances and control torque are ignored. propagate_mode = RK4 -// Initial angular velocity at body frame,[rad/s] -Omega_b(0) = 0.0 -Omega_b(1) = 0.0 -Omega_b(2) = 0.0 - -// Initial quaternion,i->b,(real part,imaginary part) -Quaternion_i2b(0) = 0.0 -Quaternion_i2b(1) = 0.0 -Quaternion_i2b(2) = 0.0 -Quaternion_i2b(3) = 1.0 - -// Initial torque at body frame,[Nm] +// Initialize Attitude mode +// MANUAL : Initialize Quaternion_i2b manually below +// CONTROLLED : Initialize attitude with given condition. Valid only when Attitude propagation mode is RK4. +initialize_mode = CONTROLLED + +// Initial angular velocity at body frame [rad/s] +initial_angular_velocity_b_rad_s(0) = 0.0 +initial_angular_velocity_b_rad_s(1) = 0.0 +initial_angular_velocity_b_rad_s(2) = 0.0 + +// Initial quaternion inertial frame to body frame (real part, imaginary part) +// This value also used in INERTIAL_STABILIZE mode of ControlledAttitude +initial_quaternion_i2b(0) = 0.0 +initial_quaternion_i2b(1) = 0.0 +initial_quaternion_i2b(2) = 0.0 +initial_quaternion_i2b(3) = 1.0 + +// Initial torque at body frame [Nm] // Note: The initial torque added just for the first propagation step -Torque_b(0) = +0.000 -Torque_b(1) = -0.000 -Torque_b(2) = 0.000 +initial_torque_b_Nm(0) = +0.000 +initial_torque_b_Nm(1) = -0.000 +initial_torque_b_Nm(2) = 0.000 -[ControlledAttitude] +[CONTROLLED_ATTITUDE] // Mode definitions // INERTIAL_STABILIZE // SUN_POINTING @@ -32,16 +38,15 @@ main_mode = INERTIAL_STABILIZE sub_mode = SUN_POINTING // Pointing direction @ body frame for main pointing mode -pointing_t_b(0) = 0.707 -pointing_t_b(1) = 0.707 -pointing_t_b(2) = 0.0 +main_pointing_direction_b(0) = 0.707 +main_pointing_direction_b(1) = 0.707 +main_pointing_direction_b(2) = 0.0 // Pointing direction @ body frame for sub pointing mode -// pointing_t_b and pointing_sub_t_b should separate larger than 30 degrees. -pointing_sub_t_b(0) = 0.0 -pointing_sub_t_b(1) = 0.0 -pointing_sub_t_b(2) = 1.0 - +// main_pointing_direction_b and sub_pointing_direction_b should separate larger than 30 degrees. +sub_pointing_direction_b(0) = 0.0 +sub_pointing_direction_b(1) = 0.0 +sub_pointing_direction_b(2) = 1.0 [ORBIT] calculation = ENABLE @@ -55,28 +60,42 @@ logging = ENABLE // ENCKE : Encke orbit propagation with disturbances and thruster maneuver propagate_mode = RELATIVE +// Orbit initialize mode for RK4, KEPLER, and ENCKE +// DEFAULT : Use default initialize method (RK4 and ENCKE use pos/vel, KEPLER uses init_mode_kepler) +// POSITION_VELOCITY_I : Initialize with position and velocity in the inertial frame +// ORBITAL_ELEMENTS : Initialize with orbital elements +initialize_mode = POSITION_VELOCITY_I + +// Initial value definition for POSITION_VELOCITY_I initialize mode //////// +initial_position_i_m(0) = -2111769.7723711144 +initial_position_i_m(1) = -5360353.2254375768 +initial_position_i_m(2) = 3596181.6497774957 + +initial_velocity_i_m_s(0) = 4200.4344740455268 +initial_velocity_i_m_s(1) = -4637.540129059361 +initial_velocity_i_m_s(2) = -4429.2361258448807 +/////////////////////////////////////////////////////////////////////////// + +// Initial value definition for ORBITAL_ELEMENTS initialize mode //////// +semi_major_axis_m = 6794500.0 +eccentricity = 0.0015 +inclination_rad = 0.9012 +raan_rad = 0.1411 +argument_of_perigee_rad = 1.7952 +epoch_jday = 2.458940966402607e6 +/////////////////////////////////////////////////////////////////////////////// + + // Settings for SGP4 /////////////////////////////////////////////// // TLE // Example: ISS tle1=1 25544U 98067A 20076.51604214 .00016717 00000-0 10270-3 0 9005 tle2=2 25544 51.6412 86.9962 0006063 30.9353 329.2153 15.49228202 17647 +// World Geodetic System wgs = 2 // 0: wgs72old, 1: wgs72, 2: wgs84 ////////////////////////////////////////////////////////////////////////// -// Initial value definition for RK4 ////////////////////////////////////// -// *The coordinate system is defined in PlanetSelect.ini -// Initial satellite position[m] -init_position(0) = 4.2164140100E+07 // radius of GEO -init_position(1) = 0 -init_position(2) = 0 - -//initial satellite velocity[m/s] -init_velocity(0) = 0 -init_velocity(1) = 3.074661E+03 // Speed of a spacecraft in GEO -init_velocity(2) = 0 -/////////////////////////////////////////////////////////////////////////// - -// Information used for relative orbit propagation////////////////////////////// +// Settings for relative orbit propagation //////////////////////////// // Relative Orbit Update Method (0 means RK4, 1 means STM) relative_orbit_update_method = 0 // RK4 Relative Dynamics model type (only valid for RK4 update) @@ -86,55 +105,32 @@ relative_dynamics_model_type = 0 // 0: HCW stm_model_type = 0 // Initial satellite position relative to the reference satellite in LVLH frame[m] -// *The coordinate system is defined in PlanetSelect.ini -init_relative_position_lvlh(0) = 0.0 -init_relative_position_lvlh(1) = 100.0 -init_relative_position_lvlh(2) = 0.0 +// * The coordinate system is defined at [PLANET_SELECTION] in SampleSimBase.ini +initial_relative_position_lvlh_m(0) = 0.0 +initial_relative_position_lvlh_m(1) = 100.0 +initial_relative_position_lvlh_m(2) = 0.0 // initial satellite velocity relative to the reference satellite in LVLH frame[m/s] -init_relative_velocity_lvlh(0) = 0.0 -init_relative_velocity_lvlh(1) = 0.0 -init_relative_velocity_lvlh(2) = 0.0 +initial_relative_velocity_lvlh_m_s(0) = 0.0 +initial_relative_velocity_lvlh_m_s(1) = 0.0 +initial_relative_velocity_lvlh_m_s(2) = 0.0 // information of reference satellite -reference_sat_id = 0 +reference_satellite_id = 0 /////////////////////////////////////////////////////////////////////////////// - -// Information used for orbital propagation by the Kepler Motion /////////// -// initialize mode for kepler motion -// INIT_POSVEL : initialize with position and velocity defined for RK4 -// INIT_OE : initialize with the following orbital elements -init_mode_kepler = INIT_POSVEL -// Orbital Elements for INIT_OE -semi_major_axis_m = 6794500.0 -eccentricity = 0.0015 -inclination_rad = 0.9012 -raan_rad = 0.1411 -arg_perigee_rad = 1.7952 -epoch_jday = 2.458940966402607e6 -/////////////////////////////////////////////////////////////////////////////// - - -// Information used for orbital propagation by the Encke Formulation /////////// +// Settings for Encke mode /////////// error_tolerance = 0.0001 -// initialize position and vector are same with RK4 setting /////////////////////////////////////////////////////////////////////////////// -[Thermal] -IsCalcEnabled=0 -debug=0 - -[LOCAL_ENVIRONMENT] -local_env_file = ../../data/ini/FfSatLocalEnvironment.ini - +[THERMAL] +calculation = DISABLE +debug = 0 +thermal_file_directory = ../../data/sample/initialize_files/thermal_csv_files/ -[DISTURBANCE] -dist_file = ../../data/ini/FfSatDisturbance.ini - - -[STRUCTURE_FILE] +[SETTING_FILES] +local_environment_file = ../../data/ini/FfSatLocalEnvironment.ini +disturbance_file = ../../data/ini/FfSatDisturbance.ini structure_file = ../../data/ini/FfSatStructure2.ini - -[COMPONENTS_FILE] +[COMPONENT_FILES] // Users can add the path for component initialize files here. From 1828184b727292fbbd32c95298531e60ba184edd Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Wed, 12 Apr 2023 15:09:26 +0200 Subject: [PATCH 19/20] Fix plot name --- s2e-ff/scripts/Plot/plot_relative_position_rtn.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/s2e-ff/scripts/Plot/plot_relative_position_rtn.py b/s2e-ff/scripts/Plot/plot_relative_position_rtn.py index 1fdac682..2089d8a4 100644 --- a/s2e-ff/scripts/Plot/plot_relative_position_rtn.py +++ b/s2e-ff/scripts/Plot/plot_relative_position_rtn.py @@ -48,9 +48,9 @@ # Data read and edit # # Read S2E CSV -d1 = pandas.read_csv(read_file_name, skiprows=[1,1], sep=',', usecols=['sat1 pos from sat0_rtn(X)[m]', 'sat1 pos from sat0_rtn(Y)[m]', 'sat1 pos from sat0_rtn(Z)[m]']) +d1 = pandas.read_csv(read_file_name, skiprows=[1,1], sep=',', usecols=['sat1 pos from sat0_rtn_x[m]', 'sat1 pos from sat0_rtn_y[m]', 'sat1 pos from sat0_rtn_z[m]']) # Add satellites if you need -# d2 = pandas.read_csv(read_file_name, skiprows=[1,1], sep=',', usecols=['sat2 pos from sat0_rtn(X)[m]', 'sat2 pos from sat0_rtn(Y)[m]', 'sat2 pos from sat0_rtn(Z)[m]']) +# d2 = pandas.read_csv(read_file_name, skiprows=[1,1], sep=',', usecols=['sat2 pos from sat0_rtn_x[m]', 'sat2 pos from sat0_rtn_y[m]', 'sat2 pos from sat0_rtn_z[m]']) # Edit data if you need @@ -65,14 +65,14 @@ ax.set_zlabel("Normal [m]") # Add plot settings if you need -# ax.set_xlim(-30, 30) -# ax.set_ylim(-30, 30) -# ax.set_zlim(-20, 20) +#ax.set_xlim(-100, 100) +#ax.set_ylim(-100, 100) +#ax.set_zlim(-100, 100) ax.plot(0,0,0, marker="*", c="green", markersize=10, label="Sat0") -ax.plot(d1['sat1 pos from sat0_rtn(X)[m]'].to_numpy(),d1['sat1 pos from sat0_rtn(Y)[m]'].to_numpy(),d1['sat1 pos from sat0_rtn(Z)[m]'].to_numpy(), marker="x", c="red", label="Sat1") +ax.plot(d1['sat1 pos from sat0_rtn_x[m]'].to_numpy(),d1['sat1 pos from sat0_rtn_y[m]'].to_numpy(),d1['sat1 pos from sat0_rtn_z[m]'].to_numpy(), marker="x", c="red", label="Sat1") # Add satellites if you need -# ax.plot(d2['sat2 pos from sat0_rtn(X)[m]'].to_numpy(),d2['sat2 pos from sat0_rtn(Y)[m]'].to_numpy(),d2['sat2 pos from sat0_rtn(Z)[m]'].to_numpy(), marker="o", c="blue", label="Sat2") +# ax.plot(d2['sat2 pos from sat0_rtn_x[m]'].to_numpy(),d2['sat2 pos from sat0_rtn_y[m]'].to_numpy(),d2['sat2 pos from sat0_rtn_z[m]'].to_numpy(), marker="o", c="blue", label="Sat2") ax.legend() From 327e45062f43e453493b64907f321fad7de95299 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Wed, 12 Apr 2023 15:26:53 +0200 Subject: [PATCH 20/20] Fix function name in test codes --- s2e-ff/test/TestQuasiNonsingularOrbitalElements.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/s2e-ff/test/TestQuasiNonsingularOrbitalElements.cpp b/s2e-ff/test/TestQuasiNonsingularOrbitalElements.cpp index 281e54c0..2f07d10b 100644 --- a/s2e-ff/test/TestQuasiNonsingularOrbitalElements.cpp +++ b/s2e-ff/test/TestQuasiNonsingularOrbitalElements.cpp @@ -65,7 +65,7 @@ TEST(QuasiNonsingularOrbitalElements, ConstructorWithPositionVelocity) { position_i_m[0] = -5659121.225; position_i_m[1] = 2467374.064; position_i_m[2] = -3072838.471; - const double r_norm_m = norm(position_i_m); + const double r_norm_m = position_i_m.CalcNorm(); libra::Vector<3> velocity_i_m_s; velocity_i_m_s[0] = 3517.005128; velocity_i_m_s[1] = -323.2731889;