Skip to content

Getting Started With the Sim

devantormey edited this page Feb 24, 2020 · 4 revisions

Where is the most current version

The most current version is typically in the branch dev_dev. Although the most current stable version will be in "dev". So if you have just cloned the repository try out dev_dev to see if things are working and if not go back to dev.

Our Folder Structure and How it works

The folder structure looks like this soci-gnc

Include Lib Src Test

Src contains the main simulink file as well as sim_init.m. In order to do anything first make sure you are inside the Src folder and run sim_init.m.

The Lib folder contains all of our simulink libraries along with their corresponding init files. All libraries require an init file to set up their specific set of variables or constants.

The Test folder contains all of our testing scripts and simulink unit tests.

The Include folder is probably a little harder to understand but will eventually make sense. For now just htink of it as the scripts that trigger the initialization of all of our libraries. In addition it contains scripts that set up all of our data types.

How to run the main sim

Provided that there is nothing horribly wrong inside the main sim getting it to run is fairly straight forward. The steps are the following:

  1. make sure you are inside the Src folder
  2. Run sim_init.m
  3. Should you get no errors open up mainSim.slx inside Src
  4. Run the simulink file.

How our variables work.

You may notice after running sim init there are a few variables in the workspace. Chiefly you should see the two structs:

  1. simParams
  2. fswParams

simParams is a large struct containing all of the variables and constants necessary to run the sim. For example the vehicle weight is stored in "simParams.scParams.m_2u". Likewise the fswParams contains all of the variables and constants necessary to run flight software. These two variable are populated when you run sim_init triggering the "include" director to run the "init_params.m" script. Init_params just runs all of those library init files I talked about earlier. In addition sim_init sets up all of your folder paths so that simulink can find all the libraries it needs.

Clone this wiki locally