Skip to content

Commit

Permalink
Merge pull request #90 from ut-issl/feature/update-component-document…
Browse files Browse the repository at this point in the history
…s-v7

Update component documents for v7
  • Loading branch information
200km authored Nov 7, 2023
2 parents e7308a1 + 1a2b54b commit 909eb5d
Show file tree
Hide file tree
Showing 9 changed files with 114 additions and 127 deletions.
18 changes: 9 additions & 9 deletions Specifications/Component/AOCS/Spec_RWJitter.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Specification for RW jitter
# Specification for ReactionWheelJitter class

## 1. Overview
- `RWJitter` class simulates the high-frequency jitter of Reaction Wheels.
- `ReactionWheelJitter` class simulates the high-frequency jitter of Reaction Wheels.
- This class uses:
+ Angular velocity of the RW
+ Parameters of RW disturbance measured by experiments
Expand All @@ -10,31 +10,31 @@
+ RW jitter forces and torques in the body frame

1. functions
- `CalcJitter(double angular_velocity)`
+ Simulates the jitter
- `CalcJitter`
+ Simulates the reaction wheel jitter
+ (If Enabled) Calls `AddStructuralResonance()`. This function adds the effect of structural resonance to the high-frequency disturbance of RW. You can choose to consider the effect of structural resonance or not.

2. files
- `RWJitter.cpp`, `RWJitter.h`
- `RW.ini`
- `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 `RW.ini`
- Set parameters in `reaction_wheel.ini`
- When only the static imbalance and dynamic imbalance(correspond to $C_i$ at $h_i\ne1$) is known according to the spec sheet, edit the files as follows.
+ `radial_force_harmonics_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.
+ `RW.ini`
+ `reaction_wheel.ini`
* Set `harmonics_degree = 1`.
- Set the jitter update period to an appropriate value.
+ Jitter update period is equal to the product of `CompoUpdateIntervalSec` in `simulation_base.ini` and `fast_prescaler` in `RW.ini`.
+ Jitter update period is equal to the product of `CompoUpdateIntervalSec` in `simulation_base.ini` and `fast_prescaler` in `reaction_wheel.ini`.
+ For correct calculation, the update period of the jitter should be set to approximately 0.1ms.
+ A larger update period is not a problem, but it will cause aliasing in the jitter waveform.

Expand Down
15 changes: 7 additions & 8 deletions Specifications/Component/AOCS/Spec_STT.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
# Specification for Attitude Dynamics
# Specification for StarSensor class

## 1. Overview
1. functions
- `STT` class simulates a star sensor.
- The `STT` class calculates and returns the observed quaternions and error flags.
- `StarSensor` class simulates a star sensor.
- The `StarSensor` class calculates and returns the observed quaternions and error flags.

2. files
- STT.cpp, STT.h : Definitions and declarations of the class
- InitSTT.cpp : Interface functions for the initialization of `STT` class
- STT.ini : Initialization file
- `star_sensor.cpp, star_sensor.hpp` : Definitions and declarations of the class
- `star_sensor.ini` : Initialization file

3. how to use
- Set the parameters in `STT.ini`.
- Create an instance by using the initialization function `InitSTT`
- Set the parameters in `star_sensor.ini`.
- Create an instance by using the initialization function `InitStarSensor`
- Use `Get*` function to get quaternion information.


Expand Down
8 changes: 4 additions & 4 deletions Specifications/Component/Abstract/Spec_ComponentBase.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# Specification of ComponentBase class
# Specification of Component class

## 1. Overview
1. Functions
- The `ComponentBase` class is an abstract class to handle the electrical power and the update timing of components.
- The `Component` class is an abstract class to handle the electrical power and the update timing of components.
- This class has two virtual functions: `MainRoutine` and `FastUpdate`. Both are called periodically. Users can select the functions according to the required calling period.
+ The `MainRoutine` function is the components' main function. Most of the processing is handled in this function.
+ The `FastUpdate` function handles the processes that need to be computed in a high-speed cycle. So, users will use this function only when high-frequency disturbances need to be calculated (e.g., RW jitter).

2. Related Files
- Main file: `ComponentBase.h`, `ComponentBase.cpp`
- Main file: `component.hpp`, `component.cpp`

3. How to use
- Inherit this class by the user's component class.
- The `RWModel` in `S2E_CORE` is useful as a usage example of the `FastUpdate`.
- The `ReactionWheel` in `S2E_CORE` is useful as a usage example of the `FastUpdate`.

## 2. Explanation of Algorithm
1. Constructor
Expand Down
20 changes: 10 additions & 10 deletions Specifications/Component/Abstract/Spec_ObcCommunicationBase.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Specification of ObcCommunicationBase class
# Specification of UartCommunicationWithObc class

## 1. Overview
1. Functions
- The `ObcCommunicationBase` class is an abstract class to communicate with `OBC`.
- Component classes can use this abstract class to emulate telemetry/command communication with an `OBC`.
- This class also supports communication with `C2A` in the `OBC_C2A` class.
- The `UartCommunicationWithObc` class is an abstract class to communicate with `OnBoardComputer`.
- Component classes can use this abstract class to emulate telemetry/command communication with an `OnBoardComputer`.
- This class also supports communication with `C2A` in the `ObcWithC2a` class.
2. Related files
- OBC.c, h
- EXP.c, h
- on_board_computer.cpp, hpp
- example_serial_communication_with_obc.cpp, hpp
- Users can find an example of using this class.
3. How to use
- Inherit this class by component class.
- Users need to set `port_id` and target `OBC` for the communication.
- Users need to set `sils_port_id` and target `OnBoardComputer` for the communication.
- This class has the following protected functions for telemetry/command communication. Users can call these functions in the `MainRoutine` of the component.
```cpp
int ReceiveCommand(const int offset, const int rec_size);
Expand All @@ -26,12 +26,12 @@
## 2. Explanation of Algorithm
1. Constructors
1. overview
- In the constructors, the communication port for the `OBC` is connected.
- In the constructors, the communication port for the `OnBoardComputer` is connected.
- If another component already connects the port, the connection function returns an error, and the constructors output a message.
2. inputs and outputs
- Both constructors require `port_id` and target `OBC`.
- Both constructors require `sils_port_id` and target `OnBoardComputer`.
- Users can set the communication data buffer size. When users do not put the size, the value is automatically set as the maximum value.
- The maximum value is 1024, and it is defined in `SCIPort.h`
- The maximum value is 1024, and it is defined in `uart_port.hpp`
3. algorithm
- N/A
4. note
Expand Down
44 changes: 22 additions & 22 deletions Specifications/Component/Abstract/Spec_SensorBase.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# Specification of SensorBase class
# Specification of Sensor class

## 1. Overview
1. Functions
- The `SensorBase` class is a base class to provide common features for sensors.
- The `Sensor` class is a base class to provide common features for sensors.
- This class adds the following noises and output limits.
- Constant offset noise
- Normal random noise
- Random Walk noise
- Scale factor noise and cross-talk between axes

2. Related files
- Main file: `SensorBase.cpp, .h`
- Used Libraries: `Vector.h`, `Matrix.h`, `NormalRand.h`, `RandomWalk.h`
- Main file: `sensor_base.cpp, .hpp`
- Used Libraries: `vector.hpp`, `matrix.hpp`, `normal_randomization.hpp`, `random_walk.hpp`

3. How to use
- Inherit this class by your sensor class.
- The `GYRO` and `MagSensor` in `S2E_CORE` are useful as usage examples.
- The `GyroSensor` and `Magnetometer` in `S2E_CORE` are useful as usage examples.

## 2. Explanation of Algorithm
1. Constructor
Expand All @@ -28,13 +28,13 @@
- `range_to_zero_c`: The output is set as zero when the true value is larger than this value.
- This feature is optional. If you don't want to use the value, please set this huge value.
- `range_to_zero_c` should be larger than `range_to_const_c`.
- `bias_c`: Constant offset noise
- `nr_stddev_c`: Standard deviation for normal random noise
- `bias_noise_c`: Constant offset noise
- `normal_random_standard_deviation_c`: Standard deviation for normal random noise
- Random Walk noise parameters
- `rw_stepwidth`: Step width for Random Walk propagation (unit: sec)
- `random_walk_step_width_s`: Step width for Random Walk propagation (unit: sec)
- It should be the same as the update frequency of the sensor.
- `rw_stddev_c`: Standard deviation for Random Walk
- `rw_limit_c`: Soft limit of Random Walk
- `random_walk_standard_deviation_c`: Standard deviation for Random Walk
- `random_walk_limit_c`: Soft limit of Random Walk
- **Note**: The number of elements for all parameters can be set by using the `template` feature.
- **Note**: All parameters are defined in the component frame.
- **Note**: Normally, the unit of the parameters is the same as the unit of true value. Users also can change the unit by using the scale factor matrix.
Expand All @@ -53,28 +53,28 @@
4. note
- N/A
## 3. Results of verifications
- We verified the `SensorBase` class with the following parameters.
- We verified the `Sensor` class with the following parameters.
- Default parameters
- `scale_factor` = Unit matrix
- `range_to_const_c` = 5
- `range_to_zero_c` = 10
- `bias_c` = 0.0
- `nr_stddev_c` = 0.0
- `rw_stepwidth`= 0.1 sec
- `rw_stddev_c` = 0.0
- `rw_limit_c` = 0.0
- `bias_noise_c` = 0.0
- `normal_random_standard_deviation_c` = 0.0
- `random_walk_step_width_s`= 0.1 sec
- `random_walk_standard_deviation_c` = 0.0
- `random_walk_limit_c` = 0.0
- input value: 0.0
- Case 1: `bias_c` = 1.0, others = default
- Case 1: `bias_noise_c` = 1.0, others = default
- The bottom figure shows the result of the output data.
- We verified the constant offset noise calculation is correct according to the data.
<div align="center">
<figure id="bias_1">
<img src="./figs/bias_1.png" width=400>
<figcaption>Result of constant offset noise (bias_c = 1.0).</figcaption>
<figcaption>Result of constant offset noise (bias_noise_c = 1.0).</figcaption>
</figure>
</div>

- Case 2: `nr_stddev_c` = 1.0, others = default
- Case 2: `normal_random_standard_deviation_c` = 1.0, others = default
- The simulation time is 1000sec, and the log output period is 0.1sec.
- The bottom figure shows the result of the output data.
- The calculated average and standard deviation from the output data are shown as follows.
Expand All @@ -84,11 +84,11 @@
<div align="center">
<figure id="normal_random_noise_1">
<img src="./figs/normal_random_noise_1.png" width=400>
<figcaption>Result of normal random noise (nr_stddev_c = 1.0).</figcaption>
<figcaption>Result of normal random noise (normal_random_standard_deviation_c = 1.0).</figcaption>
</figure>
</div>

- Case 3: `rw_stddev_c` = 0.3, `rw_limit_c` = 0.05, others = default
- Case 3: `random_walk_standard_deviation_c` = 0.3, `random_walk_limit_c` = 0.05, others = default
- The simulation time is 200sec, and the log output period is 0.5sec.
- The bottom figure shows the result of the output data.
- The output data randomly varies inside the limit value.
Expand All @@ -97,7 +97,7 @@
<div align="center">
<figure id="random_walk_03_005">
<img src="./figs/random_walk_03_005.png" width=400>
<figcaption>Result of Random Walk noise (rw_stddev_c = 0.3, rw_limit_c = 0.05).</figcaption>
<figcaption>Result of Random Walk noise (random_walk_standard_deviation_c = 0.3, random_walk_limit_c = 0.05).</figcaption>
</figure>
</div>

Expand Down
39 changes: 17 additions & 22 deletions Specifications/Component/Mission/Spec_Telescope_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,20 @@
- output position of its image on the image sensor, if it is in the field of view.
+ `ObserveStars`
* Function to output some HIP IDs of the brightest stars in the field of view, using `HipparcosCatalogue`.
* Specify how many stars this function outputs in `Telescope.ini`.
* Specify how many stars this function outputs in `telescope.ini`.


2. files
- `Telescope.cpp` , `Telescope.h`
- `telescope.cpp` , `telescope.hpp`
+ Definitions and declarations of the class
- `InitTelescope.cpp`
+ Interface functions for the initialization
- `HipparcosCatalogue.cpp` , `HipparcosCatalogue.h`
- `hipparcos_catalogue.cpp` , `hipparcos_catalogue.hpp`
+ Definitions and declarations of the class to read Hipparcos catalogue.
- `InitHipparcosCatalogue.cpp`
+ Interface functions for the initialization of the `HipparcosCatalogue`

3. how to use
- Set the parameters in `Telescope.ini`
- Create instance by using initialization function `InitTelescope`
- Set the parameters in `telescope.ini`
- Create instance by using initialization function `InitTelescope`.
+ Each telescope is numbered as "Telescope1,…"
- To use `HipparcosCatalogue` data, `hip_main.csv` is necessary. `s2e-core/scripts/download_HIPcatalogue.sh` is the script to download it. Run the following code using Git bash in `s2e-core/scripts/`:
- To use `HipparcosCatalogue` data, `hip_main.csv` is necessary. `s2e-core/scripts/Common/download_HIPcatalogue.sh` is the script to download it. Run the following code using Git bash in `s2e-core/scripts/`:
```
bash download_HIPcatalogue.sh
```
Expand All @@ -47,26 +43,26 @@
2. input and output
- input
+ The position vector of the celestial body in the body-fixed coordinate.
* This position vector is provided by `CelesInfo`.
* This position vector is provided by `CelestialInformation`.
+ The forbidden angle about the celestial body
+ Specify the forbidden angle in `Telescope.ini`.
+ Specify the forbidden angle in `telescope.ini`.
- output
+ true: The celestial body is in forbidden angle
+ false: The celestial body is not in forbidden angle
3. process to judge
- The judging process is calculated in the telescope's component coordinate. $q_{b2c}$ is the quaternion to convert from the body coordinate(B) to the component coordinate(C). Specify $q_{b2c}$ in `Telescope.ini`. The X-axis of the component coordinate is defined as the line of sight of the telescope.
- The judging process is calculated in the telescope's component coordinate. $q_{b2c}$ is the quaternion to convert from the body coordinate(B) to the component coordinate(C). Specify $q_{b2c}$ in `telescope.ini`. The X-axis of the component coordinate is defined as the line of sight of the telescope.
2. `Observe`
1. overview
- This function judges whether the celestial bodies(provided by `CelesInfo`) are in the field of view and outputs the position of them on the image sensor if they are in the field of view
- This function judges whether the celestial bodies(provided by `CelestialInformation`) are in the field of view and outputs the position of them on the image sensor if they are in the field of view
- If they are not in the field of view, this function outputs $(-1,-1)$.
2. input and output
- input
+ The reference to the position of the celestial body on the image sensor
+ The position vector of the celestial body in the body-fixed coordinate
* `CelesInfo` provides the position vector.
* `CelestialInformation` provides the position vector.
- output
+ (void)
* This function rewrites the "reference to the celestial body's position on the image sensor" given as the input.
Expand Down Expand Up @@ -135,17 +131,16 @@ In this section, the output of the functions when some angular velocity is input
- input $ω_b=[0.1~0~0]^T$ .
2. conditions for the verification
1. input files
- `SampleSimBase.ini`
- `Telescope.ini`
- `SampleEnvironment.ini`
- `sample_simulation_base.ini`
- `telescope.ini`
2. initial condition
- `SampleSimBase.ini`
- `sample_simulation_base.ini`
```
Simulation start date[UTC] : 2017/12/01 11:00:00.0
Simulation finish time[sec] : 1500
Quaternion : q_i2b=[0 0 0 1]^T
```
- `Telescope.ini`
- `telescope.ini`
```
q_b2c=[0 0 0 1]^T
sun_forbidden_angle = 60
Expand All @@ -156,15 +151,15 @@ In this section, the output of the functions when some angular velocity is input
x_fov_par_pix = 0.02
y_fov_par_pix = 0.02
```
- `SampleEnvironment.ini`
- `sample_simulation_base.ini`
```
[HIPPARCOS_CATALOGUE]
max_magnitude = 5.0
calculation = ENABLE
logging = DISABLE
```
The disturbance torque in the main function of `SampleCase.cpp` is commented out.
The disturbance torque in the main function of `sample_case.cpp` is commented out.
3. result
1. judge for forbidden angle
Expand Down
Loading

0 comments on commit 909eb5d

Please sign in to comment.