diff --git a/General/DocumentFormat.md b/General/DocumentFormat.md index bea48565..690fae43 100644 --- a/General/DocumentFormat.md +++ b/General/DocumentFormat.md @@ -6,63 +6,62 @@ - Because GitHub started to support math description ([link](https://github.blog/2022-05-19-math-support-in-markdown/)), we need to describe equations suit with the rule of GitHub and [MathJax](https://www.mathjax.org/). ## 1. Overview -1. Functions - - Write an overview of functions to be realized using the class or library here clearly. +### 1. Features +- Write an overview of features to be realized using the class or library here clearly. -2. Related files - - Enumerate all related codes and input files here +### 2. Related files +- Enumerate all related codes and input files here -3. How to use - - Write how to use the class or functions +### 3. How to use +- Write how to use the class or functions ## 2. Explanation of Algorithm - Write important algorithms for the class, the library, or each function. Please use equations, figures, reference papers for easy understanding. +Write important algorithms for the class, the library, or each function. Please use equations, figures, reference papers for easy understanding. -1. Name of function - 1. Overview +### 1. Name of class, structure, and function +#### 1. Overview +- Please summarize the - 2. Inputs and Outputs +#### 2. Inputs and Outputs +- Please list up inputs and outputs - 3. Algorithm - - Math description - - please use equations as - $$\dot{\boldsymbol{x}}=f(\boldsymbol{x},t)$$ - or - ```math - \dot{\boldsymbol{x}}=f(\boldsymbol{x},t) - ``` - - you can also use inline equation as $x=y$ +#### 3. Algorithm +- Please use math description when you need as follows +$$\dot{\boldsymbol{x}}=f(\boldsymbol{x},t)$$ - 4. Note +```math +\dot{\boldsymbol{x}}=f(\boldsymbol{x},t) +``` +- you can also use inline equation as $x=y$ -2. Name of function +#### 4. Note - 1. Overview - 2. Inputs and Outputs - 3. Algorithm - 4. Note +### 2. Name of function +#### 1. Overview +#### 2. Inputs and Outputs +#### 3. Algorithm +#### 4. Note -3. ... - - 1. ... +### 3. Name of function +#### 1. Overview ## 3. Results of verifications -1. Name of verification case - 1. Overview - - please write a reason why the author does the verification - - 2. conditions for the verification - 1. input files - 2. initial values - - 3. results - - please use figures to show the results clearly - - Upload the figure files in `figs` directory - - **Note:** the figure size should be smaller than several hundred K Bytes - - Smaller is better - - Link the figure file with **relative path** +### 1. Name of verification case +#### 1. Overview +- please write a reason why the author does the verification + +#### 2. conditions for the verification +- input files +- initial values + +#### 3. result +- please use figures to show the results clearly +- Upload the figure files in `figs` directory + - **Note:** the figure size should be smaller than several hundred K Bytes + - Smaller is better + - Link the figure file with **relative path** ## 4. References diff --git a/README.md b/README.md index c7618f46..430080bc 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 v7.0.0](https://github.com/ut-issl/s2e-core/releases/tag/v7.0.0) + - The Current version supports [s2e-core v7.2.0](https://github.com/ut-issl/s2e-core/releases/tag/v7.2.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. @@ -13,7 +13,7 @@ - Documents for the latest `develop` branch of s2e-core - This version is only for s2e-core developers - feature/branch-name - - Writing documents before merge with the `develop` + - Writing documents before merging with the `develop` - hotfix/branch-name - Fix typos, misdescription, etc. - If you have any questions or comments for S2E, feel free to ask us on the [discussions page of s2e-core](https://github.com/ut-issl/s2e-core/discussions). @@ -24,24 +24,24 @@ 1. [Coding Convention of S2E](./General/CodingConvention.md) 1. [Naming Rule for User Interface](./General/NamingRuleForUserInterface.md) 1. [Format of S2E Documents](./General/DocumentFormat.md) - 1. Mandatory set up and How to Build the S2E + 1. Mandatory Setup and How to Build the S2E 1. [How to build with Visual Studio](./General/HowToCompileWithVisualStudio.md) 1. [How to build with Ubuntu in Docker](./General/HowToCompileWithUbuntuInDocker.md) for **both Windows and Mac** users 1. How to build with other compilers will be written 1. Set up of External Libraries **NOTE**: Currently, this setting sequence is included in the mandatory setups described above. So users don't need to see the following documents. - 1. [How to download CSPICE Library](./General/HowToDwnloadCSPCElibrary.md) + 1. [How to download the CSPICE Library](./General/HowToDwnloadCSPCElibrary.md) 1. [How to download and make NRLMSISE00 Library](./General/HowToDownloadNRLMSISE00library.md) 1. Visualization of Simulation Results 1. [How to Visualize Simulation Results](./General/HowToVisualizeSimulationResults.md) 1. Tutorials - - We strongly recommend to sequentially follow the tutorials without external hardware at first. + - We strongly recommend sequentially following 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. + - Users can refer to 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) @@ -88,7 +88,7 @@ 1.
Ports - - `ports` directory manages source codes to emulate connection of components including communication and power ports. + - `ports` directory manages source codes to emulate the connection of components including communication and power ports. 1. GPIO Port: TBW 1. I2C Port: TBW @@ -101,8 +101,8 @@ 1.
Examples - - `examples` directory manages example source codes to show how to make user defined components. - - Please do not use these classes directory for your simulation analysis. + - `examples` directory manages example source codes to show how to make user-defined components. + - Please do not use these class directories for your simulation analysis. 1. Change structure: TBW 1. I2C controller for HILS: TBW @@ -114,35 +114,37 @@ 1.
Ideal - - `ideal` directory manages source codes of idealized components which are used in initial analysis phase in research and satellite development. - - Force Generator: TBW - - Torque Generator: TBW + - `ideal` directory manages source codes of idealized components which are used in the initial analysis phase in research and satellite development. + - [Angular Velocity Observer](./Specifications/Component/AOCS/spec_angular_velocity_observer.md) + - [Attitude Observer](./Specifications/Component/AOCS/spec_attitude_observer.md) + - [Force Generator](./Specifications/Component/AOCS/spec_force_generator.md) + - [Torque Generator](./Specifications/Component/AOCS/spec_torque_generator.md)
1.
Real - - `real` directory manages source codes to emulate well used components in a normal satellite mission. + - `real` directory manages source codes to emulate well-used components in a normal satellite mission. 1.
AOCS (Attitude and Orbit Control System) - - `aocs` directory manages components like sensor and actuators for AOCS subsystem. + - The `aocs` directory manages components like sensors and actuators for the AOCS subsystem. 1. GNSS Receiver: TBW - 1. GYRO Sensor: TBW - 1. Magnetometer: TBW - 1. Magnetorquer: TBW - 1. Reaction wheel: TBW - 1. [Reaction wheel jitter](./Specifications/Component/AOCS/Spec_RWJitter.md) + 1. [GYRO Sensor](./Specifications/Component/AOCS/spec_gyro_sensor.md) + 1. [Magnetometer](./Specifications/Component/AOCS/spec_magnetometer.md) + 1. [Magnetorquer](./Specifications/Component/AOCS/spec_magnetorquer.md) + 1. [Reaction wheel](./Specifications/Component/AOCS/spec_reaction_wheel.md) + - [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 + 1. [Sun sensor](./Specifications/Component/AOCS/spec_sun_sensor.md) + 1. [MTQ-Magnetometer interference](./Specifications/Component/AOCS/spec_mtq_magnetometer_interference)
1.
CDH (Command and Data Handling) - - `cdh` directory manages components for CDH subsystem. + - The `cdh` directory manages components for the CDH subsystem. 1. On Board Computer: TBW 1. OBC with C2A: TBW @@ -155,14 +157,14 @@ 1. Antenna: TBW 1. Antenna Radiation pattern: TBW - 1. GS calculator: TBW + 1. Ground Station calculator: TBW 1. WINGS command sender to C2A: TBW
1.
Mission - - `mission` directory manages mission specific components like science instruments of spacecraft. + - The `mission` directory manages mission-specific components like science instruments of spacecraft. 1. [Telescope](./Specifications/Component/Mission/Spec_Telescope_en.md) ([Japanese version](./Specifications/Component/Mission/Spec_Telescope_ja.md)) @@ -170,7 +172,7 @@ 1.
Power - - `power` directory manages components for power subsystem. + - The `power` directory manages components for the power subsystem. 1. Battery: TBW 1. CSV scenario interface: TBW @@ -182,7 +184,7 @@ 1.
Propulsion - - `propulsion` directory manages components for propulsion subsystem. + - The `propulsion` directory manages components for the propulsion subsystem. 1. [Simple Thruster](./Specifications/Component/Propulsion/Spec_SimpleThruster.md) @@ -194,7 +196,7 @@ 1.
Products - - `products` directory manages source codes to emulate specific products published in the world. The telemetry and command interfaces are also emulated based on ICDs. + - The `products` directory manages source codes to emulate specific products published in the world. The telemetry and command interfaces are also emulated based on ICDs. - Users can use them for a practical simulation for satellite development. - TBW @@ -204,7 +206,7 @@ 1.
Disturbances - - `disturbances` directory manages source codes to calculate disturbances acting on spacecraft on orbit. + - The `disturbances` directory manages source codes to calculate disturbances acting on spacecraft in orbit. 1. Base classes 1. [Disturbance](./Specifications/Disturbance/Spec_Disturbance.md) @@ -223,10 +225,10 @@ 1.
Dynamics - - `dynamics` directory manages source codes to calculate dynamics behavior of spacecraft. + - The `dynamics` directory manages source codes to calculate the dynamics behavior of spacecraft. 1. Attitude - 1. [Overview of Attitude calculation](./Specifications/Dynamics/Spec_Attitude.md) + 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) @@ -252,7 +254,7 @@ - `environment` directory manages source codes to calculate space environment simulation. 1. Overview of Environment calculation - - We divided space environment into two categories: `global` and `local`. + - We divided the space environment into two categories: `global` and `local`. - `global` directory manages space environment calculations which are shared with all spacecraft and ground stations in the simulation scenario. - e.g., planet position vector in the inertial frame. - `local` directory manages space environment calculations only for a spacecraft at its position and attitude. @@ -291,7 +293,7 @@ 1. First order lag: TBW 1. External - - External library related source codes. + - External library-related source codes. 1. IGRF (International Geomagnetic Reference Field): TBW 1. inih: TBW 1. nrlmsise00: TBW @@ -300,13 +302,19 @@ 1. Geodesy 1. Geodetic Position: TBW + 1. GNSS (Global Navigation Satellite System) + 1. ANTEX file reader: TBW + 1. Bias SINEX file reader: TBW + 1. GNSS satellite number: TBW + 1. SP3 file reader: 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. C2A command database: TBW 1. Logger 1. Loggable: TBW @@ -315,9 +323,9 @@ 1.
math - 1. Constants : TBW + 1. Constants: TBW 1. Matrix: TBW - 1. Matrix and Vector : TBW + 1. Matrix and Vector: TBW 1. Ordinary Differential Equation: TBW - This library will be replaced by `Numerical integration`. 1. Quaternion: TBW @@ -343,6 +351,7 @@ 1. Kepler Orbit: TBW 1. Orbital Elements: TBW 1. Relative Orbit Models: TBW + 1. Interpolation orbit: TBW 1. Planet rotation 1. Moon rotation utilities: TBW @@ -365,7 +374,7 @@ 1.
Simulation - - `simulation` directory manages source codes to define simulation scenario. + - `simulation` directory manages source codes to define the simulation scenario. 1. [Simulation Configuration](./Specifications/Simulation/Spec_SimulationConfiguration.md) @@ -396,7 +405,7 @@ 1.
Simulation Sample - - `simulation_sample` directory manages example source codes for user defined simulation scenario. Users can copy and modify this directory to make user defined simulation scenario. + - `simulation_sample` directory manages example source codes for user-defined simulation scenarios. Users can copy and modify this directory to make user-defined simulation scenarios. 1. Case 1. [Sample Case](./Specifications/Simulation/Spec_SampleCase.md) diff --git a/Specifications/Component/AOCS/Spec_RWJitter.md b/Specifications/Component/AOCS/Spec_RWJitter.md index f7c8dcff..96cb6c90 100644 --- a/Specifications/Component/AOCS/Spec_RWJitter.md +++ b/Specifications/Component/AOCS/Spec_RWJitter.md @@ -9,166 +9,168 @@ + RW jitter forces and torques in the component frame + RW jitter forces and torques in the body frame -1. functions - - `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 - - `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_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 `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_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_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. - + `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 `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. +### 1. functions +- `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 +- `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_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 `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_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_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. + + `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 `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. ## 2. Explanation of Algorithm -1. `CalcJitter` - 1. overview - - Function to calculate jitter force and torque - - 2. input and output - - input - + angular velocity of the RW - - output - + jitter force and torque in the component frame - + jitter force and torque in the body frame - - 3. algorithm - - The disturbances consist of discrete harmonics of reaction wheel speed with amplitudes proportional to the square of the wheel speed: - - ```math - u(t)=\sum_{i=1}^n C_i\Omega^2\sin(2\pi h_i\Omega t+\alpha_i) - ``` - - - where $u(t)$ is the disturbance force and torque in Newton (N) or Newton-meters (Nm), $n$ is the number of harmonics included in the model, $C_i$ is the amplitude of the $i$ th harmonic in $\mathrm{N^2/Hz}$ (or $\mathrm{(Nm)^2/Hz}$), $\Omega$ is the wheel speed in Hz, $h_i$ is the $i$ th harmonic number and $\alpha_i$ is a random phase (assumed to be uniform over $[0, 2\pi]$) [1]. - - $\alpha_i$ is generated as a uniform random number in the constructor. - - When users want to use a more precise model, set `considers_structural_resonance` to ENABLE in `RW.ini` and use a model that takes structural resonance inside the RW into account. - + If structural resonances are not taken into account, the RW disturbance will be underestimated, but it is not a significant change in general. - + See the description of `AddStructuralResonance()` for the algorithm to calculate the structural resonance. - -2. `AddStructuralResonance()` - 1. overview - - Function to add structural resonance inside the RW on the disturbance by harmonics of RW - 2. input and output - - input: - + N/A - - output: - + jitter force and torque with structural resonance in component frame - 3. algorithm - - The transfer function from disturbance by harmonics of RW without resonance ( $u(t)$ ) to disturbance with resonance ( $y(t)$ ) is modeled as following equation: - ```math - G(s)=\frac{s^2+2\zeta\omega_ns+\omega_n^2}{s^2+2d\zeta\omega_ns+\omega_n^2} - ``` - ```math - Y(s)=G(s)U(s) - ``` - - where $\omega_n$ is the angular frequency on the structural resonance. Other parameters such as $\zeta$, $d$ are determined by the result of experiments. - - To perform the simulation in discrete time, A bi-linear transformation $G(s)\rightarrow H(z)$ is applied. $T$ is the jitter update period. - - ```math - \begin{aligned} - G(\frac{2}{T}\frac{z-1}{z+1})&=\dfrac{(\frac{2}{T}\frac{z-1}{z+1})^2+2\zeta\omega_n(\frac{2}{T}\frac{z-1}{z+1})+\omega_n^2}{(\frac{2}{T}\frac{z-1}{z+1})^2+2d\zeta\omega_n(\frac{2}{T}\frac{z-1}{z+1})+\omega_n^2}\\ - &=\dfrac{(4+4\zeta T\omega_n+T^2\omega_n^2)+(-8+2T^2\omega_n^2)z^{-1}+(4-4\zeta T\omega_n+T^2\omega_n^2)z^{-2}}{(4+4d\zeta T\omega_n+T^2\omega_n^2)+(-8+2T^2\omega_n^2)z^{-1}+(4-4d\zeta T\omega_n+T^2\omega_n^2)z^{-2}}\\ - &=\dfrac{c_3+c_4z^{-1}+c_5z^{-2}}{c_0+c_1z^{-1}+c_2z^{-2}}\\ - &=H(z) - \end{aligned} - ``` - - - The $\omega_n$ should be the fixed value by pre-warping because there is frequency distortion due to bilinear transformation. The formula for calculating $\omega_n$ for the true resonant frequency $\omega_d$ is as follows: - - ```math - \omega_n=\frac{2}{T}\tan(\frac{T\omega_d}{2}) - ``` - - - The bi-linear transformation transforms the relationship between input $u$ and output $y$ as follows: - - ```math - \begin{aligned} - Y(z)&=H(z)U(z)\\ - (c_0+c_1z^{-1}+c_2z^{-2})Y(z)&=(c_3+c_4z^{-1}+c_5z^{-2})U(z) - \end{aligned} - ``` - - - By applying the inverse z-transform, the continuous relationship between $y(t)$ and $u(t)$ can be expressed as a discrete relationship of a difference equation between $y[n]$ and $u[n]$, where $[n]$ is the current simulation time step. The difference equation is as follows: - ```math - c_0y[n]+c_1y[n-1]+c_2y[n-2]=c_3u[n]+c_4u[n-1]+c_5u[n-2] - ``` - - - Therefore, $y[n]$ is calculated as follows. - ```math - y[n]=\frac{(-c_1y[n-1]-c_2y[n-2]+c_3u[n]+c_4u[n-1]+c_5u[n-2])}{c_0} - ``` +### 1. `CalcJitter` +#### 1. overview +- Function to calculate jitter force and torque + +#### 2. input and output +- input + + angular velocity of the RW +- output + + jitter force and torque in the component frame + + jitter force and torque in the body frame + +#### 3. algorithm +- The disturbances consist of discrete harmonics of reaction wheel speed with amplitudes proportional to the square of the wheel speed: + +```math +u(t)=\sum_{i=1}^n C_i\Omega^2\sin(2\pi h_i\Omega t+\alpha_i) +``` + +- where $u(t)$ is the disturbance force and torque in Newton (N) or Newton-meters (Nm), $n$ is the number of harmonics included in the model, $C_i$ is the amplitude of the $i$ th harmonic in $\mathrm{N^2/Hz}$ (or $\mathrm{(Nm)^2/Hz}$), $\Omega$ is the wheel speed in Hz, $h_i$ is the $i$ th harmonic number and $\alpha_i$ is a random phase (assumed to be uniform over $[0, 2\pi]$) [1]. +- $\alpha_i$ is generated as a uniform random number in the constructor. +- When users want to use a more precise model, set `considers_structural_resonance` to ENABLE in `RW.ini` and use a model that takes structural resonance inside the RW into account. + + If structural resonances are not taken into account, the RW disturbance will be underestimated, but it is not a significant change in general. + + See the description of `AddStructuralResonance()` for the algorithm to calculate the structural resonance. + +### 2. `AddStructuralResonance()` +#### 1. overview +- Function to add structural resonance inside the RW on the disturbance by harmonics of RW + +#### 2. input and output +- input: + + N/A +- output: + + jitter force and torque with structural resonance in component frame + +#### 3. algorithm +- The transfer function from disturbance by harmonics of RW without resonance ( $u(t)$ ) to disturbance with resonance ( $y(t)$ ) is modeled as following equation: +```math +G(s)=\frac{s^2+2\zeta\omega_ns+\omega_n^2}{s^2+2d\zeta\omega_ns+\omega_n^2} +``` +```math +Y(s)=G(s)U(s) +``` +- where $\omega_n$ is the angular frequency on the structural resonance. Other parameters such as $\zeta$, $d$ are determined by the result of experiments. +- To perform the simulation in discrete time, A bi-linear transformation $G(s)\rightarrow H(z)$ is applied. $T$ is the jitter update period. + +```math +\begin{aligned} +G(\frac{2}{T}\frac{z-1}{z+1})&=\dfrac{(\frac{2}{T}\frac{z-1}{z+1})^2+2\zeta\omega_n(\frac{2}{T}\frac{z-1}{z+1})+\omega_n^2}{(\frac{2}{T}\frac{z-1}{z+1})^2+2d\zeta\omega_n(\frac{2}{T}\frac{z-1}{z+1})+\omega_n^2}\\ +&=\dfrac{(4+4\zeta T\omega_n+T^2\omega_n^2)+(-8+2T^2\omega_n^2)z^{-1}+(4-4\zeta T\omega_n+T^2\omega_n^2)z^{-2}}{(4+4d\zeta T\omega_n+T^2\omega_n^2)+(-8+2T^2\omega_n^2)z^{-1}+(4-4d\zeta T\omega_n+T^2\omega_n^2)z^{-2}}\\ +&=\dfrac{c_3+c_4z^{-1}+c_5z^{-2}}{c_0+c_1z^{-1}+c_2z^{-2}}\\ +&=H(z) +\end{aligned} +``` + +- The $\omega_n$ should be the fixed value by pre-warping because there is frequency distortion due to bilinear transformation. The formula for calculating $\omega_n$ for the true resonant frequency $\omega_d$ is as follows: + +```math +\omega_n=\frac{2}{T}\tan(\frac{T\omega_d}{2}) +``` + +- The bi-linear transformation transforms the relationship between input $u$ and output $y$ as follows: + +```math +\begin{aligned} +Y(z)&=H(z)U(z)\\ +(c_0+c_1z^{-1}+c_2z^{-2})Y(z)&=(c_3+c_4z^{-1}+c_5z^{-2})U(z) +\end{aligned} +``` + +- By applying the inverse z-transform, the continuous relationship between $y(t)$ and $u(t)$ can be expressed as a discrete relationship of a difference equation between $y[n]$ and $u[n]$, where $[n]$ is the current simulation time step. The difference equation is as follows: +```math +c_0y[n]+c_1y[n-1]+c_2y[n-2]=c_3u[n]+c_4u[n-1]+c_5u[n-2] +``` + +- Therefore, $y[n]$ is calculated as follows. +```math +y[n]=\frac{(-c_1y[n-1]-c_2y[n-2]+c_3u[n]+c_4u[n-1]+c_5u[n-2])}{c_0} +``` ## 3. Results of verifications - In this section, jitter output when the RW is rotated at a constant speed is verified. - 1. X-axis torque data in the time domain - 1. overview - - 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 - - `sample_simulation_base.ini` - - `reaction_wheel.ini` - 2. initial condition - - `sample_simulation_base.ini` - ``` - EndTimeSec = 0.5 - StepTimeSec = 0.0001 - CompoUpdateIntervalSec = 0.0001 - LogOutputIntervalSec = 0.0001 - ``` - - - `reaction_wheel.ini` - ``` - fast_prescaler = 1 - max_angular_velocity = 9000.0 - calculation = ENABLE - logging = ENABLE - harmonics_degree = 12 - considers_structural_resonance = ENABLE - structural_resonance_freq = 585.0 //[Hz] - damping_factor = 0.1 //[ ] - bandwidth = 0.001 //[ ] - ``` - 3. result - - The simulation result is compared with the disturbance experiment result of Sinclair RW0.003. -
- Simulated RW jitter in time domain -
- - - At all speeds, the characteristics of the actual RW are well simulated. - - - 2. X-axis torque waterfall - 1. overview - - The RW model is rotated at 1000, 2000, ..., 9000rpm, and the jitter torque time-domain data was extracted. Then, FFT was applied to the data by Matlab, and the waterfall plot was plotted. - 2. initial condition - - same as the initial condition of the verification about the time domain data - 3. result - - The simulation result is compared with the disturbance experiment result of Sinclair RW0.003. -
- Simulated RW jitter in time domain -
- - - Both the first-order mode and the structural resonance ($\omega_n=585\mathrm{Hz}$) are approximately simulated. +### 1. X-axis torque data in the time domain +#### 1. overview +- 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 +- input files + - `sample_simulation_base.ini` + - `reaction_wheel.ini` +- initial condition + - `sample_simulation_base.ini` + ``` + EndTimeSec = 0.5 + StepTimeSec = 0.0001 + CompoUpdateIntervalSec = 0.0001 + LogOutputIntervalSec = 0.0001 + ``` + - `reaction_wheel.ini` + ``` + fast_prescaler = 1 + max_angular_velocity = 9000.0 + calculation = ENABLE + logging = ENABLE + harmonics_degree = 12 + considers_structural_resonance = ENABLE + structural_resonance_freq = 585.0 //[Hz] + damping_factor = 0.1 //[ ] + bandwidth = 0.001 //[ ] + ``` +#### 3. result +- The simulation result is compared with the disturbance experiment result of Sinclair RW0.003. +
+Simulated RW jitter in time domain +
+ +- At all speeds, the characteristics of the actual RW are well simulated. + +### 2. X-axis torque waterfall +#### 1. overview +- The RW model is rotated at 1000, 2000, ..., 9000rpm, and the jitter torque time-domain data was extracted. Then, FFT was applied to the data by Matlab, and the waterfall plot was plotted. + +#### 2. initial condition +- same as the initial condition of the verification about the time domain data + +#### 3. result +- The simulation result is compared with the disturbance experiment result of Sinclair RW0.003. +
+Simulated RW jitter in time domain +
+ +- Both the first-order mode and the structural resonance ($\omega_n=585\mathrm{Hz}$) are approximately simulated. ## 4. References - 1. Masterson, R. A. (1999). Development and validation of empirical and analytical reaction wheel disturbance models (Doctoral dissertation, Massachusetts Institute of Technology). - 2. Shields, et al., (2017). Characterization of CubeSat reaction wheel assemblies. Journal of Small Satellites, 6(1), 565-580. +1. Masterson, R. A. (1999). Development and validation of empirical and analytical reaction wheel disturbance models (Doctoral dissertation, Massachusetts Institute of Technology). +2. Shields, et al., (2017). Characterization of CubeSat reaction wheel assemblies. Journal of Small Satellites, 6(1), 565-580. diff --git a/Specifications/Component/AOCS/Spec_STT.md b/Specifications/Component/AOCS/Spec_STT.md index c39c35f5..08494e85 100644 --- a/Specifications/Component/AOCS/Spec_STT.md +++ b/Specifications/Component/AOCS/Spec_STT.md @@ -1,71 +1,79 @@ # Specification for StarSensor class ## 1. Overview -1. functions - - `StarSensor` class simulates a star sensor. - - The `StarSensor` class calculates and returns the observed quaternions and error flags. - -2. files - - `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 `star_sensor.ini`. - - Create an instance by using the initialization function `InitStarSensor` - - Use `Get*` function to get quaternion information. +### 1. functions +- `StarSensor` class simulates a star sensor. +- The `StarSensor` class calculates and returns the observed quaternions and error flags. + +### 2. files +- `star_sensor.cpp, star_sensor.hpp` : Definitions and declarations of the class +- `star_sensor.ini` : Initialization file +- `plot_star_sensor.py`: An example of a Python script to plot star sensor output + +### 3. how to use +- Set the parameters in `star_sensor.ini`. +- Create an instance by using the initialization function `InitStarSensor` +- Use `Get*` function to get quaternion information. ## 2. Explanation of Algorithm -1. `Update` - - TBW -2. `Judgement` - 1. `EarthJudgement` - - Calculate the angle $\theta_{ce}$ between the earth's center direction $\boldsymbol{r_{sc}}$ and the earth's edge direction $\boldsymbol{r_{se}}$. $R_e$ is the earth's radius. - - Calculate the angle $\theta_{es}$ between the sight direction $\boldsymbol{r_{sight}}$ and the earth's edge direction $\boldsymbol{r_{se}}$. - - Judge the STT error flag by comparing $\theta_{es}$ with the earth forbidden angle $\theta_{efa}$. If $\theta_{es} > \theta_{efa}$, the earth is completely outside the earth forbidden angle. - - - ```math - \begin{align} - \theta_{ce} = \arctan{\left(\frac{|\boldsymbol{r_{se}}|}{R_e}\right)}\\ - \theta_{cs} = \arccos{(\boldsymbol{r_{se}}*\boldsymbol{r_{sight}})}\\ - \theta_{es} = \theta_{ce} - \theta_{cs} - \tag{1} - \end{align} - ``` - - ![](./figs/stt_earth_judgement.png) - +### 1. `Update` +- TBW + +### 2. `Judgement` +#### 1. `EarthJudgement` +- Calculate the angle $\theta_{ce}$ between the earth's center direction $\boldsymbol{r_{sc}}$ and the earth's edge direction $\boldsymbol{r_{se}}$. $R_e$ is the earth's radius. +- Calculate the angle $\theta_{es}$ between the sight direction $\boldsymbol{r_{sight}}$ and the earth's edge direction $\boldsymbol{r_{se}}$. +- Judge the STT error flag by comparing $\theta_{es}$ with the earth forbidden angle $\theta_{efa}$. If $\theta_{es} > \theta_{efa}$, the earth is completely outside the earth forbidden angle. + + +```math +\begin{align} + \theta_{ce} = \arctan{\left(\frac{|\boldsymbol{r_{se}}|}{R_e}\right)}\\ + \theta_{cs} = \arccos{(\boldsymbol{r_{se}}*\boldsymbol{r_{sight}})}\\ + \theta_{es} = \theta_{ce} - \theta_{cs} + \tag{1} +\end{align} +``` + +![](./figs/stt_earth_judgement.png) + ## 3. Results of verifications -1. verification of Earth judgement - 1. overview - - Check that Earth judgement is performed correctly - - 2. conditions for the verification - - PropStepSec: 0.001 - - StepTimeSec: 0.1 - - EndTimeSec: 200 - - Initial position [m] : [4.2164140100E+07,0,0] - - Initial velocity [m/s] : [0,3.074661E+03,0] - - ControlledAttitude - - main mode = EARTH_CENTER_POINTING: the pointing direction is determined by each case - - sub mode = SUN_POINTING: [0,0,1] - - STT quaternion from body frame to component frame: [0,0,0,1] - - Earth forbidden half-angle: 10deg - - The angle between the earth's center and edge direction: 8.6deg - - 3. results - - The angle between pointing direction and earth center = 15deg - - STT flag is always 1, since the angle $\theta_{es}$ between the sight direction and the earth's edge direction is 15 - 8.6 = 6.4deg < 10deg. - - ![](./figs/stt_flag_15.png) - - - The angle between pointing direction and earth center = 20deg - - STT flag is always 0, since the angle $\theta_{es}$ between the sight direction and the earth's edge direction is 20 - 8.6 = 11.4deg > 10deg. - - ![](./figs/stt_flag_20.png) - - - The angle between pointing direction and earth center = 30deg - - STT flag is always 0, since the angle $\theta_{es}$ between the sight direction and the earth's edge direction is 30 - 8.6 = 21.4deg > 10deg. - ![](./figs/stt_flag_30.png) +### 1. verification of Earth judgement +#### 1. overview +- Check that Earth judgement is performed correctly + +#### 2. conditions for the verification +- PropStepSec: 0.001 +- StepTimeSec: 0.1 +- EndTimeSec: 200 +- Initial position [m] : [4.2164140100E+07,0,0] +- Initial velocity [m/s] : [0,3.074661E+03,0] +- ControlledAttitude + - main mode = EARTH_CENTER_POINTING: the pointing direction is determined by each case + - sub mode = SUN_POINTING: [0,0,1] +- STT quaternion from body frame to component frame: [0,0,0,1] +- Earth forbidden half-angle: 10deg +- The angle between the earth's center and edge direction: 8.6deg + +#### 3. results +- The angle between pointing direction and earth center = 15deg + - STT flag is always 1, since the angle $\theta_{es}$ between the sight direction and the earth's edge direction is 15 - 8.6 = 6.4deg < 10deg. + +![](./figs/stt_flag_15.png) + +- The angle between pointing direction and earth center = 20deg + - STT flag is always 0, since the angle $\theta_{es}$ between the sight direction and the earth's edge direction is 20 - 8.6 = 11.4deg > 10deg. + +![](./figs/stt_flag_20.png) + +- The angle between pointing direction and earth center = 30deg + - STT flag is always 0, since the angle $\theta_{es}$ between the sight direction and the earth's edge direction is 30 - 8.6 = 21.4deg > 10deg. + +![](./figs/stt_flag_30.png) + +- The output result obtained by the default initial settings. + - The figure is generated by the Python script. + +![](./figs/star_sensor_output.png) diff --git a/Specifications/Component/AOCS/figs/angular_velocity_observer_output.png b/Specifications/Component/AOCS/figs/angular_velocity_observer_output.png new file mode 100644 index 00000000..48b45ce5 Binary files /dev/null and b/Specifications/Component/AOCS/figs/angular_velocity_observer_output.png differ diff --git a/Specifications/Component/AOCS/figs/attitude_observer_output.png b/Specifications/Component/AOCS/figs/attitude_observer_output.png new file mode 100644 index 00000000..a49847b0 Binary files /dev/null and b/Specifications/Component/AOCS/figs/attitude_observer_output.png differ diff --git a/Specifications/Component/AOCS/figs/force_generator_output.png b/Specifications/Component/AOCS/figs/force_generator_output.png new file mode 100644 index 00000000..a76cf0f2 Binary files /dev/null and b/Specifications/Component/AOCS/figs/force_generator_output.png differ diff --git a/Specifications/Component/AOCS/figs/gyro_sensor_output.png b/Specifications/Component/AOCS/figs/gyro_sensor_output.png new file mode 100644 index 00000000..c2dcf423 Binary files /dev/null and b/Specifications/Component/AOCS/figs/gyro_sensor_output.png differ diff --git a/Specifications/Component/AOCS/figs/magnetometer_output.png b/Specifications/Component/AOCS/figs/magnetometer_output.png new file mode 100644 index 00000000..8ed135ba Binary files /dev/null and b/Specifications/Component/AOCS/figs/magnetometer_output.png differ diff --git a/Specifications/Component/AOCS/figs/magnetorquer_output.png b/Specifications/Component/AOCS/figs/magnetorquer_output.png new file mode 100644 index 00000000..08503a92 Binary files /dev/null and b/Specifications/Component/AOCS/figs/magnetorquer_output.png differ diff --git a/Specifications/Component/AOCS/figs/reaction_wheel_output_case1.png b/Specifications/Component/AOCS/figs/reaction_wheel_output_case1.png new file mode 100644 index 00000000..e29fa379 Binary files /dev/null and b/Specifications/Component/AOCS/figs/reaction_wheel_output_case1.png differ diff --git a/Specifications/Component/AOCS/figs/reaction_wheel_output_case2.png b/Specifications/Component/AOCS/figs/reaction_wheel_output_case2.png new file mode 100644 index 00000000..9f382e8e Binary files /dev/null and b/Specifications/Component/AOCS/figs/reaction_wheel_output_case2.png differ diff --git a/Specifications/Component/AOCS/figs/result_mtq_magnetometer_interference.png b/Specifications/Component/AOCS/figs/result_mtq_magnetometer_interference.png new file mode 100644 index 00000000..c80ee6c4 Binary files /dev/null and b/Specifications/Component/AOCS/figs/result_mtq_magnetometer_interference.png differ diff --git a/Specifications/Component/AOCS/figs/star_sensor_output.png b/Specifications/Component/AOCS/figs/star_sensor_output.png new file mode 100644 index 00000000..5aaf24a6 Binary files /dev/null and b/Specifications/Component/AOCS/figs/star_sensor_output.png differ diff --git a/Specifications/Component/AOCS/figs/sun_sensor_output.png b/Specifications/Component/AOCS/figs/sun_sensor_output.png new file mode 100644 index 00000000..714b01a5 Binary files /dev/null and b/Specifications/Component/AOCS/figs/sun_sensor_output.png differ diff --git a/Specifications/Component/AOCS/figs/torque_generator_output.png b/Specifications/Component/AOCS/figs/torque_generator_output.png new file mode 100644 index 00000000..0e495583 Binary files /dev/null and b/Specifications/Component/AOCS/figs/torque_generator_output.png differ diff --git a/Specifications/Component/AOCS/spec_angular_velocity_observer.md b/Specifications/Component/AOCS/spec_angular_velocity_observer.md new file mode 100644 index 00000000..0bc73cb5 --- /dev/null +++ b/Specifications/Component/AOCS/spec_angular_velocity_observer.md @@ -0,0 +1,39 @@ +# Specification for AngularVelocityObserver class + +## 1. Overview +### 1. functions +- The `AngularVelocityObserver` class simulates an ideal angular velocity observer. +- The `AngularVelocityObserver` class observes angular velocity with noise. + +### 2. files +- `angular_velocity_observer.cpp, angular_velocity_observer.hpp`: Definitions and declarations of the class +- `angular_velocity_observer.ini`: Initialization file +- `plot_angular_velocity_observer.py`: An example of a Python script to plot angular velocity observer output + +### 3. how to use +- Set the parameters in `angular_velocity_observer.ini`. + - Other parameters + - Parameters for the `Component` class + - Parameters for the `Sensor` class +- Create an instance by using the initialization function `InitializeAngularVelocityObserver` +- Use the `GetAngularVelocity_b_rad_s` function to get magnetic field information. + + +## 2. Explanation of Algorithm + +### 1. MainRoutine +#### 1. Overview +- The `MainRoutine` function adds the noise to the true angular velocity. + +#### 2. Inputs and Outputs +- NA + +#### 3. Algorithm +- NA + + +## 3. Results of verifications +- The output result obtained by the default initial settings. + - The figure is generated by the Python script. + +![](./figs/angular_velocity_observer_output.png) diff --git a/Specifications/Component/AOCS/spec_attitude_observer.md b/Specifications/Component/AOCS/spec_attitude_observer.md new file mode 100644 index 00000000..767d49dd --- /dev/null +++ b/Specifications/Component/AOCS/spec_attitude_observer.md @@ -0,0 +1,39 @@ +# Specification for AttitudeObserver class + +## 1. Overview +### 1. functions +- The `AttitudeObserver` class simulates an ideal attitude observer. +- The `AttitudeObserver` class observes attitude quaternion with noise. + +### 2. files +- `attitude_observer.cpp, attitude_observer.hpp`: Definitions and declarations of the class +- `attitude_observer.ini`: Initialization file +- `plot_attitude_observer.py`: An example of a Python script to plot attitude observer output + +### 3. how to use +- Set the parameters in `attitude_observer.ini`. + - `error_angle_standard_deviation_deg`: Standard deviation of error angle + - Other parameters + - Parameters for the `Component` class +- Create an instance by using the initialization function `InitializeAttitudeObserver` +- Use the `GetQuaternion_i2b` function to get magnetic field information. + + +## 2. Explanation of Algorithm + +### 1. MainRoutine +#### 1. Overview +- The `MainRoutine` function adds the noise to the true attitude quaternion. + +#### 2. Inputs and Outputs +- NA + +#### 3. Algorithm +- NA + + +## 3. Results of verifications +- The output result obtained by the default initial settings. + - The figure is generated by the Python script. + +![](./figs/attitude_observer_output.png) diff --git a/Specifications/Component/AOCS/spec_force_generator.md b/Specifications/Component/AOCS/spec_force_generator.md new file mode 100644 index 00000000..9742f5f5 --- /dev/null +++ b/Specifications/Component/AOCS/spec_force_generator.md @@ -0,0 +1,40 @@ +# Specification for ForceGenerator class + +## 1. Overview +### 1. functions +- The `ForceGenerator` class simulates an ideal force generator. + +### 2. files +- `force_generator.cpp, force_generator.hpp`: Definitions and declarations of the class +- `force_generator.ini`: Initialization file +- `plot_force_generator.py`: An example of a Python script to plot force_generator output + +### 3. how to use +- Set the parameters in `force_generator.ini`. + - `force_magnitude_standard_deviation_N`: Standard deviation of force magnitude + - `force_direction_standard_deviation_deg`: Standard deviation of force direction + - Other parameters + - Parameters for the `Component` class +- Create an instance by using the initialization function `InitForceGenerator` +- Use the `SetForce*` function to set the ordered force. + - Users can select the coordinate of the ordered force. + + +## 2. Explanation of Algorithm + +### 1. MainRoutine +#### 1. Overview +- The `MainRoutine` function adds output noise to the ordered force and calculates generated force. + +#### 2. Inputs and Outputs +- NA + +#### 3. Algorithm +- NA + + +## 3. Results of verifications +- The output result obtained by the default initial settings. + - The figure is generated by the Python script. + +![](./figs/force_generator_output.png) diff --git a/Specifications/Component/AOCS/spec_gyro_sensor.md b/Specifications/Component/AOCS/spec_gyro_sensor.md new file mode 100644 index 00000000..e7c077f2 --- /dev/null +++ b/Specifications/Component/AOCS/spec_gyro_sensor.md @@ -0,0 +1,41 @@ +# Specification for GyroSensor class + +## 1. Overview +### 1. functions +- The `GyroSensor` class simulates a gyro sensor. +- The `GyroSensor` class calculates and returns the observed angular velocity with noise. + +### 2. files +- `gyro_sensor.cpp, gyro_sensor.hpp`: Definitions and declarations of the class +- `gyro_sensor.ini`: Initialization file +- `plot_gyro_sensor.py`: An example of a Python script to plot gyro sensor output + +### 3. how to use +- Set the parameters in `gyro_sensor.ini`. + - `quaternion_b2c`: Frame conversion quaternion from body to component frame. + - Other parameters + - Parameters for the `Component` class + - Parameters for the `Sensor` class + - Parameters for the `PowerPort` class +- Create an instance by using the initialization function `InitGyroSensor` +- Use the `Get*` function to get angular velocity information. + + +## 2. Explanation of Algorithm + +### 1. MainRoutine +#### 1. Overview +- The `MainRoutine` function converts the angular velocity coordinate from the body to the component and adds noises using the feature of the `Sensor` class. + +#### 2. Inputs and Outputs +- NA + +#### 3. Algorithm +- NA + + +## 3. Results of verifications +- The output result obtained by the default initial settings. + - The figure is generated by the Python script. + +![](./figs/gyro_sensor_output.png) diff --git a/Specifications/Component/AOCS/spec_magnetometer.md b/Specifications/Component/AOCS/spec_magnetometer.md new file mode 100644 index 00000000..ad67d8ee --- /dev/null +++ b/Specifications/Component/AOCS/spec_magnetometer.md @@ -0,0 +1,41 @@ +# Specification for Magnetometer class + +## 1. Overview +### 1. functions +- The `Magnetometer` class simulates a magnetometer. +- The `Magnetometer` class calculates and returns the observed magnetic field with noise. + +### 2. files +- `magnetometer.cpp, magnetometer.hpp`: Definitions and declarations of the class +- `magnetometer.ini`: Initialization file +- `plot_magnetometer.py`: An example of a Python script to plot magnetometer output + +### 3. how to use +- Set the parameters in `magnetometer.ini`. + - `quaternion_b2c`: Frame conversion quaternion from body to component frame. + - Other parameters + - Parameters for the `Component` class + - Parameters for the `Sensor` class + - Parameters for the `PowerPort` class +- Create an instance by using the initialization function `InitMagnetometer` +- Use the `Get*` function to get magnetic field information. + + +## 2. Explanation of Algorithm + +### 1. MainRoutine +#### 1. Overview +- The `MainRoutine` function converts the magnetic field coordinate from the body to the component and adds noises using the feature of the `Sensor` class. + +#### 2. Inputs and Outputs +- NA + +#### 3. Algorithm +- NA + + +## 3. Results of verifications +- The output result obtained by the default initial settings. + - The figure is generated by the Python script. + +![](./figs/magnetometer_output.png) diff --git a/Specifications/Component/AOCS/spec_magnetorquer.md b/Specifications/Component/AOCS/spec_magnetorquer.md new file mode 100644 index 00000000..170e5001 --- /dev/null +++ b/Specifications/Component/AOCS/spec_magnetorquer.md @@ -0,0 +1,47 @@ +# Specification for Magnetorquer class + +## 1. Overview +### 1. functions +- The `Magnetorquer` class simulates a magnetorquer. +- The `Magnetorquer` class generates torque caused by the magnetorquer. + +### 2. files +- `magnetorquer.cpp, magnetorquer.hpp`: Definitions and declarations of the class +- `magnetorquer.ini`: Initialization file +- `plot_magnetorquer.py`: An example of a Python script to plot magnetorquer output + +### 3. how to use +- Set the parameters in `magnetorquer.ini`. + - `quaternion_b2c`: Frame conversion quaternion from body to component frame. + - `scale_factor_c`: Scale factor from ordered value to generated value + - `max_output_magnetic_moment_c_Am2`: Maximum output of magnetorquer + - `min_output_magnetic_moment_c_Am2`: Minimum output of magnetorquer + - `constant_bias_noise_c_Am2`: Constant bias noise + - `random_walk_standard_deviation_c_Am2`: Standard deviation of random walk noise for MTQ output + - `random_walk_limit_c_Am2`: Limit of random walk noise for MTQ output + - `white_noise_standard_deviation_c_Am2`: Standard deviation of white noise for MTQ output + - Other parameters + - Parameters for the `Component` class + - Parameters for the `PowerPort` class +- Create an instance by using the initialization function `InitMagnetorquer` +- Use the `SetOutputMagneticMoment*` function to set the ordered magnetic moment. + + +## 2. Explanation of Algorithm + +### 1. MainRoutine +#### 1. Overview +- The `MainRoutine` function adds output noise to the ordered magnetic moment and calculates generated torque by the interaction between the output magnetic moment and the magnetic field. + +#### 2. Inputs and Outputs +- NA + +#### 3. Algorithm +- NA + + +## 3. Results of verifications +- The output result obtained by the default initial settings. + - The figure is generated by the Python script. + +![](./figs/magnetorquer_output.png) diff --git a/Specifications/Component/AOCS/spec_mtq_magnetometer_interference.md b/Specifications/Component/AOCS/spec_mtq_magnetometer_interference.md new file mode 100644 index 00000000..6b02bb19 --- /dev/null +++ b/Specifications/Component/AOCS/spec_mtq_magnetometer_interference.md @@ -0,0 +1,36 @@ +# Specification for MtqMagnetometerInterference class + +## 1. Overview +### 1. functions +- The `MtqMagnetometerInterference` class simulates an interference phenomenon between magnetorquers (MTQs) and magnetometers. +- The `MtqMagnetometerInterference` class adds bias noise to magnetometers when MTQs are turned on. + +### 2. files +- `mtq_magnetometer_interference.cpp, mtq_magnetometer_interference.hpp`: Definitions and declarations of the class +- `component_interference.ini`: Initialization file + +### 3. how to use +- Set the parameters in `magnetometer.ini`. + - `polynomial_degree`: Degree of polynomial + - `additional_bias_by_mtq_coefficients_*`: Coefficients of the polynomial +- Create an instance of the `MtqMagnetometerInterference` class. +- Execute the `UpdateInterference` function in the `ComponentInterference` function of the `InstalledComponents` class. + + +## 2. Explanation of Algorithm + +### 1. MainRoutine +#### 1. Overview +- TBW + +#### 2. Inputs and Outputs +- TBW + +#### 3. Algorithm +- TBW + + +## 3. Results of verifications +- A result of the interference between MTQ and magnetometer. + +![](./figs/result_mtq_magnetometer_interference.png) diff --git a/Specifications/Component/AOCS/spec_reaction_wheel.md b/Specifications/Component/AOCS/spec_reaction_wheel.md new file mode 100644 index 00000000..4838e231 --- /dev/null +++ b/Specifications/Component/AOCS/spec_reaction_wheel.md @@ -0,0 +1,65 @@ +# Specification for ReactionWheel class + +## 1. Overview +### 1. functions +- The `ReactionWheel` class simulates a reaction wheel. +- The `ReactionWheel` class generates torque caused by the reaction wheel. + +### 2. files +- `reaction_wheel.cpp, reaction_wheel.hpp`: Definitions and declarations of the class +- `reaction_wheel_ode.cpp, reaction_wheel_ode.hpp`: Ordinary differential equation for RW emulation +- `reaction_wheel.ini`: Initialization file +- `plot_reaction_wheel.py`: An example of a Python script to plot reaction_wheel output + +### 3. how to use +- Set the parameters in `reaction_wheel.ini`. + - `moment_of_inertia_kgm2`: Moment of inertia of the rotor + - `max_output_torque_Nm`: Maximum output torque + - `max_angular_velocity_rpm`: Maximum angular velocity + - Direction parameters + - `direction_determination_mode`: Mode of direction definition + - `quaternion_b2c`: Quaternion body to component (used in RW jitter) + - `direction_b`: Rotation direction + - `position_b_m`: Position of the wheel + - `dead_time_s`: Dead time + - `time_constant_s`: Time constant of the first-order control lag + - Friction parameters + - `friction_order`: Order of friction acceleration + - `friction_coefficients`: Coefficients of friction acceleration + - `stop_limit_angular_velocity_rad_s`: Stop limit angular velocity + - `initial_motor_drive_flag`: Initial motor drive flag + - `initial_angular_velocity_rad_s`: Initial angular velocity + - Other parameters + - Parameters for the `Component` class + - Parameters for the `PowerPort` class + - Parameters for the `RwJitter` class +- Create an instance by using the initialization function `InitReactionWheel` +- Use the `SetDriveFlag`, `SetVelocityLimit_rpm`, and `SetTargetTorque_*` to drive the reaction wheel. +- Use the `GetAngularVelocity_*` to get angular velocity information. + + +## 2. Explanation of Algorithm + +### 1. MainRoutine +#### 1. Overview +- The `MainRoutine` function calculates the generating torque including control lag and friction. + +#### 2. Inputs and Outputs +- TBW + +#### 3. Algorithm +- TBW + + +## 3. Results of verifications +- Case 1 + - Parameters: Default + - Command: +20 rad/s2 -> -20 rad/s2 -> drive_flag = false. + +![](./figs/reaction_wheel_output_case1.png) + +- Case 2 + - Parameters: time_constant = 0, friction_coefficients = 1.0 + - Command: +20 rad/s2 -> -20 rad/s2 -> drive_flag = false. + +![](./figs/reaction_wheel_output_case2.png) diff --git a/Specifications/Component/AOCS/spec_sun_sensor.md b/Specifications/Component/AOCS/spec_sun_sensor.md new file mode 100644 index 00000000..a18fe6b1 --- /dev/null +++ b/Specifications/Component/AOCS/spec_sun_sensor.md @@ -0,0 +1,47 @@ +# Specification for SunSensor class + +## 1. Overview +### 1. functions +- The `SunSensor` class simulates a sun sensor. +- The `SunSensor` class calculates and returns the observed sun vector with noise. + +### 2. files +- `sun_sensor.cpp, sun_sensor.hpp`: Definitions and declarations of the class +- `sun_sensor.ini`: Initialization file +- `plot_sun_sensor.py`: An example of a Python script to plot sun sensor output + +### 3. how to use +- Set the parameters in `sun_sensor.ini`. + - `quaternion_b2c`: Frame conversion quaternion from body to component frame. + - `field_of_view_deg`: Field of view of the sun sensor + - `white_noise_standard_deviation_deg`: White noise standard deviation + - `bias_standard_deviation_deg`: Bias noise standard deviation + - `intensity_lower_threshold_percent`: Lower threshold of intensity to generate observation result + + - Other parameters + - Parameters for the `Component` class + - Parameters for the `PowerPort` class +- Create an instance by using the initialization function `InitSunSensor` +- Use the `Get*` function to get angular velocity information. + + +## 2. Explanation of Algorithm + +### 1. MainRoutine +#### 1. Overview +- The sun direction vector is converted to the component frame. +- Judge the sun is inside the field of view of the sun sensor. +- Add observation noises. + +#### 2. Inputs and Outputs +- NA + +#### 3. Algorithm +- NA + + +## 3. Results of verifications +- The output result obtained by the default initial settings. + - The figure is generated by the Python script. + +![](./figs/sun_sensor_output.png) diff --git a/Specifications/Component/AOCS/spec_torque_generator.md b/Specifications/Component/AOCS/spec_torque_generator.md new file mode 100644 index 00000000..461ea8fc --- /dev/null +++ b/Specifications/Component/AOCS/spec_torque_generator.md @@ -0,0 +1,39 @@ +# Specification for TorqueGenerator class + +## 1. Overview +### 1. functions +- The `TorqueGenerator` class simulates an ideal torque generator. + +### 2. files +- `torque_generator.cpp, torque_generator.hpp`: Definitions and declarations of the class +- `torque_generator.ini`: Initialization file +- `plot_torque_generator.py`: An example of a Python script to plot torque_generator output + +### 3. how to use +- Set the parameters in `torque_generator.ini`. + - `torque_magnitude_standard_deviation_Nm`: Standard deviation of torque magnitude + - `torque_direction_standard_deviation_deg`: Standard deviation of torque direction + - Other parameters + - Parameters for the `Component` class +- Create an instance by using the initialization function `InitTorqueGenerator` +- Use the `SetTorque*` function to set the ordered torque. + + +## 2. Explanation of Algorithm + +### 1. MainRoutine +#### 1. Overview +- The `MainRoutine` function adds output noise to the ordered torque and calculates generated torque. + +#### 2. Inputs and Outputs +- NA + +#### 3. Algorithm +- NA + + +## 3. Results of verifications +- The output result obtained by the default initial settings. + - The figure is generated by the Python script. + +![](./figs/torque_generator_output.png) diff --git a/Specifications/Component/Abstract/Spec_ComponentBase.md b/Specifications/Component/Abstract/Spec_ComponentBase.md index 9becb265..7e001667 100644 --- a/Specifications/Component/Abstract/Spec_ComponentBase.md +++ b/Specifications/Component/Abstract/Spec_ComponentBase.md @@ -1,87 +1,102 @@ # Specification of Component class ## 1. Overview -1. Functions - - 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). +### 1. Functions +- 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: `component.hpp`, `component.cpp` +### 2. Related Files +- Main file: `component.hpp`, `component.cpp` -3. How to use - - Inherit this class by the user's component class. - - The `ReactionWheel` in `S2E_CORE` is useful as a usage example of the `FastUpdate`. +### 3. How to use +- Inherit this class by the user's component class. +- The `ReactionWheel` in `S2E_CORE` is useful as a usage example of the `FastUpdate`. ## 2. Explanation of Algorithm -1. Constructor - 1. overview - - Users can set component update `prescaler` and power port. - 2. inputs - - `prescaler` - + `prescaler` determines the execution cycle of the `MainRoutine` function. - + The period of `MainRoutine` equals to `SimTime::compo_update_interval_sec` $\times$ `prescaler`. - - `clock_gen` - + `clock_gen` is an instance that simulates the clock of a component. - + Users do not need to care about this. - - `power_port` - + `power_port` is an instance that simulates the power supply - - `fast_prescaler` - + `fast_prescaler` determines the execution cycle of the `FastUpdate` function. - + The period of `FastUpdate` equals to `SimTime::compo_update_interval_sec` $\times$ `fast_prescaler`. - + If you don't need to use `FastUpdate`, you don't need to specify this (it is set to 1 by default). - 3. algorithm - - N/A - 4. note - - N/A - -2. `MainRoutine` - 1. overview - - Components' main function - 2. inputs - - `time_count` - + `time_count` is incremented each time the `Tick` function is called. - + Users can use this timing information when they need for their components. - 3. algorithm - - N/A - 4. note - - All the components have to override the `MainRoutine` function. - -3. `FastUpdate` - 1. overview - - This function handles the processes that need to be computed in a high-speed cycle. - 2. inputs - - N/A - 3. algorithm - - N/A - 4. note - - `FastUpdate` function is not a pure virtual function, so components without fast calculation do not need to override this function. - - As explained in the `FastTick` section, `ITickable::needs_fast_update_` flag must be true to call `FastUpdate`. So, if users want to use `FastUpdate`, call `ITickable::SetNeedsFastUpdate(true)` in the constructor of each component. - -4. `Tick` - 1. overview - - This function executes `MainRoutine`. - - `ClockGenerator` class calls this function. - 2. inputs - - `count` - + `count` is incremented each time the `Tick` function is called. - 3. algorithm - - Execute `MainRoutine` when the `count` is divisible by the `prescaler`. By this mechanism, the execution period of `MainRoutine` is divided. - 4. note - - N/A - -4. `FastTick` - 1. overview - - This function executes `FastUpdate`. - - `ClockGenerator` class calls this function. - 2. inputs - - `count` - + `count` is incremented each time the `FastTick` function is called. - 3. algorithm - - Execute `FastUpdate` when the `count` is divisible by the `fast_prescaler`. By this mechanism, the execution period of `FastUpdate` is divided. - 4. note - - `ITickable::needs_fast_update_` flag must be true to call `FastUpdate`. So, if you want to use `FastUpdate`, call `ITickable::SetNeedsFastUpdate(true)` in the constructor of each component. +### 1. Constructor +#### 1. overview +- Users can set component update `prescaler` and power port. + +#### 2. inputs +- `prescaler` + + `prescaler` determines the execution cycle of the `MainRoutine` function. + + The period of `MainRoutine` equals to `SimTime::compo_update_interval_sec` $\times$ `prescaler`. +- `clock_gen` + + `clock_gen` is an instance that simulates the clock of a component. + + Users do not need to care about this. +- `power_port` + + `power_port` is an instance that simulates the power supply +- `fast_prescaler` + + `fast_prescaler` determines the execution cycle of the `FastUpdate` function. + + The period of `FastUpdate` equals to `SimTime::compo_update_interval_sec` $\times$ `fast_prescaler`. + + If you don't need to use `FastUpdate`, you don't need to specify this (it is set to 1 by default). + +#### 3. algorithm +- N/A + +#### 4. note +- N/A + +### 2. `MainRoutine` +#### 1. overview +- Components' main function + +#### 2. inputs +- `time_count` + + `time_count` is incremented each time the `Tick` function is called. + + Users can use this timing information when they need for their components. + +#### 3. algorithm +- N/A + +#### 4. note +- All the components have to override the `MainRoutine` function. + +### 3. `FastUpdate` +#### 1. overview +- This function handles the processes that need to be computed in a high-speed cycle. + +#### 2. inputs +- N/A + +#### 3. algorithm +- N/A + +#### 4. note +- `FastUpdate` function is not a pure virtual function, so components without fast calculation do not need to override this function. +- As explained in the `FastTick` section, `ITickable::needs_fast_update_` flag must be true to call `FastUpdate`. So, if users want to use `FastUpdate`, call `ITickable::SetNeedsFastUpdate(true)` in the constructor of each component. + +### 4. `Tick` +#### 1. overview +- This function executes `MainRoutine`. +- `ClockGenerator` class calls this function. + +#### 2. inputs +- `count` + + `count` is incremented each time the `Tick` function is called. + +#### 3. algorithm +- Execute `MainRoutine` when the `count` is divisible by the `prescaler`. By this mechanism, the execution period of `MainRoutine` is divided. + +#### 4. note +- N/A + +### 5. `FastTick` +#### 1. overview +- This function executes `FastUpdate`. +- `ClockGenerator` class calls this function. + +#### 2. inputs +- `count` + + `count` is incremented each time the `FastTick` function is called. + +#### 3. algorithm +- Execute `FastUpdate` when the `count` is divisible by the `fast_prescaler`. By this mechanism, the execution period of `FastUpdate` is divided. + +#### 4. note +- `ITickable::needs_fast_update_` flag must be true to call `FastUpdate`. So, if you want to use `FastUpdate`, call `ITickable::SetNeedsFastUpdate(true)` in the constructor of each component. ## 3. Results of verifications - N/A diff --git a/Specifications/Component/Abstract/Spec_ObcCommunicationBase.md b/Specifications/Component/Abstract/Spec_ObcCommunicationBase.md index 65cf9ad1..5c0f93d1 100644 --- a/Specifications/Component/Abstract/Spec_ObcCommunicationBase.md +++ b/Specifications/Component/Abstract/Spec_ObcCommunicationBase.md @@ -1,99 +1,124 @@ # Specification of UartCommunicationWithObc class ## 1. Overview -1. Functions - - 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 - - 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 `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); - int SendTelemetry(const int offset); - ``` - - In the protected functions, the following pure virtual functions are called. Users need to define the functions in the subclass. - ```cpp - virtual int ParseCommand(const int cmd_size)=0; - virtual int GenerateTelemetry()=0; - ``` +### 1. Functions +- 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 +- 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 `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); + int SendTelemetry(const int offset); + ``` +- In the protected functions, the following pure virtual functions are called. Users need to define the functions in the subclass. + ```cpp + virtual int ParseCommand(const int cmd_size)=0; + virtual int GenerateTelemetry()=0; + ``` ## 2. Explanation of Algorithm -1. Constructors - 1. overview - - 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 `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 `uart_port.hpp` - 3. algorithm - - N/A - 4. note - - N/A -2. Destructor - 1. overview - - In the destructor, the communication port is closed. - - If another component has closed the port, the close function returns an error, and the constructors output a message. - 2. inputs and outputs - - N/A - 3. algorithm - - N/A - 4. note - - N/A -3. ReceiveCommand - 1. overview - - Receive command data sent from the OBC. - 2. inputs and outputs - - input - - offset: offset value of the rx_buffer [Byte] - - rec_size: receiving data size = length of the command [Byte] - - output - - return: Error code. (<=0: Error was happened) - 3. algorithm - - N/A - 4. note - - N/A -4. SendTelemetry - 1. overview - - Send telemetry data to the OBC. - 2. inputs and outputs - - input - - offset: offset value of the tx_buffer [Byte] - - output - - return: Error code. 0: fine, <0: Error. - 3. algorithm - - N/A - 4. note - - N/A -5. ParseCommand - 1. overview - - Users need to define this function to analyze the command. - 2. inputs and outputs - - input - - cmd_size: command side [Byte] - - output - - return: Error code. (<=0: Error was happened) - 3. algorithm - - N/A - 4. note - - N/A -6. GenerateTelemetry - 1. overview - - Users need to define this function to make telemetry. - 2. inputs and outputs - - input: N/A - - output - - return: send data size [Byte] - 3. algorithm - - N/A - 4. note - - N/A +### 1. Constructors +#### 1. overview +- 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 `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 `uart_port.hpp` + +#### 3. algorithm +- N/A + +#### 4. note +- N/A + +### 2. Destructor +#### 1. overview +- In the destructor, the communication port is closed. +- If another component has closed the port, the close function returns an error, and the constructors output a message. + +#### 2. inputs and outputs +- N/A + +#### 3. algorithm +- N/A + +#### 4. note +- N/A + +### 3. ReceiveCommand +#### 1. overview +- Receive command data sent from the OBC. + +#### 2. inputs and outputs +- input + - offset: offset value of the rx_buffer [Byte] + - rec_size: receiving data size = length of the command [Byte] +- output + - return: Error code. (<=0: Error was happened) + +#### 3. algorithm +- N/A + +#### 4. note +- N/A + +### 4. SendTelemetry +#### 1. overview +- Send telemetry data to the OBC. + +#### 2. inputs and outputs +- input + - offset: offset value of the tx_buffer [Byte] +- output + - return: Error code. 0: fine, <0: Error. + +#### 3. algorithm +- N/A + +#### 4. note +- N/A + +### 5. ParseCommand +#### 1. overview +- Users need to define this function to analyze the command. + +#### 2. inputs and outputs +- input + - cmd_size: command side [Byte] +- output + - return: Error code. (<=0: Error was happened) + +#### 3. algorithm +- N/A +#### 4. note +- N/A + +### 6. GenerateTelemetry +#### 1. overview +- Users need to define this function to make telemetry. + +#### 2. inputs and outputs +- input: N/A +- output + - return: send data size [Byte] + +#### 3. algorithm +- N/A + +#### 4. note +- N/A + ## 3. Results of verifications - N/A diff --git a/Specifications/Component/Abstract/Spec_SensorBase.md b/Specifications/Component/Abstract/Spec_SensorBase.md index 9606113e..8cff996f 100644 --- a/Specifications/Component/Abstract/Spec_SensorBase.md +++ b/Specifications/Component/Abstract/Spec_SensorBase.md @@ -1,57 +1,65 @@ # Specification of Sensor class ## 1. Overview -1. Functions - - 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 - - Random Walk noise - - Scale factor noise and cross-talk between axes +### 1. Functions +- 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 + - Random Walk noise + - Scale factor noise and cross-talk between axes -2. Related files - - Main file: `sensor_base.cpp, .hpp` - - Used Libraries: `vector.hpp`, `matrix.hpp`, `normal_randomization.hpp`, `random_walk.hpp` +### 2. Related files +- 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 `GyroSensor` and `Magnetometer` in `S2E_CORE` are useful as usage examples. +### 3. How to use +- Inherit this class by your sensor class. +- The `GyroSensor` and `Magnetometer` in `S2E_CORE` are useful as usage examples. ## 2. Explanation of Algorithm -1. Constructor - 1. overview - - Users can set sensor noise parameters by using the Constructor. - 2. inputs - - `scale_factor`: Scale factor matrix to express scale factor noise and cross-talk - - Range related parameters - - `range_to_const_c`: The output value cannot over this value - - `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_noise_c`: Constant offset noise - - `normal_random_standard_deviation_c`: Standard deviation for normal random noise - - Random Walk noise parameters - - `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. - - `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. - 3. algorithm - - The values of the `range_to_const_c` and `range_to_zero_c` are checked here with the `RangeCheck` function. - 4. note - - N/A -2. Measure - 1. overview - - This function adds all noises, and the output is clipped by the `Clip` function not to over the ranges. - 2. inputs and outputs - - input: True value on the component frame - - output: Measured value on the component frame - 3. algorithm - - N/A - 4. note - - N/A +### 1. Constructor +#### 1. overview +- Users can set sensor noise parameters by using the Constructor. + +#### 2. inputs +- `scale_factor`: Scale factor matrix to express scale factor noise and cross-talk +- Range related parameters + - `range_to_const_c`: The output value cannot over this value + - `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_noise_c`: Constant offset noise +- `normal_random_standard_deviation_c`: Standard deviation for normal random noise +- Random Walk noise parameters + - `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. + - `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. + +#### 3. algorithm +- The values of the `range_to_const_c` and `range_to_zero_c` are checked here with the `RangeCheck` function. + +#### 4. note +- N/A + +### 2. Measure +#### 1. overview +- This function adds all noises, and the output is clipped by the `Clip` function not to over the ranges. + +#### 2. inputs and outputs +- input: True value on the component frame +- output: Measured value on the component frame + +#### 3. algorithm +- N/A + +#### 4. note +- N/A + ## 3. Results of verifications - We verified the `Sensor` class with the following parameters. - Default parameters diff --git a/Specifications/Component/Mission/Spec_Telescope_en.md b/Specifications/Component/Mission/Spec_Telescope_en.md index 215b9e25..7bc9166d 100644 --- a/Specifications/Component/Mission/Spec_Telescope_en.md +++ b/Specifications/Component/Mission/Spec_Telescope_en.md @@ -7,265 +7,267 @@ + Positions of the celestial bodies on the image sensor + Positions of stars on the image sensor -1. functions - - `MainRoutine` runs the following three functions: - + `JudgeForbiddenAngle` - * Function to judge whether the celestial body is in the forbidden angle. - + `Observe` - * Function to - - judge whether the celestial body(provided by `CelesInfo`) is in the field of view. - - 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`. +### 1. functions +- `MainRoutine` runs the following three functions: + + `JudgeForbiddenAngle` + * Function to judge whether the celestial body is in the forbidden angle. + + `Observe` + * Function to + - judge whether the celestial body(provided by `CelesInfo`) is in the field of view. + - 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`. +### 2. files +- `telescope.cpp` , `telescope.hpp` + + Definitions and declarations of the class +- `hipparcos_catalogue.cpp` , `hipparcos_catalogue.hpp` + + Definitions and declarations of the class to read Hipparcos catalogue. -2. files - - `telescope.cpp` , `telescope.hpp` - + Definitions and declarations of the class - - `hipparcos_catalogue.cpp` , `hipparcos_catalogue.hpp` - + Definitions and declarations of the class to read Hipparcos catalogue. - -3. how to use - - 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/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 - ``` +### 3. how to use +- 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/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 + ``` ## 2. Explanation of Algorithm -1. `JudgeForbiddenAngle` - 1. overview - - Function to judge whether a celestial body is in the forbidden angle. +### 1. `JudgeForbiddenAngle` +#### 1. overview +- Function to judge whether a celestial body is in the forbidden angle. - 2. input and output - - input - + The position vector of the celestial body in the body-fixed coordinate. - * This position vector is provided by `CelestialInformation`. - + The forbidden angle about the celestial body - + 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 +#### 2. input and output +- input + + The position vector of the celestial body in the body-fixed coordinate. + * This position vector is provided by `CelestialInformation`. + + The forbidden angle about the celestial body + + 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. +#### 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. -2. `Observe` - 1. overview - - 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. `Observe` +#### 1. overview +- 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 - * `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. +#### 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 + * `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. - 3. algorithm - 1. Calculate process to judge whether the celestial body is in the field of view - - A 2D coordinate on the image sensor is defined to handle the position on the image sensor. The definition is as follows: - - The X-axis of the image sensor coordinate corresponds with the Z-axis of the component coordinate. - - The Y-axis of the image sensor coordinate corresponds with the Y-axis of the component coordinate. - - Then, the inclination angle from the X-axis of the celestial body's direction in the XZ plane of the component coordinate is calculated using $(x_c, y_c, z_c)$ as follows: - ```math - tan^{-1}⁡\frac{z_c}{x_c} - ``` - - - In the same way, the inclination angle from the X-axis of the celestial body's direction in the XY plane of the component coordinate is calculated as follows: - ```math - tan^{-1}⁡\frac{y_c}{x_c} - ``` - - - They are written as `arg_x` and `arg_y` in the code. In this manual, $\theta_x$ and $\theta_y$ are used for them. If $\theta_x$ is within FOV_x and $\theta_y$ is within FOV_y, the celestial body is judged to be in the field of view. +#### 3. algorithm +##### 1. Calculate process to judge whether the celestial body is in the field of view +- A 2D coordinate on the image sensor is defined to handle the position on the image sensor. The definition is as follows: + - The X-axis of the image sensor coordinate corresponds with the Z-axis of the component coordinate. + - The Y-axis of the image sensor coordinate corresponds with the Y-axis of the component coordinate. +- Then, the inclination angle from the X-axis of the celestial body's direction in the XZ plane of the component coordinate is calculated using $(x_c, y_c, z_c)$ as follows: -
-
- 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)
-
-
+```math +tan^{-1}⁡\frac{z_c}{x_c} +``` - 2. Calculate process for calculating the position of the image - - The origin of the sensor coordinate is the corner of the image sensor, so $x_{imgsensor}$ and $y_{imgsensor}$ have positive values. The unit of them is pixel(pix). In this manual, $N_x$ and $N_y$ are used for the total number of pixels along x, y axes of the sensor coordinate (They are `x_num_of_pix` and `y_num_of_pix` in the code). In the same way, `X` and `Y` are used for the position of the celestial body on the image sensor (They are `pos_imgsensor[0]` and `pos_imgsensor[1]`). Then, `X` and `Y` are calculated as follows: - ```math - X=\frac{N_x}{2}\times\frac{\tan(\theta_x)}{\tan(FOV_x)}+\frac{N_x}{2} - ``` - ```math - Y=\frac{N_y}{2}\times\frac{\tan(\theta_y)}{\tan(FOV_y)}+\frac{N_y}{2} - ``` +- In the same way, the inclination angle from the X-axis of the celestial body's direction in the XY plane of the component coordinate is calculated as follows: - If the celestial body is not in the field of view, the output is $X=Y=-1$. +```math +tan^{-1}⁡\frac{y_c}{x_c} +``` -3. `ObserveStars` - 1. overview - - Function to output some HIP IDs of the brightest stars in the field of view, using `HipparcosCatalogue` +- They are written as `arg_x` and `arg_y` in the code. In this manual, $\theta_x$ and $\theta_y$ are used for them. If $\theta_x$ is within FOV_x and $\theta_y$ is within FOV_y, the celestial body is judged to be in the field of view. - 2. input and output - - input - + (void) - - output - + (void) +
+
+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)
+
+
- 3. main process - When `ObserveStars` is called in the `MainRoutine`, this function works as follows: - 1. Clear `star_in_sight` - 2. Judge the brightest star (provided by `HipparcosCatalogue`) is in the field of view - 3. If the star is in the field of view, push the information (such as the HIP ID and its position on the image sensor) to `star_in_sight` - 4. Go to step 2. to judge the next brightest star - 5. Exit the loop when the number of elements of `star_in_sight` reaches the specified number - - 4. error handling - If all the data in `HipparcosCatalogue` are checked before the number of elements of `star_in_sight` reaches the specified number, the data of lacking element is filled with -1. +##### 2. Calculate process for calculating the position of the image +- The origin of the sensor coordinate is the corner of the image sensor, so $x_{imgsensor}$ and $y_{imgsensor}$ have positive values. The unit of them is pixel(pix). In this manual, $N_x$ and $N_y$ are used for the total number of pixels along x, y axes of the sensor coordinate (They are `x_num_of_pix` and `y_num_of_pix` in the code). In the same way, `X` and `Y` are used for the position of the celestial body on the image sensor (They are `pos_imgsensor[0]` and `pos_imgsensor[1]`). Then, `X` and `Y` are calculated as follows: +```math +X=\frac{N_x}{2}\times\frac{\tan(\theta_x)}{\tan(FOV_x)}+\frac{N_x}{2} +``` +```math +Y=\frac{N_y}{2}\times\frac{\tan(\theta_y)}{\tan(FOV_y)}+\frac{N_y}{2} +``` + +If the celestial body is not in the field of view, the output is $X=Y=-1$. + +### 3. `ObserveStars` +#### 1. overview +- Function to output some HIP IDs of the brightest stars in the field of view, using `HipparcosCatalogue` + +#### 2. input and output +- input + + (void) +- output + + (void) + +#### 3. main process +When `ObserveStars` is called in the `MainRoutine`, this function works as follows: +1. Clear `star_in_sight` +2. Judge the brightest star (provided by `HipparcosCatalogue`) is in the field of view +3. If the star is in the field of view, push the information (such as the HIP ID and its position on the image sensor) to `star_in_sight` +4. Go to step 2. to judge the next brightest star +5. Exit the loop when the number of elements of `star_in_sight` reaches the specified number + +#### 4. error handling +If all the data in `HipparcosCatalogue` are checked before the number of elements of `star_in_sight` reaches the specified number, the data of lacking element is filled with -1. ## 3. Results of verifications In this section, the output of the functions when some angular velocity is input is verified. -1. Input of angular velocity around X-axis of the body coordinate - 1. overview - - input $ω_b=[0.1~0~0]^T$ . - 2. conditions for the verification - 1. input files - - `sample_simulation_base.ini` - - `telescope.ini` - 2. initial condition - - `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` - ``` - q_b2c=[0 0 0 1]^T - sun_forbidden_angle = 60 - earth_forbidden_angle = 60 - moon_forbidden_angle = 60 - x_num_of_pix = 2048 - y_num_of_pix = 2048 - x_fov_par_pix = 0.02 - y_fov_par_pix = 0.02 - ``` - - `sample_simulation_base.ini` - ``` - [HIPPARCOS_CATALOGUE] - max_magnitude = 5.0 - calculation = ENABLE - logging = DISABLE - ``` - - The disturbance torque in the main function of `sample_case.cpp` is commented out. - - 3. result - 1. judge for forbidden angle - - The angle from the line of sight about the direction of the Sun, the Earth, the Moon is as follows: -
-
- The angle from the line of sight about the direction of the Sun, the Earth, the Moon -
The angle from the line of sight about the direction of the Sun, the Earth, the Moon
-
-
- Then, the result of the judge for the forbidden angles is as follows: -
-
- result of the judge for the forbidden angles about the Sun, the Earth, the Moon -
result of the judge for the forbidden angles about the Sun, the Earth, the Moon
-
-
- The above figures show that the judge correctly detects when a celestial body in its forbidden angle. +### 1. Input of angular velocity around X-axis of the body coordinate +#### 1. overview +- input $ω_b=[0.1~0~0]^T$ . +#### 2. conditions for the verification +- input files + - `sample_simulation_base.ini` + - `telescope.ini` +- initial condition + - `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` + ``` + q_b2c=[0 0 0 1]^T + sun_forbidden_angle = 60 + earth_forbidden_angle = 60 + moon_forbidden_angle = 60 + x_num_of_pix = 2048 + y_num_of_pix = 2048 + x_fov_par_pix = 0.02 + y_fov_par_pix = 0.02 + ``` + - `sample_simulation_base.ini` + ``` + [HIPPARCOS_CATALOGUE] + max_magnitude = 5.0 + calculation = ENABLE + logging = DISABLE + ``` + +The disturbance torque in the main function of `sample_case.cpp` is commented out. - 2. `Observe` function - - Only the Moon and the Earth are in the field of view (See the figure "The angle from the line of sight about the direction of the Sun, the Earth, the Moon"). The track of the image of the Moon on the image sensor is as follows: -
-
- The track of the image of the Moon on the image sensor -
The track of the image of the Moon on the image sensor
-
-
- This figure shows the track makes a circle. This result seems to be reasonable, because the angular velocity around the X-axis of the body coordinate correspond with that of the component coordinate, for $q_{b2c}=[0~0~0~1]^T$ . The 3D plot of MOON_POS_B for further verification is as follows: -
-
- 3D plot of MOON_POS_B -
3D plot of MOON_POS_B
-
-
- Considering that the projection of the track of MOON_POS_B to the YZ plane corresponds the track of the image on the image sensor because the line of sight is the X-axis, the result also seems to be reasonable. Next, the track of the image of the Moon on the image sensor is as follows: -
-
- The track of the image of the Earth on the image sensor -
The track of the image of the Earth on the image sensor
-
-
+#### 3. result +1. judge for forbidden angle + - The angle from the line of sight about the direction of the Sun, the Earth, the Moon is as follows: +
+
+ The angle from the line of sight about the direction of the Sun, the Earth, the Moon +
The angle from the line of sight about the direction of the Sun, the Earth, the Moon
+
+
+ Then, the result of the judge for the forbidden angles is as follows: +
+
+ result of the judge for the forbidden angles about the Sun, the Earth, the Moon +
result of the judge for the forbidden angles about the Sun, the Earth, the Moon
+
+
+ The above figures show that the judge correctly detects when a celestial body in its forbidden angle. - In addition, the 3D plot of EARTH_POS_B is as follows: -
-
- 3D plot of EARTH_POS_B -
3D plot of EARTH_POS_B
-
-
- As well as the Moon case, this result seems to be reasonable because the projection of the track of the Earth to the YZ plane corresponds with the track of the image. +2. `Observe` function + - Only the Moon and the Earth are in the field of view (See the figure "The angle from the line of sight about the direction of the Sun, the Earth, the Moon"). The track of the image of the Moon on the image sensor is as follows: +
+
+ The track of the image of the Moon on the image sensor +
The track of the image of the Moon on the image sensor
+
+
+ This figure shows the track makes a circle. This result seems to be reasonable, because the angular velocity around the X-axis of the body coordinate correspond with that of the component coordinate, for $q_{b2c}=[0~0~0~1]^T$ . The 3D plot of MOON_POS_B for further verification is as follows: +
+
+ 3D plot of MOON_POS_B +
3D plot of MOON_POS_B
+
+
+ Considering that the projection of the track of MOON_POS_B to the YZ plane corresponds the track of the image on the image sensor because the line of sight is the X-axis, the result also seems to be reasonable. Next, the track of the image of the Moon on the image sensor is as follows: +
+
+ The track of the image of the Earth on the image sensor +
The track of the image of the Earth on the image sensor
+
+
- 3. `ObserveStars`function - - The first, second, and third HIP ID outputs were 113368, 9884, and 3419. Their track on the image sensor are as follows: -
-
- The stars' track on the image sensor -
The stars' track on the image sensor
-
-
- - The tracks make circles, which are the reasonable outputs because of the same reason stated in the verification of `Observe` function. In addition, the each Vmag of HIP ID=113368,9884,and 3419 is 1.17,2.01,and 2.04, so it is verified that the outputs are in order of brightness. + In addition, the 3D plot of EARTH_POS_B is as follows: +
+
+ 3D plot of EARTH_POS_B +
3D plot of EARTH_POS_B
+
+
+ As well as the Moon case, this result seems to be reasonable because the projection of the track of the Earth to the YZ plane corresponds with the track of the image. + + 3. `ObserveStars`function + - The first, second, and third HIP ID outputs were 113368, 9884, and 3419. Their track on the image sensor are as follows: +
+
+ The stars' track on the image sensor +
The stars' track on the image sensor
+
+
+ + The tracks make circles, which are the reasonable outputs because of the same reason stated in the verification of `Observe` function. In addition, the each Vmag of HIP ID=113368,9884,and 3419 is 1.17,2.01,and 2.04, so it is verified that the outputs are in order of brightness. -2. input of angular velocity around y axis of the body coordinate - 1. overview - - The angular velocity input is $ω_b=[0.1~0~0]^T$ .The other condition is the same as the case of 1. Note that the verification of the case around z axis is omitted because y and z are equivalent under this condition. - 1. result - 1. judge for forbidden angle - - The angle from the line of sight about the direction of the Sun, the Earth, the Moon is as follows: -
-
- The angle from the line of sight about the direction of the Sun, the Earth, the Moon -
The angle from the line of sight about the direction of the Sun, the Earth, the Moon
-
- Then, the result of the judge for the forbidden angles is as follows: -
- The result of the judge for the forbidden angles -
The result of the judge for the forbidden angles
-
-
- These above figures show that the judge is correctly conducted when a celestial body in its forbidden angle. +### 2. input of angular velocity around y axis of the body coordinate +#### 1. overview +- The angular velocity input is $ω_b=[0.1~0~0]^T$ .The other condition is the same as the case of 1. Note that the verification of the case around z axis is omitted because y and z are equivalent under this condition. - 2. `Observe` function - - The figure "The angle from the line of sight about the direction of the Sun, the Earth, the Moon" shows that the earth is mainly in the field of view, so this section discusses only about the Earth. The track of the image of the Earth is as follows (For the sake of ease, only 4 tracks in the field of view are displayed): -
-
- The track of the image of the Earth on the image sensor -
The track of the image of the Earth on the image sensor
-
-
- In addition, the 3D plot of EARTH_POS_B is as follows: -
-
- 3D plot of EARTH_POS_B -
3D plot of EARTH_POS_B
-
-
- The 3D plot of EARTH_POS_B shows that the track of EARTH_POS_B is a spiral which axis is at right angle to the line of sight. In this case, it can be showed that the track on image sensor forms a hyperbola(The proof for this is omitted). Considering this fact, the result seems to be reasonable. - - 3. `ObserveStars` function - - The tracks of the stars are partially as follows: -
-
- The stars' track on the image sensor -
The stars' track on the image sensor
-
-
- As mentioned in `Observe` function section, they form hyperbolas which axis of symmetry is Y=1024. In addition, it was confirmed that the data was output in order of the brightness on each time (The result is complicated, so it is not list in this manual). +#### 2. result +1. judge for forbidden angle +- The angle from the line of sight about the direction of the Sun, the Earth, the Moon is as follows: +
+
+The angle from the line of sight about the direction of the Sun, the Earth, the Moon +
The angle from the line of sight about the direction of the Sun, the Earth, the Moon
+
+Then, the result of the judge for the forbidden angles is as follows: +
+The result of the judge for the forbidden angles +
The result of the judge for the forbidden angles
+
+
+These above figures show that the judge is correctly conducted when a celestial body in its forbidden angle. + +2. `Observe` function +- The figure "The angle from the line of sight about the direction of the Sun, the Earth, the Moon" shows that the earth is mainly in the field of view, so this section discusses only about the Earth. The track of the image of the Earth is as follows (For the sake of ease, only 4 tracks in the field of view are displayed): +
+
+The track of the image of the Earth on the image sensor +
The track of the image of the Earth on the image sensor
+
+
+In addition, the 3D plot of EARTH_POS_B is as follows: +
+
+3D plot of EARTH_POS_B +
3D plot of EARTH_POS_B
+
+
+The 3D plot of EARTH_POS_B shows that the track of EARTH_POS_B is a spiral which axis is at right angle to the line of sight. In this case, it can be showed that the track on image sensor forms a hyperbola(The proof for this is omitted). Considering this fact, the result seems to be reasonable. + +3. `ObserveStars` function +- The tracks of the stars are partially as follows: +
+
+The stars' track on the image sensor +
The stars' track on the image sensor
+
+
+As mentioned in `Observe` function section, they form hyperbolas which axis of symmetry is Y=1024. In addition, it was confirmed that the data was output in order of the brightness on each time (The result is complicated, so it is not list in this manual). ## 4. References diff --git a/Specifications/Component/Mission/Spec_Telescope_ja.md b/Specifications/Component/Mission/Spec_Telescope_ja.md index 8983a0a4..f5d2cbcd 100644 --- a/Specifications/Component/Mission/Spec_Telescope_ja.md +++ b/Specifications/Component/Mission/Spec_Telescope_ja.md @@ -4,264 +4,261 @@ - 望遠鏡を模擬したクラス. - 太陽系内の天体および恒星の位置データより,禁止角判定,および天体のイメージセンサ上の位置を返す. -1. 関数 - - `MainRoutine`内では以下の3つの関数を動作させている. - + `JudgeForbiddenAngle` - * 太陽・月・地球の禁止角判定を行う関数. - + `Observe` - * CelesInfoが提供する天体が画角内に入っているかどうかを判定し,入っているならばイメージセンサ上の位置を出力する関数. - + `ObserveStars` - * HipparcosCatalogueを調べ,画角内に入っている恒星のうち視等級の小さい(すなわち,明るい)ものから数個のHIP IDを出力する関数. - - -2. 関連ソースコード,ファイル - - `telescope.cpp` , `telescope.hpp` - + クラスの定義が行われている. - - `hipparcos_catalogue.cpp` , `hipparcos_catalogue.hpp` - + 天球上の恒星の位置データ(ヒッパルコス星表)を読み出すためのクラスを定義している. - -3. 使い方 - - `telescope.ini`で定数を入力する. - - 初期化関数 `InitTelescope` を利用し,インスタンスを生成. - + Telescope1,…のように,個々の望遠鏡に番号が振ってある. - - `HipparcosCatalogue` のデータを利用するために,`hip_main.csv` のダウンロードを済ませる必要がある.このためのスクリプトとして `s2e-core/scripts/Common/download_HIPcatalogue.sh`を用意した.Git Bashなどを利用して,このスクリプトがあるディレクトリで以下を実行することで,必要なcsvファイルをダウンロードすることができる. - ``` - bash download_HIPcatalogue.sh - ``` - +### 1. 関数 +- `MainRoutine`内では以下の3つの関数を動作させている. + + `JudgeForbiddenAngle` + * 太陽・月・地球の禁止角判定を行う関数. + + `Observe` + * CelesInfoが提供する天体が画角内に入っているかどうかを判定し,入っているならばイメージセンサ上の位置を出力する関数. + + `ObserveStars` + * HipparcosCatalogueを調べ,画角内に入っている恒星のうち視等級の小さい(すなわち,明るい)ものから数個のHIP IDを出力する関数. + +### 2. 関連ソースコード,ファイル +- `telescope.cpp` , `telescope.hpp` + + クラスの定義が行われている. +- `hipparcos_catalogue.cpp` , `hipparcos_catalogue.hpp` + + 天球上の恒星の位置データ(ヒッパルコス星表)を読み出すためのクラスを定義している. + +### 3. 使い方 +- `telescope.ini`で定数を入力する. +- 初期化関数 `InitTelescope` を利用し,インスタンスを生成. + + Telescope1,…のように,個々の望遠鏡に番号が振ってある. +- `HipparcosCatalogue` のデータを利用するために,`hip_main.csv` のダウンロードを済ませる必要がある.このためのスクリプトとして `s2e-core/scripts/Common/download_HIPcatalogue.sh`を用意した.Git Bashなどを利用して,このスクリプトがあるディレクトリで以下を実行することで,必要なcsvファイルをダウンロードすることができる. + ``` + bash download_HIPcatalogue.sh + ``` ## 2. アルゴリズム説明 -1. `JudgeForbiddenAngle` +### 1. `JudgeForbiddenAngle` - 1. 概要 - - 太陽・月・地球の禁止角判定を行う関数. +#### 1. 概要 +- 太陽・月・地球の禁止角判定を行う関数. - 2. 入力と出力 - - 入力 - + 判定対象の天体の,body座標系から見た位置 - * この位置は,CelesInfoから提供される - + その判定対象の天体に関する禁止角 - * 禁止角の値は,`telescope.ini`で指定する - - 出力 - + 禁止角に入っているならばtrue,そうでないならばfalse +#### 2. 入力と出力 +- 入力 + + 判定対象の天体の,body座標系から見た位置 + * この位置は,CelesInfoから提供される + + その判定対象の天体に関する禁止角 + * 禁止角の値は,`telescope.ini`で指定する +- 出力 + + 禁止角に入っているならばtrue,そうでないならばfalse - 3. 判定処理 - - 処理はコンポ座標系で行っている.$q_{b2c}$はTelescope.iniで指定する機体座標系(B)→コンポ座標系(C)変換Quaternionである.コンポ座標系は,望遠鏡視線方向をx方向としている. - +#### 3. 判定処理 +- 処理はコンポ座標系で行っている.$q_{b2c}$はTelescope.iniで指定する機体座標系(B)→コンポ座標系(C)変換Quaternionである.コンポ座標系は,望遠鏡視線方向をx方向としている. -2. `Observe` - 1. 概要 - - CelesInfoが提供する天体が画角内に入っているかどうかを判定し,入っているならばイメージセンサ上の位置を出力する関数. - - 画角内に入っていない場合は,(-1, -1)を出力する. +### 2. `Observe` - 2. 入力と出力 - - 入力 - + 対象天体の像の,望遠鏡センサ面上における位置への参照 - + 判定対象の天体の,body座標系から見た位置 - * この位置は,CelesInfoから提供される - - 出力 - + なし - * 入力として与えた「対象天体の像の,望遠鏡センサ面上における位置」を書き換えている +#### 1. 概要 +- CelesInfoが提供する天体が画角内に入っているかどうかを判定し,入っているならばイメージセンサ上の位置を出力する関数. +- 画角内に入っていない場合は,(-1, -1)を出力する. - 3. 判定処理 - 1. 画角内判定処理 - イメージセンサ上での位置を取り扱うため,センサ上に改めて2次元座標系を定義しなおしている.具体的には,コンポ座標系z軸方向がセンサ座標系x軸方向,コンポ座標系y軸方向がセンサ座標系y軸方向に一致するように定義している. -
-
- コンポ座標系(C)とセンサ座標系(imgsensor)の関係 -
コンポ座標系(C)とセンサ座標系(imgsensor)の関係
-
-
+#### 2. 入力と出力 +- 入力 + + 対象天体の像の,望遠鏡センサ面上における位置への参照 + + 判定対象の天体の,body座標系から見た位置 + * この位置は,CelesInfoから提供される +- 出力 + + なし + * 入力として与えた「対象天体の像の,望遠鏡センサ面上における位置」を書き換えている - このとき,コンポ座標系からみた天体の位置 $(x_c,y_c,z_c)$ より,コンポ座標系xz平面でみた天体の方向のx軸からの偏角は +#### 3. 判定処理 +1. 画角内判定処理 +イメージセンサ上での位置を取り扱うため,センサ上に改めて2次元座標系を定義しなおしている.具体的には,コンポ座標系z軸方向がセンサ座標系x軸方向,コンポ座標系y軸方向がセンサ座標系y軸方向に一致するように定義している. +
+
+コンポ座標系(C)とセンサ座標系(imgsensor)の関係 +
コンポ座標系(C)とセンサ座標系(imgsensor)の関係
+
+
- ```math - tan^{-1}⁡\frac{z_c}{x_c} - ``` +このとき,コンポ座標系からみた天体の位置 $(x_c,y_c,z_c)$ より,コンポ座標系xz平面でみた天体の方向のx軸からの偏角は - であり,コンポ座標系xy平面でみた天体の方向のx軸からの偏角は +```math +tan^{-1}⁡\frac{z_c}{x_c} +``` - ```math - tan^{-1}⁡\frac{y_c}{x_c} - ``` +であり,コンポ座標系xy平面でみた天体の方向のx軸からの偏角は - で計算される.これらの値はそれぞれソースコード上でarg_x,およびarg_yである(説明上,それぞれ $\theta_x$,$\theta_y$と表記する). $\theta_x$ がセンサ座標系x方向の視野角(FOV_x)以下であり,かつ $\theta_y$ がセンサ座標系y方向の視野角(FOV_y)以下であれば対象の天体が画角内に入っていると判定する. +```math +tan^{-1}⁡\frac{y_c}{x_c} +``` - 4. イメージセンサ上における位置計算処理 - - センサ座標系の原点はイメージセンサの角に位置しており, $x_{imgsensor}$ および $y_{imgsensor}$ は原点を基準とした正の値で表現される.単位はピクセル(pix)である.ここでは説明のためイメージセンサのx方向全ピクセル数(ソースコード上ではx_num_of_pix),y方向全ピクセル数(ソースコード上ではy_num_of_pix)をそれぞれ $N_x$ および $N_y$ と表記する.同様に,天体のイメージセンサ上の位置(ソースコード上ではpos_imgsensor)をX,Yと表記することにすれば,これらは - - ```math - X=\frac{N_x}{2}\times\frac{\tan(\theta_x)}{\tan(FOV_x)}+\frac{N_x}{2} - ``` - ```math - Y=\frac{N_y}{2}\times\frac{\tan(\theta_y)}{\tan(FOV_y)}+\frac{N_y}{2} - ``` +で計算される.これらの値はそれぞれソースコード上でarg_x,およびarg_yである(説明上,それぞれ $\theta_x$,$\theta_y$と表記する). $\theta_x$ がセンサ座標系x方向の視野角(FOV_x)以下であり,かつ $\theta_y$ がセンサ座標系y方向の視野角(FOV_y)以下であれば対象の天体が画角内に入っていると判定する. - として計算される.なお,天体が画角内に入っていないときは, $X=Y=-1$ なる出力を与える. +#### 4. イメージセンサ上における位置計算処理 +- センサ座標系の原点はイメージセンサの角に位置しており, $x_{imgsensor}$ および $y_{imgsensor}$ は原点を基準とした正の値で表現される.単位はピクセル(pix)である.ここでは説明のためイメージセンサのx方向全ピクセル数(ソースコード上ではx_num_of_pix),y方向全ピクセル数(ソースコード上ではy_num_of_pix)をそれぞれ $N_x$ および $N_y$ と表記する.同様に,天体のイメージセンサ上の位置(ソースコード上ではpos_imgsensor)をX,Yと表記することにすれば,これらは -3. `ObserveStars` - 1. 概要 - - `HipparcosCatalogue` を調べ,画角内に入っている恒星のうち視等級の小さい(すなわち,明るい)ものから数個のHIP IDを出力する関数. - - 出力するHIP IDの個数はTelescope.iniで指定する. +```math +X=\frac{N_x}{2}\times\frac{\tan(\theta_x)}{\tan(FOV_x)}+\frac{N_x}{2} +``` +```math +Y=\frac{N_y}{2}\times\frac{\tan(\theta_y)}{\tan(FOV_y)}+\frac{N_y}{2} +``` - 2. 入力と出力 - - 入力 - + なし - - 出力 - + なし +として計算される.なお,天体が画角内に入っていないときは, $X=Y=-1$ なる出力を与える. - 3. メイン処理 - - `MainRoutine` で `ObserveStars` が呼び出されると,はじめに `star_in_sight` をクリアする.続いて,視等級の小さい順に `HipparcosCatalogue` が提供する恒星が画角内に入っているかどうかを判定してゆき,入っている場合はHIP IDやセンサ上の位置などを含む情報を `star_in_sight` にプッシュする.これを `star_in_sight` の要素数が指定の個数に達するまで繰り返す.なお, `HipparcosCatalogue` はあらかじめ視等級の小さい順にソートされている. +### 3. `ObserveStars` +#### 1. 概要 +- `HipparcosCatalogue` を調べ,画角内に入っている恒星のうち視等級の小さい(すなわち,明るい)ものから数個のHIP IDを出力する関数. +- 出力するHIP IDの個数はTelescope.iniで指定する. - 4. エラー処理 - - 指定の個数に達する前に,カタログの終端に達した場合は,出力するはずであった残りのデータはすべてのパラメータを-1とする. +#### 2. 入力と出力 +- 入力 + + なし +- 出力 + + なし +#### 3. メイン処理 +- `MainRoutine` で `ObserveStars` が呼び出されると,はじめに `star_in_sight` をクリアする.続いて,視等級の小さい順に `HipparcosCatalogue` が提供する恒星が画角内に入っているかどうかを判定してゆき,入っている場合はHIP IDやセンサ上の位置などを含む情報を `star_in_sight` にプッシュする.これを `star_in_sight` の要素数が指定の個数に達するまで繰り返す.なお, `HipparcosCatalogue` はあらかじめ視等級の小さい順にソートされている. +4. エラー処理 +- 指定の個数に達する前に,カタログの終端に達した場合は,出力するはずであった残りのデータはすべてのパラメータを-1とする. ## 3. 動作確認結果 禁止角判定, `Observe` 関数の動作, `ObserveStars` 関数の動作が正しく行えているかどうかを判定する.ここでは,body座標系において各軸まわりの角速度入力があったときに,どのような出力を得るかを確認し,その妥当性を検証することにする. -1. x軸周りの角速度を与えた場合 - 1. 概要 - - 角速度入力 $ω_b=[0.1~0~0]^T$を与える. - - 2. シミュレーション条件 - 1. 入力ファイル - - `sample_simulation_base.ini` - - `telescope.ini` - 2. 初期値 - - `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` - ``` - 姿勢Quaternion : q_b2c=[0 0 0 1]^T - 太陽禁止角[deg] : 60 - 地球禁止角[deg] : 60 - 月禁止角[deg] : 60 - X方向総画素数 : 2048 - Y方向総画素数 : 2048 - X方向1ピクセル当たり視野角[deg] : 0.02 - Y方向1ピクセル当たり視野角[deg] : 0.02 - ``` - - `sample_simulation_base.ini` - ``` - [HIPPARCOS_CATALOGUE] - max_magnitude = 5.0 - calculation = ENABLE - logging = DISABLE - ``` - なお,`sample_case.cpp`のメイン関数内において,外乱トルクはコメントアウトしている. - - 3. 結果 - 1. 禁止角判定 - - 上記の条件下で,太陽・地球・月の視線方向からの角度は,以下のようである. -
-
- 太陽・月・地球の視線方向からの角度 -
太陽・月・地球の視線方向からの角度
-
-
- このとき,各禁止角判定結果は以下の通りであった. -
-
- 太陽・月・地球の禁止角判定 -
太陽・月・地球の禁止角判定
-
-
- 以上2つの図より、禁止角60度以内に入った場合に正しく禁止角判定されていることがわかる. - - 2. `Observe`関数の動作 - - 禁止角判定の結果より,画角内に入っているのは地球および月のみであるから,それらに関して検討する.月のイメージセンサ上の位置の軌跡は,以下の図のようになった. -
-
- イメージセンサ上における月の位置の軌跡 -
イメージセンサ上における月の位置の軌跡
-
-
- この図より,軌跡が円を描いていることがわかる.本シミュレーション条件では,慣性座標系(I),Body座標系(B),コンポ座標系(C)の方向が一致しているため,Body座標系x軸周りの角速度は,コンポ座標系における視線方向周りの角速度を意味するから,軌跡が真円になるはずであり,正しい.確認のためMOON_POS_Bを3次元プロットした結果は以下のようである. -
-
- MOON_POS_Bの3次元プロット -
MOON_POS_Bの3次元プロット
-
-
- 望遠鏡の視線はx方向であったから,MOON_POS_Bの軌跡のyz平面への射影がイメージセンサ上における月の位置の軌跡になっており,やはり正しい観測ができていることがわかる.地球に関しても,同様にイメージセンサ上の位置の軌跡を下図に示す. -
-
- イメージセンサ上における地球の位置の軌跡 -
イメージセンサ上における地球の位置の軌跡
-
-
- また,EARTH_POS_Bの3次元プロットは以下の通りであった. -
-
- EARTH_POS_Bの3次元プロット -
EARTH_POS_Bの3次元プロット
-
-
- 月の場合と同様に,EARTH_POS_Bの3次元プロットにおける地球の軌跡のyz平面への射影としてイメージセンサ上における地球の位置の軌跡が得られていることがわかり,正しい. - - 3. `ObserveStars`関数の動作 - - 出力結果は,1番目,2番目,3番目のHIP IDがそれぞれ113368,9884,3419であった.これらのイメージセンサ上での軌跡は以下の通りであった. -
-
- ObserveStars関数の出力で得られた各恒星の軌跡 -
ObserveStars関数の出力で得られた各恒星の軌跡
-
-
- - `ObserveStars` 関数の動作確認で述べたのと同様の理由により,軌跡が円を描いており正しい結果が得られていると考えられる.なお,HIP IDが113368,9884,3419に対応する恒星の視等級はそれぞれ1.17,2.01,2.04であることから,視等級の高いものから順番に出力されていることが確認できる. - -2. y軸周りの角速度を与えた場合 - 1. 概要 - - 角速度入力 $ω_b=[0 ~0.1~0]^T$ を与える.その他のシミュレーション条件はx軸周りの場合と同様である.なお,本シミュレーションでは望遠鏡に関してはy軸とz軸が等価であるから,z軸周りの回転を与えた場合の検証は割愛する. - 1. 結果 - 1. 禁止角判定 - - 太陽・地球・月の視線方向からの角度は,以下のようである. -
-
- 太陽・月・地球の視線方向からの角度 -
太陽・月・地球の視線方向からの角度
-
-
- このとき,各禁止角判定は以下の通りであった. -
-
- 太陽・月・地球の禁止角判定 -
太陽・月・地球の禁止角判定
-
-
- 以上2つの図より、禁止角60度以内に入った場合に正しく禁止角判定されていることがわかる. - 2. `Observe` 関数の動作 - - 太陽・地球・月の視線方向からの角度をみると,画角内に入っているのは主に地球であるから,これに関して `Observe` 関数の動作を確認する(月や太陽も画角内に入るが,地球の場合と同様の議論で済むため割愛する).視線方向に直交する軸周りの回転であるから,地球の像が画角内に何度も出入りするが,ここでは簡単のため画角内に入った軌跡のうち4本のみを取り出して表示している. -
-
- イメージセンサ上における地球の位置の軌跡 -
イメージセンサ上における地球の位置の軌跡
-
-
- このときのEARTH_POS_Bの3次元プロットも同時に示しておく. -
-
- EARTH_POS_Bの3次元プロット -
EARTH_POS_Bの3次元プロット
-
-
- EARTH_POS_Bは望遠鏡視線方向と直交する軸を中心とした螺旋を描いていることがわかる.このときイメージセンサ上に投影される軌跡は双曲線であることを示すことができる(証明は割愛).イメージセンサ上における地球の位置の軌跡は二次曲線の形状をしており,X=1024(イメージセンサの中心軸)を対称軸とした双曲線であり,正しく動作していると考えられる. - 3. `ObserveStars`関数の動作 - - x軸を中心軸とした回転の場合とは異なり,恒星の視野内の出入りが多いため,それらの一部についてイメージセンサ上の軌跡を示す. -
-
- ObserveStars関数の出力で得られた各恒星の軌跡 -
ObserveStars関数の出力で得られた各恒星の軌跡
-
-
- データ処理の都合上,途切れ途切れになっているが, `Observe` 関数の挙動で述べた通り,Y=1024を対称軸とした双曲線を描いていることがわかる.また,煩雑になるため本ファイルには載せないが,各時刻で視等級の高い順番にデータが出力されていることも確認された. +### 1. x軸周りの角速度を与えた場合 +#### 1. 概要 +- 角速度入力 $ω_b=[0.1~0~0]^T$を与える. + +#### 2. シミュレーション条件 +- 入力ファイル + - `sample_simulation_base.ini` + - `telescope.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` + ``` + 姿勢Quaternion : q_b2c=[0 0 0 1]^T + 太陽禁止角[deg] : 60 + 地球禁止角[deg] : 60 + 月禁止角[deg] : 60 + X方向総画素数 : 2048 + Y方向総画素数 : 2048 + X方向1ピクセル当たり視野角[deg] : 0.02 + Y方向1ピクセル当たり視野角[deg] : 0.02 + ``` + - `sample_simulation_base.ini` + ``` + [HIPPARCOS_CATALOGUE] + max_magnitude = 5.0 + calculation = ENABLE + logging = DISABLE + ``` + - なお,`sample_case.cpp`のメイン関数内において,外乱トルクはコメントアウトしている. + +#### 3. 結果 +1. 禁止角判定 +- 上記の条件下で,太陽・地球・月の視線方向からの角度は,以下のようである. +
+
+太陽・月・地球の視線方向からの角度 +
太陽・月・地球の視線方向からの角度
+
+
+このとき,各禁止角判定結果は以下の通りであった. +
+
+太陽・月・地球の禁止角判定 +
太陽・月・地球の禁止角判定
+
+
+以上2つの図より、禁止角60度以内に入った場合に正しく禁止角判定されていることがわかる. + +2. `Observe`関数の動作 +- 禁止角判定の結果より,画角内に入っているのは地球および月のみであるから,それらに関して検討する.月のイメージセンサ上の位置の軌跡は,以下の図のようになった. +
+
+イメージセンサ上における月の位置の軌跡 +
イメージセンサ上における月の位置の軌跡
+
+
+この図より,軌跡が円を描いていることがわかる.本シミュレーション条件では,慣性座標系(I),Body座標系(B),コンポ座標系(C)の方向が一致しているため,Body座標系x軸周りの角速度は,コンポ座標系における視線方向周りの角速度を意味するから,軌跡が真円になるはずであり,正しい.確認のためMOON_POS_Bを3次元プロットした結果は以下のようである. +
+
+MOON_POS_Bの3次元プロット +
MOON_POS_Bの3次元プロット
+
+
+望遠鏡の視線はx方向であったから,MOON_POS_Bの軌跡のyz平面への射影がイメージセンサ上における月の位置の軌跡になっており,やはり正しい観測ができていることがわかる.地球に関しても,同様にイメージセンサ上の位置の軌跡を下図に示す. +
+
+イメージセンサ上における地球の位置の軌跡 +
イメージセンサ上における地球の位置の軌跡
+
+
+また,EARTH_POS_Bの3次元プロットは以下の通りであった. +
+
+EARTH_POS_Bの3次元プロット +
EARTH_POS_Bの3次元プロット
+
+
+月の場合と同様に,EARTH_POS_Bの3次元プロットにおける地球の軌跡のyz平面への射影としてイメージセンサ上における地球の位置の軌跡が得られていることがわかり,正しい. + +3. `ObserveStars`関数の動作 +- 出力結果は,1番目,2番目,3番目のHIP IDがそれぞれ113368,9884,3419であった.これらのイメージセンサ上での軌跡は以下の通りであった. +
+
+ObserveStars関数の出力で得られた各恒星の軌跡 +
ObserveStars関数の出力で得られた各恒星の軌跡
+
+
+ +`ObserveStars` 関数の動作確認で述べたのと同様の理由により,軌跡が円を描いており正しい結果が得られていると考えられる.なお,HIP IDが113368,9884,3419に対応する恒星の視等級はそれぞれ1.17,2.01,2.04であることから,視等級の高いものから順番に出力されていることが確認できる. + +### 2. y軸周りの角速度を与えた場合 +#### 1. 概要 +- 角速度入力 $ω_b=[0 ~0.1~0]^T$ を与える.その他のシミュレーション条件はx軸周りの場合と同様である.なお,本シミュレーションでは望遠鏡に関してはy軸とz軸が等価であるから,z軸周りの回転を与えた場合の検証は割愛する. + +#### 1. 結果 +1. 禁止角判定 +- 太陽・地球・月の視線方向からの角度は,以下のようである. +
+
+太陽・月・地球の視線方向からの角度 +
太陽・月・地球の視線方向からの角度
+
+
+このとき,各禁止角判定は以下の通りであった. +
+
+太陽・月・地球の禁止角判定 +
太陽・月・地球の禁止角判定
+
+
+以上2つの図より、禁止角60度以内に入った場合に正しく禁止角判定されていることがわかる. +2. `Observe` 関数の動作 +- 太陽・地球・月の視線方向からの角度をみると,画角内に入っているのは主に地球であるから,これに関して `Observe` 関数の動作を確認する(月や太陽も画角内に入るが,地球の場合と同様の議論で済むため割愛する).視線方向に直交する軸周りの回転であるから,地球の像が画角内に何度も出入りするが,ここでは簡単のため画角内に入った軌跡のうち4本のみを取り出して表示している. +
+
+イメージセンサ上における地球の位置の軌跡 +
イメージセンサ上における地球の位置の軌跡
+
+
+このときのEARTH_POS_Bの3次元プロットも同時に示しておく. +
+
+EARTH_POS_Bの3次元プロット +
EARTH_POS_Bの3次元プロット
+
+
+EARTH_POS_Bは望遠鏡視線方向と直交する軸を中心とした螺旋を描いていることがわかる.このときイメージセンサ上に投影される軌跡は双曲線であることを示すことができる(証明は割愛).イメージセンサ上における地球の位置の軌跡は二次曲線の形状をしており,X=1024(イメージセンサの中心軸)を対称軸とした双曲線であり,正しく動作していると考えられる. +3. `ObserveStars`関数の動作 +- x軸を中心軸とした回転の場合とは異なり,恒星の視野内の出入りが多いため,それらの一部についてイメージセンサ上の軌跡を示す. +
+
+ObserveStars関数の出力で得られた各恒星の軌跡 +
ObserveStars関数の出力で得られた各恒星の軌跡
+
+
+データ処理の都合上,途切れ途切れになっているが, `Observe` 関数の挙動で述べた通り,Y=1024を対称軸とした双曲線を描いていることがわかる.また,煩雑になるため本ファイルには載せないが,各時刻で視等級の高い順番にデータが出力されていることも確認された. ## 4. References diff --git a/Specifications/Component/Power/Spec_PCU.md b/Specifications/Component/Power/Spec_PCU.md index eba8d558..28d5649b 100644 --- a/Specifications/Component/Power/Spec_PCU.md +++ b/Specifications/Component/Power/Spec_PCU.md @@ -1,34 +1,44 @@ # Specification of PowerControlUnit class ## 1. Overview -1. Functions - - `PowerControlUnit` class is a base class of power control units and manages multiple `PowerPorts`. -2. Related files - - Main file: `power_control_unit.cpp, .hpp` - - Related file: `power_port.cpp, .hpp` -3. How to use - - **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. +### 1. Functions +- `PowerControlUnit` class is a base class of power control units and manages multiple `PowerPorts`. + +### 2. Related files +- Main file: `power_control_unit.cpp, .hpp` +- Related file: `power_port.cpp, .hpp` + +### 3. How to use +- **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 - 1. overview - - This function makes a new `PowerPort`. - 2. inputs and outputs - - Inputs: the port ID and the arguments for `PowerPort` - - Outputs: the error code (0 is a success, -1 is an error) - 3. algorithm - - Make a new `PowerPort` when the port ID is not used. - 4. note: N/A -1. ClosePort - 1. overview - - This function deletes the designated `PowerPort`. - 2. inputs and outputs - - Inputs: the port ID. - - Outputs: the error code (0 is a success, -1 is an error). - 3. algorithm - - Delete the designated `PowerPort` when the port still exists. - 4. note: N/A +### 1. ConnectPort +#### 1. overview +- This function makes a new `PowerPort`. + +#### 2. inputs and outputs +- Inputs: the port ID and the arguments for `PowerPort` +- Outputs: the error code (0 is a success, -1 is an error) + +#### 3. algorithm +- Make a new `PowerPort` when the port ID is not used. + +#### 4. note: N/A + +### 2. ClosePort +#### 1. overview +- This function deletes the designated `PowerPort`. + +#### 2. inputs and outputs +- Inputs: the port ID. +- Outputs: the error code (0 is a success, -1 is an error). + +#### 3. algorithm +- Delete the designated `PowerPort` when the port still exists. + +#### 4. note: N/A ## 3. Results of verifications N/A diff --git a/Specifications/Component/Propulsion/Spec_SimpleThruster.md b/Specifications/Component/Propulsion/Spec_SimpleThruster.md index a5647b11..fc559b9d 100644 --- a/Specifications/Component/Propulsion/Spec_SimpleThruster.md +++ b/Specifications/Component/Propulsion/Spec_SimpleThruster.md @@ -3,212 +3,217 @@ ## 1. Overview - This class simulates a thruster and contains functions for it. -1. functions - - By setting the thruster valve open and close, thruster torque and force are generated. - - The thruster model includes the magnitude and directional errors in the ini file. - - According to the thruster output, users can set the thrust duty to the value between 0 and 1. - -2. files - - `simple_thruster.cpp` , `simple_thruster.hpp` - + Definitions and declarations of the class - - `thruster.ini` - + Parameters for a/multiple thruster(s) - -3. how to use - - 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 - + `calc_torque` function requires a position of the spacecraft's mass center as an argument. - - When a thruster is open, set the duty to 1 by `set_duty(1)` function. - + Users can set duty to the value between 0 and 1. +### 1. functions +- By setting the thruster valve open and close, thruster torque and force are generated. +- The thruster model includes the magnitude and directional errors in the ini file. +- According to the thruster output, users can set the thrust duty to the value between 0 and 1. + +### 2. files +- `simple_thruster.cpp` , `simple_thruster.hpp` + + Definitions and declarations of the class +- `thruster.ini` + + Parameters for a/multiple thruster(s) +- `plot_simple_thruster.py`: An example of a Python script to plot simple thruster output + +### 3. how to use +- 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 + + `calc_torque` function requires a position of the spacecraft's mass center as an argument. +- When a thruster is open, set the duty to 1 by `set_duty(1)` function. + + Users can set duty to the value between 0 and 1. ## 2. Explanation of Algorithm -1. Thrust - 1. overview - - Thrust magnitude is a scalar value of thrust. - - Thrust contains the magnitude and direction errors according to the ini file setting. - - Thrust magnitude calculation considers the duty of thruster. If the thruster valve is closed, the thrust magnitude is 0. - 2. input and output - - input - + Thruster duty ratio - + 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 - Thrust magnitude can be calculated as follows: - - ```math - F_{thrust} = \epsilon * F_{max} + n_{f} - ``` - - where $F_{thrust}$ is thrust magnitude, $\epsilon$ is the duty of thruster, $F_{max}$ is the maximum thrust magnitude, and $n_{f}$ is the error of thrust magnitude. - - Thrust direction can be calculated as follows: - - ```math - \boldsymbol{d}_{err} = \boldsymbol{q}(\boldsymbol{d}_{true},n) * \boldsymbol{d}_x - ``` - ```math - \boldsymbol{d}_{thrust} = \boldsymbol{q}(\boldsymbol{d}_{err},n_{d}) * \boldsymbol{d}_{true} - ``` - - where - - $\boldsymbol{d}_{true}$ is the thrust vector without errors - - $n$ is the random angles to rotate the direction of error $\boldsymbol{d}_{err}$ - - $\boldsymbol{d}_{x}$ is the vector which is not equal to $\boldsymbol{d}_{true}$ - - $n_d$ is the directional error - - $\boldsymbol{d}_{thrust}$ is the thrust vector with errors - - $\boldsymbol{q}(\boldsymbol{d},n)$ is the quaternion which has the rotation axis $\boldsymbol{d}$ and the rotation angle $n$ . - - Thrust can be calculated as follows: - - ```math - \boldsymbol{F}_{thrust} = F_{thrust} * \boldsymbol{d}_{thrust} - ``` - - where $\boldsymbol{F}_{thrust}$ is thrust. +### 1. Thrust +#### 1. overview +- Thrust magnitude is a scalar value of thrust. +- Thrust contains the magnitude and direction errors according to the ini file setting. +- Thrust magnitude calculation considers the duty of thruster. If the thruster valve is closed, the thrust magnitude is 0. + +#### 2. input and output +- input + + Thruster duty ratio + + 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 +Thrust magnitude can be calculated as follows: + +```math +F_{thrust} = \epsilon * F_{max} + n_{f} +``` + +where $F_{thrust}$ is thrust magnitude, $\epsilon$ is the duty of thruster, $F_{max}$ is the maximum thrust magnitude, and $n_{f}$ is the error of thrust magnitude. + +Thrust direction can be calculated as follows: + +```math +\boldsymbol{d}_{err} = \boldsymbol{q}(\boldsymbol{d}_{true},n) * \boldsymbol{d}_x +``` +```math +\boldsymbol{d}_{thrust} = \boldsymbol{q}(\boldsymbol{d}_{err},n_{d}) * \boldsymbol{d}_{true} +``` + +where +- $\boldsymbol{d}_{true}$ is the thrust vector without errors +- $n$ is the random angles to rotate the direction of error $\boldsymbol{d}_{err}$ +- $\boldsymbol{d}_{x}$ is the vector which is not equal to $\boldsymbol{d}_{true}$ +- $n_d$ is the directional error +- $\boldsymbol{d}_{thrust}$ is the thrust vector with errors +- $\boldsymbol{q}(\boldsymbol{d},n)$ is the quaternion which has the rotation axis $\boldsymbol{d}$ and the rotation angle $n$ . + +Thrust can be calculated as follows: + +```math +\boldsymbol{F}_{thrust} = F_{thrust} * \boldsymbol{d}_{thrust} +``` + +where $\boldsymbol{F}_{thrust}$ is thrust. -2. Torque - 1. overview - - 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_position_b_m` - + Mass center of spacecraft - + Thrust magnitude and direction - - output - + Torque - 3. algorithms - Torque by the thruster can be calculated as follows: - - ```math - \boldsymbol{T}_{thrust} = (\boldsymbol{v}_{thruster}-\boldsymbol{v}_{SC}) \times \boldsymbol{F}_{thrust} - ``` - - where - - $\boldsymbol{T}_{thrust}$ is torque by the thruster - - $\boldsymbol{v}_{thruster}$ is thruster position - - $\boldsymbol{v}_{SC}$ is the mass center of spacecraft. +### 2. Torque +#### 1. overview +- 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_position_b_m` + + Mass center of spacecraft + + Thrust magnitude and direction +- output + + Torque + +#### 3. algorithms +Torque by the thruster can be calculated as follows: + +```math +\boldsymbol{T}_{thrust} = (\boldsymbol{v}_{thruster}-\boldsymbol{v}_{SC}) \times \boldsymbol{F}_{thrust} +``` + +where +- $\boldsymbol{T}_{thrust}$ is torque by the thruster +- $\boldsymbol{v}_{thruster}$ is thruster position +- $\boldsymbol{v}_{SC}$ is the mass center of spacecraft. ## 3. Results of verifications -1. Case1 - - input - + 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 Std Dev: [0,0,0] N - -
-
- -
Thrust force values in N unit.
-
-
- - + Torque Mean: [0,0,0] Nm - + Torque Std Dev: [0,0,0] Nm - -
-
- -
Thrust torque values in Nm unit.
-
-
- - -2. Case2 - - input - + 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 Std Dev: [0,0,1.09804e-5] N - -
-
- -
Thrust force values in N unit.
-
-
- - + Torque Mean: [0,0,0] Nm - + Torque Std Dev: [0,0,0] Nm - -
-
- -
Thrust torque values in Nm unit.
-
-
- -3. Case3 - - input - + 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 Std Dev: [1.0e-4, 9.79e-5, 1.216e-5] N - -
-
- -
Thrust force values in N unit.
-
-
- - + Torque Mean: [1.04e-6,-4.94e-7,0] Nm - + Torque Std Dev: [1.29e-5, 1.26e-5, 0] Nm - -
-
- -
Thrust torque values in Nm unit.
-
-
- -4. Case4 - - input - + 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 Std Dev: [0,0,0] N - -
-
- -
Thrust force values in N unit.
-
-
- - + Torque Mean: [0.0001,0,0] Nm - + Torque Std Dev: [0,0,0] Nm - -
-
- -
Thrust torque values in Nm unit.
-
-
+### 1. Case1 +- input + + 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 Std Dev: [0,0,0] N + +
+
+ +
Thrust force values in N unit.
+
+
+ + + Torque Mean: [0,0,0] Nm + + Torque Std Dev: [0,0,0] Nm + +
+
+ +
Thrust torque values in Nm unit.
+
+
+ + +### 2. Case2 +- input + + 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 Std Dev: [0,0,1.09804e-5] N + +
+
+ +
Thrust force values in N unit.
+
+
+ + + Torque Mean: [0,0,0] Nm + + Torque Std Dev: [0,0,0] Nm + +
+
+ +
Thrust torque values in Nm unit.
+
+
+ +### 3. Case3 +- input + + 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 Std Dev: [1.0e-4, 9.79e-5, 1.216e-5] N + +
+
+ +
Thrust force values in N unit.
+
+
+ + + Torque Mean: [1.04e-6,-4.94e-7,0] Nm + + Torque Std Dev: [1.29e-5, 1.26e-5, 0] Nm + +
+
+ +
Thrust torque values in Nm unit.
+
+
+ +### 4. Case4 +- input + + 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 Std Dev: [0,0,0] N + +
+
+ +
Thrust force values in N unit.
+
+
+ + + Torque Mean: [0.0001,0,0] Nm + + Torque Std Dev: [0,0,0] Nm + +
+
+ +
Thrust torque values in Nm unit.
+
+
diff --git a/Specifications/Disturbance/Spec_Disturbance.md b/Specifications/Disturbance/Spec_Disturbance.md index f91843f6..4ca47ed1 100644 --- a/Specifications/Disturbance/Spec_Disturbance.md +++ b/Specifications/Disturbance/Spec_Disturbance.md @@ -2,16 +2,16 @@ ## 1. Overview -1. Functions - - `Disturbance` is a base class for all disturbance classes. +### 1. Functions +- `Disturbance` is a base class for all disturbance classes. -2. Related files - - `src/disturbances/disturbance.hpp` +### 2. Related files +- `src/disturbances/disturbance.hpp` -3. How to use - - When you want to make a new disturbance class, you need to inherit this. - - Users need to define the `Update` function according to the target disturbance calculation. And update the members `force_b_N_`, `torque_b_Nm_`, `acceleration_b_m_s2_`, and/or `acceleration_i_m_s2_` in the function. - - If the disturbance does not depend on the spacecraft attitude, please set `is_attitude_dependent_ = false` to avoid unnecessary disturbance update. +### 3. How to use +- When you want to make a new disturbance class, you need to inherit this. +- Users need to define the `Update` function according to the target disturbance calculation. And update the members `force_b_N_`, `torque_b_Nm_`, `acceleration_b_m_s2_`, and/or `acceleration_i_m_s2_` in the function. +- If the disturbance does not depend on the spacecraft attitude, please set `is_attitude_dependent_ = false` to avoid unnecessary disturbance update. ## 2. Explanation of Algorithm diff --git a/Specifications/Disturbance/Spec_Disturbances.md b/Specifications/Disturbance/Spec_Disturbances.md index 9615a8fe..ecb5aee6 100644 --- a/Specifications/Disturbance/Spec_Disturbances.md +++ b/Specifications/Disturbance/Spec_Disturbances.md @@ -2,32 +2,32 @@ ## 1. Overview -1. Functions - - This class integrates all disturbances calculation. - - All disturbances are initialized in this class. - - Their update calculations are called in this class. +### 1. Functions +- This class integrates all disturbances calculation. +- All disturbances are initialized in this class. +- Their update calculations are called in this class. -2. Related files - - `src/disturbances/disturbances.hpp` - - `src/disturbances/disturbances.cpp` +### 2. Related files +- `src/disturbances/disturbances.hpp` +- `src/disturbances/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. - - If you register your disturbance class correctly, the update function is automatically updated in the `Disturbances::Update` class, and the disturbance force and/or torque is added for dynamics propagation. +### 3. How to use +- When you make a new disturbance class, you need to register the new disturbance class in the `InitializeInstances` function. +- If you register your disturbance class correctly, the update function is automatically updated in the `Disturbances::Update` class, and the disturbance force and/or torque is added for dynamics propagation. ## 2. Explanation of Algorithm -1. `Update` function - 1. overview - - This function calls the `Disturbance::Update` functions defined by each disturbance class. - - Generally, orbital disturbances depend on spacecraft position. Some disturbances depend on spacecraft attitude with respect to the disturbance sources. Therefore, there are two update timing in this function. - - When the spacecraft position is updated, all disturbances are updated. - - When the spacecraft attitude is updated, disturbances which depend on attitude are updated. - -1. `InitializeInstances` function - 1. overview - - The instances of all disturbance classes are made and registered to the disturbance list in this function. - - The Earth only disturbances are registered when the selected center object is the Earth. +### 1. `Update` function +#### 1. overview +- This function calls the `Disturbance::Update` functions defined by each disturbance class. +- Generally, orbital disturbances depend on spacecraft position. Some disturbances depend on spacecraft attitude with respect to the disturbance sources. Therefore, there are two update timing in this function. + - When the spacecraft position is updated, all disturbances are updated. + - When the spacecraft attitude is updated, disturbances which depend on attitude are updated. + +### 1. `InitializeInstances` function +#### 1. overview +- The instances of all disturbance classes are made and registered to the disturbance list in this function. +- The Earth only disturbances are registered when the selected center object is the Earth. ## 4. References diff --git a/Specifications/Disturbance/Spec_GeoPotential.md b/Specifications/Disturbance/Spec_GeoPotential.md index 56f9f315..18ac5369 100644 --- a/Specifications/Disturbance/Spec_GeoPotential.md +++ b/Specifications/Disturbance/Spec_GeoPotential.md @@ -2,84 +2,83 @@ ## 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. - -2. Related files - - `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` - - Choose an orbit propagator mode that considers disturbances. - - Edit the `disturbance.ini` file - - Select `ENABLE` for `calculation` and `logging` - - Select `degree` of calculation - - When the `degree` is smaller than 1, it is overwritten as 0. - - When the `degree` is larger than 360, it is overwritten as 360. - - **NOTE**: The calculation time is related to the selected degree. +### 1. Functions +- 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, .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` +- Choose an orbit propagator mode that considers disturbances. +- Edit the `disturbance.ini` file + - Select `ENABLE` for `calculation` and `logging` + - Select `degree` of calculation + - When the `degree` is smaller than 1, it is overwritten as 0. + - When the `degree` is larger than 360, it is overwritten as 360. + - **NOTE**: The calculation time is related to the selected degree. ## 2. Explanation of Algorithm - The base algorithm is referred to [Satellite Orbits](https://www.springer.com/jp/book/9783540672807) chapter 3.2. - -1. Read coefficients - 1. overview - - This function reads the geopotential coefficients from the EGM96 file `egm96_to360.ascii`. - - The file doesn't have coefficients for `n=0,m=0`, `n=1,m=0`, and `n=1,m=1`. - - All coefficients are completely normalized by following normalization function $N_{n,m}$ - ```math - N_{n,m}=\sqrt{\frac{(n+m)!}{(2-\delta_{0m})(2n+1)(n-m)!}}\\ - ``` - - where $\delta_{0m}$ is the Kronecker delta. - - 2. inputs and outputs - - Input - - file path of `egm96_to360.ascii` - - maximum degree for geopotential calculation - - Output - - **Return**: reading is succeeded or not. - - Normalized coefficient $C_{n,m}$ and $S_{n,m}$ - - 3. algorithm - - The file format of `egm96_to360.ascii` is `n,m,Cnm,Snm,sigmaCnm,sigmaSnm` in line with space delimiter. In this calculation, the `sigmaCnm` and `sigmaSnm` are not used. - - - The total number of reading lines is defined as the following equation - ```math - N_{line}=\frac{1}{2}(n+1)(n+2)-3 - ``` - where $n$ is maximum degree, and -3 is for the coefficients of `n=0,m=0`, `n=1,m=0`, and `n=1,m=1`, which are not in the file. - - 4. note - - - **When the reading file process is failed**, the maximum degree is set to zero, and a simple Kepler calculation will be executed. - -2. Calculate Legendre polynomials with recursion algorithm - - 1. overview - - We chose to use the recursion algorithm written in chapter 3.2.4 of [Satellite Orbits](https://www.springer.com/jp/book/9783540672807) since the calculation of the Legendre polynomials for spherical harmonics is time-consuming. - - However, the original equation in the book is unnormalized form, and it is not suitable with the normalized coefficients. - - For a small degree, users can directly use the normalized function $N_{n,m}$ to unnormalize the coefficients or to normalize the functions $V_{n,m}$ and $V_{n,m}$ . But for a large degree, the factorial calculation in the $N_{n,m}$ reaches a huge value, which standard `double` variables cannot handle. - - To avoid that, the normalized recursion algorithm was derived as described in Section 3. - - There are the following two functions: - - `v_w_nn_update` - - `v_w_nm_update` - - 2. inputs and outputs - - Inputs - - Both functions - - Satellite position in ECEF frame $x, y, z$ - - degree and order as $n$ and $m$ - - `v_w_nn_update`: $V_{n-1,n-1}$ and $W_{n-1,n-1}$ - - `v_w_nm_update`: $V_{n-1,m}, W_{n-1,m}, V_{n-2,m}$, and $W_{n-2,m}$ - - Outputs - - `v_w_nn_update`: $V_{n,n}$ and $W_{n,n}$ - - `v_w_nm_update`: $V_{n,m}$ and $W_{n,m}$ - - 3. algorithm +- The base algorithm is referred to [Satellite Orbits](https://www.springer.com/jp/book/9783540672807) chapter 3.2. + +### 1. Read coefficients +#### 1. overview +- This function reads the geopotential coefficients from the EGM96 file `egm96_to360.ascii`. +- The file doesn't have coefficients for `n=0,m=0`, `n=1,m=0`, and `n=1,m=1`. +- All coefficients are completely normalized by following normalization function $N_{n,m}$ + +```math +N_{n,m}=\sqrt{\frac{(n+m)!}{(2-\delta_{0m})(2n+1)(n-m)!}}\\ +``` + - where $\delta_{0m}$ is the Kronecker delta. + +#### 2. inputs and outputs +- Input + - file path of `egm96_to360.ascii` + - maximum degree for geopotential calculation +- Output + - **Return**: reading is succeeded or not. + - Normalized coefficient $C_{n,m}$ and $S_{n,m}$ + +3. algorithm +- The file format of `egm96_to360.ascii` is `n,m,Cnm,Snm,sigmaCnm,sigmaSnm` in line with space delimiter. In this calculation, the `sigmaCnm` and `sigmaSnm` are not used. +- The total number of reading lines is defined as the following equation +```math +N_{line}=\frac{1}{2}(n+1)(n+2)-3 +``` + - where $n$ is maximum degree, and -3 is for the coefficients of `n=0,m=0`, `n=1,m=0`, and `n=1,m=1`, which are not in the file. + +4. note +- **When the reading file process is failed**, the maximum degree is set to zero, and a simple Kepler calculation will be executed. + +### 2. Calculate Legendre polynomials with recursion algorithm + +#### 1. overview +- We chose to use the recursion algorithm written in chapter 3.2.4 of [Satellite Orbits](https://www.springer.com/jp/book/9783540672807) since the calculation of the Legendre polynomials for spherical harmonics is time-consuming. + - However, the original equation in the book is unnormalized form, and it is not suitable with the normalized coefficients. + - For a small degree, users can directly use the normalized function $N_{n,m}$ to unnormalize the coefficients or to normalize the functions $V_{n,m}$ and $V_{n,m}$ . But for a large degree, the factorial calculation in the $N_{n,m}$ reaches a huge value, which standard `double` variables cannot handle. + - To avoid that, the normalized recursion algorithm was derived as described in Section 3. +- There are the following two functions: + - `v_w_nn_update` + - `v_w_nm_update` + +#### 2. inputs and outputs +- Inputs + - Both functions + - Satellite position in ECEF frame $x, y, z$ + - degree and order as $n$ and $m$ + - `v_w_nn_update`: $V_{n-1,n-1}$ and $W_{n-1,n-1}$ + - `v_w_nm_update`: $V_{n-1,m}, W_{n-1,m}, V_{n-2,m}$, and $W_{n-2,m}$ +- Outputs + - `v_w_nn_update`: $V_{n,n}$ and $W_{n,n}$ + - `v_w_nm_update`: $V_{n,m}$ and $W_{n,m}$ + +#### 3. algorithm For unnormalized algorithms, see chapter 3.2.4 of [Satellite Orbits](https://www.springer.com/jp/book/9783540672807). @@ -87,9 +86,9 @@ For normalized algorithm, we use following normalizing relation for Legendre pol ```math \begin{align} - \bar{P}_{n,m} &= \frac{1}{N_{n,m}}P_{n,m}\\ - \bar{V}_{n,m} &= \frac{1}{N_{n,m}}V_{n,m}\\ - \bar{W}_{n,m} &= \frac{1}{N_{n,m}}W_{n,m}\\ +\bar{P}_{n,m} &= \frac{1}{N_{n,m}}P_{n,m}\\ +\bar{V}_{n,m} &= \frac{1}{N_{n,m}}V_{n,m}\\ +\bar{W}_{n,m} &= \frac{1}{N_{n,m}}W_{n,m}\\ \end{align} ``` @@ -97,17 +96,17 @@ The recursion calculation of V and W can be changed to a normalized version as f ```math \begin{align} - N_{m,m}\bar{V}_{m,m} &= (2m-1)(\frac{xR_{e}}{r^2}N_{m-1,m-1}\bar{V}_{m-1,m-1}-\frac{yR_e}{r^2}N_{m-1,m-1}\bar{W}_{m-1,m-1})\\ - \bar{V}_{m,m} &= \frac{N_{m-1,m-1}}{N_{m,m}}(2m-1)(\frac{xR_{e}}{r^2}\bar{V}_{m-1,m-1}-\frac{yR_e}{r^2}\bar{W}_{m-1,m-1})\\ - \bar{W}_{m,m} &= \frac{N_{m-1,m-1}}{N_{m,m}}(2m-1)(\frac{xR_{e}}{r^2}\bar{W}_{m-1,m-1}+\frac{yR_e}{r^2}\bar{V}_{m-1,m-1})\\ +N_{m,m}\bar{V}_{m,m} &= (2m-1)(\frac{xR_{e}}{r^2}N_{m-1,m-1}\bar{V}_{m-1,m-1}-\frac{yR_e}{r^2}N_{m-1,m-1}\bar{W}_{m-1,m-1})\\ +\bar{V}_{m,m} &= \frac{N_{m-1,m-1}}{N_{m,m}}(2m-1)(\frac{xR_{e}}{r^2}\bar{V}_{m-1,m-1}-\frac{yR_e}{r^2}\bar{W}_{m-1,m-1})\\ +\bar{W}_{m,m} &= \frac{N_{m-1,m-1}}{N_{m,m}}(2m-1)(\frac{xR_{e}}{r^2}\bar{W}_{m-1,m-1}+\frac{yR_e}{r^2}\bar{V}_{m-1,m-1})\\ \end{align} ``` ```math \begin{align} - N_{n,m}\bar{V}_{n,m} &= \frac{2n-1}{n-m}(\frac{zR_{e}}{r^2}N_{n-1,m}\bar{V}_{n-1,m}-\frac{n+m-1}{n-m}\frac{R_e^2}{r^2}N_{n-2,m}\bar{V}_{n-2,m})\\ - \bar{V}_{n,m} &= \frac{2n-1}{n-m}\frac{zR_{e}}{r^2}\frac{N_{n-1,m}}{N_{n,m}}\bar{V}_{n-1,m}-\frac{n+m-1}{n-m}\frac{R_e^2}{r^2}\frac{N_{n-2,m}}{N_{n,m}}\bar{V}_{n-2,m}\\ - \bar{W}_{n,m} &= \frac{2n-1}{n-m}\frac{zR_{e}}{r^2}\frac{N_{n-1,m}}{N_{n,m}}\bar{W}_{n-1,m}-\frac{n+m-1}{n-m}\frac{R_e^2}{r^2}\frac{N_{n-2,m}}{N_{n,m}}\bar{W}_{n-2,m}\\ +N_{n,m}\bar{V}_{n,m} &= \frac{2n-1}{n-m}(\frac{zR_{e}}{r^2}N_{n-1,m}\bar{V}_{n-1,m}-\frac{n+m-1}{n-m}\frac{R_e^2}{r^2}N_{n-2,m}\bar{V}_{n-2,m})\\ +\bar{V}_{n,m} &= \frac{2n-1}{n-m}\frac{zR_{e}}{r^2}\frac{N_{n-1,m}}{N_{n,m}}\bar{V}_{n-1,m}-\frac{n+m-1}{n-m}\frac{R_e^2}{r^2}\frac{N_{n-2,m}}{N_{n,m}}\bar{V}_{n-2,m}\\ +\bar{W}_{n,m} &= \frac{2n-1}{n-m}\frac{zR_{e}}{r^2}\frac{N_{n-1,m}}{N_{n,m}}\bar{W}_{n-1,m}-\frac{n+m-1}{n-m}\frac{R_e^2}{r^2}\frac{N_{n-2,m}}{N_{n,m}}\bar{W}_{n-2,m}\\ \end{align} ``` @@ -115,69 +114,73 @@ The recurrence relation of normalize function can be expressed as follows ```math \begin{align} - N_{0,0} &= 1\\ - N_{m,m} &= (2m-1)\sqrt{\frac{2m}{2m+1}}N_{m-1,m-1}\quad(m\geq1)\\ - N_{n,m} &= \sqrt{\frac{2n-1}{2n+1}}\sqrt{\frac{n+m}{n-m}}N_{n-1,m}\quad(n\geq1,0\leq m \leq n) +N_{0,0} &= 1\\ +N_{m,m} &= (2m-1)\sqrt{\frac{2m}{2m+1}}N_{m-1,m-1}\quad(m\geq1)\\ +N_{n,m} &= \sqrt{\frac{2n-1}{2n+1}}\sqrt{\frac{n+m}{n-m}}N_{n-1,m}\quad(n\geq1,0\leq m \leq n) \end{align} ``` So, the divisions of the normalized functions are described as follows ```math \begin{align} - \frac{N_{0,0}}{N_{1,1}} &= \sqrt{2m+1}=\sqrt{3}\\ - \frac{N_{m-1,m-1}}{N_{m,m}} &= \frac{1}{2m-1}\sqrt{\frac{2m+1}{2m}}\quad(m\geq2)\\ - \frac{N_{n-1,m}}{N_{n,m}} &= \sqrt{\frac{2n+1}{2n-1}}\sqrt{\frac{n-m}{n+m}}\quad(n\geq1,0\leq m \leq n)\\ - \frac{N_{n-2,m}}{N_{n,m}} &= \frac{N_{n-2,m}}{N_{n-1,m}}\frac{N_{n-1,m}}{N_{n,m}}\\ - \frac{N_{n-2,m}}{N_{n,m}} &= \sqrt{\frac{2n-1}{2n-3}}\sqrt{\frac{n-m-1}{n+m-1}}\frac{N_{n-1,m}}{N_{n,m}}\quad(n\geq2,0\leq m \leq n) +\frac{N_{0,0}}{N_{1,1}} &= \sqrt{2m+1}=\sqrt{3}\\ +\frac{N_{m-1,m-1}}{N_{m,m}} &= \frac{1}{2m-1}\sqrt{\frac{2m+1}{2m}}\quad(m\geq2)\\ +\frac{N_{n-1,m}}{N_{n,m}} &= \sqrt{\frac{2n+1}{2n-1}}\sqrt{\frac{n-m}{n+m}}\quad(n\geq1,0\leq m \leq n)\\ +\frac{N_{n-2,m}}{N_{n,m}} &= \frac{N_{n-2,m}}{N_{n-1,m}}\frac{N_{n-1,m}}{N_{n,m}}\\ +\frac{N_{n-2,m}}{N_{n,m}} &= \sqrt{\frac{2n-1}{2n-3}}\sqrt{\frac{n-m-1}{n+m-1}}\frac{N_{n-1,m}}{N_{n,m}}\quad(n\geq2,0\leq m \leq n) \end{align} ``` The recurrence relations for normalized V and W are derived as follows ```math \begin{align} - \bar{V}_{0,0} &= \frac{Re}{r}\\ - \bar{W}_{0,0} &= 0\\ - \bar{V}_{1,1} &= \sqrt{3}(2m-1)(\frac{xR_{e}}{r^2}\bar{V}_{0,0}-\frac{yR_e}{r^2}\bar{W}_{0,0})\\ +\bar{V}_{0,0} &= \frac{Re}{r}\\ +\bar{W}_{0,0} &= 0\\ +\bar{V}_{1,1} &= \sqrt{3}(2m-1)(\frac{xR_{e}}{r^2}\bar{V}_{0,0}-\frac{yR_e}{r^2}\bar{W}_{0,0})\\ \end{align} ``` ```math \begin{align} - \bar{V}_{m,m} &= \sqrt{\frac{2m+1}{2m}}(\frac{xR_{e}}{r^2}\bar{V}_{m-1,m-1}-\frac{yR_e}{r^2}\bar{W}_{m-1,m-1})\quad(m\geq2)\\ - \bar{W}_{m,m} &= \sqrt{\frac{2m+1}{2m}}(\frac{xR_{e}}{r^2}\bar{W}_{m-1,m-1}+\frac{yR_e}{r^2}\bar{V}_{m-1,m-1})\quad(m\geq2)\\ +\bar{V}_{m,m} &= \sqrt{\frac{2m+1}{2m}}(\frac{xR_{e}}{r^2}\bar{V}_{m-1,m-1}-\frac{yR_e}{r^2}\bar{W}_{m-1,m-1})\quad(m\geq2)\\ +\bar{W}_{m,m} &= \sqrt{\frac{2m+1}{2m}}(\frac{xR_{e}}{r^2}\bar{W}_{m-1,m-1}+\frac{yR_e}{r^2}\bar{V}_{m-1,m-1})\quad(m\geq2)\\ \end{align} ``` ```math \begin{align} - \bar{V}_{n,m} &= \sqrt{\frac{2n+1}{2n-1}}\sqrt{\frac{n-m}{n+m}}(\frac{2n-1}{n-m}\frac{zR_{e}}{r^2}\bar{V}_{n-1,m})\quad(n=1,0\leq m \leq n)\\ - \bar{W}_{n,m} &= \sqrt{\frac{2n+1}{2n-1}}\sqrt{\frac{n-m}{n+m}}(\frac{2n-1}{n-m}\frac{zR_{e}}{r^2}\bar{W}_{n-1,m})\quad(n=1,0\leq m \leq n)\\ +\bar{V}_{n,m} &= \sqrt{\frac{2n+1}{2n-1}}\sqrt{\frac{n-m}{n+m}}(\frac{2n-1}{n-m}\frac{zR_{e}}{r^2}\bar{V}_{n-1,m})\quad(n=1,0\leq m \leq n)\\ +\bar{W}_{n,m} &= \sqrt{\frac{2n+1}{2n-1}}\sqrt{\frac{n-m}{n+m}}(\frac{2n-1}{n-m}\frac{zR_{e}}{r^2}\bar{W}_{n-1,m})\quad(n=1,0\leq m \leq n)\\ \end{align} ``` ```math \begin{align} - \bar{V}_{n,m} &= \sqrt{\frac{2n+1}{2n-1}}\sqrt{\frac{n-m}{n+m}}(\frac{2n-1}{n-m}\frac{zR_{e}}{r^2}\bar{V}_{n-1,m}-\frac{n+m-1}{n-m}\frac{R_e^2}{r^2}\sqrt{\frac{2n-1}{2n-3}}\sqrt{\frac{n-m-1}{n+m-1}}\bar{V}_{n-2,m})\quad(n\geq2,0\leq m \leq n)\\ - \bar{W}_{n,m} &= \sqrt{\frac{2n+1}{2n-1}}\sqrt{\frac{n-m}{n+m}}(\frac{2n-1}{n-m}\frac{zR_{e}}{r^2}\bar{W}_{n-1,m}-\frac{n+m-1}{n-m}\frac{R_e^2}{r^2}\sqrt{\frac{2n-1}{2n-3}}\sqrt{\frac{n-m-1}{n+m-1}}\bar{W}_{n-2,m})\quad(n\geq2,0\leq m \leq n)\\ +\bar{V}_{n,m} &= \sqrt{\frac{2n+1}{2n-1}}\sqrt{\frac{n-m}{n+m}}(\frac{2n-1}{n-m}\frac{zR_{e}}{r^2}\bar{V}_{n-1,m}-\frac{n+m-1}{n-m}\frac{R_e^2}{r^2}\sqrt{\frac{2n-1}{2n-3}}\sqrt{\frac{n-m-1}{n+m-1}}\bar{V}_{n-2,m})\quad(n\geq2,0\leq m \leq n)\\ +\bar{W}_{n,m} &= \sqrt{\frac{2n+1}{2n-1}}\sqrt{\frac{n-m}{n+m}}(\frac{2n-1}{n-m}\frac{zR_{e}}{r^2}\bar{W}_{n-1,m}-\frac{n+m-1}{n-m}\frac{R_e^2}{r^2}\sqrt{\frac{2n-1}{2n-3}}\sqrt{\frac{n-m-1}{n+m-1}}\bar{W}_{n-2,m})\quad(n\geq2,0\leq m \leq n)\\ \end{align} ``` -3. Calculate acceleration: `CalcAccelerationECEF` - 1. overview - - This function calculates gravity acceleration - - 2. inputs and outputs - - Input - - normalized Coefficients: $\bar{C}_{n,m}$ and $\bar{S}_{n,m}$ - - normalized function: $\bar{V}_{n,m}$ and $\bar{W}_{n,m}$ - - Output - - Gravity acceleration in ECEF frame - 3. algorithm +### 3. Calculate acceleration: `CalcAccelerationECEF` +#### 1. overview +- This function calculates gravity acceleration + +#### 2. inputs and outputs +- Input + - normalized coefficients + - $\bar{C}_{n,m}$ + - $\bar{S}_{n,m}$ + - normalized function + - $\bar{V}_{n,m}$ + - $\bar{W}_{n,m}$ +- Output + - Gravity acceleration in ECEF frame +#### 3. algorithm For unnormalized algorithms, See chapter 3.2.5 of [Satellite Orbits](https://www.springer.com/jp/book/9783540672807). -When we use the normalized coefficients $\bar{C}_{n,m}$ and $\bar{S}_{n,m}$ and $\bar{V}_{n,m}$ and $\bar{W}_{n,m}$ functions, the acceleration calculation is described like follows +When we use the normalized coefficients and normalized functions, the acceleration calculation is described like follows ```math \begin{align} - \ddot{x}_{n,m} &= -\frac{GM}{Re^{2}}\bar{C}_{n,0}\bar{V}_{n+1,1}\\ - &= -\frac{GM}{Re^{2}} C_{n,0}V_{n+1,1} \frac{N_{n,0}}{N_{n+1,1}}\quad(m=0) +\ddot{x}_{n,m} &= -\frac{GM}{Re^{2}}\bar{C}_{n,0}\bar{V}_{n+1,1}\\ +&= -\frac{GM}{Re^{2}} C_{n,0}V_{n+1,1} \frac{N_{n,0}}{N_{n+1,1}}\quad(m=0) \end{align} ``` The division of normalized function $\frac{N_{n,0}}{N_{n+1,1}}$ should be removed, so we have to multiply following correction factors into the equation. @@ -185,125 +188,126 @@ The division of normalized function $\frac{N_{n,0}}{N_{n+1,1}}$ should be remove When $m=0$, following correction factors are useful for x and y acceleration ```math \begin{align} - \frac{N_{n+1,1}}{N_{n,0}}=\sqrt{\frac{1}{2}}\sqrt{\frac{2n+1}{2n+3}}\sqrt{(n+2)(n+1)} +\frac{N_{n+1,1}}{N_{n,0}}=\sqrt{\frac{1}{2}}\sqrt{\frac{2n+1}{2n+3}}\sqrt{(n+2)(n+1)} \end{align} ``` When $m=1$, following correction factors are useful for x and y acceleration ```math \begin{align} - \frac{N_{n+1,0}}{N_{n,1}}=\sqrt{2}\sqrt{\frac{2n+1}{2n+3}}\sqrt{\frac{1}{n(n+1)}}\quad(m=1)\\ +\frac{N_{n+1,0}}{N_{n,1}}=\sqrt{2}\sqrt{\frac{2n+1}{2n+3}}\sqrt{\frac{1}{n(n+1)}}\quad(m=1)\\ \end{align} ``` When $m>1$, following correction factors are useful for x and y acceleration ```math \begin{align} - \frac{N_{n+1,m+1}}{N_{n,m}} &= \sqrt{\frac{2n+1}{2n+3}}\sqrt{(n+m+1)(n+m+2)}\\ - \frac{N_{n+1,m-1}}{N_{n,m}} &= \sqrt{\frac{2n+1}{2n+3}}\sqrt{\frac{1}{(n-m+1)(n-m+2)}}\\ +\frac{N_{n+1,m+1}}{N_{n,m}} &= \sqrt{\frac{2n+1}{2n+3}}\sqrt{(n+m+1)(n+m+2)}\\ +\frac{N_{n+1,m-1}}{N_{n,m}} &= \sqrt{\frac{2n+1}{2n+3}}\sqrt{\frac{1}{(n-m+1)(n-m+2)}}\\ \end{align} ``` When $m>=0$, following correction factors are useful for z acceleration ```math \begin{align} - \frac{N_{n+1,m}}{N_{n,m}}=\sqrt{\frac{2n+1}{2n+3}}\sqrt{\frac{n+m+1}{n-m+1}} +\frac{N_{n+1,m}}{N_{n,m}}=\sqrt{\frac{2n+1}{2n+3}}\sqrt{\frac{n+m+1}{n-m+1}} \end{align} ``` - 4. note - - To accelerate the calculation, the double `for loop` of acceleration calculation and the recursion loop need to be integrated in future. +#### 4. note +- To accelerate the calculation, the double `for loop` of acceleration calculation and the recursion loop need to be integrated in future. ## 3. Results of verifications -1. Calculation accuracy - 1. overview - - The calculated gravity acceleration is compared with [Matlab's Gravity Spherical Harmonics](https://jp.mathworks.com/help/aerotbx/ug/gravitysphericalharmonic.html) calculation. - - The satellite position in the ECEF frame calculated by S2E is inputted to the `CalcAccelerationECEF` and `gravitysphericalharmonic( r, 'EGM96',360, 'Error' );` function of Matlab. - - Both calculations use EGM96. - - The degree of Matlab is fixed to 360, the degree of S2E is changed to check the relationship between the degree and the accuracy. - - 2. conditions for the verification - 1. input files - - Default initialize files - - 2. initial values - - Default initialize files - ``` - 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 - ``` - tle1=1 38666U 12003B 12237.00000000 +.00000100 00000-0 67980-4 0 00008 - tle2=2 38666 098.6030 315.4100 0000010 300.0000 180.0000 14.09465034 0011 - ``` - - - Inputted satellite position in ECEF frame - - PositionInECEF - - 3. results - - Calculated gravity acceleration by `gravitysphericalharmonic(r,'EGM96',360,'Error' )` - - AccelerationECEF_Matlab - - - Difference between `CalcAccelerationECEF` output when `degree=0=1` and Matlab's output (`degree = 360`) - - You can see significant error since `CalcAccelerationECEF` does not care about high-order gravity potential. - - AccelerationDiffECEF_S2E_deg0 - - - Difference between `CalcAccelerationECEF` output when `degree=360 and Matlab's output (`degree = 360`) - - The error is relatively small - - AccelerationDiffECEF_S2E_deg360 - - - Finally, the relationship between degree and accuracy is summarized. - - The error is limited to 1e-8 [m/s2]. The cause of the error should be considered when users need accurate orbit propagation. - - SummaryAccuracy - - 4. Note - - To check the accuracy of the calculation, the resolution of `log output` should be larger than 10. - - In this case, the author chose the resolution as 15. -2. Calculation speed - 1. overview - - The author has checked the relationship between the degree and the calculation speed. - - `chrono` class was used as follows - - ```c++ - chrono::system_clock::time_point start, end; - start = chrono::system_clock::now(); - - debug_pos_ecef_m_ = spacecraft.dynamics_->orbit_->GetPosition_ecef_m(); - CalcAccelerationEcef(dynamics.GetOrbit().GetPosition_ecef_m()); - - end = chrono::system_clock::now(); - time_ms_ = static_cast(chrono::duration_cast(end - start).count() / 1000.0); - ``` - - - 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 - - Core i7-8650U(2.11GHz) - - VS2017 32bit debug - - 2. conditions for the verification - 1. input files - - Same with accuracy verification - 2. initial values - - Same with accuracy verification - - 3. results - - When `degree=0=1`, the calculation time is just `0.018 msec`. - - When `degree=2 and 10`, the calculation time is `0.035 msec and 0.2 msec`, respectively. - - When `degree=360`, the calculation time reaches `110 msec`, but it is faster than the calculation time of `gravitysphericalharmonic( r, 'EGM96',360, 'Error' )`, which is `700 ms`. - - SummaryCalculationTime - - 4. Note - - - +#### 1. Calculation accuracy +##### 1. overview +- The calculated gravity acceleration is compared with [Matlab's Gravity Spherical Harmonics](https://jp.mathworks.com/help/aerotbx/ug/gravitysphericalharmonic.html) calculation. +- The satellite position in the ECEF frame calculated by S2E is inputted to the `CalcAccelerationECEF` and `gravitysphericalharmonic( r, 'EGM96',360, 'Error' );` function of Matlab. + - Both calculations use EGM96. + - The degree of Matlab is fixed to 360, the degree of S2E is changed to check the relationship between the degree and the accuracy. + +##### 2. conditions for the verification +- input files + - Default initialize files + +- initial values + - Default initialize files + ``` + 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 + ``` + tle1=1 38666U 12003B 12237.00000000 +.00000100 00000-0 67980-4 0 00008 + tle2=2 38666 098.6030 315.4100 0000010 300.0000 180.0000 14.09465034 0011 + ``` + + - Inputted satellite position in ECEF frame + + PositionInECEF + +3. results +- Calculated gravity acceleration by `gravitysphericalharmonic(r,'EGM96',360,'Error' )` + +AccelerationECEF_Matlab + +- Difference between `CalcAccelerationECEF` output when `degree=0=1` and Matlab's output (`degree = 360`) + - You can see significant error since `CalcAccelerationECEF` does not care about high-order gravity potential. + +AccelerationDiffECEF_S2E_deg0 + +- Difference between `CalcAccelerationECEF` output when `degree=360 and Matlab's output (`degree = 360`) + - The error is relatively small + +AccelerationDiffECEF_S2E_deg360 + +- Finally, the relationship between degree and accuracy is summarized. + - The error is limited to 1e-8 [m/s2]. The cause of the error should be considered when users need accurate orbit propagation. + +SummaryAccuracy + +4. Note + - To check the accuracy of the calculation, the resolution of `log output` should be larger than 10. + - In this case, the author chose the resolution as 15. + +#### 2. Calculation speed +##### 1. overview +- The author has checked the relationship between the degree and the calculation speed. +- `chrono` class was used as follows + +```c++ + chrono::system_clock::time_point start, end; + start = chrono::system_clock::now(); + + debug_pos_ecef_m_ = spacecraft.dynamics_->orbit_->GetPosition_ecef_m(); + CalcAccelerationEcef(dynamics.GetOrbit().GetPosition_ecef_m()); + + end = chrono::system_clock::now(); + time_ms_ = static_cast(chrono::duration_cast(end - start).count() / 1000.0); +``` + +- 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 + - Core i7-8650U(2.11GHz) + - VS2017 32bit debug + +##### 2. conditions for the verification +- input files + - Same with accuracy verification +- initial values + - Same with accuracy verification + +##### 3. results +- When `degree=0=1`, the calculation time is just `0.018 msec`. +- When `degree=2 and 10`, the calculation time is `0.035 msec and 0.2 msec`, respectively. +- When `degree=360`, the calculation time reaches `110 msec`, but it is faster than the calculation time of `gravitysphericalharmonic( r, 'EGM96',360, 'Error' )`, which is `700 ms`. + +SummaryCalculationTime + +4. Note + +- ## 4. References diff --git a/Specifications/Disturbance/Spec_GravityGradient.md b/Specifications/Disturbance/Spec_GravityGradient.md index d60608bb..6425315a 100644 --- a/Specifications/Disturbance/Spec_GravityGradient.md +++ b/Specifications/Disturbance/Spec_GravityGradient.md @@ -2,54 +2,54 @@ ## 1. Overview -1. functions - - This class calculates the gravity gradient torque in the `Disturbances` class. - -2. related files - - `gravity_gradient.cpp`, `gravity_gradient.hpp` : Definitions and declarations of the class - - `disturbance.ini` : Initialization file - -3. how to use - - Make an instance of the `GravityGradient` class in `InitializeInstances` function in `disturbances.cpp` - - Create an instance by using the initialization function `InitGravityGradient` - - Set the parameters in the `disturbance.ini` - - Select `ENABLE` for `calculation` and `logging` +### 1. functions +- This class calculates the gravity gradient torque in the `Disturbances` class. + +### 2. related files +- `gravity_gradient.cpp`, `gravity_gradient.hpp` : Definitions and declarations of the class +- `disturbance.ini` : Initialization file + +### 3. how to use +- Make an instance of the `GravityGradient` class in `InitializeInstances` function in `disturbances.cpp` + - Create an instance by using the initialization function `InitGravityGradient` +- Set the parameters in the `disturbance.ini` + - Select `ENABLE` for `calculation` and `logging` ## 2. Explanation of Algorithm -1. ` CalcTorque_b_Nm` function - 1. overview - This function performs disturbance calculation and torque output simultaneously. - - 2. algorithm - Gravity gradient torque is calculated by the following equations (1). - ```math - \boldsymbol{T}_{GG} = \cfrac{3 \mu}{R_0^5} \boldsymbol{R}_0 \times (\boldsymbol{I}\cdot \boldsymbol{R}_o) - ``` - - where $\mu$ is the gravitational constant of the Earth in normal case, $R_0$ is the distance between the Earth center and the satellite, $\boldsymbol{R_0}$ is the vector from Earth center to the satellite, $\boldsymbol{I}$ is the inertia tensor of the satellite. - Users can change the $\mu$ for other planet with the constructor. +### 1. ` CalcTorque_b_Nm` function +#### 1. overview +This function performs disturbance calculation and torque output simultaneously. + +#### 2. algorithm +Gravity gradient torque is calculated by the following equations (1). +```math + \boldsymbol{T}_{GG} = \cfrac{3 \mu}{R_0^5} \boldsymbol{R}_0 \times (\boldsymbol{I}\cdot \boldsymbol{R}_o) +``` + +where $\mu$ is the gravitational constant of the Earth in normal case, $R_0$ is the distance between the Earth center and the satellite, $\boldsymbol{R_0}$ is the vector from Earth center to the satellite, $\boldsymbol{I}$ is the inertia tensor of the satellite. +Users can change the $\mu$ for other planet with the constructor. ## 3. Results of verifications -1. verification of gravity gradient torque - 1. overview - - Check that the gravity gradient torque equation is performed correctly - - 2. conditions for the verification - - PropStepSec: 0.001 - - StepTimeSec: 0.1 - - EndTimeSec: 300 - - Inertia tensor: diag [0.17, 0.1, 0.25] - - Initial Quaternion_i2b: [0,0,0,1] - - Initial torque: [0,0,0] - - Initial angular velocity: [0,0,0] - - Disturbance torque: All Disable except gravity gradient torque - - 3. results - - The order of the gg torque is $10^7$, which seems a proper value. - - ![](./figs/test_ggtorque.png) +### 1. verification of gravity gradient torque +#### 1. overview +- Check that the gravity gradient torque equation is performed correctly + +#### 2. conditions for the verification +- PropStepSec: 0.001 +- StepTimeSec: 0.1 +- EndTimeSec: 300 +- Inertia tensor: diag [0.17, 0.1, 0.25] +- Initial Quaternion_i2b: [0,0,0,1] +- Initial torque: [0,0,0] +- Initial angular velocity: [0,0,0] +- Disturbance torque: All Disable except gravity gradient torque + +#### 3. results +- The order of the gg torque is $10^7$, which seems a proper value. + +![](./figs/test_ggtorque.png) ## 4. References diff --git a/Specifications/Disturbance/Spec_MagneticDisturbance.md b/Specifications/Disturbance/Spec_MagneticDisturbance.md index 647293f2..311c427e 100644 --- a/Specifications/Disturbance/Spec_MagneticDisturbance.md +++ b/Specifications/Disturbance/Spec_MagneticDisturbance.md @@ -2,112 +2,112 @@ ## 1. Overview -1. functions - - This class calculates the magnetic disturbance torque in the `Disturbances` class - - This function receives the geomagnetic vector in the body-fixed coordinate system, calculates the cross product with the residual magnetic moment, and returns the residual magnetic torque in the body coordinate system. - -2. related files - - `magnetic_disturbance.cpp`, `magnetic_disturbance.hpp` : Definitions and declarations of the class - - `disturbance.ini` : Initialization file - -3. how to use - - Make an instance of the `MagneticDisturbance` class in `InitializeInstances` function in `disturbances.cpp` - - Create an instance by using the initialization function `InitMagneticDisturbance` - - Set the parameters in the `disturbance.ini` - - Select `ENABLE` for `calculation` and `logging` +### 1. functions +- This class calculates the magnetic disturbance torque in the `Disturbances` class +- This function receives the geomagnetic vector in the body-fixed coordinate system, calculates the cross product with the residual magnetic moment, and returns the residual magnetic torque in the body coordinate system. + +### 2. related files +- `magnetic_disturbance.cpp`, `magnetic_disturbance.hpp` : Definitions and declarations of the class +- `disturbance.ini` : Initialization file + +### 3. how to use +- Make an instance of the `MagneticDisturbance` class in `InitializeInstances` function in `disturbances.cpp` + - Create an instance by using the initialization function `InitMagneticDisturbance` +- Set the parameters in the `disturbance.ini` + - Select `ENABLE` for `calculation` and `logging` + - ## 2. Explanation of Algorithm -1. `CalcTorque_b_Nm` function - 1. overview - This function performs disturbance calculation and torque output simultaneously. - - 2. algorithm - Magnetic disturbance torque is calculated by the following equation. - ```math - \boldsymbol{T}_{mag} = \boldsymbol{M} \times \boldsymbol{B} - ``` - - where $\boldsymbol{M}$ is the residual magnetic moment [Am2] in the body-fixed frame, $\boldsymbol{B}$ is the magnetic field [nT] in the body-fixed frame. - -2. `CalcRMM` function - 1. overview - This function calculates the residual magnetic moment(RMM) of the spacecraft. Usually, the RMM is varied by the power state of the components installed in the spacecraft, but this function emulates the variation of the RMM by a random walk process and normal random value. - - 2. inputs and outputs - - implicit inputs - - `ResidualMagneticMoment` which is the class to manage the following RMM parameters - - Standard deviation of the random walk - - Limit of the one-step of the random walk - - Standard deviation of the white noise - - outputs - - (Vector<3>) RMM: the residual magnetic moment in the body-fixed frame [Am2] - - 3. algorithm - The residual magnetic moment is calculated by the following equations. - ```math - \begin{align} - \boldsymbol{M}(t_{k+1}) &= \boldsymbol{M}_0 + \boldsymbol{r}(t_{k+1}) + \boldsymbol{w}_1(t_{k+1}) \\ - \boldsymbol{r}(t_{k+1}) &= \boldsymbol{r}(t_{k}) +\boldsymbol{w_2}(t_{k+1}) - \end{align} - ``` - where $\boldsymbol{M}_0$ is the average residual magnetic moment in the body-fixed frame, $\boldsymbol{r}$ is the random walk of RMM, and $\boldsymbol{w}_i \sim N([0,0,0],\Sigma_i)$ is the white noise. +### 1. `CalcTorque_b_Nm` function +#### 1. overview +This function performs disturbance calculation and torque output simultaneously. + +#### 2. algorithm +Magnetic disturbance torque is calculated by the following equation. +```math + \boldsymbol{T}_{mag} = \boldsymbol{M} \times \boldsymbol{B} +``` + +where $\boldsymbol{M}$ is the residual magnetic moment [Am2] in the body-fixed frame, $\boldsymbol{B}$ is the magnetic field [nT] in the body-fixed frame. + +### 2. `CalcRMM` function +#### 1. overview +This function calculates the residual magnetic moment(RMM) of the spacecraft. Usually, the RMM is varied by the power state of the components installed in the spacecraft, but this function emulates the variation of the RMM by a random walk process and normal random value. + +#### 2. inputs and outputs +- implicit inputs + - `ResidualMagneticMoment` which is the class to manage the following RMM parameters + - Standard deviation of the random walk + - Limit of the one-step of the random walk + - Standard deviation of the white noise +- outputs + - (Vector<3>) RMM: the residual magnetic moment in the body-fixed frame [Am2] + +#### 3. algorithm +The residual magnetic moment is calculated by the following equations. +```math + \begin{align} + \boldsymbol{M}(t_{k+1}) &= \boldsymbol{M}_0 + \boldsymbol{r}(t_{k+1}) + \boldsymbol{w}_1(t_{k+1}) \\ + \boldsymbol{r}(t_{k+1}) &= \boldsymbol{r}(t_{k}) +\boldsymbol{w_2}(t_{k+1}) + \end{align} +``` +where $\boldsymbol{M}_0$ is the average residual magnetic moment in the body-fixed frame, $\boldsymbol{r}$ is the random walk of RMM, and $\boldsymbol{w}_i \sim N([0,0,0],\Sigma_i)$ is the white noise. ## 3. Results of verifications -1. verification of magnetic disturbance torque - 1. overview - - Check that the magnetic disturbance torque equation is performed correctly. - - 2. conditions for the verification - - PropStepSec: 0.001 - - StepTimeSec: 0.1 - - EndTimeSec: 300 - - Inertia tensor: diag [0.17, 0.1, 0.25] - - Initial Quaternion_i2b: [0,0,0,1] - - Initial torque: [0,0,0] - - Initial angular velocity: [0,0,0] - - Disturbance torque: All Disable except magnetic disturbance torque. - - 3. results - - RMM = [0.1,0,0]Am2 - - T = residual magnetic moment × magnetic field - - The Y component of the earth's magnetic field corresponds to the Z component of the disturbance torque, and the Z component of the earth's magnetic field corresponds to the -Y component of the disturbance torque - ![](./figs/test_rmm_magneticfield.png) - ![](./figs/test_rmm_px.png) - - - RMM = [0.05,0.05,0.05]Am2 - The order becomes $10^6$, which is a proper value. - ![](./figs/test_rmm_pxyz.png) - -2. verification of RMM - 1. overview - - Check that the RMM equation is performed correctly. - - 2. conditions for the verification - - PropStepSec: 0.001 - - StepTimeSec: 0.1 - - EndTimeSec: 300 - - Inertia tensor: diag [0.17, 0.1, 0.25] - - Initial Quaternion_i2b: [0,0,0,1] - - Initial torque: [0,0,0] - - Initial angular velocity: [0,0,0] - - Disturbance torque: All Disable - - 3. results - - [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) - - - [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) - - - [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) +### 1. verification of magnetic disturbance torque +#### 1. overview +- Check that the magnetic disturbance torque equation is performed correctly. + +#### 2. conditions for the verification +- PropStepSec: 0.001 +- StepTimeSec: 0.1 +- EndTimeSec: 300 +- Inertia tensor: diag [0.17, 0.1, 0.25] +- Initial Quaternion_i2b: [0,0,0,1] +- Initial torque: [0,0,0] +- Initial angular velocity: [0,0,0] +- Disturbance torque: All Disable except magnetic disturbance torque. + +#### 3. results +- RMM = [0.1,0,0]Am2 + - T = residual magnetic moment × magnetic field + - The Y component of the earth's magnetic field corresponds to the Z component of the disturbance torque, and the Z component of the earth's magnetic field corresponds to the -Y component of the disturbance torque +![](./figs/test_rmm_magneticfield.png) +![](./figs/test_rmm_px.png) + +- RMM = [0.05,0.05,0.05]Am2 + - The order becomes $10^6$, which is a proper value. +![](./figs/test_rmm_pxyz.png) + +### 2. verification of RMM +#### 1. overview +- Check that the RMM equation is performed correctly. + +#### 2. conditions for the verification +- PropStepSec: 0.001 +- StepTimeSec: 0.1 +- EndTimeSec: 300 +- Inertia tensor: diag [0.17, 0.1, 0.25] +- Initial Quaternion_i2b: [0,0,0,1] +- Initial torque: [0,0,0] +- Initial angular velocity: [0,0,0] +- Disturbance torque: All Disable + +#### 3. results +- [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) + +- [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) + +- [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) ## 4. References 1. 姿勢制御研究委員会, 人工衛星の力学と姿勢ハンドブック, 培風館, 2007. (written in Japanese) diff --git a/Specifications/Disturbance/Spec_SurfaceForce.md b/Specifications/Disturbance/Spec_SurfaceForce.md index 91b830d8..811a78d6 100644 --- a/Specifications/Disturbance/Spec_SurfaceForce.md +++ b/Specifications/Disturbance/Spec_SurfaceForce.md @@ -1,79 +1,82 @@ # Surface Force ## 1. Overview -1. Functions - - S2E handles air drag and Solar Radiation Pressure(SRP) as surface force disturbances since both disturbances affect spacecraft surfaces. The structure of both equations is identical, but they have different coefficients. - - Thus, the `SurfaceForce` base class provides the structure of the equation, and `AirDrag` and `SolarRadiationPressureDisturbance` subclasses provide specific calculations with appropriate coefficients. - - Currently, the `SurfaceForce` class supports multi-surface spacecraft without a self-shadowing effect. Users can select the number of surfaces. - - For the detailed description of `AirDrag` and `SolarRadiationPressureDisturbance`, please refer [Air Drag](./Spec_SurfaceForce_AirDrag.md) and [Solar Radiation Pressure](./Spec_SurfaceForce_SolarRadiation.md). +### 1. Functions +- S2E handles air drag and Solar Radiation Pressure(SRP) as surface force disturbances since both disturbances affect spacecraft surfaces. The structure of both equations is identical, but they have different coefficients. +- Thus, the `SurfaceForce` base class provides the structure of the equation, and `AirDrag` and `SolarRadiationPressureDisturbance` subclasses provide specific calculations with appropriate coefficients. +- Currently, the `SurfaceForce` class supports multi-surface spacecraft without a self-shadowing effect. Users can select the number of surfaces. +- For the detailed description of `AirDrag` and `SolarRadiationPressureDisturbance`, please refer [Air Drag](./Spec_SurfaceForce_AirDrag.md) and [Solar Radiation Pressure](./Spec_SurfaceForce_SolarRadiation.md). -2. Related files - - `surface_force.cpp`, `surface_force.hpp` : The base class `SurfaceForce` is defined. +### 2. Related files +- `surface_force.cpp`, `surface_force.hpp` : The base class `SurfaceForce` is defined. -3. How to use - - Make a subclass that inherits the `SurfaceForce` class. - - Define the `CalcCoefficients` function in the subclass. - - Execute `CalcTorqueForce` in the update function of the subclass. +### 3. How to use +- Make a subclass that inherits the `SurfaceForce` class. +- Define the `CalcCoefficients` function in the subclass. +- Execute `CalcTorqueForce` in the update function of the subclass. ## 2. Explanation of Algorithm -1. Constructor - 1. overview - - Initialize structure parameters - 2. inputs and outputs - - input - - List of `Surface` class which manages surface area, position, and normal direction. - - Position vector of the center of gravity in the body fixed frame [m]. - - output - - The instance of the class - 3. algorithm: NA - 4. note - - 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` in the `Structure.ini`. If users want to define the origin as a specific point, they need to carefully set all vectors to suit their definition. - -2. `CalcTorqueForce` function - 1. overview - - This is the main function to calculate the force and torque generated by the surface force disturbances. - - 2. inputs and outputs - - input - - `input_direction_b`: direction of disturbance source at the body frame - - `item`: parameter which decides the magnitude of the disturbances (Solar flux, air density) - - Surface information defined in the constructor - - output - - `force_b_N_`: Force at the body frame (unit: N) - - `torque_b_Nm_` : Torque at the body frame (unit: Nm) - - Both variables are defined in the `SimpleDisturbance` base class - - 3. algorithm - - Let us consider the following coordinate on a surface for surface force calculation - - $\boldsymbol{n}$ is the normal vector of the surface - - $\boldsymbol{v}$ is the direction vector of the disturbance source (e.g., sun direction vector or velocity vector) - - SummaryCalculationTime - - - $\boldsymbol{t}$ is the direction of in-plane force. - - ```math - \boldsymbol{t}=\frac{\boldsymbol{v}\times\boldsymbol{n}}{|\boldsymbol{v}\times\boldsymbol{n}|}\times\boldsymbol{n} - ``` - - - Surface force and torque acting on the surface is expressed as following equation - - $\boldsymbol{r}_{s}$ is the position vector of the surface - - $\boldsymbol{r}_{cg}$ is the position vector of the center of mass - - ```math - \begin{align} - \boldsymbol{F} &= -C_{n}\boldsymbol{n}+C_{t}\boldsymbol{t}\\ - \boldsymbol{T} &= (\boldsymbol{r}_{s}-\boldsymbol{r}_{cg})\times\boldsymbol{F} - \end{align} - ``` - - - Detail of the $C_{n}$ and $C_{t}$ are defined by subclasses by using `CalcCoefficients` function - - 4. note - - NA +### 1. Constructor +#### 1. overview +- Initialize structure parameters + +#### 2. inputs and outputs +- input + - List of `Surface` class which manages surface area, position, and normal direction. + - Position vector of the center of gravity in the body fixed frame [m]. +- output + - The instance of the class + +#### 3. algorithm: NA + +#### 4. note +- 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` in the `Structure.ini`. If users want to define the origin as a specific point, they need to carefully set all vectors to suit their definition. + +### 2. `CalcTorqueForce` function +#### 1. overview +- This is the main function to calculate the force and torque generated by the surface force disturbances. + +#### 2. inputs and outputs +- input + - `input_direction_b`: direction of disturbance source at the body frame + - `item`: parameter which decides the magnitude of the disturbances (Solar flux, air density) + - Surface information defined in the constructor +- output + - `force_b_N_`: Force at the body frame (unit: N) + - `torque_b_Nm_` : Torque at the body frame (unit: Nm) + - Both variables are defined in the `SimpleDisturbance` base class + +#### 3. algorithm +- Let us consider the following coordinate on a surface for surface force calculation + - $\boldsymbol{n}$ is the normal vector of the surface + - $\boldsymbol{v}$ is the direction vector of the disturbance source (e.g., sun direction vector or velocity vector) + +SummaryCalculationTime + +- $\boldsymbol{t}$ is the direction of in-plane force. + +```math +\boldsymbol{t}=\frac{\boldsymbol{v}\times\boldsymbol{n}}{|\boldsymbol{v}\times\boldsymbol{n}|}\times\boldsymbol{n} +``` + +- Surface force and torque acting on the surface is expressed as following equation + - $\boldsymbol{r}_{s}$ is the position vector of the surface + - $\boldsymbol{r}_{cg}$ is the position vector of the center of mass + +```math +\begin{align} + \boldsymbol{F} &= -C_{n}\boldsymbol{n}+C_{t}\boldsymbol{t}\\ + \boldsymbol{T} &= (\boldsymbol{r}_{s}-\boldsymbol{r}_{cg})\times\boldsymbol{F} +\end{align} +``` + +- Detail of the $C_{n}$ and $C_{t}$ are defined by subclasses by using `CalcCoefficients` function + +#### 4. note +- NA ## 3. Results of verifications - - Verifications will be done by the subclasses. +- Verifications will be done by the subclasses. ## 4. References 1. NA diff --git a/Specifications/Disturbance/Spec_SurfaceForce_AirDrag.md b/Specifications/Disturbance/Spec_SurfaceForce_AirDrag.md index e8b8b05d..cc059261 100644 --- a/Specifications/Disturbance/Spec_SurfaceForce_AirDrag.md +++ b/Specifications/Disturbance/Spec_SurfaceForce_AirDrag.md @@ -2,144 +2,145 @@ ## 1. Overview -1. Functions - - `AirDrag` class inherits `SurfaceForce` base class and calculates air drag disturbance force and torque. - -2. Related files - - `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. - - `disturbance.ini` : Initialization file - -3. How to use - - Make an instance of the `AirDrag` class in `InitializeInstances` function in `disturbances.cpp` - - Create an instance by using the initialization function `InitAirDrag` - - Set the parameters in the `disturbance.ini` - - Select `ENABLE` for `calculation` and `logging` - - Select the following conditions of air drag calculation - - Surface Temperature degC - - Atmosphere Temperature degC - - Molecular weight of the thermosphere g/mol +### 1. Functions +- `AirDrag` class inherits `SurfaceForce` base class and calculates air drag disturbance force and torque. + +### 2. Related files +- `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. +- `disturbance.ini` : Initialization file + +### 3. How to use +- Make an instance of the `AirDrag` class in `InitializeInstances` function in `disturbances.cpp` + - Create an instance by using the initialization function `InitAirDrag` +- Set the parameters in the `disturbance.ini` + - Select `ENABLE` for `calculation` and `logging` + - Select the following conditions of air drag calculation + - Surface Temperature degC + - Atmosphere Temperature degC + - Molecular weight of the thermosphere g/mol ## 2. Explanation of Algorithm -1. `CalcCoefficients` - 1. overview - - `CalcCoefficients` calculates the normal and in-plane coefficients for `SurfaceForce` calculation. The air drag force acting on a surface is expressed as the following equation - - ```math - \begin{align} - \boldsymbol{F}=-C_{n}\boldsymbol{n}+C_{t}\boldsymbol{t}\\ - C_{n}=\frac{1}{2}\rho A v^2 C_{n}^{\prime}\\ - C_{t}=\frac{1}{2}\rho A v^2 C_{t}^{\prime} - \end{align} - ``` - - - This function mainly calculates the common part of the coefficient calculation. $C_{n}^{\prime}$ and $C_{t}^{\prime}$ are calculated in `CalCnCt` function, and they will be used in this function. - - 2. inputs and outputs - - input - - $\boldsymbol{v}$: Relative velocity vector between the spacecraft and the atmosphere [m/s] - - $\rho$: air density [kg/m3] - - output - - coefficients $C_{n}$ and $C_{t}$ - - 3. algorithm - - See above equations. - - 4. note: NA - -2. `CalCnCt` - 1. overview - - `CalCnCt` calculates $C_{n}^{\prime}$ and $C_{t}^{\prime}$. - - 2. inputs and outputs - - input variables - - $\boldsymbol{v}$: Relative velocity vector between the spacecraft and the atmosphere [m/s] - - Currently, we assume that this value equals spacecraft velocity in the body-fixed frame. - - input parameters - - $\sigma_{d}$: Diffuse coefficients for air drag - - Ini file provide specularity for air drag $\sigma_{s}$, and the diffuse coefficient is derived as $\sigma_{d}=1-\sigma_{s}$. - - **Note**: There is no absorption term for air drag. Thus total reflectivity is set as 1. - - $T_{w}$: Temperature of the surface [K] - - $T_{m}$: Temperature of the atmosphere [K] - - $M$: Molecular weight of the thermosphere [g/mol] - - In the default ini file, we use $M=18$, and it is a little bit smaller than the molecular weight of atmosphere $M=29$. [Structure of the Thermosphere](https://www.sciencedirect.com/science/article/pii/0032063361900368?via%3Dihub) provides information on the molecular weight of the thermosphere. - - outputs - - $C_{n}^{\prime}$ and $C_{t}^{\prime}$ - -3. algorithm - - $C_{n}^{\prime}$ and $C_{t}^{\prime}$ are calculated as following equations - - ```math - \begin{align} - C_{n}^{\prime} &= \frac{2-\sigma_{d}}{\sqrt{\pi}}\frac{\Pi(S_{n})}{S^{2}}+\frac{\sigma_{d}}{2}\frac{\chi(S_{n})}{S^{2}}\sqrt{\frac{T_{w}}{T_{m}}}\\ - C_{t}^{\prime} &=\frac{\sigma_{d}}{\sqrt{\pi}}\frac{\chi(S_{n})}{S^{2}}S_{t} - \end{align} - ``` - - - $S, S_{n}, S_{t}$ are defined as follows - - $k=1.38064852E-23$ is the Boltzmann constant - - $\theta$ is the angle between the normal vector and the velocity vector - - $\cos{\theta}$ and $\sin{\theta}$ are calculated in `SurfaceForce` base class. - - ```math - \begin{align} - S &= \sqrt{\frac{Mv^{2}}{2kT_{w}}}\\ - S_{n} &= S\cos{\theta}\\ - S_{t} &= S\sin{\theta}\\ - \end{align} - ``` - - - $\Pi(x)$ and $\chi(x)$ are defined as follows - - where `erf` is the [Gauss error function](https://en.wikipedia.org/wiki/Error_function). - - ```math - \begin{align} - \Pi(x) &= x e^{-x^{2}}+\sqrt{\pi}(x^2+0.5)(1+erf(x))\\ - \chi(x) &= e^{-x^{2}}+\sqrt{\pi}x(1+erf(x)) - \end{align} - ``` - - The above functions are defined as `CalcFunctionPi` and `CalcFunctionChi`. -4. note - - Please see the reference document for more information on detailed calculations. +### 1. `CalcCoefficients` +#### 1. overview +- `CalcCoefficients` calculates the normal and in-plane coefficients for `SurfaceForce` calculation. The air drag force acting on a surface is expressed as the following equation + +```math +\begin{align} + \boldsymbol{F}=-C_{n}\boldsymbol{n}+C_{t}\boldsymbol{t}\\ + C_{n}=\frac{1}{2}\rho A v^2 C_{n}^{\prime}\\ + C_{t}=\frac{1}{2}\rho A v^2 C_{t}^{\prime} +\end{align} +``` + +- This function mainly calculates the common part of the coefficient calculation. $C_{n}^{\prime}$ and $C_{t}^{\prime}$ are calculated in `CalCnCt` function, and they will be used in this function. + +#### 2. inputs and outputs +- input + - $\boldsymbol{v}$: Relative velocity vector between the spacecraft and the atmosphere [m/s] + - $\rho$: air density [kg/m3] +- output + - coefficients $C_{n}$ and $C_{t}$ + +#### 3. algorithm +- See above equations. + +#### 4. note: NA + +### 2. `CalCnCt` +#### 1. overview + - `CalCnCt` calculates $C_{n}^{\prime}$ and $C_{t}^{\prime}$. + +#### 2. inputs and outputs +- input variables + - $\boldsymbol{v}$: Relative velocity vector between the spacecraft and the atmosphere [m/s] + - Currently, we assume that this value equals spacecraft velocity in the body-fixed frame. +- input parameters + - $\sigma_{d}$: Diffuse coefficients for air drag + - Ini file provide specularity for air drag $\sigma_{s}$, and the diffuse coefficient is derived as $\sigma_{d}=1-\sigma_{s}$. + - **Note**: There is no absorption term for air drag. Thus total reflectivity is set as 1. + - $T_{w}$: Temperature of the surface [K] + - $T_{m}$: Temperature of the atmosphere [K] + - $M$: Molecular weight of the thermosphere [g/mol] + - In the default ini file, we use $M=18$, and it is a little bit smaller than the molecular weight of atmosphere $M=29$. [Structure of the Thermosphere](https://www.sciencedirect.com/science/article/pii/0032063361900368?via%3Dihub) provides information on the molecular weight of the thermosphere. +- outputs + - $C_{n}^{\prime}$ and $C_{t}^{\prime}$ + +#### 3. algorithm +- $C_{n}^{\prime}$ and $C_{t}^{\prime}$ are calculated as following equations + +```math +\begin{align} + C_{n}^{\prime} &= \frac{2-\sigma_{d}}{\sqrt{\pi}}\frac{\Pi(S_{n})}{S^{2}}+\frac{\sigma_{d}}{2}\frac{\chi(S_{n})}{S^{2}}\sqrt{\frac{T_{w}}{T_{m}}}\\ + C_{t}^{\prime} &=\frac{\sigma_{d}}{\sqrt{\pi}}\frac{\chi(S_{n})}{S^{2}}S_{t} +\end{align} +``` + +- $S, S_{n}, S_{t}$ are defined as follows + - $k=1.38064852E-23$ is the Boltzmann constant + - $\theta$ is the angle between the normal vector and the velocity vector + - $\cos{\theta}$ and $\sin{\theta}$ are calculated in `SurfaceForce` base class. + +```math +\begin{align} + S &= \sqrt{\frac{Mv^{2}}{2kT_{w}}}\\ + S_{n} &= S\cos{\theta}\\ + S_{t} &= S\sin{\theta}\\ +\end{align} +``` + +- $\Pi(x)$ and $\chi(x)$ are defined as follows + - where `erf` is the [Gauss error function](https://en.wikipedia.org/wiki/Error_function). + - These functions are defined as `CalcFunctionPi` and `CalcFunctionChi`. + +```math +\begin{align} + \Pi(x) &= x e^{-x^{2}}+\sqrt{\pi}(x^2+0.5)(1+erf(x))\\ + \chi(x) &= e^{-x^{2}}+\sqrt{\pi}x(1+erf(x)) +\end{align} +``` + +#### 4. note +- Please see the reference document for more information on detailed calculations. ## 3. Results of verifications -1. Verification of magnitude of the force - 1. overview - - The calculated magnitude of the air drag force is compared with other calculation results in three cases. +### 1. Verification of magnitude of the force +#### 1. overview +- The calculated magnitude of the air drag force is compared with other calculation results in three cases. - 2. conditions for the verification - - See the bottom table. - -3. results - - The calculation result is completely the same as the other calculation. - - | 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 | - | 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 | - | Out-plane force (reference) | 0.31514 | 0.23636 | 0.15757 | - -1. Verification of direction of the force - 1. overview - - Next, we confirmed that the direction of the calculated force is correct. - - 2. conditions for the verification - - S2E is executed using the default setting. - - 3. results - - We confirmed that the direction of the force is opposite the direction of the velocity of the spacecraft. - - SummaryCalculationTime +#### 2. conditions for the verification +- See the bottom table. + +#### 3. results +- The calculation result is completely the same as the other calculation. + + | 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 | + | 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 | + | Out-plane force (reference) | 0.31514 | 0.23636 | 0.15757 | + +### 1. Verification of direction of the force +#### 1. overview +- Next, we confirmed that the direction of the calculated force is correct. + +#### 2. conditions for the verification +- S2E is executed using the default setting. + +#### 3. results +- We confirmed that the direction of the force is opposite the direction of the velocity of the spacecraft. + +SummaryCalculationTime ## 4. References 1. H. Klinkrad and B. Fritsche, "[ORBIT AND ATTITUDE PERTURBATIONS DUE TO AERODYNAMICS AND RADIATION PRESSURE](https://pdfs.semanticscholar.org/a16c/1abab4c081b4434bda9190f4f7be789c246a.pdf)", in *ESA Workshop on Space Weather*, 1998. 2. Marcel Nicolet, [Structure of the Thermosphere](https://www.sciencedirect.com/science/article/pii/0032063361900368?via%3Dihub), Planetary and Space Science, 1961 -3. [Gauss error function](https://en.wikipedia.org/wiki/Error_function) \ No newline at end of file +3. [Gauss error function](https://en.wikipedia.org/wiki/Error_function) diff --git a/Specifications/Disturbance/Spec_SurfaceForce_SolarRadiation.md b/Specifications/Disturbance/Spec_SurfaceForce_SolarRadiation.md index f5acf123..6c3f7e8f 100644 --- a/Specifications/Disturbance/Spec_SurfaceForce_SolarRadiation.md +++ b/Specifications/Disturbance/Spec_SurfaceForce_SolarRadiation.md @@ -2,67 +2,67 @@ ## 1. Overview -1. Functions - - `SolarRadiationPressureDisturbance` class inherits `SurfaceForce` base class and calculates air drag disturbance force and torque. +### 1. Functions +- `SolarRadiationPressureDisturbance` class inherits `SurfaceForce` base class and calculates air drag disturbance force and torque. -2. Related files - - `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. - - `disturbance.ini` : Initialization file +### 2. Related files +- `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. +- `disturbance.ini` : Initialization file -3. How to use - - Make an instance of the `SolarRadiationPressureDisturbance` class in `InitializeInstances` function in `disturbances.cpp` - - Create an instance by using the initialization function `InitSolarRadiationPressureDisturbance` - - Set the parameters in the `disturbance.ini` - - Select `ENABLE` for `calculation` and `logging` +### 3. How to use +- Make an instance of the `SolarRadiationPressureDisturbance` class in `InitializeInstances` function in `disturbances.cpp` + - Create an instance by using the initialization function `InitSolarRadiationPressureDisturbance` +- Set the parameters in the `disturbance.ini` + - Select `ENABLE` for `calculation` and `logging` ## 2. Explanation of Algorithm -1. `CalcCoefficients` function - 1. overview - - `CalcCoefficients` calculates the normal and in-plane coefficients for `SurfaceForce` calculation. - - 2. inputs and outputs - - inputs - - $v_{s}$:Direction vector of the sun (spacecraft to the sun) at the body frame - - $P$ Solar pressure at the position of the spacecraft [N/m^2] - - setting parameters - - $\nu$ : Total reflectance - - $\nu = 1-\alpha$, where $\alpha$ is the absorption of the sun spectrum. - - $\mu$ : Specularity. Ratio of specular reflection inside the total reflected light. - - $A$ : Area of the surface - - outputs - - $C_{n}$ and $C_{t}$ - - 3. algorithm - - $C_{n}$ and $C_{t}$ are calculated as follows: - - $\theta$ is the angle between the normal vector and the sun vector. - - ```math - \begin{align} - C_{n} &= AP \left((1+\nu\mu)\cos^{2}{\theta}+\frac{2}{3}\nu(1-\mu)\cos{\theta} \right)\\ - C_{t} &= AP(1-\nu\mu)\cos{\theta}\sin{\theta} - \end{align} - ``` - - 4. note - - NA +### 1. `CalcCoefficients` function +#### 1. overview +- `CalcCoefficients` calculates the normal and in-plane coefficients for `SurfaceForce` calculation. + +#### 2. inputs and outputs +- inputs + - $v_{s}$:Direction vector of the sun (spacecraft to the sun) at the body frame + - $P$ Solar pressure at the position of the spacecraft [N/m^2] +- setting parameters + - $\nu$ : Total reflectance + - $\nu = 1-\alpha$, where $\alpha$ is the absorption of the sun spectrum. + - $\mu$ : Specularity. Ratio of specular reflection inside the total reflected light. + - $A$ : Area of the surface +- outputs + - $C_{n}$ and $C_{t}$ + +#### 3. algorithm +- $C_{n}$ and $C_{t}$ are calculated as follows: + - $\theta$ is the angle between the normal vector and the sun vector. + +```math +\begin{align} + C_{n} &= AP \left((1+\nu\mu)\cos^{2}{\theta}+\frac{2}{3}\nu(1-\mu)\cos{\theta} \right)\\ + C_{t} &= AP(1-\nu\mu)\cos{\theta}\sin{\theta} +\end{align} +``` + +#### 4. note +- NA ## 3. Results of verifications -1. Verification of perfect reflection case - 1. overview - - In the perfect reflection case, the direction of the SRP force will be opposite from the direction of the sun. +### 1. Verification of perfect reflection case +#### 1. overview +- In the perfect reflection case, the direction of the SRP force will be opposite from the direction of the sun. - 2. conditions for the verification - - We assumed that the structure of the spacecraft is a 50-cm cube whose optical property is the perfect specular reflection($\nu=\mu=1$). +#### 2. conditions for the verification +- We assumed that the structure of the spacecraft is a 50-cm cube whose optical property is the perfect specular reflection($\nu=\mu=1$). - 3. results - - We confirmed that the direction of the SRP force is opposite from the direction of the sun at the body frame. +#### 3. results +- We confirmed that the direction of the SRP force is opposite from the direction of the sun at the body frame. - SummaryCalculationTime +SummaryCalculationTime ## 4. References diff --git a/Specifications/Disturbance/Spec_ThirdBodyGravity.md b/Specifications/Disturbance/Spec_ThirdBodyGravity.md index b8b6e0b8..94897f97 100644 --- a/Specifications/Disturbance/Spec_ThirdBodyGravity.md +++ b/Specifications/Disturbance/Spec_ThirdBodyGravity.md @@ -2,129 +2,128 @@ ## 1. Overview -1. Functions - - The `ThirdBodyGravity` class calculates the gravity acceleration generated by the third body, such as Sun, Moon, or planets. - -2. Related files - - `src/disturbance/third_body_gravity.cpp` - - `src/disturbance/third_body_gravity.hpp` - -3. How to use - - Make an instance of the `ThirdBodyGravity` class in `InitializeInstances` function in `disturbances.cpp` - - Create an instance by using the initialization function `InitThirdBodyGravity` - - Chose a orbit propagator mode that considers disturbances. - - Edit the `disturbance.ini` file - - Select `ENABLE` for `calculation` and `logging` - - Select `number_of_third_body` and `third_body_name` you need. - - **NOTE**: All of the `third_body_name` objects must be included in the `selected_body_name` of the `[CELESTIAL_INFORMATION]` section in the `simulation_base.ini`. - - **NOTE**: When the class `ThirdBodyGravity` is instantiated, the class reports an error in the following cases. - 1. The target specified by `center_object` of the `[CELESTIAL_INFORMATION]` section in the `simulation_base.ini`. is included in the list of `third_body`. - 2. The list of `third_body_name` includes objects which are not in the list of `selected_body_name` in the `[CELESTIAL_INFORMATION]` section in the `simulation_base.ini`. - - **NOTE**: If the same body is specified more than once in the list of `third_body_name` in `disturbance.ini`, the second and subsequent entries of the body are ignored. +### 1. Functions +- The `ThirdBodyGravity` class calculates the gravity acceleration generated by the third body, such as Sun, Moon, or planets. + +### 2. Related files +- `src/disturbance/third_body_gravity.cpp` +- `src/disturbance/third_body_gravity.hpp` + +### 3. How to use +- Make an instance of the `ThirdBodyGravity` class in `InitializeInstances` function in `disturbances.cpp` + - Create an instance by using the initialization function `InitThirdBodyGravity` +- Chose a orbit propagator mode that considers disturbances. +- Edit the `disturbance.ini` file + - Select `ENABLE` for `calculation` and `logging` + - Select `number_of_third_body` and `third_body_name` you need. + - **NOTE**: All of the `third_body_name` objects must be included in the `selected_body_name` of the `[CELESTIAL_INFORMATION]` section in the `simulation_base.ini`. +- **NOTE**: When the class `ThirdBodyGravity` is instantiated, the class reports an error in the following cases. + 1. The target specified by `center_object` of the `[CELESTIAL_INFORMATION]` section in the `simulation_base.ini`. is included in the list of `third_body`. + 2. The list of `third_body_name` includes objects which are not in the list of `selected_body_name` in the `[CELESTIAL_INFORMATION]` section in the `simulation_base.ini`. +- **NOTE**: If the same body is specified more than once in the list of `third_body_name` in `disturbance.ini`, the second and subsequent entries of the body are ignored. ## 2.Explanation of Algorithm - The base algorithm is referred to [Satellite Orbits](https://www.springer.com/jp/book/9783540672807) chapter 3.3. -1. ` CalcAcceleration_i_m_s2` function - 1. overview - - This function calculates the acceleration in the inertial frame generated by the third body. +### 1. ` CalcAcceleration_i_m_s2` function +#### 1. overview +- This function calculates the acceleration in the inertial frame generated by the third body. - 2. inputs and outputs - - Input - - position of the third body seen from the **center object** in the inertial coordinate system - - position of the third body seen from the **spacecraft** in the inertial coordinate system - - gravity constant (GM) of the third body - - NOTE: These inputs are derived from `CelestialInformation`. +#### 2. inputs and outputs +- Input + - position of the third body seen from the **center object** in the inertial coordinate system + - position of the third body seen from the **spacecraft** in the inertial coordinate system + - gravity constant (GM) of the third body + - NOTE: These inputs are derived from `CelestialInformation`. - - Output - - acceleration generated by the third body in the inertial coordinate system +- Output + - acceleration generated by the third body in the inertial coordinate system - 3. algorithm - - Definition of the variables - - $\boldsymbol{r}$: the position of the spacecraft (written as `sc_position_i_m` in the code) - - $\boldsymbol{s}$: the position of the third body (written as `third_body_pos_i_m` in the code) - - $\boldsymbol{s}-\boldsymbol{r}$: the position of the third body seen from the spacecraft (written as `third_body_position_from_sc_i_m` in the code) +#### 3. algorithm +- Definition of the variables + - $\boldsymbol{r}$: the position of the spacecraft (written as `sc_position_i_m` in the code) + - $\boldsymbol{s}$: the position of the third body (written as `third_body_pos_i_m` in the code) + - $\boldsymbol{s}-\boldsymbol{r}$: the position of the third body seen from the spacecraft (written as `third_body_position_from_sc_i_m` in the code) - ThirdBodyGravity_general +ThirdBodyGravity_general - - The acceleration disturbance effect by the third body is written as follows: +- The acceleration disturbance effect by the third body is written as follows: - ```math - \ddot{\boldsymbol{r}}=GM\left(\frac{\boldsymbol{s}-\boldsymbol{r}}{|\boldsymbol{s}-\boldsymbol{r}|^3}-\frac{\boldsymbol{s}}{|\boldsymbol{s}|^3}\right) - ``` +```math +\ddot{\boldsymbol{r}}=GM\left(\frac{\boldsymbol{s}-\boldsymbol{r}}{|\boldsymbol{s}-\boldsymbol{r}|^3}-\frac{\boldsymbol{s}}{|\boldsymbol{s}|^3}\right) +``` - - See section 3.3.1 of [Satellite Orbits](https://www.springer.com/jp/book/9783540672807) for a detailed explanation. +- See section 3.3.1 of [Satellite Orbits](https://www.springer.com/jp/book/9783540672807) for a detailed explanation. ## 3. Results of verifications -1. overview - - The deformation of the orbit caused by the acceleration of the third body gravity is compared between S2E and STK. +### 1. overview +- The deformation of the orbit caused by the acceleration of the third body gravity is compared between S2E and STK. -2. conditions for the verification - 1. input files - - Default initialize files - - 2. initial values - ``` - 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. +### 2. conditions for the verification +- input files + - Default initialize files - ``` - initial_position_i_m(0) = 42241095.67425744 - initial_position_i_m(1) = 0 - initial_position_i_m(2) = 0 +- initial values + ``` + 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. + ``` + initial_position_i_m(0) = 42241095.67425744 + initial_position_i_m(1) = 0 + initial_position_i_m(2) = 0 - initial_velocity_i_m_s(0) = 0 - initial_velocity_i_m_s(1) = 2.978E+4 - initial_velocity_i_m_s(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. + - All the disturbance calculations, except for the third-object gravity, are set to DISABLE. - - The following cases are tested. - 1. Only the gravity of the Sun is taken into account - 2. Only the gravity of the Moon is taken into account - 3. Both the gravity of the Sun and the Moon are taken into account - 4. Only the gravity of Mars is taken into account (TBW) + - The following cases are tested. + 1. Only the gravity of the Sun is taken into account + 2. Only the gravity of the Moon is taken into account + 3. Both the gravity of the Sun and the Moon are taken into account + 4. Only the gravity of Mars is taken into account (TBW) - 3. results - - Without the third body, S2E and STK show the same result. +3. results +- Without the third body, S2E and STK show the same result. - ThirdBodyGravity_result1 +ThirdBodyGravity_result1 - 1. Only the gravity of the Sun is taken into account - - The deformation of the orbit compared to GEO is shown in the following figure. +1. Only the gravity of the Sun is taken into account +- The deformation of the orbit compared to GEO is shown in the following figure. - ThirdBodyGravity_s2e_stk_sun +ThirdBodyGravity_s2e_stk_sun - - The acceleration disturbance caused by the Sun's gravity is shown in the following figure. +- The acceleration disturbance caused by the Sun's gravity is shown in the following figure. - ThirdBodyGravity_acc_sun +ThirdBodyGravity_acc_sun - 2. Only the gravity of the Moon is taken into account - - The deformation of the orbit compared to GEO is shown in the following figure. +2. Only the gravity of the Moon is taken into account +- The deformation of the orbit compared to GEO is shown in the following figure. - ThirdBodyGravity_s2e_stk_moon +ThirdBodyGravity_s2e_stk_moon - - The acceleration disturbance caused by the Moon's gravity is shown in the following figure. +- The acceleration disturbance caused by the Moon's gravity is shown in the following figure. - ThirdBodyGravity_acc_moon - - 3. Both the gravity of the Sun and the Moon are taken into account - - The deformation of the orbit compared to GEO is shown in the following figure. +ThirdBodyGravity_acc_moon - ThirdBodyGravity_s2e_stk_sun_moon +3. Both the gravity of the Sun and the Moon are taken into account +- The deformation of the orbit compared to GEO is shown in the following figure. - - The gravitational disturbance of both the Sun and the Moon is shown in the following figure. +ThirdBodyGravity_s2e_stk_sun_moon - ThirdBodyGravity_acc_sun +- The gravitational disturbance of both the Sun and the Moon is shown in the following figure. - - In all of the above cases, the S2E and STK results are consistent. +ThirdBodyGravity_acc_sun + +- In all of the above cases, the S2E and STK results are consistent. ## 4. References 1. [Satellite Orbits](https://www.springer.com/jp/book/9783540672807) chapter 3.3. diff --git a/Specifications/Dynamics/Spec_Attitude.md b/Specifications/Dynamics/Spec_Attitude.md index 0e7cce77..113e8c7c 100644 --- a/Specifications/Dynamics/Spec_Attitude.md +++ b/Specifications/Dynamics/Spec_Attitude.md @@ -2,30 +2,30 @@ ## 1. Overview -1. functions - - The `Attitude` class calculates the attitude and angular velocity of a satellite with the following propagation modes. - - RK4 : 4th order Runge-Kutta propagation with disturbances and actuators output torque. Users use this mode to consider attitude control algorithm. - - CONTROLLED : Satellite attitude is perfectly controlled to the setting direction. This mode doesn't consider the disturbances and actuators output torque. Users use this mode when they focus on orbit dynamics or mission analysis. - -2. files - - `src/dynamics/attitude/attitude.hpp, .cpp` - - Definition of `Attitude` base class - - `src/dynamics/attitude/initialize_attitude.hpp, .cpp` - - Make an instance of `Attitude` class. - -3. How to use - - Make an instance of the attitude class in `Initialize` function in `dynamics.cpp` - - Usually, users don't care this process. - - 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 = 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. - +### 1. functions +- The `Attitude` class calculates the attitude and angular velocity of a satellite with the following propagation modes. + - `RK4` : 4th order Runge-Kutta propagation with disturbances and actuators output torque. Users use this mode to consider attitude control algorithm. + - `CONTROLLED` : Satellite attitude is perfectly controlled to the setting direction. This mode doesn't consider the disturbances and actuators output torque. Users use this mode when they focus on orbit dynamics or mission analysis. + +### 2. files +- `src/dynamics/attitude/attitude.hpp, .cpp` + - Definition of `Attitude` base class +- `src/dynamics/attitude/initialize_attitude.hpp, .cpp` + - Make an instance of `Attitude` class. + +### 3. How to use +- Make an instance of the attitude class in `Initialize` function in `dynamics.cpp` + - Usually, users don't care this process. +- 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 = 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. + ## 2. Explanation of Algorithm In the `Attitude` base class provides the following common functions for every propagator. diff --git a/Specifications/Dynamics/Spec_ControlledAttitude.md b/Specifications/Dynamics/Spec_ControlledAttitude.md index 99ed564e..7c6cbd7a 100644 --- a/Specifications/Dynamics/Spec_ControlledAttitude.md +++ b/Specifications/Dynamics/Spec_ControlledAttitude.md @@ -2,208 +2,212 @@ ## 1. Overview -1. Functions - - The `ControlledAttitude` class provides a perfectly controlled attitude instead of free motion attitude dynamics by numerical propagation. - - Users can set the attitude as sun pointing, earth pointing, and others for any direction in the spacecraft body frame. Of course, users can select an inertial stabilized attitude. - - It is useful for power, communication, and orbit analyses with S2E. - -2. Related files - - `src/dynamics/attitude/attitude.hpp, .cpp` - - Definition of `Attitude` base class - - `src/dynamics/attitude/controlled_attitude.hpp, .cpp` - - `ControlledAttitude` class is defined here. - - `src/dynamics/attitude/initialize_attitude.hpp, .cpp` - - Make an instance of `Attitude` class. - - `sample_satellite.ini` : Initialization file - -3. How to use - - Inside the codes - - `ControlledAttitude` class inherits the `Attitude` class, so other functions can access the `ControlledAttitude` class by using get functions in the `Attitude` class. - - User I/F - - Firstly, users should set `propagate_mode = CONTROLLED` at the `[ATTITUDE]` section in the `sample_satellite.ini` file. - - Users can set a target attitude in the initialize file. There are the following setting parameters: `main_mode`, `sub_mode`, `initial_quaternion_i2t`, `pointing_t_b`, and `pointing_sub_t_b`. - - Firstly, users select the control mode by using `main_mode` and `sub_mode`. For the control mode. - - When `main_mode` is set as `INERTIAL_STABILIZE`, `sub_mode` is ignored, and the spacecraft attitude is fixed to the `initial_quaternion_i2t` value in the simulation. - - When `main_mode` is set as `HOGE_POINTING` modes, the direction of the body-fixed frame defined by `pointing_t_b` is controlled to point the specific direction of the modes. - - Ex. 1, the body-fixed +X axis directs to the sun when `main_mode = SUN_POINTING` and `pointing_t_b = [1.0,0.0,0.0]`. - - Ex. 2, the body-fixed -Z axis directs to the earth center when `main_mode = EARTH_CENTER_POINTING` and `pointing_t_b = [0.0,0.0,-1.0]`. - - `sub_mode` is only used when users select `POINTING` modes for `main_mode`. `sub_mode` is defined to stop rotation around the pointing direction of `main_mode`. The selected sub-direction in the body-fixed frame cannot perfectly direct the target direction since the primary target and sub-target usually do not satisfy the vertical relationship. - - `sub_mode` cannot be `INERTIAL_STABILIZE` and the same mode with `main_mode`. - - The angle between `pointing_t_b` and `pointing_sub_t_b` should be larger than 30 degrees. (90 degrees is recommended) - - List of attitude control mode - - INERTIAL_STABILIZE = 0 - - SUN_POINTING = 1 - - EARTH_CENTER_POINTING = 2 - - VELOCITY_DIRECTION_POINTING = 3 - - ORBIT_NORMAL_POINTING = 4 - - orbit normal $n$ is defined as $n=r\times v$, where $r$ is radial direction and $v$ is velocity direction. - +### 1. Functions +- The `ControlledAttitude` class provides a perfectly controlled attitude instead of free motion attitude dynamics by numerical propagation. +- Users can set the attitude as sun pointing, earth pointing, and others for any direction in the spacecraft body frame. Of course, users can select an inertial stabilized attitude. +- It is useful for power, communication, and orbit analyses with S2E. + +### 2. Related files +- `src/dynamics/attitude/attitude.hpp, .cpp` + - Definition of `Attitude` base class +- `src/dynamics/attitude/controlled_attitude.hpp, .cpp` + - `ControlledAttitude` class is defined here. +- `src/dynamics/attitude/initialize_attitude.hpp, .cpp` + - Make an instance of `Attitude` class. +- `sample_satellite.ini` : Initialization file + +### 3. How to use +- Inside the codes + - `ControlledAttitude` class inherits the `Attitude` class, so other functions can access the `ControlledAttitude` class by using get functions in the `Attitude` class. +- User I/F + - Firstly, users should set `propagate_mode = CONTROLLED` at the `[ATTITUDE]` section in the `sample_satellite.ini` file. + - Users can set a target attitude in the initialize file. There are the following setting parameters: `main_mode`, `sub_mode`, `initial_quaternion_i2t`, `pointing_t_b`, and `pointing_sub_t_b`. + - Firstly, users select the control mode by using `main_mode` and `sub_mode`. For the control mode. + - When `main_mode` is set as `INERTIAL_STABILIZE`, `sub_mode` is ignored, and the spacecraft attitude is fixed to the `initial_quaternion_i2t` value in the simulation. + - When `main_mode` is set as `HOGE_POINTING` modes, the direction of the body-fixed frame defined by `pointing_t_b` is controlled to point the specific direction of the modes. + - Ex. 1, the body-fixed +X axis directs to the sun when `main_mode = SUN_POINTING` and `pointing_t_b = [1.0,0.0,0.0]`. + - Ex. 2, the body-fixed -Z axis directs to the earth center when `main_mode = EARTH_CENTER_POINTING` and `pointing_t_b = [0.0,0.0,-1.0]`. + - `sub_mode` is only used when users select `POINTING` modes for `main_mode`. `sub_mode` is defined to stop rotation around the pointing direction of `main_mode`. The selected sub-direction in the body-fixed frame cannot perfectly direct the target direction since the primary target and sub-target usually do not satisfy the vertical relationship. + - `sub_mode` cannot be `INERTIAL_STABILIZE` and the same mode with `main_mode`. + - The angle between `pointing_t_b` and `pointing_sub_t_b` should be larger than 30 degrees. (90 degrees is recommended) +- List of attitude control mode + - INERTIAL_STABILIZE = 0 + - SUN_POINTING = 1 + - EARTH_CENTER_POINTING = 2 + - VELOCITY_DIRECTION_POINTING = 3 + - ORBIT_NORMAL_POINTING = 4 + - orbit normal $n$ is defined as $n=r\times v$, where $r$ is radial direction and $v$ is velocity direction. ## 2. Explanation of Algorithm -1. Initialize function - - 1. overview - - This function initializes the target attitude and confirms that the setting parameters are correct. - - The parameter checklist - - Out of range check for both mode definitions. - - `main_mode` and `sub_mode` is not the same - - The angle between `pointing_t_b` and `pointing_sub_t_b` should be larger than 30 degrees. - 2. inputs and outputs - - NA - 3. algorithm - - NA - 4. note - - NA - -2. Propagate function - - 1. overview - - This is the main function executed in every loop of attitude dynamics calculation. - - 2. inputs and outputs - - inputs - - setting parameters - - outputs - - quaternion_i2b - - 3. algorithm - - Detail algorithm is described in the next function. - - 4. note - - NA - -3. CalcTargetDirection - - 1. overview - - This function calculates the target direction according to the pointing mode. - - 2. inputs and outputs - - inputs - - control mode - - orbit class - - celestial information class - - outputs - - the direction of the target object - - 3. algorithm - - As written in the code. - - 4. note - - NA - -3. PointingCtrl - - 1. overview - - This function calculates the `quaternion_i2b`. - - 2. inputs and outputs - - inputs - - the main direction of the target object in ECI frame $t_m^i$ - - the sub direction of the target object in ECI frame $t_s^i$ - - the main controlled direction in the body frame $d_m^b$ - - the sub controlled direction in the body frame $d_s^b$ - - outputs - - quaternion_i2b - - 3. algorithm - - Firstly, the $DCM_{t2i}$, which is the frame transformation from the target frame to the inertial frame, is calculated using $t_m^i$ and $t_s^i$ with `CalcDCM`. - - Next, the $DCM_{t2b}$, which is the frame transformation from the target frame to the body-fixed frame, is calculated using $d_m^b$ and $d_s^b$ with `CalcDCM`. - - Finally, both DCMs are combined as - ```math - DCM_{i2b} = DCM_{t2b} \cdot DCM_{t2i}' - ``` - and `quaternion_i2b` is calculated from the $DCM_{i2b}$. - - 4. note - - NA - -3. CalcDCM - - 1. overview - - This function calculates a DCM from two given directions. - - The DCM represents the coordinate transform matrix from the new frame defined by the two directions to the original frame. - - 2. inputs and outputs - - inputs - - the main direction in the frame $a$ : $d_m^a$ - - the sub direction in the frame $a$ : $d_s^a$ - - outputs - - Coordinate transform matrix from the new frame to the original frame $a$ - - 3. algorithm - - The first basis vector of the new frame is defined as the main direction. - ```math - e_1=d_m^a - ``` - - The second basis vector needs to be direct to the sub direction, but it should be vertical with $e_1$. - ```math - e_2 = \frac{(e_1\times d_s^a) \times e_1}{|(e_1\times d_s^a) \times e_1|} - ``` - - The third basis vector is defined as right-hand coordinate. - ```math - e_3=\frac{e_1\times e_2}{|e_1\times e_2|} - ``` - - 4. note - - NA - -3. note - - Currently, the `ControlledAttitude` class does not calculate angular velocity, and it is set as 0. The feature will be implemented in the near future. +### 1. Initialize function + +#### 1. overview +- This function initializes the target attitude and confirms that the setting parameters are correct. +- The parameter checklist + - Out of range check for both mode definitions. + - `main_mode` and `sub_mode` is not the same + - The angle between `pointing_t_b` and `pointing_sub_t_b` should be larger than 30 degrees. + +#### 2. inputs and outputs +- NA + +#### 3. algorithm +- NA + +#### 4. note +- NA + +### 2. Propagate function + +#### 1. overview +- This is the main function executed in every loop of attitude dynamics calculation. + +#### 2. inputs and outputs +- inputs + - setting parameters +- outputs + - quaternion_i2b + +#### 3. algorithm +- Detail algorithm is described in the next function. + +#### 4. note +- NA + +### 3. CalcTargetDirection + +#### 1. overview +- This function calculates the target direction according to the pointing mode. + +#### 2. inputs and outputs +- inputs + - control mode + - orbit class + - celestial information class +- outputs + - the direction of the target object + +#### 3. algorithm +- As written in the code. + +#### 4. note +- NA + +### 3. PointingCtrl + +#### 1. overview +- This function calculates the `quaternion_i2b`. + +#### 2. inputs and outputs +- inputs + - the main direction of the target object in ECI frame $t_m^i$ + - the sub direction of the target object in ECI frame $t_s^i$ + - the main controlled direction in the body frame $d_m^b$ + - the sub controlled direction in the body frame $d_s^b$ +- outputs + - quaternion_i2b + +#### 3. algorithm +- Firstly, the $DCM_{t2i}$, which is the frame transformation from the target frame to the inertial frame, is calculated using $t_m^i$ and $t_s^i$ with `CalcDCM`. +- Next, the $DCM_{t2b}$, which is the frame transformation from the target frame to the body-fixed frame, is calculated using $d_m^b$ and $d_s^b$ with `CalcDCM`. +- Finally, both DCMs are combined as follows. And `quaternion_i2b` is calculated from the $DCM_{i2b}$. +```math +DCM_{i2b} = DCM_{t2b} \cdot DCM_{t2i}' +``` + +#### 4. note +- NA + +### 3. CalcDCM + +#### 1. overview +- This function calculates a DCM from two given directions. +- The DCM represents the coordinate transform matrix from the new frame defined by the two directions to the original frame. + +#### 2. inputs and outputs +- inputs + - the main direction in the frame $a$ : $d_m^a$ + - the sub direction in the frame $a$ : $d_s^a$ +- outputs + - Coordinate transform matrix from the new frame to the original frame $a$ + +#### 3. algorithm +- The first basis vector of the new frame is defined as the main direction. +```math + e_1=d_m^a +``` +- The second basis vector needs to be direct to the sub direction, but it should be vertical with $e_1$. +```math + e_2 = \frac{(e_1\times d_s^a) \times e_1}{|(e_1\times d_s^a) \times e_1|} +``` +- The third basis vector is defined as right-hand coordinate. +```math + e_3=\frac{e_1\times e_2}{|e_1\times e_2|} +``` + +#### 4. note +- NA + +### 3. note +- Currently, the `ControlledAttitude` class does not calculate angular velocity, and it is set as 0. The feature will be implemented in the near future. ## 3. Results of verifications -1. Inertial stabilize - 1. overview - - To verify the correctness of pointing control - 2. conditions for the verification - 1. input files - - default files - 2. initial values - - main_mode = sub_mode = INERTIAL_STABILIZE - - initial_quaternion_i2b = [0.5,0.5,0.5,0.5] - 3. results - - The inertial stabilize control is succeeded. - InertialStabilize - -1. Pointing Control - 1. overview - - Several cases described at the bottom were checked to verify the correctness of pointing control. - 2. conditions for the verification - 1. input files - - default files - 2. cases   - -| case | main mode | sub mode | main_pointing_direction_b | sub_pointing_direction_b | -| ---- | ------------ | ------------ | --------------- | ---------------- | -| 1 | Sun | Earth Center | [1,0,0] | [0,1,0] | -| 2 | Sun | Earth Center | [0,0,-1] | [-1,0,0] | -| 3 | Earth Center | Velocity | [0,-1,0] | [0,0,1] | -| 4 | Velocity | Sun | [0.707,0.707,0] | [0,0,1] | -| | | | | | - - 3. results - 1. Case 1 - - The spacecraft +X axis correctly directs to the sun, and its +Y axis roughly directs to the earth. - - Case1 - - 1. Case 2 - - The spacecraft -Z axis correctly directs to the sun, and its -X axis roughly directs to the earth. - - Case2 - - 1. Case 3 - - The spacecraft -Y axis correctly directs to the earth, and its +Z axis roughly directs to the velocity direction. - - Case3 - - 1. Case 4 - - The spacecraft +XY direction correctly directs to the velocity direction, and its +Z axis roughly directs to the sun. - - Case4 - +### 1. Inertial stabilize +#### 1. overview +- To verify the correctness of pointing control + +#### 2. conditions for the verification +- input files + - default files +- initial values + - main_mode = sub_mode = INERTIAL_STABILIZE + - initial_quaternion_i2b = [0.5,0.5,0.5,0.5] + +#### 3. results +- The inertial stabilize control is succeeded. +InertialStabilize + +### 1. Pointing Control +#### 1. overview +- Several cases described at the bottom were checked to verify the correctness of pointing control. + +#### 2. conditions for the verification +- input files + - default files +- cases   + + | case | main mode | sub mode | main_pointing_direction_b | sub_pointing_direction_b | + | ---- | ------------ | ------------ | --------------- | ---------------- | + | 1 | Sun | Earth Center | [1,0,0] | [0,1,0] | + | 2 | Sun | Earth Center | [0,0,-1] | [-1,0,0] | + | 3 | Earth Center | Velocity | [0,-1,0] | [0,0,1] | + | 4 | Velocity | Sun | [0.707,0.707,0] | [0,0,1] | + | | | | | | + +#### 3. results +1. Case 1 +- The spacecraft +X axis correctly directs to the sun, and its +Y axis roughly directs to the earth. + +Case1 + +1. Case 2 +- The spacecraft -Z axis correctly directs to the sun, and its -X axis roughly directs to the earth. + +Case2 + +1. Case 3 +- The spacecraft -Y axis correctly directs to the earth, and its +Z axis roughly directs to the velocity direction. + +Case3 + +1. Case 4 +- The spacecraft +XY direction correctly directs to the velocity direction, and its +Z axis roughly directs to the sun. + +Case4 + ## 4. References 1. NA \ No newline at end of file diff --git a/Specifications/Dynamics/Spec_EnckeMethod.md b/Specifications/Dynamics/Spec_EnckeMethod.md index b6d6ad4c..e3bf3097 100644 --- a/Specifications/Dynamics/Spec_EnckeMethod.md +++ b/Specifications/Dynamics/Spec_EnckeMethod.md @@ -2,128 +2,127 @@ ## 1. Overview -1. functions - - The `EnckeOrbitPropagation` class calculates the satellite position and velocity with Encke's method, including disturbances and controlled accelerations by the satellite. - - This orbit propagation mode provides an accurate and efficient orbit calculation with disturbance forces. - - We can also use it for accurate relative orbit propagation, and the feature will be implemented soon. +### 1. functions +- The `EnckeOrbitPropagation` class calculates the satellite position and velocity with Encke's method, including disturbances and controlled accelerations by the satellite. +- This orbit propagation mode provides an accurate and efficient orbit calculation with disturbance forces. +- We can also use it for accurate relative orbit propagation, and the feature will be implemented soon. -2. files - - `src/dynamics/orbit/orbit.hpp, cpp` - - Definition of `Orbit` base class - - `src/dynamics/orbit/initialize_orbit.hpp, .cpp` - - Make an instance of orbit class. - - `src/dynamics/orbit/encke_orbit_propagation.cpp, .hpp` - - We use [KeplerOrbit](./Spec_KeplerOrbit.md) libraries to calculate the reference orbit. +### 2. files +- `src/dynamics/orbit/orbit.hpp, cpp` + - Definition of `Orbit` base class +- `src/dynamics/orbit/initialize_orbit.hpp, .cpp` + - Make an instance of orbit class. +- `src/dynamics/orbit/encke_orbit_propagation.cpp, .hpp` +- We use [KeplerOrbit](./Spec_KeplerOrbit.md) libraries to calculate the reference orbit. -3. How to use - - Select `propagate_mode = ENCKE` in the spacecraft's ini file. - - Select `initialize_mode` as you want. - - `DEFAULT` : Use default initialize method (`RK4` and `ENCKE` use position and velocity, `KEPLER` uses init_mode_kepler) - - `POSITION_VELOCITY_I` : Initialize with position and velocity in the inertial frame - - `ORBITAL_ELEMENTS` : Initialize with orbital elements - - Set the value of `error_tolerance`, which decides the threshold for the rectification. +### 3. How to use +- Select `propagate_mode = ENCKE` in the spacecraft's ini file. +- Select `initialize_mode` as you want. + - `DEFAULT` : Use default initialize method (`RK4` and `ENCKE` use position and velocity, `KEPLER` uses init_mode_kepler) + - `POSITION_VELOCITY_I` : Initialize with position and velocity in the inertial frame + - `ORBITAL_ELEMENTS` : Initialize with orbital elements +- Set the value of `error_tolerance`, which decides the threshold for the rectification. ## 2. Explanation of Algorithm -1. `EnckeOrbitPropagation::Initialize` function - 1. Overview - - This function generates the initial value of the reference orbit and the difference orbit. +### 1. `EnckeOrbitPropagation::Initialize` function +#### 1. Overview +- This function generates the initial value of the reference orbit and the difference orbit. - 2. Inputs and outputs - - Input - - $\mu$ : The standard gravitational parameter of the central body - - $t$ : Time in Julian day - - $\boldsymbol{r}_{i}$ : Initial position in the inertial frame - - $\boldsymbol{v}_{i}$ : Initial velocity in the inertial frame - - Output - - The reference orbit - - The difference is set as zero +#### 2. Inputs and outputs +- Input + - $\mu$ : The standard gravitational parameter of the central body + - $t$ : Time in Julian day + - $\boldsymbol{r}_{i}$ : Initial position in the inertial frame + - $\boldsymbol{v}_{i}$ : Initial velocity in the inertial frame +- Output + - The reference orbit + - The difference is set as zero - 3. Algorithm - - The reference orbit is initialized as the Kepler Orbit with `OrbitalElements::CalcOeFromPosVel` function. The detail of the function is described in [Specification for Kepler Orbit Propagation](./Spec_KeplerOrbit.md) +#### 3. Algorithm +- The reference orbit is initialized as the Kepler Orbit with `OrbitalElements::CalcOeFromPosVel` function. The detail of the function is described in [Specification for Kepler Orbit Propagation](./Spec_KeplerOrbit.md) -2. `EnckeOrbitPropagation::Propagate` function - 1. Overview - - This function is the main algorithm of Encke's method and calculates the orbit of the spacecraft. - - The method separates the orbit to the reference and the difference. The reference is calculated with the Kepler orbit method as a two-body problem, and the difference is calculated, including the disturbances. - - $\boldsymbol{r}_{ref}$ : Reference orbit - - $\boldsymbol{\delta}$ : Difference - - Please refer to the references to learn the original idea of Encke's method. +### 2. `EnckeOrbitPropagation::Propagate` function +#### 1. Overview +- This function is the main algorithm of Encke's method and calculates the orbit of the spacecraft. +- The method separates the orbit to the reference and the difference. The reference is calculated with the Kepler orbit method as a two-body problem, and the difference is calculated, including the disturbances. + - $\boldsymbol{r}_{ref}$ : Reference orbit + - $\boldsymbol{\delta}$ : Difference +- Please refer to the references to learn the original idea of Encke's method. - 2. Inputs and outputs - - Input - - $\boldsymbol{a}_d$ : Acceleration - - $t$ : Current time - - Output - - $\boldsymbol{r}_{i}$ : Initial position in the inertial frame - - $\dot{\boldsymbol{r}}_{i}$ : Initial velocity in the inertial frame - - 3. Algorithm - 1. Rectification - - If the norm of the difference is larger than the tolerance, we need to update the reference orbit as the latest orbit information. - 2. Update reference orbit - - The reference orbit is calculated with the Kepler orbit calculation method. - 3. Propagate the difference - - Propagate the following differential equation. At this moment, we use the fourth-order Runge-Kutta method as a propagator. - ```math - \begin{align} - \ddot{\boldsymbol{\delta}} &= -\frac{\mu}{r_{ref}^3}(\boldsymbol{\delta}+f(q)\boldsymbol{r})+\boldsymbol{a}_d\\ - f(q) &= q \frac{q^2 + 3q + 3}{(1+q)^{1.5} + 1}\\ - q &= \frac{\boldsymbol{\delta}\cdot(\boldsymbol{\delta}-2\boldsymbol{r}_i)}{r_i} - \end{align} - ``` +#### 2. Inputs and outputs +- Input + - $\boldsymbol{a}_d$ : Acceleration + - $t$ : Current time +- Output + - $\boldsymbol{r}_{i}$ : Initial position in the inertial frame + - $\dot{\boldsymbol{r}}_{i}$ : Initial velocity in the inertial frame + +#### 3. Algorithm +1. Rectification +- If the norm of the difference is larger than the tolerance, we need to update the reference orbit as the latest orbit information. +2. Update reference orbit +- The reference orbit is calculated with the Kepler orbit calculation method. +3. Propagate the difference +- Propagate the following differential equation. At this moment, we use the fourth-order Runge-Kutta method as a propagator. +```math +\begin{align} + \ddot{\boldsymbol{\delta}} &= -\frac{\mu}{r_{ref}^3}(\boldsymbol{\delta}+f(q)\boldsymbol{r})+\boldsymbol{a}_d\\ + f(q) &= q \frac{q^2 + 3q + 3}{(1+q)^{1.5} + 1}\\ + q &= \frac{\boldsymbol{\delta}\cdot(\boldsymbol{\delta}-2\boldsymbol{r}_i)}{r_i} +\end{align} +``` ## 3. Results of verifications -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 (`ORBITAL_ELEMENTS` and `POSITION_VELOCITY_I`). - - 2. Conditions for the verification - - sample_simulation_base.ini - - The following values are modified from the default. - ``` - EndTimeSec = 10000 - LogOutPutIntervalSec = 5 - ``` - - SampleDisturbance.ini - - The disturbance setting is depending on the simulation case. - - All disabled or enabled. Other settings are default. - - SampleSat.ini - - The following values are modified from the default. - - `propagate_mode` is changed for each mode. - - Orbital elements for Kepler - ``` - semi_major_axis_m = 6794500.0 - eccentricity = 0.0015 - inclination_rad = 0.9012 - raan_rad = 0.1411 - arg_perigee_rad = 1.7952 - epoch_jday = 2.458940966402607e6 - ``` - - Initial position and velocity (compatible value with the orbital elements) - ``` - 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 - ``` +### 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 (`ORBITAL_ELEMENTS` and `POSITION_VELOCITY_I`). + +#### 2. Conditions for the verification +- sample_simulation_base.ini + - The following values are modified from the default. + ``` + EndTimeSec = 10000 + LogOutPutIntervalSec = 5 + ``` +- SampleDisturbance.ini + - The disturbance setting is depending on the simulation case. + - All disabled or enabled. Other settings are default. +- SampleSat.ini + - The following values are modified from the default. + - `propagate_mode` is changed for each mode. + - Orbital elements for Kepler + ``` + semi_major_axis_m = 6794500.0 + eccentricity = 0.0015 + inclination_rad = 0.9012 + raan_rad = 0.1411 + arg_perigee_rad = 1.7952 + epoch_jday = 2.458940966402607e6 + ``` + - Initial position and velocity (compatible value with the orbital elements) + ``` + 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 - - The following figure shows the difference between orbit derived with Kepler mode initialized with OE and Encke mode without any disturbances. - - The error is small (less than 10m), and we confirmed that the Encke propagation mode is correct when the disturbances are zero. -
- -
+3. Results +- The following figure shows the difference between orbit derived with Kepler mode initialized with OE and Encke mode without any disturbances. + - The error is small (less than 10m), and we confirmed that the Encke propagation mode is correct when the disturbances are zero. +
+ +
- - The following figure shows the difference between orbit derived with RK4 mode and Encke mode with all disturbances. - - The error is larger than the non-disturbance case, but the $10^4 [m]$ error between the Encke method and the Cowell method is compatible with the ref[2] when using the RK4 in LEO. We confirmed that the Encke propagation mode is correct when all disturbances are included. -
- -
- +- The following figure shows the difference between orbit derived with RK4 mode and Encke mode with all disturbances. + - The error is larger than the non-disturbance case, but the $10^4 [m]$ error between the Encke method and the Cowell method is compatible with the ref[2] when using the RK4 in LEO. We confirmed that the Encke propagation mode is correct when all disturbances are included. +
+ +
## 4. References - [1] David A. Vallado, "Fundamental of Astrodynamics and Applications, Third Edition", ch.8, 2007. diff --git a/Specifications/Dynamics/Spec_KeplerOrbit.md b/Specifications/Dynamics/Spec_KeplerOrbit.md index cd60d792..c1b1c2a4 100644 --- a/Specifications/Dynamics/Spec_KeplerOrbit.md +++ b/Specifications/Dynamics/Spec_KeplerOrbit.md @@ -2,265 +2,264 @@ ## 1. Overview -1. Functions - - The `KeplerOrbit` class calculates the satellite position and velocity with the simple two-body problem. We ignored any disturbances and generated forces by the satellite. - - This orbit propagation mode provides the simplest and fastest orbit calculation for any orbit(LEO, GEO, Deep Space, and so on.). +### 1. Functions +- The `KeplerOrbit` class calculates the satellite position and velocity with the simple two-body problem. We ignored any disturbances and generated forces by the satellite. +- This orbit propagation mode provides the simplest and fastest orbit calculation for any orbit(LEO, GEO, Deep Space, and so on.). -2. Files - - `src/dynamics/orbit/orbit.hpp, cpp` - - Definition of `Orbit` base class - - `src/dynamics/orbit/initialize_orbit.hpp, .cpp` - - Make an instance of orbit class. - - `src/dynamics/orbit/kepler_orbit_propagation.hpp, .cpp` - - Libraries - - `src/library/orbit/kepler_orbit.cpp, hpp` - - `src/library/orbit/orbital_elements.cpp, hpp` +### 2. Files +- `src/dynamics/orbit/orbit.hpp, cpp` + - Definition of `Orbit` base class +- `src/dynamics/orbit/initialize_orbit.hpp, .cpp` + - Make an instance of orbit class. +- `src/dynamics/orbit/kepler_orbit_propagation.hpp, .cpp` +- Libraries + - `src/library/orbit/kepler_orbit.cpp, hpp` + - `src/library/orbit/orbital_elements.cpp, hpp` - -3. How to use - - Select `propagate_mode = KEPLER` in the spacecraft's ini file. - - Select `initialize_mode` as you want. - - `DEFAULT` : Use default initialize method (`RK4` and `ENCKE` use position and velocity, `KEPLER` uses init_mode_kepler) - - `POSITION_VELOCITY_I` : Initialize with position and velocity in the inertial frame - - `ORBITAL_ELEMENTS` : Initialize with orbital elements +### 3. How to use +- Select `propagate_mode = KEPLER` in the spacecraft's ini file. +- Select `initialize_mode` as you want. + - `DEFAULT` : Use default initialize method (`RK4` and `ENCKE` use position and velocity, `KEPLER` uses init_mode_kepler) + - `POSITION_VELOCITY_I` : Initialize with position and velocity in the inertial frame + - `ORBITAL_ELEMENTS` : Initialize with orbital elements ## 2. Explanation of Algorithm -1. `KeplerOrbit::CalcConstKeplerMotion` function - 1. Overview - - This function calculates the following constant values. - - Mean motion - - Frame conversion matrix from in-plane position to the inertial frame position +### 1. `KeplerOrbit::CalcConstKeplerMotion` function +#### 1. Overview +- This function calculates the following constant values. + - Mean motion + - Frame conversion matrix from in-plane position to the inertial frame position - 2. Inputs and outputs - - Input - - Orbital Elements - - $\mu$ : The standard gravitational parameter of the central body - - Output - - $n$ : Mean motion - - $R_{p2i}$ : Frame conversion matrix from in-plane position to the inertial frame position +#### 2. Inputs and outputs +- Input + - Orbital Elements + - $\mu$ : The standard gravitational parameter of the central body +- Output + - $n$ : Mean motion + - $R_{p2i}$ : Frame conversion matrix from in-plane position to the inertial frame position - 3. Algorithm - - Mean motion - ```math - n = \sqrt{\frac{\mu}{a^3}} - ``` - - Frame conversion matrix from in-plane position to ECI position - ```math - R_{p2i} = R_z(-\Omega)R_x(-i)R_z(-\omega) - ``` - ```math - R_x(\theta) = \begin{pmatrix} - 1 & 0 & 0 \\ - 0 & \cos{\theta} & \sin{\theta} \\ - 0 & -\sin{\theta} & \cos{\theta} - \end{pmatrix} - ``` - ```math - R_z(\theta) = \begin{pmatrix} - \cos{\theta} & \sin{\theta} & 0 \\ - -\sin{\theta} & \cos{\theta} & 0 \\ - 0 & 0 & 1 - \end{pmatrix} - ``` +#### 3. Algorithm +- Mean motion +```math +n = \sqrt{\frac{\mu}{a^3}} +``` +- Frame conversion matrix from in-plane position to ECI position +```math +R_{p2i} = R_z(-\Omega)R_x(-i)R_z(-\omega) +``` +```math +R_x(\theta) = \begin{pmatrix} + 1 & 0 & 0 \\ + 0 & \cos{\theta} & \sin{\theta} \\ + 0 & -\sin{\theta} & \cos{\theta} + \end{pmatrix} +``` +```math +R_z(\theta) = \begin{pmatrix} + \cos{\theta} & \sin{\theta} & 0 \\ + -\sin{\theta} & \cos{\theta} & 0 \\ + 0 & 0 & 1 + \end{pmatrix} +``` -2. `KeplerOrbit::CalcOrbit` function - 1. Overview - - This function calculates the position and velocity of the spacecraft in the inertial frame at the designated time. +### 2. `KeplerOrbit::CalcOrbit` function +#### 1. Overview +- This function calculates the position and velocity of the spacecraft in the inertial frame at the designated time. - 2. Inputs and outputs - - Input - - $t$ : Time in Julian day - - Orbital Elements - - Constants - - Output - - $\boldsymbol{r}_{i}$ : Position in the inertial frame - - $\boldsymbol{v}_{i}$ : Velocity in the inertial frame +#### 2. Inputs and outputs +- Input + - $t$ : Time in Julian day + - Orbital Elements + - Constants +- Output + - $\boldsymbol{r}_{i}$ : Position in the inertial frame + - $\boldsymbol{v}_{i}$ : Velocity in the inertial frame - 3. Algorithm - - Calculate mean anomaly $l$[rad] - ```math - l = n * (t-t_{epoch}) - ``` - - Calculate eccentric anomaly $u$[rad] by solving the Kepler Equation - - Details are described in `KeplerOrbit::SolveKeplerFirstOrder` - - Calculate two dimensional position $x^{\*}$, $y^{\*}$ and velocity $\dot{x}^{\*}$, $\dot{y}^{\*}$ in the orbital plane - ```math - \begin{align} - x^* &= a(\cos{u}-e)\\ - y^* &= a\sqrt{1-e^2}\sin{u}\\ - \dot{x}^* &= -an\frac{\sin{u}}{1^e\cos{u}}\\ - \dot{y}^* &= an\sqrt{1-e^2}\frac{\cos{u}}{1^e\cos{u}}\\ - \end{align} - ``` - - Convert to the inertial frame - ```math - \begin{align} - \boldsymbol{r}_{i} &= R_{p2i}\begin{bmatrix} x^* \\ - y^* \\ - 0 - \end{bmatrix}\\ - \boldsymbol{v}_{i} &= R_{p2i}\begin{bmatrix} \dot{x}^* \\ - \dot{y}^* \\ - 0 - \end{bmatrix}\\ - \end{align} - ``` +#### 3. Algorithm +- Calculate mean anomaly $l$[rad] +```math +l = n * (t-t_{epoch}) +``` +- Calculate eccentric anomaly $u$[rad] by solving the Kepler Equation + - Details are described in `KeplerOrbit::SolveKeplerFirstOrder` +- Calculate two dimensional position $x^{\*}$, $y^{\*}$ and velocity $\dot{x}^{\*}$, $\dot{y}^{\*}$ in the orbital plane +```math +\begin{align} + x^* &= a(\cos{u}-e)\\ + y^* &= a\sqrt{1-e^2}\sin{u}\\ + \dot{x}^* &= -an\frac{\sin{u}}{1^e\cos{u}}\\ + \dot{y}^* &= an\sqrt{1-e^2}\frac{\cos{u}}{1^e\cos{u}}\\ +\end{align} +``` +- Convert to the inertial frame +```math +\begin{align} + \boldsymbol{r}_{i} &= R_{p2i}\begin{bmatrix} x^* \\ + y^* \\ + 0 + \end{bmatrix}\\ + \boldsymbol{v}_{i} &= R_{p2i}\begin{bmatrix} \dot{x}^* \\ + \dot{y}^* \\ + 0 + \end{bmatrix}\\ +\end{align} +``` -3. `KeplerOrbit::SolveKeplerFirstOrder` function - 1. Overview - - This function solves the Kepler Equation with the first-order iterative method. - - Note: This method is not suited to the high eccentricity orbit. It is better to use the Newton-Raphson method for such a case. - - From `v6.0.0` we have `SolveKeplerNewtonMethod` and use it. The detail of the method will be write. +### 3. `KeplerOrbit::SolveKeplerFirstOrder` function +#### 1. Overview +- This function solves the Kepler Equation with the first-order iterative method. +- Note: This method is not suited to the high eccentricity orbit. It is better to use the Newton-Raphson method for such a case. + - From `v6.0.0` we have `SolveKeplerNewtonMethod` and use it. The detail of the method will be write. - 2. Inputs and outputs - - Input - - $e$ : eccentricity - - $l$ : mean anomaly [rad] - - $\epsilon$ : threshold for convergence [rad] - - Limit of iteration - - Output - - $u$ : eccentric anomaly [rad] +#### 2. Inputs and outputs +- Input + - $e$ : eccentricity + - $l$ : mean anomaly [rad] + - $\epsilon$ : threshold for convergence [rad] + - Limit of iteration +- Output + - $u$ : eccentric anomaly [rad] - 3. Algorithm - - Set the initial value of eccentric anomaly as follows - - $u_0=l$ - - Calculate $u_{n+1}$ with the following equation - ```math - u_{n+1} = l + e\sin{u_n} - ``` - - Iterate the calculation until the following conditions are satisfied - - $|u_{n+1} - u_{n}| < \epsilon$ - - The iteration number over the limit of iteration +#### 3. Algorithm +- Set the initial value of eccentric anomaly as follows + - $u_0=l$ +- Calculate $u_{n+1}$ with the following equation +```math +u_{n+1} = l + e\sin{u_n} +``` +- Iterate the calculation until the following conditions are satisfied + - $|u_{n+1} - u_{n}| < \epsilon$ + - The iteration number over the limit of iteration -4. `OrbitalElements::CalcOeFromPosVel` function - 1. Overview - - This function calculates the orbital elements from the initial position and velocity in the inertial frame. +### 4. `OrbitalElements::CalcOeFromPosVel` function +#### 1. Overview +- This function calculates the orbital elements from the initial position and velocity in the inertial frame. - 2. Inputs and outputs - - Input - - $\mu$ : The standard gravitational parameter of the central body - - $t$ : Time in Julian day - - $\boldsymbol{r}_{i}$ : Initial position in the inertial frame - - $\boldsymbol{v}_{i}$ : Initial velocity in the inertial frame - - Output - - orbital element +#### 2. Inputs and outputs +- Input + - $\mu$ : The standard gravitational parameter of the central body + - $t$ : Time in Julian day + - $\boldsymbol{r}_{i}$ : Initial position in the inertial frame + - $\boldsymbol{v}_{i}$ : Initial velocity in the inertial frame +- Output + - orbital element - 3. Algorithm - - $\boldsymbol{h}_{i}$ : Angular momentum vector of the orbit - ```math - \boldsymbol{h}_{i} = \boldsymbol{r}_{i} \times \boldsymbol{v}_{i} - ``` - - $a$ : Semi-major axis - ```math - a = \frac{\mu}{2\frac{\mu}{r} - v^2} - ``` - - $i$ : Inclination - ```math - i = \cos^{-1}{h_z} - ``` - - $\Omega$ : Right Ascension of the Ascending Node (RAAN) - - Note: This equation is not support $i = 0$ case. - ```math - \Omega = \sin^{-1}\left(\frac{h_x}{\sqrt{h_x^2 + h_y^2}}\right) - ``` - - $x_{p}, y_{p}$ : Position in the orbital plane - ```math - \begin{align} - x_{p} &= r_{ix} \cos{\Omega} + r_{iy} \sin{\Omega};\\ - y_{p} &= (-r_{ix} \sin{\Omega} + r_{iy} \cos{\Omega})\cos{i} + r_{iz}\sin{i} - \end{align} - ``` - - $\dot{x}_{p}, \dot{y}_{p}$ : Velocity in the orbital plane - ```math - \begin{align} - \dot{x}_{p} &= v_{ix} \cos{\Omega} + v_{iy} \sin{\Omega};\\ - \dot{y}_{p} &= (-v_{ix} \sin{\Omega} + v_{iy} \cos{\Omega})\cos{i} + v_{iz}\sin{i} - \end{align} - ``` - - $e$ : Eccentricity - ```math - \begin{align} - c_1 &= \frac{h}{\mu}\dot{y}_p - \frac{x_p}{r}\\ - c_2 &= -\frac{h}{\mu}\dot{x}_p - \frac{y_p}{r}\\ - e &= \sqrt{c_1^2 + c_2^2} - \end{align} - ``` - - $\omega$ : Argument of Perigee - ```math - \omega = \tan^{-1}\left(\frac{c_2}{c_1}\right) - ``` - - $t_{epoch}$ : Epoch [Julian day] - ```math - \begin{align} - f &= \tan^{-1}\left(\frac{y_p}{x_p}\right) - \omega\\ - u &= \tan^{-1}\frac{\frac{r \sin{f}}{\sqrt{1-e^2}}}{r\cos{f} + ae}\\ - \end{align} - ``` - ```math - \begin{align} - n &= \sqrt{\frac{\mu}{a^3}}\\ - dt &= \frac{u - e\sin{u}}{n}\\ - t_{epoch} &= t - \frac{dt}{24*60*60} - \end{align} - ``` +#### 3. Algorithm +- $\boldsymbol{h}_{i}$ : Angular momentum vector of the orbit +```math +\boldsymbol{h}_{i} = \boldsymbol{r}_{i} \times \boldsymbol{v}_{i} +``` +- $a$ : Semi-major axis +```math +a = \frac{\mu}{2\frac{\mu}{r} - v^2} +``` +- $i$ : Inclination +```math +i = \cos^{-1}{h_z} +``` +- $\Omega$ : Right Ascension of the Ascending Node (RAAN) + - Note: This equation is not support $i = 0$ case. +```math +\Omega = \sin^{-1}\left(\frac{h_x}{\sqrt{h_x^2 + h_y^2}}\right) +``` +- $x_{p}, y_{p}$ : Position in the orbital plane +```math +\begin{align} + x_{p} &= r_{ix} \cos{\Omega} + r_{iy} \sin{\Omega};\\ + y_{p} &= (-r_{ix} \sin{\Omega} + r_{iy} \cos{\Omega})\cos{i} + r_{iz}\sin{i} +\end{align} +``` +- $\dot{x}_{p}, \dot{y}_{p}$ : Velocity in the orbital plane +```math +\begin{align} + \dot{x}_{p} &= v_{ix} \cos{\Omega} + v_{iy} \sin{\Omega};\\ + \dot{y}_{p} &= (-v_{ix} \sin{\Omega} + v_{iy} \cos{\Omega})\cos{i} + v_{iz}\sin{i} +\end{align} +``` +- $e$ : Eccentricity +```math +\begin{align} + c_1 &= \frac{h}{\mu}\dot{y}_p - \frac{x_p}{r}\\ + c_2 &= -\frac{h}{\mu}\dot{x}_p - \frac{y_p}{r}\\ + e &= \sqrt{c_1^2 + c_2^2} +\end{align} +``` +- $\omega$ : Argument of Perigee +```math +\omega = \tan^{-1}\left(\frac{c_2}{c_1}\right) +``` +- $t_{epoch}$ : Epoch [Julian day] +```math +\begin{align} + f &= \tan^{-1}\left(\frac{y_p}{x_p}\right) - \omega\\ + u &= \tan^{-1}\frac{\frac{r \sin{f}}{\sqrt{1-e^2}}}{r\cos{f} + ae}\\ +\end{align} +``` +```math +\begin{align} + n &= \sqrt{\frac{\mu}{a^3}}\\ + dt &= \frac{u - e\sin{u}}{n}\\ + t_{epoch} &= t - \frac{dt}{24*60*60} +\end{align} +``` ## 3. Results of verifications -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 (`ORBITAL_ELEMENTS` and `POSITION_VELOCITY_I`). - - 2. Conditions for the verification - - sample_simulation_base.ini - - The following values are modified from the default. - ``` - EndTimeSec = 10000 - LogOutPutIntervalSec = 5 - ``` - - SampleDisturbance.ini - - All disturbances are disabled. - - SampleSat.ini - - The following values are modified from the default. - - `propagate_mode` is changed for each mode. - - Orbital elements for Kepler - ``` - semi_major_axis_m = 6794500.0 - eccentricity = 0.0015 - inclination_rad = 0.9012 - raan_rad = 0.1411 - arg_perigee_rad = 1.7952 - epoch_jday = 2.458940966402607e6 - ``` - - 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 - ``` +### 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 (`ORBITAL_ELEMENTS` and `POSITION_VELOCITY_I`). + +#### 2. Conditions for the verification +- sample_simulation_base.ini + - The following values are modified from the default. + ``` + EndTimeSec = 10000 + LogOutPutIntervalSec = 5 + ``` +- SampleDisturbance.ini + - All disturbances are disabled. +- SampleSat.ini + - The following values are modified from the default. + - `propagate_mode` is changed for each mode. + - Orbital elements for Kepler + ``` + semi_major_axis_m = 6794500.0 + eccentricity = 0.0015 + inclination_rad = 0.9012 + raan_rad = 0.1411 + arg_perigee_rad = 1.7952 + epoch_jday = 2.458940966402607e6 + ``` + - 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 + ``` - 3. Results - - The following figure shows the orbit calculation result of Kepler mode with `ORBITAL_ELEMENTS` initialize mode. - - The result looks correct. -
- -
+#### 3. Results +- 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 `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 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 `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. -
- -
+- 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. +
+ +
## 4. References - Hiroshi Kinoshita, "Celestial mechanisms and orbital dynamics", ch.2, 1998 (written in Japanese) diff --git a/Specifications/Dynamics/Spec_Orbit.md b/Specifications/Dynamics/Spec_Orbit.md index c914294a..92bb3dac 100644 --- a/Specifications/Dynamics/Spec_Orbit.md +++ b/Specifications/Dynamics/Spec_Orbit.md @@ -2,51 +2,50 @@ ## 1. Overview -1. functions - - The `Orbit` class calculates the position and velocity of satellites with the following propagation mode. - - `KEPLER` : Kepler orbit propagation without disturbances and thruster maneuver - - `SGP4` : SGP4 propagation using TLE without thruster maneuver - - `RK4` : RK4 propagation with disturbances and thruster maneuver - - `ENCKE` : Encke's orbit propagation with disturbances and thruster maneuver - - `RELATIVE` : Relative dynamics (for formation flying simulation) - - The `KEPLER` mode is the simplest and general for all users. - - The `SGP4` mode is useful for LEO satellites users without orbit control. - - When users need to analyze the orbit disturbance force effect or the orbit control algorithm, the users should choose `RK4` or `ENCKE` mode. - - For multiple satellite operation, `RELATIVE` mode is useful.` - -2. files - - `src/dynamics/orbit/orbit.hpp, cpp` - - Definition of `Orbit` base class - - `src/dynamics/orbit/initialize_orbit.hpp, .cpp` - - Make an instance of orbit class. - -3. How to use - - Make an instance of the orbit class in `Initialize` function in `dynamics.cpp` - - Select `propagate_mode` in the spacecraft's ini file(eg. `sample_spacecraft.ini`). - - Select `initialize_mode` in the spacecraft's ini file(eg. `sample_spacecraft.ini`). - - 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 at `[CELESTIAL_INFORMATION]` section in `sample_simulation_base.ini`. +### 1. functions +- The `Orbit` class calculates the position and velocity of satellites with the following propagation mode. + - `KEPLER` : Kepler orbit propagation without disturbances and thruster maneuver + - `SGP4` : SGP4 propagation using TLE without thruster maneuver + - `RK4` : RK4 propagation with disturbances and thruster maneuver + - `ENCKE` : Encke's orbit propagation with disturbances and thruster maneuver + - `RELATIVE` : Relative dynamics (for formation flying simulation) +- The `KEPLER` mode is the simplest and general for all users. +- The `SGP4` mode is useful for LEO satellites users without orbit control. +- When users need to analyze the orbit disturbance force effect or the orbit control algorithm, the users should choose `RK4` or `ENCKE` mode. +- For multiple satellite operation, `RELATIVE` mode is useful.` + +### 2. files +- `src/dynamics/orbit/orbit.hpp, cpp` + - Definition of `Orbit` base class +- `src/dynamics/orbit/initialize_orbit.hpp, .cpp` + - Make an instance of orbit class. + +### 3. How to use +- Make an instance of the orbit class in `Initialize` function in `dynamics.cpp` +- Select `propagate_mode` in the spacecraft's ini file(eg. `sample_spacecraft.ini`). +- Select `initialize_mode` in the spacecraft's ini file(eg. `sample_spacecraft.ini`). + - 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 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. -1. `UpdateByAttitude` function - The `UpdateByAttitude` function simply converts the velocity vector of the spacecraft (in ECI coordinate system) to body coordinate system notation using the argument: `quaternion_i2b`. +### 1. `UpdateByAttitude` function +- The `UpdateByAttitude` function simply converts the velocity vector of the spacecraft (in ECI coordinate system) to body coordinate system notation using the argument: `quaternion_i2b`. -2. `SetAcceleration_i_m_s2`, `AddAcceleration_i_m_s2`, `AddForce_i_N`, `AddForce_b_N` function - These functions provides the interface to include orbital disturbance or control forces. +### 2. `SetAcceleration_i_m_s2`, `AddAcceleration_i_m_s2`, `AddForce_i_N`, `AddForce_b_N` function +- These functions provides the interface to include orbital disturbance or control forces. -2. `TransformEcefToGeodetic` function - The `TransformEcefToGeodetic` function calculates latitude[rad], longitude[rad], and altitude[m]. Currently, we use the `Geodetic` class to calculate the information. +### 2. `TransformEcefToGeodetic` function +- The `TransformEcefToGeodetic` function calculates latitude[rad], longitude[rad], and altitude[m]. Currently, we use the `Geodetic` class to calculate the information. -3. `TransformEciToEcef` function - The `TransformEciToEcef` function can convert the position and the velocity of the satellite from the ECI frame to the ECEF frame, which considers the earth's rotation. +### 3. `TransformEciToEcef` function +- The `TransformEciToEcef` function can convert the position and the velocity of the satellite from the ECI frame to the ECEF frame, which considers the earth's rotation. ## 3. Results of verifications - The verification results are described in the document of each propagation method. ## 4. References NA - diff --git a/Specifications/Dynamics/Spec_RelativeOrbit.md b/Specifications/Dynamics/Spec_RelativeOrbit.md index 3c994f91..a6d40372 100644 --- a/Specifications/Dynamics/Spec_RelativeOrbit.md +++ b/Specifications/Dynamics/Spec_RelativeOrbit.md @@ -2,284 +2,283 @@ ## 1. Overview -1. functions - - - The `RelativeOrbit` class calculates the position of a satellite with respect to a reference satellite. This class calculates the position both in the LVLH frame and inertial frame. Users can choose the update method between: - + relative dynamics propagation using RK4 - + update using STM(State Transition Matrix) - -2. Related files - - `src/dynamics/orbit/orbit.hpp, cpp` - - Definition of `Orbit` base class - - `src/dynamics/orbit/initialize_orbit.hpp, .cpp` - - Make an instance of orbit class. - - `src/dynamics/orbit/relative_orbit.hpp, .cpp` - + Definition of the class - - Libraries - - `src/library/orbit/relative_orbit_models.hpp, .cpp` - + Library to store equations for various relative dynamics - - -3. How to use +### 1. functions + +- The `RelativeOrbit` class calculates the position of a satellite with respect to a reference satellite. This class calculates the position both in the LVLH frame and inertial frame. Users can choose the update method between: + + relative dynamics propagation using RK4 + + update using STM(State Transition Matrix) + +### 2. Related files +- `src/dynamics/orbit/orbit.hpp, cpp` + - Definition of `Orbit` base class +- `src/dynamics/orbit/initialize_orbit.hpp, .cpp` + - Make an instance of orbit class. +- `src/dynamics/orbit/relative_orbit.hpp, .cpp` + + Definition of the class +- Libraries + - `src/library/orbit/relative_orbit_models.hpp, .cpp` + + Library to store equations for various relative dynamics + +### 3. How to use - - Relative orbit propagation is available only when multiple satellites are simulated. - + The sample case in S2E_CORE simulates a single satellite. For an example of simulating multiple satellites, please refer to the [tutorial](../../Tutorials/HowToSimulateMultipleSatellites.md). - - Confirm the instance of `RelativeInformation` is the member of each satellite. - - Set up the configuration of the `[ORBIT]` section in the `sample_spacecraft.ini`. - + Set `propagate_mode = RELATIVE` to use the relative orbit propagation - + Choose `relative_orbit_update_method`. - * `relative_orbit_update_method = 0` means the orbit is updated with the propagation of the relative dynamics equation( $\dot{\boldsymbol{x}}=\boldsymbol{Ax}+\boldsymbol{Bu}$ , i.e., Hill equation). - * `relative_orbit_update_method = 1` means the orbit is updated with the STM( $\boldsymbol{x}(t)=\boldsymbol{\Phi}(t,t_0)\boldsymbol{x}(t_0)$ , i.e., Clohessy-Wiltshire solution). - + When you choose `relative_orbit_update_method = 0`, set `relative_dynamics_model_type`. - + When you choose `relative_orbit_update_method = 1`, set `stm_model_type`. - + Set the initial relative position of the satellite in the LVLH frame. LVLH frame definition is: - * $\boldsymbol{x}$ is a direction vector from the reference satellite ("chief" in the figure) radially outward. - * The direction of $\boldsymbol{z}$ corresponds to the angular momentum vector of the reference satellite orbit. - * The direction of $\boldsymbol{y}$ is determined by $\boldsymbol{z}\times\boldsymbol{x}$. -
-
- -
Definition of LVLH frame [1]
-
-
- - + Set the ID and ini file name of the reference satellite. - * NOTE: Confirm the `propagate_mode` of the reference satellite is not 2. The orbit of the reference satellite must be propagated by the methods other than the relative orbit propagation. - -4. How to add a new relative dynamics model - - 1. New Relative Dynamics equation - - + Add the name of the dynamics model to the `RelativeOrbitModel` enum in `relative_orbit_models.hpp`. - + Add the function to calculate the system matrix like `CalcHillSystemMatrix` in `relative_orbit_models.hpp`. - + Edit the `CalculateSystemMatrix` function in `relative_orbit.hpp`. - - 2. New STM - - + 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`. +- Relative orbit propagation is available only when multiple satellites are simulated. + + The sample case in S2E_CORE simulates a single satellite. For an example of simulating multiple satellites, please refer to the [tutorial](../../Tutorials/HowToSimulateMultipleSatellites.md). +- Confirm the instance of `RelativeInformation` is the member of each satellite. +- Set up the configuration of the `[ORBIT]` section in the `sample_spacecraft.ini`. + + Set `propagate_mode = RELATIVE` to use the relative orbit propagation + + Choose `relative_orbit_update_method`. + * `relative_orbit_update_method = 0` means the orbit is updated with the propagation of the relative dynamics equation( $\dot{\boldsymbol{x}}=\boldsymbol{Ax}+\boldsymbol{Bu}$ , i.e., Hill equation). + * `relative_orbit_update_method = 1` means the orbit is updated with the STM( $\boldsymbol{x}(t)=\boldsymbol{\Phi}(t,t_0)\boldsymbol{x}(t_0)$ , i.e., Clohessy-Wiltshire solution). + + When you choose `relative_orbit_update_method = 0`, set `relative_dynamics_model_type`. + + When you choose `relative_orbit_update_method = 1`, set `stm_model_type`. + + Set the initial relative position of the satellite in the LVLH frame. LVLH frame definition is: + * $\boldsymbol{x}$ is a direction vector from the reference satellite ("chief" in the figure) radially outward. + * The direction of $\boldsymbol{z}$ corresponds to the angular momentum vector of the reference satellite orbit. + * The direction of $\boldsymbol{y}$ is determined by $\boldsymbol{z}\times\boldsymbol{x}$. +
+
+ +
Definition of LVLH frame [1]
+
+
+ + + Set the ID and ini file name of the reference satellite. + * NOTE: Confirm the `propagate_mode` of the reference satellite is not 2. The orbit of the reference satellite must be propagated by the methods other than the relative orbit propagation. + +### 4. How to add a new relative dynamics model + +1. New Relative Dynamics equation + + + Add the name of the dynamics model to the `RelativeOrbitModel` enum in `relative_orbit_models.hpp`. + + Add the function to calculate the system matrix like `CalcHillSystemMatrix` in `relative_orbit_models.hpp`. + + Edit the `CalculateSystemMatrix` function in `relative_orbit.hpp`. + +2. New STM + + + 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`. ## 2. Explanation of Algorithm -1. `InitializeState` - - 1. overview - + The `InitializeState` function initializes the orbit of the satellite. - - 2. inputs and outputs - + input - * `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$ - * `initial_time_s` - - Initial simulation time (default value is 0) - + output - * none - - 3. algorithm - - 4. note - -1. `CalculateSystemMatrix` - - 1. overview - + The `CalculateSystemMatrix` function is used only inside the `RelativeOrbit` class. This function calls the system matrix calculation function according to `relative_dynamics_model_type`. - - 2. inputs and outputs - + input - * `relative_dynamics_model_type` - - The type of relative dynamics model - * `reference_sat_orbit` - - The orbit of the reference satellite - * `gravity_constant_m3_s2` - - The gravity constant $\mu$ - + output - * none - - 3. algorithm - - 4. note - -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`. - - 2. inputs and outputs - + input - * `stm_model_type` - - The type of relative dynamics model - * `reference_sat_orbit` - - The orbit of the reference satellite - * `gravity_constant_m3_s2` - - The gravity constant $\mu$ - * `elapsed_sec` - - Elapsed simulation time - + output - * none - - 3. algorithm - - 4. note - -1. `CalculateHillSystemMatrix` - - 1. overview - + The `CalculateHillSystemMatrix` function calculates the system matrix of the Hill equation. - + 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$ - * `gravity_constant_m3_s2` - - The gravity constant $\mu$ - + output - * `system_matrix` - - system matrix - - 3. algorithm - + The mean motion of the reference orbit ($n$) is calculated as follows: - - ```math - n=\sqrt{\frac{\mu}{R^3}} - ``` - - + Then, the system matrix ($\boldsymbol{A}$) is calculated as follows: - - ```math - \boldsymbol{A}= - \begin{pmatrix} - 0 & 0 & 0 & 1 & 0 & 0 \\ - 0 & 0 & 0 & 0 & 1 & 0 \\ - 0 & 0 & 0 & 0 & 0 & 1 \\ - 3n^2 & 0 & 0 & 0 & 2n & 0 \\ - 0 & 0 & 0 & -2n & 0 & 0 \\ - 0 & 0 & -n^2 & 0 & 0 & 0 \\ - \end{pmatrix} - ``` - - 4. note - -1. `CalculateHcwStm` - - 1. overview - + 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$ - * `gravity_constant_m3_s2` - - The gravity constant $\mu$ - * `elapsed_sec` - - Elapsed simulation time - + output - * `system_matrix` - - system matrix - - 3. algorithm - + The mean motion of the reference orbit ($n$) is calculated as follows: - - ```math - n=\sqrt{\frac{\mu}{R^3}} - ``` - - + Then, the system matrix ($\boldsymbol{A}$) is calculated as follows: - - ```math - \boldsymbol{\Phi}(t,t0)= - \begin{pmatrix} - 4-3\cos(nt) & 0 & 0 & \frac{\sin(nt)}{n} & \frac{2}{n}-\frac{2\cos(nt)}{n} & 0 \\ - -6nt+6\sin(nt) & 1 & 0 & -\frac{2}{n}+\frac{2\cos(nt)}{n} & \frac{4\sin(nt)}{n}-3t & 0 \\ - 0 & 0 & \cos(nt) & 0 & 0 & \frac{\sin(nt)}{n} \\ - 3n\sin(nt) & 0 & 0 & cos(nt) & 2\sin(nt) & 0 \\ - -6n+6n\cos(nt) & 0 & 0 & -2\sin(nt) & -3+4\cos(nt) & 0 \\ - 0 & 0 & -n\sin(nt) & 0 & 0 & \cos(nt) \\ - \end{pmatrix} - ``` - - 4. note +### 1. `InitializeState` + +#### 1. overview ++ The `InitializeState` function initializes the orbit of the satellite. + +#### 2. inputs and outputs ++ input + * `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$ + * `initial_time_s` + - Initial simulation time (default value is 0) ++ output + * none + +#### 3. algorithm + +#### 4. note + +### 2. `CalculateSystemMatrix` + +#### 1. overview ++ The `CalculateSystemMatrix` function is used only inside the `RelativeOrbit` class. This function calls the system matrix calculation function according to `relative_dynamics_model_type`. + +#### 2. inputs and outputs ++ input + * `relative_dynamics_model_type` + - The type of relative dynamics model + * `reference_sat_orbit` + - The orbit of the reference satellite + * `gravity_constant_m3_s2` + - The gravity constant $\mu$ ++ output + * none + +#### 3. algorithm + +#### 4. note + +### 3. `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`. + +#### 2. inputs and outputs ++ input + * `stm_model_type` + - The type of relative dynamics model + * `reference_sat_orbit` + - The orbit of the reference satellite + * `gravity_constant_m3_s2` + - The gravity constant $\mu$ + * `elapsed_sec` + - Elapsed simulation time ++ output + * none + +#### 3. algorithm + +#### 4. note + +### 4. `CalculateHillSystemMatrix` + +#### 1. overview ++ The `CalculateHillSystemMatrix` function calculates the system matrix of the Hill equation. ++ 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$ + * `gravity_constant_m3_s2` + - The gravity constant $\mu$ ++ output + * `system_matrix` + - system matrix + +#### 3. algorithm ++ The mean motion of the reference orbit ($n$) is calculated as follows: + +```math +n=\sqrt{\frac{\mu}{R^3}} +``` + ++ Then, the system matrix ($\boldsymbol{A}$) is calculated as follows: + +```math +\boldsymbol{A}= +\begin{pmatrix} +0 & 0 & 0 & 1 & 0 & 0 \\ +0 & 0 & 0 & 0 & 1 & 0 \\ +0 & 0 & 0 & 0 & 0 & 1 \\ +3n^2 & 0 & 0 & 0 & 2n & 0 \\ +0 & 0 & 0 & -2n & 0 & 0 \\ +0 & 0 & -n^2 & 0 & 0 & 0 \\ +\end{pmatrix} +``` + +#### 4. note + +### 5. `CalculateHcwStm` + +#### 1. overview ++ 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$ + * `gravity_constant_m3_s2` + - The gravity constant $\mu$ + * `elapsed_sec` + - Elapsed simulation time ++ output + * `system_matrix` + - system matrix + +#### 3. algorithm ++ The mean motion of the reference orbit ($n$) is calculated as follows: + +```math +n=\sqrt{\frac{\mu}{R^3}} +``` + ++ Then, the system matrix ($\boldsymbol{A}$) is calculated as follows: + +```math +\boldsymbol{\Phi}(t,t0)= +\begin{pmatrix} +4-3\cos(nt) & 0 & 0 & \frac{\sin(nt)}{n} & \frac{2}{n}-\frac{2\cos(nt)}{n} & 0 \\ +-6nt+6\sin(nt) & 1 & 0 & -\frac{2}{n}+\frac{2\cos(nt)}{n} & \frac{4\sin(nt)}{n}-3t & 0 \\ +0 & 0 & \cos(nt) & 0 & 0 & \frac{\sin(nt)}{n} \\ +3n\sin(nt) & 0 & 0 & cos(nt) & 2\sin(nt) & 0 \\ +-6n+6n\cos(nt) & 0 & 0 & -2\sin(nt) & -3+4\cos(nt) & 0 \\ +0 & 0 & -n\sin(nt) & 0 & 0 & \cos(nt) \\ +\end{pmatrix} +``` + +#### 4. note ## 3. Results of verifications -1. Relative Orbit Propagation - 1. overview - - - Make sure the relative orbit is correctly propagated using a simple orbit - - 2. conditions for the verification - 1. input files - - Initialization files for the two satellites were prepared. - - `satellite0.ini` - - `satellite1.ini` - 2. initial values - - 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 = RK4 - - //Information used for orbital propagation by the Runge-Kutta method/////////// - //initial satellite position[m] - //*The coordinate system is defined in PlanetSelect.ini - 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 - 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 - /////////////////////////////////////////////////////////////////////////////// - ``` - - - `satellite1.ini` - - ``` - propagate_mode = RELATIVE - - //Information used for relative orbit propagation////////////////////////////// - //Relative Orbit Update Method (0 means RK4, 1 means STM) - relative_orbit_update_method = 0 - // RK4 Relative Dynamics model type (only valid for RK4 update) - // 0: Hill - relative_dynamics_model_type = 0 - // STM Relative Dynamics model type (only valid for STM update) - // 0: HCW - stm_model_type = 0 - // Initial satellite position relative to the reference satellite in LVLH frame[m] - // * The coordinate system is defined 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 satellite1 seen from satellite0 in the inertia frame was calculated. - -
- -
-
- -
- - - They correctly move periodically. - - In this example of verification, the RK4 method is used to propagate relative orbits, but the results were the same when using STM. - - +#### 1. Relative Orbit Propagation +##### 1. overview + +- Make sure the relative orbit is correctly propagated using a simple orbit + +##### 2. conditions for the verification +- input files + - Initialization files for the two satellites were prepared. + - `satellite0.ini` + - `satellite1.ini` +- initial values + - 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 = RK4 + + //Information used for orbital propagation by the Runge-Kutta method/////////// + //initial satellite position[m] + //*The coordinate system is defined in PlanetSelect.ini + 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 + 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 + /////////////////////////////////////////////////////////////////////////////// + ``` + + - `satellite1.ini` + + ``` + propagate_mode = RELATIVE + + //Information used for relative orbit propagation////////////////////////////// + //Relative Orbit Update Method (0 means RK4, 1 means STM) + relative_orbit_update_method = 0 + // RK4 Relative Dynamics model type (only valid for RK4 update) + // 0: Hill + relative_dynamics_model_type = 0 + // STM Relative Dynamics model type (only valid for STM update) + // 0: HCW + stm_model_type = 0 + // Initial satellite position relative to the reference satellite in LVLH frame[m] + // * The coordinate system is defined 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 satellite1 seen from satellite0 in the inertia frame was calculated. + +
+ +
+
+ +
+ +- They correctly move periodically. +- In this example of verification, the RK4 method is used to propagate relative orbits, but the results were the same when using STM. + + ## 4. References diff --git a/Specifications/Dynamics/Spec_Rk4Attitude.md b/Specifications/Dynamics/Spec_Rk4Attitude.md index eb0cfb50..818b71fe 100644 --- a/Specifications/Dynamics/Spec_Rk4Attitude.md +++ b/Specifications/Dynamics/Spec_Rk4Attitude.md @@ -2,234 +2,233 @@ ## 1. Overview -1. functions - - This class has the function to propagate the attitude motion equation that forms the basis of the attitude simulator. - - Use the 4th Runge-Kutta equation for the propagation or set the attitude as determined values. - - This class also calculates the angular momentum. - -2. files - - `src/dynamics/attitude/attitude.hpp, .cpp` - - Definition of `Attitude` base class - - `src/dynamics/attitude/attitude_rk4.hpp, .cpp` - - Normal free motion dynamics propagator `AttitudeRk4` class is defined here. - - `src/dynamics/attitude/initialize_attitude.hpp, .cpp` - - Make an instance of `Attitude` class. - - `sample_satellite.ini` : Initialization file - -3. how to use - - Set the parameters in `sample_satellite.ini` or user defined satellite initialize file - - If you want to use RK4 as attitude dynamics, please set `propagate_mode = RK4` at the `[ATTITUDE]` section in the `sample_satellite.ini` file. - - Select `initialize_mode` at the `[ATTITUDE]` section in the `sample_satellite.ini` file. - - `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. - - Create an instance by using initialization function `InitAttitude` - - Execute attitude propagation by `Propagate` function - - Use `Get*` function to get attitude information. - +### 1. functions +- This class has the function to propagate the attitude motion equation that forms the basis of the attitude simulator. +- Use the 4th Runge-Kutta equation for the propagation or set the attitude as determined values. +- This class also calculates the angular momentum. + +### 2. files +- `src/dynamics/attitude/attitude.hpp, .cpp` + - Definition of `Attitude` base class +- `src/dynamics/attitude/attitude_rk4.hpp, .cpp` + - Normal free motion dynamics propagator `AttitudeRk4` class is defined here. +- `src/dynamics/attitude/initialize_attitude.hpp, .cpp` + - Make an instance of `Attitude` class. +- `sample_satellite.ini` : Initialization file + +### 3. how to use +- Set the parameters in `sample_satellite.ini` or user defined satellite initialize file + - If you want to use RK4 as attitude dynamics, please set `propagate_mode = RK4` at the `[ATTITUDE]` section in the `sample_satellite.ini` file. + - Select `initialize_mode` at the `[ATTITUDE]` section in the `sample_satellite.ini` file. + - `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. +- Create an instance by using initialization function `InitAttitude` +- Execute attitude propagation by `Propagate` function +- Use `Get*` function to get attitude information. ## 2. Explanation of RK4 Algorithm -1. `Propagate` function - 1. overview - - This function manages the timings of `RungeKuttaOneStep` function, which calculates the attitude dynamics and kinematics by the 4th Runge-Kutta method. - - 2. inputs and outputs - - input - - (double) `end_time_s`: Time incremented in the main function - - output - - (void) - - 3. algorithm - There are two-time steps definition related to attitude propagation. - 1. Time incremented in the main function - - This time step decides the timing to update the torque input values by disturbances and actuator outputs. - - The step is defined as the variable `propagation_step_s_` in the `simulation_time` class. - 2. Time incremented in Propagate function - - This time step is much shorter than the time step in the main function. - - This step determines the accuracy of the attitude propagation. - - The step is defined as the variable `propagation_step_s_` in the `Attitude` class. - - There is a `while loop` in the `Propagate` function, in which Runge-Kutta integration is performed. In addition, there is only one Runge-Kutta integration function outside the while loop, but this is for adjusting the time-lapse. - -2. `RungeKuttaOneStep` function - - 1. overview - Calculate the attitude propagation by 4th Runge-Kutta integration. - - 2. inputs and outputs - - input - - (double) t: Elapsed time from the time when the `Propagate` function is called. - - (double) dt: The duration for the attitude propagation - - 3. algorithm - If the differential equation (1) is given, the state quantity in $n+1$ step can be calculated as (2). - - ```math - \begin{align} - \hat{\boldsymbol{x}} &= \boldsymbol{f}(\boldsymbol{x},t)\\ - \boldsymbol{x_{n+1}} &= \boldsymbol{x_{n}} + \cfrac{\Delta t}{6}(\boldsymbol{k_1}+2\boldsymbol{k_2}+2\boldsymbol{k_3}+\boldsymbol{k_4}) - \end{align} - ``` - where $\Delta t$ is a time step, which meets the equation (3). - - ```math - t_{n+1} = t_{n} + \Delta t - ``` - - $k_i \, (i=1,2,3,4)$, which has the same number of elements, can be calculated as the equations (4). - - ```math - \begin{align} - \boldsymbol{k_{1}} &= \boldsymbol{f}(\boldsymbol{x_n},t_n) \\ - \boldsymbol{k_{2}} &= \boldsymbol{f}\left(\boldsymbol{x_n}+\frac{\Delta t}{2} \boldsymbol{k_1},t_n+\frac{\Delta t}{2} \right) \\ - \boldsymbol{k_{3}} &= \boldsymbol{f}\left(\boldsymbol{x_n}+\frac{\Delta t}{2} \boldsymbol{k_2},t_n+\frac{\Delta t}{2} \right) \\ - \boldsymbol{k_{4}} &= \boldsymbol{f}\left(\boldsymbol{x_n} + \Delta t \boldsymbol{k_3},t_n+\Delta t \right) - \end{align} - ``` - - In this attitude propagation, the quantity of state $\boldsymbol{x}$ consists of 7 elements, including `Quaternion_i2b` and angular velocity $\boldsymbol{\omega}_b$. - - ```math - \begin{align} - \boldsymbol{\omega}_b &= [{\omega}_{bx} \, {\omega}_{by} \, {\omega}_{bz}]^T \\ - \boldsymbol{q}_{i2b} &= [q_x \, q_y \, q_z \, q_w]^T \\ - \boldsymbol{x} &= [\boldsymbol{\omega}_b, \boldsymbol{q}_{i2b}]^T - \end{align} - ``` - - 4. note - The one that solves the upper differential equation is implemented in Library. - -3. `AttitudeDynamicsAndKinematics` function - - 1. overview - The equation of attitude motion is described in this function. - - 2. inputs and outputs - - input - - (Vector<7>) x: Quantity of state - - (double) t: Elapsed time from the time when the `Propagate` starts - - output - - (Vector<7>) dxdt: Differentiation of quantity of state. - - 3. algorithm - Equation of attitude motion is calculated as the equation (6), which is written in Chapter 6 of Reference 1, - - ```math - \dot{\boldsymbol{\omega}}_b = \boldsymbol{I}_b^{-1}(\boldsymbol{T}_b - \boldsymbol{\omega}_b \times \boldsymbol{h}_b) - ``` - - where $\boldsymbol{\omega}_b$[rad/s] is angular velocity in the body-fixed coordinate, $\boldsymbol{I}_b$[kgm$^2$] is inertia tensor of the satellite, $\boldsymbol{T}_b$[Nm] is torque in the body-fixed coordinate, $\boldsymbol{h}_b$[Nms] is angular momentum of the satellite in the body-fixed coordinate. - Quaternion_i2b is calculated from the kinematics equation (7). This equation is executed in ` CalcAngularVelocityMatrix` function. - - ```math - \dot{\boldsymbol{q}}_{i2b} = \cfrac{1}{2} - \begin{bmatrix} - 0 & {\omega}_{bz} & -{\omega}_{by} & {\omega}_{bx} \\ - - {\omega}_{bz} & 0 & {\omega}_{bx} & {\omega}_{by} \\ - {\omega}_{by} & -{\omega}_{bx} & 0 & {\omega}_{bz} \\ - - {\omega}_{bx} & -{\omega}_{by} & -{\omega}_{bz} & 0 - \end{bmatrix} - \boldsymbol{q}_{i2b} - ``` +### 1. `Propagate` function +#### 1. overview +- This function manages the timings of `RungeKuttaOneStep` function, which calculates the attitude dynamics and kinematics by the 4th Runge-Kutta method. + +#### 2. inputs and outputs +- input + - (double) `end_time_s`: Time incremented in the main function +- output + - (void) + +#### 3. algorithm +There are two-time steps definition related to attitude propagation. +1. Time incremented in the main function + - This time step decides the timing to update the torque input values by disturbances and actuator outputs. + - The step is defined as the variable `propagation_step_s_` in the `simulation_time` class. +2. Time incremented in Propagate function + - This time step is much shorter than the time step in the main function. + - This step determines the accuracy of the attitude propagation. + - The step is defined as the variable `propagation_step_s_` in the `Attitude` class. + +There is a `while loop` in the `Propagate` function, in which Runge-Kutta integration is performed. In addition, there is only one Runge-Kutta integration function outside the while loop, but this is for adjusting the time-lapse. + +### 2. `RungeKuttaOneStep` function + +#### 1. overview +Calculate the attitude propagation by 4th Runge-Kutta integration. + +#### 2. inputs and outputs +- input + - (double) t: Elapsed time from the time when the `Propagate` function is called. + - (double) dt: The duration for the attitude propagation + +#### 3. algorithm +If the differential equation (1) is given, the state quantity in $n+1$ step can be calculated as (2). + +```math +\begin{align} + \hat{\boldsymbol{x}} &= \boldsymbol{f}(\boldsymbol{x},t)\\ + \boldsymbol{x_{n+1}} &= \boldsymbol{x_{n}} + \cfrac{\Delta t}{6}(\boldsymbol{k_1}+2\boldsymbol{k_2}+2\boldsymbol{k_3}+\boldsymbol{k_4}) +\end{align} +``` +where $\Delta t$ is a time step, which meets the equation (3). + +```math +t_{n+1} = t_{n} + \Delta t +``` + +$k_i \, (i=1,2,3,4)$, which has the same number of elements, can be calculated as the equations (4). + +```math +\begin{align} + \boldsymbol{k_{1}} &= \boldsymbol{f}(\boldsymbol{x_n},t_n) \\ + \boldsymbol{k_{2}} &= \boldsymbol{f}\left(\boldsymbol{x_n}+\frac{\Delta t}{2} \boldsymbol{k_1},t_n+\frac{\Delta t}{2} \right) \\ + \boldsymbol{k_{3}} &= \boldsymbol{f}\left(\boldsymbol{x_n}+\frac{\Delta t}{2} \boldsymbol{k_2},t_n+\frac{\Delta t}{2} \right) \\ + \boldsymbol{k_{4}} &= \boldsymbol{f}\left(\boldsymbol{x_n} + \Delta t \boldsymbol{k_3},t_n+\Delta t \right) +\end{align} +``` + +In this attitude propagation, the quantity of state $\boldsymbol{x}$ consists of 7 elements, including `Quaternion_i2b` and angular velocity $\boldsymbol{\omega}_b$. + +```math +\begin{align} + \boldsymbol{\omega}_b &= [{\omega}_{bx} \, {\omega}_{by} \, {\omega}_{bz}]^T \\ + \boldsymbol{q}_{i2b} &= [q_x \, q_y \, q_z \, q_w]^T \\ + \boldsymbol{x} &= [\boldsymbol{\omega}_b, \boldsymbol{q}_{i2b}]^T +\end{align} +``` + +#### 4. note +The one that solves the upper differential equation is implemented in Library. + +### 3. `AttitudeDynamicsAndKinematics` function + +#### 1. overview +The equation of attitude motion is described in this function. + +2. inputs and outputs +- input + - (Vector<7>) x: Quantity of state + - (double) t: Elapsed time from the time when the `Propagate` starts +- output + - (Vector<7>) dxdt: Differentiation of quantity of state. + +3. algorithm +Equation of attitude motion is calculated as the equation (6), which is written in Chapter 6 of Reference 1, + +```math +\dot{\boldsymbol{\omega}}_b = \boldsymbol{I}_b^{-1}(\boldsymbol{T}_b - \boldsymbol{\omega}_b \times \boldsymbol{h}_b) +``` + +where $\boldsymbol{\omega}_b$[rad/s] is angular velocity in the body-fixed coordinate, $\boldsymbol{I}_b$[kgm$^2$] is inertia tensor of the satellite, $\boldsymbol{T}_b$[Nm] is torque in the body-fixed coordinate, $\boldsymbol{h}_b$[Nms] is angular momentum of the satellite in the body-fixed coordinate. +Quaternion_i2b is calculated from the kinematics equation (7). This equation is executed in ` CalcAngularVelocityMatrix` function. + +```math +\dot{\boldsymbol{q}}_{i2b} = \cfrac{1}{2} +\begin{bmatrix} + 0 & {\omega}_{bz} & -{\omega}_{by} & {\omega}_{bx} \\ + - {\omega}_{bz} & 0 & {\omega}_{bx} & {\omega}_{by} \\ + {\omega}_{by} & -{\omega}_{bx} & 0 & {\omega}_{bz} \\ + - {\omega}_{bx} & -{\omega}_{by} & -{\omega}_{bz} & 0 +\end{bmatrix} +\boldsymbol{q}_{i2b} +``` ## 3. Results of verifications -1. verification of kinematics equation - 1. overview - - Check that the integral propagation of kinematics equations is performed correctly - - 2. conditions for the verification - - attitude_integral_step_s : 0.001 - - simulation_step_s: 0.1 - - simulation_duration_s: 300 - - Inertia tensor: diag [0.17, 0.1, 0.25] - - Initial quaternion_i2b: [0,0,0,1] - - Initial torque: [0,0,0] - - Initial angular velocity: Set by each case - - Disturbance torque: All Disable - - 3. results - - Initial angular velocity = [0,0,0] - - ![](./figs/test_kinematics_0.png) - - - Initial angular velocity = [0.314, 0, 0] rad/s - - ![](./figs/test_kinematics_px.png) - - - Initial angular velocity = [0, 0.314, 0] rad/s - - ![](./figs/test_kinematics_py.png) - - - Initial angular velocity = [0, 0, 0.314] rad/s - - ![](./figs/test_kinematics_pz.png) - - - Initial angular velocity = [0, 0, -0.314] rad/s - - ![](./figs/test_kinematics_mz.png) - -2. verification of dynamics equation - 1. overview - Confirm that the integral propagation of the dynamics equation is performed correctly - - 2. conditions of the verification - - attitude_integral_step_s : 0.001 - - simulation_step_s: 0.1 - - simulation_duration_s: 300 - - Inertia tensor: diag[0.17, 0.1, 0.25] - - Initial Quaternion_i2b: [0,0,0,1] - - Initial torque: Set by each case - - Initial angular velocity: [0,0,0] - - Disturbance torque: All Disable - - 3. results - - Add constant torque: [0,0,0] Nm - - body frame - ![](./figs/test_dynamics_0_b.png) - - - inertial frame - ![](./figs/test_dynamics_0_i.png) - - - Add constant torque = [0.1,0,0] Nm - - body frame - ![](./figs/test_dynamics_px_b.png) - - - inertial frame - ![](./figs/test_dynamics_px_i.png) - - Add constant torque = [0,0.1,0] Nm - - body frame - ![](./figs/test_dynamics_py_b.png) - - - inertial frame - ![](./figs/test_dynamics_py_i.png) - - - Add constant torque = [0,0,0.1] Nm - - body frame - ![](./figs/test_dynamics_pz_b.png) - - - inertial frame - ![](./figs/test_dynamics_pz_i.png) - -3. validation of attitude dynamics propagation time step - 1. overview - Validate the time step of the attitude dynamics propagation - - 2. conditions of the verification - - attitude_integral_step_s : 0.001 / 0.01 - - simulation_step_s: 0.1 - - simulation_duration_s: 300 - - Inertia tensor: diag[0.17, 0.1, 0.25] - - Initial Quaternion_i2b: [0,0,0,1] - - Initial torque: [0,0,0] - - Initial angular velocity: [0,0,0] - - Disturbance torque: All Disable - - 3. results - - No difference between two results in attitude_integral_step_s = 0.001 / 0.01 sec. +### 1. verification of kinematics equation +#### 1. overview +- Check that the integral propagation of kinematics equations is performed correctly + +#### 2. conditions for the verification +- attitude_integral_step_s : 0.001 +- simulation_step_s: 0.1 +- simulation_duration_s: 300 +- Inertia tensor: diag [0.17, 0.1, 0.25] +- Initial quaternion_i2b: [0,0,0,1] +- Initial torque: [0,0,0] +- Initial angular velocity: Set by each case +- Disturbance torque: All Disable + +#### 3. results +- Initial angular velocity = [0,0,0] + +![](./figs/test_kinematics_0.png) + +- Initial angular velocity = [0.314, 0, 0] rad/s + +![](./figs/test_kinematics_px.png) + +- Initial angular velocity = [0, 0.314, 0] rad/s + +![](./figs/test_kinematics_py.png) + +- Initial angular velocity = [0, 0, 0.314] rad/s + +![](./figs/test_kinematics_pz.png) + +- Initial angular velocity = [0, 0, -0.314] rad/s + +![](./figs/test_kinematics_mz.png) + +### 2. verification of dynamics equation +#### 1. overview +Confirm that the integral propagation of the dynamics equation is performed correctly + +#### 2. conditions of the verification +- attitude_integral_step_s : 0.001 +- simulation_step_s: 0.1 +- simulation_duration_s: 300 +- Inertia tensor: diag[0.17, 0.1, 0.25] +- Initial Quaternion_i2b: [0,0,0,1] +- Initial torque: Set by each case +- Initial angular velocity: [0,0,0] +- Disturbance torque: All Disable + +#### 3. results +- Add constant torque: [0,0,0] Nm +- body frame +![](./figs/test_dynamics_0_b.png) + +- inertial frame +![](./figs/test_dynamics_0_i.png) + +- Add constant torque = [0.1,0,0] Nm + - body frame + ![](./figs/test_dynamics_px_b.png) + + - inertial frame + ![](./figs/test_dynamics_px_i.png) +- Add constant torque = [0,0.1,0] Nm +- body frame +![](./figs/test_dynamics_py_b.png) + +- inertial frame +![](./figs/test_dynamics_py_i.png) + +- Add constant torque = [0,0,0.1] Nm +- body frame +![](./figs/test_dynamics_pz_b.png) + +- inertial frame +![](./figs/test_dynamics_pz_i.png) + +### 3. validation of attitude dynamics propagation time step +#### 1. overview +Validate the time step of the attitude dynamics propagation + +#### 2. conditions of the verification +- attitude_integral_step_s : 0.001 / 0.01 +- simulation_step_s: 0.1 +- simulation_duration_s: 300 +- Inertia tensor: diag[0.17, 0.1, 0.25] +- Initial Quaternion_i2b: [0,0,0,1] +- Initial torque: [0,0,0] +- Initial angular velocity: [0,0,0] +- Disturbance torque: All Disable + +#### 3. results +- No difference between two results in attitude_integral_step_s = 0.001 / 0.01 sec. ## 4. References 1. 狼, 冨田, 中須賀, 松永, 宇宙ステーション入門第二版, 東京大学出版会, 2008. (Written in Japanese) diff --git a/Specifications/Dynamics/Spec_Rk4Orbit.md b/Specifications/Dynamics/Spec_Rk4Orbit.md index e9265e14..412f696a 100644 --- a/Specifications/Dynamics/Spec_Rk4Orbit.md +++ b/Specifications/Dynamics/Spec_Rk4Orbit.md @@ -2,101 +2,101 @@ ## 1. Overview -1. functions - - The `Rk4OrbitPropagation` class calculates the position and velocity of satellites with 4th Order Runge-Kutta method(RK4). - -2. files - - `src/dynamics/orbit/orbit.hpp, cpp` - - Definition of `Orbit` base class - - `src/dynamics/orbit/initialize_orbit.hpp, .cpp` - - Make an instance of orbit class. - - `src/dynamics/orbit/rk4_orbit_propagation.hpp, .cpp` - -3. How to use - - Select `propagate_mode = RK4` in the spacecraft's ini file. - - Select `initialize_mode` as you want. - - `DEFAULT` : Use default initialize method (`RK4` and `ENCKE` use position and velocity, `KEPLER` uses init_mode_kepler) - - `POSITION_VELOCITY_I` : Initialize with position and velocity in the inertial frame - - `ORBITAL_ELEMENTS` : Initialize with orbital elements +### 1. functions +- The `Rk4OrbitPropagation` class calculates the position and velocity of satellites with 4th Order Runge-Kutta method(RK4). + +### 2. files +- `src/dynamics/orbit/orbit.hpp, cpp` + - Definition of `Orbit` base class +- `src/dynamics/orbit/initialize_orbit.hpp, .cpp` + - Make an instance of orbit class. +- `src/dynamics/orbit/rk4_orbit_propagation.hpp, .cpp` + +### 3. How to use +- Select `propagate_mode = RK4` in the spacecraft's ini file. +- Select `initialize_mode` as you want. + - `DEFAULT` : Use default initialize method (`RK4` and `ENCKE` use position and velocity, `KEPLER` uses init_mode_kepler) + - `POSITION_VELOCITY_I` : Initialize with position and velocity in the inertial frame + - `ORBITAL_ELEMENTS` : Initialize with orbital elements ## 2. Explanation of Algorithm -1. `Propagate` function - - The position and velocity of the satellite are updated by using RK4. As the input of RK4, the six-state variables are set. These state variables are the three-dimensional position [$x$, $y$ ,$z$] and three-dimensional velocity [$v_x$, $v_y$, $v_z$] at the inertial coordinate. Here, the inertial coordinate is decided by the `PlanetSelect.ini` - - As the force which works to the satellite motion is the external acceleration [$a_x$,$a_y$,$a_z$] calculated from the disturbance class or thruster class and the gravity force from the center planet, which is defined in `PlanetSelect.ini`. As a summary, the orbit is calculated as the following equation. - ```math - \begin{align} - \dot{x} &= v_x\\ - \dot{y} &= v_y\\ - \dot{z} &= v_z\\ - \dot{v}_x &= a_x-\mu\frac{x}{r^3}\\ - \dot{v}_y &= a_y-\mu\frac{y}{r^3}\\ - \dot{v}_z &= a_z-\mu\frac{z}{r^3}\\ - r &= \sqrt{x^2+y^2+z^2} - \end{align} - ``` +### 1. `Propagate` function +- The position and velocity of the satellite are updated by using RK4. As the input of RK4, the six-state variables are set. These state variables are the three-dimensional position [$x$, $y$ ,$z$] and three-dimensional velocity [$v_x$, $v_y$, $v_z$] at the inertial coordinate. Here, the inertial coordinate is decided by the `PlanetSelect.ini` +- As the force which works to the satellite motion is the external acceleration [$a_x$,$a_y$,$a_z$] calculated from the disturbance class or thruster class and the gravity force from the center planet, which is defined in `PlanetSelect.ini`. As a summary, the orbit is calculated as the following equation. +```math +\begin{align} + \dot{x} &= v_x\\ + \dot{y} &= v_y\\ + \dot{z} &= v_z\\ + \dot{v}_x &= a_x-\mu\frac{x}{r^3}\\ + \dot{v}_y &= a_y-\mu\frac{y}{r^3}\\ + \dot{v}_z &= a_z-\mu\frac{z}{r^3}\\ + r &= \sqrt{x^2+y^2+z^2} +\end{align} +``` ## 3. Results of verifications -1. Verification of the error of Fourth Order Runge-Kutta method (RK4) - 1. Overview - - Verify the numerical integration error of the RK4 method. - - The output of the simulation was compared with the analytical solution. - - 2. conditions for the verification - - The Verifications were conducted in the case of `simulation_step_s` and `orbit_update_period_s` were 0.1(sec), 1(sec), and 10(sec). - - The initial values of the propagation are as follows: - ``` - initial_position_i_m(0) = 1.5944017672e7 - initial_position_i_m(1) = 0.0 - initial_position_i_m(2) = 0.0 - - initial_velocity_i_m_s(0) = 0.0 - initial_velocity_i_m_s(1) = 5000.0 - initial_velocity_i_m_s(2) = 0.0 - ``` - - This is a circular orbit, which period is about 20040(sec). The center of the orbit is Earth. - - As a reference, the analytical solution was used. The solution is as follows: - ```math - x=R\cos(\omega t),y=R\sin(\omega t)\quad when~R=1.5944017672\times10^7, \omega=0.000313597243985794 - ``` - - All of the effects of disturbance and environment were disabled. - - The simulation time is 60120(sec), which is approximately three-period. In addition, for a long-term test, the case in which simulation time is 200400(about 10 periods) was tested. The `orbit_update_period_s` of this case is 1(sec). - - 3. results -
- orbit_steptimesec_01 - orbit_steptimesec_1 - orbit_steptimesec_10 - -
- - - In the cases of `orbit_update_period_s=0.1` and `orbit_update_period_s=1`, the error is kept within $10^{-6}$ order. However, once the error grows, it will get bigger and bigger. - - In the case of `orbit_update_period_s=10`, the error quickly grows up to $10^{-4}$ order. - -
- orbit_steptimesec_1_longterm - -
- - - In the long-term test result, it is clear that the error magnitude grows proportionally to the time. - - 4. Others - - At first, the output of STK would be used for reference. However, it did not work well. Data were input as follows: -
- orbit_STKsettings - -
- - - However, the result is as follows: -
- orbit_STKresult - -
- - - As this figure shows, the initial values in the result are slightly different from the input. - + In the .sa files, the initial values of $x, y, z, v_x, v_y, v_z$ are converted into elements of orbit and stored. The error might occur in the process of this conversion. - +### 1. Verification of the error of Fourth Order Runge-Kutta method (RK4) +#### 1. Overview +- Verify the numerical integration error of the RK4 method. +- The output of the simulation was compared with the analytical solution. + +#### 2. conditions for the verification +- The Verifications were conducted in the case of `simulation_step_s` and `orbit_update_period_s` were 0.1(sec), 1(sec), and 10(sec). +- The initial values of the propagation are as follows: + ``` + initial_position_i_m(0) = 1.5944017672e7 + initial_position_i_m(1) = 0.0 + initial_position_i_m(2) = 0.0 + + initial_velocity_i_m_s(0) = 0.0 + initial_velocity_i_m_s(1) = 5000.0 + initial_velocity_i_m_s(2) = 0.0 + ``` +- This is a circular orbit, which period is about 20040(sec). The center of the orbit is Earth. +- As a reference, the analytical solution was used. The solution is as follows: +```math +x=R\cos(\omega t),y=R\sin(\omega t)\quad when~R=1.5944017672\times10^7, \omega=0.000313597243985794 +``` +- All of the effects of disturbance and environment were disabled. +- The simulation time is 60120(sec), which is approximately three-period. In addition, for a long-term test, the case in which simulation time is 200400(about 10 periods) was tested. The `orbit_update_period_s` of this case is 1(sec). + +#### 3. results +
+ orbit_steptimesec_01 + orbit_steptimesec_1 + orbit_steptimesec_10 + +
+ +- In the cases of `orbit_update_period_s=0.1` and `orbit_update_period_s=1`, the error is kept within $10^{-6}$ order. However, once the error grows, it will get bigger and bigger. +- In the case of `orbit_update_period_s=10`, the error quickly grows up to $10^{-4}$ order. + +
+ orbit_steptimesec_1_longterm + +
+ +- In the long-term test result, it is clear that the error magnitude grows proportionally to the time. + +#### 4. Others +- At first, the output of STK would be used for reference. However, it did not work well. Data were input as follows: +
+ orbit_STKsettings + +
+ +- However, the result is as follows: +
+ orbit_STKresult + +
+ +- As this figure shows, the initial values in the result are slightly different from the input. + + In the .sa files, the initial values of $x, y, z, v_x, v_y, v_z$ are converted into elements of orbit and stored. The error might occur in the process of this conversion. + ## 4. References NA diff --git a/Specifications/Dynamics/Spec_Sgp4.md b/Specifications/Dynamics/Spec_Sgp4.md index e9bb39e2..133ac4da 100644 --- a/Specifications/Dynamics/Spec_Sgp4.md +++ b/Specifications/Dynamics/Spec_Sgp4.md @@ -2,73 +2,73 @@ ## 1. Overview -1. functions - - The `Sgp4OrbitPropagation` class calculates the position and velocity of satellites by using SGP4 method with TLE. +### 1. functions +- The `Sgp4OrbitPropagation` class calculates the position and velocity of satellites by using SGP4 method with TLE. -2. files - - `src/dynamics/orbit/orbit.hpp, cpp` - - Definition of `Orbit` base class - - `src/dynamics/orbit/initialize_orbit.hpp, .cpp` - - Make an instance of orbit class. - - `src/dynamics/orbit/sgp4_orbit_propagation.hpp, .cpp` - - Library of SGP4 - - `/src/library/external/sgp4` +### 2. files +- `src/dynamics/orbit/orbit.hpp, cpp` + - Definition of `Orbit` base class +- `src/dynamics/orbit/initialize_orbit.hpp, .cpp` + - Make an instance of orbit class. +- `src/dynamics/orbit/sgp4_orbit_propagation.hpp, .cpp` + - Library of SGP4 + - `/src/library/external/sgp4` + +### 3. How to use +- Select `propagate_mode = SGP4` in the spacecraft's ini file. +- Set the TLE you need like the following example + ``` + 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 + ``` -3. How to use - - Select `propagate_mode = SGP4` in the spacecraft's ini file. - - Set the TLE you need like the following example - ``` - 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 - ``` - ## 2. Explanation of Algorithm -1. Propagate function - - The difference between the `current Julian day` and the original period in TLE in units of [minutes] (elapse_time_min) is calculated, and it is used in the argument of the sgp4 function of the SGP4 calculation execution function. At the same time, the geodetic system definition (`whichconst`) and the trajectory information structure (`satrec`) are also required, which are defined at the call of the constructor. The position [m] and velocity [m/s] of the spacecraft are assigned to the member variables sat_position_i_ and sat_velocity_i_ as the output of the sgp4 function. Note that the values, in this case are the values from the ECI coordinate system. +### 1. Propagate function + - The difference between the `current Julian day` and the original period in TLE in units of [minutes] (elapse_time_min) is calculated, and it is used in the argument of the sgp4 function of the SGP4 calculation execution function. At the same time, the geodetic system definition (`whichconst`) and the trajectory information structure (`satrec`) are also required, which are defined at the call of the constructor. The position [m] and velocity [m/s] of the spacecraft are assigned to the member variables sat_position_i_ and sat_velocity_i_ as the output of the sgp4 function. Note that the values, in this case are the values from the ECI coordinate system. ## 3. Results of verifications -1. Verification of SGP4 +### 1. Verification of SGP4 + +#### 1. Overview +- Verify whether the propagation of SGP4 is correctly installed or not. +- By comparing the propagation result of SGP4 in STK simulator and S2E - 1. Overview - - Verify whether the propagation of SGP4 is correctly installed or not. - - By comparing the propagation result of SGP4 in STK simulator and S2E - - 2. Conditions for the verification - - Conduct verification using the two different initial TLE cases with different time spans. - 1. Hodoyoshi orbit : (span:10000 second) - - TLE - ``` - 40299U 14070B 20001.00000000 -.00003285 00000-0 -13738-3 0 00007 - 40299 097.3451 081.6192 0014521 069.5674 178.3972 15.23569636286180 - ``` +#### 2. Conditions for the verification +- Conduct verification using the two different initial TLE cases with different time spans. +1. Hodoyoshi orbit : (span:10000 second) + - TLE + ``` + 40299U 14070B 20001.00000000 -.00003285 00000-0 -13738-3 0 00007 + 40299 097.3451 081.6192 0014521 069.5674 178.3972 15.23569636286180 + ``` - 2. ISS Release orbit (span:10 days) - - TLE - ``` - 99999U 20001.00000000 .00000007 00000-0 93906-7 0 00002 - 99999 053.4260 297.1689 0008542 245.4975 274.8981 15.55688139000015 - ``` +2. ISS Release orbit (span:10 days) + - TLE + ``` + 99999U 20001.00000000 .00000007 00000-0 93906-7 0 00002 + 99999 053.4260 297.1689 0008542 245.4975 274.8981 15.55688139000015 + ``` - 3. Results - 1. Hodoyoshi orbit : (span:10000 second) - - Left: STK, Right: S2E -
- orbit_steptimesec_01 - orbit_steptimesec_01 - -
- The outputs of the satellite position are almost the same between the two simulators. +#### 3. Results +1. Hodoyoshi orbit : (span:10000 second) + - Left: STK, Right: S2E +
+ orbit_steptimesec_01 + orbit_steptimesec_01 + +
+ The outputs of the satellite position are almost the same between the two simulators. - 2. ISS Release orbit : (span:10000 second) - - Left: STK, Right: S2E -
- orbit_steptimesec_01 - orbit_steptimesec_01 - -
- The outputs of the satellite position are almost the same between the two simulators. +2. ISS Release orbit : (span:10000 second) + - Left: STK, Right: S2E +
+ orbit_steptimesec_01 + orbit_steptimesec_01 + +
+ The outputs of the satellite position are almost the same between the two simulators. ## 4. References NA diff --git a/Specifications/Environment/Spec_Atmosphere.md b/Specifications/Environment/Spec_Atmosphere.md index d7831263..942737dc 100644 --- a/Specifications/Environment/Spec_Atmosphere.md +++ b/Specifications/Environment/Spec_Atmosphere.md @@ -1,122 +1,122 @@ # Specification for Atmosphere model ## 1. Overview -1. Functions - + The `Atmosphere` class calculates an air density at the satellite's position. +### 1. Functions ++ The `Atmosphere` class calculates an air density at the satellite's position. 2. Related files - + `src/environment/local/atmosphere.cpp, .hpp` - + `Atmosphere` class is defined. - + `src/environment/local/local_environment.cpp, .hpp` - + `Atmosphere` class is used here as a member variable of `LocalEnvironment` class. - + `src/library/external/nrlmsise00/wrapper_nrlmsise00.cpp, .hpp` - + An air density is calculated using an external library, NRLMSISE00 atmosphere model. - -3. How to use - + Select a model and set a standard deviation as `air_density_standard_deviation` for random noise in the `local_environment.ini` file - + 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. - + `nrlmsise00_table_file`: The space weather table path - + `is_manual_parameter_used`: The manual setting parameter defined as follows are used or not - + manual_daily_f107: User defined f10.7 (1 day) - + manual_average_f107: User defined f10.7 (30 days average) - + manual_ap: User defined ap - + The public functions - + `CalcAirDensity_kg_m3`: Update the air density (kg/m3) based on the selected model - + `GetAirDensity_kg_m3`: Return the calculated air density (kg/m3) ++ `src/environment/local/atmosphere.cpp, .hpp` + + `Atmosphere` class is defined. ++ `src/environment/local/local_environment.cpp, .hpp` + + `Atmosphere` class is used here as a member variable of `LocalEnvironment` class. ++ `src/library/external/nrlmsise00/wrapper_nrlmsise00.cpp, .hpp` + + An air density is calculated using an external library, NRLMSISE00 atmosphere model. + +### 3. How to use ++ Select a model and set a standard deviation as `air_density_standard_deviation` for random noise in the `local_environment.ini` file + + 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. + + `nrlmsise00_table_file`: The space weather table path + + `is_manual_parameter_used`: The manual setting parameter defined as follows are used or not + + manual_daily_f107: User defined f10.7 (1 day) + + manual_average_f107: User defined f10.7 (30 days average) + + manual_ap: User defined ap ++ The public functions + + `CalcAirDensity_kg_m3`: Update the air density (kg/m3) based on the selected model + + `GetAirDensity_kg_m3`: Return the calculated air density (kg/m3) ## 2. Installation of NRLMSISE00 + Please check [How to download and compile NRLMSISE00 Library](./General/HowToDownloadNRLMSISE00library.md) ## 3. Explanation of Algorithm -+ STANDARD - 1. Air density calculation - + Inputs - + Altitude - + Outputs - + Air density - - + Algorithm - The STANDARD model assumes the air density as follows. - - ```math - \rho \left(h \right) = \rho_0 \exp \left(-\frac{h - h_0}{H} \right) - ``` - where $h_0$ is a reference height, $\rho_0$ is an air density at the reference height, and $H$ is a scale height. These parameters are referred from the table shown in References [2]. - -+ NRLMSISE00 - 1. Read Space weather table - + `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. - + SpaceWeather.txt includes data between 2015 and 2044. If the simulation date is out of range, the air density cannot be calculated accurately. - - 2. Air density calculation - + Inputs - + Decimal year - + Latitude - + Longitude - + Altitude - + Outputs - + Air density - + Algorithm - + Please refer the following reference. - + Picone, J. M.; Hedin, A. E.; Drob, D. P.; Aikin, A. C. (2002-12-01). “NRLMSISE-00 empirical model of the atmosphere: Statistical comparisons and scientific issues”. Journal of Geophysical Research: Space Physics 107 (A12) +### STANDARD +#### 1. Air density calculation ++ Inputs + + Altitude ++ Outputs + + Air density + ++ Algorithm + The STANDARD model assumes the air density as follows. + +```math +\rho \left(h \right) = \rho_0 \exp \left(-\frac{h - h_0}{H} \right) +``` +where $h_0$ is a reference height, $\rho_0$ is an air density at the reference height, and $H$ is a scale height. These parameters are referred from the table shown in References [2]. + +### NRLMSISE00 +#### Read Space weather table ++ `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. + + SpaceWeather.txt includes data between 2015 and 2044. If the simulation date is out of range, the air density cannot be calculated accurately. + +#### Air density calculation ++ Inputs + + Decimal year + + Latitude + + Longitude + + Altitude ++ Outputs + + Air density ++ Algorithm + + Please refer the following reference. + + Picone, J. M.; Hedin, A. E.; Drob, D. P.; Aikin, A. C. (2002-12-01). “NRLMSISE-00 empirical model of the atmosphere: Statistical comparisons and scientific issues”. Journal of Geophysical Research: Space Physics 107 (A12) ## 4. Verification -+ NRLMSISE00 - 1. Overview - + The calculated air density was compared with [outputs from web-based NRLMSISE00 model](https://ccmc.gsfc.nasa.gov/modelweb/models/nrlmsise00.php). - - 2. Conditions for the verification - 1. input file - + Default initialize files - - 2. initial values - + Case1 : Default initialize files - ``` - 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. - ``` - 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 - ``` - tle1=1 38666U 12003B 12237.00000000 +.00000100 00000-0 67980-4 0 00008 - tle2=2 38666 098.6030 315.4100 0000010 300.0000 180.0000 14.09465034 0011 - ``` +### NRLMSISE00 +1. Overview + + The calculated air density was compared with [outputs from web-based NRLMSISE00 model](https://ccmc.gsfc.nasa.gov/modelweb/models/nrlmsise00.php). + +2. Conditions for the verification + 1. input file + + Default initialize files - 3. Results - + The calculated air density at t = 0.5 [s] was compared with the result of web-based model. - + S2E - + Case1 : 2.27E-15 kg / m3 - + Case2 : 1.01E-14 kg / m3 - + Web-based NRLMSISE00 - + Case1 : 2.454E-15 kg / m3 - - - + Case2 : 1.000E-14 kg / m3 - + 2. initial values + + Case1 : Default initialize files + ``` + 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. + ``` + 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 + ``` + tle1=1 38666U 12003B 12237.00000000 +.00000100 00000-0 67980-4 0 00008 + tle2=2 38666 098.6030 315.4100 0000010 300.0000 180.0000 14.09465034 0011 + ``` + +3. Results + + The calculated air density at t = 0.5 [s] was compared with the result of web-based model. + + S2E + + Case1 : 2.27E-15 kg / m3 + + Case2 : 1.01E-14 kg / m3 + + Web-based NRLMSISE00 + + Case1 : 2.454E-15 kg / m3 + + + + Case2 : 1.000E-14 kg / m3 + ## 5. References diff --git a/Specifications/Environment/Spec_CelestialInformation.md b/Specifications/Environment/Spec_CelestialInformation.md index 8bdef0ea..e05d3a1c 100644 --- a/Specifications/Environment/Spec_CelestialInformation.md +++ b/Specifications/Environment/Spec_CelestialInformation.md @@ -1,36 +1,36 @@ # Specification for Celestial Information ## 1. Overview -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 `EarthRotation`, and this class just calls their functions. +### 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 `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. +### 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. -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: - - `GetPositionFromCenter_i_m` - - You can select celestial ID or name for the arguments - - `GetVelocityFromCenter_i_m_s` - - You can select celestial ID or name for the arguments - - `GetGravityConstant_m3_s2` - - argument is celestial body name - - `GetCenterBodyGravityConstant_m3_s2` - - `GetRadii_m` or `GetRadiiFromName_m` - - You can select celestial ID or name for the arguments - - `GetMeanRadiusFromName_m` - - argument is celestial body name +### 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: + - `GetPositionFromCenter_i_m` + - You can select celestial ID or name for the arguments + - `GetVelocityFromCenter_i_m_s` + - You can select celestial ID or name for the arguments + - `GetGravityConstant_m3_s2` + - argument is celestial body name + - `GetCenterBodyGravityConstant_m3_s2` + - `GetRadii_m` or `GetRadiiFromName_m` + - You can select celestial ID or name for the arguments + - `GetMeanRadiusFromName_m` + - argument is celestial body name ## 3. Explanation of Algorithm -1. `UpdateAllObjectsInformation` function - 1. overview - - Actual calculation is executed by the CSPICE library. This function just calls the CSPICE functions. +### 1. `UpdateAllObjectsInformation` function +#### 1. overview +- Actual calculation is executed by the CSPICE library. This function just calls the CSPICE functions. ## 4. Verification - NA diff --git a/Specifications/Environment/Spec_CelestialRotation.md b/Specifications/Environment/Spec_CelestialRotation.md index 7c23418a..ba7c97c3 100644 --- a/Specifications/Environment/Spec_CelestialRotation.md +++ b/Specifications/Environment/Spec_CelestialRotation.md @@ -2,240 +2,239 @@ ## 1. Overview -1. Functions - - The `EarthRotation` class calculates the rotational motion of the Earth. - -2. Related files - - `src/environment/global/earth_rotation.cpp, .hpp` - - `EarthRotation` class is defined here. - - `src/environment/global/celestial_information.cpp, .hpp` - - `EarthRotation` class is used here. - -3. How to use - - 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}$ ) - - $\bf{R}$, $\bf{N}$, $\bf{P}$ stand for the DCM of axial rotation, nutation, precession, respectively. +### 1. Functions +- The `EarthRotation` class calculates the rotational motion of the Earth. + +### 2. Related files +- `src/environment/global/earth_rotation.cpp, .hpp` + - `EarthRotation` class is defined here. +- `src/environment/global/celestial_information.cpp, .hpp` + - `EarthRotation` class is used here. + +### 3. How to use +- 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}$ ) + - $\bf{R}$, $\bf{N}$, $\bf{P}$ stand for the DCM of axial rotation, nutation, precession, respectively. ## 2. Explanation of Algorithm - The algorithm is based on [IERS Conventions 2003](https://www.iers.org/SharedDocs/Publikationen/EN/IERS/Publications/tn/TechnNote32/tn32.pdf;jsessionid=22C15057833E870494CC905A5B05180C.live1?__blob=publicationFile&v=1). - -1. `Update` - - 1. overview - - This function calculates the coordinate transformation from ECI to ECEF, calling `Rotation` and `Precession` and `Nutation` functions. - ```math - \mathrm{DCM_{ECItoECEF}} = \bf{R}\bf{N}\bf{P} - ``` - - where $\bf{R}$, $\bf{N}$, $\bf{P}$ stand for the DCM of axial rotation, nutation, precession, respectively. - - 2. inputs and outputs - - Input - - Julian date - - Output - - the DCM of the coordinate transformation from ECI to ECEF - - 3. algorithm - - ```math - \mathrm{jdTT} = \mathrm{julian\, date} + \mathrm{dtUT1UTC} - ``` - - where Julian date is the input, dtUT1UTC is the time difference between UT1 and UTC - - dtUT1UTC = 32.184 [s] - - ```math - \mathrm{tTT} = \frac{\mathrm{jdTT} - \mathrm{JDJ2000}}{\mathrm{JC}} - ``` - - where tTT is Julian century for terrestrial time, JDJ2000 is Julian Date @ J2000, JC is Julian Century - - JDJ2000 = 2451545.0 [day] - - JC = 36525 [day/century] - - - By using tTT, we get the DCM of precession ( $\bf{P}$ ) and nutation ( $\bf{N}$ ) with `Precession` and `Nutation` functions. - - $\varepsilon$, $\Delta \varepsilon$, $\Delta \psi$ are calculated in `Nutation` function. - - ```math - \begin{align} - \mathrm{E_q} &= \Delta \psi \cos{(\varepsilon + \Delta \varepsilon)} \\ - \mathrm{GAST} &= \mathrm{GMST} + \mathrm{E_q} - \end{align} - ``` - - where GAST is Greenwich Apparent Sidereal Time, GMST is Greenwich Mean Sidereal Time - - - GAST is calculated from julian date in `gstime` function in `src/Library/sgp4/sgp4unit.h`. - - - By using GMST, We get the DCM of axial rotation ( $\bf{R}$ ) with the `Rotation` function. The coordinate transformation from ECI to ECEF is calculated. - ```math - \mathrm{DCM_{ECItoECEF}} = \bf{R}\bf{N}\bf{P} - ``` - - 4. note - - If rotation mode is `Simple`, only axial rotation is calculated. - -2. `AxialRotation` - - 1. overview - - This function calculates the axial rotation of the central object. - - 2. inputs and outputs - - Input - - Greenwich Apparent Sidereal Time (GAST) - - Output - - the DCM of axial rotation ( $\bf{R}$ ) - - 3. algorithm - ```math - \bf{R} = - \begin{pmatrix} - \cos{\mathrm{(GAST)}} & \sin{\mathrm{(GAST)}} & 0 \\ - - \sin{\mathrm{(GAST)}} & \cos{\mathrm{(GAST)}} & 0 \\ - 0 & 0 & 1 - \end{pmatrix} - ``` - -3. `Precession` - - 1. overview - - This function calculates the precession of the central object. - - 2. inputs and outputs - - Input - - Julian century for terrestrial time (tTT) - - Output - - the DCM of precession ( $\bf{P}$ ) - - 3. algorithm - - Precession angles are calculated as follows. - ```math - \begin{align} - \zeta &= 2306.2181" \mathrm{tTT} + 0.30188" \mathrm{tTT}^2 + 0.017998" \mathrm{tTT}^3 \\ - \theta &= 2004.3109" \mathrm{tTT} - 0.42665" \mathrm{tTT}^2 - 0.041833" \mathrm{tTT}^3 \\ - z &= 2306.2181" \mathrm{tTT} + 1.09468" \mathrm{tTT}^2 + 0.018203" \mathrm{tTT}^3 \\ - \end{align} - ``` - ```math - \bf{P} = - \begin{pmatrix} - \cos{(-z)} & \sin{(-z)} & 0 \\ - - \sin{(-z)} & \cos{(-z)} & 0 \\ - 0 & 0 & 1 - \end{pmatrix} - \begin{pmatrix} - \cos{\theta} & 0 & - \sin{\theta} \\ - 0 & 1 & 0 \\ - \sin{\theta} & 0 & \cos{\theta} - \end{pmatrix} - \begin{pmatrix} - \cos{(-\zeta)} & \sin{(-\zeta)} & 0 \\ - - \sin{(-\zeta)} & \cos{(-\zeta)} & 0 \\ - 0 & 0 & 1 - \end{pmatrix} - ``` - -4. `Nutation` - - 1. overview - - This function calculates the nutation of the central object. - - 2. inputs and outputs - - Input - - Julian century for terrestrial time (tTT) - - Output - - Return: the DCM of precession ( $\bf{N}$ ) - - $\varepsilon$: mean obliquity of the ecliptic - - $\Delta \varepsilon$: nutation in obliquity - - $\Delta \psi$: nutation in longitude - - 3. algorithm - Delaunay angles are calculated as follows. - ```math - \begin{align} - l &= 134.96340251^\circ + 1717915923.2178"\mathrm{tTT} + 31.8792"\mathrm{tTT}^2 + 0.051635"\mathrm{tTT}^3 - 0.00024470"\mathrm{tTT}^4 \\ - l' &= 357.52910918^\circ + 129596581.0481"\mathrm{tTT} - 0.5532"\mathrm{tTT}^2 + 0.000136"\mathrm{tTT}^3 - 0.00001149"\mathrm{tTT}^4 \\ - F &= 93.27209062^\circ + 1739527262.8478"\mathrm{tTT} - 12.7512"\mathrm{tTT}^2 - 0.001037"\mathrm{tTT}^3 + 0.00000417"\mathrm{tTT}^4 \\ - D &= 297.85019547^\circ + 1602961601.2090"\mathrm{tTT} - 6.3706"\mathrm{tTT}^2+0.006593"\mathrm{tTT}^3 -0.00003169"\mathrm{tTT}^4 \\ - \Omega &= 125.04455501^\circ - 6962890.5431"\mathrm{tTT} + 7.4722"\mathrm{tTT}^2+0.007702"\mathrm{tTT}^3-0.00005939"\mathrm{tTT}^4 \\ - \end{align} - ``` - - - l : mean anomaly of the moon - - l' : mean anomaly of the sun - - F : mean argument of latitude of the moon - - D : mean elongation of the moon from the sun - - $\Omega$ : mean longitude of ascending node of the moon - - $\varepsilon$ and $\Delta \varepsilon$ and $\Delta \psi$ are calculated as follows. - - ```math - \begin{align} - \varepsilon &= 23^\circ26'21".448 - 46".8150\mathrm{tTT} - 0".00059\mathrm{tTT}^2 + 0".001813\mathrm{tTT}^3 \\ - \Delta \epsilon &= 9.205\cos{\Omega} + 0.573\cos{2L'} - 0.090\cos{2\Omega} + 0.098\cos{2L}+0.007\cos{l'} - 0.001\cos{l} + 0.022\cos{(2L'+l')} + 0.013\cos{(2L+l)}-0.010\cos({2L'-l')} \, [\mathrm{arcsec}] \\ - \Delta \psi &= -17.206\sin{\Omega} - 1.317\sin{2L'} + 0.207\sin{2\Omega} - 0.228\sin{2L} + 0.148\sin{l'}+0.071\sin{l}-0.052\sin{(2L'+l')} - 0.030\sin{(2L+l)}+0.022\sin{(2L'-l')} \, [\mathrm{arcsec}] \\ - \end{align} - ``` - - where $L = F + \Omega$,$L' = L - D$ - - ```math - \bf{N} = - \begin{pmatrix} - 1 & 0 & 0 \\ - 0 & \cos{\left(-(\varepsilon + \Delta \varepsilon)\right)} & \sin{\left(-(\varepsilon + \Delta \varepsilon)\right)} \\ - 0 & - \sin{\left(-(\varepsilon + \Delta \varepsilon)\right)} & \cos{\left(-(\varepsilon + \Delta \varepsilon)\right)} - \end{pmatrix} - \begin{pmatrix} - \cos{(-\Delta \psi)} & \sin{(-\Delta \psi)} & 0 \\ - - \sin{(-\Delta \psi)} & \cos{(-\Delta \psi)} & 0 \\ - 0 & 0 & 1 - \end{pmatrix} - \begin{pmatrix} - 1 & 0 & 0 \\ - 0 & \cos{\varepsilon} & \sin{\varepsilon} \\ - 0 & - \sin{\varepsilon} & \cos{\varepsilon} - \end{pmatrix} - ``` +The algorithm is based on [IERS Conventions 2003](https://www.iers.org/SharedDocs/Publikationen/EN/IERS/Publications/tn/TechnNote32/tn32.pdf;jsessionid=22C15057833E870494CC905A5B05180C.live1?__blob=publicationFile&v=1). + +### 1. `Update` + +#### 1. overview +- This function calculates the coordinate transformation from ECI to ECEF, calling `Rotation` and `Precession` and `Nutation` functions. +```math +\mathrm{DCM_{ECItoECEF}} = \bf{R}\bf{N}\bf{P} +``` +- where $\bf{R}$, $\bf{N}$, $\bf{P}$ stand for the DCM of axial rotation, nutation, precession, respectively. + +#### 2. inputs and outputs +- Input + - Julian date +- Output + - the DCM of the coordinate transformation from ECI to ECEF + +#### 3. algorithm + +```math +\mathrm{jdTT} = \mathrm{julian\, date} + \mathrm{dtUT1UTC} +``` +- where Julian date is the input, dtUT1UTC is the time difference between UT1 and UTC + - dtUT1UTC = 32.184 [s] + +```math +\mathrm{tTT} = \frac{\mathrm{jdTT} - \mathrm{JDJ2000}}{\mathrm{JC}} +``` +- where tTT is Julian century for terrestrial time, JDJ2000 is Julian Date @ J2000, JC is Julian Century + - JDJ2000 = 2451545.0 [day] + - JC = 36525 [day/century] + +- By using tTT, we get the DCM of precession ( $\bf{P}$ ) and nutation ( $\bf{N}$ ) with `Precession` and `Nutation` functions. +- $\varepsilon$, $\Delta \varepsilon$, $\Delta \psi$ are calculated in `Nutation` function. + +```math +\begin{align} + \mathrm{E_q} &= \Delta \psi \cos{(\varepsilon + \Delta \varepsilon)} \\ + \mathrm{GAST} &= \mathrm{GMST} + \mathrm{E_q} +\end{align} +``` +- where GAST is Greenwich Apparent Sidereal Time, GMST is Greenwich Mean Sidereal Time + +- GAST is calculated from julian date in `gstime` function in `src/Library/sgp4/sgp4unit.h`. + +- By using GMST, We get the DCM of axial rotation ( $\bf{R}$ ) with the `Rotation` function. The coordinate transformation from ECI to ECEF is calculated. +```math +\mathrm{DCM_{ECItoECEF}} = \bf{R}\bf{N}\bf{P} +``` + +#### 4. note +- If rotation mode is `Simple`, only axial rotation is calculated. + +### 2. `AxialRotation` + +#### 1. overview +- This function calculates the axial rotation of the central object. + +#### 2. inputs and outputs +- Input + - Greenwich Apparent Sidereal Time (GAST) +- Output + - the DCM of axial rotation ( $\bf{R}$ ) + +#### 3. algorithm +```math +\bf{R} = +\begin{pmatrix} +\cos{\mathrm{(GAST)}} & \sin{\mathrm{(GAST)}} & 0 \\ +- \sin{\mathrm{(GAST)}} & \cos{\mathrm{(GAST)}} & 0 \\ +0 & 0 & 1 +\end{pmatrix} +``` + +### 3. `Precession` + +#### 1. overview +- This function calculates the precession of the central object. + +#### 2. inputs and outputs +- Input + - Julian century for terrestrial time (tTT) +- Output + - the DCM of precession ( $\bf{P}$ ) + +#### 3. algorithm +- Precession angles are calculated as follows. +```math +\begin{align} + \zeta &= 2306.2181" \mathrm{tTT} + 0.30188" \mathrm{tTT}^2 + 0.017998" \mathrm{tTT}^3 \\ + \theta &= 2004.3109" \mathrm{tTT} - 0.42665" \mathrm{tTT}^2 - 0.041833" \mathrm{tTT}^3 \\ + z &= 2306.2181" \mathrm{tTT} + 1.09468" \mathrm{tTT}^2 + 0.018203" \mathrm{tTT}^3 \\ +\end{align} +``` +```math +\bf{P} = +\begin{pmatrix} + \cos{(-z)} & \sin{(-z)} & 0 \\ + - \sin{(-z)} & \cos{(-z)} & 0 \\ + 0 & 0 & 1 +\end{pmatrix} +\begin{pmatrix} + \cos{\theta} & 0 & - \sin{\theta} \\ + 0 & 1 & 0 \\ + \sin{\theta} & 0 & \cos{\theta} +\end{pmatrix} +\begin{pmatrix} + \cos{(-\zeta)} & \sin{(-\zeta)} & 0 \\ + - \sin{(-\zeta)} & \cos{(-\zeta)} & 0 \\ + 0 & 0 & 1 +\end{pmatrix} +``` + +### 4. `Nutation` + +#### 1. overview +- This function calculates the nutation of the central object. + +#### 2. inputs and outputs +- Input + - Julian century for terrestrial time (tTT) +- Output + - Return: the DCM of precession ( $\bf{N}$ ) + - $\varepsilon$: mean obliquity of the ecliptic + - $\Delta \varepsilon$: nutation in obliquity + - $\Delta \psi$: nutation in longitude + +#### 3. algorithm +Delaunay angles are calculated as follows. +```math +\begin{align} + l &= 134.96340251^\circ + 1717915923.2178"\mathrm{tTT} + 31.8792"\mathrm{tTT}^2 + 0.051635"\mathrm{tTT}^3 - 0.00024470"\mathrm{tTT}^4 \\ + l' &= 357.52910918^\circ + 129596581.0481"\mathrm{tTT} - 0.5532"\mathrm{tTT}^2 + 0.000136"\mathrm{tTT}^3 - 0.00001149"\mathrm{tTT}^4 \\ + F &= 93.27209062^\circ + 1739527262.8478"\mathrm{tTT} - 12.7512"\mathrm{tTT}^2 - 0.001037"\mathrm{tTT}^3 + 0.00000417"\mathrm{tTT}^4 \\ + D &= 297.85019547^\circ + 1602961601.2090"\mathrm{tTT} - 6.3706"\mathrm{tTT}^2+0.006593"\mathrm{tTT}^3 -0.00003169"\mathrm{tTT}^4 \\ + \Omega &= 125.04455501^\circ - 6962890.5431"\mathrm{tTT} + 7.4722"\mathrm{tTT}^2+0.007702"\mathrm{tTT}^3-0.00005939"\mathrm{tTT}^4 \\ +\end{align} +``` + +- l : mean anomaly of the moon +- l' : mean anomaly of the sun +- F : mean argument of latitude of the moon +- D : mean elongation of the moon from the sun +- $\Omega$ : mean longitude of ascending node of the moon + +$\varepsilon$ and $\Delta \varepsilon$ and $\Delta \psi$ are calculated as follows. + +```math +\begin{align} +\varepsilon &= 23^\circ26'21".448 - 46".8150\mathrm{tTT} - 0".00059\mathrm{tTT}^2 + 0".001813\mathrm{tTT}^3 \\ +\Delta \epsilon &= 9.205\cos{\Omega} + 0.573\cos{2L'} - 0.090\cos{2\Omega} + 0.098\cos{2L}+0.007\cos{l'} - 0.001\cos{l} + 0.022\cos{(2L'+l')} + 0.013\cos{(2L+l)}-0.010\cos({2L'-l')} \, [\mathrm{arcsec}] \\ +\Delta \psi &= -17.206\sin{\Omega} - 1.317\sin{2L'} + 0.207\sin{2\Omega} - 0.228\sin{2L} + 0.148\sin{l'}+0.071\sin{l}-0.052\sin{(2L'+l')} - 0.030\sin{(2L+l)}+0.022\sin{(2L'-l')} \, [\mathrm{arcsec}] \\ +\end{align} +``` + +where $L = F + \Omega$,$L' = L - D$ + +```math +\bf{N} = +\begin{pmatrix} +1 & 0 & 0 \\ +0 & \cos{\left(-(\varepsilon + \Delta \varepsilon)\right)} & \sin{\left(-(\varepsilon + \Delta \varepsilon)\right)} \\ +0 & - \sin{\left(-(\varepsilon + \Delta \varepsilon)\right)} & \cos{\left(-(\varepsilon + \Delta \varepsilon)\right)} +\end{pmatrix} +\begin{pmatrix} +\cos{(-\Delta \psi)} & \sin{(-\Delta \psi)} & 0 \\ +- \sin{(-\Delta \psi)} & \cos{(-\Delta \psi)} & 0 \\ +0 & 0 & 1 +\end{pmatrix} +\begin{pmatrix} +1 & 0 & 0 \\ +0 & \cos{\varepsilon} & \sin{\varepsilon} \\ +0 & - \sin{\varepsilon} & \cos{\varepsilon} +\end{pmatrix} +``` ## 3. Results of verifications -1. $\mathrm{DCM_{ECItoECEF}}$ calculation in `Update` function - 1. overview - - - The $\mathrm{DCM_{ECItoECEF}}$ calculation is compared with [Matlab's dcmeci2ecef function](https://jp.mathworks.com/help/aerotbx/ug/dcmeci2ecef.html#d123e38055) +### 1. $\mathrm{DCM_{ECItoECEF}}$ calculation in `Update` function +#### 1. overview - 2. conditions for the verification - 1. input value - - Simulation time - - 200, 20000, 100000 [s] - - other conditions - - default initialize files - - UTC = 2020/01/01 12:00:00 - - Step Time 0.1 [s] - 3. results +- The $\mathrm{DCM_{ECItoECEF}}$ calculation is compared with [Matlab's dcmeci2ecef function](https://jp.mathworks.com/help/aerotbx/ug/dcmeci2ecef.html#d123e38055) - - Results of calculation time in S2E +#### 2. conditions for the verification +- input value + - Simulation time + - 200, 20000, 100000 [s] + - other conditions + - default initialize files + - UTC = 2020/01/01 12:00:00 + - Step Time 0.1 [s] +#### 3. results - - - If you want to reduce the calculation time, it is recommended to select `Simple` mode rather than `Idle` mode. Note again that if the rotation mode input is neither `Full` nor `Simple`, the `Idle` mode is set. +- Results of calculation time in S2E - - Results of S2E in `Simple` rotation mode + - +If you want to reduce the calculation time, it is recommended to select `Simple` mode rather than `Idle` mode. Note again that if the rotation mode input is neither `Full` nor `Simple`, the `Idle` mode is set. - - Results of S2E in `Full` rotation mode +- Results of S2E in `Simple` rotation mode - + - - Results of Matlab +- Results of S2E in `Full` rotation mode - + - The results of `Full` rotation mode and Matlab agree well. Note that Matlab is based on the IAU-2000/2005 reference system, while S2E is based on IERS Conventions 2003. - +- Results of Matlab + + + +The results of `Full` rotation mode and Matlab agree well. Note that Matlab is based on the IAU-2000/2005 reference system, while S2E is based on IERS Conventions 2003. ## 4. References diff --git a/Specifications/Environment/Spec_ClockGenerator.md b/Specifications/Environment/Spec_ClockGenerator.md index e05447b4..8335c99b 100644 --- a/Specifications/Environment/Spec_ClockGenerator.md +++ b/Specifications/Environment/Spec_ClockGenerator.md @@ -1,28 +1,28 @@ # Specification for Clock Generator ## 1. Overview -1. Functions - + The `ClockGenerator` generates clock for classes which inherit `ITickable`. - + It is mainly used to manage update the component states since the `Component` class inherits `ITickable` - + This class is not managed by `GlobalEnvironment` class. The `Spacecraft` class directly has the instance of this class and execute the update function. +### 1. Functions ++ The `ClockGenerator` generates clock for classes which inherit `ITickable`. ++ It is mainly used to manage update the component states since the `Component` class inherits `ITickable` ++ This class is not managed by `GlobalEnvironment` class. The `Spacecraft` class directly has the instance of this class and execute the update function. -2. Related files - + `src/environment/global/clock_generator.cpp, .hpp` - + `src/components/base/interface_tickable.hpp` +### 2. Related files ++ `src/environment/global/clock_generator.cpp, .hpp` ++ `src/components/base/interface_tickable.hpp` -3. How to use - + Make an instance of a class which inherit `ITickable`. Then, the instance is automatically registered to the component list `ClockGenerator::components_`. - + The `Spacecraft` class calls the `UpdateComponents` function to update the states of the registered components. +### 3. How to use ++ Make an instance of a class which inherit `ITickable`. Then, the instance is automatically registered to the component list `ClockGenerator::components_`. ++ The `Spacecraft` class calls the `UpdateComponents` function to update the states of the registered components. ## 3. Explanation of Algorithm -1. `UpdateComponents` function - 1. overview - - Call `TickToComponents` when the component update timing flag is `true`. - -1. `TickToComponents` function - 1. overview - - Increment count and execute the `ITickable::Tick` or `ITickable::FastTick` function. - - They call the `component::MainRoutine` and `component::FastUpdate` functions, respectively. +### 1. `UpdateComponents` function +#### 1. overview +- Call `TickToComponents` when the component update timing flag is `true`. + +### 1. `TickToComponents` function +#### 1. overview +- Increment count and execute the `ITickable::Tick` or `ITickable::FastTick` function. +- They call the `component::MainRoutine` and `component::FastUpdate` functions, respectively. ## 4. Verification - NA diff --git a/Specifications/Environment/Spec_GeomagneticField.md b/Specifications/Environment/Spec_GeomagneticField.md index 438c5052..6c246bd9 100644 --- a/Specifications/Environment/Spec_GeomagneticField.md +++ b/Specifications/Environment/Spec_GeomagneticField.md @@ -1,28 +1,28 @@ # Specification for Geomagnetic field model ## 1. Overview -1. Functions - + `GeomagneticField` class calculates the geomagnetic field at the spacecraft's position from the IGRF model - + This class also adds noise to emulate the difference between the IGRF model and the real world. +### 1. Functions ++ `GeomagneticField` class calculates the geomagnetic field at the spacecraft's position from the IGRF model ++ This class also adds noise to emulate the difference between the IGRF model and the real world. -2. Related files - + `src/environment/local/geomagnetic_field.cpp, .hpp` - + `GeomagneticField` class is defined. - + `src/environment/local/local_environment.cpp, .hpp` - + `GeomagneticField` class is used here as a member variable of `LocalEnvironment` class. - + `src/library/external/igrf/igrf.cpp, h` - + A magnetic field in the ECI frame is calculated by the IGRF model. +### 2. Related files ++ `src/environment/local/geomagnetic_field.cpp, .hpp` + + `GeomagneticField` class is defined. ++ `src/environment/local/local_environment.cpp, .hpp` + + `GeomagneticField` class is used here as a member variable of `LocalEnvironment` class. ++ `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 - + Public functions - + `CalcMagneticField` : Update the magnetic field - + `GetGeomagneticField_i_nT` : Return the magnetic field (nT) in the ECI - + `GetGeomagneticField_b_nT` : Return the magnetic field (nT) in the body-fixed coordinate +### 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 ++ Public functions + + `CalcMagneticField` : Update the magnetic field + + `GetGeomagneticField_i_nT` : Return the magnetic field (nT) in the ECI + + `GetGeomagneticField_b_nT` : Return the magnetic field (nT) in the body-fixed coordinate ## 2. Explanation of Algorithm @@ -31,36 +31,36 @@ + Please refer [here](https://www.ngdc.noaa.gov/IAGA/vmod/igrf.html#:~:text=The%20International%20Association%20of%20Geomagnetism,interior%2C%20its%20crust%20and%20its) for the details of IGRF. ## 3. Verification -1. Overview - + The calculated magnetic field is compared with [Matlab's IGRF function](https://jp.mathworks.com/help/aerotbx/ug/igrfmagm.html) calculation in the ECI frame. +### Overview ++ The calculated magnetic field is compared with [Matlab's IGRF function](https://jp.mathworks.com/help/aerotbx/ug/igrfmagm.html) calculation in the ECI frame. -2. Conditions for the verification - 1. input files - - Default initialize files +### 2. Conditions for the verification +1. input files + - Default initialize files - 2. initial values - - To check the result in an example orbit, the EndTime was changed to 9000 s. - ``` - 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). - ``` - 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 - ``` +2. initial values + - To check the result in an example orbit, the EndTime was changed to 9000 s. + ``` + 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). + ``` + 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 + ``` -3. Results - + Results of S2E - +### 3. Results ++ Results of S2E + - + Error between S2E and MATLAB - + The error is approximately 200―500 nT. This may be because the coefficients of S2E are 13th, but on the other hand, those of MATLAB are 12th. - ++ Error between S2E and MATLAB + + The error is approximately 200―500 nT. This may be because the coefficients of S2E are 13th, but on the other hand, those of MATLAB are 12th. + ## 4. References 1. International Geomagnetic Reference Field, https://www.ngdc.noaa.gov/IAGA/vmod/igrf.html#:~:text=The%20International%20Association%20of%20Geomagnetism,interior%2C%20its%20crust%20and%20its diff --git a/Specifications/Environment/Spec_GlobalEnvironment.md b/Specifications/Environment/Spec_GlobalEnvironment.md index f5ef32a0..928e0871 100644 --- a/Specifications/Environment/Spec_GlobalEnvironment.md +++ b/Specifications/Environment/Spec_GlobalEnvironment.md @@ -1,20 +1,20 @@ # Specification for Global Environment ## 1. Overview -1. Functions - + The `GlobalEnvironment` class integrates all global environments. +### 1. Functions ++ The `GlobalEnvironment` class integrates all global environments. -2. Related files - + `src/environment/global/global_environment.cpp, .hpp` - + All global environment classes are initialized and updated here as a member variable. +### 2. Related files ++ `src/environment/global/global_environment.cpp, .hpp` + + All global environment classes are initialized and updated here as a member variable. -3. How to use - + When users make a new global environment class, users need to add the class as a member variable. +### 3. How to use ++ When users make a new global environment class, users need to add the class as a member variable. ## 3. Explanation of Algorithm -1. `Update` function - 1. overview - - Update all global environments. +### 1. `Update` function +#### 1. overview +- Update all global environments. ## 4. Verification - NA diff --git a/Specifications/Environment/Spec_GnssSatellites_en.md b/Specifications/Environment/Spec_GnssSatellites_en.md index c3b56c42..ccb7342d 100644 --- a/Specifications/Environment/Spec_GnssSatellites_en.md +++ b/Specifications/Environment/Spec_GnssSatellites_en.md @@ -1,19 +1,19 @@ # Specification for GNSS ## 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_SATELLITES]` in `sample_gnss.ini`. +### 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_SATELLITES]` in `sample_gnss.ini`. -2. Related files - - `src/environment/global/globalEnvironment.cpp, .hpp` - - GnssSatellites class is defined. Various GET functions are also implemented. - - `src/environment/global/initialize_gnss_satellites.cpp, .hpp` - - This makes the instance of the GnssSatellites class. The initialization is described in the `sample_gnss.ini` file. - - `ExtLibraries/sp3` - - It contains a set of files (.sp3, .clk_30s) necessary for generating orbits and clock biases. +### 2. Related files +- `src/environment/global/globalEnvironment.cpp, .hpp` + - GnssSatellites class is defined. Various GET functions are also implemented. +- `src/environment/global/initialize_gnss_satellites.cpp, .hpp` + - This makes the instance of the GnssSatellites class. The initialization is described in the `sample_gnss.ini` file. +- `ExtLibraries/sp3` + - It contains a set of files (.sp3, .clk_30s) necessary for generating orbits and clock biases. -3. About downloading .sp3 files, etc. +### 3. About downloading .sp3 files, etc. - The author has not yet written script files to download .sp3 or .clk. Users can download them from `ftp://igs.ensg.ign.fr/pub/igs/products/`, `http://mgmds01.tksc.jaxa.jp/`, etc., referring to the directory classification. The directories are assumed to be as follows. ``` ExtLibraries diff --git a/Specifications/Environment/Spec_GnssSatellites_ja.md b/Specifications/Environment/Spec_GnssSatellites_ja.md index 6a20184f..aa145131 100644 --- a/Specifications/Environment/Spec_GnssSatellites_ja.md +++ b/Specifications/Environment/Spec_GnssSatellites_ja.md @@ -1,19 +1,19 @@ # 姿勢シミュレータ仕様書 - GNSS - ## 1. 概要 -1. 機能 - - .sp3や.clk_30sなどのGNSS衛星の軌道, クロックバイアスに関するデータを読み取り, 他クラスで使用できるためのクラス. - - `sample_gnss.ini` により読みだすファイル名と範囲を決定します +### 1. 機能 +- .sp3や.clk_30sなどのGNSS衛星の軌道, クロックバイアスに関するデータを読み取り, 他クラスで使用できるためのクラス. +- `sample_gnss.ini` により読みだすファイル名と範囲を決定します -2. 関連ファイル - - `src/environment/global/globalEnvironment.cpp, .hpp` - - GnssSatellites クラスが定義されています. また, 各種GET関数も実装されています. - - `src/environment/global/initialize_gnss_satellites.cpp, .hpp` - - GnssSatellites クラスのための初期化ファイルとなっています. 初期化の内容については `sample_gnss.ini` ファイル内に記述されています. - - `ExtLibraries/sp3` - - 軌道やクロックバイアスの生成に必要なファイル群(.sp3, .clk_30s)などが入っています. +### 2. 関連ファイル +- `src/environment/global/globalEnvironment.cpp, .hpp` + - GnssSatellites クラスが定義されています. また, 各種GET関数も実装されています. +- `src/environment/global/initialize_gnss_satellites.cpp, .hpp` + - GnssSatellites クラスのための初期化ファイルとなっています. 初期化の内容については `sample_gnss.ini` ファイル内に記述されています. +- `ExtLibraries/sp3` + - 軌道やクロックバイアスの生成に必要なファイル群(.sp3, .clk_30s)などが入っています. -3. .sp3ファイルなどのダウンロードに関して +### 3. .sp3ファイルなどのダウンロードに関して - まだダウンロードをする際に使用するスクリプトを書いていません. ディレクトリ分けなどを参考に`ftp://igs.ensg.ign.fr/pub/igs/products/`や`http://mgmds01.tksc.jaxa.jp/`等のサイトから各自ダウンロードしてください. ディレクトリ分けは以下の様になっていることを想定しています. ``` ExtLibraries diff --git a/Specifications/Environment/Spec_HipparcosCatalogue_en.md b/Specifications/Environment/Spec_HipparcosCatalogue_en.md index 9323151a..ad97a054 100644 --- a/Specifications/Environment/Spec_HipparcosCatalogue_en.md +++ b/Specifications/Environment/Spec_HipparcosCatalogue_en.md @@ -3,33 +3,33 @@ ## 1. Overview - This class read the csv file of Hipparcos catalogue and to enable other classes to use the data. - Specify the max visual magnitude to read in `sample_simulation_base.ini` - 1. functions - + `ReadContents` - * Function to read `hip_main.csv` - + `Get` functions - * Functions to access the data of `HipparcosCatalogue` from outside of this class - - 2. files - + `HipparcosCatalogue.cpp` ,`HipparcosCatalogue.hpp` - * Definitions and declarations of the class - + `sample_simulation_base.ini` - * Parameters for initialization - + `hip_main.csv` - * This is the original data of the Hipparcos catalogue. It is in the `ExtLibraries` directory. This data is sorted in of the visual magnitude, not in the order of HIP ID. - - 3. How to download `hip_main.csv` - + `s2e-core/scripts/download_HIPcatalogue.sh` is the script to download it. Run the following code using Git bash in `s2e-core/scripts/`. - * **NOTE for Mac OS users: Run the following script not from the Mac terminal but the Ubuntu terminal in Docker.** (Because the specification of `sed` is different between Mac and Linux, the file cannot be generated correctly. Reference: ) - ``` - bash download_HIPcatalogue.sh - ``` - - 4. How to use - + Set the parameters in `sample_simulation_base.ini` - + Create an instance by using initialization function `InitHipparcosCatalogue` - + Run `GetContents` to read the csv file - + Get the data from outside this class using `Get` functions. - + The `HipparcosData` structure has four elements, hipparcos_id, visible_magnitude, right_ascension_deg, declination_deg. `HipparcosCatalogue` stores the data as a vector of `HipparcosData`. +### 1. functions ++ `ReadContents` + * Function to read `hip_main.csv` ++ `Get` functions + * Functions to access the data of `HipparcosCatalogue` from outside of this class + +### 2. files ++ `HipparcosCatalogue.cpp` ,`HipparcosCatalogue.hpp` + * Definitions and declarations of the class ++ `sample_simulation_base.ini` + * Parameters for initialization ++ `hip_main.csv` + * This is the original data of the Hipparcos catalogue. It is in the `ExtLibraries` directory. This data is sorted in of the visual magnitude, not in the order of HIP ID. + +### 3. How to download `hip_main.csv` ++ `s2e-core/scripts/download_HIPcatalogue.sh` is the script to download it. Run the following code using Git bash in `s2e-core/scripts/`. + * **NOTE for Mac OS users: Run the following script not from the Mac terminal but the Ubuntu terminal in Docker.** (Because the specification of `sed` is different between Mac and Linux, the file cannot be generated correctly. Reference: ) + ``` + bash download_HIPcatalogue.sh + ``` + +### 4. How to use ++ Set the parameters in `sample_simulation_base.ini` ++ Create an instance by using initialization function `InitHipparcosCatalogue` ++ Run `GetContents` to read the csv file ++ Get the data from outside this class using `Get` functions. ++ The `HipparcosData` structure has four elements, hipparcos_id, visible_magnitude, right_ascension_deg, declination_deg. `HipparcosCatalogue` stores the data as a vector of `HipparcosData`. ## 2. Explanation of Algorithm TBW diff --git a/Specifications/Environment/Spec_HipparcosCatalogue_ja.md b/Specifications/Environment/Spec_HipparcosCatalogue_ja.md index 11903bb5..b387414a 100644 --- a/Specifications/Environment/Spec_HipparcosCatalogue_ja.md +++ b/Specifications/Environment/Spec_HipparcosCatalogue_ja.md @@ -3,33 +3,35 @@ ## 1. 概要 - csv形式のヒッパルコス星表のデータを読み取り,他クラスで使用できるようにするためのクラス. - `sample_simulation_base.ini` によりあらかじめ読み出す視等級の上限を決める. - 1. 関数 - + `ReadContents` - * `hip_main.csv`を読み出してデータに格納する関数. - + 各種 `Get` 関数 - * クラス外から `HipparcosCatalogue` のデータにアクセスする場合に用いる関数. - 2. 関連ソースコード,ファイル - + `HipparcosCatalogue.cpp` ,`HipparcosCatalogue.hpp` - * クラスの定義が行われている. - + `initialize_global_environment.cpp` - * 初期化関数が記述されている - + `sample_simulation_base.ini` - * 初期化ファイル - + `hip_main.csv` - * ヒッパルコス星表の元データ. `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ファイルを生成することができないため.参考:) - ``` - bash download_HIPcatalogue.sh - ``` - - 4. 使い方 - + `sample_simulation_base.ini`でパラメータを設定 - + 初期化関数 `InitHipparcosCatalogue` を利用し,インスタンスを生成 - + `GetContents` を実行することで,csvファイルからデータを取得する. - + 各種情報が必要な場合は, `Get` 関数を使って取得する. - + hipparcos_id(HIP ID),visible_magnitude(視等級),right_ascension_deg(赤経),declination_deg(赤緯)の4要素を持つ `HipparcosData` 構造体を定義している.データはこの `HipparcosData` 型を要素にとるベクタとして保存される. +### 1. 関数 ++ `ReadContents` + * `hip_main.csv`を読み出してデータに格納する関数. ++ 各種 `Get` 関数 + * クラス外から `HipparcosCatalogue` のデータにアクセスする場合に用いる関数. + +### 2. 関連ソースコード,ファイル ++ `HipparcosCatalogue.cpp` ,`HipparcosCatalogue.hpp` + * クラスの定義が行われている. ++ `initialize_global_environment.cpp` + * 初期化関数が記述されている ++ `sample_simulation_base.ini` + * 初期化ファイル ++ `hip_main.csv` + * ヒッパルコス星表の元データ. `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ファイルを生成することができないため.参考:) +``` +bash download_HIPcatalogue.sh +``` + +### 4. 使い方 ++ `sample_simulation_base.ini`でパラメータを設定 ++ 初期化関数 `InitHipparcosCatalogue` を利用し,インスタンスを生成 ++ `GetContents` を実行することで,csvファイルからデータを取得する. ++ 各種情報が必要な場合は, `Get` 関数を使って取得する. ++ hipparcos_id(HIP ID),visible_magnitude(視等級),right_ascension_deg(赤経),declination_deg(赤緯)の4要素を持つ `HipparcosData` 構造体を定義している.データはこの `HipparcosData` 型を要素にとるベクタとして保存される. ## 2. アルゴリズム説明 diff --git a/Specifications/Environment/Spec_LocalCelestialInformation.md b/Specifications/Environment/Spec_LocalCelestialInformation.md index fed1d756..b79285c4 100644 --- a/Specifications/Environment/Spec_LocalCelestialInformation.md +++ b/Specifications/Environment/Spec_LocalCelestialInformation.md @@ -1,30 +1,30 @@ # Specification for Local Celestial Information ## 1. Overview -1. Functions - - `LocalCelestialInformation` calculates the celestial bodies position and velocity on the spacecraft body-fixed frame. +### 1. Functions +- `LocalCelestialInformation` calculates the celestial bodies position and velocity on the spacecraft body-fixed frame. -2. Related files - - `src/environment/local/local_celestial_information.cpp, .hpp` - - `LocalCelestialInformation` class is defined. - - `src/environment/local/local_environment.cpp, .hpp` - - `LocalCelestialInformation` class is used here as a member variable of `LocalEnvironment` class. +### 2. Related files +- `src/environment/local/local_celestial_information.cpp, .hpp` + - `LocalCelestialInformation` class is defined. +- `src/environment/local/local_environment.cpp, .hpp` + - `LocalCelestialInformation` class is used here as a member variable of `LocalEnvironment` class. + +### 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: + - Get celestial body position vector from the spacecraft position. Users need to set the body name as an argument. + - `GetPositionFromSpacecraft_i_m` + - `GetPositionFromSpacecraft_b_m` + - Get center body position vector from the spacecraft position without any arguments. + - `GetCenterBodyPositionFromSpacecraft_i_m` + - `GetCenterBodyPositionFromSpacecraft_b_m` +- To access the celestial body position in the inertial frame, users can use `GetGlobalInformation` -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: - - Get celestial body position vector from the spacecraft position. Users need to set the body name as an argument. - - `GetPositionFromSpacecraft_i_m` - - `GetPositionFromSpacecraft_b_m` - - Get center body position vector from the spacecraft position without any arguments. - - `GetCenterBodyPositionFromSpacecraft_i_m` - - `GetCenterBodyPositionFromSpacecraft_b_m` - - To access the celestial body position in the inertial frame, users can use `GetGlobalInformation` - ## 3. Explanation of Algorithm -1. `UpdateAllObjectsInformation` function - 1. overview - - Convert the celestial bodies positions to the body frame from the inertial frame. +### 1. `UpdateAllObjectsInformation` function +#### 1. overview +- Convert the celestial bodies positions to the body frame from the inertial frame. ## 4. Verification - NA diff --git a/Specifications/Environment/Spec_LocalEnvironment.md b/Specifications/Environment/Spec_LocalEnvironment.md index 36274e43..7afd23a6 100644 --- a/Specifications/Environment/Spec_LocalEnvironment.md +++ b/Specifications/Environment/Spec_LocalEnvironment.md @@ -1,21 +1,21 @@ # Specification for Local Environment ## 1. Overview -1. Functions - + The `LocalEnvironment` class integrates all local environments. +### 1. Functions ++ The `LocalEnvironment` class integrates all local environments. -2. Related files - + `src/environment/local/local_environment.cpp, .hpp` - + All local environment classes are initialized and updated here as a member variable. +### 2. Related files ++ `src/environment/local/local_environment.cpp, .hpp` + + All local environment classes are initialized and updated here as a member variable. -3. How to use - + When users make a new local environment class, users need to add the class as a member variable. +### 3. How to use ++ When users make a new local environment class, users need to add the class as a member variable. ## 3. Explanation of Algorithm -1. `Update` function - 1. overview - - The environment calculations that depend on the spacecraft attitude are called when the spacecraft attitude is updated. - - The environment calculations that depend on the spacecraft position are called when the spacecraft position is updated. +### 1. `Update` function +#### 1. overview +- The environment calculations that depend on the spacecraft attitude are called when the spacecraft attitude is updated. +- The environment calculations that depend on the spacecraft position are called when the spacecraft position is updated. ## 4. Verification - NA diff --git a/Specifications/Environment/Spec_PhysicalConstants.md b/Specifications/Environment/Spec_PhysicalConstants.md index 9e692eba..bb419e76 100644 --- a/Specifications/Environment/Spec_PhysicalConstants.md +++ b/Specifications/Environment/Spec_PhysicalConstants.md @@ -1,15 +1,15 @@ # Specification for Physical Constants ## 1. Overview -1. Functions - + This file defines the physical constant values used in the S2E. +### 1. Functions ++ This file defines the physical constant values used in the S2E. -2. Related files - + `src/environment/global/physical_constants.hpp` +### 2. Related files ++ `src/environment/global/physical_constants.hpp` -3. How to use - + When users want to use some physical constant values, please see this header file. - + If you cannot find what you want, please add the value here and make the Pull Request to share the value with other users. +### 3. How to use ++ When users want to use some physical constant values, please see this header file. ++ If you cannot find what you want, please add the value here and make the Pull Request to share the value with other users. ## 3. Explanation of Algorithm - NA diff --git a/Specifications/Environment/Spec_SRPEnvironment.md b/Specifications/Environment/Spec_SRPEnvironment.md index c0e82c10..d6720a64 100644 --- a/Specifications/Environment/Spec_SRPEnvironment.md +++ b/Specifications/Environment/Spec_SRPEnvironment.md @@ -2,150 +2,150 @@ ## 1. Overview -1. Functions - - `SolarRadiationPressureEnvironment` calculates solar power flux at the spacecraft's position, including the earth's eclipse effect. - -2. Related files - - `src/environment/local/solar_radiation_pressure_environment.cpp, .hpp` - - `SolarRadiationPressureEnvironment` class is defined. - - `src/environment/local/local_environment.cpp, .hpp` - - `SolarRadiationPressureEnvironment` class is used here as a member variable of `LocalEnvironment` class. - -3. How to use - - Call `UpdateAllStates` function to calculates solar power flux and updates the eclipse flag. - - Users can get calculated values by using the following functions: - - `GetPressure_N_m2`: Return solar pressure (N/m2) with eclipse effect for SRP disturbance calculation. - - `GetPowerDensity_W_m2`: Return solar power density (W/m2) with eclipse effect for Electrical Power System calculation. - - `GetPressureWithoutEclipse_Nm2`: Return solar pressure (N/m2) without eclipse effect. - - `GetSolarConstant_W_m2`: Return solar constant value 1366 [W/m2] - - `GetShadowCoefficient`: Return shadow function $\nu$. - - When the spacecraft is in umbra, $\nu=0$. - - When the spacecraft is in sunlight, $\nu=1$. - - When the spacecraft is in penumbra, $0<\nu<1$. - - `GetIsEclipsed`: Return eclipse or not +### 1. Functions +- `SolarRadiationPressureEnvironment` calculates solar power flux at the spacecraft's position, including the earth's eclipse effect. + +### 2. Related files +- `src/environment/local/solar_radiation_pressure_environment.cpp, .hpp` + - `SolarRadiationPressureEnvironment` class is defined. +- `src/environment/local/local_environment.cpp, .hpp` + - `SolarRadiationPressureEnvironment` class is used here as a member variable of `LocalEnvironment` class. + +### 3. How to use +- Call `UpdateAllStates` function to calculates solar power flux and updates the eclipse flag. +- Users can get calculated values by using the following functions: + - `GetPressure_N_m2`: Return solar pressure (N/m2) with eclipse effect for SRP disturbance calculation. + - `GetPowerDensity_W_m2`: Return solar power density (W/m2) with eclipse effect for Electrical Power System calculation. + - `GetPressureWithoutEclipse_Nm2`: Return solar pressure (N/m2) without eclipse effect. + - `GetSolarConstant_W_m2`: Return solar constant value 1366 [W/m2] + - `GetShadowCoefficient`: Return shadow function $\nu$. + - When the spacecraft is in umbra, $\nu=0$. + - When the spacecraft is in sunlight, $\nu=1$. + - When the spacecraft is in penumbra, $0<\nu<1$. + - `GetIsEclipsed`: Return eclipse or not ## 2. Explanation of Algorithm -1. Pressure calculation in `UpdateAllStates` function - - 1. overview - - Solar radiation pressure at the position of the spacecraft is calculated by using the inverse square law. - - 2. inputs and outputs - - Constants - - Solar constant: $P_{\odot} = 1366$ W/m2 - - Speed of light: $c = 299792458$ m/s - - Astronomical Unit: $AU = 149597870700$ m - - Input variables - - The sun position in the body-fixed frame of the spacecraft: $\boldsymbol{r}_{\odot-sc}$ m - - Unbold $r_{\odot-sc}$ is the norm of $\boldsymbol{r}_{\odot-sc}$ - - Output - - Solar radiation pressure: $P_{sc}$ N/m2 - - 3. algorithm - ```math - P_{sc}=\frac{P_{sun}}{c}\left(\frac{AU}{r_{\odot-sc}}\right)^{2} - ``` - - 4. note - - It is known that the solar constant value varies between 1365 and 1367 W/m2, but it is handled as a constant value in S2E. - -2. `CalcShadowCoefficient` function - 1. overview - - This function determines that the spacecraft is inside the eclipse of the earth or not. - - 2. inputs and outputs - - Constants - - Radius of the earth: $r_{\oplus}=6378137$ m - - Radius of the sun: $r_{\odot}=6.96\times10^{8}$ m - - Input variables - - The sun position in the body-fixed frame of the spacecraft: $\boldsymbol{r}_{\odot-sc}$ m - - The earth position in the body-fixed frame of the spacecraft: $\boldsymbol{r}_{\oplus-sc}$ m - - Output - - none - - 3. algorithm - ```math - \begin{align} - A_{\odot} &= \sin^{-1}\left(\frac{r_{\odot}}{r_{\odot-sc}}\right)\\ - A_{\oplus} &= \sin^{-1}\left(\frac{r_{\oplus}}{r_{\oplus-sc}}\right)\\ - \delta &= \cos^{-1}\left(\frac{r_{\odot-sc}}{r_{\oplus-sc}}\cdot \boldsymbol{r}_{\oplus-sc}\cdot(\boldsymbol{r}_{\odot-sc}-\boldsymbol{r}_{\oplus-sc})\right)\\ - \end{align} - ``` - - 4. note - - See the following description of the `CalcShadowFunction` for the calculation of the shadow function. - -3. `CalcShadowFunction` function - 1. overview - - This function calculates the degree of the Sun's occultation by the Earth. - - The base algorithm is referred to [Satellite Orbits](https://www.springer.com/jp/book/9783540672807) chapter 3.4. - - 2. inputs and outputs - - Input - - The apparent radius of the Sun: $A_{\odot}$ - - The apparent radius of the Earth: $A_{\oplus}$ - - The apparent separation of the centers of the Sun and the Earth: $\delta$ - - The angle between the center of the Sun and the common chord: $x$ - - The length of the common chord of the apparent solar disk and apparent celestial disk: $y$ - - Output - - The shadow function: $\nu$ - - 3. algorithm - - If the occultation is total, then $\nu=0$. - - If the occultation is partial but maximum, then $\nu=1-\left(\frac{A_{\oplus}}{A_{\odot}}\right)^2$ - - If the occultation is partial, then $\nu = 1-\frac{S}{\pi A^2_{\odot}}$ - - S is given by the following calculation. - - ```math - S=A_{\odot}^2\arccos\left(\frac{x}{A_{\odot}}\right)+A_{\oplus}^2\arccos\left(\frac{\delta-x}{A_{\oplus}}\right)-\delta\cdot y - ``` - - In other cases, since it means that no occultation takes place, then $\nu=1$. +### 1. Pressure calculation in `UpdateAllStates` function + +#### 1. overview +- Solar radiation pressure at the position of the spacecraft is calculated by using the inverse square law. + +#### 2. inputs and outputs +- Constants + - Solar constant: $P_{\odot} = 1366$ W/m2 + - Speed of light: $c = 299792458$ m/s + - Astronomical Unit: $AU = 149597870700$ m +- Input variables + - The sun position in the body-fixed frame of the spacecraft: $\boldsymbol{r}_{\odot-sc}$ m + - Unbold $r_{\odot-sc}$ is the norm of $\boldsymbol{r}_{\odot-sc}$ +- Output +- Solar radiation pressure: $P_{sc}$ N/m2 + +#### 3. algorithm +```math +P_{sc}=\frac{P_{sun}}{c}\left(\frac{AU}{r_{\odot-sc}}\right)^{2} +``` + +#### 4. note +- It is known that the solar constant value varies between 1365 and 1367 W/m2, but it is handled as a constant value in S2E. + +### 2. `CalcShadowCoefficient` function +#### 1. overview +- This function determines that the spacecraft is inside the eclipse of the earth or not. + +#### 2. inputs and outputs +- Constants + - Radius of the earth: $r_{\oplus}=6378137$ m + - Radius of the sun: $r_{\odot}=6.96\times10^{8}$ m +- Input variables + - The sun position in the body-fixed frame of the spacecraft: $\boldsymbol{r}_{\odot-sc}$ m + - The earth position in the body-fixed frame of the spacecraft: $\boldsymbol{r}_{\oplus-sc}$ m +- Output + - none + +#### 3. algorithm +```math +\begin{align} +A_{\odot} &= \sin^{-1}\left(\frac{r_{\odot}}{r_{\odot-sc}}\right)\\ +A_{\oplus} &= \sin^{-1}\left(\frac{r_{\oplus}}{r_{\oplus-sc}}\right)\\ +\delta &= \cos^{-1}\left(\frac{r_{\odot-sc}}{r_{\oplus-sc}}\cdot \boldsymbol{r}_{\oplus-sc}\cdot(\boldsymbol{r}_{\odot-sc}-\boldsymbol{r}_{\oplus-sc})\right)\\ +\end{align} +``` + +#### 4. note +- See the following description of the `CalcShadowFunction` for the calculation of the shadow function. + +### 3. `CalcShadowFunction` function +#### 1. overview +- This function calculates the degree of the Sun's occultation by the Earth. +- The base algorithm is referred to [Satellite Orbits](https://www.springer.com/jp/book/9783540672807) chapter 3.4. + +#### 2. inputs and outputs +- Input + - The apparent radius of the Sun: $A_{\odot}$ + - The apparent radius of the Earth: $A_{\oplus}$ + - The apparent separation of the centers of the Sun and the Earth: $\delta$ + - The angle between the center of the Sun and the common chord: $x$ + - The length of the common chord of the apparent solar disk and apparent celestial disk: $y$ +- Output + - The shadow function: $\nu$ + +#### 3. algorithm +- If the occultation is total, then $\nu=0$. +- If the occultation is partial but maximum, then $\nu=1-\left(\frac{A_{\oplus}}{A_{\odot}}\right)^2$ +- If the occultation is partial, then $\nu = 1-\frac{S}{\pi A^2_{\odot}}$ + - S is given by the following calculation. + +```math +S=A_{\odot}^2\arccos\left(\frac{x}{A_{\odot}}\right)+A_{\oplus}^2\arccos\left(\frac{\delta-x}{A_{\oplus}}\right)-\delta\cdot y +``` +- In other cases, since it means that no occultation takes place, then $\nu=1$. ## 3. Results of verifications -1. Verification of pressure calculation in `UpdateAllStates` function - 1. overview - - The pressure calculation above is verified. - - 2. conditions for the verification - - A test code written in the `SRPEnvironment.cpp` is used. - - The sun position and the earth position are fixed, and the spacecraft position varies as following values. - - Sun-spacecraft distance: 149604270700m - 153797870700m - - Earth-spacecraft distance: 6400000m - 4200000000m - - 3. results - - The pressure calculation is verified. - - SummaryCalculationTime - -2. Verification of calculation in `CalcShadowFunction` function - 1. overview - - The calculation of the shadow function is verified. - - The result of the `CalcShadowFunction` of S2E is compared with the results of the `solar intensity` of STK. - - 2. conditions for the verification - - Orbit - - The orbit of the ISS was used for verification. - - The TLE data are as follows. - ``` - 1 25544U 98067A 20250.86981481 .00000008 00000-0 82464-5 0 9991 - 2 25544 51.6470 304.2415 0002004 86.5035 251.6018 15.49214189244677 - ``` - - - Simulation time - - The simulation time is as follows. - ``` - //Simulation start date,[UTC] - StartYMDHMS=2020/09/13 12:00:00.0 - //Simulation finish time,[sec] - EndTimeSec=3600 - ``` - - 3. Results - - The calculation of the shadow function is verified. - Result_SRPEnvironment_shadowfunction +### 1. Verification of pressure calculation in `UpdateAllStates` function +#### 1. overview +- The pressure calculation above is verified. + +#### 2. conditions for the verification +- A test code written in the `SRPEnvironment.cpp` is used. +- The sun position and the earth position are fixed, and the spacecraft position varies as following values. + - Sun-spacecraft distance: 149604270700m - 153797870700m + - Earth-spacecraft distance: 6400000m - 4200000000m + +#### 3. results +- The pressure calculation is verified. + +SummaryCalculationTime + +### 2. Verification of calculation in `CalcShadowFunction` function +#### 1. overview +- The calculation of the shadow function is verified. +- The result of the `CalcShadowFunction` of S2E is compared with the results of the `solar intensity` of STK. + +#### 2. conditions for the verification +- Orbit + - The orbit of the ISS was used for verification. + - The TLE data are as follows. + ``` + 1 25544U 98067A 20250.86981481 .00000008 00000-0 82464-5 0 9991 + 2 25544 51.6470 304.2415 0002004 86.5035 251.6018 15.49214189244677 + ``` + +- Simulation time + - The simulation time is as follows. + ``` + //Simulation start date,[UTC] + StartYMDHMS=2020/09/13 12:00:00.0 + //Simulation finish time,[sec] + EndTimeSec=3600 + ``` + +#### 3. Results +- The calculation of the shadow function is verified. +Result_SRPEnvironment_shadowfunction ## 4. References diff --git a/Specifications/Environment/Spec_SimulationTime.md b/Specifications/Environment/Spec_SimulationTime.md index 5fbd2253..40cb7a79 100644 --- a/Specifications/Environment/Spec_SimulationTime.md +++ b/Specifications/Environment/Spec_SimulationTime.md @@ -1,28 +1,28 @@ # Specification for Simulation Time ## 1. Overview -1. Functions - + The `SimulationTime` class manages simulation time related information as follows. - - Start time of the simulation scenario - - Elapsed time of the simulation scenario - - Current time of the simulation scenario - - Update timing of calculations - - Attitude update, orbit update, thermal update, component update - - Update timing of log output and display output - - -2. Related files - + `src/environment/global/simulation_time.cpp, .hpp` - - `SimulationTime` class is defined. - - `src/environment/global/global_environment.cpp, .hpp` - - `SimulationTime` class is used here as a member variable of `GlobalEnvironment` class. - - `src/environment/global/initialize_global_environment.cpp, .hpp` - - `SimulationTime` class is instanced here based on the `simulation_base.ini` file. - - -3. How to use - - Call ` UpdateTime` function to increment time of the simulation scenario. - - Users can get time related information by using the getter functions. +### 1. Functions ++ The `SimulationTime` class manages simulation time related information as follows. + - Start time of the simulation scenario + - Elapsed time of the simulation scenario + - Current time of the simulation scenario + - Update timing of calculations + - Attitude update, orbit update, thermal update, component update + - Update timing of log output and display output + + +### 2. Related files ++ `src/environment/global/simulation_time.cpp, .hpp` + - `SimulationTime` class is defined. +- `src/environment/global/global_environment.cpp, .hpp` + - `SimulationTime` class is used here as a member variable of `GlobalEnvironment` class. +- `src/environment/global/initialize_global_environment.cpp, .hpp` + - `SimulationTime` class is instanced here based on the `simulation_base.ini` file. + + +### 3. How to use +- Call ` UpdateTime` function to increment time of the simulation scenario. +- Users can get time related information by using the getter functions. ## 3. Explanation of Algorithm - NA diff --git a/Specifications/Interface/Spec_PowerPort.md b/Specifications/Interface/Spec_PowerPort.md index 3b64f5d7..b808cddc 100644 --- a/Specifications/Interface/Spec_PowerPort.md +++ b/Specifications/Interface/Spec_PowerPort.md @@ -1,67 +1,69 @@ # Specification of Power Port ## 1. Overview -1. Functions - - `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: `power_port.cpp, .hpp` - - Referenced files: `component.cpp, .hpp` and `power_control_unit.cpp, .hpp` -3. How to use - - **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 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 OnBoardComputer(1, clock_gen, pcu_->GetPowerPort(0)); - ``` - - 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 `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. +### 1. Functions +- `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: `power_port.cpp, .hpp` +- Referenced files: `component.cpp, .hpp` and `power_control_unit.cpp, .hpp` + +### 3. How to use +- **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 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 OnBoardComputer(1, clock_gen, pcu_->GetPowerPort(0)); + ``` +- 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 `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 - 1. overview - - This function is a setter function of the supply voltage to the power port. - - Users can control the power switch by using this function. +### 1. SetVoltage +#### 1. overview +- This function is a setter function of the supply voltage to the power port. +- Users can control the power switch by using this function. - 2. inputs and outputs - - input: supply voltage to the port - - output: switch state of the port +#### 2. inputs and outputs +- input: supply voltage to the port +- output: switch state of the port - 3. algorithm - - After the voltage is set, the `Update` function is called to check that the supply voltage is enough to turn on the component. +#### 3. algorithm +- After the voltage is set, the `Update` function is called to check that the supply voltage is enough to turn on the component. - 4. note: N/A +#### 4. note: N/A -1. Update - 1. overview - - This is an update function of the switch state and the consumed current. - - This function also has an over-current protection feature. +### 1. Update +#### 1. overview +- This is an update function of the switch state and the consumed current. +- This function also has an over-current protection feature. - 2. inputs and outputs - - input: N/A (members of the class) - - output: switch state of the port +#### 2. inputs and outputs +- input: N/A (members of the class) +- output: switch state of the port - 3. algorithm - - When the supply voltage is larger than the `kMinimumVoltage` of the component, the switch state becomes `true`, and the consumed current is calculated as the following equation. - ```math - I = P/V - ``` - - The `P` is the `assumed_power_consumption`, and users can set the value with the `SetAssumedPowerConsumption` function. - - If the calculated current consumption is larger than the `kCurrentLimit`, the over-current protection feature is executed and turning the switch off. +#### 3. algorithm +- When the supply voltage is larger than the `kMinimumVoltage` of the component, the switch state becomes `true`, and the consumed current is calculated as the following equation. +```math +I = P/V +``` +- The `P` is the `assumed_power_consumption`, and users can set the value with the `SetAssumedPowerConsumption` function. +- If the calculated current consumption is larger than the `kCurrentLimit`, the over-current protection feature is executed and turning the switch off. - 4. note: N/A +#### 4. note: N/A ## 3. Results of verifications N/A diff --git a/Specifications/Simulation/Spec_GroundStation.md b/Specifications/Simulation/Spec_GroundStation.md index 38c6595c..431d34c4 100644 --- a/Specifications/Simulation/Spec_GroundStation.md +++ b/Specifications/Simulation/Spec_GroundStation.md @@ -2,22 +2,22 @@ ## 1. Overview -1. Functions - - The `GroundStation` class is the base class to define the following basic feature of ground stations. - - Position of the ground station - - Minimum elevation angle - - Visible flag for each spacecraft - - Users can make user defined ground station by inheriting this class. - -2. Related files - - `src/simulation/ground_station/ground_station.cpp, .hpp` - - The `GroundStation` class is defined here. - - `src/simulation/ground_station/sample_ground_station/sample_ground_station.cpp, .hpp` - - An example to make user defined ground station with the `GroundStation` class. - -3. How to use - - See [Sample Ground Station](./Spec_SampleGroundStation.md) - +### 1. Functions +- The `GroundStation` class is the base class to define the following basic feature of ground stations. + - Position of the ground station + - Minimum elevation angle + - Visible flag for each spacecraft +- Users can make user defined ground station by inheriting this class. + +### 2. Related files +- `src/simulation/ground_station/ground_station.cpp, .hpp` + - The `GroundStation` class is defined here. +- `src/simulation/ground_station/sample_ground_station/sample_ground_station.cpp, .hpp` + - An example to make user defined ground station with the `GroundStation` class. + +### 3. How to use +- See [Sample Ground Station](./Spec_SampleGroundStation.md) + ## 2. Explanation of Algorithm NA diff --git a/Specifications/Simulation/Spec_InstalledComponents.md b/Specifications/Simulation/Spec_InstalledComponents.md index 60262b3f..9d65f509 100644 --- a/Specifications/Simulation/Spec_InstalledComponents.md +++ b/Specifications/Simulation/Spec_InstalledComponents.md @@ -2,22 +2,22 @@ ## 1. Overview -1. Functions - - The `InstalledComponents` class is the base class to define the following interface functions for component list. - - Force and torque generation - - Log setup - - Users can make user defined component list by inheriting this class. +### 1. Functions +- The `InstalledComponents` class is the base class to define the following interface functions for component list. + - Force and torque generation + - Log setup +- Users can make user defined component list by inheriting this class. -2. Related files - - `src/simulation/spacecraft/installed_components.cpp, .hpp` - - The `InstalledComponents` class is defined here. - - `src/simulation/spacecraft/spacecraft.cpp, .hpp` - - The `InstalledComponents` class is used here. - - `src/simulation/spacecraft/sample_spacecraft/sample_components.cpp, .hpp` - - An example to make user defined component list with the `InstalledComponents` class. +### 2. Related files +- `src/simulation/spacecraft/installed_components.cpp, .hpp` + - The `InstalledComponents` class is defined here. +- `src/simulation/spacecraft/spacecraft.cpp, .hpp` + - The `InstalledComponents` class is used here. +- `src/simulation/spacecraft/sample_spacecraft/sample_components.cpp, .hpp` + - An example to make user defined component list with the `InstalledComponents` class. -3. How to use - - See [Sample Components](./Spec_SampleComponents.md) +### 3. How to use +- See [Sample Components](./Spec_SampleComponents.md) ## 2. Explanation of Algorithm NA diff --git a/Specifications/Simulation/Spec_MonteCarloSimulation.md b/Specifications/Simulation/Spec_MonteCarloSimulation.md index 1d0662b3..d822aa3f 100644 --- a/Specifications/Simulation/Spec_MonteCarloSimulation.md +++ b/Specifications/Simulation/Spec_MonteCarloSimulation.md @@ -2,20 +2,20 @@ ## 1. Overview -1. Functions - - The `Monte Carlo Simulation` feature of S2E provides a framework for Monte Carlo simulation +### 1. Functions +- The `Monte Carlo Simulation` feature of S2E provides a framework for Monte Carlo simulation -2. Related files(TBW) - - `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` +### 2. Related files(TBW) +- `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) - +### 3. How to use +- Read [How to use Monte Carlo simulation](../../Tutorials/HowToUseMonteCarloSimulation.md) + ## 2. Explanation of Algorithm TBW diff --git a/Specifications/Simulation/Spec_SampleCase.md b/Specifications/Simulation/Spec_SampleCase.md index f477f137..b4bfb2de 100644 --- a/Specifications/Simulation/Spec_SampleCase.md +++ b/Specifications/Simulation/Spec_SampleCase.md @@ -2,16 +2,16 @@ ## 1. Overview -1. Functions - - The `SampleCase` class is an example of making the user defined scenario with the `SimulationCase` class. +### 1. Functions +- The `SampleCase` class is an example of making the user defined scenario with the `SimulationCase` class. -2. Related files - - `src/simulation_sample/case/sample_case.cpp, .hpp` - - The `SampleCase` class is defined here. - - `src/simulation/case/simulation_case.cpp, .hpp` - - The `SimulationCase` class is defined here. - - `src/s2e.cpp` - - The instance of the `SampleCase` class is made in this main function. +### 2. Related files +- `src/simulation_sample/case/sample_case.cpp, .hpp` + - The `SampleCase` class is defined here. +- `src/simulation/case/simulation_case.cpp, .hpp` + - The `SimulationCase` class is defined here. +- `src/s2e.cpp` + - The instance of the `SampleCase` class is made in this main function. ## 2. How to make user defined simulation scenario - `sample_case.hpp` @@ -19,8 +19,8 @@ - Inherit the `SimulationCase` class. - Users need to define override functions for all pure virtual functions of the `SimulationCase` class. - Add spacecraft and/or ground station as users need into the member variables. - - If users simulate multiple spacecraft, users can add several spacecraft here. - - Multiple spacecraft case, you can refer the [s2e-ff](https://github.com/ut-issl/s2e-ff) + - If users simulate multiple spacecraft, users can add several spacecraft here. + - Multiple spacecraft case, you can refer the [s2e-ff](https://github.com/ut-issl/s2e-ff) - `sample_case.cpp` - Write detailed process of the override functions @@ -30,9 +30,9 @@ - Users need to `delete` your defined members `spacecraft` and `ground_station`. - `InitializeTargetObjects` function - You have to make instances of your `spacecraft` and `ground_station` class here. - - You also need to register log output by `LogSetup` function. + - You also need to register log output by `LogSetup` function. - `UpdateTargetObjects` function - - This function is called in the `SimulationCase::Main` function. + - This function is called in the `SimulationCase::Main` function. - Users can update their spacecraft and ground station classes here. - `GetLogHeader` and `GetLogValue` functions - These functions are used in the Monte-Carlo simulation mode. For the normal mode, you don't need to care. diff --git a/Specifications/Simulation/Spec_SampleGroundStation.md b/Specifications/Simulation/Spec_SampleGroundStation.md index e40451f6..b5e937c2 100644 --- a/Specifications/Simulation/Spec_SampleGroundStation.md +++ b/Specifications/Simulation/Spec_SampleGroundStation.md @@ -2,17 +2,16 @@ ## 1. Overview -1. Functions - - The `SampleGroundStation` class is is an example of making the user defined ground station with the `GroundStation` class. - -2. Related files - - `src/simulation_sample_/ground_station/sample_ground_station.cpp, .hpp` - - The `SampleGroundStation` class is defined here. - - `src/simulation/ground_station/ground_station.cpp, .hpp` - - The `GroundStation` class is defined here. - - `src/simulation_sample/case/sample_case.cpp, .hpp` - - The instance of the `SampleGroundStation` class is made in this class. - +### 1. Functions +- The `SampleGroundStation` class is is an example of making the user defined ground station with the `GroundStation` class. + +### 2. Related files +- `src/simulation_sample_/ground_station/sample_ground_station.cpp, .hpp` + - The `SampleGroundStation` class is defined here. +- `src/simulation/ground_station/ground_station.cpp, .hpp` + - The `GroundStation` class is defined here. +- `src/simulation_sample/case/sample_case.cpp, .hpp` + - The instance of the `SampleGroundStation` class is made in this class. ## 2. How to make user defined ground station - `sample_ground_station.hpp` diff --git a/Specifications/Simulation/Spec_SampleGroundStationComponents.md b/Specifications/Simulation/Spec_SampleGroundStationComponents.md index 4ddd91b3..e7344fdc 100644 --- a/Specifications/Simulation/Spec_SampleGroundStationComponents.md +++ b/Specifications/Simulation/Spec_SampleGroundStationComponents.md @@ -2,18 +2,18 @@ ## 1. Overview -1. Functions - - The `SampleGroundStationComponents` class is an example of component list mounted on the `SampleGroundStation`. +### 1. Functions +- The `SampleGroundStationComponents` class is an example of component list mounted on the `SampleGroundStation`. -2. Related files - - `src/simulation_sample/ground_station/sample_ground_station_components.cpp, .hpp` - - `SampleGroundStationComponents` is defined here. - - `src/simulation_sample/ground_station/sample_ground_station.cpp, .hpp` - - The instance of the `SampleGroundStationComponent` class is made in this class. +### 2. Related files +- `src/simulation_sample/ground_station/sample_ground_station_components.cpp, .hpp` + - `SampleGroundStationComponents` is defined here. +- `src/simulation_sample/ground_station/sample_ground_station.cpp, .hpp` + - The instance of the `SampleGroundStationComponent` class is made in this class. -3. How to use - - See [Sample Ground Station](./Spec_SampleGroundStation.md) because the `SampleGroundStationComponent` is used in the `SampleGroundStation`. - - Details: TBW +### 3. How to use +- See [Sample Ground Station](./Spec_SampleGroundStation.md) because the `SampleGroundStationComponent` is used in the `SampleGroundStation`. +- Details: TBW ## 2. Explanation of Algorithm TBW diff --git a/Specifications/Simulation/Spec_SampleSpacecraft.md b/Specifications/Simulation/Spec_SampleSpacecraft.md index f7c63990..eba7669b 100644 --- a/Specifications/Simulation/Spec_SampleSpacecraft.md +++ b/Specifications/Simulation/Spec_SampleSpacecraft.md @@ -2,16 +2,16 @@ ## 1. Overview -1. Functions - - The `SampleSpacecraft` class is is an example of making the user defined spacecraft with the `Spacecraft` class. - -2. Related files - - `src/simulation_sample/spacecraft/sample_spacecraft.cpp, .hpp` - - The `SampleSpacecraft` class is defined here. - - `src/simulation/spacecraft/spacecraft.cpp, .hpp` - - The `Spacecraft` class is defined here. - - `src/simulation_sample/case/sample_case.cpp, .hpp` - - The instance of the `SampleSpacecraft` class is made in this class. +### 1. Functions +- The `SampleSpacecraft` class is is an example of making the user defined spacecraft with the `Spacecraft` class. + +### 2. Related files +- `src/simulation_sample/spacecraft/sample_spacecraft.cpp, .hpp` + - The `SampleSpacecraft` class is defined here. +- `src/simulation/spacecraft/spacecraft.cpp, .hpp` + - The `Spacecraft` class is defined here. +- `src/simulation_sample/case/sample_case.cpp, .hpp` + - The instance of the `SampleSpacecraft` class is made in this class. ## 2. How to make user defined spacecraft diff --git a/Specifications/Simulation/Spec_SampleSpacecraftComponents.md b/Specifications/Simulation/Spec_SampleSpacecraftComponents.md index 79cc3510..502f276c 100644 --- a/Specifications/Simulation/Spec_SampleSpacecraftComponents.md +++ b/Specifications/Simulation/Spec_SampleSpacecraftComponents.md @@ -2,18 +2,18 @@ ## 1. Overview -1. Functions - - The `SampleSpacecraftComponents` class is an example of component list mounted on the `SampleSpacecraft`. - -2. Related files - - `src/simulation_sample/spacecraft/sample_spacecraft_components.cpp, .hpp` - - `SampleSpacecraftComponents` is defined here. - - `src/simulation_sample/spacecraft/sample_ground_station.cpp, .hpp` - - The instance of the `SampleSpacecraftComponent` class is made in this class. - -3. How to use - - See [Sample Spacecraft](./Spec_Samplespacecraft.md) because the `SampleSpacecraftComponent` is used in the `SampleSpacecraft`. - - Details: TBW +### 1. Functions +- The `SampleSpacecraftComponents` class is an example of component list mounted on the `SampleSpacecraft`. + +### 2. Related files +- `src/simulation_sample/spacecraft/sample_spacecraft_components.cpp, .hpp` + - `SampleSpacecraftComponents` is defined here. +- `src/simulation_sample/spacecraft/sample_ground_station.cpp, .hpp` + - The instance of the `SampleSpacecraftComponent` class is made in this class. + +### 3. How to use +- See [Sample Spacecraft](./Spec_Samplespacecraft.md) because the `SampleSpacecraftComponent` is used in the `SampleSpacecraft`. +- Details: TBW ## 2. How to make user defined components list installed on spacecraft - `sample_components.hpp` diff --git a/Specifications/Simulation/Spec_SimulationCase.md b/Specifications/Simulation/Spec_SimulationCase.md index 3825b729..fed6cfe9 100644 --- a/Specifications/Simulation/Spec_SimulationCase.md +++ b/Specifications/Simulation/Spec_SimulationCase.md @@ -2,23 +2,23 @@ ## 1. Overview -1. Functions - - The `SimulationCase` class is the base class to define the simulation scenario. - - Users can make user defined simulation scenario by inheriting this class. - -2. Related files - - `src/simulation/case/simulation_case.cpp, .hpp` - - The `SimulationCase` class is defined here. - - `src/simulation/case/sample_case.cpp, .hpp` - - An example to make user defined scenario with the `SimulationCase` class. - - `src/s2e.cpp` - - The instance of the `SimulationCase` class is made in this main function. - -3. How to use - - See the following documents - - [How To Make New Simulation Scenario](../../Tutorials/HowToMakeNewSimulationScenario.md) - - [Sample Case](./Spec_SampleCase.md.md) - +### 1. Functions +- The `SimulationCase` class is the base class to define the simulation scenario. +- Users can make user defined simulation scenario by inheriting this class. + +### 2. Related files +- `src/simulation/case/simulation_case.cpp, .hpp` + - The `SimulationCase` class is defined here. +- `src/simulation/case/sample_case.cpp, .hpp` + - An example to make user defined scenario with the `SimulationCase` class. +- `src/s2e.cpp` + - The instance of the `SimulationCase` class is made in this main function. + +### 3. How to use +- See the following documents + - [How To Make New Simulation Scenario](../../Tutorials/HowToMakeNewSimulationScenario.md) + - [Sample Case](./Spec_SampleCase.md.md) + ## 2. Explanation of Algorithm NA diff --git a/Specifications/Simulation/Spec_SimulationConfiguration.md b/Specifications/Simulation/Spec_SimulationConfiguration.md index 490a0b20..d39a7947 100644 --- a/Specifications/Simulation/Spec_SimulationConfiguration.md +++ b/Specifications/Simulation/Spec_SimulationConfiguration.md @@ -2,29 +2,29 @@ ## 1. Overview -1. Functions - - `SimulationConfiguration` is a structure for simulation setting parameters. - - Parameters - - Input/Output - - initialize_base_file_name_ - - main_logger_ - - Spacecraft - - number_of_simulated_spacecraft_ - - spacecraft_file_list_ - - Ground Station - - number_of_simulated_ground_station_ - - ground_station_file_list_ - - Others - - inter_sc_communication_file_ - - gnss_file_ +### 1. Functions +- `SimulationConfiguration` is a structure for simulation setting parameters. +- Parameters + - Input/Output + - initialize_base_file_name_ + - main_logger_ + - Spacecraft + - number_of_simulated_spacecraft_ + - spacecraft_file_list_ + - Ground Station + - number_of_simulated_ground_station_ + - ground_station_file_list_ + - Others + - inter_sc_communication_file_ + - gnss_file_ -2. Related files - - `src/simulation/simulation_configuration.hpp` - - The `SimulationConfiguration` structure is defined here. +### 2. Related files +- `src/simulation/simulation_configuration.hpp` + - The `SimulationConfiguration` structure is defined here. -3. How to use - - The `SimulationConfiguration` is initialized in the beginning of the simulation case. - - In other process, the `SimulationConfiguration` is used as read only to share the simulation setting parameters. +### 3. How to use +- The `SimulationConfiguration` is initialized in the beginning of the simulation case. +- In other process, the `SimulationConfiguration` is used as read only to share the simulation setting parameters. ## 2. Explanation of Algorithm NA diff --git a/Specifications/Simulation/Spec_Spacecraft.md b/Specifications/Simulation/Spec_Spacecraft.md index daa42294..935437a6 100644 --- a/Specifications/Simulation/Spec_Spacecraft.md +++ b/Specifications/Simulation/Spec_Spacecraft.md @@ -2,60 +2,62 @@ ## 1. Overview -1. Functions - - The `Spacecraft` class is the base class to define the following basic features of spacecraft. - - Component information - - Clock Generator - - The base class of components (`InstalledComponents`) - - Dynamics information - - Attitude - - Orbit - - Thermal - - Relative Information - - Local environment - - Disturbance - - Structure - - Users can make user defined spacecraft by inheriting this class. +### 1. Functions +- The `Spacecraft` class is the base class to define the following basic features of spacecraft. + - Component information + - Clock Generator + - The base class of components (`InstalledComponents`) + - Dynamics information + - Attitude + - Orbit + - Thermal + - Relative Information + - Local environment + - Disturbance + - Structure +- Users can make user defined spacecraft by inheriting this class. -2. Related files - - `src/simulation/spacecraft/spacecraft.cpp, .hpp` - - The `Spacecraft` class is defined here. - - `src/simulation/spacecraft/sample_spacecraft/sample_spacecraft.cpp, .hpp` - - An example to make user defined spacecraft with the `Spacecraft` class. +### 2. Related files +- `src/simulation/spacecraft/spacecraft.cpp, .hpp` + - The `Spacecraft` class is defined here. +- `src/simulation/spacecraft/sample_spacecraft/sample_spacecraft.cpp, .hpp` + - An example to make user defined spacecraft with the `Spacecraft` class. -3. How to use - - See [Sample Spacecraft](./Spec_SampleSpacecraft.md) - - Usually, users just need to consider the user defined components. The disturbance, dynamics of the spacecraft, and etc are already considered in this base class. +### 3. How to use +- See [Sample Spacecraft](./Spec_SampleSpacecraft.md) +- Usually, users just need to consider the user defined components. The disturbance, dynamics of the spacecraft, and etc are already considered in this base class. ## 2. Explanation of Algorithm -1. `Initialize` function - 1. overview - - Initialize all members - - There are two functions with same name - - One is for single satellite case - - The other is for multiple satellite case to consider relative information +### 1. `Initialize` function +#### 1. overview +- Initialize all members +- There are two functions with same name + - One is for single satellite case + - The other is for multiple satellite case to consider relative information -1. `Update` function - 1. overview - - Update states or calculations for spacecraft - 2. inputs and outputs - - Input - - Simulation time - - Output - - NA - 3. algorithm - 1. Clear the force and torque acting on the spacecraft to zero. - 1. Update the local environment around the spacecraft - - The previous spacecraft position and attitude are used. - 1. Update the disturbance acting on the spacecraft - - The local environment information and the previous spacecraft position and attitude are used. - 1. Update the components behavior mounted on the spacecraft - - The components measure the state or generate force/torque. - 1. Add force and torque acting on the spacecraft - - The force and torque from the disturbances - - The force and torque from the components - 1. Propagate the dynamics of the spacecraft - - Attitude and Orbit +### 1. `Update` function +#### 1. overview +- Update states or calculations for spacecraft + +#### 2. inputs and outputs +- Input + - Simulation time +- Output + - NA + +#### 3. algorithm +1. Clear the force and torque acting on the spacecraft to zero. +1. Update the local environment around the spacecraft + - The previous spacecraft position and attitude are used. +1. Update the disturbance acting on the spacecraft + - The local environment information and the previous spacecraft position and attitude are used. +1. Update the components behavior mounted on the spacecraft + - The components measure the state or generate force/torque. +1. Add force and torque acting on the spacecraft + - The force and torque from the disturbances + - The force and torque from the components +1. Propagate the dynamics of the spacecraft + - Attitude and Orbit ## 3. Results of verifications NA diff --git a/Specifications/Simulation/Spec_Structure.md b/Specifications/Simulation/Spec_Structure.md index 17e9e808..899af653 100644 --- a/Specifications/Simulation/Spec_Structure.md +++ b/Specifications/Simulation/Spec_Structure.md @@ -2,21 +2,21 @@ ## 1. Overview -1. Functions - - The `Structure` class integrates the following structure information of spacecraft. - - Kinematic Information - - Surface - - Residual Magnetic Moment +### 1. Functions +- The `Structure` class integrates the following structure information of spacecraft. + - Kinematic Information + - Surface + - Residual Magnetic Moment -2. Related files - - `src/simulation/spacecraft/structure/structure.cpp, .hpp` - - The `Structure` class is defined here. - - `src/simulation/spacecraft/spacecraft.cpp, .hpp` - - The `Structure` class is used here. +### 2. Related files +- `src/simulation/spacecraft/structure/structure.cpp, .hpp` + - The `Structure` class is defined here. +- `src/simulation/spacecraft/spacecraft.cpp, .hpp` + - The `Structure` class is used here. -3. How to use - - This class is used in the `Spacecraft` class and users usually don't need to care. - - If users need to change the `Structure` during the simulation, please see [Example Change Structure](TBW) +### 3. How to use +- This class is used in the `Spacecraft` class and users usually don't need to care. +- If users need to change the `Structure` during the simulation, please see [Example Change Structure](TBW) ## 2. Explanation of Algorithm NA diff --git a/Tutorials/GettingStarted.md b/Tutorials/GettingStarted.md index 235ef4fd..5083dcfa 100644 --- a/Tutorials/GettingStarted.md +++ b/Tutorials/GettingStarted.md @@ -37,10 +37,11 @@ - In this base file, other initialize files are defined. - You can see simulation conditions as time definitions, randomize seed definitions, etc. 4. Open `sample_satellite.ini`, which is the file to set the spacecraft parameters. -4. Edit the value of angular momentum `initial_angular_velocity_b_rad_s(0-2)` in the `[Attitude]` section as you want. -5. Rerun the `s2e-core` **without a rebuild** -6. Check the new log file in `./data/sample/logs` to confirm the initial angular velocity is changed as you want. -7. Of course, you can change other values similarly. +5. Edit the value of angular momentum `initial_angular_velocity_b_rad_s(0-2)` in the `[Attitude]` section as you want. +6. Set the value of `initialize_mode` to `MANUAL` if it is `CONTROLLED`. +7. Rerun the `s2e-core` **without a rebuild** +8. Check the new log file in `./data/sample/logs` to confirm the initial angular velocity is changed as you want. +9. Of course, you can change other values similarly. ## 5. Edit Simulation Conditions: Disturbances