From 5d4729c253561919a7651d8575bf20ee19eb19d1 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 26 May 2022 10:59:36 +0000 Subject: [PATCH 01/38] Update crazy-max/ghaction-github-labeler action to v4 --- .github/workflows/labeler.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From ddef0765091b86ec15717da9684bb7a318608d1a Mon Sep 17 00:00:00 2001 From: Ryo Suzumoto Date: Fri, 17 Jun 2022 02:07:25 +0900 Subject: [PATCH 02/38] rename minimum_user_for_s2e to minimum_user --- .github/workflows/build.yml | 4 ++-- README.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 346dbb7..ee92ca7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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/README.md b/README.md index 25c1488..c390609 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # 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. @@ -17,7 +17,7 @@ ## 概要 -- 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 の雛形にもなりうる. From 0ac6bb74a69de8fc827d4db20303b04e86496516 Mon Sep 17 00:00:00 2001 From: Ryo Suzumoto Date: Mon, 12 Sep 2022 23:25:22 +0900 Subject: [PATCH 03/38] fix docs --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c390609..ac1c7ca 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ ## Notes -- Details are described [S2E Document: How to integrate C2A](https://github.com/ut-issl/s2e-documents/blob/main/Tutorials/HowToIntegrateC2A.md). +- Details are described [S2E Document: How to integrate C2A](https://github.com/ut-issl/s2e-documents/blob/develop/Tutorials/HowToIntegrateC2A.md). - s2e-core [v5.0.0](https://github.com/ut-issl/s2e-core/releases/tag/v5.0.0) is used. @@ -23,7 +23,7 @@ ## C2A in S2E について -- 詳細は [S2E Document: How to integrate C2A](https://github.com/ut-issl/s2e-documents/blob/main/Tutorials/HowToIntegrateC2A.md) を参照のこと. +- 詳細は [S2E Document: How to integrate C2A](https://github.com/ut-issl/s2e-documents/blob/develop/Tutorials/HowToIntegrateC2A.md) を参照のこと. - ここでは,S2E Core のバージョンは [v5.0.0](https://github.com/ut-issl/s2e-core/releases/tag/v5.0.0) を用いる. From b1140eadd910ddbfff4dee04f1c66492efd2a4db Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Wed, 5 Apr 2023 16:26:47 +0200 Subject: [PATCH 04/38] Fix CMake to suit with s2e-core v6.0.0 --- CMakeLists.txt | 76 +++++++++++--------------------------------------- 1 file changed, 16 insertions(+), 60 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2b7698c..acf0ab2 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 ) cmake_minimum_required(VERSION 3.13) @@ -28,7 +28,7 @@ if(NOT DEFINED FLIGHT_SW_DIR) set(FLIGHT_SW_DIR ../FlightSW) endif() if(NOT DEFINED C2A_NAME) - set(C2A_NAME "c2a_sample") + set(C2A_NAME "c2a-core/Examples/minimum_user") endif() ## options to use C2A @@ -62,54 +62,15 @@ 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 @@ -171,22 +132,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 +161,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 From ee7ecb2735bae1822b6925c0be7ee37fbe4cc595 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Wed, 5 Apr 2023 16:28:28 +0200 Subject: [PATCH 05/38] Apply clang format --- src/Simulation/Case/c2a_core_sample_case.cpp | 34 ++++++------------- src/Simulation/Case/c2a_core_sample_case.h | 9 +++-- .../Spacecraft/c2a_core_sample_sat.h | 8 ++--- src/s2e_for_c2a_core.cpp | 8 ++--- 4 files changed, 21 insertions(+), 38 deletions(-) diff --git a/src/Simulation/Case/c2a_core_sample_case.cpp b/src/Simulation/Case/c2a_core_sample_case.cpp index 019e558..bd9ab77 100644 --- a/src/Simulation/Case/c2a_core_sample_case.cpp +++ b/src/Simulation/Case/c2a_core_sample_case.cpp @@ -1,17 +1,10 @@ #include "c2a_core_sample_case.h" -C2aCoreSampleCase::C2aCoreSampleCase(std::string ini_fname) -: SimulationCase(ini_fname) -{ -} +C2aCoreSampleCase::C2aCoreSampleCase(std::string ini_fname) : SimulationCase(ini_fname) {} -C2aCoreSampleCase::~C2aCoreSampleCase() -{ - delete spacecraft_; -} +C2aCoreSampleCase::~C2aCoreSampleCase() { delete spacecraft_; } -void C2aCoreSampleCase::Initialize() -{ +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); @@ -26,17 +19,13 @@ void C2aCoreSampleCase::Initialize() // 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) - { +void C2aCoreSampleCase::Main() { + glo_env_->Reset(); // for MonteCarlo Sim + while (!glo_env_->GetSimTime().GetState().finish) { // Logging - if (glo_env_->GetSimTime().GetState().log_output) - { + if (glo_env_->GetSimTime().GetState().log_output) { sim_config_.main_logger_->WriteValues(); } // Global Environment Update @@ -44,22 +33,19 @@ void C2aCoreSampleCase::Main() // Spacecraft Update spacecraft_->Update(&(glo_env_->GetSimTime())); // Debug output - if (glo_env_->GetSimTime().GetState().disp_output) - { + if (glo_env_->GetSimTime().GetState().disp_output) { std::cout << "Progresss: " << glo_env_->GetSimTime().GetProgressionRate() << "%\r"; } } } -std::string C2aCoreSampleCase::GetLogHeader() const -{ +std::string C2aCoreSampleCase::GetLogHeader() const { std::string str_tmp = ""; return str_tmp; } -std::string C2aCoreSampleCase::GetLogValue() const -{ +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 index 87613d3..3b7bbd2 100644 --- a/src/Simulation/Case/c2a_core_sample_case.h +++ b/src/Simulation/Case/c2a_core_sample_case.h @@ -1,11 +1,10 @@ #pragma once -#include "SimulationCase.h" #include "../Spacecraft/c2a_core_sample_sat.h" +#include "SimulationCase.h" -class C2aCoreSampleCase: public SimulationCase -{ -public: +class C2aCoreSampleCase : public SimulationCase { + public: C2aCoreSampleCase(std::string ini_fname); virtual ~C2aCoreSampleCase(); @@ -15,6 +14,6 @@ class C2aCoreSampleCase: public SimulationCase virtual std::string GetLogHeader() const; virtual std::string GetLogValue() const; -private: + private: C2aCoreSampleSat* spacecraft_; }; diff --git a/src/Simulation/Spacecraft/c2a_core_sample_sat.h b/src/Simulation/Spacecraft/c2a_core_sample_sat.h index d9215b3..90f4ad8 100644 --- a/src/Simulation/Spacecraft/c2a_core_sample_sat.h +++ b/src/Simulation/Spacecraft/c2a_core_sample_sat.h @@ -3,9 +3,9 @@ #include "Spacecraft.h" #include "c2a_core_sample_components.h" -class C2aCoreSampleSat : public Spacecraft -{ -public: +class C2aCoreSampleSat : public Spacecraft { + public: C2aCoreSampleSat(SimulationConfig* sim_config, const GlobalEnvironment* glo_env, const int sat_id); -private: + + private: }; diff --git a/src/s2e_for_c2a_core.cpp b/src/s2e_for_c2a_core.cpp index d5b1847..e460374 100644 --- a/src/s2e_for_c2a_core.cpp +++ b/src/s2e_for_c2a_core.cpp @@ -5,13 +5,12 @@ #include "./Simulation/Case/c2a_core_sample_case.h" // degub print of initialize file path -void print_path(std::string 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,8 +18,7 @@ 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"; From 320724fb030e01ec3e93da08099b7d908e658045 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Wed, 5 Apr 2023 16:41:03 +0200 Subject: [PATCH 06/38] Fix to build with s2e-core v6.0.0 --- src/Simulation/Case/c2a_core_sample_case.cpp | 36 +++++-------------- src/Simulation/Case/c2a_core_sample_case.h | 18 +++++++--- .../Spacecraft/c2a_core_sample_components.cpp | 18 +++++----- .../Spacecraft/c2a_core_sample_components.h | 23 ++++++------ .../Spacecraft/c2a_core_sample_sat.cpp | 4 +-- .../Spacecraft/c2a_core_sample_sat.h | 5 +-- src/s2e_for_c2a_core.cpp | 4 +-- 7 files changed, 49 insertions(+), 59 deletions(-) diff --git a/src/Simulation/Case/c2a_core_sample_case.cpp b/src/Simulation/Case/c2a_core_sample_case.cpp index bd9ab77..2dc0bf5 100644 --- a/src/Simulation/Case/c2a_core_sample_case.cpp +++ b/src/Simulation/Case/c2a_core_sample_case.cpp @@ -4,39 +4,19 @@ C2aCoreSampleCase::C2aCoreSampleCase(std::string ini_fname) : SimulationCase(ini C2aCoreSampleCase::~C2aCoreSampleCase() { delete spacecraft_; } -void C2aCoreSampleCase::Initialize() { +void C2aCoreSampleCase::InitializeTargetObjects() { // 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); + // `spacecraft_id` corresponds to the index of `spacecraft_file` in simulation_base.ini + const int spacecraft_id = 0; + spacecraft_ = new C2aCoreSampleSat(&simulation_configuration_, global_environment_, spacecraft_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(); + spacecraft_->LogSetup(*(simulation_configuration_.main_logger_)); } -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"; - } - } +void C2aCoreSampleCase::UpdateTargetObjects() { + // Spacecraft Update + spacecraft_->Update(&(global_environment_->GetSimulationTime())); } std::string C2aCoreSampleCase::GetLogHeader() const { diff --git a/src/Simulation/Case/c2a_core_sample_case.h b/src/Simulation/Case/c2a_core_sample_case.h index 3b7bbd2..95477da 100644 --- a/src/Simulation/Case/c2a_core_sample_case.h +++ b/src/Simulation/Case/c2a_core_sample_case.h @@ -1,19 +1,29 @@ #pragma once +#include <./simulation/case/simulation_case.hpp> + #include "../Spacecraft/c2a_core_sample_sat.h" -#include "SimulationCase.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_; + + /** + * @fn InitializeTargetObjects + * @brief Override function of InitializeTargetObjects in SimulationCase + */ + void InitializeTargetObjects(); + + /** + * @fn UpdateTargetObjects + * @brief Override function of Main in SimulationCase + */ + void UpdateTargetObjects(); }; diff --git a/src/Simulation/Spacecraft/c2a_core_sample_components.cpp b/src/Simulation/Spacecraft/c2a_core_sample_components.cpp index 6103af5..eae47b7 100644 --- a/src/Simulation/Spacecraft/c2a_core_sample_components.cpp +++ b/src/Simulation/Spacecraft/c2a_core_sample_components.cpp @@ -1,16 +1,16 @@ #include "c2a_core_sample_components.h" -#include +#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) + const GlobalEnvironment* glo_env, const SimulationConfiguration* 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_ = new ObcWithC2a(clock_gen, 100); obc_->ConnectComPort(PORT_CH_RS422_MOBC_EXT, 1024, 1024); // UART通信用にとりあえず繋いでおく #endif @@ -21,16 +21,16 @@ C2aCoreSampleComponents::~C2aCoreSampleComponents() { delete obc_; } -Vector<3> C2aCoreSampleComponents::GenerateForce_N_b() { +Vector<3> C2aCoreSampleComponents::GenerateForce_b_N() { // There is no orbit control component, so it remains 0 - Vector<3> force_N_b_(0.0); - return force_N_b_; + Vector<3> force_b_N(0.0); + return force_b_N; } -Vector<3> C2aCoreSampleComponents::GenerateTorque_Nm_b() { +Vector<3> C2aCoreSampleComponents::GenerateTorque_b_Nm() { // No attitude control component - Vector<3> torque_Nm_b_(0.0); - return torque_Nm_b_; + 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.h b/src/Simulation/Spacecraft/c2a_core_sample_components.h index 8f255de..45eeb85 100644 --- a/src/Simulation/Spacecraft/c2a_core_sample_components.h +++ b/src/Simulation/Spacecraft/c2a_core_sample_components.h @@ -1,32 +1,31 @@ #pragma once -#include - -#include "Dynamics.h" -#include "GlobalEnvironment.h" -#include "LocalEnvironment.h" -#include "Vector.hpp" +#include +#include +#include +#include +#include // include for components -#include "OBC_C2A.h" +#include 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); + const SimulationConfiguration* config, ClockGenerator* clock_gen); ~C2aCoreSampleComponents(); - libra::Vector<3> GenerateForce_N_b(); - libra::Vector<3> GenerateTorque_Nm_b(); + libra::Vector<3> GenerateForce_b_N(); + libra::Vector<3> GenerateTorque_b_Nm(); void LogSetup(Logger& logger); private: // Components - OBC_C2A* obc_; + ObcWithC2a* obc_; // References const Dynamics* dynamics_; const Structure* structure_; const LocalEnvironment* local_env_; const GlobalEnvironment* glo_env_; - const SimulationConfig* config_; + const SimulationConfiguration* config_; }; diff --git a/src/Simulation/Spacecraft/c2a_core_sample_sat.cpp b/src/Simulation/Spacecraft/c2a_core_sample_sat.cpp index 1358731..18535e9 100644 --- a/src/Simulation/Spacecraft/c2a_core_sample_sat.cpp +++ b/src/Simulation/Spacecraft/c2a_core_sample_sat.cpp @@ -2,7 +2,7 @@ #include "c2a_core_sample_components.h" -C2aCoreSampleSat::C2aCoreSampleSat(SimulationConfig* sim_config, const GlobalEnvironment* glo_env, const int sat_id) +C2aCoreSampleSat::C2aCoreSampleSat(SimulationConfiguration* 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_); + components_ = new C2aCoreSampleComponents(dynamics_, structure_, local_environment_, glo_env, sim_config, &clock_generator_); } diff --git a/src/Simulation/Spacecraft/c2a_core_sample_sat.h b/src/Simulation/Spacecraft/c2a_core_sample_sat.h index 90f4ad8..d321ac5 100644 --- a/src/Simulation/Spacecraft/c2a_core_sample_sat.h +++ b/src/Simulation/Spacecraft/c2a_core_sample_sat.h @@ -1,11 +1,12 @@ #pragma once -#include "Spacecraft.h" +#include + #include "c2a_core_sample_components.h" class C2aCoreSampleSat : public Spacecraft { public: - C2aCoreSampleSat(SimulationConfig* sim_config, const GlobalEnvironment* glo_env, const int sat_id); + C2aCoreSampleSat(SimulationConfiguration* sim_config, const GlobalEnvironment* glo_env, const int sat_id); private: }; diff --git a/src/s2e_for_c2a_core.cpp b/src/s2e_for_c2a_core.cpp index e460374..6eb3b72 100644 --- a/src/s2e_for_c2a_core.cpp +++ b/src/s2e_for_c2a_core.cpp @@ -1,10 +1,10 @@ // Simulator includes -#include "Interface/LogOutput/Logger.h" +#include "library/logger/logger.hpp" // Add custom include files #include "./Simulation/Case/c2a_core_sample_case.h" -// degub print of initialize file path +// debug print of initialize file path void print_path(std::string path) { #ifdef WIN32 std::cout << path << std::endl; From 9cf2ae9b59a1c58ffafcfa9702756c749cd0a3e4 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Wed, 5 Apr 2023 16:42:50 +0200 Subject: [PATCH 07/38] Revert default c2a directory name --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index acf0ab2..c128c04 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,7 @@ if(NOT DEFINED FLIGHT_SW_DIR) set(FLIGHT_SW_DIR ../FlightSW) endif() if(NOT DEFINED C2A_NAME) - set(C2A_NAME "c2a-core/Examples/minimum_user") + set(C2A_NAME "c2a_sample") endif() ## options to use C2A From a0a7cd20ba884e018537430945c88740baa4347c Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Wed, 5 Apr 2023 16:54:05 +0200 Subject: [PATCH 08/38] Fix s2e-core version --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ee92ca7..029298e 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: feature/major-update-v6.0.0 C2A_CORE_VERSION: develop jobs: From 3d1be5b7d89a7e18e04aac1a9d4ab398ed1e96b9 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Wed, 5 Apr 2023 16:54:20 +0200 Subject: [PATCH 09/38] Add format check --- .github/workflows/check-format.yml | 49 ++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/check-format.yml 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 From 92ca723af648df5cef3601c62e2c60857b7f0a34 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Fri, 7 Apr 2023 21:44:42 +0200 Subject: [PATCH 10/38] Fix version --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c128c04..fed802e 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 2.0 + VERSION 2.0.0 ) cmake_minimum_required(VERSION 3.13) From ff06da9ad04fd5323b963fe83531cd04d9854532 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Fri, 7 Apr 2023 21:49:32 +0200 Subject: [PATCH 11/38] Remove unnecessary include directory --- CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fed802e..422e02f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,7 @@ if(NOT DEFINED FLIGHT_SW_DIR) set(FLIGHT_SW_DIR ../FlightSW) endif() if(NOT DEFINED C2A_NAME) - set(C2A_NAME "c2a_sample") + set(C2A_NAME "c2a-core/Examples/minimum_user") endif() ## options to use C2A @@ -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) From d205e775977118564cc78c569c844b92dcc050e8 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Fri, 7 Apr 2023 21:50:17 +0200 Subject: [PATCH 12/38] Fix s2e-core version info in CI --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 029298e..541276c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ on: pull_request: env: - S2E_CORE_VERSION: feature/major-update-v6.0.0 + S2E_CORE_VERSION: v6.0.0 C2A_CORE_VERSION: develop jobs: From 66ce21eb60dfa515208503f39721440051b87b88 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Fri, 7 Apr 2023 21:56:36 +0200 Subject: [PATCH 13/38] Modify simulation base ini file --- data/ini/c2a_core_sim_base.ini | 89 ++++++++++++++++++---------------- 1 file changed, 46 insertions(+), 43 deletions(-) diff --git a/data/ini/c2a_core_sim_base.ini b/data/ini/c2a_core_sim_base.ini index 2aa5607..751f3ad 100644 --- a/data/ini/c2a_core_sim_base.ini +++ b/data/ini/c2a_core_sim_base.ini @@ -1,98 +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=86400 +// Simulation duration [sec] +simulation_duration_s = 86400 // 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=10 // should be larger than StepTimeSec +// 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 "AttitudeUpdateIntervalSec" -AttitudeRKStepSec = 10 +// 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 -OrbitUpdateIntervalSec = 10 // should be larger than StepTimeSec +orbit_update_period_s = 10 // should be larger than 'simulation_step_s' // Orbit Δt for Runge-Kutta method [sec] -// This must be smaller than "OrbitUpdateIntervalSec" -OrbitRKStepSec = 10 +// 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 -ThermalUpdateIntervalSec = 10 // should be larger than StepTimeSec +thermal_update_period_s = 10 // should be larger than 'simulation_step_s' // Thermal Δt for Runge-Kutta method [sec] -// This must be smaller than "ThermalUpdateIntervalSec" -ThermalRKStepSec = 10 +// This must be smaller than 'thermal_update_period_s' +thermal_integral_step_s = 10 // 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 = 10 // should be larger than StepTimeSec +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 -SimulationSpeed = 1 +simulation_speed_setting = 1 -[PLANET_SELECTION] +[CELESTIAL_INFORMATION] // Whether global celestial information is logged or not -logging = DISABLE +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 = 2 -selected_body(0) = EARTH -selected_body(1) = SUN -selected_body(2) = MOON -selected_body(3) = MARS +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 -[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)... . -num_of_simulated_spacecraft = 1 -sat_file(0) = ../../data/ini/c2a_core_sample_sat.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 = 1 +number_of_simulated_ground_station = 0 +spacecraft_file(0) = ../../data/ini/c2a_core_sample_sat.ini +log_file_save_directory = ../../data/sample/logs/ From 928f3d5302cb772ce68298d0598b8baaff1dcbfa Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Fri, 7 Apr 2023 21:57:35 +0200 Subject: [PATCH 14/38] Modify structure ini file --- data/ini/c2a_core_structure.ini | 136 ++++++++++++++++---------------- 1 file changed, 68 insertions(+), 68 deletions(-) diff --git a/data/ini/c2a_core_structure.ini b/data/ini/c2a_core_structure.ini index 5ef1dfb..b7c707c 100644 --- a/data/ini/c2a_core_structure.ini +++ b/data/ini/c2a_core_structure.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 1b8eabe5c9660d480510b83b06d6978c5b1a1e1e Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Fri, 7 Apr 2023 21:59:03 +0200 Subject: [PATCH 15/38] Modify disturbance ini file --- data/ini/c2a_core_disturbance.ini | 33 ++++++++++++++++++------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/data/ini/c2a_core_disturbance.ini b/data/ini/c2a_core_disturbance.ini index ee6928e..1320e50 100644 --- a/data/ini/c2a_core_disturbance.ini +++ b/data/ini/c2a_core_disturbance.ini @@ -1,26 +1,29 @@ [GEOPOTENTIAL] +// Enable only when the center object is defined as the Earth calculation = DISABLE logging = DISABLE 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 = DISABLE logging = DISABLE -[AIRDRAG] +[AIR_DRAG] +// Enable only when the center object is defined as the Earth 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] +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 = DISABLE logging = DISABLE @@ -33,10 +36,12 @@ 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 +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 From 88c91a873a1c57d89695fd273ca1c97a9cedb0ee Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Fri, 7 Apr 2023 22:00:12 +0200 Subject: [PATCH 16/38] Modify local environment ini file --- data/ini/c2a_core_local_environment.ini | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/data/ini/c2a_core_local_environment.ini b/data/ini/c2a_core_local_environment.ini index a5bc2fa..01b6e48 100644 --- a/data/ini/c2a_core_local_environment.ini +++ b/data/ini/c2a_core_local_environment.ini @@ -1,13 +1,13 @@ -[MAG_ENVIRONMENT] +[MAGNETIC_FIELD_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] +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 = DISABLE logging = DISABLE @@ -19,15 +19,15 @@ logging = DISABLE // 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 = DISABLE -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 59e444013ef4bda71250e58592113ec0ebb09176 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Fri, 7 Apr 2023 22:03:14 +0200 Subject: [PATCH 17/38] Modify satellite ini file --- data/ini/c2a_core_sample_sat.ini | 157 +++++++++++++++---------------- 1 file changed, 78 insertions(+), 79 deletions(-) diff --git a/data/ini/c2a_core_sample_sat.ini b/data/ini/c2a_core_sample_sat.ini index b6abb0a..00d5635 100644 --- a/data/ini/c2a_core_sample_sat.ini +++ b/data/ini/c2a_core_sample_sat.ini @@ -4,25 +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 @@ -33,15 +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] @@ -56,27 +61,42 @@ logging = DISABLE // ENCKE : Encke orbit propagation with disturbances and thruster maneuver propagate_mode = SGP4 -// TLE definition for SGP4 /////////////////////////////////////////////// -// ISS +// 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,53 +106,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 = 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 +reference_satellite_id = 1 /////////////////////////////////////////////////////////////////////////////// - -// 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/c2a_core_local_environment.ini - -[DISTURBANCE] -dist_file = ../../data/ini/c2a_core_disturbance.ini - - -[STRUCTURE_FILE] -structure_file = ../../data/ini/c2a_core_structure.ini +[THERMAL] +calculation = DISABLE +debug = 0 +thermal_file_directory = ../../data/sample/initialize_files/thermal_csv_files/ +[SETTING_FILES] +local_environment_file = ../../data/ini/c2a_core_local_environment.ini +disturbance_file = ../../data/ini/c2a_core_disturbance.ini +structure_file = ../../data//ini/c2a_core_structure.ini -[COMPONENTS_FILE] +[COMPONENT_FILES] // Users can add the path for component initialize files here. From c7a447df1ac9aa90a114b404ac9798bb78eadb3f Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Fri, 7 Apr 2023 22:20:05 +0200 Subject: [PATCH 18/38] Revert default C2A name --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 422e02f..ead3b94 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,7 @@ if(NOT DEFINED FLIGHT_SW_DIR) set(FLIGHT_SW_DIR ../FlightSW) endif() if(NOT DEFINED C2A_NAME) - set(C2A_NAME "c2a-core/Examples/minimum_user") + set(C2A_NAME "c2a_sample") endif() ## options to use C2A From 57ca90f63b336afcd452096546235bd6d91d9994 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Sat, 8 Apr 2023 16:12:04 +0200 Subject: [PATCH 19/38] Fix ini file directory name --- data/{ini => initialize_files}/c2a_core_disturbance.ini | 0 data/{ini => initialize_files}/c2a_core_local_environment.ini | 0 data/{ini => initialize_files}/c2a_core_sample_sat.ini | 0 data/{ini => initialize_files}/c2a_core_sim_base.ini | 0 data/{ini => initialize_files}/c2a_core_structure.ini | 0 data/{ini => initialize_files}/components/.gitkeep | 0 data/{ini => initialize_files}/scenario/.gitkeep | 0 7 files changed, 0 insertions(+), 0 deletions(-) rename data/{ini => initialize_files}/c2a_core_disturbance.ini (100%) rename data/{ini => initialize_files}/c2a_core_local_environment.ini (100%) rename data/{ini => initialize_files}/c2a_core_sample_sat.ini (100%) rename data/{ini => initialize_files}/c2a_core_sim_base.ini (100%) rename data/{ini => initialize_files}/c2a_core_structure.ini (100%) rename data/{ini => initialize_files}/components/.gitkeep (100%) rename data/{ini => initialize_files}/scenario/.gitkeep (100%) diff --git a/data/ini/c2a_core_disturbance.ini b/data/initialize_files/c2a_core_disturbance.ini similarity index 100% rename from data/ini/c2a_core_disturbance.ini rename to data/initialize_files/c2a_core_disturbance.ini diff --git a/data/ini/c2a_core_local_environment.ini b/data/initialize_files/c2a_core_local_environment.ini similarity index 100% rename from data/ini/c2a_core_local_environment.ini rename to data/initialize_files/c2a_core_local_environment.ini diff --git a/data/ini/c2a_core_sample_sat.ini b/data/initialize_files/c2a_core_sample_sat.ini similarity index 100% rename from data/ini/c2a_core_sample_sat.ini rename to data/initialize_files/c2a_core_sample_sat.ini diff --git a/data/ini/c2a_core_sim_base.ini b/data/initialize_files/c2a_core_sim_base.ini similarity index 100% rename from data/ini/c2a_core_sim_base.ini rename to data/initialize_files/c2a_core_sim_base.ini diff --git a/data/ini/c2a_core_structure.ini b/data/initialize_files/c2a_core_structure.ini similarity index 100% rename from data/ini/c2a_core_structure.ini rename to data/initialize_files/c2a_core_structure.ini 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 From 90d1552f9c9e7de89307a90a461617f38705eb3b Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Sat, 8 Apr 2023 16:12:56 +0200 Subject: [PATCH 20/38] Rename component directory --- src/{Component => components}/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/{Component => components}/.gitkeep (100%) diff --git a/src/Component/.gitkeep b/src/components/.gitkeep similarity index 100% rename from src/Component/.gitkeep rename to src/components/.gitkeep From d329fee937f1029077c8eae44fabf29f8b6ce94c Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Sat, 8 Apr 2023 16:13:22 +0200 Subject: [PATCH 21/38] Rename simulation directory --- src/{Simulation => simulation}/Case/c2a_core_sample_case.cpp | 0 src/{Simulation => simulation}/Case/c2a_core_sample_case.h | 0 src/{Simulation => simulation}/GroundStation/.gitkeep | 0 .../Spacecraft/c2a_core_sample_components.cpp | 0 .../Spacecraft/c2a_core_sample_components.h | 0 src/{Simulation => simulation}/Spacecraft/c2a_core_sample_sat.cpp | 0 src/{Simulation => simulation}/Spacecraft/c2a_core_sample_sat.h | 0 7 files changed, 0 insertions(+), 0 deletions(-) rename src/{Simulation => simulation}/Case/c2a_core_sample_case.cpp (100%) rename src/{Simulation => simulation}/Case/c2a_core_sample_case.h (100%) rename src/{Simulation => simulation}/GroundStation/.gitkeep (100%) rename src/{Simulation => simulation}/Spacecraft/c2a_core_sample_components.cpp (100%) rename src/{Simulation => simulation}/Spacecraft/c2a_core_sample_components.h (100%) rename src/{Simulation => simulation}/Spacecraft/c2a_core_sample_sat.cpp (100%) rename src/{Simulation => simulation}/Spacecraft/c2a_core_sample_sat.h (100%) diff --git a/src/Simulation/Case/c2a_core_sample_case.cpp b/src/simulation/Case/c2a_core_sample_case.cpp similarity index 100% rename from src/Simulation/Case/c2a_core_sample_case.cpp rename to src/simulation/Case/c2a_core_sample_case.cpp diff --git a/src/Simulation/Case/c2a_core_sample_case.h b/src/simulation/Case/c2a_core_sample_case.h similarity index 100% rename from src/Simulation/Case/c2a_core_sample_case.h rename to src/simulation/Case/c2a_core_sample_case.h diff --git a/src/Simulation/GroundStation/.gitkeep b/src/simulation/GroundStation/.gitkeep similarity index 100% rename from src/Simulation/GroundStation/.gitkeep rename to src/simulation/GroundStation/.gitkeep diff --git a/src/Simulation/Spacecraft/c2a_core_sample_components.cpp b/src/simulation/Spacecraft/c2a_core_sample_components.cpp similarity index 100% rename from src/Simulation/Spacecraft/c2a_core_sample_components.cpp rename to src/simulation/Spacecraft/c2a_core_sample_components.cpp diff --git a/src/Simulation/Spacecraft/c2a_core_sample_components.h b/src/simulation/Spacecraft/c2a_core_sample_components.h similarity index 100% rename from src/Simulation/Spacecraft/c2a_core_sample_components.h rename to src/simulation/Spacecraft/c2a_core_sample_components.h diff --git a/src/Simulation/Spacecraft/c2a_core_sample_sat.cpp b/src/simulation/Spacecraft/c2a_core_sample_sat.cpp similarity index 100% rename from src/Simulation/Spacecraft/c2a_core_sample_sat.cpp rename to src/simulation/Spacecraft/c2a_core_sample_sat.cpp diff --git a/src/Simulation/Spacecraft/c2a_core_sample_sat.h b/src/simulation/Spacecraft/c2a_core_sample_sat.h similarity index 100% rename from src/Simulation/Spacecraft/c2a_core_sample_sat.h rename to src/simulation/Spacecraft/c2a_core_sample_sat.h From 7b253d4105aaeb69fa398c58875882f55ed442aa Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Sat, 8 Apr 2023 16:14:07 +0200 Subject: [PATCH 22/38] Rename ground station directory --- src/simulation/{GroundStation => ground_station}/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/simulation/{GroundStation => ground_station}/.gitkeep (100%) 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 From 7749c6ae9f78a9b4466e7ae7f95b9a4df57ea7ed Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Sat, 8 Apr 2023 16:14:30 +0200 Subject: [PATCH 23/38] Rename case directory --- src/simulation/{Case => case}/c2a_core_sample_case.cpp | 0 src/simulation/{Case => case}/c2a_core_sample_case.h | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename src/simulation/{Case => case}/c2a_core_sample_case.cpp (100%) rename src/simulation/{Case => case}/c2a_core_sample_case.h (100%) diff --git a/src/simulation/Case/c2a_core_sample_case.cpp b/src/simulation/case/c2a_core_sample_case.cpp similarity index 100% rename from src/simulation/Case/c2a_core_sample_case.cpp rename to src/simulation/case/c2a_core_sample_case.cpp diff --git a/src/simulation/Case/c2a_core_sample_case.h b/src/simulation/case/c2a_core_sample_case.h similarity index 100% rename from src/simulation/Case/c2a_core_sample_case.h rename to src/simulation/case/c2a_core_sample_case.h From efdd1a2ae3788410db94bf2431ed0df45223be81 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Sat, 8 Apr 2023 16:14:47 +0200 Subject: [PATCH 24/38] Rename spacecraft directory --- .../{Spacecraft => spacecraft}/c2a_core_sample_components.cpp | 0 .../{Spacecraft => spacecraft}/c2a_core_sample_components.h | 0 src/simulation/{Spacecraft => spacecraft}/c2a_core_sample_sat.cpp | 0 src/simulation/{Spacecraft => spacecraft}/c2a_core_sample_sat.h | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename src/simulation/{Spacecraft => spacecraft}/c2a_core_sample_components.cpp (100%) rename src/simulation/{Spacecraft => spacecraft}/c2a_core_sample_components.h (100%) rename src/simulation/{Spacecraft => spacecraft}/c2a_core_sample_sat.cpp (100%) rename src/simulation/{Spacecraft => spacecraft}/c2a_core_sample_sat.h (100%) diff --git a/src/simulation/Spacecraft/c2a_core_sample_components.cpp b/src/simulation/spacecraft/c2a_core_sample_components.cpp similarity index 100% rename from src/simulation/Spacecraft/c2a_core_sample_components.cpp rename to src/simulation/spacecraft/c2a_core_sample_components.cpp diff --git a/src/simulation/Spacecraft/c2a_core_sample_components.h b/src/simulation/spacecraft/c2a_core_sample_components.h similarity index 100% rename from src/simulation/Spacecraft/c2a_core_sample_components.h rename to src/simulation/spacecraft/c2a_core_sample_components.h diff --git a/src/simulation/Spacecraft/c2a_core_sample_sat.cpp b/src/simulation/spacecraft/c2a_core_sample_sat.cpp similarity index 100% rename from src/simulation/Spacecraft/c2a_core_sample_sat.cpp rename to src/simulation/spacecraft/c2a_core_sample_sat.cpp diff --git a/src/simulation/Spacecraft/c2a_core_sample_sat.h b/src/simulation/spacecraft/c2a_core_sample_sat.h similarity index 100% rename from src/simulation/Spacecraft/c2a_core_sample_sat.h rename to src/simulation/spacecraft/c2a_core_sample_sat.h From d98166c9f96657a6a7ea507a914512542e2a38b5 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Sat, 8 Apr 2023 16:15:39 +0200 Subject: [PATCH 25/38] Fix directory name in CMake --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ead3b94..2996430 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,9 +73,9 @@ 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_sat.cpp + src/simulation/spacecraft/c2a_core_sample_components.cpp ) # Create executable file add_executable(${PROJECT_NAME} ${SOURCE_FILES}) From bfbe5d4042c1f761fd2a7b05fabe8bcbe79e3f9d Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Sat, 8 Apr 2023 16:19:48 +0200 Subject: [PATCH 26/38] Fix directory name in codes --- data/initialize_files/c2a_core_sample_sat.ini | 6 +++--- data/initialize_files/c2a_core_sim_base.ini | 2 +- src/s2e_for_c2a_core.cpp | 4 ++-- src/simulation/case/c2a_core_sample_case.h | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/data/initialize_files/c2a_core_sample_sat.ini b/data/initialize_files/c2a_core_sample_sat.ini index 00d5635..03c4d65 100644 --- a/data/initialize_files/c2a_core_sample_sat.ini +++ b/data/initialize_files/c2a_core_sample_sat.ini @@ -129,9 +129,9 @@ debug = 0 thermal_file_directory = ../../data/sample/initialize_files/thermal_csv_files/ [SETTING_FILES] -local_environment_file = ../../data/ini/c2a_core_local_environment.ini -disturbance_file = ../../data/ini/c2a_core_disturbance.ini -structure_file = ../../data//ini/c2a_core_structure.ini +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 index 751f3ad..642d811 100644 --- a/data/initialize_files/c2a_core_sim_base.ini +++ b/data/initialize_files/c2a_core_sim_base.ini @@ -97,5 +97,5 @@ save_initialize_files = ENABLE // 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/ini/c2a_core_sample_sat.ini +spacecraft_file(0) = ../../data/initialize_files/c2a_core_sample_sat.ini log_file_save_directory = ../../data/sample/logs/ diff --git a/src/s2e_for_c2a_core.cpp b/src/s2e_for_c2a_core.cpp index 6eb3b72..6878dbb 100644 --- a/src/s2e_for_c2a_core.cpp +++ b/src/s2e_for_c2a_core.cpp @@ -2,7 +2,7 @@ #include "library/logger/logger.hpp" // Add custom include files -#include "./Simulation/Case/c2a_core_sample_case.h" +#include "./simulation/case/c2a_core_sample_case.h" // debug print of initialize file path void print_path(std::string path) { @@ -20,7 +20,7 @@ void print_path(std::string path) { // Main function 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.h b/src/simulation/case/c2a_core_sample_case.h index 95477da..fc525c5 100644 --- a/src/simulation/case/c2a_core_sample_case.h +++ b/src/simulation/case/c2a_core_sample_case.h @@ -2,7 +2,7 @@ #include <./simulation/case/simulation_case.hpp> -#include "../Spacecraft/c2a_core_sample_sat.h" +#include "../spacecraft/c2a_core_sample_sat.h" class C2aCoreSampleCase : public SimulationCase { public: From 6b53975497d73002134c03dea60360cb02eab6e7 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Sat, 8 Apr 2023 16:21:59 +0200 Subject: [PATCH 27/38] Add doxygen comment --- src/s2e_for_c2a_core.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/s2e_for_c2a_core.cpp b/src/s2e_for_c2a_core.cpp index 6878dbb..281b24b 100644 --- a/src/s2e_for_c2a_core.cpp +++ b/src/s2e_for_c2a_core.cpp @@ -1,3 +1,8 @@ +/** + * @file s2e_for_c2a_core.cpp + * @brief The main file of S2E-FOR-C2A-CORE + */ + // Simulator includes #include "library/logger/logger.hpp" From 9bfd01c2f7e7189133a033f194b569c2be4336d5 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Sat, 8 Apr 2023 16:25:48 +0200 Subject: [PATCH 28/38] Fix header file to hpp --- src/s2e_for_c2a_core.cpp | 2 +- src/simulation/case/c2a_core_sample_case.cpp | 2 +- .../{c2a_core_sample_case.h => c2a_core_sample_case.hpp} | 2 +- src/simulation/spacecraft/c2a_core_sample_components.cpp | 2 +- ...re_sample_components.h => c2a_core_sample_components.hpp} | 0 src/simulation/spacecraft/c2a_core_sample_sat.cpp | 5 ++--- .../{c2a_core_sample_sat.h => c2a_core_sample_satellite.hpp} | 2 +- 7 files changed, 7 insertions(+), 8 deletions(-) rename src/simulation/case/{c2a_core_sample_case.h => c2a_core_sample_case.hpp} (91%) rename src/simulation/spacecraft/{c2a_core_sample_components.h => c2a_core_sample_components.hpp} (100%) rename src/simulation/spacecraft/{c2a_core_sample_sat.h => c2a_core_sample_satellite.hpp} (85%) diff --git a/src/s2e_for_c2a_core.cpp b/src/s2e_for_c2a_core.cpp index 281b24b..84f3f2c 100644 --- a/src/s2e_for_c2a_core.cpp +++ b/src/s2e_for_c2a_core.cpp @@ -7,7 +7,7 @@ #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" // debug print of initialize file path void print_path(std::string path) { diff --git a/src/simulation/case/c2a_core_sample_case.cpp b/src/simulation/case/c2a_core_sample_case.cpp index 2dc0bf5..0a370d9 100644 --- a/src/simulation/case/c2a_core_sample_case.cpp +++ b/src/simulation/case/c2a_core_sample_case.cpp @@ -1,4 +1,4 @@ -#include "c2a_core_sample_case.h" +#include "c2a_core_sample_case.hpp" C2aCoreSampleCase::C2aCoreSampleCase(std::string ini_fname) : SimulationCase(ini_fname) {} diff --git a/src/simulation/case/c2a_core_sample_case.h b/src/simulation/case/c2a_core_sample_case.hpp similarity index 91% rename from src/simulation/case/c2a_core_sample_case.h rename to src/simulation/case/c2a_core_sample_case.hpp index fc525c5..c1c2028 100644 --- a/src/simulation/case/c2a_core_sample_case.h +++ b/src/simulation/case/c2a_core_sample_case.hpp @@ -2,7 +2,7 @@ #include <./simulation/case/simulation_case.hpp> -#include "../spacecraft/c2a_core_sample_sat.h" +#include "../spacecraft/c2a_core_sample_satellite.hpp" class C2aCoreSampleCase : public SimulationCase { public: diff --git a/src/simulation/spacecraft/c2a_core_sample_components.cpp b/src/simulation/spacecraft/c2a_core_sample_components.cpp index eae47b7..73699db 100644 --- a/src/simulation/spacecraft/c2a_core_sample_components.cpp +++ b/src/simulation/spacecraft/c2a_core_sample_components.cpp @@ -1,4 +1,4 @@ -#include "c2a_core_sample_components.h" +#include "c2a_core_sample_components.hpp" #include diff --git a/src/simulation/spacecraft/c2a_core_sample_components.h b/src/simulation/spacecraft/c2a_core_sample_components.hpp similarity index 100% rename from src/simulation/spacecraft/c2a_core_sample_components.h rename to src/simulation/spacecraft/c2a_core_sample_components.hpp diff --git a/src/simulation/spacecraft/c2a_core_sample_sat.cpp b/src/simulation/spacecraft/c2a_core_sample_sat.cpp index 18535e9..b6c3920 100644 --- a/src/simulation/spacecraft/c2a_core_sample_sat.cpp +++ b/src/simulation/spacecraft/c2a_core_sample_sat.cpp @@ -1,6 +1,5 @@ -#include "c2a_core_sample_sat.h" - -#include "c2a_core_sample_components.h" +#include "c2a_core_sample_components.hpp" +#include "c2a_core_sample_satellite.hpp" C2aCoreSampleSat::C2aCoreSampleSat(SimulationConfiguration* sim_config, const GlobalEnvironment* glo_env, const int sat_id) : Spacecraft(sim_config, glo_env, sat_id) { diff --git a/src/simulation/spacecraft/c2a_core_sample_sat.h b/src/simulation/spacecraft/c2a_core_sample_satellite.hpp similarity index 85% rename from src/simulation/spacecraft/c2a_core_sample_sat.h rename to src/simulation/spacecraft/c2a_core_sample_satellite.hpp index d321ac5..636855c 100644 --- a/src/simulation/spacecraft/c2a_core_sample_sat.h +++ b/src/simulation/spacecraft/c2a_core_sample_satellite.hpp @@ -2,7 +2,7 @@ #include -#include "c2a_core_sample_components.h" +#include "c2a_core_sample_components.hpp" class C2aCoreSampleSat : public Spacecraft { public: From c0db26540cc170360f13d2a66d1c59e5335bff01 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Sat, 8 Apr 2023 16:30:38 +0200 Subject: [PATCH 29/38] Fix include guard --- src/simulation/case/c2a_core_sample_case.hpp | 10 +++++++++- .../spacecraft/c2a_core_sample_components.hpp | 10 +++++++++- .../spacecraft/c2a_core_sample_satellite.hpp | 10 +++++++++- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/simulation/case/c2a_core_sample_case.hpp b/src/simulation/case/c2a_core_sample_case.hpp index c1c2028..b6e5f34 100644 --- a/src/simulation/case/c2a_core_sample_case.hpp +++ b/src/simulation/case/c2a_core_sample_case.hpp @@ -1,4 +1,10 @@ -#pragma once +/** + * @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> @@ -27,3 +33,5 @@ class C2aCoreSampleCase : public SimulationCase { */ void UpdateTargetObjects(); }; + +#endif // S2E_SIMULATION_CASE_C2A_CORE_SAMPLE_CASE_HPP_ diff --git a/src/simulation/spacecraft/c2a_core_sample_components.hpp b/src/simulation/spacecraft/c2a_core_sample_components.hpp index 45eeb85..fde3970 100644 --- a/src/simulation/spacecraft/c2a_core_sample_components.hpp +++ b/src/simulation/spacecraft/c2a_core_sample_components.hpp @@ -1,4 +1,10 @@ -#pragma once +/** + * @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 @@ -29,3 +35,5 @@ class C2aCoreSampleComponents : public InstalledComponents { const GlobalEnvironment* glo_env_; const SimulationConfiguration* config_; }; + +#endif // S2E_SIMULATION_SPACECRAFT_C2A_CORE_SAMPLE_COMPONENTS_HPP_ diff --git a/src/simulation/spacecraft/c2a_core_sample_satellite.hpp b/src/simulation/spacecraft/c2a_core_sample_satellite.hpp index 636855c..1135141 100644 --- a/src/simulation/spacecraft/c2a_core_sample_satellite.hpp +++ b/src/simulation/spacecraft/c2a_core_sample_satellite.hpp @@ -1,4 +1,10 @@ -#pragma once +/** + * @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 @@ -10,3 +16,5 @@ class C2aCoreSampleSat : public Spacecraft { private: }; + +#endif // S2E_SIMULATION_SPACECRAFT_C2A_CORE_SAMPLE_SATELLITE_HPP_ From 5018a6f751b4f4a74cae773fd47a313167326983 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Sat, 8 Apr 2023 16:32:52 +0200 Subject: [PATCH 30/38] Fix file name to suit with the s2e-core naming rule --- CMakeLists.txt | 2 +- .../{c2a_core_sample_sat.cpp => c2a_core_sample_satellite.cpp} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename src/simulation/spacecraft/{c2a_core_sample_sat.cpp => c2a_core_sample_satellite.cpp} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2996430..a4fe3b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,7 +74,7 @@ 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_satellite.cpp src/simulation/spacecraft/c2a_core_sample_components.cpp ) # Create executable file diff --git a/src/simulation/spacecraft/c2a_core_sample_sat.cpp b/src/simulation/spacecraft/c2a_core_sample_satellite.cpp similarity index 100% rename from src/simulation/spacecraft/c2a_core_sample_sat.cpp rename to src/simulation/spacecraft/c2a_core_sample_satellite.cpp From e8a9da6575e691ca5070d19b9bfec65914c800bb Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Sat, 8 Apr 2023 16:34:52 +0200 Subject: [PATCH 31/38] Add doxygen comment for file description --- src/simulation/case/c2a_core_sample_case.cpp | 5 +++++ src/simulation/spacecraft/c2a_core_sample_components.cpp | 5 +++++ src/simulation/spacecraft/c2a_core_sample_satellite.cpp | 8 +++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/simulation/case/c2a_core_sample_case.cpp b/src/simulation/case/c2a_core_sample_case.cpp index 0a370d9..415b9ab 100644 --- a/src/simulation/case/c2a_core_sample_case.cpp +++ b/src/simulation/case/c2a_core_sample_case.cpp @@ -1,3 +1,8 @@ +/** + * @file c2a_core_sample_case.cpp + * @brief User defined simulation case for C2A-CORE + */ + #include "c2a_core_sample_case.hpp" C2aCoreSampleCase::C2aCoreSampleCase(std::string ini_fname) : SimulationCase(ini_fname) {} diff --git a/src/simulation/spacecraft/c2a_core_sample_components.cpp b/src/simulation/spacecraft/c2a_core_sample_components.cpp index 73699db..f1e9508 100644 --- a/src/simulation/spacecraft/c2a_core_sample_components.cpp +++ b/src/simulation/spacecraft/c2a_core_sample_components.cpp @@ -1,3 +1,8 @@ +/** + * @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 diff --git a/src/simulation/spacecraft/c2a_core_sample_satellite.cpp b/src/simulation/spacecraft/c2a_core_sample_satellite.cpp index b6c3920..27eafb1 100644 --- a/src/simulation/spacecraft/c2a_core_sample_satellite.cpp +++ b/src/simulation/spacecraft/c2a_core_sample_satellite.cpp @@ -1,6 +1,12 @@ -#include "c2a_core_sample_components.hpp" +/** + * @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" + C2aCoreSampleSat::C2aCoreSampleSat(SimulationConfiguration* sim_config, const GlobalEnvironment* glo_env, const int sat_id) : Spacecraft(sim_config, glo_env, sat_id) { components_ = new C2aCoreSampleComponents(dynamics_, structure_, local_environment_, glo_env, sim_config, &clock_generator_); From ed5fbd57a510bffd46af2a23e181a75ba096668d Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Sat, 8 Apr 2023 16:55:05 +0200 Subject: [PATCH 32/38] Add doxygen comments --- src/simulation/case/c2a_core_sample_case.hpp | 22 ++++++++++- .../spacecraft/c2a_core_sample_components.hpp | 39 ++++++++++++++++--- .../spacecraft/c2a_core_sample_satellite.hpp | 8 ++++ 3 files changed, 62 insertions(+), 7 deletions(-) diff --git a/src/simulation/case/c2a_core_sample_case.hpp b/src/simulation/case/c2a_core_sample_case.hpp index b6e5f34..cec9cd1 100644 --- a/src/simulation/case/c2a_core_sample_case.hpp +++ b/src/simulation/case/c2a_core_sample_case.hpp @@ -10,16 +10,36 @@ #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(std::string ini_fname); + /** + * @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: - C2aCoreSampleSat* spacecraft_; + C2aCoreSampleSat* spacecraft_; //!< Spacecraft Instance /** * @fn InitializeTargetObjects diff --git a/src/simulation/spacecraft/c2a_core_sample_components.hpp b/src/simulation/spacecraft/c2a_core_sample_components.hpp index fde3970..b45d1ad 100644 --- a/src/simulation/spacecraft/c2a_core_sample_components.hpp +++ b/src/simulation/spacecraft/c2a_core_sample_components.hpp @@ -15,25 +15,52 @@ // 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, const Structure* structure, const LocalEnvironment* local_env, const GlobalEnvironment* glo_env, const SimulationConfiguration* config, ClockGenerator* clock_gen); + + /** + * @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_; + ObcWithC2a* obc_; //!< Onboard Computer with C2A // References - const Dynamics* dynamics_; - const Structure* structure_; - const LocalEnvironment* local_env_; - const GlobalEnvironment* glo_env_; - const SimulationConfiguration* config_; + const Dynamics* dynamics_; //!< Dynamics information of the spacecraft + const Structure* structure_; //!< Structure information of the spacecraft + const LocalEnvironment* local_env_; //!< Local environment information around the spacecraft + const GlobalEnvironment* glo_env_; //!< Global environment information around the spacecraft + const SimulationConfiguration* config_; //!< Simulation settings }; #endif // S2E_SIMULATION_SPACECRAFT_C2A_CORE_SAMPLE_COMPONENTS_HPP_ diff --git a/src/simulation/spacecraft/c2a_core_sample_satellite.hpp b/src/simulation/spacecraft/c2a_core_sample_satellite.hpp index 1135141..17951cf 100644 --- a/src/simulation/spacecraft/c2a_core_sample_satellite.hpp +++ b/src/simulation/spacecraft/c2a_core_sample_satellite.hpp @@ -10,8 +10,16 @@ #include "c2a_core_sample_components.hpp" +/** + * @class C2aCoreSampleSat + * @brief User side spacecraft class for C2A-CORE + */ class C2aCoreSampleSat : public Spacecraft { public: + /** + * @fn C2aCoreSampleSat + * @brief Constructor + */ C2aCoreSampleSat(SimulationConfiguration* sim_config, const GlobalEnvironment* glo_env, const int sat_id); private: From a51d4f803baecd88a1a0d5bf58c924d2783f3d2e Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Sat, 8 Apr 2023 16:56:58 +0200 Subject: [PATCH 33/38] Translate to English --- src/simulation/spacecraft/c2a_core_sample_components.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/simulation/spacecraft/c2a_core_sample_components.cpp b/src/simulation/spacecraft/c2a_core_sample_components.cpp index f1e9508..b38442f 100644 --- a/src/simulation/spacecraft/c2a_core_sample_components.cpp +++ b/src/simulation/spacecraft/c2a_core_sample_components.cpp @@ -17,7 +17,7 @@ C2aCoreSampleComponents::C2aCoreSampleComponents(const Dynamics* dynamics, const #ifdef USE_C2A obc_ = new ObcWithC2a(clock_gen, 100); - obc_->ConnectComPort(PORT_CH_RS422_MOBC_EXT, 1024, 1024); // UART通信用にとりあえず繋いでおく + obc_->ConnectComPort(PORT_CH_RS422_MOBC_EXT, 1024, 1024); // Connect UART Port #endif } From 1e9b0019ff71470611e737567cc6f52e19264866 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Sat, 8 Apr 2023 16:59:39 +0200 Subject: [PATCH 34/38] Rename variables in sample case --- src/simulation/case/c2a_core_sample_case.cpp | 2 +- src/simulation/case/c2a_core_sample_case.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/simulation/case/c2a_core_sample_case.cpp b/src/simulation/case/c2a_core_sample_case.cpp index 415b9ab..643747e 100644 --- a/src/simulation/case/c2a_core_sample_case.cpp +++ b/src/simulation/case/c2a_core_sample_case.cpp @@ -5,7 +5,7 @@ #include "c2a_core_sample_case.hpp" -C2aCoreSampleCase::C2aCoreSampleCase(std::string ini_fname) : SimulationCase(ini_fname) {} +C2aCoreSampleCase::C2aCoreSampleCase(const std::string initialise_base_file) : SimulationCase(initialise_base_file) {} C2aCoreSampleCase::~C2aCoreSampleCase() { delete spacecraft_; } diff --git a/src/simulation/case/c2a_core_sample_case.hpp b/src/simulation/case/c2a_core_sample_case.hpp index cec9cd1..220cad3 100644 --- a/src/simulation/case/c2a_core_sample_case.hpp +++ b/src/simulation/case/c2a_core_sample_case.hpp @@ -20,7 +20,7 @@ class C2aCoreSampleCase : public SimulationCase { * @fn C2aCoreSampleCase * @brief Constructor */ - C2aCoreSampleCase(std::string ini_fname); + C2aCoreSampleCase(const std::string initialise_base_file); /** * @fn ~C2aCoreSampleCase * @brief Destructor From f17c5b1bb266c0892a7319107b12a3a8e25beaca Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Sat, 8 Apr 2023 17:01:25 +0200 Subject: [PATCH 35/38] Rename variables in sample satellite --- src/simulation/spacecraft/c2a_core_sample_satellite.cpp | 8 +++++--- src/simulation/spacecraft/c2a_core_sample_satellite.hpp | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/simulation/spacecraft/c2a_core_sample_satellite.cpp b/src/simulation/spacecraft/c2a_core_sample_satellite.cpp index 27eafb1..d71ef4e 100644 --- a/src/simulation/spacecraft/c2a_core_sample_satellite.cpp +++ b/src/simulation/spacecraft/c2a_core_sample_satellite.cpp @@ -7,7 +7,9 @@ #include "c2a_core_sample_components.hpp" -C2aCoreSampleSat::C2aCoreSampleSat(SimulationConfiguration* sim_config, const GlobalEnvironment* glo_env, const int sat_id) - : Spacecraft(sim_config, glo_env, sat_id) { - components_ = new C2aCoreSampleComponents(dynamics_, structure_, local_environment_, glo_env, sim_config, &clock_generator_); +C2aCoreSampleSat::C2aCoreSampleSat(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 index 17951cf..86c34de 100644 --- a/src/simulation/spacecraft/c2a_core_sample_satellite.hpp +++ b/src/simulation/spacecraft/c2a_core_sample_satellite.hpp @@ -20,7 +20,8 @@ class C2aCoreSampleSat : public Spacecraft { * @fn C2aCoreSampleSat * @brief Constructor */ - C2aCoreSampleSat(SimulationConfiguration* sim_config, const GlobalEnvironment* glo_env, const int sat_id); + C2aCoreSampleSat(const SimulationConfiguration* simulation_configuration, const GlobalEnvironment* global_environment, + const unsigned int spacecraft_id); private: }; From 59c0570aacd21e58669822ca41982a9f736d3391 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Sat, 8 Apr 2023 17:04:03 +0200 Subject: [PATCH 36/38] Rename variables in sample components --- .../spacecraft/c2a_core_sample_components.cpp | 13 +++++++++---- .../spacecraft/c2a_core_sample_components.hpp | 14 +++++++------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/simulation/spacecraft/c2a_core_sample_components.cpp b/src/simulation/spacecraft/c2a_core_sample_components.cpp index b38442f..f18e78f 100644 --- a/src/simulation/spacecraft/c2a_core_sample_components.cpp +++ b/src/simulation/spacecraft/c2a_core_sample_components.cpp @@ -11,11 +11,16 @@ #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 SimulationConfiguration* config, ClockGenerator* clock_gen) - : dynamics_(dynamics), structure_(structure), local_env_(local_env), glo_env_(glo_env), config_(config) { +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_gen, 100); + obc_ = new ObcWithC2a(clock_generator, 100); obc_->ConnectComPort(PORT_CH_RS422_MOBC_EXT, 1024, 1024); // Connect UART Port #endif diff --git a/src/simulation/spacecraft/c2a_core_sample_components.hpp b/src/simulation/spacecraft/c2a_core_sample_components.hpp index b45d1ad..fd6dda1 100644 --- a/src/simulation/spacecraft/c2a_core_sample_components.hpp +++ b/src/simulation/spacecraft/c2a_core_sample_components.hpp @@ -25,8 +25,8 @@ class C2aCoreSampleComponents : public InstalledComponents { * @fn C2aCoreSampleComponents * @brief Constructor */ - C2aCoreSampleComponents(const Dynamics* dynamics, const Structure* structure, const LocalEnvironment* local_env, const GlobalEnvironment* glo_env, - const SimulationConfiguration* config, ClockGenerator* clock_gen); + C2aCoreSampleComponents(const Dynamics* dynamics, Structure* structure, const LocalEnvironment* local_environment, + const GlobalEnvironment* global_environment, const SimulationConfiguration* configuration, ClockGenerator* clock_generator); /** * @fn ~C2aCoreSampleComponents @@ -56,11 +56,11 @@ class C2aCoreSampleComponents : public InstalledComponents { 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_env_; //!< Local environment information around the spacecraft - const GlobalEnvironment* glo_env_; //!< Global environment information around the spacecraft - const SimulationConfiguration* config_; //!< Simulation settings + 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_ From 00318b1f8e6ee7261b2d8d32f2a5dd7e34b302c0 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Sat, 8 Apr 2023 17:06:06 +0200 Subject: [PATCH 37/38] Rename SampleSat class to SampleSatellite --- src/simulation/case/c2a_core_sample_case.cpp | 2 +- src/simulation/case/c2a_core_sample_case.hpp | 2 +- src/simulation/spacecraft/c2a_core_sample_satellite.cpp | 4 ++-- src/simulation/spacecraft/c2a_core_sample_satellite.hpp | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/simulation/case/c2a_core_sample_case.cpp b/src/simulation/case/c2a_core_sample_case.cpp index 643747e..1bbb912 100644 --- a/src/simulation/case/c2a_core_sample_case.cpp +++ b/src/simulation/case/c2a_core_sample_case.cpp @@ -13,7 +13,7 @@ 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 C2aCoreSampleSat(&simulation_configuration_, global_environment_, spacecraft_id); + spacecraft_ = new C2aCoreSampleSatellite(&simulation_configuration_, global_environment_, spacecraft_id); // Register the log output spacecraft_->LogSetup(*(simulation_configuration_.main_logger_)); diff --git a/src/simulation/case/c2a_core_sample_case.hpp b/src/simulation/case/c2a_core_sample_case.hpp index 220cad3..46009f8 100644 --- a/src/simulation/case/c2a_core_sample_case.hpp +++ b/src/simulation/case/c2a_core_sample_case.hpp @@ -39,7 +39,7 @@ class C2aCoreSampleCase : public SimulationCase { virtual std::string GetLogValue() const; private: - C2aCoreSampleSat* spacecraft_; //!< Spacecraft Instance + C2aCoreSampleSatellite* spacecraft_; //!< Spacecraft Instance /** * @fn InitializeTargetObjects diff --git a/src/simulation/spacecraft/c2a_core_sample_satellite.cpp b/src/simulation/spacecraft/c2a_core_sample_satellite.cpp index d71ef4e..56ca4aa 100644 --- a/src/simulation/spacecraft/c2a_core_sample_satellite.cpp +++ b/src/simulation/spacecraft/c2a_core_sample_satellite.cpp @@ -7,8 +7,8 @@ #include "c2a_core_sample_components.hpp" -C2aCoreSampleSat::C2aCoreSampleSat(const SimulationConfiguration* simulation_configuration, const GlobalEnvironment* global_environment, - const unsigned int spacecraft_id) +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 index 86c34de..f0d0da8 100644 --- a/src/simulation/spacecraft/c2a_core_sample_satellite.hpp +++ b/src/simulation/spacecraft/c2a_core_sample_satellite.hpp @@ -11,17 +11,17 @@ #include "c2a_core_sample_components.hpp" /** - * @class C2aCoreSampleSat + * @class C2aCoreSampleSatellite * @brief User side spacecraft class for C2A-CORE */ -class C2aCoreSampleSat : public Spacecraft { +class C2aCoreSampleSatellite : public Spacecraft { public: /** * @fn C2aCoreSampleSat * @brief Constructor */ - C2aCoreSampleSat(const SimulationConfiguration* simulation_configuration, const GlobalEnvironment* global_environment, - const unsigned int spacecraft_id); + C2aCoreSampleSatellite(const SimulationConfiguration* simulation_configuration, const GlobalEnvironment* global_environment, + const unsigned int spacecraft_id); private: }; From 8c36cf62cf3332b88caf61e7f58c4283c32e22a5 Mon Sep 17 00:00:00 2001 From: Ryo Suzumoto Date: Sun, 9 Apr 2023 15:07:38 +0900 Subject: [PATCH 38/38] bump version in readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ac1c7ca..365b294 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ ## Notes - Details are described [S2E Document: How to integrate C2A](https://github.com/ut-issl/s2e-documents/blob/develop/Tutorials/HowToIntegrateC2A.md). -- s2e-core [v5.0.0](https://github.com/ut-issl/s2e-core/releases/tag/v5.0.0) is used. +- s2e-core [v6.0.0](https://github.com/ut-issl/s2e-core/releases/tag/v6.0.0) is used. ## Related repositories @@ -24,7 +24,7 @@ ## C2A in S2E について - 詳細は [S2E Document: How to integrate C2A](https://github.com/ut-issl/s2e-documents/blob/develop/Tutorials/HowToIntegrateC2A.md) を参照のこと. -- ここでは,S2E Core のバージョンは [v5.0.0](https://github.com/ut-issl/s2e-core/releases/tag/v5.0.0) を用いる. +- ここでは,S2E Core のバージョンは [v6.0.0](https://github.com/ut-issl/s2e-core/releases/tag/v6.0.0) を用いる. ## 関連リポジトリ