diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 346dbb7..541276c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ on: pull_request: env: - S2E_CORE_VERSION: v5.0.0 + S2E_CORE_VERSION: v6.0.0 C2A_CORE_VERSION: develop jobs: @@ -101,7 +101,7 @@ jobs: shell: cmd run: | cl.exe - cmake -G "Visual Studio 17 2022" -A Win32 -DCMAKE_CONFIGURATION_TYPES:STRING="Debug" -DEXT_LIB_DIR=../s2e-core/ExtLibraries -DFLIGHT_SW_DIR=../c2a-core -DC2A_NAME=Examples/minimum_user_for_s2e -D${{ matrix.use_c2a }} + cmake -G "Visual Studio 17 2022" -A Win32 -DCMAKE_CONFIGURATION_TYPES:STRING="Debug" -DEXT_LIB_DIR=../s2e-core/ExtLibraries -DFLIGHT_SW_DIR=../c2a-core -DC2A_NAME=Examples/minimum_user -D${{ matrix.use_c2a }} cmake --build . --clean-first build_s2e_linux: @@ -181,5 +181,5 @@ jobs: - name: build working-directory: ./s2e-user run: | - cmake . -DEXT_LIB_DIR=../s2e-core/ExtLibraries -DFLIGHT_SW_DIR=../c2a-core -DC2A_NAME=Examples/minimum_user_for_s2e -D${{ matrix.use_c2a }} -DUSE_SCI_COM_WINGS=OFF + cmake . -DEXT_LIB_DIR=../s2e-core/ExtLibraries -DFLIGHT_SW_DIR=../c2a-core -DC2A_NAME=Examples/minimum_user -D${{ matrix.use_c2a }} -DUSE_SCI_COM_WINGS=OFF cmake --build . diff --git a/.github/workflows/check-format.yml b/.github/workflows/check-format.yml new file mode 100644 index 0000000..e8bf945 --- /dev/null +++ b/.github/workflows/check-format.yml @@ -0,0 +1,49 @@ +name: check format + +on: + push: + branches: + - main + - develop + pull_request: + paths: + - '.github/workflows/check-format.yml' + - '.clang-format' + - 'src/**' + +jobs: + clang-format: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 2 + + - name: install clang-format + run: | + sudo apt-get update + sudo apt-get install -y clang-format + clang-format --version + + - name: check clang-format version + run: | + clang-format --version + md5sum "$(which git-clang-format)" + head "$(which git-clang-format)" + + - name: check format(push) + if: github.event_name == 'push' + run: | + git-clang-format --commit HEAD^ --diff | tee format.patch + + - name: check format(pull_request) + if: github.event_name == 'pull_request' + run: | + git-clang-format --commit ${{ github.event.pull_request.base.sha }} --diff | tee format.patch + + - name: check + run: | + git apply --allow-empty format.patch + git status + git diff --exit-code diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 85f2bfd..d84c3eb 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -17,7 +17,7 @@ jobs: - uses: actions/checkout@v3 - name: Run Labeler - uses: crazy-max/ghaction-github-labeler@v3 + uses: crazy-max/ghaction-github-labeler@v4 with: github-token: ${{ secrets.GITHUB_TOKEN }} yaml-file: .github/labels.yml diff --git a/CMakeLists.txt b/CMakeLists.txt index 2b7698c..a4fe3b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_policy(SET CMP0048 NEW) project(S2E_FOR_C2A_CORE LANGUAGES CXX DESCRIPTION "S2E_FOR_C2A_CORE" - VERSION 1.0 + VERSION 2.0.0 ) cmake_minimum_required(VERSION 3.13) @@ -39,7 +39,6 @@ if(USE_C2A) add_definitions(-DSILS_FW) #include_directories of C2A include_directories(${C2A_DIR}/src) - include_directories(${S2E_CORE_DIR}/src/Interface/SpacecraftInOut) #add subdirectory set(BUILD_C2A_AS_CXX ON) @@ -62,60 +61,21 @@ set(S2E_DIR ${CMAKE_CURRENT_COURCE_DIR}) 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) ## 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/s2e_for_c2a_core.cpp - src/Simulation/Case/c2a_core_sample_case.cpp - src/Simulation/Spacecraft/c2a_core_sample_sat.cpp - src/Simulation/Spacecraft/c2a_core_sample_components.cpp + src/simulation/case/c2a_core_sample_case.cpp + src/simulation/spacecraft/c2a_core_sample_satellite.cpp + src/simulation/spacecraft/c2a_core_sample_components.cpp ) # Create executable file add_executable(${PROJECT_NAME} ${SOURCE_FILES}) @@ -171,22 +131,19 @@ 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) ## C2A integration if(USE_C2A) @@ -203,8 +160,6 @@ if(USE_HILS) set_target_properties(SIMULATION PROPERTIES COMMON_LANGUAGE_RUNTIME "") set_target_properties(GLOBAL_ENVIRONMENT PROPERTIES COMMON_LANGUAGE_RUNTIME "") set_target_properties(LOCAL_ENVIRONMENT PROPERTIES COMMON_LANGUAGE_RUNTIME "") - set_target_properties(HILS_IO PROPERTIES COMMON_LANGUAGE_RUNTIME "") - set_target_properties(RELATIVE_INFO PROPERTIES COMMON_LANGUAGE_RUNTIME "") endif() ## Cmake debug diff --git a/README.md b/README.md index 25c1488..365b294 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ # S2E User for C2A Core ## Overview -- This repository is an example of S2E User to execute a sample of [minimum C2A](https://github.com/ut-issl/c2a-core/tree/develop/Examples/minimum_user_for_s2e) and to support an operation with WINGS (TBA). +- This repository is an example of S2E User to execute a sample of [minimum C2A](https://github.com/ut-issl/c2a-core/tree/develop/Examples/minimum_user) and to support an operation with WINGS (TBA). - The CI system for c2a-core are using this repository. - This is also an example of SILS/HILS test for C2A development. ## Notes -- Details are described [S2E Document: How to integrate C2A](https://github.com/ut-issl/s2e-documents/blob/main/Tutorials/HowToIntegrateC2A.md). -- s2e-core [v5.0.0](https://github.com/ut-issl/s2e-core/releases/tag/v5.0.0) is used. +- Details are described [S2E Document: How to integrate C2A](https://github.com/ut-issl/s2e-documents/blob/develop/Tutorials/HowToIntegrateC2A.md). +- s2e-core [v6.0.0](https://github.com/ut-issl/s2e-core/releases/tag/v6.0.0) is used. ## Related repositories @@ -17,14 +17,14 @@ ## 概要 -- C2A Core に含まれる [最小限のC2A サンプル](https://github.com/ut-issl/c2a-core/tree/develop/Examples/minimum_user_for_s2e) を SILS で動かし,かつ, WINGS (TBA) によって運用(コマンド操作とテレメトリ受信)できるようにするための最低限の S2E User. +- C2A Core に含まれる [最小限のC2A サンプル](https://github.com/ut-issl/c2a-core/tree/develop/Examples/minimum_user) を SILS で動かし,かつ, WINGS (TBA) によって運用(コマンド操作とテレメトリ受信)できるようにするための最低限の S2E User. - C2A Core の CI にもこの S2E を使っている. - C2A 開発を始める際につかう SILS/HILS の雛形にもなりうる. ## C2A in S2E について -- 詳細は [S2E Document: How to integrate C2A](https://github.com/ut-issl/s2e-documents/blob/main/Tutorials/HowToIntegrateC2A.md) を参照のこと. -- ここでは,S2E Core のバージョンは [v5.0.0](https://github.com/ut-issl/s2e-core/releases/tag/v5.0.0) を用いる. +- 詳細は [S2E Document: How to integrate C2A](https://github.com/ut-issl/s2e-documents/blob/develop/Tutorials/HowToIntegrateC2A.md) を参照のこと. +- ここでは,S2E Core のバージョンは [v6.0.0](https://github.com/ut-issl/s2e-core/releases/tag/v6.0.0) を用いる. ## 関連リポジトリ diff --git a/data/ini/c2a_core_disturbance.ini b/data/ini/c2a_core_disturbance.ini deleted file mode 100644 index ee6928e..0000000 --- a/data/ini/c2a_core_disturbance.ini +++ /dev/null @@ -1,42 +0,0 @@ -[GEOPOTENTIAL] -calculation = DISABLE -logging = DISABLE -degree = 4 -file_path = ../../../ExtLibraries/GeoPotential/egm96_to360.ascii - - -[MAG_DISTURBANCE] -calculation = DISABLE -logging = DISABLE - - -[AIRDRAG] -calculation = DISABLE -logging = DISABLE -// 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] - - -[SRDIST] -calculation = DISABLE -logging = DISABLE - - -[GRAVITY_GRADIENT] -calculation = DISABLE -logging = DISABLE - - -[THIRD_BODY_GRAVITY] -calculation = DISABLE -logging = DISABLE -// The number of gravity-generating bodies other than the central body -num_of_third_body = 0 -// ist 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 diff --git a/data/ini/c2a_core_local_environment.ini b/data/ini/c2a_core_local_environment.ini deleted file mode 100644 index a5bc2fa..0000000 --- a/data/ini/c2a_core_local_environment.ini +++ /dev/null @@ -1,34 +0,0 @@ -[MAG_ENVIRONMENT] -calculation = DISABLE -logging = DISABLE -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] - - -[SRP] -calculation = DISABLE -logging = DISABLE - - -[ATMOSPHERE] -calculation = DISABLE -logging = DISABLE - -// Atmosphere model -// STANDARD: Model using scale height, NRLMSISE00: NRLMSISE00 model -model = STANDARD -nrlmsise00_table_path = ../../../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 = DISABLE -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 - - -[LOCAL_CELESTIAL_INFORMATION] -logging = DISABLE diff --git a/data/ini/c2a_core_sample_sat.ini b/data/ini/c2a_core_sample_sat.ini deleted file mode 100644 index b6abb0a..0000000 --- a/data/ini/c2a_core_sample_sat.ini +++ /dev/null @@ -1,138 +0,0 @@ -[ATTITUDE] -// Attitude propagation mode -// RK4 : Attitude Propagation with RK4 including disturbances and control torque -// 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] -// 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 - - -[ControlledAttitude] -// Mode definitions -// INERTIAL_STABILIZE -// SUN_POINTING -// EARTH_CENTER_POINTING -// VELOCITY_DIRECTION_POINTING -// ORBIT_NORMAL_POINTING -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 - -// 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 - - -[ORBIT] -calculation = DISABLE -logging = DISABLE - -// Orbit propagation mode -// RK4 : RK4 propagation with disturbances and thruster maneuver -// SGP4 : SGP4 propagation using TLE without thruster maneuver -// RELATIVE : Relative dynamics (for formation flying simulation) -// KEPLER : Kepler orbit propagation without disturbances and thruster maneuver -// ENCKE : Encke orbit propagation with disturbances and thruster maneuver -propagate_mode = SGP4 - -// TLE definition for SGP4 /////////////////////////////////////////////// -// 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 -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////////////////////////////// -// 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) -// 0: Hill -relative_dynamics_model_type = 0 -// STM Relative Dynamics model type (only valid for STM update) -// 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 -// 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 -// information of reference satellite -reference_sat_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 /////////// -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/c2a_core_local_environment.ini - - -[DISTURBANCE] -dist_file = ../../data/ini/c2a_core_disturbance.ini - - -[STRUCTURE_FILE] -structure_file = ../../data/ini/c2a_core_structure.ini - - -[COMPONENTS_FILE] -// Users can add the path for component initialize files here. diff --git a/data/ini/c2a_core_sim_base.ini b/data/ini/c2a_core_sim_base.ini deleted file mode 100644 index 2aa5607..0000000 --- a/data/ini/c2a_core_sim_base.ini +++ /dev/null @@ -1,98 +0,0 @@ -[TIME] -// Simulation start date [UTC] -StartYMDHMS=2020/01/01 12:00:00.0 - -// Simulation finish time [sec] -EndTimeSec=86400 - -// Simulation step time [sec] -// Minimum time step for the entire simulation -StepTimeSec=0.1 - -// Attitude Update Period [sec] -// Attitude is updated at the period specified here -AttitudeUpdateIntervalSec=10 // should be larger than StepTimeSec - -// Attitide Δt for Runge-Kutt method [sec] -// This must be smaller than "AttitudeUpdateIntervalSec" -AttitudeRKStepSec = 10 - -// Orbit Update Period [sec] -// Orbit is updated at the period specified here -OrbitUpdateIntervalSec = 10 // should be larger than StepTimeSec - -// Orbit Δt for Runge-Kutta method [sec] -// This must be smaller than "OrbitUpdateIntervalSec" -OrbitRKStepSec = 10 - -// Thermal Update Period [sec] -// Thermal is updated at the period specified here -ThermalUpdateIntervalSec = 10 // should be larger than StepTimeSec - -// Thermal Δt for Runge-Kutta method [sec] -// This must be smaller than "ThermalUpdateIntervalSec" -ThermalRKStepSec = 10 - -// Component Update Period [sec] -CompoUpdateIntervalSec = 0.1 // should be larger than StepTimeSec - -// Log Output Period [sec] -LogOutPutIntervalSec = 10 // should be larger than StepTimeSec - -// Simulation speed -// 0: as fast as possible, 1: real-time, >1: faster than real-time, <1: slower than real-time -SimulationSpeed = 1 - - -[PLANET_SELECTION] -// Whether global celestial information is logged or not -logging = DISABLE - -// Definition of Inertial frame -inertial_frame = J2000 -aberration_correction = NONE -center_object = EARTH - -// Earth Rotation model -// Idle:no motion,Simple:rotation only,Full:full-dynamics -rotation_mode = Simple - -// Definition of calculation celestial bodies -num_of_selected_body = 2 -selected_body(0) = EARTH -selected_body(1) = SUN -selected_body(2) = MOON -selected_body(3) = MARS - - -[FURNSH_PATH] -// 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 - - -[HIPPARCOS_CATALOGUE] -catalogue_path = ../../../ExtLibraries/HipparcosCatalogue/hip_main.csv -max_magnitude = 3.0 // Max magnitude to read from Hip catalog -calculation = DISABLE -logging = DISABLE - - -[RAND] -// Seed of randam. When this value is 0, the seed will be varied by time. -Rand_Seed = 0x11223344 - - -[SIM_SETTING] -// Whether the ini files are saved or not -log_inifile = 1 - -// 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)... . -num_of_simulated_spacecraft = 1 -sat_file(0) = ../../data/ini/c2a_core_sample_sat.ini -log_file_path = ../../data/logs/ diff --git a/data/ini/c2a_core_structure.ini b/data/ini/c2a_core_structure.ini deleted file mode 100644 index 5ef1dfb..0000000 --- a/data/ini/c2a_core_structure.ini +++ /dev/null @@ -1,115 +0,0 @@ -// -// 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 a specific point, they need to set all vectors to suit their definition carefully. -// - -[STRUCTURE] -// 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) - -mass = 14 //[kg] - -// 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 - -[SURFACES] -num_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 - -// 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 - -// 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 - -// Total reflectance for the Sun spectrum -reflectivity_0 = 0.4 -reflectivity_1 = 0.4 -reflectivity_2 = 0.4 -reflectivity_3 = 0.4 -reflectivity_4 = 0.4 -reflectivity_5 = 0.4 - -// Specularity for the Sun spectrum -specularity_0 = 0.4 -specularity_1 = 0.4 -specularity_2 = 0.4 -specularity_3 = 0.4 -specularity_4 = 0.4 -specularity_5 = 0.4 - -// Specularity for air drag -air_specularity_0 = 0.4 -air_specularity_1 = 0.4 -air_specularity_2 = 0.4 -air_specularity_3 = 0.4 -air_specularity_4 = 0.4 -air_specularity_5 = 0.4 - -[RMM] -// 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 Random Walk Speed [nT] -rmm_rwdev = 1.0E-5 - -// RMM Random Walk Limit [nT] -rmm_rwlimit = 1.0E-3 - -// RMM White Noise Standard deviation [nT] -rmm_wnvar = 5.0E-5 diff --git a/data/initialize_files/c2a_core_disturbance.ini b/data/initialize_files/c2a_core_disturbance.ini new file mode 100644 index 0000000..1320e50 --- /dev/null +++ b/data/initialize_files/c2a_core_disturbance.ini @@ -0,0 +1,47 @@ +[GEOPOTENTIAL] +// Enable only when the center object is defined as the Earth +calculation = DISABLE +logging = DISABLE +degree = 4 +coefficients_file_path = ../../../ExtLibraries/GeoPotential/egm96_to360.ascii + + +[MAGNETIC_DISTURBANCE] +// Enable only when the center object is defined as the Earth +calculation = DISABLE +logging = DISABLE + + +[AIR_DRAG] +// Enable only when the center object is defined as the Earth +calculation = DISABLE +logging = DISABLE + +// Condition of air drag +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] + + +[SOLAR_RADIATION_PRESSURE_DISTURBANCE] +calculation = DISABLE +logging = DISABLE + + +[GRAVITY_GRADIENT] +calculation = DISABLE +logging = DISABLE + + +[THIRD_BODY_GRAVITY] +calculation = DISABLE +logging = DISABLE + +// The number of gravity-generating bodies other than the central body +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_name" of "[CelestialInformation]" +third_body_name(0) = SUN +third_body_name(1) = MOON +third_body_name(2) = MARS diff --git a/data/initialize_files/c2a_core_local_environment.ini b/data/initialize_files/c2a_core_local_environment.ini new file mode 100644 index 0000000..01b6e48 --- /dev/null +++ b/data/initialize_files/c2a_core_local_environment.ini @@ -0,0 +1,34 @@ +[MAGNETIC_FIELD_ENVIRONMENT] +calculation = DISABLE +logging = DISABLE +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 + + +[SOLAR_RADIATION_PRESSURE_ENVIRONMENT] +calculation = DISABLE +logging = DISABLE + + +[ATMOSPHERE] +calculation = DISABLE +logging = DISABLE + +// Atmosphere model +// STANDARD: Model using scale height, NRLMSISE00: NRLMSISE00 model +model = STANDARD +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_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 +air_density_standard_deviation = 0.0 // Standard deviation of the air density + + +[LOCAL_CELESTIAL_INFORMATION] +logging = DISABLE diff --git a/data/initialize_files/c2a_core_sample_sat.ini b/data/initialize_files/c2a_core_sample_sat.ini new file mode 100644 index 0000000..03c4d65 --- /dev/null +++ b/data/initialize_files/c2a_core_sample_sat.ini @@ -0,0 +1,137 @@ +[ATTITUDE] +// Attitude propagation mode +// RK4 : Attitude Propagation with RK4 including disturbances and control torque +// CONTROLLED : Attitude Calculation with Controlled Attitude mode. All disturbances and control torque are ignored. +propagate_mode = CONTROLLED + +// 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 +initial_torque_b_Nm(0) = +0.000 +initial_torque_b_Nm(1) = -0.000 +initial_torque_b_Nm(2) = 0.000 + +[CONTROLLED_ATTITUDE] +// Mode definitions +// INERTIAL_STABILIZE +// SUN_POINTING +// EARTH_CENTER_POINTING +// VELOCITY_DIRECTION_POINTING +// ORBIT_NORMAL_POINTING +main_mode = INERTIAL_STABILIZE +sub_mode = SUN_POINTING + +// Pointing direction @ body frame for main pointing mode +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 +// 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 = DISABLE +logging = DISABLE + +// Orbit propagation mode +// RK4 : RK4 propagation with disturbances and thruster maneuver +// SGP4 : SGP4 propagation using TLE without thruster maneuver +// RELATIVE : Relative dynamics (for formation flying simulation) +// KEPLER : Kepler orbit propagation without disturbances and thruster maneuver +// 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 +////////////////////////////////////////////////////////////////////////// + +// 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) +// 0: Hill +relative_dynamics_model_type = 0 +// STM Relative Dynamics model type (only valid for STM update) +// 0: HCW +stm_model_type = 0 +// Initial satellite position relative to the reference satellite in LVLH frame[m] +// * 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] +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_satellite_id = 1 +/////////////////////////////////////////////////////////////////////////////// + +// Settings for Encke mode /////////// +error_tolerance = 0.0001 +/////////////////////////////////////////////////////////////////////////////// + + +[THERMAL] +calculation = DISABLE +debug = 0 +thermal_file_directory = ../../data/sample/initialize_files/thermal_csv_files/ + +[SETTING_FILES] +local_environment_file = ../../data/initialize_files/c2a_core_local_environment.ini +disturbance_file = ../../data/initialize_files/c2a_core_disturbance.ini +structure_file = ../../data//initialize_files/c2a_core_structure.ini + +[COMPONENT_FILES] +// Users can add the path for component initialize files here. diff --git a/data/initialize_files/c2a_core_sim_base.ini b/data/initialize_files/c2a_core_sim_base.ini new file mode 100644 index 0000000..642d811 --- /dev/null +++ b/data/initialize_files/c2a_core_sim_base.ini @@ -0,0 +1,101 @@ +[TIME] +// Simulation start time [UTC] +simulation_start_time_utc = 2020/01/01 12:00:00.0 + +// Simulation duration [sec] +simulation_duration_s = 86400 + +// Simulation step time [sec] +// Minimum time step for the entire simulation +simulation_step_s = 0.1 + +// Attitude Update Period [sec] +// Attitude is updated at the period specified here +attitude_update_period_s = 10 // should be larger than 'simulation_step_s' + +// Attitide Δt for Runge-Kutt method [sec] +// This must be smaller than 'attitude_update_period_s' +attitude_integral_step_s = 10 + +// Orbit Update Period [sec] +// Orbit is updated at the period specified here +orbit_update_period_s = 10 // should be larger than 'simulation_step_s' + +// Orbit Δt for Runge-Kutta method [sec] +// This must be smaller than 'orbit_ppdate_period_s' +orbit_integral_step_s = 10 + +// Thermal Update Period [sec] +// Thermal is updated at the period specified here +thermal_update_period_s = 10 // should be larger than 'simulation_step_s' + +// Thermal Δt for Runge-Kutta method [sec] +// This must be smaller than 'thermal_update_period_s' +thermal_integral_step_s = 10 + +// Component Update Period [sec] +component_update_period_s = 0.1 // should be larger than 'simulation_step_s' + +// Log Output Period [sec] +log_output_period_s = 10 // 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 +simulation_speed_setting = 1 + + +[CELESTIAL_INFORMATION] +// Whether global celestial information is logged or not +logging = ENABLE + +// Definition of Inertial frame +inertial_frame = J2000 +// 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 +rotation_mode = Simple + +// Definition of calculation celestial bodies +number_of_selected_body = 2 +selected_body_name(0) = EARTH +selected_body_name(1) = SUN +selected_body_name(2) = MOON +selected_body_name(3) = MARS + + +[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 + + +[HIPPARCOS_CATALOGUE] +catalogue_file_path = ../../../ExtLibraries/HipparcosCatalogue/hip_main.csv +max_magnitude = 3.0 // Max magnitude to read from Hip catalog +calculation = DISABLE +logging = DISABLE + + +[RANDOMIZE] +// Seed of randam. When this value is 0, the seed will be varied by time. +rand_seed = 0x11223344 + + +[SIMULATION_SETTINGS] +// Whether the ini files are saved or not +save_initialize_files = ENABLE + +// Initialize files +// 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 = 1 +number_of_simulated_ground_station = 0 +spacecraft_file(0) = ../../data/initialize_files/c2a_core_sample_sat.ini +log_file_save_directory = ../../data/sample/logs/ diff --git a/data/initialize_files/c2a_core_structure.ini b/data/initialize_files/c2a_core_structure.ini new file mode 100644 index 0000000..b7c707c --- /dev/null +++ b/data/initialize_files/c2a_core_structure.ini @@ -0,0 +1,115 @@ +// +// 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 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. +// + +[KINEMATIC_PARAMETERS] +// Inertia Tensor @ body fixed frame [kg・m2] +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_kg = 14 + +// Position vector of the center of gravity @ the body frame [m] +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] +number_of_surfaces = 6 + +// Area of each surface [m^2] +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_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_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 +reflectivity_1 = 0.4 +reflectivity_2 = 0.4 +reflectivity_3 = 0.4 +reflectivity_4 = 0.4 +reflectivity_5 = 0.4 + +// Specularity for the Sun spectrum +specularity_0 = 0.4 +specularity_1 = 0.4 +specularity_2 = 0.4 +specularity_3 = 0.4 +specularity_4 = 0.4 +specularity_5 = 0.4 + +// Specularity for air drag +air_specularity_0 = 0.4 +air_specularity_1 = 0.4 +air_specularity_2 = 0.4 +air_specularity_3 = 0.4 +air_specularity_4 = 0.4 +air_specularity_5 = 0.4 + +[RESIDUAL_MAGNETIC_MOMENT] +// Constant component of Residual Magnetic Moment(RMM) [A・m^2] +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 [A・m^2] +rmm_random_walk_speed_Am2 = 1.0E-5 + +// RMM Random Walk Limit [A・m^2] +rmm_random_walk_limit_Am2 = 1.0E-3 + +// RMM White Noise Standard deviation [A・m^2] +rmm_white_noise_standard_deviation_Am2 = 5.0E-5 diff --git a/data/ini/components/.gitkeep b/data/initialize_files/components/.gitkeep similarity index 100% rename from data/ini/components/.gitkeep rename to data/initialize_files/components/.gitkeep diff --git a/data/ini/scenario/.gitkeep b/data/initialize_files/scenario/.gitkeep similarity index 100% rename from data/ini/scenario/.gitkeep rename to data/initialize_files/scenario/.gitkeep diff --git a/src/Simulation/Case/c2a_core_sample_case.cpp b/src/Simulation/Case/c2a_core_sample_case.cpp deleted file mode 100644 index 019e558..0000000 --- a/src/Simulation/Case/c2a_core_sample_case.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include "c2a_core_sample_case.h" - -C2aCoreSampleCase::C2aCoreSampleCase(std::string ini_fname) -: SimulationCase(ini_fname) -{ -} - -C2aCoreSampleCase::~C2aCoreSampleCase() -{ - delete spacecraft_; -} - -void C2aCoreSampleCase::Initialize() -{ - // Instantiate the target of the simulation - const int sat_id = 0; // `sat_id=0` corresponds to the index of `sat_file` in Simbase.ini - spacecraft_ = new C2aCoreSampleSat(&sim_config_, glo_env_, sat_id); - - // Register the log output - glo_env_->LogSetup(*(sim_config_.main_logger_)); - spacecraft_->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(); - -} - -void C2aCoreSampleCase::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 - spacecraft_->Update(&(glo_env_->GetSimTime())); - // Debug output - if (glo_env_->GetSimTime().GetState().disp_output) - { - std::cout << "Progresss: " << glo_env_->GetSimTime().GetProgressionRate() << "%\r"; - } - } -} - -std::string C2aCoreSampleCase::GetLogHeader() const -{ - std::string str_tmp = ""; - - return str_tmp; -} - -std::string C2aCoreSampleCase::GetLogValue() const -{ - std::string str_tmp = ""; - - return str_tmp; -} diff --git a/src/Simulation/Case/c2a_core_sample_case.h b/src/Simulation/Case/c2a_core_sample_case.h deleted file mode 100644 index 87613d3..0000000 --- a/src/Simulation/Case/c2a_core_sample_case.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once - -#include "SimulationCase.h" -#include "../Spacecraft/c2a_core_sample_sat.h" - -class C2aCoreSampleCase: public SimulationCase -{ -public: - C2aCoreSampleCase(std::string ini_fname); - virtual ~C2aCoreSampleCase(); - - void Initialize(); - void Main(); - - virtual std::string GetLogHeader() const; - virtual std::string GetLogValue() const; - -private: - C2aCoreSampleSat* spacecraft_; -}; diff --git a/src/Simulation/Spacecraft/c2a_core_sample_components.cpp b/src/Simulation/Spacecraft/c2a_core_sample_components.cpp deleted file mode 100644 index 6103af5..0000000 --- a/src/Simulation/Spacecraft/c2a_core_sample_components.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include "c2a_core_sample_components.h" - -#include - -#ifdef USE_C2A -#include "src_user/Settings/port_config.h" -#endif - -C2aCoreSampleComponents::C2aCoreSampleComponents(const Dynamics* dynamics, const Structure* structure, const LocalEnvironment* local_env, - const GlobalEnvironment* glo_env, const SimulationConfig* config, ClockGenerator* clock_gen) - : dynamics_(dynamics), structure_(structure), local_env_(local_env), glo_env_(glo_env), config_(config) { -#ifdef USE_C2A - obc_ = new OBC_C2A(clock_gen, 100); - - obc_->ConnectComPort(PORT_CH_RS422_MOBC_EXT, 1024, 1024); // UART通信用にとりあえず繋いでおく -#endif -} - -C2aCoreSampleComponents::~C2aCoreSampleComponents() { - // OBC must be deleted the last since it has com ports - delete obc_; -} - -Vector<3> C2aCoreSampleComponents::GenerateForce_N_b() { - // There is no orbit control component, so it remains 0 - Vector<3> force_N_b_(0.0); - return force_N_b_; -} - -Vector<3> C2aCoreSampleComponents::GenerateTorque_Nm_b() { - // No attitude control component - Vector<3> torque_Nm_b_(0.0); - return torque_Nm_b_; -} - -void C2aCoreSampleComponents::LogSetup(Logger& logger) { UNUSED(logger); } diff --git a/src/Simulation/Spacecraft/c2a_core_sample_components.h b/src/Simulation/Spacecraft/c2a_core_sample_components.h deleted file mode 100644 index 8f255de..0000000 --- a/src/Simulation/Spacecraft/c2a_core_sample_components.h +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once - -#include - -#include "Dynamics.h" -#include "GlobalEnvironment.h" -#include "LocalEnvironment.h" -#include "Vector.hpp" - -// include for components -#include "OBC_C2A.h" - -class C2aCoreSampleComponents : public InstalledComponents { - public: - C2aCoreSampleComponents(const Dynamics* dynamics, const Structure* structure, const LocalEnvironment* local_env, const GlobalEnvironment* glo_env, - const SimulationConfig* config, ClockGenerator* clock_gen); - ~C2aCoreSampleComponents(); - libra::Vector<3> GenerateForce_N_b(); - libra::Vector<3> GenerateTorque_Nm_b(); - void LogSetup(Logger& logger); - - private: - // Components - OBC_C2A* obc_; - - // References - const Dynamics* dynamics_; - const Structure* structure_; - const LocalEnvironment* local_env_; - const GlobalEnvironment* glo_env_; - const SimulationConfig* config_; -}; diff --git a/src/Simulation/Spacecraft/c2a_core_sample_sat.cpp b/src/Simulation/Spacecraft/c2a_core_sample_sat.cpp deleted file mode 100644 index 1358731..0000000 --- a/src/Simulation/Spacecraft/c2a_core_sample_sat.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "c2a_core_sample_sat.h" - -#include "c2a_core_sample_components.h" - -C2aCoreSampleSat::C2aCoreSampleSat(SimulationConfig* sim_config, const GlobalEnvironment* glo_env, const int sat_id) - : Spacecraft(sim_config, glo_env, sat_id) { - components_ = new C2aCoreSampleComponents(dynamics_, structure_, local_env_, glo_env, sim_config, &clock_gen_); -} diff --git a/src/Simulation/Spacecraft/c2a_core_sample_sat.h b/src/Simulation/Spacecraft/c2a_core_sample_sat.h deleted file mode 100644 index d9215b3..0000000 --- a/src/Simulation/Spacecraft/c2a_core_sample_sat.h +++ /dev/null @@ -1,11 +0,0 @@ -#pragma once - -#include "Spacecraft.h" -#include "c2a_core_sample_components.h" - -class C2aCoreSampleSat : public Spacecraft -{ -public: - C2aCoreSampleSat(SimulationConfig* sim_config, const GlobalEnvironment* glo_env, const int sat_id); -private: -}; diff --git a/src/Component/.gitkeep b/src/components/.gitkeep similarity index 100% rename from src/Component/.gitkeep rename to src/components/.gitkeep diff --git a/src/s2e_for_c2a_core.cpp b/src/s2e_for_c2a_core.cpp index d5b1847..84f3f2c 100644 --- a/src/s2e_for_c2a_core.cpp +++ b/src/s2e_for_c2a_core.cpp @@ -1,17 +1,21 @@ +/** + * @file s2e_for_c2a_core.cpp + * @brief The main file of S2E-FOR-C2A-CORE + */ + // Simulator includes -#include "Interface/LogOutput/Logger.h" +#include "library/logger/logger.hpp" // Add custom include files -#include "./Simulation/Case/c2a_core_sample_case.h" +#include "./simulation/case/c2a_core_sample_case.hpp" -// degub print of initialize file path -void print_path(std::string path) -{ +// debug print of initialize file path +void print_path(std::string path) { #ifdef WIN32 std::cout << path << std::endl; #else const char *rpath = realpath(path.c_str(), NULL); - if(rpath) { + if (rpath) { std::cout << rpath << std::endl; free((void *)rpath); } @@ -19,10 +23,9 @@ void print_path(std::string path) } // Main function -int main() -{ +int main() { // Set initialize file - std::string ini_file = "../../data/ini/c2a_core_sim_base.ini"; + std::string ini_file = "../../data/initialize_files/c2a_core_sim_base.ini"; std::cout << "Starting simulation..." << std::endl; std::cout << "\tIni file: "; diff --git a/src/simulation/case/c2a_core_sample_case.cpp b/src/simulation/case/c2a_core_sample_case.cpp new file mode 100644 index 0000000..1bbb912 --- /dev/null +++ b/src/simulation/case/c2a_core_sample_case.cpp @@ -0,0 +1,37 @@ +/** + * @file c2a_core_sample_case.cpp + * @brief User defined simulation case for C2A-CORE + */ + +#include "c2a_core_sample_case.hpp" + +C2aCoreSampleCase::C2aCoreSampleCase(const std::string initialise_base_file) : SimulationCase(initialise_base_file) {} + +C2aCoreSampleCase::~C2aCoreSampleCase() { delete spacecraft_; } + +void C2aCoreSampleCase::InitializeTargetObjects() { + // Instantiate the target of the simulation + // `spacecraft_id` corresponds to the index of `spacecraft_file` in simulation_base.ini + const int spacecraft_id = 0; + spacecraft_ = new C2aCoreSampleSatellite(&simulation_configuration_, global_environment_, spacecraft_id); + + // Register the log output + spacecraft_->LogSetup(*(simulation_configuration_.main_logger_)); +} + +void C2aCoreSampleCase::UpdateTargetObjects() { + // Spacecraft Update + spacecraft_->Update(&(global_environment_->GetSimulationTime())); +} + +std::string C2aCoreSampleCase::GetLogHeader() const { + std::string str_tmp = ""; + + return str_tmp; +} + +std::string C2aCoreSampleCase::GetLogValue() const { + std::string str_tmp = ""; + + return str_tmp; +} diff --git a/src/simulation/case/c2a_core_sample_case.hpp b/src/simulation/case/c2a_core_sample_case.hpp new file mode 100644 index 0000000..46009f8 --- /dev/null +++ b/src/simulation/case/c2a_core_sample_case.hpp @@ -0,0 +1,57 @@ +/** + * @file c2a_core_sample_case.hpp + * @brief User defined simulation case for C2A-CORE + */ + +#ifndef S2E_SIMULATION_CASE_C2A_CORE_SAMPLE_CASE_HPP_ +#define S2E_SIMULATION_CASE_C2A_CORE_SAMPLE_CASE_HPP_ + +#include <./simulation/case/simulation_case.hpp> + +#include "../spacecraft/c2a_core_sample_satellite.hpp" + +/** + * @class C2aCoreSampleCase + * @brief User defined simulation case for C2A-CORE + */ +class C2aCoreSampleCase : public SimulationCase { + public: + /** + * @fn C2aCoreSampleCase + * @brief Constructor + */ + C2aCoreSampleCase(const std::string initialise_base_file); + /** + * @fn ~C2aCoreSampleCase + * @brief Destructor + */ + virtual ~C2aCoreSampleCase(); + + /** + * @fn GetLogHeader + * @brief Override function of GetLogHeader + */ + virtual std::string GetLogHeader() const; + /** + * @fn GetLogValue + * @brief Override function of GetLogValue + */ + virtual std::string GetLogValue() const; + + private: + C2aCoreSampleSatellite* spacecraft_; //!< Spacecraft Instance + + /** + * @fn InitializeTargetObjects + * @brief Override function of InitializeTargetObjects in SimulationCase + */ + void InitializeTargetObjects(); + + /** + * @fn UpdateTargetObjects + * @brief Override function of Main in SimulationCase + */ + void UpdateTargetObjects(); +}; + +#endif // S2E_SIMULATION_CASE_C2A_CORE_SAMPLE_CASE_HPP_ diff --git a/src/Simulation/GroundStation/.gitkeep b/src/simulation/ground_station/.gitkeep similarity index 100% rename from src/Simulation/GroundStation/.gitkeep rename to src/simulation/ground_station/.gitkeep diff --git a/src/simulation/spacecraft/c2a_core_sample_components.cpp b/src/simulation/spacecraft/c2a_core_sample_components.cpp new file mode 100644 index 0000000..f18e78f --- /dev/null +++ b/src/simulation/spacecraft/c2a_core_sample_components.cpp @@ -0,0 +1,46 @@ +/** + * @file c2a_core_sample_components.cpp + * @brief User side components management installed on a spacecraft for C2A-CORE + */ + +#include "c2a_core_sample_components.hpp" + +#include + +#ifdef USE_C2A +#include "src_user/Settings/port_config.h" +#endif + +C2aCoreSampleComponents::C2aCoreSampleComponents(const Dynamics* dynamics, Structure* structure, const LocalEnvironment* local_environment, + const GlobalEnvironment* global_environment, const SimulationConfiguration* configuration, + ClockGenerator* clock_generator) + : dynamics_(dynamics), + structure_(structure), + local_environment_(local_environment), + global_environment_(global_environment), + configuration_(configuration) { +#ifdef USE_C2A + obc_ = new ObcWithC2a(clock_generator, 100); + + obc_->ConnectComPort(PORT_CH_RS422_MOBC_EXT, 1024, 1024); // Connect UART Port +#endif +} + +C2aCoreSampleComponents::~C2aCoreSampleComponents() { + // OBC must be deleted the last since it has com ports + delete obc_; +} + +Vector<3> C2aCoreSampleComponents::GenerateForce_b_N() { + // There is no orbit control component, so it remains 0 + Vector<3> force_b_N(0.0); + return force_b_N; +} + +Vector<3> C2aCoreSampleComponents::GenerateTorque_b_Nm() { + // No attitude control component + Vector<3> torque_b_Nm(0.0); + return torque_b_Nm; +} + +void C2aCoreSampleComponents::LogSetup(Logger& logger) { UNUSED(logger); } diff --git a/src/simulation/spacecraft/c2a_core_sample_components.hpp b/src/simulation/spacecraft/c2a_core_sample_components.hpp new file mode 100644 index 0000000..fd6dda1 --- /dev/null +++ b/src/simulation/spacecraft/c2a_core_sample_components.hpp @@ -0,0 +1,66 @@ +/** + * @file c2a_core_sample_components.hpp + * @brief User side components management installed on a spacecraft for C2A-CORE + */ + +#ifndef S2E_SIMULATION_SPACECRAFT_C2A_CORE_SAMPLE_COMPONENTS_HPP_ +#define S2E_SIMULATION_SPACECRAFT_C2A_CORE_SAMPLE_COMPONENTS_HPP_ + +#include +#include +#include +#include +#include + +// include for components +#include + +/** + * @class C2aCoreSampleComponents + * @brief User side components management installed on a spacecraft for C2A-CORE + */ +class C2aCoreSampleComponents : public InstalledComponents { + public: + /** + * @fn C2aCoreSampleComponents + * @brief Constructor + */ + C2aCoreSampleComponents(const Dynamics* dynamics, Structure* structure, const LocalEnvironment* local_environment, + const GlobalEnvironment* global_environment, const SimulationConfiguration* configuration, ClockGenerator* clock_generator); + + /** + * @fn ~C2aCoreSampleComponents + * @brief Destructor + */ + ~C2aCoreSampleComponents(); + + // Override functions for InstalledComponents + /** + * @fn GenerateForce_b_N + * @brief Return force generated by components in unit Newton in body fixed frame + */ + libra::Vector<3> GenerateForce_b_N(); + /** + * @fn GenerateTorque_b_Nm + * @brief Return torque generated by components in unit Newton-meter in body fixed frame + */ + libra::Vector<3> GenerateTorque_b_Nm(); + /** + * @fn LogSetup + * @brief Setup the logger for components + */ + void LogSetup(Logger& logger); + + private: + // Components + ObcWithC2a* obc_; //!< Onboard Computer with C2A + + // References + const Dynamics* dynamics_; //!< Dynamics information of the spacecraft + const Structure* structure_; //!< Structure information of the spacecraft + const LocalEnvironment* local_environment_; //!< Local environment information around the spacecraft + const GlobalEnvironment* global_environment_; //!< Global environment information around the spacecraft + const SimulationConfiguration* configuration_; //!< Simulation settings +}; + +#endif // S2E_SIMULATION_SPACECRAFT_C2A_CORE_SAMPLE_COMPONENTS_HPP_ diff --git a/src/simulation/spacecraft/c2a_core_sample_satellite.cpp b/src/simulation/spacecraft/c2a_core_sample_satellite.cpp new file mode 100644 index 0000000..56ca4aa --- /dev/null +++ b/src/simulation/spacecraft/c2a_core_sample_satellite.cpp @@ -0,0 +1,15 @@ +/** + * @file c2a_core_sample_satellite.cpp + * @brief User side spacecraft class for C2A-CORE + */ + +#include "c2a_core_sample_satellite.hpp" + +#include "c2a_core_sample_components.hpp" + +C2aCoreSampleSatellite::C2aCoreSampleSatellite(const SimulationConfiguration* simulation_configuration, const GlobalEnvironment* global_environment, + const unsigned int spacecraft_id) + : Spacecraft(simulation_configuration, global_environment, spacecraft_id) { + components_ = + new C2aCoreSampleComponents(dynamics_, structure_, local_environment_, global_environment, simulation_configuration, &clock_generator_); +} diff --git a/src/simulation/spacecraft/c2a_core_sample_satellite.hpp b/src/simulation/spacecraft/c2a_core_sample_satellite.hpp new file mode 100644 index 0000000..f0d0da8 --- /dev/null +++ b/src/simulation/spacecraft/c2a_core_sample_satellite.hpp @@ -0,0 +1,29 @@ +/** + * @file c2a_core_sample_satellite.hpp + * @brief User side spacecraft class for C2A-CORE + */ + +#ifndef S2E_SIMULATION_SPACECRAFT_C2A_CORE_SAMPLE_SATELLITE_HPP_ +#define S2E_SIMULATION_SPACECRAFT_C2A_CORE_SAMPLE_SATELLITE_HPP_ + +#include + +#include "c2a_core_sample_components.hpp" + +/** + * @class C2aCoreSampleSatellite + * @brief User side spacecraft class for C2A-CORE + */ +class C2aCoreSampleSatellite : public Spacecraft { + public: + /** + * @fn C2aCoreSampleSat + * @brief Constructor + */ + C2aCoreSampleSatellite(const SimulationConfiguration* simulation_configuration, const GlobalEnvironment* global_environment, + const unsigned int spacecraft_id); + + private: +}; + +#endif // S2E_SIMULATION_SPACECRAFT_C2A_CORE_SAMPLE_SATELLITE_HPP_