I developed this simulation as part of Stanford Student Space InItiative's (SSI) dynamics subteam. We are developing a rocket to be launched from a balloon at high altitude, where there is less frictional forces and where the rocket can propel itself more efficiently. our goal is to reach the karman line 100,000 kilometers up that defines the edge of space. This simulation is essential in the planning and testing of our rocket.
We started off discussing how we would use a standard thrust curve of a n5800 engine in order to model the flight dynamics of our rocket. Below are several images of our brainstorming process.


I then had to gather data for the thrust curve of a typical n5800 engine. We didn't have a lot of data to go off of as SSI uses smaller engines such as the H550 for most of its test launches. I used official data from the n5800 engine website in my code.

There are many aerodynamic coefficients and constants To keep track of, including the coefficient of drag, spin damping coefficient, and the rocket's moment of inertia. These constants will remain the same during our interpolation process, whose setup is the image on the right.


in order to create the various graphs that will show the rocket's altitude, speed, spin rate, etc., I had to include a loop to calculate and update their values at every time interval. After gathering the data, I used the matplotlib python module to graph the results.

Results (compressed for page layout purposes)

What I learned
instantaneous dynamical values can be approximated by interpolating between known points. This is the process i used in order to convert ~20 data points from the thrust curve into over 1000s of data points for various values to be used in the simulation
use libraries and modules to simplify tasks. it might be easier to write code for a specific function if it's simple, but for more complex tasks this may not be the case. Getting familiar with scientific libraries is essential
incorporating physics into a simulation involves methodical planning and outlining before writing it up into code.
Next Steps
Developing more accurate constants, specifically the coefficient of drag. I would like to calculate this coefficient by geometry using nasa's new rocket modeler III software.
Adding a "hangle" component to the simulation that will simulate the rocket when launched at an angle. Along with this, i need to simulate the angle at which the rocket is traveling and adjust the components of thrust accordingly.
A Note from Umar
I avoid simply placing my computer science projects on GitHub. I personally believe that GitHub doesn't do as well of a job as showcasing the process of constructing a computer science project as a portfolio would. Therefore, I aim to display all my personal and internship projects on this site, showing not only my code but also my thought process in constructing the program.