simulator
This program is developed in MATLAB for the simulation of 6 d.o.f. rocket dynamics during all phases of flight: thrust, coast, apogee, and recovery. It predicts 3D trajectory, apogee height, forces acting on the rocket, and various other aerodynamic values. This simulator can also run stochastic simulations with multiple options. More detailed information about the physical model of the simulator is available in documentation.pdf.
How to Use It
-
Configure the Settings: The script
simulatorConfig.m
is where you set up the parameters for the simulation. You can configure:- Simulation Flags: Choose the type of simulation (e.g., parafoil, ballistic).
- Plot Preferences: Decide if you want charts, text summaries, or to save the detailed results.
-
Run Script: Execute the function
mainSimulator
to start the simulation process. You can optionally feedRocket
,Environment
, andWind
objects to override config readings and use name-value arguments to change option flags.Example Usage:
mission = Mission(true); rocket = Rocket(mission); environment = Environment(mission, rocket.motor); wind = WindCustom(mission); [ascent, descent] = mainSimulator(rocket, wind, environment, settings, ... 'parafoil', true, 'ballistic', false, 'prints', true, 'plots', true);
-
Check Out the Results: Once it's done running, you'll get:
- Charts: The tool makes graphs that show various flight parameters.
- Text Summary: The function prints the key simulation results.
Key Files
-
mainSimulator.m
: The main function to run the simulation. It:- Loads the necessary data and configurations.
- Runs the simulation for the ascent and descent phases.
- Generates charts, prints the text summary, and saves the results based on your settings.
-
simulatorConfig.m
: The configuration script where you set up the parameters for the simulation. Key settings include:- Simulation Flags: Choose the type of simulation (e.g., parafoil, ballistic).
- Plot Preferences: Decide if you want charts, text summaries, and if you want to save the data.
Example Settings Inside
simulatorConfig.m
:%% SIMULATION FLAGS simulator.parafoil = true; % True if parafoil open loop descent needs to be performed simulator.ballistic = false; % True to run a ballistic (without parachutes) simulation %% PLOTS simulator.prints = false; % True to print data after simulation simulator.plots = false; % True to plot data after simulation simulator.landingMap = true; % True to run geoplots simulator.satellite3D = false; % True to plot trajectory on 3D map simulator.SMonly = true; % True to plot only SM (useful during design!)
Configuration Files
The simulator requires several configuration files located under common/missions/config
. These files include:
-
rocketConfig.m
: Contains the rocket's geometric and mass properties. -
environmentConfig.m
: Contains the launch site dependent variables. -
windConfig.m
: Contains the wind model parameters. -
motorConfig.m
: Contains the motor parameters. -
parachuteConfig.m
: Contains the parachute parameters.
Output
The simulator records and outputs in the Matlab console the following data: (for a stochastic simulation output look in the Options section)
- Apogee altitude [m]
- Total time of flight [s]
- Speed:
- Max speed reached and Mach number [m/s]
- Max speed timestep [s]
- Altitude at max speed timestep [m]
- Acceleration:
- Max acceleration [m/s^2] and [g]
- Max acceleration timestep [s]
- Speed at max acceleration timestep [m/s]
- Run on the launchpad:
- height of the launch pad tower [m]
- speed at launch pad exit [m/s]
- timestep at launch pad exit [s]
- latitude of landing point [deg]
- longitude of landing point [deg]
- speed at apogee relative to wind velocity [m/s]
Additionally, the mainSimulator
function can return the ascent and descent data as a struct.
Plots
Data that can be plotted at each timestep:
- Static stability margin
- Altitude
- Speed and Mach number
- Acceleration
- Forces acting on the rocket (Thrust and aerodynamic forces)
- Aerodynamic angles
- Axial force coefficient (CA)
- Temperature of the nosecone
- Body frame velocities
- Eulerian angles
- 3D trajectory (on a map from google maps as an option)
- Trajectory projections on the XZ, XY, YZ planes