Tuesday, July 30, 2013

Rocket Launch (Continued: Part 2)

Julian Date: 2456504

Brief update: I have been working on a function to have a user input solar system lazily between working on more interesting programs (like the one this post is about). It will work with all of the written programs and will be finished . . . eventually.

Last time I mentioned this function*, the code ended at the point where the engines stop firing. So from there, the program asks if you want to plot the trajectory of the rocket. This uses the N-Body approach to find and plot the trajectory, taking into account the sun, moon, and all 9 planets (Yes I know, Pluto etc. do not effect it too much, but it is easier to code this way, it is more accurate, and it does not take much computing power.) There is a direction cosine matrix which transfers the latitude into radius. For simplicity, I assumed that at the end of firing, the rocket is on the x axis. This means the perpendicular horizontal motion is in the y direction, parallel horizontal motion is in the x direction, and all vertical motion is in the z direction. Also, I add velocity in the y direction to compensate for Earth's rotation (compensates for tilt but need to write something to launch from a certain point on earth and/or have a preset destination and assume/calculate an ideal launch.)

*Rocket Launch (part 1)

So here it is:

As I said, after all of the choices made in the previous rocket launch post (see above*), it gives an option to plot the trajectory. It then prompts the run time and number of time steps.

So the launch used in this example: Falcon 9 Light, 15000 kg payload, thrust vector at 20 seconds for 20 seconds at 4 degrees 30 degrees from East, and run for 1e4 seconds. The result was as follows:


This is the resulting n-body projection using all 9 planets, the sun, and the moon. 

Rocket: Blue
Planet: Black

Left: Projected trajectory of the Falcon 9 Light. Notice it "crashes" into the planet.
Right: Projected trajectory of the Earth, and the rocket about it.



Rocket: Saturn V, 55000 kg payload, turn at 20 seconds for 20 seconds at 30 degrees to east with a 4 degree vector. Run for 1e7 seconds.
Left: Position of rocket from Earth. The spirals are from the rotation around the sun. What this graph shows is that the rocket gets further away, eventually it would reverse.
Right: Total orbit of the rocket and planet. The rocket has a shorter orbit and will constantly be moving away from Earth until it catches up in the orbit.

As I said before, I need to program some way to launch to a certain destination or from a certain point, but for now this is it. There will eventually be an option to include the moon in a simulation as well as a function for a missile launch.


No comments:

Post a Comment