From 021bba88008bc8073ed5a3270eb70b7ff5ec3576 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Thu, 3 Oct 2024 11:26:07 +0900 Subject: [PATCH 1/6] Update index in readme --- README.md | 65 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 035f587..1b7e7d1 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ - The branch construction - main - Documents for the latest stable version of s2e-core - - The Current version supports [s2e-core v7.2.0](https://github.com/ut-issl/s2e-core/releases/tag/v7.2.0) + - The Current version supports [s2e-core v8.0.0](https://github.com/ut-issl/s2e-core/releases/tag/v8.0.0) - If there are several patch update versions, please use the latest one to avoid bugs. - The old versions are managed with `release/tag/v.*.*.*` - The `major` version number is compatible with s2e-core's `major` version number. @@ -231,6 +231,7 @@ 1. [Overview of Attitude Calculation](./Specifications/Dynamics/Spec_Attitude.md) 1. [Attitude RK4](./Specifications/Dynamics/Spec_Rk4Attitude.md) 1. [Controlled Attitude](./Specifications/Dynamics/Spec_ControlledAttitude.md) + 1. Attitude with Cantilever Vibration: TBW 1. Orbit 1. [Overview of Orbit calculation](./Specifications/Dynamics/Spec_Orbit.md) @@ -278,31 +279,34 @@ 1. [Atmosphere](./Specifications/Environment/Spec_Atmosphere.md) 1. [Geomagnetic field](./Specifications/Environment/Spec_GeomagneticField.md) 1. [Solar Radiation Pressure Environment](./Specifications/Environment/Spec_SRPEnvironment.md) + 1. Earth Albedo: TBW - 1.
Library + 1.
Logger + + 1. Loggable: TBW + 1. Log Utility: TBW + 1. Logger: TBW + +
+ + 1.
Math Physics 1. Atmosphere 1. Simple air density model: TBW 1. Harris-Priester model: TBW - - 1. Communication - 1. COM port interface: TBW + 1. NRLMSISE00: TBW 1. Control Utilities 1. First order lag: TBW - 1. External - - External library-related source codes. - 1. IGRF (International Geomagnetic Reference Field): TBW - 1. inih: TBW - 1. nrlmsise00: TBW - 1. sgp4: TBW - 1. Geodesy 1. Geodetic Position: TBW + 1. Geomagnetic + 1. IGRF (International Geomagnetic Reference Field): TBW + 1. GNSS (Global Navigation Satellite System) 1. ANTEX file reader: TBW 1. Bias SINEX file reader: TBW @@ -312,16 +316,6 @@ 1. Gravity 1. Gravity potential: TBW - 1. Initialize - 1. Initialize file access: TBW - 1. WINGS operation file: TBW - 1. C2A command database: TBW - - 1. Logger - 1. Loggable: TBW - 1. Log Utility: TBW - 1. Logger: TBW - 1.
math 1. Constants: TBW @@ -353,6 +347,7 @@ 1. Orbital Elements: TBW 1. Relative Orbit Models: TBW 1. Interpolation orbit: TBW + 1. sgp4: TBW 1. Planet rotation 1. Moon rotation utilities: TBW @@ -363,16 +358,17 @@ 1. Minimal standard linear congruential generator: TBW 1. Minimal standard linear congruential generator with shuffle: TBW 1. Random walk: TBW - - 1. utilities - 1. Endian: TBW - 1. Macros: TBW - 1. Quantization: TBW - 1. Ring Buffer: TBW - 1. SLIP: TBW
+ 1.
Setting file reader + + 1. Initialize file access: TBW + 1. WINGS operation file: TBW + 1. C2A command database: TBW + +
+ 1.
Simulation - `simulation` directory manages source codes to define the simulation scenario. @@ -422,4 +418,15 @@
+ 1.
Utilities + + 1. Endian: TBW + 1. Macros: TBW + 1. Quantization: TBW + 1. Ring Buffer: TBW + 1. SLIP: TBW + 1. COM port interface: TBW + +
+ 1. [Troubleshooting](./General/Troubleshooting.md) From cd3a2913f00204fea0a3d55e5fa6ed5886b8b7ad Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Fri, 4 Oct 2024 23:01:50 +0900 Subject: [PATCH 2/6] Fix directory info --- Tutorials/GettingStarted.md | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/Tutorials/GettingStarted.md b/Tutorials/GettingStarted.md index 5083dcf..32bc761 100644 --- a/Tutorials/GettingStarted.md +++ b/Tutorials/GettingStarted.md @@ -18,7 +18,7 @@ ## 3. Check log output -1. Check `./data/sample/logs` to find CSV log output file +1. Check `./logs` to find CSV log output file - The file name includes executed time as `YYMMDD_HHMMSS_default.csv` - The included executed time is defined by the user computer settings. 2. Open the CSV log file @@ -31,33 +31,34 @@ ## 4. Edit Simulation Conditions -1. Move to `./data/sample/initialize_files` directory +1. Move to `./settings` directory 2. You can find the several **initialize** files ([INI files](https://en.wikipedia.org/wiki/INI_file)). In these initialize files, simulation conditions are defined, and you can change the conditions without rebuild of S2E by editing the initialize files. 3. Open `sample_simulation_base.ini`, which is the base file of the initialize files. - In this base file, other initialize files are defined. - You can see simulation conditions as time definitions, randomize seed definitions, etc. -4. Open `sample_satellite.ini`, which is the file to set the spacecraft parameters. +4. Open `./sample_satellite/satellite.ini`, which is the file to set the spacecraft parameters. 5. Edit the value of angular momentum `initial_angular_velocity_b_rad_s(0-2)` in the `[Attitude]` section as you want. 6. Set the value of `initialize_mode` to `MANUAL` if it is `CONTROLLED`. 7. Rerun the `s2e-core` **without a rebuild** -8. Check the new log file in `./data/sample/logs` to confirm the initial angular velocity is changed as you want. +8. Check the new log file in `./logs` to confirm the initial angular velocity is changed as you want. 9. Of course, you can change other values similarly. ## 5. Edit Simulation Conditions: Disturbances -1. Move to `./data/sample/ini` directory again -2. Open `sample_disturbance.ini`, which defines conditions to calculate orbital disturbance torques and forces +1. Move to `./settings` directory again +2. Open `./sample_satellite/disturbance.ini`, which defines conditions to calculate orbital disturbance torques and forces - Currently, S2E supports the following disturbances: - Gravity Gradient torque - Magnetic Disturbance torque - Air drag torque and force - Solar radiation pressure torque and force - Geo Potential acceleration + - Lunar Gravity Field - Third body gravity acceleration 3. You can select `ENABLE` or `DISABLE` of calculation and log output for each disturbance 4. Edit all `calculation` parameters of each disturbance as `calculation = DISABLE` 5. Rerun the `s2e-core` **without a rebuild** -6. Check the new log file in `./data/sample/logs` to confirm the spacecraft is not affected by any disturbance torque and the angular velocity and quaternion are not changed. You can also plot by following command and see all the disturbance torque and force are zero. (assuming you already created a `pipenv` virtual environment) +6. Check the new log file in `./logs` to confirm the spacecraft is not affected by any disturbance torque and the angular velocity and quaternion are not changed. You can also plot by following command and see all the disturbance torque and force are zero. (assuming you already created a `pipenv` virtual environment) ``` # Windows cd scripts/Plot @@ -70,8 +71,8 @@ ## 6. Edit Simulation Conditions: Orbit -1. Move to `./data/sample/ini` directory -1. Open `sample_satellite.ini` and see the `[Orbit]` section, which defines conditions to calculate orbit motion +1. Move to `./settings` directory +1. Open `./sample_satellite/satellite.ini` and see the `[Orbit]` section, which defines conditions to calculate orbit motion - Currently, S2E supports several types of orbit propagation. Please see [Orbit](./Specifications/Dynamics/Spec_Orbit.md) specification documents for more details. 1. Please set the parameters as follow: - `propagate_mode = SGP4`: SGP4 Propagator @@ -97,20 +98,21 @@ tle2=2 33493 98.2516 327.9413 0016885 9.3461 350.8072 15.01563916753462 ``` 1. Rerun the `s2e-core` **without a rebuild** -1. Check the new log file in `./data/sample/logs` to confirm the spacecraft position in ECI frame `spacecraft_position_i` is changed. +1. Check the new log file in `./logs` to confirm the spacecraft position in ECI frame `spacecraft_position_i` is changed. 1. To visualize the orbit result, execute the `plot_satellite_orbit_on_miller.py` and `plot_orbit_eci.py`. You can see the different plots as follows. ![](./figs/GettingStarted_PlotPrismOrbitInMiller.JPG) ![](./figs/GettingStarted_PlotPrismOrbit3d.JPG) ## 7. Edit Simulation Conditions: Environment -1. Move to `./data/sample/ini` directory -2. Open `sample_local_environment.ini`, which defines conditions to calculate the environment around the spacecraft +1. Move to `./settings` directory +2. Open `./sample_satellite/local_environment.ini`, which defines conditions to calculate the environment around the spacecraft - Currently, S2E supports the following environment models: - Celestial information: CSPICE - Geomagnetic field model: IGRF with random variation - Solar power model: Considering solar distance and eclipse + - Earth Albedo: The simplest model - Air density: NRLMSISE-00 model with random variation 3. Edit values of `magnetic_field_random_walk_standard_deviation_nT, magnetic_field_random_walk_limit_nT, magnetic_field_white_noise_standard_deviation_nT` 4. Rerun the `s2e-core` **without a rebuild** -5. Check the new log file in `./data/sample/logs` to confirm the magnetic field at the spacecraft position in ECI frame `geomagnetic_field_at_spacecraft_position_i`, the magnetic field in body frame `geomagnetic_field_at_spacecraft_position_b`, and magnetic disturbance torque in body frame `magnetic_disturbance_torque_b` are changed. +5. Check the new log file in `./logs` to confirm the magnetic field at the spacecraft position in ECI frame `geomagnetic_field_at_spacecraft_position_i`, the magnetic field in body frame `geomagnetic_field_at_spacecraft_position_b`, and magnetic disturbance torque in body frame `magnetic_disturbance_torque_b` are changed. From 283cc4a3699596e161f513d6ecd5b95ef7aa70e5 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Sat, 5 Oct 2024 10:40:22 +0900 Subject: [PATCH 3/6] Update tutorial new simulation scenario --- Tutorials/HowToMakeNewSimulationScenario.md | 40 ++++++++++++--------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/Tutorials/HowToMakeNewSimulationScenario.md b/Tutorials/HowToMakeNewSimulationScenario.md index cc0cb0e..31f761e 100644 --- a/Tutorials/HowToMakeNewSimulationScenario.md +++ b/Tutorials/HowToMakeNewSimulationScenario.md @@ -5,10 +5,10 @@ - In the [Getting Started](./GettingStarted.md) tutorial, we can directly build and execute `s2e-core`, but for **source code sharing** and practical usage of S2E, we **strongly recommend managing s2e-core and s2e-user repository separately**. - [s2e-core](https://github.com/ut-issl/s2e-core) repository is shared with other users. Most of the source files are in this core repository. The codes are used as a library by the `s2e-user` repository. - `s2e-user` repository is an independent repository for **each spacecraft project or research project**. This repository includes the following parts: - - Source codes for the `main` - - Source codes for `simulation scenario` + - Source codes for the `main` function. + - Source codes for `simulation scenario`. - Source codes for `components` if the target spacecraft has components, which strongly depends on your project. - - `Initialize files` + - `Setting files` to define detailed parameters for simulation settings. - `Compile setting` files as [CMake files](https://cmake.org/), [Visual Studio Solution files](https://visualstudio.microsoft.com/downloads/), or others. - This tutorial explains an example of how to make `s2e-user` repository and execute it. - The supported version of this document @@ -24,9 +24,10 @@ ``` └─ s2e-user-example └─ src - └─ data └─ s2e-core (git submodule) └─ ExtLibraries (generated by the following procedure) + └─ settings + └─ logs └─ other files ``` @@ -48,24 +49,30 @@ 2. Download mandatory `ExtLibraries` (CSPICE and NRLMSISE-00). - Users need to use the `CMakeList.txt` in the `s2e-user-example/s2e-core/ExtLibraries` to download the mandatory external libraries. - The construction procedure is same with the s2e-core. Please see a `How To Build` document suit with your platform. + - Please check the following directories and files are made. ``` └─ s2e-user-example └─ src - └─ data └─ s2e-core (git submodule) └─ ExtLibraries └─ CMakeLists.txt (Use this file in this step) └─ ExtLibraries (This directory is generated by this step) └─ cspice - └─ GeoPotential └─ nrlmsise00 + └─ settings + └─ environment + └─ cspice + └─ generic_kernels (This directory is generated by this step) + └─ space_weather + └─ SpaceWeather-v1.2.txt (This file is generated by this step) + └─ logs ``` 3. According to the `How To Build` document, use the `s2e-user-example/CMakeList.txt` and build the s2e-user. -4. Execute and check the `s2e-user/data/logs`. +4. Execute and check the `s2e-user-example/logs`. -5. Similar to [Getting Started](./GettingStarted.md), you can edit initialize files in `s2e-user-example/data/initialize_files` and check the log file. +5. Similar to [Getting Started](./GettingStarted.md), you can edit initialize files in `s2e-user-example/settings` and check the log file. **Note:** Users can use other characters instead of `user` for a practical case. For example, you can name it `s2e_equuleus` to indicate the EQUULEUS spacecraft project. @@ -78,15 +85,14 @@ └─ s2e-user-example └─ CMakeLists.txt └─ CMakeSetting.json - └─ data - └─ initialize_files - └─ logs + └─ settings + └─ logs └─ src └─ simulation └─ case └─ user_case.cpp └─ user_case.hpp - └─ Spacecraft + └─ spacecraft └─ user_components.cpp └─ user_components.hpp └─ user_satellite.cpp @@ -101,12 +107,12 @@ - When you add new source files, the new files is automatically included as the build target. If you do not include them, please add them to excluding list in the `CMakeList.txt`. - `CMakeSetting.json ` is a compile setting file for Visual Studio. -2. `data/initialize_files` and `data/logs` - - In the `initialize_files` directory, there are several initialize files. - - The most important initialize file is `user_simulation_base.ini`. - - Other initialize files are defined in this base initialize file. So you need to edit the file names in the base file when you modify the name of other initialize files. +2. `settings` and `logs` + - In the `settings` directory, there are several setting files to define the simulation parameters. + - The most important setting file is `user_simulation_base.ini`. + - Other setting files are defined in this base setting file. So you need to edit the file names in the base file when you modify the name of other setting files. - When you change the name of the base file, you have to edit `s2e_user.cpp`. - - Details of the initialize files are described in `Specifications`. + - Details of the setting files are described in `s2e-documents/Specifications`. - Basic files are described in [Getting Started](./GettingStarted.md). - `logs` - CSV log files will be outputted here. The output directory is also defined in `user_simulation_base.ini`, so that you can change it. From 601023feb9486388462c3174502bc7084c4103f2 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Sat, 5 Oct 2024 11:12:55 +0900 Subject: [PATCH 4/6] Update add components for v8 --- Tutorials/HowToAddComponents.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Tutorials/HowToAddComponents.md b/Tutorials/HowToAddComponents.md index 864b990..dd6e5c1 100644 --- a/Tutorials/HowToAddComponents.md +++ b/Tutorials/HowToAddComponents.md @@ -22,20 +22,20 @@ ``` - Add the following descriptions at the one line below of ` OnBoardComputer *obc_; //!< Onboard Computer` ```c++ - GyroSensor *gyro_sensor_; //!< Gyro sensor + s2e::components::GyroSensor *gyro_sensor_; //!< Gyro sensor ``` 4. Open and edit `user_components.cpp` - Edit the constructor function as follows to create an instance of the `GyroSensor` class at the one line below of `obc_ = new OnBoardComputer(clock_generator);`. ``` c++ // Common - IniAccess iniAccess = IniAccess(configuration_->spacecraft_file_list_[spacecraft_id]); + s2e::setting_file_reader::IniAccess iniAccess = s2e::setting_file_reader::IniAccess(configuration_->spacecraft_file_list_[spacecraft_id]); const double compo_step_sec = global_environment_->GetSimulationTime().GetComponentStepTime_s(); // Initialize of GYRO class std::string file_name = iniAccess.ReadString("COMPONENT_FILES", "gyro_file"); configuration_->main_logger_->CopyFileToLogDirectory(file_name); - gyro_sensor_ = new GyroSensor(InitGyroSensor(clock_generator, 1, file_name, compo_step_sec, dynamics)); + gyro_sensor_ = new s2e::components::GyroSensor(InitGyroSensor(clock_generator, 1, file_name, compo_step_sec, dynamics)); ``` - Add the following descriptions at the one line up of `delete obc_;` in the destructor. @@ -45,7 +45,7 @@ - Edit the `LogSetup` function as follows to register log output ``` c++ - void UserComponents::LogSetup(Logger &logger) { logger.AddLogList(gyro_sensor_); } + void UserComponents::LogSetup(s2e::logger::Logger &logger) { logger.AddLogList(gyro_sensor_); } ``` 8. Open `user_satellite.ini` and edit `initial_angular_velocity_b_rad_s` to add initial angular velocity. @@ -54,7 +54,7 @@ 9. Add the following descriptions at the bottom line of `[COMPONENT_FILES]` to set the initialize file for the gyro sensor. ```c++ - gyro_file = ../../data/initialize_files/components/gyro_sensor_xxx.ini + gyro_file = SETTINGS_DIR_FROM_EXE/user_satellite/components/gyro_sensor_xxx.ini ``` 10. Build the `s2e-user` and execute it @@ -80,7 +80,7 @@ 2. Add the following descriptions at the one line below of `GyroSensor *gyro_sensor_;` ```c++ - GyroSensor *gyro_sensor_2_; //!< Gyro sensor 2 + s2e::components::GyroSensor *gyro_sensor_2_; //!< Gyro sensor 2 ``` 3. Open `user_components.cpp` @@ -102,7 +102,7 @@ 6. Edit the `LogSetUp` function as follows to register log output ``` c++ - void UserComponents::LogSetup(Logger &logger) { + void UserComponents::LogSetup(s2e::logger::Logger &logger) { logger.AddLogList(gyro_sensor_); logger.AddLogList(gyro_sensor_2_); } @@ -113,10 +113,10 @@ 8. Add the following descriptions at the bottom line of `[COMPONENT_FILES]` to set the initialize file for the gyro sensor ```c++ - gyro_file_2 = ../../data/initialize_files/components/gyro_sensor_yyy.ini + gyro_file_2 = SETTINGS_DIR_FROM_EXE/user_satellite/components/gyro_sensor_yyy.ini ``` -9. Copy the `data/initialize_files/components/gyro_sensor_xxx.ini` file and rename it as `gyro_sensor_yyy.ini` +9. Copy the `settings/user_satellite/components/gyro_sensor_xxx.ini` file and rename it as `gyro_sensor_yyy.ini` 10. Edit `gyro_sensor_yyy.ini` to custom the noise performance of the second gyro sensor - Edit sensor ID like `[GYRO_SENSOR_1]` to `[GYRO_SENSOR_2]` From 5e93b073bb05606466e3a9e7e6d6da16953a2055 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Sat, 5 Oct 2024 14:40:43 +0900 Subject: [PATCH 5/6] Update make new component tutorial for v8 --- Tutorials/HowToAddComponents.md | 1 + Tutorials/HowToMakeNewComponents.md | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Tutorials/HowToAddComponents.md b/Tutorials/HowToAddComponents.md index dd6e5c1..879341c 100644 --- a/Tutorials/HowToAddComponents.md +++ b/Tutorials/HowToAddComponents.md @@ -52,6 +52,7 @@ - Users can select any value. 9. Add the following descriptions at the bottom line of `[COMPONENT_FILES]` to set the initialize file for the gyro sensor. + - The keyword `SETTINGS_DIR_FROM_EXE` is defined in the `CMakeList.txt` to handle the relative path to the setting files. ```c++ gyro_file = SETTINGS_DIR_FROM_EXE/user_satellite/components/gyro_sensor_xxx.ini diff --git a/Tutorials/HowToMakeNewComponents.md b/Tutorials/HowToMakeNewComponents.md index c007974..6e8fea7 100644 --- a/Tutorials/HowToMakeNewComponents.md +++ b/Tutorials/HowToMakeNewComponents.md @@ -12,7 +12,7 @@ ## 2. Overview of component expression in S2E - Source codes emulating components are stored in the `s2e-core/src/components` directory. -- All components need to inherit the base class `Component` for general functions of components, and most of the components also inherit the base class `ILoggable` for the log output function. +- All components need to inherit the base class `s2e::components::Component` for general functions of components, and most of the components also inherit the base class `s2e::logger::ILoggable` for the log output function. - `Component` class - The base class has an important virtual function `MainRoutine`, and subclasses need to define it in their codes. - When an instance of the component class is created, the `MainRoutine` function is registered in the `TickToComponent`, and it will be automatically executed in the `Spacecraft` class. @@ -36,14 +36,14 @@ 1. The `clock_sensor.cpp, .hpp` are created in the `components` directory. - The `ClockSensor` class counts clock with a constant bias noise. - - The class inherits the `Component` and the `ILoggable` base classes as explained above. + - The class inherits the `s2e::components::Component` and the `s2e::logger::ILoggable` base classes as explained above. 1. The `user_components.hpp` and `user_components.cpp` are edit similar procedure with the [How To Add Components](./HowToAddComponents.md) - The constructor of the `ClockSensor` requires arguments as `prescaler`, `clock_generator`, `simulation_time`, and `bias_s`. - `prescaler` and `bias_s` are user setting parameters for the sensor, and you can freely set these values. - - `clock_generator` is an argument for the `Component` base class. - - `simulation_time` is a specific argument for the `ClockSensor` to get true time information. The `SimulationTime` class is managed in the `GlobalEnvironment`, and the `GlobalEnvironment` is instantiated in the `SimulationCase` class. + - `clock_generator` is an argument for the `s2e::components::Component` base class. + - `simulation_time` is a specific argument for the `ClockSensor` to get true time information. The `s2e::environment::SimulationTime` class is managed in the `s2e::environment::GlobalEnvironment`, and the `s2e::environment::GlobalEnvironment` is instantiated in the `s2e::simulation::SimulationCase` class. - We need to add the following codes to `user_components.cpp`. - Instantiate the `ClockSensor` in the constructor. ```c++ @@ -85,14 +85,14 @@ - The second line copy the initialize file to the log output directory to save the simulation setting. - The third line make the instance of the `ClockSensor`. -1. Make `clock_sensor.ini` into `s2e-user/data/initialize_files/components` from `./Tutorial/SampleCodes/clock_sensor` +1. Make `clock_sensor.ini` in `s2e-user/settings/user_satellite/components` to set parameters for the `ClockSensor`. 1. Edit `user_satellite.ini` to add the following line at the [COMPONENT_FILES] section of the file ```c++ - clock_sensor_file = INI_FILE_DIR_FROM_EXE/components/clock_sensor.ini + clock_sensor_file = SETTINGS_DIR_FROM_EXE/user_satellite/components/clock_sensor.ini ``` - - The keyword `INI_FILE_DIR_FROM_EXE` is defined in the `CMakeList.txt` to handle the relative path to the initialize files. + - The keyword `SETTINGS_DIR_FROM_EXE` is defined in the `CMakeList.txt` to handle the relative path to the setting files. 1. Build `s2e-user` and execute it From 1587adbd639c740502c04603139c1160b46fdceb Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Sat, 5 Oct 2024 17:36:35 +0900 Subject: [PATCH 6/6] Update monte carlo simulation tutorial --- Tutorials/HowToUseMonteCarloSimulation.md | 36 +++++++++++------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/Tutorials/HowToUseMonteCarloSimulation.md b/Tutorials/HowToUseMonteCarloSimulation.md index 65e3d77..dae9833 100644 --- a/Tutorials/HowToUseMonteCarloSimulation.md +++ b/Tutorials/HowToUseMonteCarloSimulation.md @@ -16,15 +16,15 @@ - `user_case.hpp` - Add header including ```c++ - #include <./simulation/monte_carlo_simulation/monte_carlo_simulation_executor.hpp> + #include "simulation/monte_carlo_simulation/monte_carlo_simulation_executor.hpp" ``` - Add private member variables for `MonteCarloSimulationExecutor`. ```c++ - MonteCarloSimulationExecutor &monte_carlo_simulator_; + s2e::simulation::MonteCarloSimulationExecutor &monte_carlo_simulator_; ``` - Replace the constructor of UserCase class to add arguments for Monte Carlo simulation. ```c++ - UserCase(const std::string initialize_base_file, MonteCarloSimulationExecutor &monte_carlo_simulator, const std::string log_path); + UserCase(const std::string initialize_base_file, s2e::simulation::MonteCarloSimulationExecutor &monte_carlo_simulator, const std::string log_path); ``` - `user_case.cpp` - Add header including @@ -33,17 +33,17 @@ ``` - Replace the constructor as follows ```c++ - UserCase::UserCase(const std::string initialize_base_file, MonteCarloSimulationExecutor &monte_carlo_simulator, const std::string log_path) + UserCase::UserCase(const std::string initialize_base_file, s2e::simulation::MonteCarloSimulationExecutor &monte_carlo_simulator, const std::string log_path) : SimulationCase(initialize_base_file, monte_carlo_simulator, log_path), monte_carlo_simulator_(monte_carlo_simulator) {} ``` - Edit `InitializeTargetObjects` function - Edit log file name definition and - - Add `MonteCarloSimulationExecutor` initialization + - Add `s2e::simulation::MonteCarloSimulationExecutor` initialization ```c++ // Monte Carlo Simulation monte_carlo_simulator_.SetSeed(); monte_carlo_simulator_.RandomizeAllParameters(); - SimulationObject::SetAllParameters(monte_carlo_simulator_); + s2e::simulation::SimulationObject::SetAllParameters(monte_carlo_simulator_); monte_carlo_simulator_.AtTheBeginningOfEachCase(); ``` - Add log settings for the Monte Carlo simulation @@ -58,9 +58,9 @@ { std::string str_tmp = ""; - str_tmp += WriteScalar("elapsed_time", "s"); - str_tmp += WriteVector("spacecraft_angular_velocity", "b", "rad/s", 3); - str_tmp += WriteVector("spacecraft_quaternion", "i2b", "-", 4); + str_tmp += s2e::logger::WriteScalar("elapsed_time", "s"); + str_tmp += s2e::logger::WriteVector("spacecraft_angular_velocity", "b", "rad/s", 3); + str_tmp += s2e::logger::WriteVector("spacecraft_quaternion", "i2b", "-", 4); return str_tmp; } @@ -68,9 +68,9 @@ { std::string str_tmp = ""; - str_tmp += WriteScalar(global_environment_->GetSimulationTime().GetElapsedTime_s()); - str_tmp += WriteVector(spacecraft_->GetDynamics().GetAttitude().GetAngularVelocity_b_rad_s(), 3); - str_tmp += WriteQuaternion(spacecraft_->GetDynamics().GetAttitude().GetQuaternion_i2b()); + str_tmp += s2e::logger::WriteScalar(global_environment_->GetSimulationTime().GetElapsedTime_s()); + str_tmp += s2e::logger::WriteVector(spacecraft_->GetDynamics().GetAttitude().GetAngularVelocity_b_rad_s(), 3); + str_tmp += s2e::logger::WriteQuaternion(spacecraft_->GetDynamics().GetAttitude().GetQuaternion_i2b()); return str_tmp; } @@ -84,16 +84,16 @@ ``` - If you find description below ```c++ - #include "library/logger/logger.hpp" + #include "logger/logger.hpp" ``` rewrite as the following description ```c++ - #include "library/logger/initialize_log.hpp" + #include "logger/initialize_log.hpp" ``` -- Make an instance of `MonteCarloSimulatorExecutor` and Logger for Monte Carlo log +- Make an instance of `s2e::simulation::MonteCarloSimulatorExecutor` and Logger for Monte Carlo log ```c++ - MonteCarloSimulationExecutor *mc_simulator = InitMonteCarloSimulation(ini_file); - Logger *log_mc_sim = InitMonteCarloLog(ini_file, mc_simulator->IsEnabled()); + MonteCarloSimulationExecutor *mc_simulator = s2e::simulation::InitMonteCarloSimulation(ini_file); + Logger *log_mc_sim = s2e::logger::InitMonteCarloLog(ini_file, mc_simulator->IsEnabled()); ``` - Add while loop for Monte Carlo simulation as follows ```c++ @@ -127,7 +127,7 @@ log_enable = ENABLE // Number of execution - number_of_executions = 3 + number_of_executions = 10 [MONTE_CARLO_RANDOMIZATION] parameter(0) = attitude0.angular_velocity_b_rad_s