This repository contains a MATLAB+SIMULINK flight simulation environment for the Vanguard vehicle. It models rocket dynamics, controls, and environmental effects.
-
Models/
Modular Simulink subsystems (aircraft dynamics, sensors, actuators, environment, control logic). -
Plotting/
Post-processing scripts for visualizing outputs (altitude, attitude, velocity, forces, etc.). -
Utils/
General utilities such as math helpers, data handling, or interpolation functions. -
FlightSimulation.slx
The main fella, the big cheese, THE Simulink model. -
RunSimulink.m
Script that sets up simulation parameters, runs the Simulink model, and saves simulation outputs to SimOut struct. -
setupEnv.m
Adds all necessary folders to the MATLAB path and prepares the workspace
- Open MATLAB.
- Run
setupEnv.mto configure the simulation environment.- Anytime you add a new subfolder, this NEEDS to be re-run to add it to path
- Configure any models/parameters in
RunSimulink.mas needed. - Start the simulation with
RunSimulink.m - Utilize the plotting scripts in
Plotting/to analyze the results!
- Create new Vehicle "Kinematics" model in the Kinematics folder, following the current naming scheme for variables is a necessity.
- Create new Aerodynamic model following the current template to load aerodynamic data. There are two implementations, one loading ANSYS CFD results and another loading RASAERO and OpenRocket data. CFD results will always be more accurate but may not have as many points as OpenRocket/RASAERO. The interpolation functons will take care of anything you need.
- Upload any new motor configuration files to
Models\Motor\EngineData- The simulation inputs .RSE files which can be obtained for your motor from ThrustCurve.org
Currently, this is a hardcoded process... Models\Sensors\Params has some
examples of sensors used on the
Vanguard V2.0 Flight Computer.
These sensors are then configured and used in the Simulink model in the
Flight Computer block, and added to the SensorBus for use elsewhere
in the model.
Simulink is a wonder to work with, and sometimes requires STRICT definition
of recursively delayed signals that contain buses. These bus definitions
can be found in the Initialization folder and if you are adding ANYTHING
to a Bus, check if there is a strict initialization for it. Currently,
the navigator bus is the only one this is required for.