forentfraps / rocket-flight-simulation

Made a graphical for rocket flying considering non-constant mass and air friction, turned out to look pretty cool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rocket-flight-simulation

Made a graphical demonstration for rocket flying, considering non-constant mass and air friction, turned out to look pretty cool

Theory

For such tasks involving non-constant mass I will be using the mesherskiy equation

image

"F.." means external forces, such as air friction and gravitation pull

image

Our rocket will have 2 phases:

- With fuel, meaning differing mass, drag from the fuel exhaustion

- Without fuel, constant mass, basically only air friction

After all those preparations we can finally make out final equations

image

After expanding it into a 3 equation system it turnes out to be non-linear differential equations, which i am not going to solve analytically However we can try them out with some test data, to later reffer to this as an expected result Note: I will be doing x/y reffering to horizontal/vertical plane, however in the code x\y is horizontal and z in vertical

PART 1

image

PART 2

image

Testing Theory

Im using this input to plot my data manually: plot_me("red", a =math.pi/4 , b = math.pi/2.38,fcons =700,fsp = 23000 , v =10)

it has a very horizontal trajectory, much like a real rocket

x1[t]

image

v1x[t]

image

x2[t]

image

v2x[t]

image

z1[t]

image

vz1[t]

image

z2[t]

image

vz2[t]

image

Compairing theory and my data, it seems as it is quite similar, which concludes as a success

I will include some actual plots, which my code can perform:

image

image

image

Note: after a closer look at the code, you could see that wind is indeed in the equation, HOWEVER, it shows wierd results, so it is better left at 0

image

image

TODO:

-Make dynamic graphs, add easy support for x/y/z[t]  as shown above (were done in a janky way)

-Fix the wind

HUGE THANKS TO Chelovechecheggg#5451 for helping

About

Made a graphical for rocket flying considering non-constant mass and air friction, turned out to look pretty cool


Languages

Language:Python 100.0%