Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 36 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- The branch construction
- main
- Documents for the latest stable version of s2e-core
- The Current version supports [s2e-core v7.2.0](https://github.com/ut-issl/s2e-core/releases/tag/v7.2.0)
- The Current version supports [s2e-core v8.0.0](https://github.com/ut-issl/s2e-core/releases/tag/v8.0.0)
- If there are several patch update versions, please use the latest one to avoid bugs.
- The old versions are managed with `release/tag/v.*.*.*`
- The `major` version number is compatible with s2e-core's `major` version number.
Expand Down Expand Up @@ -231,6 +231,7 @@
1. [Overview of Attitude Calculation](./Specifications/Dynamics/Spec_Attitude.md)
1. [Attitude RK4](./Specifications/Dynamics/Spec_Rk4Attitude.md)
1. [Controlled Attitude](./Specifications/Dynamics/Spec_ControlledAttitude.md)
1. Attitude with Cantilever Vibration: TBW

1. Orbit
1. [Overview of Orbit calculation](./Specifications/Dynamics/Spec_Orbit.md)
Expand Down Expand Up @@ -278,31 +279,34 @@
1. [Atmosphere](./Specifications/Environment/Spec_Atmosphere.md)
1. [Geomagnetic field](./Specifications/Environment/Spec_GeomagneticField.md)
1. [Solar Radiation Pressure Environment](./Specifications/Environment/Spec_SRPEnvironment.md)
1. Earth Albedo: TBW

</details>

1. <details><summary> Library </summary>
1. <details><summary> Logger </summary>

1. Loggable: TBW
1. Log Utility: TBW
1. Logger: TBW

</details>

1. <details><summary> Math Physics </summary>

1. Atmosphere
1. Simple air density model: TBW
1. Harris-Priester model: TBW

1. Communication
1. COM port interface: TBW
1. NRLMSISE00: TBW

1. Control Utilities
1. First order lag: TBW

1. External
- External library-related source codes.
1. IGRF (International Geomagnetic Reference Field): TBW
1. inih: TBW
1. nrlmsise00: TBW
1. sgp4: TBW

1. Geodesy
1. Geodetic Position: TBW

1. Geomagnetic
1. IGRF (International Geomagnetic Reference Field): TBW

1. GNSS (Global Navigation Satellite System)
1. ANTEX file reader: TBW
1. Bias SINEX file reader: TBW
Expand All @@ -312,16 +316,6 @@
1. Gravity
1. Gravity potential: TBW

1. Initialize
1. Initialize file access: TBW
1. WINGS operation file: TBW
1. C2A command database: TBW

1. Logger
1. Loggable: TBW
1. Log Utility: TBW
1. Logger: TBW

1. <details><summary> math </summary>

1. Constants: TBW
Expand Down Expand Up @@ -353,6 +347,7 @@
1. Orbital Elements: TBW
1. Relative Orbit Models: TBW
1. Interpolation orbit: TBW
1. sgp4: TBW

1. Planet rotation
1. Moon rotation utilities: TBW
Expand All @@ -363,16 +358,17 @@
1. Minimal standard linear congruential generator: TBW
1. Minimal standard linear congruential generator with shuffle: TBW
1. Random walk: TBW

1. utilities
1. Endian: TBW
1. Macros: TBW
1. Quantization: TBW
1. Ring Buffer: TBW
1. SLIP: TBW

</details>

1. <details><summary> Setting file reader </summary>

1. Initialize file access: TBW
1. WINGS operation file: TBW
1. C2A command database: TBW

</details>

1. <details><summary> Simulation </summary>

- `simulation` directory manages source codes to define the simulation scenario.
Expand Down Expand Up @@ -422,4 +418,15 @@

</details>

1. <details><summary> Utilities </summary>

1. Endian: TBW
1. Macros: TBW
1. Quantization: TBW
1. Ring Buffer: TBW
1. SLIP: TBW
1. COM port interface: TBW

</details>

1. [Troubleshooting](./General/Troubleshooting.md)
28 changes: 15 additions & 13 deletions Tutorials/GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

## 3. Check log output

1. Check `./data/sample/logs` to find CSV log output file
1. Check `./logs` to find CSV log output file
- The file name includes executed time as `YYMMDD_HHMMSS_default.csv`
- The included executed time is defined by the user computer settings.
2. Open the CSV log file
Expand All @@ -31,33 +31,34 @@

## 4. Edit Simulation Conditions

1. Move to `./data/sample/initialize_files` directory
1. Move to `./settings` directory
2. You can find the several **initialize** files ([INI files](https://en.wikipedia.org/wiki/INI_file)). In these initialize files, simulation conditions are defined, and you can change the conditions without rebuild of S2E by editing the initialize files.
3. Open `sample_simulation_base.ini`, which is the base file of the initialize files.
- In this base file, other initialize files are defined.
- You can see simulation conditions as time definitions, randomize seed definitions, etc.
4. Open `sample_satellite.ini`, which is the file to set the spacecraft parameters.
4. Open `./sample_satellite/satellite.ini`, which is the file to set the spacecraft parameters.
5. Edit the value of angular momentum `initial_angular_velocity_b_rad_s(0-2)` in the `[Attitude]` section as you want.
6. Set the value of `initialize_mode` to `MANUAL` if it is `CONTROLLED`.
7. Rerun the `s2e-core` **without a rebuild**
8. Check the new log file in `./data/sample/logs` to confirm the initial angular velocity is changed as you want.
8. Check the new log file in `./logs` to confirm the initial angular velocity is changed as you want.
9. Of course, you can change other values similarly.

## 5. Edit Simulation Conditions: Disturbances

1. Move to `./data/sample/ini` directory again
2. Open `sample_disturbance.ini`, which defines conditions to calculate orbital disturbance torques and forces
1. Move to `./settings` directory again
2. Open `./sample_satellite/disturbance.ini`, which defines conditions to calculate orbital disturbance torques and forces
- Currently, S2E supports the following disturbances:
- Gravity Gradient torque
- Magnetic Disturbance torque
- Air drag torque and force
- Solar radiation pressure torque and force
- Geo Potential acceleration
- Lunar Gravity Field
- Third body gravity acceleration
3. You can select `ENABLE` or `DISABLE` of calculation and log output for each disturbance
4. Edit all `calculation` parameters of each disturbance as `calculation = DISABLE`
5. Rerun the `s2e-core` **without a rebuild**
6. Check the new log file in `./data/sample/logs` to confirm the spacecraft is not affected by any disturbance torque and the angular velocity and quaternion are not changed. You can also plot by following command and see all the disturbance torque and force are zero. (assuming you already created a `pipenv` virtual environment)
6. Check the new log file in `./logs` to confirm the spacecraft is not affected by any disturbance torque and the angular velocity and quaternion are not changed. You can also plot by following command and see all the disturbance torque and force are zero. (assuming you already created a `pipenv` virtual environment)
```
# Windows
cd scripts/Plot
Expand All @@ -70,8 +71,8 @@

## 6. Edit Simulation Conditions: Orbit

1. Move to `./data/sample/ini` directory
1. Open `sample_satellite.ini` and see the `[Orbit]` section, which defines conditions to calculate orbit motion
1. Move to `./settings` directory
1. Open `./sample_satellite/satellite.ini` and see the `[Orbit]` section, which defines conditions to calculate orbit motion
- Currently, S2E supports several types of orbit propagation. Please see [Orbit](./Specifications/Dynamics/Spec_Orbit.md) specification documents for more details.
1. Please set the parameters as follow:
- `propagate_mode = SGP4`: SGP4 Propagator
Expand All @@ -97,20 +98,21 @@
tle2=2 33493 98.2516 327.9413 0016885 9.3461 350.8072 15.01563916753462
```
1. Rerun the `s2e-core` **without a rebuild**
1. Check the new log file in `./data/sample/logs` to confirm the spacecraft position in ECI frame `spacecraft_position_i` is changed.
1. Check the new log file in `./logs` to confirm the spacecraft position in ECI frame `spacecraft_position_i` is changed.
1. To visualize the orbit result, execute the `plot_satellite_orbit_on_miller.py` and `plot_orbit_eci.py`. You can see the different plots as follows.
![](./figs/GettingStarted_PlotPrismOrbitInMiller.JPG)
![](./figs/GettingStarted_PlotPrismOrbit3d.JPG)

## 7. Edit Simulation Conditions: Environment

1. Move to `./data/sample/ini` directory
2. Open `sample_local_environment.ini`, which defines conditions to calculate the environment around the spacecraft
1. Move to `./settings` directory
2. Open `./sample_satellite/local_environment.ini`, which defines conditions to calculate the environment around the spacecraft
- Currently, S2E supports the following environment models:
- Celestial information: CSPICE
- Geomagnetic field model: IGRF with random variation
- Solar power model: Considering solar distance and eclipse
- Earth Albedo: The simplest model
- Air density: NRLMSISE-00 model with random variation
3. Edit values of `magnetic_field_random_walk_standard_deviation_nT, magnetic_field_random_walk_limit_nT, magnetic_field_white_noise_standard_deviation_nT`
4. Rerun the `s2e-core` **without a rebuild**
5. Check the new log file in `./data/sample/logs` to confirm the magnetic field at the spacecraft position in ECI frame `geomagnetic_field_at_spacecraft_position_i`, the magnetic field in body frame `geomagnetic_field_at_spacecraft_position_b`, and magnetic disturbance torque in body frame `magnetic_disturbance_torque_b` are changed.
5. Check the new log file in `./logs` to confirm the magnetic field at the spacecraft position in ECI frame `geomagnetic_field_at_spacecraft_position_i`, the magnetic field in body frame `geomagnetic_field_at_spacecraft_position_b`, and magnetic disturbance torque in body frame `magnetic_disturbance_torque_b` are changed.
19 changes: 10 additions & 9 deletions Tutorials/HowToAddComponents.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@
```
- Add the following descriptions at the one line below of ` OnBoardComputer *obc_; //!< Onboard Computer`
```c++
GyroSensor *gyro_sensor_; //!< Gyro sensor
s2e::components::GyroSensor *gyro_sensor_; //!< Gyro sensor
```

4. Open and edit `user_components.cpp`
- Edit the constructor function as follows to create an instance of the `GyroSensor` class at the one line below of `obc_ = new OnBoardComputer(clock_generator);`.
``` c++
// Common
IniAccess iniAccess = IniAccess(configuration_->spacecraft_file_list_[spacecraft_id]);
s2e::setting_file_reader::IniAccess iniAccess = s2e::setting_file_reader::IniAccess(configuration_->spacecraft_file_list_[spacecraft_id]);
const double compo_step_sec = global_environment_->GetSimulationTime().GetComponentStepTime_s();

// Initialize of GYRO class
std::string file_name = iniAccess.ReadString("COMPONENT_FILES", "gyro_file");
configuration_->main_logger_->CopyFileToLogDirectory(file_name);
gyro_sensor_ = new GyroSensor(InitGyroSensor(clock_generator, 1, file_name, compo_step_sec, dynamics));
gyro_sensor_ = new s2e::components::GyroSensor(InitGyroSensor(clock_generator, 1, file_name, compo_step_sec, dynamics));
```

- Add the following descriptions at the one line up of `delete obc_;` in the destructor.
Expand All @@ -45,16 +45,17 @@

- Edit the `LogSetup` function as follows to register log output
``` c++
void UserComponents::LogSetup(Logger &logger) { logger.AddLogList(gyro_sensor_); }
void UserComponents::LogSetup(s2e::logger::Logger &logger) { logger.AddLogList(gyro_sensor_); }
```

8. Open `user_satellite.ini` and edit `initial_angular_velocity_b_rad_s` to add initial angular velocity.
- Users can select any value.

9. Add the following descriptions at the bottom line of `[COMPONENT_FILES]` to set the initialize file for the gyro sensor.
- The keyword `SETTINGS_DIR_FROM_EXE` is defined in the `CMakeList.txt` to handle the relative path to the setting files.

```c++
gyro_file = ../../data/initialize_files/components/gyro_sensor_xxx.ini
gyro_file = SETTINGS_DIR_FROM_EXE/user_satellite/components/gyro_sensor_xxx.ini
```

10. Build the `s2e-user` and execute it
Expand All @@ -80,7 +81,7 @@
2. Add the following descriptions at the one line below of `GyroSensor *gyro_sensor_;`

```c++
GyroSensor *gyro_sensor_2_; //!< Gyro sensor 2
s2e::components::GyroSensor *gyro_sensor_2_; //!< Gyro sensor 2
```

3. Open `user_components.cpp`
Expand All @@ -102,7 +103,7 @@
6. Edit the `LogSetUp` function as follows to register log output

``` c++
void UserComponents::LogSetup(Logger &logger) {
void UserComponents::LogSetup(s2e::logger::Logger &logger) {
logger.AddLogList(gyro_sensor_);
logger.AddLogList(gyro_sensor_2_);
}
Expand All @@ -113,10 +114,10 @@
8. Add the following descriptions at the bottom line of `[COMPONENT_FILES]` to set the initialize file for the gyro sensor

```c++
gyro_file_2 = ../../data/initialize_files/components/gyro_sensor_yyy.ini
gyro_file_2 = SETTINGS_DIR_FROM_EXE/user_satellite/components/gyro_sensor_yyy.ini
```

9. Copy the `data/initialize_files/components/gyro_sensor_xxx.ini` file and rename it as `gyro_sensor_yyy.ini`
9. Copy the `settings/user_satellite/components/gyro_sensor_xxx.ini` file and rename it as `gyro_sensor_yyy.ini`

10. Edit `gyro_sensor_yyy.ini` to custom the noise performance of the second gyro sensor
- Edit sensor ID like `[GYRO_SENSOR_1]` to `[GYRO_SENSOR_2]`
Expand Down
14 changes: 7 additions & 7 deletions Tutorials/HowToMakeNewComponents.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
## 2. Overview of component expression in S2E

- Source codes emulating components are stored in the `s2e-core/src/components` directory.
- All components need to inherit the base class `Component` for general functions of components, and most of the components also inherit the base class `ILoggable` for the log output function.
- All components need to inherit the base class `s2e::components::Component` for general functions of components, and most of the components also inherit the base class `s2e::logger::ILoggable` for the log output function.
- `Component` class
- The base class has an important virtual function `MainRoutine`, and subclasses need to define it in their codes.
- When an instance of the component class is created, the `MainRoutine` function is registered in the `TickToComponent`, and it will be automatically executed in the `Spacecraft` class.
Expand All @@ -36,14 +36,14 @@

1. The `clock_sensor.cpp, .hpp` are created in the `components` directory.
- The `ClockSensor` class counts clock with a constant bias noise.
- The class inherits the `Component` and the `ILoggable` base classes as explained above.
- The class inherits the `s2e::components::Component` and the `s2e::logger::ILoggable` base classes as explained above.

1. The `user_components.hpp` and `user_components.cpp` are edit similar procedure with the [How To Add Components](./HowToAddComponents.md)

- The constructor of the `ClockSensor` requires arguments as `prescaler`, `clock_generator`, `simulation_time`, and `bias_s`.
- `prescaler` and `bias_s` are user setting parameters for the sensor, and you can freely set these values.
- `clock_generator` is an argument for the `Component` base class.
- `simulation_time` is a specific argument for the `ClockSensor` to get true time information. The `SimulationTime` class is managed in the `GlobalEnvironment`, and the `GlobalEnvironment` is instantiated in the `SimulationCase` class.
- `clock_generator` is an argument for the `s2e::components::Component` base class.
- `simulation_time` is a specific argument for the `ClockSensor` to get true time information. The `s2e::environment::SimulationTime` class is managed in the `s2e::environment::GlobalEnvironment`, and the `s2e::environment::GlobalEnvironment` is instantiated in the `s2e::simulation::SimulationCase` class.
- We need to add the following codes to `user_components.cpp`.
- Instantiate the `ClockSensor` in the constructor.
```c++
Expand Down Expand Up @@ -85,14 +85,14 @@
- The second line copy the initialize file to the log output directory to save the simulation setting.
- The third line make the instance of the `ClockSensor`.

1. Make `clock_sensor.ini` into `s2e-user/data/initialize_files/components` from `./Tutorial/SampleCodes/clock_sensor`
1. Make `clock_sensor.ini` in `s2e-user/settings/user_satellite/components` to set parameters for the `ClockSensor`.

1. Edit `user_satellite.ini` to add the following line at the [COMPONENT_FILES] section of the file

```c++
clock_sensor_file = INI_FILE_DIR_FROM_EXE/components/clock_sensor.ini
clock_sensor_file = SETTINGS_DIR_FROM_EXE/user_satellite/components/clock_sensor.ini
```
- The keyword `INI_FILE_DIR_FROM_EXE` is defined in the `CMakeList.txt` to handle the relative path to the initialize files.
- The keyword `SETTINGS_DIR_FROM_EXE` is defined in the `CMakeList.txt` to handle the relative path to the setting files.

1. Build `s2e-user` and execute it

Expand Down
Loading
Loading