diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml index 4ef847aa..a542c164 100644 --- a/.github/workflows/actionlint.yml +++ b/.github/workflows/actionlint.yml @@ -9,7 +9,7 @@ jobs: actionlint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 - uses: reviewdog/action-actionlint@v1 with: github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 82cb5d16..376bcb05 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -14,10 +14,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 - name: Run Labeler - uses: crazy-max/ghaction-github-labeler@v4 + uses: crazy-max/ghaction-github-labeler@v5 with: github-token: ${{ secrets.GITHUB_TOKEN }} yaml-file: .github/labels.yml diff --git a/.github/workflows/mdbook.yml b/.github/workflows/mdbook.yml index 74c71782..1bd56e92 100644 --- a/.github/workflows/mdbook.yml +++ b/.github/workflows/mdbook.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 with: fetch-depth: 0 diff --git a/General/CodingConvention.md b/General/CodingConvention.md index 24aa13f8..9cc5ec1a 100644 --- a/General/CodingConvention.md +++ b/General/CodingConvention.md @@ -1,6 +1,6 @@ # Coding Convention of S2E -## Fomatter +## Formatter - We use [ClangFormat](https://clang.llvm.org/docs/ClangFormat.html) for S2E. - We selected `Google` base style with small modifications. - Details are written in [.clang-format](https://github.com/ut-issl/s2e-core/blob/develop/.clang-format). diff --git a/General/HowToDownloadNRLMSISE00library.md b/General/HowToDownloadNRLMSISE00library.md index 664b5a6f..83e766ff 100644 --- a/General/HowToDownloadNRLMSISE00library.md +++ b/General/HowToDownloadNRLMSISE00library.md @@ -9,14 +9,14 @@ ## 2. How to set up NRLMSISE00 for S2E [OLD Descriptions] 1. In any environment, run `s2e-core/scripts/Common/download_nrlmsise00_src_and_table.sh` - + Source codes of NRLMISE00 and `SpaceWeather.txt` will be downloaded, and `libnrlmsise00.a` will be made for Linux and OSX. + + Source codes of NRLMSISE00 and `SpaceWeather.txt` will be downloaded, and `libnrlmsise00.a` will be made for Linux and OSX. + Users have to compile the codes using the same compiler with S2E. After these codes are downloaded, you can directly compile them by using makefile in the `ExtLibraries\nrlmsise00\src`. + If you use Windows, a bash terminal for Windows (e.g. Git bash, WSL, MSYS) is needed to run this script, and you need to run an additional script. Proceed to Step 2. 2. For Windows Visual Studio users, run `s2e-core/scripts/VisualStudio/make_nrlmsise00_VS32bit.bat` after the process 1. + VS command prompt will be launched, then run `scripts/VisualStudio/make_libnrlmsise.bat` in VS command prompt. - + `libnrlmise.lib`, which is the library for Windows Visual Studio will be made. + + `libnrlmsise.lib`, which is the library for Windows Visual Studio will be made. + At the end of the procedure, you may see "指定されたバッチ ラベルが見つかりません - END". If there is `libnrlmsise00.lib` in the right place and all the files are in the right place, you may ignore this message. 3. Check your directories are as follows. diff --git a/General/HowToVisualizeSimulationResults.md b/General/HowToVisualizeSimulationResults.md index 3bbd59df..9b477ec4 100644 --- a/General/HowToVisualizeSimulationResults.md +++ b/General/HowToVisualizeSimulationResults.md @@ -1,9 +1,9 @@ # How to Visualize Simulation Results ## 1. Overview -The S2E generates the CSV format log file as the simulation results at the `data/log` directory. Users can use them to check the result of thier simulation with the following methods. +The S2E generates the CSV format log file as the simulation results at the `data/log` directory. Users can use them to check the result of their simulation with the following methods. - Open the CSV file with a spreadsheet application like Excel, and make charts to analyze and/or visualize the results. -- Open the CSV file with user's handmaded programs to analyze and/or visualize the resutls. +- Open the CSV file with user's handmade programs to analyze and/or visualize the results. - Use the `Plot Scripts` provided by the `S2E-CORE` to visualize the results. We are trying to increase the `Plot Scripts` to share the analysis method with many users and to improve the usability of S2E. We are welcome to add new `Plot Scripts` by users. diff --git a/README.md b/README.md index 429e1a91..c7618f46 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ - The branch construction - main - Documents for the latest stable version of s2e-core - - Current version supports [s2e-core v6.0.0](https://github.com/ut-issl/s2e-core/releases/tag/v6.0.0) + - Current version supports [s2e-core v7.0.0](https://github.com/ut-issl/s2e-core/releases/tag/v7.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. @@ -38,8 +38,11 @@ 1. Tutorials - We strongly recommend to sequentially follow the tutorials without external hardware at first. 1. [Getting Started](./Tutorials/GettingStarted.md) + -
Tutorials without any external hardware + - Users can refer the [s2e-user-example](https://github.com/ut-issl/s2e-user-example) to see sample codes of the following tutorials. + 1. [How To Make New Simulation Scenario](./Tutorials/HowToMakeNewSimulationScenario.md) 1. [How To Add Components](./Tutorials/HowToAddComponents.md) 1. [How To Make New Components](./Tutorials/HowToMakeNewComponents.md) @@ -52,6 +55,7 @@
-
Tutorials with external hardware for HILS test + - **NOTE**: Currently, these tutorials don't follow the major update v6.0.0. 1. [How To Perform UART HILS Test](./Tutorials/HowToPerformUartHilsTest.md) @@ -132,6 +136,7 @@ 1. [Reaction wheel jitter](./Specifications/Component/AOCS/Spec_RWJitter.md) 1. [Star sensor](./Specifications/Component/AOCS/Spec_STT.md) 1. Sun sensor: TBW + 1. MTQ-Magnetometer interference: TBW
@@ -149,7 +154,9 @@ - `communication` directory manages components for communication of spacecraft and ground stations. 1. Antenna: TBW + 1. Antenna Radiation pattern: TBW 1. GS calculator: TBW + 1. WINGS command sender to C2A: TBW @@ -210,7 +217,8 @@ 1. [Surface force](./Specifications/Disturbance/Spec_SurfaceForce.md) 1. [Air Drag](./Specifications/Disturbance/Spec_SurfaceForce_AirDrag.md) 1. [Solar Radiation Pressure](./Specifications/Disturbance/Spec_SurfaceForce_SolarRadiation.md) - + 1. Lunar Gravity field: TBW + 1.
Dynamics @@ -221,6 +229,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. Orbit 1. [Overview of Orbit calculation](./Specifications/Dynamics/Spec_Orbit.md) 1. [Kepler Orbit](./Specifications/Dynamics/Spec_KeplerOrbit.md) @@ -228,8 +237,14 @@ 1. [SGP4 Orbit Propagation with TLE](./Specifications/Dynamics/Spec_Sgp4.md) 1. [Encke's method](./Specifications/Dynamics/Spec_EnckeMethod.md) 1. [Relative Orbit](./Specifications/Dynamics/Spec_RelativeOrbit.md) - 1. Thermal: not supported now. - + + 1. Thermal + 1. Heater: TBW + 1. Heater Controller: TBW + 1. Heat load: TBW + 1. Node: TBW + 1. Temperature: TBW +
1.
Environment @@ -246,7 +261,8 @@ 1. Global Environment 1. [Global Environment](./Specifications/Environment/Spec_GlobalEnvironment.md) 1. [Celestial Information](./Specifications/Environment/Spec_CelestialInformation.md) - 1. [Celestial Rotation](./Specifications/Environment/Spec_CelestialRotation.md) + 1. [Earth Rotation](./Specifications/Environment/Spec_CelestialRotation.md) + 1. Moon Rotation: TBW 1. [Clock Generator](./Specifications/Environment/Spec_ClockGenerator.md) 1. [GNSS Satellites](./Specifications/Environment/Spec_GnssSatellites_en.md), ([Japanese version](./Specifications/Environment/Spec_GnssSatellites_ja.md)) 1. [Hipparcos Catalogue](./Specifications/Environment/Spec_HipparcosCatalogue_en.md), ([Japanese version](./Specifications/Environment/Spec_HipparcosCatalogue_ja.md)) @@ -264,6 +280,16 @@ 1.
Library + 1. Atmosphere + 1. Simple air density model: TBW + 1. Harris-Priester model: TBW + + 1. Communication + 1. COM port interface: TBW + + 1. Control Utilities + 1. First order lag: TBW + 1. External - External library related source codes. 1. IGRF (International Geomagnetic Reference Field): TBW @@ -274,29 +300,43 @@ 1. Geodesy 1. Geodetic Position: TBW - 1. Communication - 1. COM port interface: TBW - - 1.
math - - 1. MatVec (Matrix and Vector) : TBW - 1. Matrix: TBW - 1. ODE (Ordinary Differential Equation): TBW - 1. Quaternion: TBW - 1. Vector: TBW - 1. s2e_math: TBW - -
+ 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. optics + 1.
math + + 1. Constants : TBW + 1. Matrix: TBW + 1. Matrix and Vector : TBW + 1. Ordinary Differential Equation: TBW + - This library will be replaced by `Numerical integration`. + 1. Quaternion: TBW + 1. S2E math: TBW + 1. Vector: TBW + +
+ + 1. Numerical integration + 1. Runge Kutta method: TBW + 1. 4th order Runge Kutta method: TBW + 1. Embedded Runge Kutta method: TBW + 1. Runge Kutta Fehlberg: TBW + 1. 5th order Dormand and Prince: TBW + 1. Numerical integrator: TBW + 1. Numerical integrator manager: TBW + 1. ODE examples: TBW + + 1. Optics 1. Gaussian Beam Base: TBW 1. Orbit @@ -304,19 +344,22 @@ 1. Orbital Elements: TBW 1. Relative Orbit Models: TBW + 1. Planet rotation + 1. Moon rotation utilities: TBW + 1. Randomization 1. Global randomization: TBW 1. Normal randomization: TBW - 1. Minimal standard linear congruential generator - 1. Minimal standard linear congruential generator with shuffle - 1. Random walk + 1. Minimal standard linear congruential generator: TBW + 1. Minimal standard linear congruential generator with shuffle: TBW + 1. Random walk: TBW 1. utilities - 1. Macros: TBW 1. Endian: TBW - 1. SLIP: TBW + 1. Macros: TBW 1. Quantization: TBW 1. Ring Buffer: TBW + 1. SLIP: TBW
diff --git a/Specifications/Component/AOCS/Spec_RWJitter.md b/Specifications/Component/AOCS/Spec_RWJitter.md index e0101497..f7c8dcff 100644 --- a/Specifications/Component/AOCS/Spec_RWJitter.md +++ b/Specifications/Component/AOCS/Spec_RWJitter.md @@ -1,7 +1,7 @@ -# Specification for RW jitter +# Specification for ReactionWheelJitter class ## 1. Overview -- `RWJitter` class simulates the high-frequency jitter of Reaction Wheels. +- `ReactionWheelJitter` class simulates the high-frequency jitter of Reaction Wheels. - This class uses: + Angular velocity of the RW + Parameters of RW disturbance measured by experiments @@ -10,31 +10,31 @@ + RW jitter forces and torques in the body frame 1. functions - - `CalcJitter(double angular_velocity)` - + Simulates the jitter + - `CalcJitter` + + Simulates the reaction wheel jitter + (If Enabled) Calls `AddStructuralResonance()`. This function adds the effect of structural resonance to the high-frequency disturbance of RW. You can choose to consider the effect of structural resonance or not. 2. files - - `RWJitter.cpp`, `RWJitter.h` - - `RW.ini` - - `radial_force_harmonics_coef.csv`,`radial_torque_harmonics_coef.csv` + - `reaction_wheel_jitter.cpp`, `reaction_wheel_jitter.hpp` + - `reaction_wheel.ini` + - `radial_force_harmonics_coefficients.csv`,`radial_torque_harmonics_coefficients.csv` + These files contain the harmonic coefficients from experiments. 3. how to use - - Set the harmonics coefficients in `radial_force_harmonics_coef.csv` and `radial_torque_harmonics_coef.csv` + - Set the harmonics coefficients in `radial_force_harmonics_coefficients.csv` and `radial_torque_harmonics_coefficients.csv` - The first column is an array of the $h_i$( $i$-th harmonic number). The second column is an array of the $C_i$ (amplitude of the $i$-th harmonic). - - Set parameters in `RW.ini` + - Set parameters in `reaction_wheel.ini` - When only the static imbalance and dynamic imbalance(correspond to $C_i$ at $h_i\ne1$) is known according to the spec sheet, edit the files as follows. - + `radial_force_harmonics_coef.csv` + + `radial_force_harmonics_coefficients.csv` * Set $h_1$(the line 1 of the first column) as $1.0$. * Set $C_1$(the line 1 of the second column) as the static imbalance on the spec sheet. - + `radial_torque_harmonics_coef.csv` + + `radial_torque_harmonics_coefficients.csv` * Set $h_1$(the line 1 of the first column) as $1.0$. * Set $C_1$(the line 1 of the second column) as the dynamic imbalance on the spec sheet. - + `RW.ini` + + `reaction_wheel.ini` * Set `harmonics_degree = 1`. - Set the jitter update period to an appropriate value. - + Jitter update period is equal to the product of `CompoUpdateIntervalSec` in `Simbase.ini` and `fast_prescaler` in `RW.ini`. + + Jitter update period is equal to the product of `CompoUpdateIntervalSec` in `simulation_base.ini` and `fast_prescaler` in `reaction_wheel.ini`. + For correct calculation, the update period of the jitter should be set to approximately 0.1ms. + A larger update period is not a problem, but it will cause aliasing in the jitter waveform. @@ -123,10 +123,10 @@ - The RW model is rotated at 4000 rpm, 6000 rpm, and 8000 rpm, and the disturbance torque is compared with the actual experiment. 2. initial condition 1. input files - - `SampleSimbase.ini` - - `RW.ini` + - `sample_simulation_base.ini` + - `reaction_wheel.ini` 2. initial condition - - `SampleSimbase.ini` + - `sample_simulation_base.ini` ``` EndTimeSec = 0.5 StepTimeSec = 0.0001 @@ -134,7 +134,7 @@ LogOutputIntervalSec = 0.0001 ``` - - `RW.ini` + - `reaction_wheel.ini` ``` fast_prescaler = 1 max_angular_velocity = 9000.0 diff --git a/Specifications/Component/AOCS/Spec_STT.md b/Specifications/Component/AOCS/Spec_STT.md index a67ba320..c39c35f5 100644 --- a/Specifications/Component/AOCS/Spec_STT.md +++ b/Specifications/Component/AOCS/Spec_STT.md @@ -1,18 +1,17 @@ -# Specification for Attitude Dynamics +# Specification for StarSensor class ## 1. Overview 1. functions - - `STT` class simulates a star sensor. - - The `STT` class calculates and returns the observed quaternions and error flags. + - `StarSensor` class simulates a star sensor. + - The `StarSensor` class calculates and returns the observed quaternions and error flags. 2. files - - STT.cpp, STT.h : Definitions and declarations of the class - - InitSTT.cpp : Interface functions for the initialization of `STT` class - - STT.ini : Initialization file + - `star_sensor.cpp, star_sensor.hpp` : Definitions and declarations of the class + - `star_sensor.ini` : Initialization file 3. how to use - - Set the parameters in `STT.ini`. - - Create an instance by using the initialization function `InitSTT` + - Set the parameters in `star_sensor.ini`. + - Create an instance by using the initialization function `InitStarSensor` - Use `Get*` function to get quaternion information. diff --git a/Specifications/Component/Abstract/Spec_ComponentBase.md b/Specifications/Component/Abstract/Spec_ComponentBase.md index 69d27f16..9becb265 100644 --- a/Specifications/Component/Abstract/Spec_ComponentBase.md +++ b/Specifications/Component/Abstract/Spec_ComponentBase.md @@ -1,18 +1,18 @@ -# Specification of ComponentBase class +# Specification of Component class ## 1. Overview 1. Functions - - The `ComponentBase` class is an abstract class to handle the electrical power and the update timing of components. + - The `Component` class is an abstract class to handle the electrical power and the update timing of components. - This class has two virtual functions: `MainRoutine` and `FastUpdate`. Both are called periodically. Users can select the functions according to the required calling period. + The `MainRoutine` function is the components' main function. Most of the processing is handled in this function. + The `FastUpdate` function handles the processes that need to be computed in a high-speed cycle. So, users will use this function only when high-frequency disturbances need to be calculated (e.g., RW jitter). 2. Related Files - - Main file: `ComponentBase.h`, `ComponentBase.cpp` + - Main file: `component.hpp`, `component.cpp` 3. How to use - Inherit this class by the user's component class. - - The `RWModel` in `S2E_CORE` is useful as a usage example of the `FastUpdate`. + - The `ReactionWheel` in `S2E_CORE` is useful as a usage example of the `FastUpdate`. ## 2. Explanation of Algorithm 1. Constructor diff --git a/Specifications/Component/Abstract/Spec_ObcCommunicationBase.md b/Specifications/Component/Abstract/Spec_ObcCommunicationBase.md index 862f5754..65cf9ad1 100644 --- a/Specifications/Component/Abstract/Spec_ObcCommunicationBase.md +++ b/Specifications/Component/Abstract/Spec_ObcCommunicationBase.md @@ -1,17 +1,17 @@ -# Specification of ObcCommunicationBase class +# Specification of UartCommunicationWithObc class ## 1. Overview 1. Functions - - The `ObcCommunicationBase` class is an abstract class to communicate with `OBC`. - - Component classes can use this abstract class to emulate telemetry/command communication with an `OBC`. - - This class also supports communication with `C2A` in the `OBC_C2A` class. + - The `UartCommunicationWithObc` class is an abstract class to communicate with `OnBoardComputer`. + - Component classes can use this abstract class to emulate telemetry/command communication with an `OnBoardComputer`. + - This class also supports communication with `C2A` in the `ObcWithC2a` class. 2. Related files - - OBC.c, h - - EXP.c, h + - on_board_computer.cpp, hpp + - example_serial_communication_with_obc.cpp, hpp - Users can find an example of using this class. 3. How to use - Inherit this class by component class. - - Users need to set `port_id` and target `OBC` for the communication. + - Users need to set `sils_port_id` and target `OnBoardComputer` for the communication. - This class has the following protected functions for telemetry/command communication. Users can call these functions in the `MainRoutine` of the component. ```cpp int ReceiveCommand(const int offset, const int rec_size); @@ -26,12 +26,12 @@ ## 2. Explanation of Algorithm 1. Constructors 1. overview - - In the constructors, the communication port for the `OBC` is connected. + - In the constructors, the communication port for the `OnBoardComputer` is connected. - If another component already connects the port, the connection function returns an error, and the constructors output a message. 2. inputs and outputs - - Both constructors require `port_id` and target `OBC`. + - Both constructors require `sils_port_id` and target `OnBoardComputer`. - Users can set the communication data buffer size. When users do not put the size, the value is automatically set as the maximum value. - - The maximum value is 1024, and it is defined in `SCIPort.h` + - The maximum value is 1024, and it is defined in `uart_port.hpp` 3. algorithm - N/A 4. note diff --git a/Specifications/Component/Abstract/Spec_SensorBase.md b/Specifications/Component/Abstract/Spec_SensorBase.md index 7edb25fd..9606113e 100644 --- a/Specifications/Component/Abstract/Spec_SensorBase.md +++ b/Specifications/Component/Abstract/Spec_SensorBase.md @@ -1,8 +1,8 @@ -# Specification of SensorBase class +# Specification of Sensor class ## 1. Overview 1. Functions - - The `SensorBase` class is a base class to provide common features for sensors. + - The `Sensor` class is a base class to provide common features for sensors. - This class adds the following noises and output limits. - Constant offset noise - Normal random noise @@ -10,12 +10,12 @@ - Scale factor noise and cross-talk between axes 2. Related files - - Main file: `SensorBase.cpp, .h` - - Used Libraries: `Vector.h`, `Matrix.h`, `NormalRand.h`, `RandomWalk.h` + - Main file: `sensor_base.cpp, .hpp` + - Used Libraries: `vector.hpp`, `matrix.hpp`, `normal_randomization.hpp`, `random_walk.hpp` 3. How to use - Inherit this class by your sensor class. - - The `GYRO` and `MagSensor` in `S2E_CORE` are useful as usage examples. + - The `GyroSensor` and `Magnetometer` in `S2E_CORE` are useful as usage examples. ## 2. Explanation of Algorithm 1. Constructor @@ -28,13 +28,13 @@ - `range_to_zero_c`: The output is set as zero when the true value is larger than this value. - This feature is optional. If you don't want to use the value, please set this huge value. - `range_to_zero_c` should be larger than `range_to_const_c`. - - `bias_c`: Constant offset noise - - `nr_stddev_c`: Standard deviation for normal random noise + - `bias_noise_c`: Constant offset noise + - `normal_random_standard_deviation_c`: Standard deviation for normal random noise - Random Walk noise parameters - - `rw_stepwidth`: Step width for Random Walk propagation (unit: sec) + - `random_walk_step_width_s`: Step width for Random Walk propagation (unit: sec) - It should be the same as the update frequency of the sensor. - - `rw_stddev_c`: Standard deviation for Random Walk - - `rw_limit_c`: Soft limit of Random Walk + - `random_walk_standard_deviation_c`: Standard deviation for Random Walk + - `random_walk_limit_c`: Soft limit of Random Walk - **Note**: The number of elements for all parameters can be set by using the `template` feature. - **Note**: All parameters are defined in the component frame. - **Note**: Normally, the unit of the parameters is the same as the unit of true value. Users also can change the unit by using the scale factor matrix. @@ -53,28 +53,28 @@ 4. note - N/A ## 3. Results of verifications -- We verified the `SensorBase` class with the following parameters. +- We verified the `Sensor` class with the following parameters. - Default parameters - `scale_factor` = Unit matrix - `range_to_const_c` = 5 - `range_to_zero_c` = 10 - - `bias_c` = 0.0 - - `nr_stddev_c` = 0.0 - - `rw_stepwidth`= 0.1 sec - - `rw_stddev_c` = 0.0 - - `rw_limit_c` = 0.0 + - `bias_noise_c` = 0.0 + - `normal_random_standard_deviation_c` = 0.0 + - `random_walk_step_width_s`= 0.1 sec + - `random_walk_standard_deviation_c` = 0.0 + - `random_walk_limit_c` = 0.0 - input value: 0.0 -- Case 1: `bias_c` = 1.0, others = default +- Case 1: `bias_noise_c` = 1.0, others = default - The bottom figure shows the result of the output data. - We verified the constant offset noise calculation is correct according to the data.
-
Result of constant offset noise (bias_c = 1.0).
+
Result of constant offset noise (bias_noise_c = 1.0).
-- Case 2: `nr_stddev_c` = 1.0, others = default +- Case 2: `normal_random_standard_deviation_c` = 1.0, others = default - The simulation time is 1000sec, and the log output period is 0.1sec. - The bottom figure shows the result of the output data. - The calculated average and standard deviation from the output data are shown as follows. @@ -84,11 +84,11 @@
-
Result of normal random noise (nr_stddev_c = 1.0).
+
Result of normal random noise (normal_random_standard_deviation_c = 1.0).
-- Case 3: `rw_stddev_c` = 0.3, `rw_limit_c` = 0.05, others = default +- Case 3: `random_walk_standard_deviation_c` = 0.3, `random_walk_limit_c` = 0.05, others = default - The simulation time is 200sec, and the log output period is 0.5sec. - The bottom figure shows the result of the output data. - The output data randomly varies inside the limit value. @@ -97,7 +97,7 @@
-
Result of Random Walk noise (rw_stddev_c = 0.3, rw_limit_c = 0.05).
+
Result of Random Walk noise (random_walk_standard_deviation_c = 0.3, random_walk_limit_c = 0.05).
diff --git a/Specifications/Component/Mission/Spec_Telescope_en.md b/Specifications/Component/Mission/Spec_Telescope_en.md index d29de342..215b9e25 100644 --- a/Specifications/Component/Mission/Spec_Telescope_en.md +++ b/Specifications/Component/Mission/Spec_Telescope_en.md @@ -17,24 +17,20 @@ - output position of its image on the image sensor, if it is in the field of view. + `ObserveStars` * Function to output some HIP IDs of the brightest stars in the field of view, using `HipparcosCatalogue`. - * Specify how many stars this function outputs in `Telescope.ini`. + * Specify how many stars this function outputs in `telescope.ini`. 2. files - - `Telescope.cpp` , `Telescope.h` + - `telescope.cpp` , `telescope.hpp` + Definitions and declarations of the class - - `InitTelescope.cpp` - + Interface functions for the initialization - - `HipparcosCatalogue.cpp` , `HipparcosCatalogue.h` + - `hipparcos_catalogue.cpp` , `hipparcos_catalogue.hpp` + Definitions and declarations of the class to read Hipparcos catalogue. - - `InitHipparcosCatalogue.cpp` - + Interface functions for the initialization of the `HipparcosCatalogue` 3. how to use - - Set the parameters in `Telescope.ini` - - Create instance by using initialization function `InitTelescope` + - Set the parameters in `telescope.ini` + - Create instance by using initialization function `InitTelescope`. + Each telescope is numbered as "Telescope1,…" - - To use `HipparcosCatalogue` data, `hip_main.csv` is necessary. `s2e-core/scripts/download_HIPcatalogue.sh` is the script to download it. Run the following code using Git bash in `s2e-core/scripts/`: + - To use `HipparcosCatalogue` data, `hip_main.csv` is necessary. `s2e-core/scripts/Common/download_HIPcatalogue.sh` is the script to download it. Run the following code using Git bash in `s2e-core/scripts/`: ``` bash download_HIPcatalogue.sh ``` @@ -47,26 +43,26 @@ 2. input and output - input + The position vector of the celestial body in the body-fixed coordinate. - * This position vector is provided by `CelesInfo`. + * This position vector is provided by `CelestialInformation`. + The forbidden angle about the celestial body - + Specify the forbidden angle in `Telescope.ini`. + + Specify the forbidden angle in `telescope.ini`. - output + true: The celestial body is in forbidden angle + false: The celestial body is not in forbidden angle 3. process to judge - - The judging process is calculated in the telescope's component coordinate. $q_{b2c}$ is the quaternion to convert from the body coordinate(B) to the component coordinate(C). Specify $q_{b2c}$ in `Telescope.ini`. The X-axis of the component coordinate is defined as the line of sight of the telescope. + - The judging process is calculated in the telescope's component coordinate. $q_{b2c}$ is the quaternion to convert from the body coordinate(B) to the component coordinate(C). Specify $q_{b2c}$ in `telescope.ini`. The X-axis of the component coordinate is defined as the line of sight of the telescope. 2. `Observe` 1. overview - - This function judges whether the celestial bodies(provided by `CelesInfo`) are in the field of view and outputs the position of them on the image sensor if they are in the field of view + - This function judges whether the celestial bodies(provided by `CelestialInformation`) are in the field of view and outputs the position of them on the image sensor if they are in the field of view - If they are not in the field of view, this function outputs $(-1,-1)$. 2. input and output - input + The reference to the position of the celestial body on the image sensor + The position vector of the celestial body in the body-fixed coordinate - * `CelesInfo` provides the position vector. + * `CelestialInformation` provides the position vector. - output + (void) * This function rewrites the "reference to the celestial body's position on the image sensor" given as the input. @@ -90,7 +86,7 @@
- The relationship between the component coodinate(C) and the sensor coodinate(imgsensor) + The relationship between the component coordinate(C) and the sensor coordinate(imgsensor)
Fig. 1. The relationship between the component coordinate(C) and the sensor coordinate(imgsensor)
@@ -135,17 +131,16 @@ In this section, the output of the functions when some angular velocity is input - input $ω_b=[0.1~0~0]^T$ . 2. conditions for the verification 1. input files - - `SampleSimBase.ini` - - `Telescope.ini` - - `SampleEnvironment.ini` + - `sample_simulation_base.ini` + - `telescope.ini` 2. initial condition - - `SampleSimBase.ini` + - `sample_simulation_base.ini` ``` Simulation start date[UTC] : 2017/12/01 11:00:00.0 Simulation finish time[sec] : 1500 Quaternion : q_i2b=[0 0 0 1]^T ``` - - `Telescope.ini` + - `telescope.ini` ``` q_b2c=[0 0 0 1]^T sun_forbidden_angle = 60 @@ -156,7 +151,7 @@ In this section, the output of the functions when some angular velocity is input x_fov_par_pix = 0.02 y_fov_par_pix = 0.02 ``` - - `SampleEnvironment.ini` + - `sample_simulation_base.ini` ``` [HIPPARCOS_CATALOGUE] max_magnitude = 5.0 @@ -164,7 +159,7 @@ In this section, the output of the functions when some angular velocity is input logging = DISABLE ``` - The disturbance torque in the main function of `SampleCase.cpp` is commented out. + The disturbance torque in the main function of `sample_case.cpp` is commented out. 3. result 1. judge for forbidden angle diff --git a/Specifications/Component/Mission/Spec_Telescope_ja.md b/Specifications/Component/Mission/Spec_Telescope_ja.md index 66577fe5..8983a0a4 100644 --- a/Specifications/Component/Mission/Spec_Telescope_ja.md +++ b/Specifications/Component/Mission/Spec_Telescope_ja.md @@ -15,20 +15,16 @@ 2. 関連ソースコード,ファイル - - `Telescope.cpp` , `Telescope.h` + - `telescope.cpp` , `telescope.hpp` + クラスの定義が行われている. - - `InitTelescope.cpp` - + 初期化のためのインターフェース関数が記述されている. - - `HipparcosCatalogue.cpp` , `HipparcosCatalogue.h` + - `hipparcos_catalogue.cpp` , `hipparcos_catalogue.hpp` + 天球上の恒星の位置データ(ヒッパルコス星表)を読み出すためのクラスを定義している. - - `InitHipparcosCatalogue.cpp` - + ヒッパルコス星表のクラスを初期化するためのインターフェース関数が記述されている. 3. 使い方 - - Telescope.iniで定数を入力する. + - `telescope.ini`で定数を入力する. - 初期化関数 `InitTelescope` を利用し,インスタンスを生成. + Telescope1,…のように,個々の望遠鏡に番号が振ってある. - - `HipparcosCatalogue` のデータを利用するために,`hip_main.csv` のダウンロードを済ませる必要がある.このためのスクリプトとして `s2e-core/scripts/download_HIPcatalogue.sh`を用意した.Git Bashなどを利用して,このスクリプトがあるディレクトリで以下を実行することで,必要なcsvファイルをダウンロードすることができる. + - `HipparcosCatalogue` のデータを利用するために,`hip_main.csv` のダウンロードを済ませる必要がある.このためのスクリプトとして `s2e-core/scripts/Common/download_HIPcatalogue.sh`を用意した.Git Bashなどを利用して,このスクリプトがあるディレクトリで以下を実行することで,必要なcsvファイルをダウンロードすることができる. ``` bash download_HIPcatalogue.sh ``` @@ -46,7 +42,7 @@ + 判定対象の天体の,body座標系から見た位置 * この位置は,CelesInfoから提供される + その判定対象の天体に関する禁止角 - * 禁止角の値は,`Telescope.ini`で指定する + * 禁止角の値は,`telescope.ini`で指定する - 出力 + 禁止角に入っているならばtrue,そうでないならばfalse @@ -133,17 +129,16 @@ 2. シミュレーション条件 1. 入力ファイル - - `SampleSimBase.ini` - - `Telescope.ini` - - `SampleEnvironment.ini` + - `sample_simulation_base.ini` + - `telescope.ini` 2. 初期値 - - `SampleSimBase.ini` + - `sample_simulation_base.ini` ``` Simulation start date[UTC] : 2017/12/01 11:00:00.0 Simulation finish time[sec] : 1500 姿勢Quaternion : q_i2b=[0 0 0 1]^T ``` - - `Telescope.ini` + - `telescope.ini` ``` 姿勢Quaternion : q_b2c=[0 0 0 1]^T 太陽禁止角[deg] : 60 @@ -154,14 +149,14 @@ X方向1ピクセル当たり視野角[deg] : 0.02 Y方向1ピクセル当たり視野角[deg] : 0.02 ``` - - `SampleEnvironment.ini` + - `sample_simulation_base.ini` ``` [HIPPARCOS_CATALOGUE] max_magnitude = 5.0 calculation = ENABLE logging = DISABLE ``` - なお,SampleCase.cppのメイン関数内において,外乱トルクはコメントアウトしている. + なお,`sample_case.cpp`のメイン関数内において,外乱トルクはコメントアウトしている. 3. 結果 1. 禁止角判定 diff --git a/Specifications/Component/Power/Spec_PCU.md b/Specifications/Component/Power/Spec_PCU.md index 04cdb977..eba8d558 100644 --- a/Specifications/Component/Power/Spec_PCU.md +++ b/Specifications/Component/Power/Spec_PCU.md @@ -1,14 +1,14 @@ -# Specification of PCU +# Specification of PowerControlUnit class ## 1. Overview 1. Functions - - `PCU` class is a base class of power control units and manages multiple `PowerPorts`. + - `PowerControlUnit` class is a base class of power control units and manages multiple `PowerPorts`. 2. Related files - - Main file: `PCU.cpp, .h` - - Related file: `PowerPort.cpp, .h` + - Main file: `power_control_unit.cpp, .hpp` + - Related file: `power_port.cpp, .hpp` 3. How to use - - **Example**: The `SampleComponents` in the `s2e-core/Simulation/Spacecraft/SampleSpacecraft` is useful to know how to use this class. - - Users can make their original `PCU` class by inheriting this base class. + - **Example**: The `sample_components` in the `s2e-core/simulation_sample/spacecraft` is useful to know how to use this class. + - Users can make their original `PowerControlUnit` class by inheriting this base class. - Users need to override the `MainRoutine`, `GetLogHeader`, and `GetLogValue` functions to define the behavior of their PCUs. ## 2. Explanation of Algorithm 1. ConnectPort diff --git a/Specifications/Component/Propulsion/Spec_SimpleThruster.md b/Specifications/Component/Propulsion/Spec_SimpleThruster.md index 79fedfe7..a5647b11 100644 --- a/Specifications/Component/Propulsion/Spec_SimpleThruster.md +++ b/Specifications/Component/Propulsion/Spec_SimpleThruster.md @@ -9,15 +9,13 @@ - According to the thruster output, users can set the thrust duty to the value between 0 and 1. 2. files - - `SimpleThruster.cpp` , `SimpleThruster.h` + - `simple_thruster.cpp` , `simple_thruster.hpp` + Definitions and declarations of the class - - `InitSimpleThruster.cpp` - + Interface functions for the initialization - - `Thruster.ini` + - `thruster.ini` + Parameters for a/multiple thruster(s) 3. how to use - - Set the parameters written in `Thruster.ini` by `InitSimpleThruster.cpp`. + - Set the parameters written in `thruster.ini`. + Users can set multiple thrusters. - Create an instance by `SimpleThruster` function. - Add `calc_thrust` function to `GenerateForce_b()` in `SatComponents` class and `calc_torque` function to `GenerateTorque_b()` in `SatComponents` class @@ -34,10 +32,10 @@ 2. input and output - input + Thruster duty ratio - + Maximum thrust magnitude `max_mag` - + Thrust magnitude error `mag_err` - + Thrust direction `thruster_dir` - + Thrust direction error `deg_err ` + + Maximum thrust magnitude `thrust_magnitude_N` + + Thrust direction `thruster_direction_b` + + Thrust magnitude error `thrust_error_standard_deviation_N` + + Thrust direction error `direction_error_standard_deviation_deg` - output + Thrust magnitude and direction 3. algorithms @@ -79,7 +77,7 @@ - Torque by thruster is calculated from the thrust vector and the vector between the center of mass of the spacecraft and thruster. 2. input and output - input - + Thruster position `thruster_pos` + + Thruster position `thruster_position_b_m` + Mass center of spacecraft + Thrust magnitude and direction - output @@ -99,16 +97,16 @@ ## 3. Results of verifications 1. Case1 - input - + Position `thruster_pos` : [0m, 0m, 0.1m] - + Direction `thruster_dir` : [0, 0, 1] - + Thrust magnitude `max_mag` : 0.001N - + Thrust magnitude error `mag_err` : 0.0N - + Thrust direction error `deg_err` : 0.0deg + + Position `thruster_position_b_m` : [0m, 0m, 0.1m] + + Direction `thruster_direction_b` : [0, 0, 1] + + Thrust magnitude `thrust_magnitude_N` : 0.001N + + Thrust magnitude error `thrust_error_standard_deviation_N` : 0.0N + + Thrust direction error `direction_error_standard_deviation_deg` : 0.0deg + Simulation time: 100sec - result + Force Mean: [0,0,0.001] N - + Force STDDEV: [0,0,0] N + + Force Std Dev: [0,0,0] N
@@ -118,7 +116,7 @@
+ Torque Mean: [0,0,0] Nm - + Torque STDDEV: [0,0,0] Nm + + Torque Std Dev: [0,0,0] Nm
@@ -130,15 +128,15 @@ 2. Case2 - input - + Position `thruster_pos` : [0, 0, 0.1] m - + Direction `thruster_dir` : [0, 0, 1] - + Thrust magnitude `max_mag` : 0.001N - + Thrust magnitude error `mag_err` : 0.00001N - + Thrust direction error `deg_err` : 0.0deg + + Position `thruster_position_b_m` : [0, 0, 0.1] m + + Direction `thruster_direction_b` : [0, 0, 1] + + Thrust magnitude `thrust_magnitude_N` : 0.001N + + Thrust magnitude error `thrust_error_standard_deviation_N` : 0.00001N + + Thrust direction error `direction_error_standard_deviation_deg` : 0.0deg + Simulation time: 100sec - result + Force Mean: [0,0,0.999611e-3] N - + Force STDDEV: [0,0,1.09804e-5] N + + Force Std Dev: [0,0,1.09804e-5] N
@@ -148,7 +146,7 @@
+ Torque Mean: [0,0,0] Nm - + Torque STDDEV: [0,0,0] Nm + + Torque Std Dev: [0,0,0] Nm
@@ -159,15 +157,15 @@ 3. Case3 - input - + Position `thruster_pos` : [0, 0, 0.1] m - + Direction `thruster_dir` : [0, 0, 1] - + Thrust magnitude `max_mag` : 0.001N - + Thrust magnitude error `mag_err` : 0.0N - + Thrust direction error `deg_err` : 10.0deg + + Position `thruster_position_b_m` : [0, 0, 0.1] m + + Direction `thruster_direction_b` : [0, 0, 1] + + Thrust magnitude `thrust_magnitude_N` : 0.001N + + Thrust magnitude error `thrust_error_standard_deviation_N` : 0.0N + + Thrust direction error `direction_error_standard_deviation_deg` : 10.0deg + Simulation time: 100sec - result + Force Mean: [-4.93e-6, -1.04e-5, 0.9834e-3] N - + Force STDDEV: [1.0e-4, 9.79e-5, 1.216e-5] N + + Force Std Dev: [1.0e-4, 9.79e-5, 1.216e-5] N
@@ -177,7 +175,7 @@
+ Torque Mean: [1.04e-6,-4.94e-7,0] Nm - + Torque STDDEV: [1.29e-5, 1.26e-5, 0] Nm + + Torque Std Dev: [1.29e-5, 1.26e-5, 0] Nm
@@ -188,15 +186,15 @@ 4. Case4 - input - + Position `thruster_pos` : [0, 0.1, 0] m - + Direction `thruster_dir` : [0, 0, 1] - + Thrust magnitude `max_mag` : 0.001N - + Thrust magnitude error `mag_err` : 0.0N - + Thrust direction error `deg_err` : 10.0deg + + Position `thruster_position_b_m` : [0, 0.1, 0] m + + Direction `thruster_direction_b` : [0, 0, 1] + + Thrust magnitude `thrust_magnitude_N` : 0.001N + + Thrust magnitude error `thrust_error_standard_deviation_N` : 0.0N + + Thrust direction error `direction_error_standard_deviation_deg` : 0.0deg + Simulation time: 100sec - result + Force Mean: [0,0,0.001] N - + Force STDDEV: [0,0,0] N + + Force Std Dev: [0,0,0] N
@@ -206,7 +204,7 @@
+ Torque Mean: [0.0001,0,0] Nm - + Torque STDDEV: [0,0,0] Nm + + Torque Std Dev: [0,0,0] Nm
diff --git a/Specifications/Disturbance/Spec_Disturbances.md b/Specifications/Disturbance/Spec_Disturbances.md index 224532d4..9615a8fe 100644 --- a/Specifications/Disturbance/Spec_Disturbances.md +++ b/Specifications/Disturbance/Spec_Disturbances.md @@ -10,8 +10,6 @@ 2. Related files - `src/disturbances/disturbances.hpp` - `src/disturbances/disturbances.cpp` - - `src/disturbances/initialize_disturbances.hpp` - - `src/disturbances/initialize_disturbances.cpp` 3. How to use - When you make a new disturbance class, you need to register the new disturbance class in the `InitializeInstances` function. diff --git a/Specifications/Disturbance/Spec_GeoPotential.md b/Specifications/Disturbance/Spec_GeoPotential.md index f7707736..56f9f315 100644 --- a/Specifications/Disturbance/Spec_GeoPotential.md +++ b/Specifications/Disturbance/Spec_GeoPotential.md @@ -1,19 +1,19 @@ -# Specification of Geo Potential Calculation +# Specification of Geopotential Calculation ## 1. Overview 1. Functions - - The `GeoPotential` class calculates the gravity acceleration of the earth with the [EGM96](https://cddis.nasa.gov/926/egm96/) geo-potential model. + - The `Geopotential` class calculates the gravity acceleration of the earth with the [EGM96](https://cddis.nasa.gov/926/egm96/) geo-potential model. 2. Related files - - `src/disturbances/geopotential.cpp` - - `src/disturbances/geopotential.hpp` + - `src/disturbances/geopotential.cpp, .hpp` + - `src/library/gravity/gravity_potential.cpp, .hpp` - `s2e-core/ExtLibraries/GeoPotential/egm96_to360.ascii` - The EGM96 geopotential coefficients file was downloaded from [NASA's EMG96 website](https://cddis.nasa.gov/926/egm96/getit.html), but we cannot access it now. 3. How to use - - Make an instance of the `GeoPotential` class in `InitializeInstances` function in `disturbances.cpp` - - Create an instance by using the initialization function `InitGeoPotential` + - Make an instance of the `Geopotential` class in `InitializeInstances` function in `disturbances.cpp` + - Create an instance by using the initialization function `InitGeopotential` - Choose an orbit propagator mode that considers disturbances. - Edit the `disturbance.ini` file - Select `ENABLE` for `calculation` and `logging` @@ -226,12 +226,12 @@ When $m>=0$, following correction factors are useful for z acceleration 2. initial values - Default initialize files ``` - StartYMDHMS=2020/01/01 11:00:00.0 - EndTimeSec=200 - StepTimeSec=0.1 - OrbitPropagateStepTimeSec=0.1 - LogPeriod = 5 - SimulationSpeed = 0 + simulation_start_time_utc = 2020/01/01 11:00:00.0 + simulation_duration_s = 200 + simulation_step_s = 0.1 + orbit_update_period_s = 0.1 + log_output_period_s = 5 + simulation_speed_setting = 0 ``` - Especially, we chose following TLE for orbit calculation @@ -285,7 +285,7 @@ When $m>=0$, following correction factors are useful for z acceleration - The `time_ms_` is logged every log output step, and 400 data of the calculation time is saved. The averaged value of the 400 data is evaluated here. - Environment - - Corei7-8650U(2.11GHz) + - Core i7-8650U(2.11GHz) - VS2017 32bit debug 2. conditions for the verification diff --git a/Specifications/Disturbance/Spec_GravityGradient.md b/Specifications/Disturbance/Spec_GravityGradient.md index 9bb27c7e..d60608bb 100644 --- a/Specifications/Disturbance/Spec_GravityGradient.md +++ b/Specifications/Disturbance/Spec_GravityGradient.md @@ -7,7 +7,6 @@ 2. related files - `gravity_gradient.cpp`, `gravity_gradient.hpp` : Definitions and declarations of the class - - `initialize_Disturbance.cpp`, `initialize_Disturbance.hpp` : Interface functions for the initialization - `disturbance.ini` : Initialization file 3. how to use diff --git a/Specifications/Disturbance/Spec_MagneticDisturbance.md b/Specifications/Disturbance/Spec_MagneticDisturbance.md index 54d9ef9c..647293f2 100644 --- a/Specifications/Disturbance/Spec_MagneticDisturbance.md +++ b/Specifications/Disturbance/Spec_MagneticDisturbance.md @@ -8,7 +8,6 @@ 2. related files - `magnetic_disturbance.cpp`, `magnetic_disturbance.hpp` : Definitions and declarations of the class - - `initialize_disturbances.cpp`, `initialize_disturbances.hpp` : Interface functions for the initialization - `disturbance.ini` : Initialization file 3. how to use @@ -97,16 +96,16 @@ - Disturbance torque: All Disable 3. results - - [stddev_rw, limit_rw, stddev_wn] = [1E-5,0,0] + - [rmm_random_walk_speed_Am2, rmm_random_walk_limit_Am2, rmm_white_noise_standard_deviation_Am2] = [1E-5,0,0] - RMM random walk value is much smaller than 1E-5, because random walk limit is 0. ![](./figs/test_rmm_randomwalk.png) - - [stddev_rw, limit_rw, stddev_wn] = [1E-5,1E-4,0] + - [rmm_random_walk_speed_Am2, rmm_random_walk_limit_Am2, rmm_white_noise_standard_deviation_Am2] = [1E-5,1E-4,0] ![](./figs/test_rmm_randomwalk_2.png) - - [stddev_rw, limit_rw, stddev_wn] = [0,0,1E-5] + - [rmm_random_walk_speed_Am2, rmm_random_walk_limit_Am2, rmm_white_noise_standard_deviation_Am2] = [0,0,1E-5] ![](./figs/test_rmm_whitenoise.png) diff --git a/Specifications/Disturbance/Spec_SurfaceForce_AirDrag.md b/Specifications/Disturbance/Spec_SurfaceForce_AirDrag.md index 13e14698..e8b8b05d 100644 --- a/Specifications/Disturbance/Spec_SurfaceForce_AirDrag.md +++ b/Specifications/Disturbance/Spec_SurfaceForce_AirDrag.md @@ -9,7 +9,6 @@ - `air_drag.cpp`, `air_drag.hpp` : The `AirDrag` class is defined. - `surface_force.cpp`, `surface_force.hpp` : The base class `SurfaceForce` is defined. - **Note**: `SurfaceForce` class inherits `SimpleDisturbance` class, and `SimpleDisturbance` class inherits `Disturbance` class. So, please refer them if users want to understand the structure deeply. - - `initialize_disturbances.cpp`, `initialize_disturbances.hpp` : Interface functions for the initialization - `disturbance.ini` : Initialization file 3. How to use @@ -120,9 +119,9 @@ | parameters/results | Case 1 | Case 2 | Case 3 | | --------------------------- | ------- | ------- | ------- | - | $\sigma_{d}$ | 0.8 | 0.6 | 0.4 | - | $\theta$ rad | 0.202 | 0.202 | 0.202 | - | $v$ m/s | 7420 | 7420 | 7420 | + | $\sigma_{d}$ | 0.8 | 0.6 | 0.4 | + | $\theta$ rad | 0.202 | 0.202 | 0.202 | + | $v$ m/s | 7420 | 7420 | 7420 | | Out-plane force (S2E) | 2.30297 | 2.68680 | 3.07062 | | Out-plane force (reference) | 2.30297 | 2.68680 | 3.07062 | | Out-plane force (S2E) | 0.31514 | 0.23636 | 0.15757 | diff --git a/Specifications/Disturbance/Spec_SurfaceForce_SolarRadiation.md b/Specifications/Disturbance/Spec_SurfaceForce_SolarRadiation.md index 9de8d85d..f5acf123 100644 --- a/Specifications/Disturbance/Spec_SurfaceForce_SolarRadiation.md +++ b/Specifications/Disturbance/Spec_SurfaceForce_SolarRadiation.md @@ -9,7 +9,6 @@ - `solar_radiation_pressure_disturbance.cpp`, `solar_radiation_pressure_disturbance.hpp` : The `SolarRadiationPressureDisturbance` class is defined. - `surface_force.cpp`, `surface_force.hpp` : The base class `SurfaceForce` is defined. - **Note**: `SurfaceForce` class inherits `SimpleDisturbance` class, and `SimpleDisturbance` class inherits `Disturbance` class. So, please refer them if users want to understand the structure deeply. - - `initialize_disturbances.cpp`, `initialize_disturbances.hpp` : Interface functions for the initialization - `disturbance.ini` : Initialization file 3. How to use diff --git a/Specifications/Disturbance/Spec_ThirdBodyGravity.md b/Specifications/Disturbance/Spec_ThirdBodyGravity.md index 674f27f6..b8b6e0b8 100644 --- a/Specifications/Disturbance/Spec_ThirdBodyGravity.md +++ b/Specifications/Disturbance/Spec_ThirdBodyGravity.md @@ -65,23 +65,23 @@ 2. initial values ``` - StartYMDHMS=2020/01/01 11:00:00.0 - EndTimeSec=86400 - StepTimeSec=10 - OrbitPropagateStepTimeSec=10 - LogPeriod = 5 - SimulationSpeed = 0 + simulation_start_time_utc = 2020/01/01 11:00:00.0 + simulation_duration_s = 86400 + simulation_step_s = 10 + orbit_update_period_s = 10 + log_output_period_s = 5 + simulation_speed_setting = 0 ``` - Since the effect of third body gravity increases as one moves away from the central object, it is verified for GEO. ``` - init_position(0) = 42241095.67425744 - init_position(1) = 0 - init_position(2) = 0 + initial_position_i_m(0) = 42241095.67425744 + initial_position_i_m(1) = 0 + initial_position_i_m(2) = 0 - init_velocity(0) = 0 - init_velocity(1) = 2.978E+4 - init_velocity(1) = 3071.859163190527 + initial_velocity_i_m_s(0) = 0 + initial_velocity_i_m_s(1) = 2.978E+4 + initial_velocity_i_m_s(1) = 3071.859163190527 ``` - All the disturbance calculations, except for the third-object gravity, are set to DISABLE. diff --git a/Specifications/Dynamics/Spec_Attitude.md b/Specifications/Dynamics/Spec_Attitude.md index fa13dd66..0e7cce77 100644 --- a/Specifications/Dynamics/Spec_Attitude.md +++ b/Specifications/Dynamics/Spec_Attitude.md @@ -19,12 +19,12 @@ - Select `propagate_mode` in the spacecraft's `ini` file. - `RK4` or `CONTROLLED` described above. - Select `initialize_mode` in the spacecraft's `ini` file. - - When users select `propagate_mode = CONTROLLED`, `initialize_mode` is not used, and the attitude is initialized with [CONTROLLED_ATTITUDE] settings. + - When users select `propagate_mode = CONTROLLED`, `initialize_mode` is not used, and the attitude is initialized with `[CONTROLLED_ATTITUDE]` settings. - When users select `propagate_mode = RK4`, `initialize_mode` is used. - `initialize_mode = MANUAL` - Initial attitude is defined by `initial_quaternion_i2b` and `initial_angular_velocity_b_rad_s`. - `initialize_mode = CONTROLLED` - - Initial attitude is defined by [CONTROLLED_ATTITUDE] settings. By using this mode, users can easily choose the required initial quaternion without complicated calculation. + - Initial attitude is defined by `[CONTROLLED_ATTITUDE]` settings. By using this mode, users can easily choose the required initial quaternion without complicated calculation. ## 2. Explanation of Algorithm In the `Attitude` base class provides the following common functions for every propagator. diff --git a/Specifications/Dynamics/Spec_EnckeMethod.md b/Specifications/Dynamics/Spec_EnckeMethod.md index 04495373..b6d6ad4c 100644 --- a/Specifications/Dynamics/Spec_EnckeMethod.md +++ b/Specifications/Dynamics/Spec_EnckeMethod.md @@ -77,10 +77,10 @@ 1. Comparison with RK4 1. Overview - We compared the calculated orbit result between RK4 mode and Kepler mode. - - In the Kepler mode, we verified the correctness of both initialize mode (`INIT_OE` and `INIT_POSVEL`). + - In the Kepler mode, we verified the correctness of both initialize mode (`ORBITAL_ELEMENTS` and `POSITION_VELOCITY_I`). 2. Conditions for the verification - - SampleSimbase.ini + - sample_simulation_base.ini - The following values are modified from the default. ``` EndTimeSec = 10000 @@ -103,12 +103,12 @@ ``` - Initial position and velocity (compatible value with the orbital elements) ``` - init_position(0) = 1791860.131 - init_position(1) = 4240666.743 - init_position(2) = 4985526.129 - init_velocity(0) = -7349.913889 - init_velocity(1) = 631.6563971 - init_velocity(2) = 2095.780148 + initial_position_i_m(0) = 1791860.131 + initial_position_i_m(1) = 4240666.743 + initial_position_i_m(2) = 4985526.129 + initial_velocity_i_m_s(0) = -7349.913889 + initial_velocity_i_m_s(1) = 631.6563971 + initial_velocity_i_m_s(2) = 2095.780148 ``` 3. Results diff --git a/Specifications/Dynamics/Spec_KeplerOrbit.md b/Specifications/Dynamics/Spec_KeplerOrbit.md index ccb093c6..cd60d792 100644 --- a/Specifications/Dynamics/Spec_KeplerOrbit.md +++ b/Specifications/Dynamics/Spec_KeplerOrbit.md @@ -210,10 +210,10 @@ 1. Comparison with RK4 1. Overview - We compared the calculated orbit result between RK4 mode and Kepler mode. In the RK4 mode, all disturbances are disabled since the Kepler mode ignores them. - - In the Kepler mode, we verified the correctness of both initialize modes (`INIT_OE` and `INIT_POSVEL`). + - In the Kepler mode, we verified the correctness of both initialize modes (`ORBITAL_ELEMENTS` and `POSITION_VELOCITY_I`). 2. Conditions for the verification - - SampleSimbase.ini + - sample_simulation_base.ini - The following values are modified from the default. ``` EndTimeSec = 10000 @@ -244,19 +244,19 @@ ``` 3. Results - - The follwoing figure shows the orbit calculation result of Kepler mode with `INIT_OE`. + - The following figure shows the orbit calculation result of Kepler mode with `ORBITAL_ELEMENTS` initialize mode. - The result looks correct.
- - The difference between Kepler mode with `INIT_OE` and RK4 mode is shown in the following figure. + - The difference between Kepler mode with `ORBITAL_ELEMENTS` initialize mode and RK4 mode is shown in the following figure. - The error between them is small (less than 10m), and we confirmed that the calculation of Kepler orbit is correct.
- - The following figure shows the difference between Kepler orbit calculation with `INIT_OE` and `INIT_POSVEL`. + - The following figure shows the difference between Kepler orbit calculation with `ORBITAL_ELEMENTS` and `POSITION_VELOCITY_I` initialize mode. - The error between them is small (less than 10m), and we confirmed that the initializing method is correct.
diff --git a/Specifications/Dynamics/Spec_Orbit.md b/Specifications/Dynamics/Spec_Orbit.md index a8203225..c914294a 100644 --- a/Specifications/Dynamics/Spec_Orbit.md +++ b/Specifications/Dynamics/Spec_Orbit.md @@ -27,7 +27,7 @@ - This setting works only for `RK4`, `KEPLER`, and `ENCKE` mode. - Set the orbit information in the ini file - You can see the details in the documents for each orbit propagation mode. - - The definition of the coordinate system is decided in `PlanetSelect.ini` + - The definition of the coordinate system is decided at `[CELESTIAL_INFORMATION]` section in `sample_simulation_base.ini`. ## 2. Explanation of Algorithm In the Orbit base class provides the following common functions for every propagator. diff --git a/Specifications/Dynamics/Spec_RelativeOrbit.md b/Specifications/Dynamics/Spec_RelativeOrbit.md index f1c925dd..3c994f91 100644 --- a/Specifications/Dynamics/Spec_RelativeOrbit.md +++ b/Specifications/Dynamics/Spec_RelativeOrbit.md @@ -58,7 +58,7 @@ + Add the name of the dynamics model to `StmModel` enum in `relative_orbit_models.hpp`. + Add the function to calculate the system matrix as `CalcHcwStm`in `relative_orbit_models.hpp`. - + Edit the `CalculateSTM` function in `relative_orbit.hpp`. + + Edit the `CalculateStm` function in `relative_orbit.hpp`. ## 2. Explanation of Algorithm @@ -69,20 +69,11 @@ 2. inputs and outputs + input - * `initial_relative_position_lvlh_m`, `initial_relative_velocity_lvlh_m_s` + * `relative_position_lvlh_m`, `relative_velocity_lvlh_m_s` - The initial state of the satellite * `gravity_constant_m3_s2` - The gravity constant of the reference celestial body $\mu$ - * `reference_sat_initial_orbit` - - The initial orbit of the reference satellite - - NOTE: This is used only for the initialization. - * `current_jd` - - The initial Julian day - * `timestep` - - RK4 propagation timestep - * `wgs` - - Type of the World Geometric System - * `init_time` + * `initial_time_s` - Initial simulation time (default value is 0) + output * none @@ -102,7 +93,7 @@ - The type of relative dynamics model * `reference_sat_orbit` - The orbit of the reference satellite - * `mu` + * `gravity_constant_m3_s2` - The gravity constant $\mu$ + output * none @@ -111,10 +102,10 @@ 4. note -1. `CalculateSTM` +1. `CalculateStm` 1. overview - + The `CalculateSTM` function is used only inside the `RelativeOrbit` class. This function calls the system matrix calculation function according to `stm_model_type`. + + The `CalculateStm` function is used only inside the `RelativeOrbit` class. This function calls the system matrix calculation function according to `stm_model_type`. 2. inputs and outputs + input @@ -122,7 +113,7 @@ - The type of relative dynamics model * `reference_sat_orbit` - The orbit of the reference satellite - * `mu` + * `gravity_constant_m3_s2` - The gravity constant $\mu$ * `elapsed_sec` - Elapsed simulation time @@ -137,13 +128,13 @@ 1. overview + The `CalculateHillSystemMatrix` function calculates the system matrix of the Hill equation. - + This function is declared in `RelativeOrbitModels.h` and is used by the + + This function is declared in `relative_orbit_models.hpp` and is used by the 2. inputs and outputs + input * `orbit_radius` - Radius of the reference satellite orbit $R$ - * `mu` + * `gravity_constant_m3_s2` - The gravity constant $\mu$ + output * `system_matrix` @@ -172,17 +163,17 @@ 4. note -1. `CalculateHCWSTM` +1. `CalculateHcwStm` 1. overview - + The `CalculateHCWSTM` function calculates the Hill-Clohessy-Wiltshire STM. - + This function is declared in `RelativeOrbitModels.h` and is used by the + + The `CalculateHcwStm` function calculates the Hill-Clohessy-Wiltshire STM. + + This function is declared in `relative_orbit_models.hpp` and is used by the 2. inputs and outputs + input * `orbit_radius` - Radius of the reference satellite orbit $R$ - * `mu` + * `gravity_constant_m3_s2` - The gravity constant $\mu$ * `elapsed_sec` - Elapsed simulation time @@ -223,62 +214,60 @@ 2. conditions for the verification 1. input files - Initialization files for the two satellites were prepared. - - `Sat0.ini` - - `Sat1.ini` + - `satellite0.ini` + - `satellite1.ini` 2. initial values - - The orbit of the reference satellite (Sat0) is GEO. The initial position of the satellite (Sat1) is $(0\mathrm{m}, 100\mathrm{m}, 0\mathrm{m})^\mathrm{T}$ in LVLH frame. The orbit was propagated for 86400 sec (the period of GEO). - - `Sat0.ini` + - The orbit of the reference satellite (satellite0) is GEO. The initial position of the satellite (satellite1) is $(0\mathrm{m}, 100\mathrm{m}, 0\mathrm{m})^\mathrm{T}$ in LVLH frame. The orbit was propagated for 86400 sec (the period of GEO). + - `satellite0.ini` ``` - propagate_mode = 0 + propagate_mode = RK4 //Information used for orbital propagation by the Runge-Kutta method/////////// //initial satellite position[m] //*The coordinate system is defined in PlanetSelect.ini - init_position(0) = 4.2164140100E+07 //radius of GEO - init_position(1) = 0 - init_position(2) = 0 + initial_position_i_m(0) = 4.2164140100E+07 //radius of GEO + initial_position_i_m(1) = 0 + initial_position_i_m(2) = 0 //initial satellite velocity[m/s] //*The coordinate system is defined in PlanetSelect.ini - init_velocity(0) = 0 - init_velocity(1) = 3.074661E+03 //Speed of a spacecraft in GEO - init_velocity(2) = 0 + initial_velocity_i_m_s(0) = 0 + initial_velocity_i_m_s(1) = 3.074661E+03 //Speed of a spacecraft in GEO + initial_velocity_i_m_s(2) = 0 /////////////////////////////////////////////////////////////////////////////// ``` - - `Sat1.ini` + - `satellite1.ini` ``` - propagate_mode = 2 + propagate_mode = RELATIVE //Information used for relative orbit propagation////////////////////////////// //Relative Orbit Update Method (0 means RK4, 1 means STM) - update_method = 0 - //RK4 Relative Dynamics model type (only valid for RK4 update) - //0: Hill + relative_orbit_update_method = 0 + // RK4 Relative Dynamics model type (only valid for RK4 update) + // 0: Hill relative_dynamics_model_type = 0 - //STM Relative Dynamics model type (only valid for STM update) - //0: HCW + // STM Relative Dynamics model type (only valid for STM update) + // 0: HCW stm_model_type = 0 - //initial satellite position relative to the reference satellite in LVLH frame[m] - //*The coordinate system is defined in PlanetSelect.ini - init_relative_position_lvlh(0) = 0.0 - init_relative_position_lvlh(1) = 100.0 - init_relative_position_lvlh(2) = 0.0 - //initial satellite velocity relative to the reference satellite in LVLH frame[m/s] - //*The coordinate system is defined in PlanetSelect.ini - init_relative_velocity_lvlh(0) = 0.0 - init_relative_velocity_lvlh(1) = 0.0 - init_relative_velocity_lvlh(2) = 0.0 - //information of reference satellite - reference_sat_id = 0 - reference_sat_ini_file = ../../data/ini/Sat0.ini + // Initial satellite position relative to the reference satellite in LVLH frame[m] + // * The coordinate system is defined at [PLANET_SELECTION] in SampleSimBase.ini + initial_relative_position_lvlh_m(0) = 0.0 + initial_relative_position_lvlh_m(1) = 100.0 + initial_relative_position_lvlh_m(2) = 0.0 + // initial satellite velocity relative to the reference satellite in LVLH frame[m/s] + initial_relative_velocity_lvlh_m_s(0) = 0.0 + initial_relative_velocity_lvlh_m_s(1) = 0.0 + initial_relative_velocity_lvlh_m_s(2) = 0.0 + // information of reference satellite + reference_satellite_id = 0 /////////////////////////////////////////////////////////////////////////////// ``` 3. results - - The position of Sat1 seen from Sat0 in the inertia frame was calculated. + - The position of satellite1 seen from satellite0 in the inertia frame was calculated.
@@ -294,4 +283,4 @@ ## 4. References -1. Kapila, V., Sparks, A. G., Buffington, J. M., & Yan, Q. (2000). Spacecraft formation flying: Dynamics and control. Journal of Guidance, Control, and Dynamics, 23(3), 561-564. \ No newline at end of file +1. Kapila, V., Sparks, A. G., Buffington, J. M., & Yan, Q. (2000). Spacecraft formation flying: Dynamics and control. Journal of Guidance, Control, and Dynamics, 23(3), 561-564. diff --git a/Specifications/Environment/Spec_Atmosphere.md b/Specifications/Environment/Spec_Atmosphere.md index b5adcfb9..d7831263 100644 --- a/Specifications/Environment/Spec_Atmosphere.md +++ b/Specifications/Environment/Spec_Atmosphere.md @@ -9,8 +9,6 @@ + `Atmosphere` class is defined. + `src/environment/local/local_environment.cpp, .hpp` + `Atmosphere` class is used here as a member variable of `LocalEnvironment` class. - + `src/environment/local/initialize_local_environment.cpp, .hpp` - + `Atmosphere` class is instanced here based on the `.ini` file for the environment. + `src/library/external/nrlmsise00/wrapper_nrlmsise00.cpp, .hpp` + An air density is calculated using an external library, NRLMSISE00 atmosphere model. @@ -19,6 +17,8 @@ + Model + `STANDARD` + The air density is calculated using scale height. + + `HARRIS_PRIESTER` + + The air density is calculated using the Harris-Priester model. + `NRLMSISE00` + The air density is calculated using the NRLMSISE00 model. + If users use this model, the following additional parameters must be set in the `.ini` file. @@ -53,7 +53,7 @@ + NRLMSISE00 1. Read Space weather table - + F10.7 and Kp/Ap index, which indicates the solar activity cycle, are necessary as inputs for NRLMSISE00. + + `F10.7` and `Kp/Ap` index, which indicates the solar activity cycle, are necessary as inputs for NRLMSISE00. These parameters, which are only during the simulation period, are read from SpaceWeather.txt. + Note + If SpaceWeather.txt cannot be read, the atmosphere model is automatically set to STANDARD. @@ -84,21 +84,21 @@ 2. initial values + Case1 : Default initialize files ``` - StartYMDHMS=2020/01/01 11:00:00.0 - EndTimeSec=200 - StepTimeSec=0.1 - OrbitPropagateStepTimeSec=0.1 - LogPeriod = 5 - SimulationSpeed = 0 + simulation_start_time_utc = 2020/01/01 11:00:00.0 + simulation_duration_s = 200 + simulation_step_s = 0.1 + orbit_update_period_s = 0.1 + log_output_period_s = 0.1 + simulation_speed_setting = 0 ``` + Case2 : Start year only was changed to 2015. ``` - StartYMDHMS=2015/01/01 11:00:00.0 - EndTimeSec=200 - StepTimeSec=0.1 - OrbitPropagateStepTimeSec=0.1 - LogPeriod = 5 - SimulationSpeed = 0 + simulation_start_time_utc = 2015/01/01 11:00:00.0 + simulation_duration_s = 200 + simulation_step_s = 0.1 + orbit_update_period_s = 0.1 + log_output_period_s = 0.1 + simulation_speed_setting = 0 ``` + Especially, we chose following TLE for orbit calculation ``` diff --git a/Specifications/Environment/Spec_CelestialInformation.md b/Specifications/Environment/Spec_CelestialInformation.md index 5610ad7a..8bdef0ea 100644 --- a/Specifications/Environment/Spec_CelestialInformation.md +++ b/Specifications/Environment/Spec_CelestialInformation.md @@ -4,15 +4,13 @@ 1. Functions - `CelestialInformation` manages the celestial bodies position and velocity on the inertial frame. - This class also manages the celestial body information like the gravity constant, the radius, and the rotation. - - The actual calculations are executed by CSPICE or `CelestialRotation`, and this class just calls their functions. + - The actual calculations are executed by CSPICE or `EarthRotation`, and this class just calls their functions. 2. Related files - `src/environment/global/celestial_information.cpp, .hpp` - `CelestialInformation` class is defined. - `src/environment/global/global_environment.cpp, .hpp` - `CelestialInformation` class is used here as a member variable of `GlobalEnvironment` class. - - `src/environment/global/initialize_global_environment.cpp, .hpp` - - `CelestialInformation` class is instanced here based on the `.ini` file for the environment. 3. How to use - Call ` UpdateAllObjectsInformation` function to calculates the celestial bodies position and velocity. diff --git a/Specifications/Environment/Spec_CelestialRotation.md b/Specifications/Environment/Spec_CelestialRotation.md index 1971743c..7c23418a 100644 --- a/Specifications/Environment/Spec_CelestialRotation.md +++ b/Specifications/Environment/Spec_CelestialRotation.md @@ -1,23 +1,23 @@ -# Specification of Celestial Rotation +# Specification of Earth Rotation ## 1. Overview 1. Functions - - The `CelestialRotation` class calculates the rotational motion of central objects. Currently, only the Earth is supported as the central object. + - The `EarthRotation` class calculates the rotational motion of the Earth. 2. Related files - - `src/environment/global/celestial_rotation.cpp, .hpp` - - `CelestialRotation` class is defined here. + - `src/environment/global/earth_rotation.cpp, .hpp` + - `EarthRotation` class is defined here. - `src/environment/global/celestial_information.cpp, .hpp` - - `CelestialRotation` class is used here. + - `EarthRotation` class is used here. 3. How to use - - Make an instance of the `CelestialRotation` class in `CelestialInformation` class. + - Make an instance of the `EarthRotation` class in `CelestialInformation` class. - Select rotation mode in `sample_simulation_base.ini` - - `Idle` : no motion ( $\mathrm{DCM_{ECItoECEF}}$ is set as the unit matrix) - - If the rotation mode input is neither `Full` nor `Simple`, the `Idle` mode is set. - - `Simple` : axial rotation only ( $\mathrm{DCM_{ECItoECEF}} = \bf{R}$ ) - - `Full` : Precession and Nutation are taken into account ( $\mathrm{DCM_{ECItoECEF}} = \bf{R}\bf{N}\bf{P}$ ) + - `IDLE` : no motion ( $\mathrm{DCM_{ECItoECEF}}$ is set as the unit matrix) + - If the rotation mode input is neither `FULL` nor `SIMPLE`, the `IDLE` mode is set. + - `SIMPLE` : axial rotation only ( $\mathrm{DCM_{ECItoECEF}} = \bf{R}$ ) + - `FULL` : Precession and Nutation are taken into account ( $\mathrm{DCM_{ECItoECEF}} = \bf{R}\bf{N}\bf{P}$ ) - $\bf{R}$, $\bf{N}$, $\bf{P}$ stand for the DCM of axial rotation, nutation, precession, respectively. ## 2. Explanation of Algorithm diff --git a/Specifications/Environment/Spec_GeomagneticField.md b/Specifications/Environment/Spec_GeomagneticField.md index 74a6d789..438c5052 100644 --- a/Specifications/Environment/Spec_GeomagneticField.md +++ b/Specifications/Environment/Spec_GeomagneticField.md @@ -10,17 +10,15 @@ + `GeomagneticField` class is defined. + `src/environment/local/local_environment.cpp, .hpp` + `GeomagneticField` class is used here as a member variable of `LocalEnvironment` class. - + `src/environment/local/initialize_local_environment.cpp, .hpp` - + `GeomagneticField` class is instanced here based on the `.ini` file for environment. + `src/library/external/igrf/igrf.cpp, h` + A magnetic field in the ECI frame is calculated by the IGRF model. 3. How to use + Set a coefficient file path for the IGRF and random walk / white noise in .ini file - - coefficient_file: File path to the IGRF coefficients table. - - magnetic_field_random_walk_standard_deviation_nT: Standard deviation of the random walk noise - - magnetic_field_random_walk_limit_nT: Limit of the random walk noise - - magnetic_field_white_noise_standard_deviation_nT: Standard deviation of the normal random noise + - `coefficient_file`: File path to the IGRF coefficients table. + - `magnetic_field_random_walk_standard_deviation_nT`: Standard deviation of the random walk noise + - `magnetic_field_random_walk_limit_nT`: Limit of the random walk noise + - `magnetic_field_white_noise_standard_deviation_nT`: Standard deviation of the normal random noise + Public functions + `CalcMagneticField` : Update the magnetic field + `GetGeomagneticField_i_nT` : Return the magnetic field (nT) in the ECI @@ -43,12 +41,12 @@ 2. initial values - To check the result in an example orbit, the EndTime was changed to 9000 s. ``` - StartYMDHMS=2020/01/01 11:00:00.0 - EndTimeSec=9000 - StepTimeSec=5 - OrbitPropagateStepTimeSec=0.1 - LogPeriod = 5 - SimulationSpeed = 0 + simulation_start_time_utc = 2020/01/01 11:00:00.0 + simulation_duration_s = 9000 + simulation_step_s = 5 + orbit_update_period_s = 0.1 + log_output_period_s = 5 + simulation_speed_setting = 0 ``` - Especially, we chose the following TLE for orbit calculation (ISS orbit). ``` diff --git a/Specifications/Environment/Spec_GnssSatellites_en.md b/Specifications/Environment/Spec_GnssSatellites_en.md index e4f1d0fa..c3b56c42 100644 --- a/Specifications/Environment/Spec_GnssSatellites_en.md +++ b/Specifications/Environment/Spec_GnssSatellites_en.md @@ -3,7 +3,7 @@ ## 1. Overview 1. function - A class to read data about orbit and clock bias of GNSS satellites such as .sp3 and .clk_30s and use them in other classes. - - Determine the file name of GNSS satellites' data and time from `[GNSS_SATELLIES]` in `sample_gnss.ini`. + - Determine the file name of GNSS satellites' data and time from `[GNSS_SATELLITES]` in `sample_gnss.ini`. 2. Related files - `src/environment/global/globalEnvironment.cpp, .hpp` diff --git a/Specifications/Environment/Spec_HipparcosCatalogue_en.md b/Specifications/Environment/Spec_HipparcosCatalogue_en.md index 7deaf9ee..9323151a 100644 --- a/Specifications/Environment/Spec_HipparcosCatalogue_en.md +++ b/Specifications/Environment/Spec_HipparcosCatalogue_en.md @@ -12,8 +12,6 @@ 2. files + `HipparcosCatalogue.cpp` ,`HipparcosCatalogue.hpp` * Definitions and declarations of the class - + `initialize_global_environment.cpp` - * The initialize function is defined here. + `sample_simulation_base.ini` * Parameters for initialization + `hip_main.csv` diff --git a/Specifications/Environment/Spec_HipparcosCatalogue_ja.md b/Specifications/Environment/Spec_HipparcosCatalogue_ja.md index c47b3008..11903bb5 100644 --- a/Specifications/Environment/Spec_HipparcosCatalogue_ja.md +++ b/Specifications/Environment/Spec_HipparcosCatalogue_ja.md @@ -16,7 +16,7 @@ + `sample_simulation_base.ini` * 初期化ファイル + `hip_main.csv` - * ヒッパルコス星表の元データ. `s2e-core` 外の `ExtLibralies` に保存される.使用しやすいように,HIP ID順ではなく,視等級の小さい順にソートされている. + * ヒッパルコス星表の元データ. `s2e-core` 外の `ExtLibraries` に保存される.使用しやすいように,HIP ID順ではなく,視等級の小さい順にソートされている. 3. 外部ライブラリのダウンロードに関して + まずは`hip_main.csv` のダウンロードを済ませる必要がある.このためのスクリプトとして `s2e-core/scripts/download_HIPcatalogue.sh`を用意した.Git Bashなどを利用して,このスクリプトがあるディレクトリで以下を実行することで,必要なcsvファイルをダウンロードすることができる. * Macユーザーは,Mac標準のターミナルからではなく,Docker内のUbuntuのターミナルから実行する必要がある.( `sed` の仕様がMacとLinuxで違うので,正しいcsvファイルを生成することができないため.参考:) diff --git a/Specifications/Environment/Spec_LocalCelestialInformation.md b/Specifications/Environment/Spec_LocalCelestialInformation.md index 33fa850a..fed1d756 100644 --- a/Specifications/Environment/Spec_LocalCelestialInformation.md +++ b/Specifications/Environment/Spec_LocalCelestialInformation.md @@ -9,8 +9,7 @@ - `LocalCelestialInformation` class is defined. - `src/environment/local/local_environment.cpp, .hpp` - `LocalCelestialInformation` class is used here as a member variable of `LocalEnvironment` class. - - `src/environment/local/initialize_local_environment.cpp, .hpp` - - `LocalCelestialInformation` class is instanced here based on the `.ini` file for the environment. + 3. How to use - Call ` UpdateAllObjectsInformation` function to calculates the celestial bodies position and velocity. - Users can get calculated values by using the following functions: diff --git a/Specifications/Environment/Spec_SRPEnvironment.md b/Specifications/Environment/Spec_SRPEnvironment.md index 23ad9765..c0e82c10 100644 --- a/Specifications/Environment/Spec_SRPEnvironment.md +++ b/Specifications/Environment/Spec_SRPEnvironment.md @@ -10,8 +10,6 @@ - `SolarRadiationPressureEnvironment` class is defined. - `src/environment/local/local_environment.cpp, .hpp` - `SolarRadiationPressureEnvironment` class is used here as a member variable of `LocalEnvironment` class. - - `src/environment/local/initialize_local_environment.cpp, .hpp` - - `SolarRadiationPressureEnvironment` class is instanced here based on the `.ini` file for the environment. 3. How to use - Call `UpdateAllStates` function to calculates solar power flux and updates the eclipse flag. @@ -151,4 +149,4 @@ ## 4. References -1. Montenbruck, O., Gill, E., & Lutze, F. (2002). Satellite orbits: models, methods, and applications. Appl. Mech. Rev., 55(2), B27-B28. \ No newline at end of file +1. Montenbruck, O., Gill, E., & Lutze, F. (2002). Satellite orbits: models, methods, and applications. Appl. Mech. Rev., 55(2), B27-B28. diff --git a/Specifications/Interface/Spec_PowerPort.md b/Specifications/Interface/Spec_PowerPort.md index 5e814ae2..3b64f5d7 100644 --- a/Specifications/Interface/Spec_PowerPort.md +++ b/Specifications/Interface/Spec_PowerPort.md @@ -5,29 +5,29 @@ - `PowerPort` class provides features of an electrical power connection. - Users can use the class to control the electrical power switching of components and calculate the component's consumed electrical current. 2. Related files - - Main files: `PowerPort.cpp, .h` - - Referenced files: `ComponentBase.cpp, .h` and `PCU.cpp, .h` + - Main files: `power_port.cpp, .hpp` + - Referenced files: `component.cpp, .hpp` and `power_control_unit.cpp, .hpp` 3. How to use - - **Example**: The `SampleComponents` in the `s2e-core/Simulation/Spacecraft/SampleSpacecraft` is helpful to know how to use the feature. - - Make a component class that inherits the `ComponentBase` class. - - The `ComponentBase` class has the `PowerPort` class as a member and controls the component's action according to the electrical power switches. - - Make an instance of `PCU` and connect the power port. - - The `PCU` base class has a member of the `map` of the `PowerPort` class and manages the port id and connection of the `PowerPort`. - - Users can make their PCU by inheriting the `PCU` base class and can control the power switching in the `MainRoutine` function. + - **Example**: The `sample_components.hpp` in the `s2e-core/simulation_sample/spacecraft/` is helpful to know how to use the feature. + - Make a component class that inherits the `Component` class. + - The `Component` class has the `PowerPort` class as a member and controls the component's action according to the electrical power switches. + - Make an instance of `PowerControlUnit` and connect the power port. + - The `PowerControlUnit` base class has a member of the `map` of the `PowerPort` class and manages the port id and connection of the `PowerPort`. + - Users can make their PCU by inheriting the `PowerControlUnit` base class and can control the power switching in the `MainRoutine` function. ```cpp - pcu_ = new PCU(clock_gen); + pcu_ = new PowerControlUnit(clock_gen); pcu_->ConnectPort(0, 0.5, 3.3, 0.3); ``` - Make an instance of the components with the connected `PowerPort`. ```cpp - obc_ = new OBC(1, clock_gen, pcu_->GetPowerPort(0)); + obc_ = new OnBoardComputer(1, clock_gen, pcu_->GetPowerPort(0)); ``` - - Control the power switches by using the `PCU`. + - Control the power switches by using the `PowerControlUnit`. - The default setting of the power switch is `off`, so users need to power on the port to execute the `MainRoutine` of the components. ```cpp pcu_->GetPowerPort(0)->SetVoltage(3.3); ``` - - **Note**: The virtual power port is created when users make an instance of the `ComponentBase` class and its subclasses without the `PowerPort` information. The virtual port has a minus value port ID, and the switch state is originally `ON`, but the consumed power is zero. + - **Note**: The virtual power port is created when users make an instance of the `Component` class and its subclasses without the `PowerPort` information. The virtual port has a minus value port ID, and the switch state is originally `ON`, but the consumed power is zero. ## 2. Explanation of Algorithm 1. SetVoltage @@ -67,4 +67,4 @@ N/A ## 4. References -N/A \ No newline at end of file +N/A diff --git a/Specifications/OverallStructure/OverallStructure.md b/Specifications/OverallStructure/OverallStructure.md index 289a765e..aad8c402 100644 --- a/Specifications/OverallStructure/OverallStructure.md +++ b/Specifications/OverallStructure/OverallStructure.md @@ -9,12 +9,12 @@ S2EStructure ### 2.1. Simulation Case -- The highest layer of the structure of S2E is the `Simulation Case`, which is defined in the `src/Simulation/Case/SimulationCase.cpp`. -- The `SimulationCase` always has `SimulationConfig` and `Global Environment`. - - `SimulationConfig` has basic information on the interface of the simulation, such as `log output` and `initialize input` information. - - `GlobalEnvironment` is defined as the common environment for the whole simulation case. It includes time, celestial information, star catalog, and GNSS satellite position. -- Users can make their `SimulationCase` by inheriting the `SimulationCase` base class and adding simulation target objects (e.g., spacecraft and ground station) for their demand. -- The defined simulation objects can use the information of `SimulationConfig` and `GlobalEnvironment`. +- The highest layer of the structure of S2E is the `Simulation Case`, which is defined in the `src/simulation/case/simulation_case.cpp`. +- The `Simulation Case` always has `Simulation Configuration` and `Global Environment`. + - `Simulation Configuration` has basic information on the interface of the simulation, such as `log output` and `initialize input` information. + - `Global Environment` is defined as the common environment for the whole simulation case. It includes time, celestial information, star catalog, and GNSS satellite position. +- Users can make their `Simulation Case` by inheriting the `Simulation Case` base class and adding simulation target objects (e.g., spacecraft and ground station) for their demand. +- The defined simulation objects can use the information of `Simulation Configuration` and `Global Environment`. ### 2.2. Spacecraft - An essential simulation object is the `Spacecraft` class. @@ -41,8 +41,8 @@ ### 2.4. Structure of initializing files - The structure of the initializing files follows the above figure. -- `SimBase.ini` sets the parameters for `SimulationCase`, and file paths to each simulation object. -- `Sat.ini` sets the parameters for `Spacecraft` and file paths to each component. +- `simulation_base.ini` sets the parameters for `SimulationCase`, and file paths to each simulation object. +- `satellite.ini` sets the parameters for `Spacecraft` and file paths to each component. ## 3. Structure of spacecraft components **Note:** the structure of components is implemented now. So the following figure is just an idea, and it may be modified. diff --git a/Specifications/Simulation/Spec_MonteCarloSimulation.md b/Specifications/Simulation/Spec_MonteCarloSimulation.md index 6edbf93e..1d0662b3 100644 --- a/Specifications/Simulation/Spec_MonteCarloSimulation.md +++ b/Specifications/Simulation/Spec_MonteCarloSimulation.md @@ -6,11 +6,12 @@ - The `Monte Carlo Simulation` feature of S2E provides a framework for Monte Carlo simulation 2. Related files(TBW) - - `src/Simulation/MCSim` - - `InitParameter`: A class to initialize randomized parameters - - `MCSimExecutor`: The main class for Monte Carlo simulation - - `SimulationObject`: - - `data/SampleSat/ini/MCSim.ini` + - `src/simulation/monte_carlo_simulation` + - `initialize_monte_carlo_parameters`: A class to initialize randomized parameters + - `initialize_monte_carlo_simulation` + - `monte_carlo_simulation_executor`: The main class for Monte Carlo simulation + - `simulation_object`: + - `data/sample/initialize_files/sample_simulation_base.ini` 3. How to use - Read [How to use Monte Carlo simulation](../../Tutorials/HowToUseMonteCarloSimulation.md) diff --git a/Tutorials/HowToAddComponents.md b/Tutorials/HowToAddComponents.md index 493308d3..864b9906 100644 --- a/Tutorials/HowToAddComponents.md +++ b/Tutorials/HowToAddComponents.md @@ -5,13 +5,15 @@ - In the [How To Make New Simulation Scenario](./HowToMakeNewSimulationScenario.md) tutorial, we have made an `s2e-user` directory for our simulation scenario. - This tutorial explains how to add components to your scenario. - A similar procedure is available for other components in the `s2e-core`. + - Please see the components listed in the [components directory](https://github.com/ut-issl/s2e-core/tree/develop/src/components). - The supported version of this document - Please confirm that the version of the documents and s2e-core is compatible. ## 2. Add a Gyro sensor -- This chapter explains how to add a gyro sensor component to your `s2e-user` simulation case. +- This chapter explains how to add a gyro sensor component to your `s2e-user` simulation case step by step. +- Users can find the sample code of this section in [s2e-user-example/sample/how-to-add-components](https://github.com/ut-issl/s2e-user-example/tree/sample/how-to-add-components). 1. Open & edit `user_components.hpp` - Add the following descriptions at the one line below of `#include ` diff --git a/Tutorials/HowToAddControlAlgorithms.md b/Tutorials/HowToAddControlAlgorithms.md index 6fa4b232..132bf018 100644 --- a/Tutorials/HowToAddControlAlgorithms.md +++ b/Tutorials/HowToAddControlAlgorithms.md @@ -1,26 +1,27 @@ # How To Add Control Algorithms ## 1. Overview -- In the [How To Make New Components](./HowToMakeNewComponents.md) tutorial, we have newly made components emulating codes in [s2e-core](https://github.com/ut-issl/s2e-core) and adding the new components into our simulation scenario. +- In the [How To Make New Components](./HowToMakeNewComponents.md) tutorial, we have newly made components emulating codes and adding the new components into our simulation scenario. - Now we can simulate the behavior of spacecraft **free motion** and emulate the behavior of sensors and actuators. -- This tutorial explains how to add a **Control Algorithm** into the simulation scenario. -- For a practical satellite project, we should implement the control algorithm as actual flight software like [C2A](https://github.com/ut-issl/c2a-core) into the S2E. However, using actual flight software is usually overdoing for use cases as research, the initial phase of satellite projects. +- This tutorial explains how to add a **Control Algorithm** to the simulation scenario. +- For a practical satellite project, we should implement the control algorithm as actual flight software like [C2A](https://github.com/ut-issl/c2a-core) into the S2E. However, using actual flight software is usually overdoing for use cases such as research and the initial phase of satellite projects. - So, we introduce the following three methods, and users can choose a suitable method. - - Direct method: Directly control physical quantity without sensors, actuators, and their noises - - For theoretical researches and preliminary analysis for satellite projects - - Component method: Control using sensors and actuators without flight S/W framework - - For engineering researches and preliminary analysis for satellite projects - - From v6.0.0, we have `ideal` and `real` directories in the `s2e-core/src/components`. Users can use `ideal` components for early stage of the analysis and can use `real` components for more detailed analysis. Mixing these components is also possible. - - Flight S/W method: Control using sensors and actuators with flight S/W framework + - `Direct method`: Directly control physical quantity without sensors, actuators, and their noises + - For theoretical research and preliminary analysis for satellite projects + - `Component method`: Control using sensors and actuators without flight S/W framework + - We can include sensing and actuation noise. + - For engineering research and preliminary analysis for satellite projects + - From v6.0.0, we have `ideal` and `real` directories in the `s2e-core/src/components`. Users can use `ideal` components for the early stage of the analysis and can use `real` components for more detailed analysis. Mixing these components is also possible. + - `Flight S/W method`: Control using sensors and actuators with flight S/W framework - For actual satellite projects - The supported version of this document - - Please confirm that the version of the documents and s2e-core is compatible. + - Please confirm that the version of the documents and s2e-core are compatible. ## 2. Direct method - This chapter introduces how to add a control algorithm without sensors and actuators. - This method directly measures the satellite's physical quantity and generates torque and force acting on the satellite. - To do that, users need to edit the `Update` function in the `UserSat.cpp`. - - A sample code is in `./Tutorials/SampleCodes/control_algorithm/direct_method/user_satellite.cpp` + - A sample code is in [s2e-user-example/sample/how-to-add-control-algorithm-direct-method](https://github.com/ut-issl/s2e-user-example/tree/sample/how-to-add-control-algorithm-direct-method) - The `UserSatellite` class already has satellite attitude, orbit, and local environment information since it inherits the `Spacecraft` base class. So users can easily access these values. - To measure physical quantities, users can use getter functions defined in the `Attitude`, `Orbit`, and `LocalEnvironment` classes as `dynamics_->GetAttitude().GetAngularVelocity_b_rad_s()`. - To generate torque and force, users can use `dynamics_->AddTorque_b_Nm` and `dynamics_->AddForce_b_N`. @@ -36,11 +37,13 @@ ## 3. Component method: Using ideal components - TBW +- Users can refer the [s2e-ff](https://github.com/ut-issl/s2e-ff/tree/feature/example-three-along-track-ff-with-control) as an example of the ideal component method. + ## 4. Component method: Using real components - This chapter introduces a method to add a control algorithm using realistic sensors and actuators. - This method measures a satellite's physical quantity via sensors, generates torque and force via actuators, and executes control algorithms on OBC. - This tutorial assumes the spacecraft has a three-axis gyro sensor, a reaction wheel, and an OBC. -- The sample codes are in `SampleCodes/control_algorithm/component_method/` +- The sample codes are in [s2e-user-example/sample/how-to-add-control-algorithm-using-real-component](https://github.com/ut-issl/s2e-user-example/tree/sample/how-to-add-control-algorithm-using-real-component). - Firstly, users need to make the `UserOnBoardComputer` class to emulate the OBC. - Copy the `user_on_board_computer` files to the `s2e-user/src/components` from the `component_method/src/components`, and add the `user_on_board_computer.cpp` to the `set(SOURCE_FILES)` in the `CMakeLists.txt` to compile it. - The `UserOnBoardComputer` class has the `UserComponents` class as a member, and users can access all components to get sensing information or set the output of actuators. @@ -63,3 +66,4 @@ ## 5. FlightSW method: Control algorithm within C2A - TBW +- Users can refer the [s2e-aobc](https://github.com/ut-issl/s2e-aobc) as an example of the flight software method. diff --git a/Tutorials/HowToIntegrateC2A.md b/Tutorials/HowToIntegrateC2A.md index 3d14af9b..4c2821ff 100644 --- a/Tutorials/HowToIntegrateC2A.md +++ b/Tutorials/HowToIntegrateC2A.md @@ -2,34 +2,34 @@ ## 1. Overview - [C2A](https://github.com/ut-issl/c2a-core) (Command Centric Architecture) is an architecture for spacecraft flight software developed by [ISSL](https://www.space.t.u-tokyo.ac.jp/nlab/index.html). -- S2E can execute [C2A](https://github.com/ut-issl/c2a-core) as a flight software for onboard algorithm development and debugging. +- S2E can execute [C2A](https://github.com/ut-issl/c2a-core) as flight software for onboard algorithm development and debugging. - This document describes how to integrate the C2A within S2E. - Notes - C2A is written in C language, but S2E builds C2A as C++. - The supported version of this document - - Please confirm that the version of the documents and s2e-core is compatible. + - Please confirm that the version of the documents and s2e-core are compatible. ## 2. Overview of C2A execution in S2E -- Directory construction +- Directory Construction - Make `FlightSW` directory at same directory with `s2e-core` and `s2e-user`. - Make a `c2a-user` directory in `FlightSW` and set the C2A source code you want to use. ``` - ├─ExtLibraries - ├─FlightSW - │ └─c2a-user - │ └─src_user - │ └─src_core - ├─s2e-core - └─s2e-user + ├─ FlightSW + │ └─ c2a-user + │ └─ src_user + │ └─ src_core + └─ s2e-user-example + ├─ s2e-core + └─ ExtLibraries ``` - Edit `s2e-user/CMakeLists.txt` as follows. - `set(C2A_NAME "c2a_oss")` - Edit the directory name `c2a_oss` according to your situation. - - In the case of above directory structure, you need to edit as `c2a-user` + - In the case of the above directory structure, you need to edit as `c2a-user` - `option(USE_C2A "Use C2A" OFF)` - Turn on the `USE_C2A` flag as `option(USE_C2A "Use C2A" ON)` - Notes - - In the default setting of S2E, C2A is built but isn't executed. To execute the C2A, users need to add a on board computer, which can execute the C2A. + - In the default setting of S2E, C2A is built but isn't executed. To execute the C2A, users need to add an onboard computer, which can execute the C2A. - The `s2e-core` has the [ObcWithC2a](https://github.com/ut-issl/s2e-core/blob/develop/src/components/real/cdh/on_board_computer_with_c2a.hpp) class as a component, and users can use it to execute the C2A. - Users can use the `ObcWithC2a` class in the `UserComponents` class, the same as other components. - Build the `s2e_user` @@ -38,12 +38,11 @@ ## 3. How to build C2A in S2E with the sample codes - Sample codes - - A sample of s2e-user: [s2e-user-for-c2a-core](https://github.com/ut-issl/s2e-user-for-c2a-core) + - A sample of s2e-user: [s2e-user-example/sample/how-to-integrate-c2a](https://github.com/ut-issl/s2e-user-example/tree/sample/how-to-integrate-c2a) - A sample of c2a-user: [C2A minimum user](https://github.com/ut-issl/c2a-core/tree/develop/Examples/minimum_user) in `c2a-core`. + - Preparing development environment - - Clone the `s2e-core v6.0.1`. - - Please set the environment for that the s2e-core can work without C2A. - - Clone `s2e-user-for-c2a-core v2.0.0` at same directory with `s2e-core`. + - Clone the `s2e-user-example` and switch the branch to `sample/how-to-integrate-c2a`. - Make `FlightSW` directory at same directory with `s2e-core`. - Clone `c2a-core v3.8.0` in the `FlightSW` directory. - Execute setup script @@ -53,7 +52,17 @@ - **For users who don't use Windows** - open `c2a-core/Examples/minimum_user/CMakeLists.txt` and edit `option(USE_SCI_COM_WINGS "Use SCI_COM_WINGS" ON)` to `option(USE_SCI_COM_WINGS "Use SCI_COM_WINGS" OFF)` - This setting turns off the feature to communicate with [WINGS](https://github.com/ut-issl/wings) ground station. Currently, this feature is available only for Windows users. - - Build and execute the `s2e-user-for-c2a-core`. + - Please check the following directory construction + ``` + ├─ FlightSW + │ └─ c2a-core + │ └─ Examples + │ └─ minimum_user + └─ s2e-user-example + ├─ s2e-core + └─ ExtLibraries + ``` + - Build and execute the `s2e-user-example`. - Users can see the following output in a terminal. The `CYCLE: TOTAL` value is incremented. ![](./figs/C2aBuild.JPG) @@ -83,20 +92,21 @@ # 5. Example of S2E-C2A communication -- This section shows an example of communication between a component in S2E and an application in C2A. The sample codes are in `Tutorials/SampleCodes/c2a_integration`. +- This section shows an example of communication between a component in S2E and an application in C2A. +- The sample codes + - S2E: [s2e-user-example/sample/how-to-integrate-c2a](https://github.com/ut-issl/s2e-user-example/tree/sample/how-to-integrate-c2a) + - C2A: [Tutorials/SampleCodes/c2a_integration/](./SampleCodes/c2a_integration/c2a_src_user/) - Preparation - See `Ch. 3 How to build C2A in S2E with the sample codes`. - Modification of the S2E side - Users can use the [ExampleSerialCommunicationWithObc](https://github.com/ut-issl/s2e-core/blob/v6.0.0/src/components/examples/example_serial_communication_with_obc.hpp) class in `s2e-core` as a test component to communicate with C2A. - - Please refer the sample codes in `Tutorials/SampleCodes/c2a_integration/s2e_src`. - - The directory structure of `s2e_src` is same with that of `s2e-user-for-c2a-core`. - - Add `ExampleSerialCommunicationWithObc` as a component in `c2a_core_sample_components.cpp and .hpp`. - - Or simply just copy the source codes in `c2a_integration/s2e_src` to `s2e-user-for-c2a-core`. + - Please refer the sample codes in [s2e-user-example/sample/how-to-integrate-c2a](https://github.com/ut-issl/s2e-user-example/tree/sample/how-to-integrate-c2a). + - Add `ExampleSerialCommunicationWithObc` as a component in `user_components.cpp and .hpp`. - In this example, the `ObcWithC2a` is executed as 1kHz, and the `ExampleSerialCommunicationWithObc` is executed as 1Hz. - Modification of the C2A side - Please refer the sample codes in `Tutorials/SampleCodes/c2a_integration/c2a_src_user`. - - The directory structure of `c2a_src_user` is same with that of `c2a-core/Examples/minimum_user/src/src_user`. - - We need to add a new driver instance application to communicate with the `EXP` component. + - The directory structure of `c2a_src_user` is the same with that of `c2a-core/Examples/minimum_user/src/src_user`. + - We need to add a new driver instance application to communicate with the `ExampleSerialCommunicationWithObc` component. - Copy `Application/DriverInstances/di_s2e_uart_test.c and .h` - Edit `CMakeLists.txt` in the Application directory to add `di_s2e_uart_test.c` as a compile target. - Edit `app_registry.c, h` and `app_headers.h` in the `Application` directory to register the applications of `di_s2e_uart_test`. diff --git a/Tutorials/HowToMakeNewComponents.md b/Tutorials/HowToMakeNewComponents.md index 251309aa..c0079743 100644 --- a/Tutorials/HowToMakeNewComponents.md +++ b/Tutorials/HowToMakeNewComponents.md @@ -19,7 +19,7 @@ - The main features of the components such as observation, generate force, noise addition, communication, etc... should be written in this function. - `PowerOffRoutine` is also important especially for actuators. This function is called when the component power line is turned off. Users can stop force and torque generation and initialize the component states. - Power related functions - - `SetPowerState`, `GetCurrent` are power related functions. If you want to emulate power consumption and switch control, you need to use the functions. + - `SetPowerState` and `GetCurrent` are power related functions. If you want to emulate power consumption and switch control, you need to use the functions. - `ILoggable` class - This base class has two important virtual functions `GetLogHeader` and `GetLogValue`, for CSV log output. - These functions are registered into the log output list when the components are added in `UserComponents::LogSetUp` @@ -28,29 +28,23 @@ - These base classes also support a feature to execute HILS function. -## 3. Make a simple clock sensor +## 3. Make a simple clock sensor without initialize file - This chapter explains how to make a simple clock sensor, which observes the simulation elapsed time with a bias noise. +- Users can find the sample codes in [s2e-user-example/sample/how-to-make-new-components](https://github.com/ut-issl/s2e-user-example/tree/sample/how-to-make-new-components). + - The sample codes already including the initialize file for the `ClockSensor`. Please edit the code a bit to learn the procedure step by step. -1. Copy the following files in the directory `./Tutorials/SampleCode/clock_sensor` to the directory `s2e-user/src/components`. - - `clock_sensor.cpp` - - `clock_sensor.hpp` +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. -1. Edit `./s2e-user/CMakeList.txt` to add target source files for the compiler. Please add the following description in `set(SOURCE_FILES)` +1. The `user_components.hpp` and `user_components.cpp` are edit similar procedure with the [How To Add Components](./HowToAddComponents.md) - ``` - src/components/clock_sensor.cpp - ``` - -1. Build `s2e-user` and check there is no error. - -1. Edit `user_components.hpp` and `user_components.cpp` as referring [How To Add Components](./HowToAddComponents.md) - - - The constructor of the `ClockSensor` requires arguments as `prescaler`, `clock_generator`, `simulation_time`, and `bias_sec`. - - `prescaler` and `bias_sec` are user setting parameters for the sensor, and you can freely set these values. + - 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 time information. `SimulationTime` class is managed in the `GlobalEnvironment`, and the `GlobalEnvironment` is instantiated in the `SimulationCase` class. - - You need to edit the `user_components.cpp` as follows. + - `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. + - We need to add the following codes to `user_components.cpp`. - Instantiate the `ClockSensor` in the constructor. ```c++ clock_sensor_ = new ClockSensor(10, clock_generator, global_environment->GetSimulationTime(), 0.001); @@ -66,29 +60,19 @@ 1. Build `s2e-user` and execute it -1. Check the log file to confirm the output of the `clock_sensor` - - The output of the clock sensor has an offset error, and the update frequency is decided by the `prescaler` and the `component_update_period_s` in the base ini file. +1. Check the log file to confirm the output of the `clock_sensor_observed_time[sec]` + - The output of the clock sensor has an offset error defined by the `bias_s` value, and the update frequency is decided by the `prescaler` and the `component_update_period_s` in the base ini file. ## 4. Make an initialize file for the clock sensor - Usually, we want to change the parameters of components such as noise properties, mounting coordinates, and others without rebuilding. So this section explains how to make an initialize file for the `ClockSensor`. -1. Copy the following files in the directory `./Tutorials/SampleCode/clock_sensor` to the directory `s2e-user/src/components`. - - `initialize_clock_sensor.cpp` - - `initialize_clock_sensor.hpp` - -1. Edit `./s2e-user/CMakeList.txt` to add target source files for the compiler. Please add the following description in `set(SOURCE_FILES)` - - ``` - src/components/initialize_clock_sensor.cpp - ``` - +1. The initialize function `InitClockSensor` is defined in the `clock_sensor.hpp`. + - The initialize function requires arguments as `clock_generator`, `simulation_time`, and `file_name`. + - `clock_generator` and `simulation_time` are same argument with the constructor of the `ClockGenerator`. + - `file_name` is the file path to the initialize file for the `ClockSensor`. + 1. Edit the `user_components.hpp` and `user_components.cpp` as follows - - `user_components.hpp` - - Replace include files from `clock_sensor.hpp` to as follows - ```c++ - #include "../../components/initialize_clock_sensor.hpp" - ``` - `user_components.cpp` - Edit making instance of the `clock_sensor` at the constructor ```c++ @@ -97,14 +81,18 @@ configuration_->main_logger_->CopyFileToLogDirectory(file_name); clock_sensor_ = new ClockSensor(InitClockSensor(clock_generator, global_environment->GetSimulationTime(), file_name)); ``` + - The first line get the file path of the initialize file of the clock sensor. + - 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. Copy `clock_sensor.ini` into `s2e-user/data/initialize_files/components` from `./Tutorial/SampleCodes/clock_sensor` +1. Make `clock_sensor.ini` into `s2e-user/data/initialize_files/components` from `./Tutorial/SampleCodes/clock_sensor` 1. Edit `user_satellite.ini` to add the following line at the [COMPONENT_FILES] section of the file ```c++ - clock_sensor_file = ../../data/initialize_files/components/clock_sensor.ini + clock_sensor_file = INI_FILE_DIR_FROM_EXE/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. 1. Build `s2e-user` and execute it diff --git a/Tutorials/HowToMakeNewSimulationScenario.md b/Tutorials/HowToMakeNewSimulationScenario.md index 5ebde17d..cc0cb0ee 100644 --- a/Tutorials/HowToMakeNewSimulationScenario.md +++ b/Tutorials/HowToMakeNewSimulationScenario.md @@ -8,76 +8,99 @@ - Source codes for the `main` - Source codes for `simulation scenario` - Source codes for `components` if the target spacecraft has components, which strongly depends on your project. - - Initialize files - - Compile setting files as [CMake files](https://cmake.org/), [Visual Studio Solution files](https://visualstudio.microsoft.com/downloads/), or others. + - `Initialize files` + - `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 - Please confirm that the version of the documents and `s2e-core` is compatible. -## 2. Setup S2E_CORE +## 2. Structure of S2E-USER directory + - We provides a sample of a s2e-user repository as [s2e-user-example](https://github.com/ut-issl/s2e-user-example). + - The repository is constructed as follows. + - The repository includes `s2e-core` by using `git submodule` feature. + - The `ExtLibraries` for the user side repository should be generated by using the `CMake` files in the `s2e-core`. -1. Clone [s2e-core](https://github.com/ut-issl/s2e-core) repository in a working directory. - -2. Download mandatory `ExtLibraries` (CSPICE and NRLMSISE-00). - - Please see a `How To Compile` document suit wity your platform. ``` - └─s2e-core - └─ExtLibraries - └─ cspice - └─ GeoPotential - └─ nrlmsise00 + └─ s2e-user-example + └─ src + └─ data + └─ s2e-core (git submodule) + └─ ExtLibraries (generated by the following procedure) + └─ other files ``` -## 3. Setup & Compile s2e-user +## 3. Setup s2e-user-example -1. Make a new directory `s2e-user`. It will be a root directory of s2e-user. - ``` - └─s2e-user - └─s2e-core - └─ExtLibraries - ``` -**NOTE** This directory structure is an example. Users can use `s2e-core` as `git submodule` as shown in [S2E-FF](https://github.com/ut-issl/s2e-ff). +1. Clone [s2e-user-example](https://github.com/ut-issl/s2e-user-example) repository in a working directory. + - Because the repository includes [s2e-core](https://github.com/ut-issl/s2e-core) with the `git submodule`, please use the following commands to construct the directory. + ``` + $ git clone git@github.com:ut-issl/s2e-user-example.git + $ cd s2e-user-example/ + $ git submodule init + $ git submodule update + ``` + Or use the following command to clone the repository. + ``` + $ git clone --recursive git@github.com:ut-issl/s2e-user-example.git + ``` -2. Copy directories and files in the `./Tutorials/SampleCodes/s2e-user`. +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. + ``` + └─ 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 + ``` -3. According to the `How to compile` document, open the `s2e-user/CMakeList.txt` and build the s2e-user. +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`. -5. Similar to [Getting Started](./GettingStarted.md), you can edit initialize files and check the log file . +5. Similar to [Getting Started](./GettingStarted.md), you can edit initialize files in `s2e-user-example/data/initialize_files` 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. -## 4. Overview of S2E_USER +## 4. Overview of S2E-USER-EXAMPLE -- This chapter explains the overview of `s2e-user` in the `SampleCodes` directory. +- This chapter explains the overview of the `main` branch of the `s2e-user-example`. - The files in the directory are as follows. From here, the detail of each file is described. ``` - └─s2e-user - └─CMakeLists.txt - └─CMakeSetting.json - └─data - └─initialize_files - └─logs - └─src - └─simulation - └─case - └─user_case.cpp - └─user_case.hpp - └─Spacecraft - └─user_components.cpp - └─user_components.hpp - └─user_satellite.cpp - └─user_satellite.hpp - └─s2e_user.cpp + └─ s2e-user-example + └─ CMakeLists.txt + └─ CMakeSetting.json + └─ data + └─ initialize_files + └─ logs + └─ src + └─ simulation + └─ case + └─ user_case.cpp + └─ user_case.hpp + └─ Spacecraft + └─ user_components.cpp + └─ user_components.hpp + └─ user_satellite.cpp + └─ user_satellite.hpp + └─ s2e_user.cpp + └─ s2e-core (git submodule) ``` + 1. `CMakeLists.txt` and `CMakeSetting.json` - `CMakeLists.txt` is a [CMake file](https://cmake.org/) for a compile setting. - Details of description rules for CMake files can be searched on the internet, so please refer to them. - - Of course, when you add new source files, you have to edit the CMake file to compile them. + - 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`. @@ -87,13 +110,17 @@ - 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. + 3. `src/s2e_user.cpp` - This is the main file of this program. - In this code, `user_simulation_base.ini` is defined as the base file for the simulation, and an instance of the `SimulationCase` class named `UserCase` is created and initialized. And finally, the main routine of the class is executed. + 4. `src/simulation/case/user_case.cpp, .hpp` - `UserCase` class is defined here. `UserCase` class inherits the `SimulationCase` base class in the `s2e-core`. The `SimulationCase` class has a `SimulationConfiguration` and `GlobalEnvironment` class. The `UserCase` class has an instance of the `spacecraft` class named as `UserSatellite`. + 5. `src/simulation/spacecraft/user_satellite.cpp, .hpp` - `UserSatellite` class is defined here. `UserSatellite` class inherits the `Spacecraft` class in the `s2e-core`. The `Spacecraft` base class has instances of `Dynamics`, `LocalEnvironment`, `Disturbance`, and `Structure`. And the `UserSatellite` class has an instance of `UserComponents`. + 6. `src/simulation/spacecraft/user_components.cpp, .hpp` - The `UserComponents` class is defined here. Most users edit this code to custom the S2E for their satellite projects. - Users select components they want to use from the `s2e-core/src/components`. diff --git a/Tutorials/HowToSimulateMultipleSatellites.md b/Tutorials/HowToSimulateMultipleSatellites.md index 06c206dd..f162bc55 100644 --- a/Tutorials/HowToSimulateMultipleSatellites.md +++ b/Tutorials/HowToSimulateMultipleSatellites.md @@ -3,22 +3,22 @@ ## 1. Overview - S2E can simulate multiple satellites. - This document describes how to simulate multiple satellites. -- For the sample codes, please see `./Tutorials/SampleCodes/multiple_satellites` +- For the sample codes, please see [s2e-user-example/sample/how-to-simulate-multiple-satellites](https://github.com/ut-issl/s2e-user-example/tree/sample/how-to-simulate-multiple-satellites). - The supported version of this document - - Please confirm that the version of the documents and s2e-core is compatible. + - Please confirm that the version of the documents and s2e-core are compatible. ## 2. How to add a new satellite 1. Edit `ini` files 1. Add `ini` files for the new satellite. - `satellite.ini`, `disturbance.ini`, `local_environment.ini`, `structure.ini` are needed. - 2. Register the ini file for the new satellite in `simulation_base.ini` + 2. Register the `ini` file for the new satellite in `simulation_base.ini` - The arguments of `satellite_file` are used as satellite ID in simulation. ``` [SIMULATION_SETTINGS] number_of_simulated_spacecraft = 2 - spacecraft_file(0) = ../../data/initialize_files/user_satellite1.ini - spacecraft_file(1) = ../../data/initialize_files/user_satellite2.ini + spacecraft_file(0) = INI_FILE_DIR_FROM_EXE/user_satellite.ini + spacecraft_file(1) = INI_FILE_DIR_FROM_EXE/user_satellite2.ini ``` 2. Edit source code @@ -29,16 +29,16 @@ ``` 2. Edit `user_case.cpp` to copy the spacecraft related codes as the sample code. - - Please see sample code for more details. + - Please see the sample code for more details. 3. Build and execute the `s2e-user` -4. You can see the log `spacecraft_angular_velocity_b_x[rad/s]` twice. The first one is angular velocity of `satellite0_`, and the second one is angular velocity of `satellite1_` in the log file. +4. You can see the log `spacecraft_angular_velocity_b_x[rad/s]` twice. The first one is the angular velocity of `satellite 0`, and the second one is the angular velocity of `satellite 1` in the log file. ## 3. Advanced usage -- In the sample, the `satellite0_` and the `satellite1_` are completely same, but users can change the setting of these satellites with editing the `ini` files. +- In the sample, the `satellite0_` and the `satellite1_` are completely the same, but users can change the settings of these satellites with editing the `ini` files. - Users can change the orbit, initial attitude, satellite structure and so on. -- Users also can set the different component for the `satellite` 0 and 1, when users define different `UserSatellite` and `UserComponents` class. +- Users also can set the different components for the `satellite` 0 and 1, when users define different `UserSatellite` and `UserComponents` classes. - The document to use `relative information` will be written. - Users can also refer the [S2E-FF](https://github.com/ut-issl/s2e-ff) repository. diff --git a/Tutorials/HowToUseMonteCarloSimulation.md b/Tutorials/HowToUseMonteCarloSimulation.md index adb85ca3..65e3d77d 100644 --- a/Tutorials/HowToUseMonteCarloSimulation.md +++ b/Tutorials/HowToUseMonteCarloSimulation.md @@ -6,19 +6,19 @@ - The feature provides a framework to randomize arbitrary parameters in each class. - Users can set the mean value and standard deviation for the randomized parameters with `simulation_base.ini` file of each user. - Please see the specification document for [Monte Carlo Simulation](../Specifications/Simulation/Spec_MonteCarloSimulation.md) for a detailed description. -- This tutorial explains how to randomly change the initial value of the angular velocity. - - There are sample codes in `SampleCodes\monte_carlo_simulation`. +- This tutorial explains how to randomly change the initial value of the spacecraft angular velocity. + - There are sample codes in [s2e-user-example/sample/how-to-use-monte-carlo-simulation](https://github.com/ut-issl/s2e-user-example/tree/sample/how-to-use-monte-carlo-simulation). - The supported version of this document - Please confirm that the version of the documents and s2e-core is compatible. ## 2. Edit Simulation Case -- To use the MCSim, users have to edit their `user_case.hpp` and `user_case.cpp` +- To use the Monte Carlo simulation, users have to edit their `user_case.hpp` and `user_case.cpp` - `user_case.hpp` - Add header including ```c++ #include <./simulation/monte_carlo_simulation/monte_carlo_simulation_executor.hpp> ``` - - Add private member variables for MCSimExecutor and string. + - Add private member variables for `MonteCarloSimulationExecutor`. ```c++ MonteCarloSimulationExecutor &monte_carlo_simulator_; ``` @@ -38,7 +38,7 @@ ``` - Edit `InitializeTargetObjects` function - Edit log file name definition and - - Add MCSim initialization + - Add `MonteCarloSimulationExecutor` initialization ```c++ // Monte Carlo Simulation monte_carlo_simulator_.SetSeed(); @@ -76,7 +76,7 @@ } ``` -## 3. Edit `S2E_USER` code +## 3. Edit `s2e_user.cpp` code - To use the Monte Carlo Simulator, users have to edit their `s2e_user.cpp` - Add header file ```c++ @@ -115,7 +115,7 @@ delete mc_simulator; ``` -## 4. Initialize file for MCSim +## 4. Initialize file for Monte Carlo simulator - Edit `user_simulation_base.ini` to add the following description ```c++ diff --git a/Tutorials/SampleCodes/c2a_integration/s2e_src/simulation/spacecraft/c2a_core_sample_components.cpp b/Tutorials/SampleCodes/c2a_integration/s2e_src/simulation/spacecraft/c2a_core_sample_components.cpp deleted file mode 100644 index ff3ed0b7..00000000 --- a/Tutorials/SampleCodes/c2a_integration/s2e_src/simulation/spacecraft/c2a_core_sample_components.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/** - * @file c2a_core_sample_components.cpp - * @brief User side components management installed on a spacecraft for C2A-CORE - */ - -#include "c2a_core_sample_components.hpp" - -#include - -#ifdef USE_C2A -#include "src_user/Settings/port_config.h" -#endif - -C2aCoreSampleComponents::C2aCoreSampleComponents(const Dynamics* dynamics, Structure* structure, const LocalEnvironment* local_environment, - const GlobalEnvironment* global_environment, const SimulationConfiguration* configuration, - ClockGenerator* clock_generator) - : dynamics_(dynamics), - structure_(structure), - local_environment_(local_environment), - global_environment_(global_environment), - configuration_(configuration) { -#ifdef USE_C2A - obc_ = new ObcWithC2a(clock_generator, 100); - exp_serial_communication_ = new ExampleSerialCommunicationWithObc(clock_generator, 1, 1, obc_); - - obc_->ConnectComPort(PORT_CH_RS422_MOBC_EXT, 1024, 1024); // UART通信用にとりあえず繋いでおく -#endif -} - -C2aCoreSampleComponents::~C2aCoreSampleComponents() { - delete exp_serial_communication_; - // OBC must be deleted the last since it has com ports - delete obc_; -} - -Vector<3> C2aCoreSampleComponents::GenerateForce_b_N() { - // There is no orbit control component, so it remains 0 - Vector<3> force_b_N(0.0); - return force_b_N; -} - -Vector<3> C2aCoreSampleComponents::GenerateTorque_b_Nm() { - // No attitude control component - Vector<3> torque_b_Nm(0.0); - return torque_b_Nm; -} - -void C2aCoreSampleComponents::LogSetup(Logger& logger) { UNUSED(logger); } diff --git a/Tutorials/SampleCodes/c2a_integration/s2e_src/simulation/spacecraft/c2a_core_sample_components.hpp b/Tutorials/SampleCodes/c2a_integration/s2e_src/simulation/spacecraft/c2a_core_sample_components.hpp deleted file mode 100644 index b4e6713d..00000000 --- a/Tutorials/SampleCodes/c2a_integration/s2e_src/simulation/spacecraft/c2a_core_sample_components.hpp +++ /dev/null @@ -1,68 +0,0 @@ -/** - * @file c2a_core_sample_components.hpp - * @brief User side components management installed on a spacecraft for C2A-CORE - */ - -#ifndef S2E_SIMULATION_SPACECRAFT_C2A_CORE_SAMPLE_COMPONENTS_HPP_ -#define S2E_SIMULATION_SPACECRAFT_C2A_CORE_SAMPLE_COMPONENTS_HPP_ - -#include -#include -#include -#include -#include - -// include for components -#include -#include - -/** - * @class C2aCoreSampleComponents - * @brief User side components management installed on a spacecraft for C2A-CORE - */ -class C2aCoreSampleComponents : public InstalledComponents { - public: - /** - * @fn C2aCoreSampleComponents - * @brief Constructor - */ - C2aCoreSampleComponents(const Dynamics* dynamics, Structure* structure, const LocalEnvironment* local_environment, - const GlobalEnvironment* global_environment, const SimulationConfiguration* configuration, ClockGenerator* clock_generator); - - /** - * @fn ~C2aCoreSampleComponents - * @brief Destructor - */ - ~C2aCoreSampleComponents(); - - // Override functions for InstalledComponents - /** - * @fn GenerateForce_b_N - * @brief Return force generated by components in unit Newton in body fixed frame - */ - libra::Vector<3> GenerateForce_b_N(); - /** - * @fn GenerateTorque_b_Nm - * @brief Return torque generated by components in unit Newton-meter in body fixed frame - */ - libra::Vector<3> GenerateTorque_b_Nm(); - /** - * @fn LogSetup - * @brief Setup the logger for components - */ - void LogSetup(Logger& logger); - - private: - // Components - ObcWithC2a* obc_; //!< Onboard Computer with C2A - ExampleSerialCommunicationWithObc* exp_serial_communication_; - - // References - const Dynamics* dynamics_; //!< Dynamics information of the spacecraft - const Structure* structure_; //!< Structure information of the spacecraft - const LocalEnvironment* local_environment_; //!< Local environment information around the spacecraft - const GlobalEnvironment* global_environment_; //!< Global environment information around the spacecraft - const SimulationConfiguration* configuration_; //!< Simulation settings -}; - -#endif // S2E_SIMULATION_SPACECRAFT_C2A_CORE_SAMPLE_COMPONENTS_HPP_ diff --git a/Tutorials/SampleCodes/clock_sensor/clock_sensor.cpp b/Tutorials/SampleCodes/clock_sensor/clock_sensor.cpp deleted file mode 100644 index 6f309224..00000000 --- a/Tutorials/SampleCodes/clock_sensor/clock_sensor.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @file clock_sensor.cpp - * @brief An example to emulate a sensor to measure simulation elapsed time - */ - -#include "clock_sensor.hpp" - -ClockSensor::ClockSensor(const int prescaler, ClockGenerator* clock_generator, const SimulationTime& simulation_time, const double bias_sec) - : Component(prescaler, clock_generator), simulation_time_(simulation_time), bias_sec_(bias_sec), time_output_sec_(0.0) {} - -void ClockSensor::MainRoutine(const int time_count) { - UNUSED(time_count); - time_output_sec_ = simulation_time_.GetElapsedTime_s() + bias_sec_; -} - -std::string ClockSensor::GetLogHeader() const { - std::string str_tmp = ""; - std::string section = "clock_sensor_"; - str_tmp += WriteScalar(section + "observed_time", "sec"); - - return str_tmp; -} - -std::string ClockSensor::GetLogValue() const { - std::string str_tmp = ""; - - str_tmp += WriteScalar(time_output_sec_); - - return str_tmp; -} diff --git a/Tutorials/SampleCodes/clock_sensor/clock_sensor.hpp b/Tutorials/SampleCodes/clock_sensor/clock_sensor.hpp deleted file mode 100644 index ed451a31..00000000 --- a/Tutorials/SampleCodes/clock_sensor/clock_sensor.hpp +++ /dev/null @@ -1,54 +0,0 @@ -/** - * @file clock_sensor.hpp - * @brief An example to emulate a sensor to measure simulation elapsed time - */ - -#ifndef S2E_COMPONENTS_CLOCK_SENSOR_HPP_ -#define S2E_COMPONENTS_CLOCK_SENSOR_HPP_ - -#include -#include -#include - -/** - * @class ClockSensor - * @brief An example to emulate a sensor to measure simulation elapsed time - */ -class ClockSensor : public Component, public ILoggable { - public: - /** - * @fn ClockSensor - * @brief Constructor - * @param [in] prescaler: Frequency scale factor for update - * @param [in] clock_generator: Clock generator - * @param [in] simulation_time: Simulation time information - * @param [in] bias_sec: Bias value for clock observation [sec] - */ - ClockSensor(const int prescaler, ClockGenerator* clock_generator, const SimulationTime& simulation_time, const double bias_sec); - - private: - // Override functions for Component - /** - * @fn MainRoutine - * @brief Main routine for sensor observation - */ - void MainRoutine(const int time_count) override; - - // Override ILoggable - /** - * @fn GetLogHeader - * @brief Override GetLogHeader function of ILoggable - */ - virtual std::string GetLogHeader() const; - /** - * @fn GetLogValue - * @brief Override GetLogValue function of ILoggable - */ - virtual std::string GetLogValue() const; - - const SimulationTime& simulation_time_; //!< Simulation time information - double bias_sec_; //!< Bias value for clock observation [sec] - double time_output_sec_; //!< Output of measured time information -}; - -#endif // S2E_COMPONENTS_CLOCK_SENSOR_HPP_ diff --git a/Tutorials/SampleCodes/clock_sensor/clock_sensor.ini b/Tutorials/SampleCodes/clock_sensor/clock_sensor.ini deleted file mode 100644 index 6bed9e7e..00000000 --- a/Tutorials/SampleCodes/clock_sensor/clock_sensor.ini +++ /dev/null @@ -1,3 +0,0 @@ -[ClockSensor] -prescaler = 10 // period = prescaler * CompoUpdateIntervalSec [sec] -bias_sec = 0.005 // [sec] diff --git a/Tutorials/SampleCodes/clock_sensor/edited_codes/user_components.cpp b/Tutorials/SampleCodes/clock_sensor/edited_codes/user_components.cpp deleted file mode 100644 index 4708cb2a..00000000 --- a/Tutorials/SampleCodes/clock_sensor/edited_codes/user_components.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/** - * @file user_components.cpp - * @brief An example of user side components management installed on a spacecraft - */ - -#include "user_components.hpp" - -#include - -UserComponents::UserComponents(const Dynamics *dynamics, Structure *structure, const LocalEnvironment *local_environment, - const GlobalEnvironment *global_environment, const SimulationConfiguration *configuration, - ClockGenerator *clock_generator, const unsigned int spacecraft_id) - : configuration_(configuration), - dynamics_(dynamics), - structure_(structure), - local_environment_(local_environment), - global_environment_(global_environment) { - IniAccess iniAccess = IniAccess(configuration_->spacecraft_file_list_[spacecraft_id]); - - obc_ = new OnBoardComputer(clock_generator); - - // Clock Sensor - std::string file_name = iniAccess.ReadString("COMPONENT_FILES", "clock_sensor_file"); - configuration_->main_logger_->CopyFileToLogDirectory(file_name); - clock_sensor_ = new ClockSensor(InitClockSensor(clock_generator, global_environment->GetSimulationTime(), file_name)); -} - -UserComponents::~UserComponents() { - delete clock_sensor_; - // OBC must be deleted the last since it has com ports - delete obc_; -} - -Vector<3> UserComponents::GenerateForce_b_N() { - // There is no orbit control component, so it remains 0 - Vector<3> force_b_N(0.0); - return force_b_N; -} - -Vector<3> UserComponents::GenerateTorque_b_Nm() { - // No attitude control component - Vector<3> torque_b_Nm(0.0); - return torque_b_Nm; -} - -void UserComponents::LogSetup(Logger &logger) { - // Users can set log output when they need component log - logger.AddLogList(clock_sensor_); -} diff --git a/Tutorials/SampleCodes/clock_sensor/edited_codes/user_components.hpp b/Tutorials/SampleCodes/clock_sensor/edited_codes/user_components.hpp deleted file mode 100644 index 75209381..00000000 --- a/Tutorials/SampleCodes/clock_sensor/edited_codes/user_components.hpp +++ /dev/null @@ -1,43 +0,0 @@ -/** - * @file sample_components.hpp - * @brief An example of user side components management installed on a spacecraft - */ - -#ifndef S2E_SIMULATION_SPACECRAFT_USER_COMPONENTS_HPP_ -#define S2E_SIMULATION_SPACECRAFT_USER_COMPONENTS_HPP_ - -#include -#include -#include -#include -#include - -// include for components -#include - -#include "../../components/initialize_clock_sensor.hpp" - -class UserComponents : public InstalledComponents { - public: - UserComponents(const Dynamics *dynamics, Structure *structure, const LocalEnvironment *local_environment, - const GlobalEnvironment *global_environment, const SimulationConfiguration *configuration, ClockGenerator *clock_generator, - const unsigned int spacecraft_id); - ~UserComponents(); - libra::Vector<3> GenerateForce_b_N(); - libra::Vector<3> GenerateTorque_b_Nm(); - void LogSetup(Logger &logger); - - private: - // Components - OnBoardComputer *obc_; //!< Onboard Computer - ClockSensor *clock_sensor_; - - // States - const SimulationConfiguration *configuration_; //!< Simulation settings - const Dynamics *dynamics_; //!< Dynamics information of the spacecraft - Structure *structure_; //!< Structure information of the spacecraft - const LocalEnvironment *local_environment_; //!< Local environment information around the spacecraft - const GlobalEnvironment *global_environment_; //!< Global environment information -}; - -#endif // S2E_SIMULATION_SPACECRAFT_USER_COMPONENTS_HPP_ diff --git a/Tutorials/SampleCodes/clock_sensor/edited_codes/user_satellite.ini b/Tutorials/SampleCodes/clock_sensor/edited_codes/user_satellite.ini deleted file mode 100644 index 0ded4b56..00000000 --- a/Tutorials/SampleCodes/clock_sensor/edited_codes/user_satellite.ini +++ /dev/null @@ -1,139 +0,0 @@ -[ATTITUDE] -// Attitude propagation mode -// RK4 : Attitude Propagation with RK4 including disturbances and control torque -// CONTROLLED : Attitude Calculation with Controlled Attitude mode. All disturbances and control torque are ignored. -propagate_mode = RK4 - -// 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 = MANUAL - -// Initial angular velocity at body frame [rad/s] -initial_angular_velocity_b_rad_s(0) = 0.0 -initial_angular_velocity_b_rad_s(1) = 0.0 -initial_angular_velocity_b_rad_s(2) = 0.0 - -// Initial quaternion inertial frame to body frame (real part, imaginary part) -// This value also used in INERTIAL_STABILIZE mode of ControlledAttitude -initial_quaternion_i2b(0) = 0.0 -initial_quaternion_i2b(1) = 0.0 -initial_quaternion_i2b(2) = 0.0 -initial_quaternion_i2b(3) = 1.0 - -// Initial torque at body frame [Nm] -// Note: The initial torque added just for the first propagation step -initial_torque_b_Nm(0) = +0.000 -initial_torque_b_Nm(1) = -0.000 -initial_torque_b_Nm(2) = 0.000 - -[CONTROLLED_ATTITUDE] -// Mode definitions -// INERTIAL_STABILIZE -// SUN_POINTING -// EARTH_CENTER_POINTING -// VELOCITY_DIRECTION_POINTING -// ORBIT_NORMAL_POINTING -main_mode = INERTIAL_STABILIZE -sub_mode = SUN_POINTING - -// Pointing direction @ body frame for main pointing mode -main_pointing_direction_b(0) = 1.0 -main_pointing_direction_b(1) = 0.0 -main_pointing_direction_b(2) = 0.0 - -// Pointing direction @ body frame for sub pointing mode -// main_pointing_direction_b and sub_pointing_direction_b should separate larger than 30 degrees. -sub_pointing_direction_b(0) = 0.0 -sub_pointing_direction_b(1) = 0.0 -sub_pointing_direction_b(2) = 1.0 - - -[ORBIT] -calculation = ENABLE -logging = ENABLE - -// Orbit propagation mode -// RK4 : RK4 propagation with disturbances and thruster maneuver -// SGP4 : SGP4 propagation using TLE without thruster maneuver -// RELATIVE : Relative dynamics (for formation flying simulation) -// KEPLER : Kepler orbit propagation without disturbances and thruster maneuver -// ENCKE : Encke orbit propagation with disturbances and thruster maneuver -propagate_mode = RK4 - -// Orbit initialize mode for RK4, KEPLER, and ENCKE -// DEFAULT : Use default initialize method (RK4 and ENCKE use pos/vel, KEPLER uses init_mode_kepler) -// POSITION_VELOCITY_I : Initialize with position and velocity in the inertial frame -// ORBITAL_ELEMENTS : Initialize with orbital elements -initialize_mode = POSITION_VELOCITY_I - -// Initial value definition for POSITION_VELOCITY_I initialize mode //////// -initial_position_i_m(0) = -2111769.7723711144 -initial_position_i_m(1) = -5360353.2254375768 -initial_position_i_m(2) = 3596181.6497774957 - -initial_velocity_i_m_s(0) = 4200.4344740455268 -initial_velocity_i_m_s(1) = -4637.540129059361 -initial_velocity_i_m_s(2) = -4429.2361258448807 -/////////////////////////////////////////////////////////////////////////// - -// Initial value definition for ORBITAL_ELEMENTS initialize mode //////// -semi_major_axis_m = 6794500.0 -eccentricity = 0.0015 -inclination_rad = 0.9012 -raan_rad = 0.1411 -argument_of_perigee_rad = 1.7952 -epoch_jday = 2.458940966402607e6 -/////////////////////////////////////////////////////////////////////////////// - - -// Settings for SGP4 /////////////////////////////////////////////// -// TLE -// Example: ISS -tle1=1 25544U 98067A 20076.51604214 .00016717 00000-0 10270-3 0 9005 -tle2=2 25544 51.6412 86.9962 0006063 30.9353 329.2153 15.49228202 17647 -// World Geodetic System -wgs = 2 // 0: wgs72old, 1: wgs72, 2: wgs84 -////////////////////////////////////////////////////////////////////////// - -// Settings for relative orbit propagation //////////////////////////// -// Relative Orbit Update Method (0 means RK4, 1 means STM) -relative_orbit_update_method = 0 -// RK4 Relative Dynamics model type (only valid for RK4 update) -// 0: Hill -relative_dynamics_model_type = 0 -// STM Relative Dynamics model type (only valid for STM update) -// 0: HCW -stm_model_type = 0 -// Initial satellite position relative to the reference satellite in LVLH frame[m] -// * The coordinate system is defined at [PLANET_SELECTION] in SampleSimBase.ini -initial_relative_position_lvlh_m(0) = 0.0 -initial_relative_position_lvlh_m(1) = 100.0 -initial_relative_position_lvlh_m(2) = 0.0 -// initial satellite velocity relative to the reference satellite in LVLH frame[m/s] -initial_relative_velocity_lvlh_m_s(0) = 0.0 -initial_relative_velocity_lvlh_m_s(1) = 0.0 -initial_relative_velocity_lvlh_m_s(2) = 0.0 -// information of reference satellite -reference_satellite_id = 1 -/////////////////////////////////////////////////////////////////////////////// - -// Settings for Encke mode /////////// -error_tolerance = 0.0001 -/////////////////////////////////////////////////////////////////////////////// - - -[THERMAL] -calculation = DISABLE -debug = 0 -thermal_file_directory = ../../data/initialize_files/thermal_csv_files/ - -[SETTING_FILES] -local_environment_file = ../../data/initialize_files/user_satellite_local_environment.ini -disturbance_file = ../../data/initialize_files/user_satellite_disturbance.ini -structure_file = ../../data/initialize_files/user_satellite_structure.ini - - -[COMPONENT_FILES] -// Users can add the path for component initialize files here. -clock_sensor_file = ../../data/initialize_files/components/clock_sensor.ini diff --git a/Tutorials/SampleCodes/clock_sensor/initialize_clock_sensor.cpp b/Tutorials/SampleCodes/clock_sensor/initialize_clock_sensor.cpp deleted file mode 100644 index 4983f487..00000000 --- a/Tutorials/SampleCodes/clock_sensor/initialize_clock_sensor.cpp +++ /dev/null @@ -1,19 +0,0 @@ - -/** - * @file initialize_clock_sensor.cpp - * @brief Initialize function for ClockSensor class - */ - -#include "initialize_clock_sensor.hpp" - -#include - -ClockSensor InitClockSensor(ClockGenerator* clock_generator, const SimulationTime& simulation_time, const std::string file_name) { - IniAccess ini_file(file_name); - - const double bias_sec = ini_file.ReadDouble("ClockSensor", "bias_sec"); - const int prescaler = ini_file.ReadInt("ClockSensor", "prescaler"); - ClockSensor clock_sensor(prescaler, clock_generator, simulation_time, bias_sec); - - return clock_sensor; -} diff --git a/Tutorials/SampleCodes/clock_sensor/initialize_clock_sensor.hpp b/Tutorials/SampleCodes/clock_sensor/initialize_clock_sensor.hpp deleted file mode 100644 index 5c50dc8a..00000000 --- a/Tutorials/SampleCodes/clock_sensor/initialize_clock_sensor.hpp +++ /dev/null @@ -1,20 +0,0 @@ -/** - * @file initialize_clock_sensor.hpp - * @brief Initialize function for ClockSensor class - */ - -#ifndef S2E_COMPONENTS_INITIALIZE_CLOCK_SENSOR_HPP_ -#define S2E_COMPONENTS_INITIALIZE_CLOCK_SENSOR_HPP_ - -#include "clock_sensor.hpp" - -/** - * @fn InitGyroSensor - * @brief Initialize functions for gyro sensor without power port - * @param [in] clock_generator: Clock generator - * @param [in] simulation_time: Simulation time information - * @param [in] file_name: Path to the initialize file - */ -ClockSensor InitClockSensor(ClockGenerator *clock_generator, const SimulationTime &simulation_time, const std::string file_name); - -#endif // S2E_COMPONENTS_INITIALIZE_CLOCK_SENSOR_HPP_ diff --git a/Tutorials/SampleCodes/control_algorithm/component_method_real/data/gyro_sensor_xxx.ini b/Tutorials/SampleCodes/control_algorithm/component_method_real/data/gyro_sensor_xxx.ini deleted file mode 100644 index d5755a62..00000000 --- a/Tutorials/SampleCodes/control_algorithm/component_method_real/data/gyro_sensor_xxx.ini +++ /dev/null @@ -1,50 +0,0 @@ -[GYRO_SENSOR_1] -prescaler = 1 - -// Quaternion from body frame to component frame -// Including misalignment -quaternion_b2c(0) = 0.0 -quaternion_b2c(1) = 0.0 -quaternion_b2c(2) = 0.0 -quaternion_b2c(3) = 1.0 - -[SENSOR_BASE_GYRO_SENSOR_1] -// Scale Factor Matrix (3×3) -// (0) = (0,0), (1) = (0,1), (2) = (0,2), -scale_factor_c(0) = 1.0 -scale_factor_c(1) = 0.0 -scale_factor_c(2) = 0.0 -scale_factor_c(3) = 0.0 -scale_factor_c(4) = 1.0 -scale_factor_c(5) = 0.0 -scale_factor_c(6) = 0.0 -scale_factor_c(7) = 0.0 -scale_factor_c(8) = 1.0 - -// Constant bias noise at component frame [rad/s] -constant_bias_c_rad_s(0) = 1.0e-3 -constant_bias_c_rad_s(1) = -1.0e-3 -constant_bias_c_rad_s(2) = 2.0e-3 - -// Standard deviation for random walk noise[rad/s] -random_walk_standard_deviation_c_rad_s(0) = 0.0 -random_walk_standard_deviation_c_rad_s(1) = 0.0 -random_walk_standard_deviation_c_rad_s(2) = 0.0 - -// Limit of random walk noise[rad/s] -random_walk_limit_c_rad_s(0) = 0.0 -random_walk_limit_c_rad_s(1) = 0.0 -random_walk_limit_c_rad_s(2) = 0.0 - -// Standard deviation of normal random noise[rad/s] -normal_random_standard_deviation_c_rad_s(0) = 0.0e-3 -normal_random_standard_deviation_c_rad_s(1) = 0.0e-3 -normal_random_standard_deviation_c_rad_s(2) = 0.0e-3 - -// Range [rad/s] -range_to_constant_rad_s = 5.0 // smaller than Range_to_zero -range_to_zero_rad_s = 10.0 - -[POWER_PORT] -minimum_voltage_V = 3.3 // V -assumed_power_consumption_W = 1.0 //W diff --git a/Tutorials/SampleCodes/control_algorithm/component_method_real/data/reaction_wheel_xxx.ini b/Tutorials/SampleCodes/control_algorithm/component_method_real/data/reaction_wheel_xxx.ini deleted file mode 100644 index beba51e4..00000000 --- a/Tutorials/SampleCodes/control_algorithm/component_method_real/data/reaction_wheel_xxx.ini +++ /dev/null @@ -1,65 +0,0 @@ -[REACTION_WHEEL_1] -// prescaler defines update period of thie component -// update period = prescaler * step sec -prescaler = 1 -// prescaler for calculation of RW jitter -// To calculate the jitter, set the update cycle to about 0.1 ms. -fast_prescaler = 1 - -// Moment of inertia of the rotor [kgm^2] -moment_of_inertia_kgm2 = 5.0e-6 -// Maximum torque [Nm] -max_output_torque_Nm = 0.001 -// Maximum angular velocity [rpm] -// The RW can drive (-max_angular_velocity, +max_angular_velocity) -max_angular_velocity_rpm = 6000.0 - -// How to determine the direction of RW (DIRECTION or QUATERNION) -// If you want to consider the phase of RW strictly (e.g. RW jitter), specify QUATERNION. -// If you do not need to consider the phase of the RW rotation, specify DIRECTION. -direction_determination_mode = DIRECTION -// Quaternion from body frame to component frame -// Definition of component frame : wheel rotation axis = (0 0 1)^T. plus means direction of rotation (output torque is minus direction) -quaternion_b2c(0) = 0 -quaternion_b2c(1) = 0.70710678118 -quaternion_b2c(2) = 0 -quaternion_b2c(3) = 0.70710678118 -// Direction of axis of the RW at the body fixied frame -// plus means direction of rotation (output torque is minus direction) -direction_b(0) = 1.0 -direction_b(1) = 0.0 -direction_b(2) = 0.0 - -// Position of RW at body frame [m] -position_b_m(0) = 1.0 -position_b_m(1) = 0.0 -position_b_m(2) = 0.0 -// The control deray[s] -dead_time_s = 1.0 -// Coefficient of first order lag for driving case -first_order_lag_coefficient(0) = 2.0 -first_order_lag_coefficient(1) = 0.0 -first_order_lag_coefficient(2) = 0.0 -// Coefficient of first order lag for coasting case -coasting_lag_coefficient(0) = 2.0 -coasting_lag_coefficient(1) = 0.0 -coasting_lag_coefficient(2) = 0.0 -// For drive initialize -// They should be zero for normal case -initial_motor_drive_flag = 0 -initial_angular_velocity_rad_s = 0.0 - -//Parameters for calculate RW jitter -jitter_calculation = DISABLE -jitter_logging = DISABLE -radial_force_harmonics_coefficient_file = ../../data/sample/initialize_files/components/rw_disturbance_csv_files/radial_force_harmonics_coefficients.csv -radial_torque_harmonics_coefficient_file = ../../data/sample/initialize_files/components/rw_disturbance_csv_files/radial_torque_harmonics_coefficients.csv -harmonics_degree = 12 -considers_structural_resonance = DISABLE -structural_resonance_frequency_Hz = 585.0 //[Hz] -damping_factor = 0.1 //[ ] -bandwidth = 0.001 //[ ] - -[POWER_PORT] -minimum_voltage_V = 3.3 // V -assumed_power_consumption_W = 1.0 //W diff --git a/Tutorials/SampleCodes/control_algorithm/component_method_real/data/user_satellite.ini b/Tutorials/SampleCodes/control_algorithm/component_method_real/data/user_satellite.ini deleted file mode 100644 index 360a626b..00000000 --- a/Tutorials/SampleCodes/control_algorithm/component_method_real/data/user_satellite.ini +++ /dev/null @@ -1,140 +0,0 @@ -[ATTITUDE] -// Attitude propagation mode -// RK4 : Attitude Propagation with RK4 including disturbances and control torque -// CONTROLLED : Attitude Calculation with Controlled Attitude mode. All disturbances and control torque are ignored. -propagate_mode = RK4 - -// 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 = MANUAL - -// Initial angular velocity at body frame [rad/s] -initial_angular_velocity_b_rad_s(0) = 0.02 -initial_angular_velocity_b_rad_s(1) = 0.0 -initial_angular_velocity_b_rad_s(2) = 0.0 - -// Initial quaternion inertial frame to body frame (real part, imaginary part) -// This value also used in INERTIAL_STABILIZE mode of ControlledAttitude -initial_quaternion_i2b(0) = 0.0 -initial_quaternion_i2b(1) = 0.0 -initial_quaternion_i2b(2) = 0.0 -initial_quaternion_i2b(3) = 1.0 - -// Initial torque at body frame [Nm] -// Note: The initial torque added just for the first propagation step -initial_torque_b_Nm(0) = +0.000 -initial_torque_b_Nm(1) = -0.000 -initial_torque_b_Nm(2) = 0.000 - -[CONTROLLED_ATTITUDE] -// Mode definitions -// INERTIAL_STABILIZE -// SUN_POINTING -// EARTH_CENTER_POINTING -// VELOCITY_DIRECTION_POINTING -// ORBIT_NORMAL_POINTING -main_mode = INERTIAL_STABILIZE -sub_mode = SUN_POINTING - -// Pointing direction @ body frame for main pointing mode -main_pointing_direction_b(0) = 1.0 -main_pointing_direction_b(1) = 0.0 -main_pointing_direction_b(2) = 0.0 - -// Pointing direction @ body frame for sub pointing mode -// main_pointing_direction_b and sub_pointing_direction_b should separate larger than 30 degrees. -sub_pointing_direction_b(0) = 0.0 -sub_pointing_direction_b(1) = 0.0 -sub_pointing_direction_b(2) = 1.0 - - -[ORBIT] -calculation = ENABLE -logging = ENABLE - -// Orbit propagation mode -// RK4 : RK4 propagation with disturbances and thruster maneuver -// SGP4 : SGP4 propagation using TLE without thruster maneuver -// RELATIVE : Relative dynamics (for formation flying simulation) -// KEPLER : Kepler orbit propagation without disturbances and thruster maneuver -// ENCKE : Encke orbit propagation with disturbances and thruster maneuver -propagate_mode = RK4 - -// Orbit initialize mode for RK4, KEPLER, and ENCKE -// DEFAULT : Use default initialize method (RK4 and ENCKE use pos/vel, KEPLER uses init_mode_kepler) -// POSITION_VELOCITY_I : Initialize with position and velocity in the inertial frame -// ORBITAL_ELEMENTS : Initialize with orbital elements -initialize_mode = POSITION_VELOCITY_I - -// Initial value definition for POSITION_VELOCITY_I initialize mode //////// -initial_position_i_m(0) = -2111769.7723711144 -initial_position_i_m(1) = -5360353.2254375768 -initial_position_i_m(2) = 3596181.6497774957 - -initial_velocity_i_m_s(0) = 4200.4344740455268 -initial_velocity_i_m_s(1) = -4637.540129059361 -initial_velocity_i_m_s(2) = -4429.2361258448807 -/////////////////////////////////////////////////////////////////////////// - -// Initial value definition for ORBITAL_ELEMENTS initialize mode //////// -semi_major_axis_m = 6794500.0 -eccentricity = 0.0015 -inclination_rad = 0.9012 -raan_rad = 0.1411 -argument_of_perigee_rad = 1.7952 -epoch_jday = 2.458940966402607e6 -/////////////////////////////////////////////////////////////////////////////// - - -// Settings for SGP4 /////////////////////////////////////////////// -// TLE -// Example: ISS -tle1=1 25544U 98067A 20076.51604214 .00016717 00000-0 10270-3 0 9005 -tle2=2 25544 51.6412 86.9962 0006063 30.9353 329.2153 15.49228202 17647 -// World Geodetic System -wgs = 2 // 0: wgs72old, 1: wgs72, 2: wgs84 -////////////////////////////////////////////////////////////////////////// - -// Settings for relative orbit propagation //////////////////////////// -// Relative Orbit Update Method (0 means RK4, 1 means STM) -relative_orbit_update_method = 0 -// RK4 Relative Dynamics model type (only valid for RK4 update) -// 0: Hill -relative_dynamics_model_type = 0 -// STM Relative Dynamics model type (only valid for STM update) -// 0: HCW -stm_model_type = 0 -// Initial satellite position relative to the reference satellite in LVLH frame[m] -// * The coordinate system is defined at [PLANET_SELECTION] in SampleSimBase.ini -initial_relative_position_lvlh_m(0) = 0.0 -initial_relative_position_lvlh_m(1) = 100.0 -initial_relative_position_lvlh_m(2) = 0.0 -// initial satellite velocity relative to the reference satellite in LVLH frame[m/s] -initial_relative_velocity_lvlh_m_s(0) = 0.0 -initial_relative_velocity_lvlh_m_s(1) = 0.0 -initial_relative_velocity_lvlh_m_s(2) = 0.0 -// information of reference satellite -reference_satellite_id = 1 -/////////////////////////////////////////////////////////////////////////////// - -// Settings for Encke mode /////////// -error_tolerance = 0.0001 -/////////////////////////////////////////////////////////////////////////////// - - -[THERMAL] -calculation = DISABLE -debug = 0 -thermal_file_directory = ../../data/initialize_files/thermal_csv_files/ - -[SETTING_FILES] -local_environment_file = ../../data/initialize_files/user_satellite_local_environment.ini -disturbance_file = ../../data/initialize_files/user_satellite_disturbance.ini -structure_file = ../../data/initialize_files/user_satellite_structure.ini - - -[COMPONENT_FILES] -// Users can add the path for component initialize files here. -gyro_file = ../../data/initialize_files/components/gyro_sensor_xxx.ini -reaction_wheel_file = ../../data/initialize_files/components/reaction_wheel_xxx.ini diff --git a/Tutorials/SampleCodes/control_algorithm/component_method_real/src/components/user_on_board_computer.cpp b/Tutorials/SampleCodes/control_algorithm/component_method_real/src/components/user_on_board_computer.cpp deleted file mode 100644 index fb583539..00000000 --- a/Tutorials/SampleCodes/control_algorithm/component_method_real/src/components/user_on_board_computer.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/** - * @file user_on_board_computer.hpp - * @brief User defined on board computer - */ - -#include "user_on_board_computer.hpp" - -UserOnBoardComputer::UserOnBoardComputer(ClockGenerator* clock_generator, UserComponents& components) - : Component(1, clock_generator), components_(components) {} - -UserOnBoardComputer::~UserOnBoardComputer() {} - -void UserOnBoardComputer::MainRoutine(const int time_count) { - UNUSED(time_count); - // Sensor inputs - const libra::Vector<3> gyro_omega_c = components_.GetGyroSensor().GetMeasuredAngularVelocity_c_rad_s(); - // const double rw_rpm = components_.GetReactionWheel().GetAngularVelocity_rpm(); // An example of RW rotation speed observation - - // Control Algorithm - const double Kp = 5e-3; - double torque = -1.0 * Kp * gyro_omega_c(0); - - // Actuator outputs - components_.GetReactionWheel().SetDriveFlag(true); - components_.GetReactionWheel().SetVelocityLimit_rpm(8000.0); - components_.GetReactionWheel().SetTargetTorque_b_Nm(torque); -} diff --git a/Tutorials/SampleCodes/control_algorithm/component_method_real/src/components/user_on_board_computer.hpp b/Tutorials/SampleCodes/control_algorithm/component_method_real/src/components/user_on_board_computer.hpp deleted file mode 100644 index 71e53776..00000000 --- a/Tutorials/SampleCodes/control_algorithm/component_method_real/src/components/user_on_board_computer.hpp +++ /dev/null @@ -1,46 +0,0 @@ -/** - * @file user_on_board_computer.hpp - * @brief User defined on board computer - */ - -#ifndef S2E_COMPONENTS_USER_ON_BOARD_COMPUTER_HPP_ -#define S2E_COMPONENTS_USER_ON_BOARD_COMPUTER_HPP_ - -#include -#include - -#include "../simulation/spacecraft/user_components.hpp" - -class UserComponents; - -/* - * @class UserOnBoardComputer - * @brief Class to emulate user defined on board computer - */ -class UserOnBoardComputer : public Component { - public: - /** - * @fn UserOnBoardComputer - * @brief Constructor - * @param [in] clock_generator: Clock generator - * @param [in] components: Component list - */ - UserOnBoardComputer(ClockGenerator* clock_generator, UserComponents& components); - - /** - * @fn ~UserOnBoardComputer - * @brief Destructor - */ - ~UserOnBoardComputer(); - - protected: - UserComponents& components_; //!< Component list - - /** - * @fn MainRoutine - * @brief Override Component::Main function - */ - void MainRoutine(const int time_count); -}; - -#endif // S2E_COMPONENTS_USER_ON_BOARD_COMPUTER_HPP_ diff --git a/Tutorials/SampleCodes/control_algorithm/component_method_real/src/simulation/user_components.cpp b/Tutorials/SampleCodes/control_algorithm/component_method_real/src/simulation/user_components.cpp deleted file mode 100644 index 793d84ad..00000000 --- a/Tutorials/SampleCodes/control_algorithm/component_method_real/src/simulation/user_components.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/** - * @file user_components.cpp - * @brief An example of user side components management installed on a spacecraft - */ - -#include "user_components.hpp" - -#include - -UserComponents::UserComponents(const Dynamics *dynamics, Structure *structure, const LocalEnvironment *local_environment, - const GlobalEnvironment *global_environment, const SimulationConfiguration *configuration, - ClockGenerator *clock_generator, const unsigned int spacecraft_id) - : configuration_(configuration), - dynamics_(dynamics), - structure_(structure), - local_environment_(local_environment), - global_environment_(global_environment) { - // Common - IniAccess iniAccess = IniAccess(configuration_->spacecraft_file_list_[spacecraft_id]); - const double compo_step_sec = global_environment_->GetSimulationTime().GetComponentStepTime_s(); - - obc_ = new UserOnBoardComputer(clock_generator, *this); - - // Initialize of GyroSensor 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)); - - // Initialize of ReactionWheel class - file_name = iniAccess.ReadString("COMPONENT_FILES", "reaction_wheel_file"); - configuration_->main_logger_->CopyFileToLogDirectory(file_name); - reaction_wheel_ = new ReactionWheel(InitReactionWheel(clock_generator, 1, file_name, dynamics->GetAttitude().GetPropStep_s(), compo_step_sec)); -} - -UserComponents::~UserComponents() { - delete gyro_sensor_; - delete reaction_wheel_; - // OBC must be deleted the last since it has com ports - delete obc_; -} - -Vector<3> UserComponents::GenerateForce_b_N() { - // There is no orbit control component, so it remains 0 - Vector<3> force_b_N(0.0); - return force_b_N; -} - -Vector<3> UserComponents::GenerateTorque_b_Nm() { - // No attitude control component - Vector<3> torque_b_Nm(0.0); - torque_b_Nm = reaction_wheel_->GetOutputTorque_b_Nm(); - return torque_b_Nm; -} - -void UserComponents::LogSetup(Logger &logger) { - logger.AddLogList(gyro_sensor_); - logger.AddLogList(reaction_wheel_); -} diff --git a/Tutorials/SampleCodes/control_algorithm/component_method_real/src/simulation/user_components.hpp b/Tutorials/SampleCodes/control_algorithm/component_method_real/src/simulation/user_components.hpp deleted file mode 100644 index b3498836..00000000 --- a/Tutorials/SampleCodes/control_algorithm/component_method_real/src/simulation/user_components.hpp +++ /dev/null @@ -1,51 +0,0 @@ -/** - * @file sample_components.hpp - * @brief An example of user side components management installed on a spacecraft - */ - -#ifndef S2E_SIMULATION_SPACECRAFT_USER_COMPONENTS_HPP_ -#define S2E_SIMULATION_SPACECRAFT_USER_COMPONENTS_HPP_ - -#include -#include -#include -#include -#include - -// include for components -#include -#include - -#include "../../components/user_on_board_computer.hpp" - -class UserOnBoardComputer; - -class UserComponents : public InstalledComponents { - public: - UserComponents(const Dynamics *dynamics, Structure *structure, const LocalEnvironment *local_environment, - const GlobalEnvironment *global_environment, const SimulationConfiguration *configuration, ClockGenerator *clock_generator, - const unsigned int spacecraft_id); - ~UserComponents(); - libra::Vector<3> GenerateForce_b_N(); - libra::Vector<3> GenerateTorque_b_Nm(); - void LogSetup(Logger &logger); - - // Getter - inline GyroSensor &GetGyroSensor() { return *gyro_sensor_; } - inline ReactionWheel &GetReactionWheel() { return *reaction_wheel_; } - - private: - // Components - UserOnBoardComputer *obc_; //!< Onboard Computer - GyroSensor *gyro_sensor_; //!< Gyro sensor - ReactionWheel *reaction_wheel_; //!< Reaction wheel - - // States - const SimulationConfiguration *configuration_; //!< Simulation settings - const Dynamics *dynamics_; //!< Dynamics information of the spacecraft - Structure *structure_; //!< Structure information of the spacecraft - const LocalEnvironment *local_environment_; //!< Local environment information around the spacecraft - const GlobalEnvironment *global_environment_; //!< Global environment information -}; - -#endif // S2E_SIMULATION_SPACECRAFT_USER_COMPONENTS_HPP_ \ No newline at end of file diff --git a/Tutorials/SampleCodes/control_algorithm/direct_method/user_satellite.cpp b/Tutorials/SampleCodes/control_algorithm/direct_method/user_satellite.cpp deleted file mode 100644 index c39949a1..00000000 --- a/Tutorials/SampleCodes/control_algorithm/direct_method/user_satellite.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/** - * @file user_satellite.cpp - * @brief An example of user side spacecraft class - */ - -#include "user_satellite.hpp" - -#include "user_components.hpp" - -UserSatellite::UserSatellite(const SimulationConfiguration *simulation_configuration, const GlobalEnvironment *global_environment, - const unsigned int spacecraft_id) - : Spacecraft(simulation_configuration, global_environment, spacecraft_id) { - components_ = - new UserComponents(dynamics_, structure_, local_environment_, global_environment, simulation_configuration, &clock_generator_, spacecraft_id); -} -void UserSatellite::Update(const SimulationTime *simulation_time) { - dynamics_->ClearForceTorque(); - - // Update local environment and disturbance - local_environment_->Update(dynamics_, simulation_time); - disturbances_->Update(*local_environment_, *dynamics_, simulation_time); - - // Control algorithm - ControlAlgorithm(); - - // Add generated force and torque by disturbances - dynamics_->AddAcceleration_i_m_s2(disturbances_->GetAcceleration_i_m_s2()); - dynamics_->AddTorque_b_Nm(disturbances_->GetTorque_b_Nm()); - dynamics_->AddForce_b_N(disturbances_->GetForce_b_N()); - - // Propagate dynamics - dynamics_->Update(simulation_time, &(local_environment_->GetCelestialInformation())); -} - -void UserSatellite::ControlAlgorithm(void) { - // Sensing - Vector<3> observed_omega_b_rad_s = dynamics_->GetAttitude().GetAngularVelocity_b_rad_s(); - - // Control algorithm - Vector<3> control_torque_b_Nm(0.0); - Vector<3> control_force_b_N(0.0); - double Kp = 5.0e-3; - control_torque_b_Nm = -1.0 * Kp * observed_omega_b_rad_s; - - // Generate force and torque - dynamics_->AddTorque_b_Nm(control_torque_b_Nm); - dynamics_->AddForce_b_N(control_force_b_N); -} diff --git a/Tutorials/SampleCodes/control_algorithm/direct_method/user_satellite.hpp b/Tutorials/SampleCodes/control_algorithm/direct_method/user_satellite.hpp deleted file mode 100644 index 404afcf6..00000000 --- a/Tutorials/SampleCodes/control_algorithm/direct_method/user_satellite.hpp +++ /dev/null @@ -1,40 +0,0 @@ -/** - * @file user_satellite.hpp - * @brief An example of user side spacecraft class - */ - -#ifndef S2E_SIMULATION_SPACECRAFT_USER_SATELLITE_HPP_ -#define S2E_SIMULATION_SPACECRAFT_USER_SATELLITE_HPP_ - -#include - -#include "user_components.hpp" - -/** - * @class UserSatellite - * @brief An example of user side spacecraft class - */ -class UserSatellite : public Spacecraft { - public: - /** - * @fn UserSatellite - * @brief Constructor - */ - UserSatellite(const SimulationConfiguration *simulation_configuration, const GlobalEnvironment *global_environment, - const unsigned int spacecraft_id); - - /** - * @fn Update - * @brief Override Spacecraft::Update - */ - virtual void Update(const SimulationTime *simulation_time); - - private: - /** - * @fn ControlAlgorithm - * @brief Control algorithm - */ - void ControlAlgorithm(void); -}; - -#endif // S2E_SIMULATION_SPACECRAFT_USER_SATELLITE_HPP_ \ No newline at end of file diff --git a/Tutorials/SampleCodes/monte_carlo_simulation/s2e_user.cpp b/Tutorials/SampleCodes/monte_carlo_simulation/s2e_user.cpp deleted file mode 100644 index 68eccacf..00000000 --- a/Tutorials/SampleCodes/monte_carlo_simulation/s2e_user.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/** - * @file s2e_user.cpp - * @brief The main file of S2E-USER - */ - -#ifdef WIN32 -#define _WINSOCKAPI_ // stops windows.h including winsock.h -#include -#include -#endif - -#include -#include -#include -#include - -// Simulator includes -#include "library/logger/initialize_log.hpp" - -// Add custom include files -#include <./simulation/monte_carlo_simulation/initialize_monte_carlo_simulation.hpp> - -#include "./simulation/case/user_case.hpp" - -void print_path(std::string path) { -#ifdef WIN32 - std::cout << path << std::endl; -#else - const char *rpath = realpath(path.c_str(), NULL); - if (rpath) { - std::cout << rpath << std::endl; - free((void *)rpath); - } -#endif -} - -#ifdef WIN32 -int main(int argc, _TCHAR *argv[]) -#else -int main(int argc, char *argv[]) -#endif -{ - using namespace std::chrono; - - system_clock::time_point start, end; - start = system_clock::now(); - - std::string data_path = "../../data/"; - std::string ini_file = "../../data/initialize_files/user_simulation_base.ini"; - - // Parsing arguments: SatAttSim [ini_file] - if (argc == 0) { - std::cout << "Usage: SatAttSim [ini file path]" << std::endl; - return EXIT_FAILURE; - } - if (argc > 1) { - data_path = std::string(argv[1]); - if (data_path.back() != '/') data_path += "/"; - } - if (argc > 2) { - ini_file = std::string(argv[2]); - } - - MonteCarloSimulationExecutor *mc_simulator = InitMonteCarloSimulation(ini_file); - Logger *log_mc_simulator = InitMonteCarloLog(ini_file, mc_simulator->IsEnabled()); - - std::cout << "Starting simulation..." << std::endl; - std::cout << "\tData path: "; - print_path(data_path); - std::cout << "\tIni file: "; - print_path(ini_file); - - while (mc_simulator->WillExecuteNextCase()) { - auto simulation_case = UserCase(ini_file, *mc_simulator, log_mc_simulator->GetLogPath()); - // Initialize - log_mc_simulator->AddLogList(&simulation_case); - if (mc_simulator->GetNumberOfExecutionsDone() == 0) log_mc_simulator->WriteHeaders(); - simulation_case.Initialize(); - - // Main - log_mc_simulator->WriteValues(); // log initial value - simulation_case.Main(); - mc_simulator->AtTheEndOfEachCase(); - log_mc_simulator->WriteValues(); // log final value - log_mc_simulator->ClearLogList(); - } - - delete log_mc_simulator; - delete mc_simulator; - - end = system_clock::now(); - double time = static_cast(duration_cast(end - start).count() / 1000000.0); - std::cout << std::endl << "Simulation execution time: " << time << "sec" << std::endl << std::endl; - - return EXIT_SUCCESS; -} diff --git a/Tutorials/SampleCodes/monte_carlo_simulation/user_case.cpp b/Tutorials/SampleCodes/monte_carlo_simulation/user_case.cpp deleted file mode 100644 index 1e3a4109..00000000 --- a/Tutorials/SampleCodes/monte_carlo_simulation/user_case.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/** - * @file user_case.cpp - * @brief Example of user defined simulation case - */ - -#include "user_case.hpp" - -#include <./simulation/monte_carlo_simulation/simulation_object.hpp> - -UserCase::UserCase(const std::string initialize_base_file, MonteCarloSimulationExecutor &monte_carlo_simulator, const std::string log_path) - : SimulationCase(initialize_base_file, monte_carlo_simulator, log_path), monte_carlo_simulator_(monte_carlo_simulator) {} - -UserCase::~UserCase() { delete spacecraft_; } - -void UserCase::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 UserSatellite(&simulation_configuration_, global_environment_, spacecraft_id); - - // Register the log output - spacecraft_->LogSetup(*(simulation_configuration_.main_logger_)); - - // Monte Carlo Simulation - monte_carlo_simulator_.SetSeed(); - monte_carlo_simulator_.RandomizeAllParameters(); - SimulationObject::SetAllParameters(monte_carlo_simulator_); - monte_carlo_simulator_.AtTheBeginningOfEachCase(); -} - -void UserCase::UpdateTargetObjects() { - // Spacecraft Update - spacecraft_->Update(&(global_environment_->GetSimulationTime())); -} - -std::string UserCase::GetLogHeader() const { - 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); - - return str_tmp; -} - -std::string UserCase::GetLogValue() const { - 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()); - - return str_tmp; -} diff --git a/Tutorials/SampleCodes/monte_carlo_simulation/user_case.hpp b/Tutorials/SampleCodes/monte_carlo_simulation/user_case.hpp deleted file mode 100644 index 6398b51b..00000000 --- a/Tutorials/SampleCodes/monte_carlo_simulation/user_case.hpp +++ /dev/null @@ -1,60 +0,0 @@ -/** - * @file user_case.hpp - * @brief Example of user defined simulation case - */ - -#ifndef S2E_SIMULATION_CASE_USER_CASE_HPP_ -#define S2E_SIMULATION_CASE_USER_CASE_HPP_ - -#include <./simulation/case/simulation_case.hpp> -#include <./simulation/monte_carlo_simulation/monte_carlo_simulation_executor.hpp> - -#include "../spacecraft/user_satellite.hpp" - -/** - * @class UserCase - * @brief An example of user defined simulation case - */ -class UserCase : public SimulationCase { - public: - /** - * @fn UserCase - * @brief Constructor - */ - UserCase(const std::string initialize_base_file, MonteCarloSimulationExecutor &monte_carlo_simulator, const std::string log_path); - /** - * @fn ~UserCase - * @brief Destructor - */ - virtual ~UserCase(); - - /** - * @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: - UserSatellite *spacecraft_; //!< Instance of spacecraft - - MonteCarloSimulationExecutor &monte_carlo_simulator_; - - /** - * @fn InitializeTargetObjects - * @brief Override function of InitializeTargetObjects in SimulationCase - */ - void InitializeTargetObjects(); - - /** - * @fn UpdateTargetObjects - * @brief Override function of Main in SimulationCase - */ - void UpdateTargetObjects(); -}; - -#endif // S2E_SIMULATION_CASE_USER_CASE_HPP_ diff --git a/Tutorials/SampleCodes/monte_carlo_simulation/user_simulation_base.ini b/Tutorials/SampleCodes/monte_carlo_simulation/user_simulation_base.ini deleted file mode 100644 index d19c0fab..00000000 --- a/Tutorials/SampleCodes/monte_carlo_simulation/user_simulation_base.ini +++ /dev/null @@ -1,124 +0,0 @@ -[TIME] -// Simulation start time [UTC] -simulation_start_time_utc = 2020/01/01 12:00:00.0 - -// Simulation duration [sec] -simulation_duration_s = 200 - -// Simulation step time [sec] -// Minimum time step for the entire simulation -simulation_step_s = 0.1 - -// Attitude Update Period [sec] -// Attitude is updated at the period specified here -attitude_update_period_s = 0.1 // should be larger than 'simulation_step_s' - -// Attitide Δt for Runge-Kutt method [sec] -// This must be smaller than 'attitude_update_period_s' -attitude_integral_step_s = 0.001 - -// Orbit Update Period [sec] -// Orbit is updated at the period specified here -orbit_update_period_s = 0.1 // should be larger than 'simulation_step_s' - -// Orbit Δt for Runge-Kutta method [sec] -// This must be smaller than 'orbit_ppdate_period_s' -orbit_integral_step_s = 0.1 - -// Thermal Update Period [sec] -// Thermal is updated at the period specified here -thermal_update_period_s = 0.1 // should be larger than 'simulation_step_s' - -// Thermal Δt for Runge-Kutta method [sec] -// This must be smaller than 'thermal_update_period_s' -thermal_integral_step_s = 0.1 - -// Component Update Period [sec] -component_update_period_s = 0.1 // should be larger than 'simulation_step_s' - -// Log Output Period [sec] -log_output_period_s = 0.1 // should be larger than 'simulation_step_s' - -// Simulation speed -// 0: as fast as possible, 1: real-time, >1: faster than real-time, <1: slower than real-time -simulation_speed_setting = 0 - - -[MONTE_CARLO_EXECUTION] -// Whether Monte-Carlo Simulation is executed or not -monte_carlo_enable = ENABLE - -// Whether you want output the log file for each step -log_enable = ENABLE - -// Number of execution -number_of_executions = 3 - -[MONTE_CARLO_RANDOMIZATION] -parameter(0) = attitude0.angular_velocity_b_rad_s -attitude0.angular_velocity_b_rad_s.randomization_type = CartesianUniform -attitude0.angular_velocity_b_rad_s.mean_or_min(0) = 0.0 -attitude0.angular_velocity_b_rad_s.mean_or_min(1) = 0.0 -attitude0.angular_velocity_b_rad_s.mean_or_min(2) = 0.0 -attitude0.angular_velocity_b_rad_s.sigma_or_max(0) = 0.05817764 // 3-sigma = 10 [deg/s] -attitude0.angular_velocity_b_rad_s.sigma_or_max(1) = 0.05817764 // 3-sigma = 10 [deg/s] -attitude0.angular_velocity_b_rad_s.sigma_or_max(2) = 0.05817764 // 3-sigma = 10 [deg/s] - - -[CELESTIAL_INFORMATION] -// Whether global celestial information is logged or not -logging = ENABLE - -// Definition of Inertial frame -inertial_frame = J2000 -// The center object is also used to define the gravity constant of the center body -center_object = EARTH -aberration_correction = NONE - -// Earth Rotation model -// Idle:no motion, Simple:rotation only, Full:full-dynamics -rotation_mode = Simple - -// Definition of calculation celestial bodies -number_of_selected_body = 3 -selected_body_name(0) = EARTH -selected_body_name(1) = SUN -selected_body_name(2) = MOON -selected_body_name(3) = MERCURY -selected_body_name(4) = VENUS -selected_body_name(5) = MARS -selected_body_name(6) = JUPITER -selected_body_name(7) = SATURN -selected_body_name(8) = URANUS -selected_body_name(9) = NEPTUNE -selected_body_name(10) = PLUTO - -[CSPICE_KERNELS] -// CSPICE Kernel files definition -tls = ../../../ExtLibraries/cspice/generic_kernels/lsk/naif0010.tls -tpc1 = ../../../ExtLibraries/cspice/generic_kernels/pck/de-403-masses.tpc -tpc2 = ../../../ExtLibraries/cspice/generic_kernels/pck/gm_de431.tpc -tpc3 = ../../../ExtLibraries/cspice/generic_kernels/pck/pck00010.tpc -bsp = ../../../ExtLibraries/cspice/generic_kernels/spk/planets/de430.bsp - - -[HIPPARCOS_CATALOGUE] -catalogue_file_path = ../../../ExtLibraries/HipparcosCatalogue/hip_main.csv -max_magnitude = 3.0 // Max magnitude to read from Hip catalog -calculation = DISABLE -logging = DISABLE - - -[RANDOMIZE] -// Seed of randam. When this value is 0, the seed will be varied by time. -rand_seed = 0x11223344 - - -[SIMULATION_SETTINGS] -// Whether the ini files are saved or not -save_initialize_files = ENABLE - -number_of_simulated_spacecraft = 1 -number_of_simulated_ground_station = 0 -spacecraft_file(0) = ../../data/initialize_files/user_satellite.ini -log_file_save_directory = ../../data/logs/ diff --git a/Tutorials/SampleCodes/multiple_satellites/data/user_satellite1.ini b/Tutorials/SampleCodes/multiple_satellites/data/user_satellite1.ini deleted file mode 100644 index 8f106654..00000000 --- a/Tutorials/SampleCodes/multiple_satellites/data/user_satellite1.ini +++ /dev/null @@ -1,139 +0,0 @@ -[ATTITUDE] -// Attitude propagation mode -// RK4 : Attitude Propagation with RK4 including disturbances and control torque -// CONTROLLED : Attitude Calculation with Controlled Attitude mode. All disturbances and control torque are ignored. -propagate_mode = RK4 - -// 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 = MANUAL - -// Initial angular velocity at body frame [rad/s] -initial_angular_velocity_b_rad_s(0) = 0.0 -initial_angular_velocity_b_rad_s(1) = 0.0 -initial_angular_velocity_b_rad_s(2) = 0.0 - -// Initial quaternion inertial frame to body frame (real part, imaginary part) -// This value also used in INERTIAL_STABILIZE mode of ControlledAttitude -initial_quaternion_i2b(0) = 0.0 -initial_quaternion_i2b(1) = 0.0 -initial_quaternion_i2b(2) = 0.0 -initial_quaternion_i2b(3) = 1.0 - -// Initial torque at body frame [Nm] -// Note: The initial torque added just for the first propagation step -initial_torque_b_Nm(0) = +0.000 -initial_torque_b_Nm(1) = -0.000 -initial_torque_b_Nm(2) = 0.000 - -[CONTROLLED_ATTITUDE] -// Mode definitions -// INERTIAL_STABILIZE -// SUN_POINTING -// EARTH_CENTER_POINTING -// VELOCITY_DIRECTION_POINTING -// ORBIT_NORMAL_POINTING -main_mode = INERTIAL_STABILIZE -sub_mode = SUN_POINTING - -// Pointing direction @ body frame for main pointing mode -main_pointing_direction_b(0) = 1.0 -main_pointing_direction_b(1) = 0.0 -main_pointing_direction_b(2) = 0.0 - -// Pointing direction @ body frame for sub pointing mode -// main_pointing_direction_b and sub_pointing_direction_b should separate larger than 30 degrees. -sub_pointing_direction_b(0) = 0.0 -sub_pointing_direction_b(1) = 0.0 -sub_pointing_direction_b(2) = 1.0 - - -[ORBIT] -calculation = ENABLE -logging = ENABLE - -// Orbit propagation mode -// RK4 : RK4 propagation with disturbances and thruster maneuver -// SGP4 : SGP4 propagation using TLE without thruster maneuver -// RELATIVE : Relative dynamics (for formation flying simulation) -// KEPLER : Kepler orbit propagation without disturbances and thruster maneuver -// ENCKE : Encke orbit propagation with disturbances and thruster maneuver -propagate_mode = RK4 - -// Orbit initialize mode for RK4, KEPLER, and ENCKE -// DEFAULT : Use default initialize method (RK4 and ENCKE use pos/vel, KEPLER uses init_mode_kepler) -// POSITION_VELOCITY_I : Initialize with position and velocity in the inertial frame -// ORBITAL_ELEMENTS : Initialize with orbital elements -initialize_mode = POSITION_VELOCITY_I - -// Initial value definition for POSITION_VELOCITY_I initialize mode //////// -initial_position_i_m(0) = -2111769.7723711144 -initial_position_i_m(1) = -5360353.2254375768 -initial_position_i_m(2) = 3596181.6497774957 - -initial_velocity_i_m_s(0) = 4200.4344740455268 -initial_velocity_i_m_s(1) = -4637.540129059361 -initial_velocity_i_m_s(2) = -4429.2361258448807 -/////////////////////////////////////////////////////////////////////////// - -// Initial value definition for ORBITAL_ELEMENTS initialize mode //////// -semi_major_axis_m = 6794500.0 -eccentricity = 0.0015 -inclination_rad = 0.9012 -raan_rad = 0.1411 -argument_of_perigee_rad = 1.7952 -epoch_jday = 2.458940966402607e6 -/////////////////////////////////////////////////////////////////////////////// - - -// Settings for SGP4 /////////////////////////////////////////////// -// TLE -// Example: ISS -tle1=1 25544U 98067A 20076.51604214 .00016717 00000-0 10270-3 0 9005 -tle2=2 25544 51.6412 86.9962 0006063 30.9353 329.2153 15.49228202 17647 -// World Geodetic System -wgs = 2 // 0: wgs72old, 1: wgs72, 2: wgs84 -////////////////////////////////////////////////////////////////////////// - -// Settings for relative orbit propagation //////////////////////////// -// Relative Orbit Update Method (0 means RK4, 1 means STM) -relative_orbit_update_method = 0 -// RK4 Relative Dynamics model type (only valid for RK4 update) -// 0: Hill -relative_dynamics_model_type = 0 -// STM Relative Dynamics model type (only valid for STM update) -// 0: HCW -stm_model_type = 0 -// Initial satellite position relative to the reference satellite in LVLH frame[m] -// * The coordinate system is defined at [PLANET_SELECTION] in SampleSimBase.ini -initial_relative_position_lvlh_m(0) = 0.0 -initial_relative_position_lvlh_m(1) = 100.0 -initial_relative_position_lvlh_m(2) = 0.0 -// initial satellite velocity relative to the reference satellite in LVLH frame[m/s] -initial_relative_velocity_lvlh_m_s(0) = 0.0 -initial_relative_velocity_lvlh_m_s(1) = 0.0 -initial_relative_velocity_lvlh_m_s(2) = 0.0 -// information of reference satellite -reference_satellite_id = 1 -/////////////////////////////////////////////////////////////////////////////// - -// Settings for Encke mode /////////// -error_tolerance = 0.0001 -/////////////////////////////////////////////////////////////////////////////// - - -[THERMAL] -calculation = DISABLE -debug = 0 -thermal_file_directory = ../../data/initialize_files/thermal_csv_files/ - -[SETTING_FILES] -local_environment_file = ../../data/initialize_files/user_satellite1_local_environment.ini -disturbance_file = ../../data/initialize_files/user_satellite1_disturbance.ini -structure_file = ../../data/initialize_files/user_satellite1_structure.ini - - -[COMPONENT_FILES] -// Users can add the path for component initialize files here. - diff --git a/Tutorials/SampleCodes/multiple_satellites/data/user_satellite1_disturbance.ini b/Tutorials/SampleCodes/multiple_satellites/data/user_satellite1_disturbance.ini deleted file mode 100644 index 20796de2..00000000 --- a/Tutorials/SampleCodes/multiple_satellites/data/user_satellite1_disturbance.ini +++ /dev/null @@ -1,48 +0,0 @@ -[GEOPOTENTIAL] -// Enable only when the center object is defined as the Earth -calculation = DISABLE -logging = ENABLE -degree = 4 -coefficients_file_path = ../../../ExtLibraries/GeoPotential/egm96_to360.ascii - - -[MAGNETIC_DISTURBANCE] -// Enable only when the center object is defined as the Earth -calculation = ENABLE -logging = ENABLE - - -[AIR_DRAG] -// Enable only when the center object is defined as the Earth -calculation = ENABLE -logging = ENABLE - -// Condition of air drag -wall_temperature_degC = 30 // Surface Temperature[degC] -molecular_temperature_degC = 3 // Atmosphere Temperature[degC] -molecular_weight_g_mol = 18.0 // Molecular weight of the thermosphere[g/mol] - - -[SOLAR_RADIATION_PRESSURE_DISTURBANCE] -calculation = ENABLE -logging = ENABLE - - -[GRAVITY_GRADIENT] -calculation = ENABLE -logging = ENABLE - - -[THIRD_BODY_GRAVITY] -calculation = DISABLE -logging = ENABLE - -// The number of gravity-generating bodies other than the central body -number_of_third_body = 1 - -// List of gravity-generating bodies other than the central body -// All these bodies must be included in the "selected_body_name" of "[CelestialInformation]" -third_body_name(0) = SUN -third_body_name(1) = MOON -third_body_name(2) = MARS - diff --git a/Tutorials/SampleCodes/multiple_satellites/data/user_satellite1_local_environment.ini b/Tutorials/SampleCodes/multiple_satellites/data/user_satellite1_local_environment.ini deleted file mode 100644 index af2ff61e..00000000 --- a/Tutorials/SampleCodes/multiple_satellites/data/user_satellite1_local_environment.ini +++ /dev/null @@ -1,35 +0,0 @@ -[MAGNETIC_FIELD_ENVIRONMENT] -calculation = ENABLE -logging = ENABLE -coefficient_file = ../../../s2e-core/src/library/external/igrf/igrf13.coef -magnetic_field_random_walk_standard_deviation_nT = 10.0 -magnetic_field_random_walk_limit_nT = 400.0 -magnetic_field_white_noise_standard_deviation_nT = 50.0 - - -[SOLAR_RADIATION_PRESSURE_ENVIRONMENT] -calculation = ENABLE -logging = ENABLE - - -[ATMOSPHERE] -calculation = ENABLE -logging = ENABLE - -// Atmosphere model -// STANDARD: Model using scale height, NRLMSISE00: NRLMSISE00 model -model = STANDARD -nrlmsise00_table_file = ../../../ExtLibraries/nrlmsise00/table/SpaceWeather.txt -// Whether using user-defined f10.7 and ap value -// Ref of f10.7: https://www.swpc.noaa.gov/phenomena/f107-cm-radio-emissions -// Ref of ap: http://wdc.kugi.kyoto-u.ac.jp/kp/kpexp-j.html -is_manual_parameter_used = ENABLE -manual_daily_f107 = 150.0 // User defined f10.7 (1 day) -manual_average_f107 = 150.0 // User defined f10.7 (30 days average) -manual_ap = 3.0 // User defined ap -air_density_standard_deviation = 0.0 // Standard deviation of the air density - - -[LOCAL_CELESTIAL_INFORMATION] -logging = ENABLE - diff --git a/Tutorials/SampleCodes/multiple_satellites/data/user_satellite1_structure.ini b/Tutorials/SampleCodes/multiple_satellites/data/user_satellite1_structure.ini deleted file mode 100644 index 19c771ce..00000000 --- a/Tutorials/SampleCodes/multiple_satellites/data/user_satellite1_structure.ini +++ /dev/null @@ -1,116 +0,0 @@ -// -// The origin of all vectors defined here is the body-fixed frame. -// Users can define the origin of the body-fixed frame by themselves. -// If users want to define the origin as the center of gravity, they need to set center_of_gravity_b_m = zero vector. -// If users want to define the origin as a specific point, they need to set all vectors to suit their definition carefully. -// - -[KINEMATIC_PARAMETERS] -// Inertia Tensor @ body fixed frame [kg・m2] -inertia_tensor_kgm2(0) = 0.1 // I_xx -inertia_tensor_kgm2(1) = 0.0 // I_xy -inertia_tensor_kgm2(2) = 0.0 // I_xz -inertia_tensor_kgm2(3) = 0.0 // I_yx -inertia_tensor_kgm2(4) = 0.1 // I_yy -inertia_tensor_kgm2(5) = 0.0 // I_yz -inertia_tensor_kgm2(6) = 0.0 // I_zx -inertia_tensor_kgm2(7) = 0.0 // I_zy -inertia_tensor_kgm2(8) = 0.1 // I_zz - -mass_kg = 14 - -// Position vector of the center of gravity @ the body frame [m] -center_of_gravity_b_m(0) = 0.01 -center_of_gravity_b_m(1) = 0.01 -center_of_gravity_b_m(2) = 0.01 - -[SURFACES] -number_of_surfaces = 6 - -// Area of each surface [m^2] -area_0_m2 = 0.25 -area_1_m2 = 0.25 -area_2_m2 = 0.25 -area_3_m2 = 0.25 -area_4_m2 = 0.25 -area_5_m2 = 0.25 - -// Position vector of each surface geometric center @ body frame [m] -position_0_b_m(0) = 0.25 -position_0_b_m(1) = 0.0 -position_0_b_m(2) = 0.0 -position_1_b_m(0) = -0.25 -position_1_b_m(1) = 0.0 -position_1_b_m(2) = 0.0 -position_2_b_m(0) = 0.0 -position_2_b_m(1) = 0.25 -position_2_b_m(2) = 0.0 -position_3_b_m(0) = 0.0 -position_3_b_m(1) = -0.25 -position_3_b_m(2) = 0.0 -position_4_b_m(0) = 0.0 -position_4_b_m(1) = 0.0 -position_4_b_m(2) = 0.25 -position_5_b_m(0) = 0.0 -position_5_b_m(1) = 0.0 -position_5_b_m(2) = -0.25 - -// Normal vector of each surface @ body frame -normal_vector_0_b(0) = 1.0 -normal_vector_0_b(1) = 0.0 -normal_vector_0_b(2) = 0.0 -normal_vector_1_b(0) = -1.0 -normal_vector_1_b(1) = 0.0 -normal_vector_1_b(2) = 0.0 -normal_vector_2_b(0) = 0.0 -normal_vector_2_b(1) = 1.0 -normal_vector_2_b(2) = 0.0 -normal_vector_3_b(0) = 0.0 -normal_vector_3_b(1) = -1.0 -normal_vector_3_b(2) = 0.0 -normal_vector_4_b(0) = 0.0 -normal_vector_4_b(1) = 0.0 -normal_vector_4_b(2) = 1.0 -normal_vector_5_b(0) = 0.0 -normal_vector_5_b(1) = 0.0 -normal_vector_5_b(2) = -1.0 - -// Total reflectance for the Sun spectrum -reflectivity_0 = 0.4 -reflectivity_1 = 0.4 -reflectivity_2 = 0.4 -reflectivity_3 = 0.4 -reflectivity_4 = 0.4 -reflectivity_5 = 0.4 - -// Specularity for the Sun spectrum -specularity_0 = 0.4 -specularity_1 = 0.4 -specularity_2 = 0.4 -specularity_3 = 0.4 -specularity_4 = 0.4 -specularity_5 = 0.4 - -// Specularity for air drag -air_specularity_0 = 0.4 -air_specularity_1 = 0.4 -air_specularity_2 = 0.4 -air_specularity_3 = 0.4 -air_specularity_4 = 0.4 -air_specularity_5 = 0.4 - -[RESIDUAL_MAGNETIC_MOMENT] -// Constant component of Residual Magnetic Moment(RMM) [A・m^2] -rmm_constant_b_Am2(0) = 0.04 -rmm_constant_b_Am2(1) = 0.04 -rmm_constant_b_Am2(2) = 0.04 - -// RMM Random Walk Speed [A・m^2] -rmm_random_walk_speed_Am2 = 1.0E-5 - -// RMM Random Walk Limit [A・m^2] -rmm_random_walk_limit_Am2 = 1.0E-3 - -// RMM White Noise Standard deviation [A・m^2] -rmm_white_noise_standard_deviation_Am2 = 5.0E-5 - diff --git a/Tutorials/SampleCodes/multiple_satellites/data/user_satellite2.ini b/Tutorials/SampleCodes/multiple_satellites/data/user_satellite2.ini deleted file mode 100644 index 56f2dc3b..00000000 --- a/Tutorials/SampleCodes/multiple_satellites/data/user_satellite2.ini +++ /dev/null @@ -1,139 +0,0 @@ -[ATTITUDE] -// Attitude propagation mode -// RK4 : Attitude Propagation with RK4 including disturbances and control torque -// CONTROLLED : Attitude Calculation with Controlled Attitude mode. All disturbances and control torque are ignored. -propagate_mode = RK4 - -// 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 = MANUAL - -// Initial angular velocity at body frame [rad/s] -initial_angular_velocity_b_rad_s(0) = 0.0 -initial_angular_velocity_b_rad_s(1) = 0.0 -initial_angular_velocity_b_rad_s(2) = 0.0 - -// Initial quaternion inertial frame to body frame (real part, imaginary part) -// This value also used in INERTIAL_STABILIZE mode of ControlledAttitude -initial_quaternion_i2b(0) = 0.0 -initial_quaternion_i2b(1) = 0.0 -initial_quaternion_i2b(2) = 0.0 -initial_quaternion_i2b(3) = 1.0 - -// Initial torque at body frame [Nm] -// Note: The initial torque added just for the first propagation step -initial_torque_b_Nm(0) = +0.000 -initial_torque_b_Nm(1) = -0.000 -initial_torque_b_Nm(2) = 0.000 - -[CONTROLLED_ATTITUDE] -// Mode definitions -// INERTIAL_STABILIZE -// SUN_POINTING -// EARTH_CENTER_POINTING -// VELOCITY_DIRECTION_POINTING -// ORBIT_NORMAL_POINTING -main_mode = INERTIAL_STABILIZE -sub_mode = SUN_POINTING - -// Pointing direction @ body frame for main pointing mode -main_pointing_direction_b(0) = 1.0 -main_pointing_direction_b(1) = 0.0 -main_pointing_direction_b(2) = 0.0 - -// Pointing direction @ body frame for sub pointing mode -// main_pointing_direction_b and sub_pointing_direction_b should separate larger than 30 degrees. -sub_pointing_direction_b(0) = 0.0 -sub_pointing_direction_b(1) = 0.0 -sub_pointing_direction_b(2) = 1.0 - - -[ORBIT] -calculation = ENABLE -logging = ENABLE - -// Orbit propagation mode -// RK4 : RK4 propagation with disturbances and thruster maneuver -// SGP4 : SGP4 propagation using TLE without thruster maneuver -// RELATIVE : Relative dynamics (for formation flying simulation) -// KEPLER : Kepler orbit propagation without disturbances and thruster maneuver -// ENCKE : Encke orbit propagation with disturbances and thruster maneuver -propagate_mode = RK4 - -// Orbit initialize mode for RK4, KEPLER, and ENCKE -// DEFAULT : Use default initialize method (RK4 and ENCKE use pos/vel, KEPLER uses init_mode_kepler) -// POSITION_VELOCITY_I : Initialize with position and velocity in the inertial frame -// ORBITAL_ELEMENTS : Initialize with orbital elements -initialize_mode = POSITION_VELOCITY_I - -// Initial value definition for POSITION_VELOCITY_I initialize mode //////// -initial_position_i_m(0) = -2111769.7723711144 -initial_position_i_m(1) = -5360353.2254375768 -initial_position_i_m(2) = 3596181.6497774957 - -initial_velocity_i_m_s(0) = 4200.4344740455268 -initial_velocity_i_m_s(1) = -4637.540129059361 -initial_velocity_i_m_s(2) = -4429.2361258448807 -/////////////////////////////////////////////////////////////////////////// - -// Initial value definition for ORBITAL_ELEMENTS initialize mode //////// -semi_major_axis_m = 6794500.0 -eccentricity = 0.0015 -inclination_rad = 0.9012 -raan_rad = 0.1411 -argument_of_perigee_rad = 1.7952 -epoch_jday = 2.458940966402607e6 -/////////////////////////////////////////////////////////////////////////////// - - -// Settings for SGP4 /////////////////////////////////////////////// -// TLE -// Example: ISS -tle1=1 25544U 98067A 20076.51604214 .00016717 00000-0 10270-3 0 9005 -tle2=2 25544 51.6412 86.9962 0006063 30.9353 329.2153 15.49228202 17647 -// World Geodetic System -wgs = 2 // 0: wgs72old, 1: wgs72, 2: wgs84 -////////////////////////////////////////////////////////////////////////// - -// Settings for relative orbit propagation //////////////////////////// -// Relative Orbit Update Method (0 means RK4, 1 means STM) -relative_orbit_update_method = 0 -// RK4 Relative Dynamics model type (only valid for RK4 update) -// 0: Hill -relative_dynamics_model_type = 0 -// STM Relative Dynamics model type (only valid for STM update) -// 0: HCW -stm_model_type = 0 -// Initial satellite position relative to the reference satellite in LVLH frame[m] -// * The coordinate system is defined at [PLANET_SELECTION] in SampleSimBase.ini -initial_relative_position_lvlh_m(0) = 0.0 -initial_relative_position_lvlh_m(1) = 100.0 -initial_relative_position_lvlh_m(2) = 0.0 -// initial satellite velocity relative to the reference satellite in LVLH frame[m/s] -initial_relative_velocity_lvlh_m_s(0) = 0.0 -initial_relative_velocity_lvlh_m_s(1) = 0.0 -initial_relative_velocity_lvlh_m_s(2) = 0.0 -// information of reference satellite -reference_satellite_id = 1 -/////////////////////////////////////////////////////////////////////////////// - -// Settings for Encke mode /////////// -error_tolerance = 0.0001 -/////////////////////////////////////////////////////////////////////////////// - - -[THERMAL] -calculation = DISABLE -debug = 0 -thermal_file_directory = ../../data/initialize_files/thermal_csv_files/ - -[SETTING_FILES] -local_environment_file = ../../data/initialize_files/user_satellite2_local_environment.ini -disturbance_file = ../../data/initialize_files/user_satellite2_disturbance.ini -structure_file = ../../data/initialize_files/user_satellite2_structure.ini - - -[COMPONENT_FILES] -// Users can add the path for component initialize files here. - diff --git a/Tutorials/SampleCodes/multiple_satellites/data/user_satellite2_disturbance.ini b/Tutorials/SampleCodes/multiple_satellites/data/user_satellite2_disturbance.ini deleted file mode 100644 index 20796de2..00000000 --- a/Tutorials/SampleCodes/multiple_satellites/data/user_satellite2_disturbance.ini +++ /dev/null @@ -1,48 +0,0 @@ -[GEOPOTENTIAL] -// Enable only when the center object is defined as the Earth -calculation = DISABLE -logging = ENABLE -degree = 4 -coefficients_file_path = ../../../ExtLibraries/GeoPotential/egm96_to360.ascii - - -[MAGNETIC_DISTURBANCE] -// Enable only when the center object is defined as the Earth -calculation = ENABLE -logging = ENABLE - - -[AIR_DRAG] -// Enable only when the center object is defined as the Earth -calculation = ENABLE -logging = ENABLE - -// Condition of air drag -wall_temperature_degC = 30 // Surface Temperature[degC] -molecular_temperature_degC = 3 // Atmosphere Temperature[degC] -molecular_weight_g_mol = 18.0 // Molecular weight of the thermosphere[g/mol] - - -[SOLAR_RADIATION_PRESSURE_DISTURBANCE] -calculation = ENABLE -logging = ENABLE - - -[GRAVITY_GRADIENT] -calculation = ENABLE -logging = ENABLE - - -[THIRD_BODY_GRAVITY] -calculation = DISABLE -logging = ENABLE - -// The number of gravity-generating bodies other than the central body -number_of_third_body = 1 - -// List of gravity-generating bodies other than the central body -// All these bodies must be included in the "selected_body_name" of "[CelestialInformation]" -third_body_name(0) = SUN -third_body_name(1) = MOON -third_body_name(2) = MARS - diff --git a/Tutorials/SampleCodes/multiple_satellites/data/user_satellite2_local_environment.ini b/Tutorials/SampleCodes/multiple_satellites/data/user_satellite2_local_environment.ini deleted file mode 100644 index af2ff61e..00000000 --- a/Tutorials/SampleCodes/multiple_satellites/data/user_satellite2_local_environment.ini +++ /dev/null @@ -1,35 +0,0 @@ -[MAGNETIC_FIELD_ENVIRONMENT] -calculation = ENABLE -logging = ENABLE -coefficient_file = ../../../s2e-core/src/library/external/igrf/igrf13.coef -magnetic_field_random_walk_standard_deviation_nT = 10.0 -magnetic_field_random_walk_limit_nT = 400.0 -magnetic_field_white_noise_standard_deviation_nT = 50.0 - - -[SOLAR_RADIATION_PRESSURE_ENVIRONMENT] -calculation = ENABLE -logging = ENABLE - - -[ATMOSPHERE] -calculation = ENABLE -logging = ENABLE - -// Atmosphere model -// STANDARD: Model using scale height, NRLMSISE00: NRLMSISE00 model -model = STANDARD -nrlmsise00_table_file = ../../../ExtLibraries/nrlmsise00/table/SpaceWeather.txt -// Whether using user-defined f10.7 and ap value -// Ref of f10.7: https://www.swpc.noaa.gov/phenomena/f107-cm-radio-emissions -// Ref of ap: http://wdc.kugi.kyoto-u.ac.jp/kp/kpexp-j.html -is_manual_parameter_used = ENABLE -manual_daily_f107 = 150.0 // User defined f10.7 (1 day) -manual_average_f107 = 150.0 // User defined f10.7 (30 days average) -manual_ap = 3.0 // User defined ap -air_density_standard_deviation = 0.0 // Standard deviation of the air density - - -[LOCAL_CELESTIAL_INFORMATION] -logging = ENABLE - diff --git a/Tutorials/SampleCodes/multiple_satellites/data/user_satellite2_structure.ini b/Tutorials/SampleCodes/multiple_satellites/data/user_satellite2_structure.ini deleted file mode 100644 index 19c771ce..00000000 --- a/Tutorials/SampleCodes/multiple_satellites/data/user_satellite2_structure.ini +++ /dev/null @@ -1,116 +0,0 @@ -// -// The origin of all vectors defined here is the body-fixed frame. -// Users can define the origin of the body-fixed frame by themselves. -// If users want to define the origin as the center of gravity, they need to set center_of_gravity_b_m = zero vector. -// If users want to define the origin as a specific point, they need to set all vectors to suit their definition carefully. -// - -[KINEMATIC_PARAMETERS] -// Inertia Tensor @ body fixed frame [kg・m2] -inertia_tensor_kgm2(0) = 0.1 // I_xx -inertia_tensor_kgm2(1) = 0.0 // I_xy -inertia_tensor_kgm2(2) = 0.0 // I_xz -inertia_tensor_kgm2(3) = 0.0 // I_yx -inertia_tensor_kgm2(4) = 0.1 // I_yy -inertia_tensor_kgm2(5) = 0.0 // I_yz -inertia_tensor_kgm2(6) = 0.0 // I_zx -inertia_tensor_kgm2(7) = 0.0 // I_zy -inertia_tensor_kgm2(8) = 0.1 // I_zz - -mass_kg = 14 - -// Position vector of the center of gravity @ the body frame [m] -center_of_gravity_b_m(0) = 0.01 -center_of_gravity_b_m(1) = 0.01 -center_of_gravity_b_m(2) = 0.01 - -[SURFACES] -number_of_surfaces = 6 - -// Area of each surface [m^2] -area_0_m2 = 0.25 -area_1_m2 = 0.25 -area_2_m2 = 0.25 -area_3_m2 = 0.25 -area_4_m2 = 0.25 -area_5_m2 = 0.25 - -// Position vector of each surface geometric center @ body frame [m] -position_0_b_m(0) = 0.25 -position_0_b_m(1) = 0.0 -position_0_b_m(2) = 0.0 -position_1_b_m(0) = -0.25 -position_1_b_m(1) = 0.0 -position_1_b_m(2) = 0.0 -position_2_b_m(0) = 0.0 -position_2_b_m(1) = 0.25 -position_2_b_m(2) = 0.0 -position_3_b_m(0) = 0.0 -position_3_b_m(1) = -0.25 -position_3_b_m(2) = 0.0 -position_4_b_m(0) = 0.0 -position_4_b_m(1) = 0.0 -position_4_b_m(2) = 0.25 -position_5_b_m(0) = 0.0 -position_5_b_m(1) = 0.0 -position_5_b_m(2) = -0.25 - -// Normal vector of each surface @ body frame -normal_vector_0_b(0) = 1.0 -normal_vector_0_b(1) = 0.0 -normal_vector_0_b(2) = 0.0 -normal_vector_1_b(0) = -1.0 -normal_vector_1_b(1) = 0.0 -normal_vector_1_b(2) = 0.0 -normal_vector_2_b(0) = 0.0 -normal_vector_2_b(1) = 1.0 -normal_vector_2_b(2) = 0.0 -normal_vector_3_b(0) = 0.0 -normal_vector_3_b(1) = -1.0 -normal_vector_3_b(2) = 0.0 -normal_vector_4_b(0) = 0.0 -normal_vector_4_b(1) = 0.0 -normal_vector_4_b(2) = 1.0 -normal_vector_5_b(0) = 0.0 -normal_vector_5_b(1) = 0.0 -normal_vector_5_b(2) = -1.0 - -// Total reflectance for the Sun spectrum -reflectivity_0 = 0.4 -reflectivity_1 = 0.4 -reflectivity_2 = 0.4 -reflectivity_3 = 0.4 -reflectivity_4 = 0.4 -reflectivity_5 = 0.4 - -// Specularity for the Sun spectrum -specularity_0 = 0.4 -specularity_1 = 0.4 -specularity_2 = 0.4 -specularity_3 = 0.4 -specularity_4 = 0.4 -specularity_5 = 0.4 - -// Specularity for air drag -air_specularity_0 = 0.4 -air_specularity_1 = 0.4 -air_specularity_2 = 0.4 -air_specularity_3 = 0.4 -air_specularity_4 = 0.4 -air_specularity_5 = 0.4 - -[RESIDUAL_MAGNETIC_MOMENT] -// Constant component of Residual Magnetic Moment(RMM) [A・m^2] -rmm_constant_b_Am2(0) = 0.04 -rmm_constant_b_Am2(1) = 0.04 -rmm_constant_b_Am2(2) = 0.04 - -// RMM Random Walk Speed [A・m^2] -rmm_random_walk_speed_Am2 = 1.0E-5 - -// RMM Random Walk Limit [A・m^2] -rmm_random_walk_limit_Am2 = 1.0E-3 - -// RMM White Noise Standard deviation [A・m^2] -rmm_white_noise_standard_deviation_Am2 = 5.0E-5 - diff --git a/Tutorials/SampleCodes/multiple_satellites/data/user_simulation_base.ini b/Tutorials/SampleCodes/multiple_satellites/data/user_simulation_base.ini deleted file mode 100644 index f12a7c7f..00000000 --- a/Tutorials/SampleCodes/multiple_satellites/data/user_simulation_base.ini +++ /dev/null @@ -1,136 +0,0 @@ -[TIME] -// Simulation start time [UTC] -simulation_start_time_utc = 2020/01/01 12:00:00.0 - -// Simulation duration [sec] -simulation_duration_s = 200 - -// Simulation step time [sec] -// Minimum time step for the entire simulation -simulation_step_s = 0.1 - -// Attitude Update Period [sec] -// Attitude is updated at the period specified here -attitude_update_period_s = 0.1 // should be larger than 'simulation_step_s' - -// Attitide Δt for Runge-Kutt method [sec] -// This must be smaller than 'attitude_update_period_s' -attitude_integral_step_s = 0.001 - -// Orbit Update Period [sec] -// Orbit is updated at the period specified here -orbit_update_period_s = 0.1 // should be larger than 'simulation_step_s' - -// Orbit Δt for Runge-Kutta method [sec] -// This must be smaller than 'orbit_ppdate_period_s' -orbit_integral_step_s = 0.1 - -// Thermal Update Period [sec] -// Thermal is updated at the period specified here -thermal_update_period_s = 0.1 // should be larger than 'simulation_step_s' - -// Thermal Δt for Runge-Kutta method [sec] -// This must be smaller than 'thermal_update_period_s' -thermal_integral_step_s = 0.1 - -// Component Update Period [sec] -component_update_period_s = 0.1 // should be larger than 'simulation_step_s' - -// Log Output Period [sec] -log_output_period_s = 0.1 // should be larger than 'simulation_step_s' - -// Simulation speed -// 0: as fast as possible, 1: real-time, >1: faster than real-time, <1: slower than real-time -simulation_speed_setting = 0 - - -[MONTE_CARLO_EXECUTION] -// Whether Monte-Carlo Simulation is executed or not -monte_carlo_enable = DISABLE - -// Whether you want output the log file for each step -log_enable = ENABLE - -// Number of execution -number_of_executions = 100 - - -[MONTE_CARLO_RANDOMIZATION] -parameter(0) = attitude0.debug -attitude0.debug.randomization_type = CartesianUniform -attitude0.debug.mean_or_min(0) = 0.0 -attitude0.debug.mean_or_min(1) = 0.0 -attitude0.debug.mean_or_min(2) = 0.0 -attitude0.debug.sigma_or_max(0) = 10.0 -attitude0.debug.sigma_or_max(1) = 10.0 -attitude0.debug.sigma_or_max(2) = 10.0 - -parameter(1) = attitude0.omega_b -attitude0.omega_b.randomization_type = NoRandomization -attitude0.omega_b.mean_or_min(0) = 0.0 -attitude0.omega_b.mean_or_min(1) = 0.0 -attitude0.omega_b.mean_or_min(2) = 0.0 -attitude0.omega_b.sigma_or_max(0) = 0.05817764 // 3-sigma = 10 [deg/s] -attitude0.omega_b.sigma_or_max(1) = 0.05817764 // 3-sigma = 10 [deg/s] -attitude0.omega_b.sigma_or_max(2) = 0.05817764 // 3-sigma = 10 [deg/s] - - -[CELESTIAL_INFORMATION] -// Whether global celestial information is logged or not -logging = ENABLE - -// Definition of Inertial frame -inertial_frame = J2000 -// The center object is also used to define the gravity constant of the center body -center_object = EARTH -aberration_correction = NONE - -// Earth Rotation model -// Idle:no motion, Simple:rotation only, Full:full-dynamics -rotation_mode = Simple - -// Definition of calculation celestial bodies -number_of_selected_body = 3 -selected_body_name(0) = EARTH -selected_body_name(1) = SUN -selected_body_name(2) = MOON -selected_body_name(3) = MERCURY -selected_body_name(4) = VENUS -selected_body_name(5) = MARS -selected_body_name(6) = JUPITER -selected_body_name(7) = SATURN -selected_body_name(8) = URANUS -selected_body_name(9) = NEPTUNE -selected_body_name(10) = PLUTO - -[CSPICE_KERNELS] -// CSPICE Kernel files definition -tls = ../../../ExtLibraries/cspice/generic_kernels/lsk/naif0010.tls -tpc1 = ../../../ExtLibraries/cspice/generic_kernels/pck/de-403-masses.tpc -tpc2 = ../../../ExtLibraries/cspice/generic_kernels/pck/gm_de431.tpc -tpc3 = ../../../ExtLibraries/cspice/generic_kernels/pck/pck00010.tpc -bsp = ../../../ExtLibraries/cspice/generic_kernels/spk/planets/de430.bsp - - -[HIPPARCOS_CATALOGUE] -catalogue_file_path = ../../../ExtLibraries/HipparcosCatalogue/hip_main.csv -max_magnitude = 3.0 // Max magnitude to read from Hip catalog -calculation = DISABLE -logging = DISABLE - - -[RANDOMIZE] -// Seed of randam. When this value is 0, the seed will be varied by time. -rand_seed = 0x11223344 - - -[SIMULATION_SETTINGS] -// Whether the ini files are saved or not -save_initialize_files = ENABLE - -number_of_simulated_spacecraft = 2 -spacecraft_file(0) = ../../data/initialize_files/user_satellite1.ini -spacecraft_file(1) = ../../data/initialize_files/user_satellite2.ini -number_of_simulated_ground_station = 0 -log_file_save_directory = ../../data/logs/ - diff --git a/Tutorials/SampleCodes/multiple_satellites/src/user_case.cpp b/Tutorials/SampleCodes/multiple_satellites/src/user_case.cpp deleted file mode 100644 index e9ff29c6..00000000 --- a/Tutorials/SampleCodes/multiple_satellites/src/user_case.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @file user_case.cpp - * @brief Example of user defined simulation case - */ - -#include "user_case.hpp" - -UserCase::UserCase(const std::string initialise_base_file) : SimulationCase(initialise_base_file) {} - -UserCase::~UserCase() { - delete spacecraft0_; - delete spacecraft1_; -} - -void UserCase::InitializeTargetObjects() { - // Instantiate the target of the simulation - // `spacecraft_id` corresponds to the index of `spacecraft_file` in simulation_base.ini - spacecraft0_ = new UserSatellite(&simulation_configuration_, global_environment_, 0); - spacecraft1_ = new UserSatellite(&simulation_configuration_, global_environment_, 1); - - // Register the log output - spacecraft0_->LogSetup(*(simulation_configuration_.main_logger_)); - spacecraft1_->LogSetup(*(simulation_configuration_.main_logger_)); -} - -void UserCase::UpdateTargetObjects() { - // Spacecraft Update - spacecraft0_->Update(&(global_environment_->GetSimulationTime())); - spacecraft1_->Update(&(global_environment_->GetSimulationTime())); -} - -std::string UserCase::GetLogHeader() const { - std::string str_tmp = ""; - return str_tmp; -} - -std::string UserCase::GetLogValue() const { - std::string str_tmp = ""; - - return str_tmp; -} diff --git a/Tutorials/SampleCodes/multiple_satellites/src/user_case.hpp b/Tutorials/SampleCodes/multiple_satellites/src/user_case.hpp deleted file mode 100644 index 5718ec40..00000000 --- a/Tutorials/SampleCodes/multiple_satellites/src/user_case.hpp +++ /dev/null @@ -1,58 +0,0 @@ -/** - * @file user_case.hpp - * @brief Example of user defined simulation case - */ - -#ifndef S2E_SIMULATION_CASE_USER_CASE_HPP_ -#define S2E_SIMULATION_CASE_USER_CASE_HPP_ - -#include <./simulation/case/simulation_case.hpp> - -#include "../spacecraft/user_satellite.hpp" - -/** - * @class UserCase - * @brief An example of user defined simulation case - */ -class UserCase : public SimulationCase { - public: - /** - * @fn UserCase - * @brief Constructor - */ - UserCase(const std::string initialise_base_file); - /** - * @fn ~UserCase - * @brief Destructor - */ - virtual ~UserCase(); - - /** - * @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: - UserSatellite *spacecraft0_; //!< Instance of spacecraft - UserSatellite *spacecraft1_; //!< Instance of spacecraft - - /** - * @fn InitializeTargetObjects - * @brief Override function of InitializeTargetObjects in SimulationCase - */ - void InitializeTargetObjects(); - - /** - * @fn UpdateTargetObjects - * @brief Override function of Main in SimulationCase - */ - void UpdateTargetObjects(); -}; - -#endif // S2E_SIMULATION_CASE_USER_CASE_HPP_ diff --git a/Tutorials/SampleCodes/s2e-user/CMakeLists.txt b/Tutorials/SampleCodes/s2e-user/CMakeLists.txt deleted file mode 100644 index c2a58c35..00000000 --- a/Tutorials/SampleCodes/s2e-user/CMakeLists.txt +++ /dev/null @@ -1,174 +0,0 @@ -## General Settings -cmake_policy(SET CMP0048 NEW) -project(S2E_USER - LANGUAGES CXX - DESCRIPTION "s2e-user: A sample of S2E User Side" - VERSION 6.0.0 -) - -cmake_minimum_required(VERSION 3.13) - -# build config -option(USE_HILS "Use HILS" OFF) -option(USE_C2A "Use C2A" OFF) - -# preprocessor -if(WIN32) - add_definitions(-DWIN32) -endif() - -## set directory path -set(S2E_CORE_DIR ../s2e-core) -if(NOT DEFINED EXT_LIB_DIR) - set(EXT_LIB_DIR ../ExtLibraries) -endif() -set(CSPICE_DIR ${EXT_LIB_DIR}/cspice) -set(NRLMSISE00_DIR ${EXT_LIB_DIR}/nrlmsise00) - -if(NOT DEFINED FLIGHT_SW_DIR) - set(FLIGHT_SW_DIR ../FlightSW) -endif() -if(NOT DEFINED C2A_NAME) - set(C2A_NAME "c2a_oss") -endif() - -## options to use C2A -if(USE_C2A) - set(C2A_DIR ${FLIGHT_SW_DIR}/${C2A_NAME}) - message("C2A dir: ${C2A_DIR}") - add_definitions(-DUSE_C2A) - add_definitions(-DSILS_FW) - #include_directories of C2A - include_directories(${C2A_DIR}/src) - include_directories(${S2E_CORE_DIR}/src/interface/sils) - - #add subdirectory - add_subdirectory(${C2A_DIR} C2A) -endif() - -## options to use HILS -if(USE_HILS AND WIN32) - add_definitions(-DUSE_HILS) - ## winsock2 - SET (CMAKE_FIND_LIBRARY_SUFFIXES ".lib") - find_library(WS2_32_LIB ws2_32.lib) - message("path for winsock2 is") - message(${WS2_32_LIB}) -endif() - -## include directories of s2e-core -include_directories(${CSPICE_DIR}/include) -include_directories(${NRLMSISE00_DIR}/src) -include_directories(${S2E_CORE_DIR}/src) - -## add_subdirectories -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_user.cpp - src/simulation/case/user_case.cpp - src/simulation/spacecraft/user_satellite.cpp - src/simulation/spacecraft/user_components.cpp -) -# Create executable file -add_executable(${PROJECT_NAME} ${SOURCE_FILES}) - -## cspice library -if(CYGWIN) - SET (CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a") - set(CSPICE_LIB_DIR ${CSPICE_DIR}/cspice_cygwin/lib) -elseif(UNIX) - if(BUILD_64BIT) - set(CSPICE_LIB_DIR ${CSPICE_DIR}/cspice_unix64/lib) - else() - set(CSPICE_LIB_DIR ${CSPICE_DIR}/cspice_unix/lib) - endif() -endif() - -if(WIN32) - SET (CMAKE_FIND_LIBRARY_SUFFIXES ".lib") - find_library(CSPICE_LIB - NAMES cspice.lib csupport.lib - PATHS ${CSPICE_DIR}/cspice_msvs/lib) -else() - find_library(CSPICE_LIB - NAMES cspice.a csupport.a - PATHS ${CSPICE_LIB_DIR}) -endif() -if(NOT CSPICE_LIB) - message(FATAL_ERROR "cspice not found in ${CSPICE_LIB_DIR}") -endif() - -## nrlmsise00 library -if(CYGWIN) - SET (CMAKE_FIND_LIBRARY_SUFFIXES ".a") - find_library(NRLMSISE00_LIB - NAMES libnrlmsise00.a - PATHS ${NRLMSISE00_DIR}/lib) -elseif(UNIX) - if(BUILD_64BIT) - find_library(NRLMSISE00_LIB - NAMES libnrlmsise00.a - PATHS ${NRLMSISE00_DIR}/lib64) - else() - find_library(NRLMSISE00_LIB - NAMES libnrlmsise00.a - PATHS ${NRLMSISE00_DIR}/lib) - endif() -elseif(WIN32) - SET (CMAKE_FIND_LIBRARY_SUFFIXES ".lib") - find_library(NRLMSISE00_LIB - NAMES libnrlmsise00.lib - PATHS ${NRLMSISE00_DIR}/lib) -endif() -if(NOT NRLMSISE00_LIB) - message(FATAL_ERROR "nrlmsise00 not found in ${EXT_LIB_DIR}") -endif() - -## Linking libraries -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 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} COMPONENT) - -## C2A integration -if(USE_C2A) - target_link_libraries(${PROJECT_NAME} C2A) -endif() - -## HILS -if(USE_HILS) - target_link_libraries(${PROJECT_NAME} ${WS2_32_LIB}) - set_target_properties(${PROJECT_NAME} PROPERTIES COMMON_LANGUAGE_RUNTIME "") - set_target_properties(COMPONENT PROPERTIES COMMON_LANGUAGE_RUNTIME "") - set_target_properties(DYNAMICS PROPERTIES COMMON_LANGUAGE_RUNTIME "") - set_target_properties(DISTURBANCE PROPERTIES COMMON_LANGUAGE_RUNTIME "") - 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 "") -endif() - -## Cmake debug -message("Cspice_LIB: " ${CSPICE_LIB}) -message("nrlmsise00_LIB: " ${NRLMSISE00_LIB}) - -include(${S2E_CORE_DIR}/common.cmake) diff --git a/Tutorials/SampleCodes/s2e-user/CMakeSettings.json b/Tutorials/SampleCodes/s2e-user/CMakeSettings.json deleted file mode 100644 index 54477e50..00000000 --- a/Tutorials/SampleCodes/s2e-user/CMakeSettings.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "configurations": [ - { - "name": "Win32", - "generator": "Visual Studio 17 2022", - "configurationType": "Debug", - "inheritEnvironments": [ - "msvc_x86" - ], - "buildRoot": "${thisFileDir}\\CMakeBuilds", - "installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}", - "cmakeCommandArgs": "", - "buildCommandArgs": "", - "ctestCommandArgs": "" - } - ] -} \ No newline at end of file diff --git a/Tutorials/SampleCodes/s2e-user/data/initialize_files/components/gyro_sensor_xxx.ini b/Tutorials/SampleCodes/s2e-user/data/initialize_files/components/gyro_sensor_xxx.ini deleted file mode 100644 index 84f8948a..00000000 --- a/Tutorials/SampleCodes/s2e-user/data/initialize_files/components/gyro_sensor_xxx.ini +++ /dev/null @@ -1,50 +0,0 @@ -[GYRO_SENSOR_1] -prescaler = 10 - -// Quaternion from body frame to component frame -// Including misalignment -quaternion_b2c(0) = 0.0 -quaternion_b2c(1) = 0.0 -quaternion_b2c(2) = 0.0 -quaternion_b2c(3) = 1.0 - -[SENSOR_BASE_GYRO_SENSOR_1] -// Scale Factor Matrix (3×3) -// (0) = (0,0), (1) = (0,1), (2) = (0,2), -scale_factor_c(0) = 1.0 -scale_factor_c(1) = 0.0 -scale_factor_c(2) = 0.0 -scale_factor_c(3) = 0.0 -scale_factor_c(4) = 1.0 -scale_factor_c(5) = 0.0 -scale_factor_c(6) = 0.0 -scale_factor_c(7) = 0.0 -scale_factor_c(8) = 1.0 - -// Constant bias noise at component frame [rad/s] -constant_bias_c_rad_s(0) = 1.0e-3 -constant_bias_c_rad_s(1) = -1.0e-3 -constant_bias_c_rad_s(2) = 2.0e-3 - -// Standard deviation for random walk noise[rad/s] -random_walk_standard_deviation_c_rad_s(0) = 0.0 -random_walk_standard_deviation_c_rad_s(1) = 0.0 -random_walk_standard_deviation_c_rad_s(2) = 0.0 - -// Limit of random walk noise[rad/s] -random_walk_limit_c_rad_s(0) = 0.0 -random_walk_limit_c_rad_s(1) = 0.0 -random_walk_limit_c_rad_s(2) = 0.0 - -// Standard deviation of normal random noise[rad/s] -normal_random_standard_deviation_c_rad_s(0) = 1e-3 -normal_random_standard_deviation_c_rad_s(1) = 1e-3 -normal_random_standard_deviation_c_rad_s(2) = 1e-3 - -// Range [rad/s] -range_to_constant_rad_s = 5.0 // smaller than Range_to_zero -range_to_zero_rad_s = 10.0 - -[POWER_PORT] -minimum_voltage_V = 3.3 // V -assumed_power_consumption_W = 1.0 //W diff --git a/Tutorials/SampleCodes/s2e-user/data/initialize_files/user_satellite.ini b/Tutorials/SampleCodes/s2e-user/data/initialize_files/user_satellite.ini deleted file mode 100644 index 619e1d77..00000000 --- a/Tutorials/SampleCodes/s2e-user/data/initialize_files/user_satellite.ini +++ /dev/null @@ -1,138 +0,0 @@ -[ATTITUDE] -// Attitude propagation mode -// RK4 : Attitude Propagation with RK4 including disturbances and control torque -// CONTROLLED : Attitude Calculation with Controlled Attitude mode. All disturbances and control torque are ignored. -propagate_mode = RK4 - -// 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 = MANUAL - -// Initial angular velocity at body frame [rad/s] -initial_angular_velocity_b_rad_s(0) = 0.0 -initial_angular_velocity_b_rad_s(1) = 0.0 -initial_angular_velocity_b_rad_s(2) = 0.0 - -// Initial quaternion inertial frame to body frame (real part, imaginary part) -// This value also used in INERTIAL_STABILIZE mode of ControlledAttitude -initial_quaternion_i2b(0) = 0.0 -initial_quaternion_i2b(1) = 0.0 -initial_quaternion_i2b(2) = 0.0 -initial_quaternion_i2b(3) = 1.0 - -// Initial torque at body frame [Nm] -// Note: The initial torque added just for the first propagation step -initial_torque_b_Nm(0) = +0.000 -initial_torque_b_Nm(1) = -0.000 -initial_torque_b_Nm(2) = 0.000 - -[CONTROLLED_ATTITUDE] -// Mode definitions -// INERTIAL_STABILIZE -// SUN_POINTING -// EARTH_CENTER_POINTING -// VELOCITY_DIRECTION_POINTING -// ORBIT_NORMAL_POINTING -main_mode = INERTIAL_STABILIZE -sub_mode = SUN_POINTING - -// Pointing direction @ body frame for main pointing mode -main_pointing_direction_b(0) = 1.0 -main_pointing_direction_b(1) = 0.0 -main_pointing_direction_b(2) = 0.0 - -// Pointing direction @ body frame for sub pointing mode -// main_pointing_direction_b and sub_pointing_direction_b should separate larger than 30 degrees. -sub_pointing_direction_b(0) = 0.0 -sub_pointing_direction_b(1) = 0.0 -sub_pointing_direction_b(2) = 1.0 - - -[ORBIT] -calculation = ENABLE -logging = ENABLE - -// Orbit propagation mode -// RK4 : RK4 propagation with disturbances and thruster maneuver -// SGP4 : SGP4 propagation using TLE without thruster maneuver -// RELATIVE : Relative dynamics (for formation flying simulation) -// KEPLER : Kepler orbit propagation without disturbances and thruster maneuver -// ENCKE : Encke orbit propagation with disturbances and thruster maneuver -propagate_mode = RK4 - -// Orbit initialize mode for RK4, KEPLER, and ENCKE -// DEFAULT : Use default initialize method (RK4 and ENCKE use pos/vel, KEPLER uses init_mode_kepler) -// POSITION_VELOCITY_I : Initialize with position and velocity in the inertial frame -// ORBITAL_ELEMENTS : Initialize with orbital elements -initialize_mode = POSITION_VELOCITY_I - -// Initial value definition for POSITION_VELOCITY_I initialize mode //////// -initial_position_i_m(0) = -2111769.7723711144 -initial_position_i_m(1) = -5360353.2254375768 -initial_position_i_m(2) = 3596181.6497774957 - -initial_velocity_i_m_s(0) = 4200.4344740455268 -initial_velocity_i_m_s(1) = -4637.540129059361 -initial_velocity_i_m_s(2) = -4429.2361258448807 -/////////////////////////////////////////////////////////////////////////// - -// Initial value definition for ORBITAL_ELEMENTS initialize mode //////// -semi_major_axis_m = 6794500.0 -eccentricity = 0.0015 -inclination_rad = 0.9012 -raan_rad = 0.1411 -argument_of_perigee_rad = 1.7952 -epoch_jday = 2.458940966402607e6 -/////////////////////////////////////////////////////////////////////////////// - - -// Settings for SGP4 /////////////////////////////////////////////// -// TLE -// Example: ISS -tle1=1 25544U 98067A 20076.51604214 .00016717 00000-0 10270-3 0 9005 -tle2=2 25544 51.6412 86.9962 0006063 30.9353 329.2153 15.49228202 17647 -// World Geodetic System -wgs = 2 // 0: wgs72old, 1: wgs72, 2: wgs84 -////////////////////////////////////////////////////////////////////////// - -// Settings for relative orbit propagation //////////////////////////// -// Relative Orbit Update Method (0 means RK4, 1 means STM) -relative_orbit_update_method = 0 -// RK4 Relative Dynamics model type (only valid for RK4 update) -// 0: Hill -relative_dynamics_model_type = 0 -// STM Relative Dynamics model type (only valid for STM update) -// 0: HCW -stm_model_type = 0 -// Initial satellite position relative to the reference satellite in LVLH frame[m] -// * The coordinate system is defined at [PLANET_SELECTION] in SampleSimBase.ini -initial_relative_position_lvlh_m(0) = 0.0 -initial_relative_position_lvlh_m(1) = 100.0 -initial_relative_position_lvlh_m(2) = 0.0 -// initial satellite velocity relative to the reference satellite in LVLH frame[m/s] -initial_relative_velocity_lvlh_m_s(0) = 0.0 -initial_relative_velocity_lvlh_m_s(1) = 0.0 -initial_relative_velocity_lvlh_m_s(2) = 0.0 -// information of reference satellite -reference_satellite_id = 1 -/////////////////////////////////////////////////////////////////////////////// - -// Settings for Encke mode /////////// -error_tolerance = 0.0001 -/////////////////////////////////////////////////////////////////////////////// - - -[THERMAL] -calculation = DISABLE -debug = 0 -thermal_file_directory = ../../data/initialize_files/thermal_csv_files/ - -[SETTING_FILES] -local_environment_file = ../../data/initialize_files/user_satellite_local_environment.ini -disturbance_file = ../../data/initialize_files/user_satellite_disturbance.ini -structure_file = ../../data/initialize_files/user_satellite_structure.ini - - -[COMPONENT_FILES] -// Users can add the path for component initialize files here. diff --git a/Tutorials/SampleCodes/s2e-user/data/initialize_files/user_satellite_disturbance.ini b/Tutorials/SampleCodes/s2e-user/data/initialize_files/user_satellite_disturbance.ini deleted file mode 100644 index 32da0bd1..00000000 --- a/Tutorials/SampleCodes/s2e-user/data/initialize_files/user_satellite_disturbance.ini +++ /dev/null @@ -1,47 +0,0 @@ -[GEOPOTENTIAL] -// Enable only when the center object is defined as the Earth -calculation = DISABLE -logging = ENABLE -degree = 4 -coefficients_file_path = ../../../ExtLibraries/GeoPotential/egm96_to360.ascii - - -[MAGNETIC_DISTURBANCE] -// Enable only when the center object is defined as the Earth -calculation = ENABLE -logging = ENABLE - - -[AIR_DRAG] -// Enable only when the center object is defined as the Earth -calculation = ENABLE -logging = ENABLE - -// Condition of air drag -wall_temperature_degC = 30 // Surface Temperature[degC] -molecular_temperature_degC = 3 // Atmosphere Temperature[degC] -molecular_weight_g_mol = 18.0 // Molecular weight of the thermosphere[g/mol] - - -[SOLAR_RADIATION_PRESSURE_DISTURBANCE] -calculation = ENABLE -logging = ENABLE - - -[GRAVITY_GRADIENT] -calculation = ENABLE -logging = ENABLE - - -[THIRD_BODY_GRAVITY] -calculation = DISABLE -logging = ENABLE - -// The number of gravity-generating bodies other than the central body -number_of_third_body = 1 - -// List of gravity-generating bodies other than the central body -// All these bodies must be included in the "selected_body_name" of "[CelestialInformation]" -third_body_name(0) = SUN -third_body_name(1) = MOON -third_body_name(2) = MARS diff --git a/Tutorials/SampleCodes/s2e-user/data/initialize_files/user_satellite_local_environment.ini b/Tutorials/SampleCodes/s2e-user/data/initialize_files/user_satellite_local_environment.ini deleted file mode 100644 index 09921765..00000000 --- a/Tutorials/SampleCodes/s2e-user/data/initialize_files/user_satellite_local_environment.ini +++ /dev/null @@ -1,34 +0,0 @@ -[MAGNETIC_FIELD_ENVIRONMENT] -calculation = ENABLE -logging = ENABLE -coefficient_file = ../../../s2e-core/src/library/external/igrf/igrf13.coef -magnetic_field_random_walk_standard_deviation_nT = 10.0 -magnetic_field_random_walk_limit_nT = 400.0 -magnetic_field_white_noise_standard_deviation_nT = 50.0 - - -[SOLAR_RADIATION_PRESSURE_ENVIRONMENT] -calculation = ENABLE -logging = ENABLE - - -[ATMOSPHERE] -calculation = ENABLE -logging = ENABLE - -// Atmosphere model -// STANDARD: Model using scale height, NRLMSISE00: NRLMSISE00 model -model = STANDARD -nrlmsise00_table_file = ../../../ExtLibraries/nrlmsise00/table/SpaceWeather-v1.2.txt -// Whether using user-defined f10.7 and ap value -// Ref of f10.7: https://www.swpc.noaa.gov/phenomena/f107-cm-radio-emissions -// Ref of ap: http://wdc.kugi.kyoto-u.ac.jp/kp/kpexp-j.html -is_manual_parameter_used = ENABLE -manual_daily_f107 = 150.0 // User defined f10.7 (1 day) -manual_average_f107 = 150.0 // User defined f10.7 (30 days average) -manual_ap = 3.0 // User defined ap -air_density_standard_deviation = 0.0 // Standard deviation of the air density - - -[LOCAL_CELESTIAL_INFORMATION] -logging = ENABLE \ No newline at end of file diff --git a/Tutorials/SampleCodes/s2e-user/data/initialize_files/user_satellite_structure.ini b/Tutorials/SampleCodes/s2e-user/data/initialize_files/user_satellite_structure.ini deleted file mode 100644 index b7c707cb..00000000 --- a/Tutorials/SampleCodes/s2e-user/data/initialize_files/user_satellite_structure.ini +++ /dev/null @@ -1,115 +0,0 @@ -// -// The origin of all vectors defined here is the body-fixed frame. -// Users can define the origin of the body-fixed frame by themselves. -// If users want to define the origin as the center of gravity, they need to set center_of_gravity_b_m = zero vector. -// If users want to define the origin as a specific point, they need to set all vectors to suit their definition carefully. -// - -[KINEMATIC_PARAMETERS] -// Inertia Tensor @ body fixed frame [kg・m2] -inertia_tensor_kgm2(0) = 0.1 // I_xx -inertia_tensor_kgm2(1) = 0.0 // I_xy -inertia_tensor_kgm2(2) = 0.0 // I_xz -inertia_tensor_kgm2(3) = 0.0 // I_yx -inertia_tensor_kgm2(4) = 0.1 // I_yy -inertia_tensor_kgm2(5) = 0.0 // I_yz -inertia_tensor_kgm2(6) = 0.0 // I_zx -inertia_tensor_kgm2(7) = 0.0 // I_zy -inertia_tensor_kgm2(8) = 0.1 // I_zz - -mass_kg = 14 - -// Position vector of the center of gravity @ the body frame [m] -center_of_gravity_b_m(0) = 0.01 -center_of_gravity_b_m(1) = 0.01 -center_of_gravity_b_m(2) = 0.01 - -[SURFACES] -number_of_surfaces = 6 - -// Area of each surface [m^2] -area_0_m2 = 0.25 -area_1_m2 = 0.25 -area_2_m2 = 0.25 -area_3_m2 = 0.25 -area_4_m2 = 0.25 -area_5_m2 = 0.25 - -// Position vector of each surface geometric center @ body frame [m] -position_0_b_m(0) = 0.25 -position_0_b_m(1) = 0.0 -position_0_b_m(2) = 0.0 -position_1_b_m(0) = -0.25 -position_1_b_m(1) = 0.0 -position_1_b_m(2) = 0.0 -position_2_b_m(0) = 0.0 -position_2_b_m(1) = 0.25 -position_2_b_m(2) = 0.0 -position_3_b_m(0) = 0.0 -position_3_b_m(1) = -0.25 -position_3_b_m(2) = 0.0 -position_4_b_m(0) = 0.0 -position_4_b_m(1) = 0.0 -position_4_b_m(2) = 0.25 -position_5_b_m(0) = 0.0 -position_5_b_m(1) = 0.0 -position_5_b_m(2) = -0.25 - -// Normal vector of each surface @ body frame -normal_vector_0_b(0) = 1.0 -normal_vector_0_b(1) = 0.0 -normal_vector_0_b(2) = 0.0 -normal_vector_1_b(0) = -1.0 -normal_vector_1_b(1) = 0.0 -normal_vector_1_b(2) = 0.0 -normal_vector_2_b(0) = 0.0 -normal_vector_2_b(1) = 1.0 -normal_vector_2_b(2) = 0.0 -normal_vector_3_b(0) = 0.0 -normal_vector_3_b(1) = -1.0 -normal_vector_3_b(2) = 0.0 -normal_vector_4_b(0) = 0.0 -normal_vector_4_b(1) = 0.0 -normal_vector_4_b(2) = 1.0 -normal_vector_5_b(0) = 0.0 -normal_vector_5_b(1) = 0.0 -normal_vector_5_b(2) = -1.0 - -// Total reflectance for the Sun spectrum -reflectivity_0 = 0.4 -reflectivity_1 = 0.4 -reflectivity_2 = 0.4 -reflectivity_3 = 0.4 -reflectivity_4 = 0.4 -reflectivity_5 = 0.4 - -// Specularity for the Sun spectrum -specularity_0 = 0.4 -specularity_1 = 0.4 -specularity_2 = 0.4 -specularity_3 = 0.4 -specularity_4 = 0.4 -specularity_5 = 0.4 - -// Specularity for air drag -air_specularity_0 = 0.4 -air_specularity_1 = 0.4 -air_specularity_2 = 0.4 -air_specularity_3 = 0.4 -air_specularity_4 = 0.4 -air_specularity_5 = 0.4 - -[RESIDUAL_MAGNETIC_MOMENT] -// Constant component of Residual Magnetic Moment(RMM) [A・m^2] -rmm_constant_b_Am2(0) = 0.04 -rmm_constant_b_Am2(1) = 0.04 -rmm_constant_b_Am2(2) = 0.04 - -// RMM Random Walk Speed [A・m^2] -rmm_random_walk_speed_Am2 = 1.0E-5 - -// RMM Random Walk Limit [A・m^2] -rmm_random_walk_limit_Am2 = 1.0E-3 - -// RMM White Noise Standard deviation [A・m^2] -rmm_white_noise_standard_deviation_Am2 = 5.0E-5 diff --git a/Tutorials/SampleCodes/s2e-user/data/initialize_files/user_simulation_base.ini b/Tutorials/SampleCodes/s2e-user/data/initialize_files/user_simulation_base.ini deleted file mode 100644 index 66d7af6d..00000000 --- a/Tutorials/SampleCodes/s2e-user/data/initialize_files/user_simulation_base.ini +++ /dev/null @@ -1,134 +0,0 @@ -[TIME] -// Simulation start time [UTC] -simulation_start_time_utc = 2020/01/01 12:00:00.0 - -// Simulation duration [sec] -simulation_duration_s = 200 - -// Simulation step time [sec] -// Minimum time step for the entire simulation -simulation_step_s = 0.1 - -// Attitude Update Period [sec] -// Attitude is updated at the period specified here -attitude_update_period_s = 0.1 // should be larger than 'simulation_step_s' - -// Attitide Δt for Runge-Kutt method [sec] -// This must be smaller than 'attitude_update_period_s' -attitude_integral_step_s = 0.001 - -// Orbit Update Period [sec] -// Orbit is updated at the period specified here -orbit_update_period_s = 0.1 // should be larger than 'simulation_step_s' - -// Orbit Δt for Runge-Kutta method [sec] -// This must be smaller than 'orbit_ppdate_period_s' -orbit_integral_step_s = 0.1 - -// Thermal Update Period [sec] -// Thermal is updated at the period specified here -thermal_update_period_s = 0.1 // should be larger than 'simulation_step_s' - -// Thermal Δt for Runge-Kutta method [sec] -// This must be smaller than 'thermal_update_period_s' -thermal_integral_step_s = 0.1 - -// Component Update Period [sec] -component_update_period_s = 0.1 // should be larger than 'simulation_step_s' - -// Log Output Period [sec] -log_output_period_s = 0.1 // should be larger than 'simulation_step_s' - -// Simulation speed -// 0: as fast as possible, 1: real-time, >1: faster than real-time, <1: slower than real-time -simulation_speed_setting = 0 - - -[MONTE_CARLO_EXECUTION] -// Whether Monte-Carlo Simulation is executed or not -monte_carlo_enable = DISABLE - -// Whether you want output the log file for each step -log_enable = ENABLE - -// Number of execution -number_of_executions = 100 - - -[MONTE_CARLO_RANDOMIZATION] -parameter(0) = attitude0.debug -attitude0.debug.randomization_type = CartesianUniform -attitude0.debug.mean_or_min(0) = 0.0 -attitude0.debug.mean_or_min(1) = 0.0 -attitude0.debug.mean_or_min(2) = 0.0 -attitude0.debug.sigma_or_max(0) = 10.0 -attitude0.debug.sigma_or_max(1) = 10.0 -attitude0.debug.sigma_or_max(2) = 10.0 - -parameter(1) = attitude0.omega_b -attitude0.omega_b.randomization_type = NoRandomization -attitude0.omega_b.mean_or_min(0) = 0.0 -attitude0.omega_b.mean_or_min(1) = 0.0 -attitude0.omega_b.mean_or_min(2) = 0.0 -attitude0.omega_b.sigma_or_max(0) = 0.05817764 // 3-sigma = 10 [deg/s] -attitude0.omega_b.sigma_or_max(1) = 0.05817764 // 3-sigma = 10 [deg/s] -attitude0.omega_b.sigma_or_max(2) = 0.05817764 // 3-sigma = 10 [deg/s] - - -[CELESTIAL_INFORMATION] -// Whether global celestial information is logged or not -logging = ENABLE - -// Definition of Inertial frame -inertial_frame = J2000 -// The center object is also used to define the gravity constant of the center body -center_object = EARTH -aberration_correction = NONE - -// Earth Rotation model -// Idle:no motion, Simple:rotation only, Full:full-dynamics -rotation_mode = Simple - -// Definition of calculation celestial bodies -number_of_selected_body = 3 -selected_body_name(0) = EARTH -selected_body_name(1) = SUN -selected_body_name(2) = MOON -selected_body_name(3) = MERCURY -selected_body_name(4) = VENUS -selected_body_name(5) = MARS -selected_body_name(6) = JUPITER -selected_body_name(7) = SATURN -selected_body_name(8) = URANUS -selected_body_name(9) = NEPTUNE -selected_body_name(10) = PLUTO - -[CSPICE_KERNELS] -// CSPICE Kernel files definition -tls = ../../../ExtLibraries/cspice/generic_kernels/lsk/naif0010.tls -tpc1 = ../../../ExtLibraries/cspice/generic_kernels/pck/de-403-masses.tpc -tpc2 = ../../../ExtLibraries/cspice/generic_kernels/pck/gm_de431.tpc -tpc3 = ../../../ExtLibraries/cspice/generic_kernels/pck/pck00010.tpc -bsp = ../../../ExtLibraries/cspice/generic_kernels/spk/planets/de430.bsp - - -[HIPPARCOS_CATALOGUE] -catalogue_file_path = ../../../ExtLibraries/HipparcosCatalogue/hip_main.csv -max_magnitude = 3.0 // Max magnitude to read from Hip catalog -calculation = DISABLE -logging = DISABLE - - -[RANDOMIZE] -// Seed of randam. When this value is 0, the seed will be varied by time. -rand_seed = 0x11223344 - - -[SIMULATION_SETTINGS] -// Whether the ini files are saved or not -save_initialize_files = ENABLE - -number_of_simulated_spacecraft = 1 -number_of_simulated_ground_station = 0 -spacecraft_file(0) = ../../data/initialize_files/user_satellite.ini -log_file_save_directory = ../../data/logs/ diff --git a/Tutorials/SampleCodes/s2e-user/data/logs/.gitkeep b/Tutorials/SampleCodes/s2e-user/data/logs/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/Tutorials/SampleCodes/s2e-user/src/s2e_user.cpp b/Tutorials/SampleCodes/s2e-user/src/s2e_user.cpp deleted file mode 100644 index 1751142c..00000000 --- a/Tutorials/SampleCodes/s2e-user/src/s2e_user.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/** - * @file s2e_user.cpp - * @brief The main file of S2E-USER - */ - -#ifdef WIN32 -#define _WINSOCKAPI_ // stops windows.h including winsock.h -#include -#include -#endif - -#include -#include -#include -#include - -// Simulator includes -#include "library/logger/logger.hpp" - -// Add custom include files -#include "./simulation/case/user_case.hpp" - -void print_path(std::string path) { -#ifdef WIN32 - std::cout << path << std::endl; -#else - const char *rpath = realpath(path.c_str(), NULL); - if (rpath) { - std::cout << rpath << std::endl; - free((void *)rpath); - } -#endif -} - -#ifdef WIN32 -int main(int argc, _TCHAR *argv[]) -#else -int main(int argc, char *argv[]) -#endif -{ - using namespace std::chrono; - - system_clock::time_point start, end; - start = system_clock::now(); - - std::string data_path = "../../data/"; - std::string ini_file = "../../data/initialize_files/user_simulation_base.ini"; - - // Parsing arguments: SatAttSim [ini_file] - if (argc == 0) { - std::cout << "Usage: SatAttSim [ini file path]" << std::endl; - return EXIT_FAILURE; - } - if (argc > 1) { - data_path = std::string(argv[1]); - if (data_path.back() != '/') data_path += "/"; - } - if (argc > 2) { - ini_file = std::string(argv[2]); - } - - std::cout << "Starting simulation..." << std::endl; - std::cout << "\tData path: "; - print_path(data_path); - std::cout << "\tIni file: "; - print_path(ini_file); - - auto simulation_case = UserCase(ini_file); - simulation_case.Initialize(); - simulation_case.Main(); - - end = system_clock::now(); - double time = static_cast(duration_cast(end - start).count() / 1000000.0); - std::cout << std::endl << "Simulation execution time: " << time << "sec" << std::endl << std::endl; - - return EXIT_SUCCESS; -} diff --git a/Tutorials/SampleCodes/s2e-user/src/simulation/case/user_case.cpp b/Tutorials/SampleCodes/s2e-user/src/simulation/case/user_case.cpp deleted file mode 100644 index 8a64d6a4..00000000 --- a/Tutorials/SampleCodes/s2e-user/src/simulation/case/user_case.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/** - * @file user_case.cpp - * @brief Example of user defined simulation case - */ - -#include "user_case.hpp" - -UserCase::UserCase(const std::string initialise_base_file) : SimulationCase(initialise_base_file) {} - -UserCase::~UserCase() { delete spacecraft_; } - -void UserCase::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 UserSatellite(&simulation_configuration_, global_environment_, spacecraft_id); - - // Register the log output - spacecraft_->LogSetup(*(simulation_configuration_.main_logger_)); -} - -void UserCase::UpdateTargetObjects() { - // Spacecraft Update - spacecraft_->Update(&(global_environment_->GetSimulationTime())); -} - -std::string UserCase::GetLogHeader() const { - std::string str_tmp = ""; - return str_tmp; -} - -std::string UserCase::GetLogValue() const { - std::string str_tmp = ""; - - return str_tmp; -} diff --git a/Tutorials/SampleCodes/s2e-user/src/simulation/case/user_case.hpp b/Tutorials/SampleCodes/s2e-user/src/simulation/case/user_case.hpp deleted file mode 100644 index ee99b864..00000000 --- a/Tutorials/SampleCodes/s2e-user/src/simulation/case/user_case.hpp +++ /dev/null @@ -1,57 +0,0 @@ -/** - * @file user_case.hpp - * @brief Example of user defined simulation case - */ - -#ifndef S2E_SIMULATION_CASE_USER_CASE_HPP_ -#define S2E_SIMULATION_CASE_USER_CASE_HPP_ - -#include <./simulation/case/simulation_case.hpp> - -#include "../spacecraft/user_satellite.hpp" - -/** - * @class UserCase - * @brief An example of user defined simulation case - */ -class UserCase : public SimulationCase { - public: - /** - * @fn UserCase - * @brief Constructor - */ - UserCase(const std::string initialise_base_file); - /** - * @fn ~UserCase - * @brief Destructor - */ - virtual ~UserCase(); - - /** - * @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: - UserSatellite *spacecraft_; //!< Instance of spacecraft - - /** - * @fn InitializeTargetObjects - * @brief Override function of InitializeTargetObjects in SimulationCase - */ - void InitializeTargetObjects(); - - /** - * @fn UpdateTargetObjects - * @brief Override function of Main in SimulationCase - */ - void UpdateTargetObjects(); -}; - -#endif // S2E_SIMULATION_CASE_USER_CASE_HPP_ diff --git a/Tutorials/SampleCodes/s2e-user/src/simulation/spacecraft/user_components.cpp b/Tutorials/SampleCodes/s2e-user/src/simulation/spacecraft/user_components.cpp deleted file mode 100644 index cad3fc6b..00000000 --- a/Tutorials/SampleCodes/s2e-user/src/simulation/spacecraft/user_components.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @file user_components.cpp - * @brief An example of user side components management installed on a spacecraft - */ - -#include "user_components.hpp" - -#include - -UserComponents::UserComponents(const Dynamics *dynamics, Structure *structure, const LocalEnvironment *local_environment, - const GlobalEnvironment *global_environment, const SimulationConfiguration *configuration, - ClockGenerator *clock_generator, const unsigned int spacecraft_id) - : configuration_(configuration), - dynamics_(dynamics), - structure_(structure), - local_environment_(local_environment), - global_environment_(global_environment) { - obc_ = new OnBoardComputer(clock_generator); -} - -UserComponents::~UserComponents() { - // OBC must be deleted the last since it has com ports - delete obc_; -} - -Vector<3> UserComponents::GenerateForce_b_N() { - // There is no orbit control component, so it remains 0 - Vector<3> force_b_N(0.0); - return force_b_N; -} - -Vector<3> UserComponents::GenerateTorque_b_Nm() { - // No attitude control component - Vector<3> torque_b_Nm(0.0); - return torque_b_Nm; -} - -void UserComponents::LogSetup(Logger &logger) { - // Users can set log output when they need component log - UNUSED(logger); -} diff --git a/Tutorials/SampleCodes/s2e-user/src/simulation/spacecraft/user_components.hpp b/Tutorials/SampleCodes/s2e-user/src/simulation/spacecraft/user_components.hpp deleted file mode 100644 index a9146e40..00000000 --- a/Tutorials/SampleCodes/s2e-user/src/simulation/spacecraft/user_components.hpp +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @file sample_components.hpp - * @brief An example of user side components management installed on a spacecraft - */ - -#ifndef S2E_SIMULATION_SPACECRAFT_USER_COMPONENTS_HPP_ -#define S2E_SIMULATION_SPACECRAFT_USER_COMPONENTS_HPP_ - -#include -#include -#include -#include -#include - -// include for components -#include - -class UserComponents : public InstalledComponents { - public: - UserComponents(const Dynamics *dynamics, Structure *structure, const LocalEnvironment *local_environment, - const GlobalEnvironment *global_environment, const SimulationConfiguration *configuration, ClockGenerator *clock_generator, - const unsigned int spacecraft_id); - ~UserComponents(); - libra::Vector<3> GenerateForce_b_N(); - libra::Vector<3> GenerateTorque_b_Nm(); - void LogSetup(Logger &logger); - - private: - // Components - OnBoardComputer *obc_; //!< Onboard Computer - - // States - const SimulationConfiguration *configuration_; //!< Simulation settings - const Dynamics *dynamics_; //!< Dynamics information of the spacecraft - Structure *structure_; //!< Structure information of the spacecraft - const LocalEnvironment *local_environment_; //!< Local environment information around the spacecraft - const GlobalEnvironment *global_environment_; //!< Global environment information -}; - -#endif // S2E_SIMULATION_SPACECRAFT_USER_COMPONENTS_HPP_ - diff --git a/Tutorials/SampleCodes/s2e-user/src/simulation/spacecraft/user_satellite.cpp b/Tutorials/SampleCodes/s2e-user/src/simulation/spacecraft/user_satellite.cpp deleted file mode 100644 index b69491b1..00000000 --- a/Tutorials/SampleCodes/s2e-user/src/simulation/spacecraft/user_satellite.cpp +++ /dev/null @@ -1,15 +0,0 @@ -/** - * @file user_satellite.cpp - * @brief An example of user side spacecraft class - */ - -#include "user_satellite.hpp" - -#include "user_components.hpp" - -UserSatellite::UserSatellite(const SimulationConfiguration *simulation_configuration, const GlobalEnvironment *global_environment, - const unsigned int spacecraft_id) - : Spacecraft(simulation_configuration, global_environment, spacecraft_id) { - components_ = - new UserComponents(dynamics_, structure_, local_environment_, global_environment, simulation_configuration, &clock_generator_, spacecraft_id); -} diff --git a/Tutorials/SampleCodes/s2e-user/src/simulation/spacecraft/user_satellite.hpp b/Tutorials/SampleCodes/s2e-user/src/simulation/spacecraft/user_satellite.hpp deleted file mode 100644 index 83c6b9a4..00000000 --- a/Tutorials/SampleCodes/s2e-user/src/simulation/spacecraft/user_satellite.hpp +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @file user_satellite.hpp - * @brief An example of user side spacecraft class - */ - -#ifndef S2E_SIMULATION_SPACECRAFT_USER_SATELLITE_HPP_ -#define S2E_SIMULATION_SPACECRAFT_USER_SATELLITE_HPP_ - -#include -#include "user_components.hpp" - -/** - * @class UserSatellite - * @brief An example of user side spacecraft class - */ -class UserSatellite : public Spacecraft -{ -public: - /** - * @fn UserSatellite - * @brief Constructor - */ - UserSatellite(const SimulationConfiguration *simulation_configuration, const GlobalEnvironment *global_environment, - const unsigned int spacecraft_id); - -private: -}; - -#endif // S2E_SIMULATION_SPACECRAFT_USER_SATELLITE_HPP_ -