How To Make New Simulation Scenario
1. Overview
- In the Getting Started tutorial, we can directly build and execute
s2e-core, but for source code sharing and practical usage of S2E, we strongly recommend managing s2e-core and s2e-user repository separately.- s2e-core repository is shared with other users. Most of the source files are in this core repository. The codes are used as a library by the
s2e-userrepository. s2e-userrepository is an independent repository for each spacecraft project or research project. This repository includes the following parts:- Source codes for the
main - Source codes for
simulation scenario - Source codes for
componentsif the target spacecraft has components, which strongly depends on your project. Initialize filesCompile settingfiles as CMake files, Visual Studio Solution files, or others.
- Source codes for the
- s2e-core repository is shared with other users. Most of the source files are in this core repository. The codes are used as a library by the
- This tutorial explains an example of how to make
s2e-userrepository and execute it. - The supported version of this document
- Please confirm that the version of the documents and
s2e-coreis compatible.
- Please confirm that the version of the documents and
2. Structure of S2E-USER directory
-
We provides a sample of a s2e-user repository as s2e-user-example.
-
The repository is constructed as follows.
- The repository includes
s2e-coreby usinggit submodulefeature. - The
ExtLibrariesfor the user side repository should be generated by using theCMakefiles in thes2e-core.
└─ s2e-user-example └─ src └─ data └─ s2e-core (git submodule) └─ ExtLibraries (generated by the following procedure) └─ other files - The repository includes
3. Setup s2e-user-example
-
Clone s2e-user-example repository in a working directory.
- Because the repository includes s2e-core with the
git submodule, please use the following commands to construct the directory.
Or use the following command to clone the repository.$ git clone git@github.com:ut-issl/s2e-user-example.git $ cd s2e-user-example/ $ git submodule init $ git submodule update$ git clone --recursive git@github.com:ut-issl/s2e-user-example.git
- Because the repository includes s2e-core with the
-
Download mandatory
ExtLibraries(CSPICE and NRLMSISE-00).- Users need to use the
CMakeList.txtin thes2e-user-example/s2e-core/ExtLibrariesto download the mandatory external libraries. - The construction procedure is same with the s2e-core. Please see a
How To Builddocument suit with your platform.└─ s2e-user-example └─ src └─ data └─ s2e-core (git submodule) └─ ExtLibraries └─ CMakeLists.txt (Use this file in this step) └─ ExtLibraries (This directory is generated by this step) └─ cspice └─ GeoPotential └─ nrlmsise00
- Users need to use the
-
According to the
How To Builddocument, use thes2e-user-example/CMakeList.txtand build the s2e-user. -
Execute and check the
s2e-user/data/logs. -
Similar to Getting Started, you can edit initialize files in
s2e-user-example/data/initialize_filesand check the log file.
Note: Users can use other characters instead of user for a practical case. For example, you can name it s2e_equuleus to indicate the EQUULEUS spacecraft project.
4. Overview of S2E-USER-EXAMPLE
- This chapter explains the overview of the
mainbranch of thes2e-user-example. - The files in the directory are as follows. From here, the detail of each file is described.
└─ s2e-user-example └─ CMakeLists.txt └─ CMakeSetting.json └─ data └─ initialize_files └─ logs └─ src └─ simulation └─ case └─ user_case.cpp └─ user_case.hpp └─ Spacecraft └─ user_components.cpp └─ user_components.hpp └─ user_satellite.cpp └─ user_satellite.hpp └─ s2e_user.cpp └─ s2e-core (git submodule)
-
CMakeLists.txtandCMakeSetting.jsonCMakeLists.txtis a CMake file for a compile setting.- Details of description rules for CMake files can be searched on the internet, so please refer to them.
- When you add new source files, the new files is automatically included as the build target. If you do not include them, please add them to excluding list in the
CMakeList.txt.
CMakeSetting.jsonis a compile setting file for Visual Studio.
-
data/initialize_filesanddata/logs- In the
initialize_filesdirectory, there are several initialize files.- The most important initialize file is
user_simulation_base.ini. - Other initialize files are defined in this base initialize file. So you need to edit the file names in the base file when you modify the name of other initialize files.
- When you change the name of the base file, you have to edit
s2e_user.cpp.
- When you change the name of the base file, you have to edit
- Details of the initialize files are described in
Specifications.- Basic files are described in Getting Started.
- The most important initialize file is
logs- CSV log files will be outputted here. The output directory is also defined in
user_simulation_base.ini, so that you can change it.
- CSV log files will be outputted here. The output directory is also defined in
- In the
-
src/s2e_user.cpp- This is the main file of this program.
- In this code,
user_simulation_base.iniis defined as the base file for the simulation, and an instance of theSimulationCaseclass namedUserCaseis created and initialized. And finally, the main routine of the class is executed.
-
src/simulation/case/user_case.cpp, .hppUserCaseclass is defined here.UserCaseclass inherits theSimulationCasebase class in thes2e-core. TheSimulationCaseclass has aSimulationConfigurationandGlobalEnvironmentclass. TheUserCaseclass has an instance of thespacecraftclass named asUserSatellite.
-
src/simulation/spacecraft/user_satellite.cpp, .hppUserSatelliteclass is defined here.UserSatelliteclass inherits theSpacecraftclass in thes2e-core. TheSpacecraftbase class has instances ofDynamics,LocalEnvironment,Disturbance, andStructure. And theUserSatelliteclass has an instance ofUserComponents.
-
src/simulation/spacecraft/user_components.cpp, .hpp- The
UserComponentsclass is defined here. Most users edit this code to custom the S2E for their satellite projects. - Users select components they want to use from the
s2e-core/src/components. - You can add new source codes in the
s2e-user/componentsdirectory if you want to make original components.
- The