Author Topic: Spacex Falcon 9 orbital launch and landing simulation - TODO  (Read 6669 times)

Offline meetsitaram

Hi, I would like to do a hobby project to simulate falcon 9 stage-1 launch, make a full earth orbit and successfully land at launch site. Can you guys help me point to all the resources that i would need, to do this?

I am a software programmer, haven't done any simulation before, do not have much background in aeronautics, but learned some concepts when playing Kerbal Space Program and have been following space related news since the launch of Mars Curiosity.

Offline jimvela

  • Member
  • Full Member
  • ****
  • Posts: 1307
  • Liked: 205
  • Likes Given: 10
Hi, I would like to do a hobby project to simulate falcon 9 stage-1 launch, make a full earth orbit and successfully land at launch site. Can you guys help me point to all the resources that i would need, to do this?

A falcon 9 V1.1 Full thrust first stage is not capable of reaching orbit while lofting a second stage and payload- so what you wish to simulate is not possible.

Quote
I am a software programmer, haven't done any simulation before, do not have much background in aeronautics, but learned some concepts when playing Kerbal Space Program and have been following space related news since the launch of Mars Curiosity.

SpaceX' own materials indicate that they are working towards recovering a second stage after orbital operations in some scenarios, so if you're looking at recovery from orbit this is what you should be studying.

Offline meetsitaram

Not even a decaying orbit, without the second stage and dragon? At least launch and make a round trip across earth? Even if not possible, I would like to at least simulate the failure. Is there any software to find out? Thanks.

Offline philw1776

  • Full Member
  • ****
  • Posts: 1017
  • Seacoast NH
  • Liked: 610
  • Likes Given: 288
Look up the Rocket Equation and code it. 
Then scour SpaceX's site for #s on Falcon 9 FT specs or read threads here.
You'll quickly realize that the first stage will fall in the Atlantic off Cape Canaveral not off Europe or Africa.
“When it looks more like an alien dreadnought, that’s when you know you’ve won.”

Offline meetsitaram

Thanks.  :D Will try that. That will be a good start for me.

Offline meithan

  • Full Member
  • *
  • Posts: 104
  • Mexico
  • Liked: 91
  • Likes Given: 6
If you're interested in simulating the full trajectory, then that's the domain of Computational Fluid Dynamics. Lucikly, it's possible to get away with a fairly decent solution with even an extremely simplified model.

Some students of mine simulated the reentry of the Apollo 8 capsule for a Differential Equations class. Even with a super simplistic physical model (quadratic drag equation), they got a fairly good solution: see the attached image.

The plot on the left shows the simulated velocity of the capsule as a function of time, for the 8 minutes from reentry interface at 400,000 ft to splashdown. The figure on the right is taken from the Apollo 8 Mission Report - that's actual mission data. Compare the simulated solution to the curve labeled velocity. Not bad, huh? My students were super excited about it.

If you're interested in doing this at some later point, I'll be glad to provide assistance. The physics to be solved would be gravity + simplistic drag + thrust, and we could use a relatively simple solution algorithm like a 4th-order Runge-Kutta solver (no need for much math background -- the algorithmic recipe is simple enough).

Offline meetsitaram

That looks very interesting.  Can you recommend any good study material to get to know these concepts? Can you forward me the project details for the simulation results you posted above?

Offline meetsitaram

Thanks meithan for helping me understand a lot of basic concepts that are essential for simulating a rocket launch.  I was able to launch falcon 9 stage1 to a 220km X 260km low earth orbit, successfully achieve single stage to orbit without stage2 and payload. No fuel left for return flight though.
« Last Edit: 01/09/2016 03:54 AM by meetsitaram »

Offline CorvusCorax

  • Full Member
  • ****
  • Posts: 419
  • Germany
  • Liked: 447
  • Likes Given: 319
at the risk of getting flamed - I would simply fire up Kerbal Space Program with the "realism overhaul" mod pack installed. That includes RSS (real solar system, replaces KSP's made up solar system with the Sol system) and FAR (ferrum aerospace research - pretty realistic aerodynamic simulation including trans and supersonic effects as well as heating) installed
on top of that theres a few already existing mods to get SpaceX style tanks and engines.

further modding KSP for this purpose sounds a lot easier to me that writing a new program from scratch. Also most of these mods are open source, so you can look at their code and code documentation for how they are simulating the involved fluid dynamics.
(Kerbal Space Programs inbuilt fluid dynamics are horrible, but FAR is pretty good. So good that I could reproduce the effects of a rotor blade stall on a KSP built helicopter with it)


basically all computer simulation simplifies the physics by splitting time into small discrete timesteps during which most environmental variables are assumed constant. As such instead of solving a differential equation continuously, you just add up many small discrete solutions with various aproximatiion techniques. That creates small errors, but it can create pretty accurate results for problems too complex to find a generic solutions - as well as limit and specify the maximum error made.

By the way, there is an awesome video about how SpaceX does their in house fluid dynamic simulation. This is the real stuff:



(awesome educational video!)

Offline meetsitaram

My only concern with KSP is that I spend a lot of time manually steering the launch vehicle. Is there some kind of script mode or automation, where I can set the entire launch time line, code a feedback logic to align the thrust along velocity vector, throttle engines to limit acceleration, etc. and directly see the final results? Time needed to run a launch simulation 10 times is much less than launching a rocket 10 times in KSP.

Offline rocx

  • Full Member
  • ***
  • Posts: 385
  • NL
  • Liked: 265
  • Likes Given: 145
If you want to automate the launch, you should use kOS: http://ksp-kos.github.io/KOS_DOC/downloads_links.html
I'm not sure if you should speed up the launch, as in KSP physical time acceleration decreases the accuracy of the calculations. Of course outside the atmosphere time acceleration is trivial.
Any day with a rocket landing is a fantastic day.

Offline MarsInMyLifetime

  • Full Member
  • **
  • Posts: 278
  • Austin, TX
    • Light of Day
  • Liked: 132
  • Likes Given: 137
Earth's rotation during an inclined orbit will place your returning stage somewhat West of the launch site (the "sine wave" ground tracks you see in control room graphics, for example). Just something to keep in mind in the simulation. An equatorial launch will track back to the launch site, to simplify things.
Don

Offline Lars-J

  • Senior Member
  • *****
  • Posts: 4032
  • California
  • Liked: 3329
  • Likes Given: 2092
My only concern with KSP is that I spend a lot of time manually steering the launch vehicle. Is there some kind of script mode or automation, where I can set the entire launch time line, code a feedback logic to align the thrust along velocity vector, throttle engines to limit acceleration, etc. and directly see the final results? Time needed to run a launch simulation 10 times is much less than launching a rocket 10 times in KSP.

Yes, the there are several, but "MechJeb" is the most popular auto-pilot mod.
« Last Edit: 01/11/2016 05:26 PM by Lars-J »

Offline CorvusCorax

  • Full Member
  • ****
  • Posts: 419
  • Germany
  • Liked: 447
  • Likes Given: 319
its really a good question if theres a way to run the KSP physics sim "headless" - currently its I think coupled to the visuals - aka the graphics frame rate. But if only the resulting trajectory is important, one doesn't need that.
Maybe it could be done using a mod that changes the camera view-port to be an unchanging blank screen in a different coordinate system? But I don't know how much control mods have over camera angle, and physical versus visual simulation framerate. I didn't find any information about this, maybe someone in the KSP modding community could help.

Offline meithan

  • Full Member
  • *
  • Posts: 104
  • Mexico
  • Liked: 91
  • Likes Given: 6
FAR (ferrum aerospace research - pretty realistic aerodynamic simulation including trans and supersonic effects as well as heating)

You can get pretty close to actual launch data by simulating a very simple point-particle vehicle with a quadratic drag model for the aerodynamics. You don't need to simulate things like stall, and the absence of trans-sonic effects has only a minor impact on the results (because by the time the rocket is going fast it is high up). Drag is not very important in the overall launch anyway (unless the launch fails, of course) so you can get away with a simplistic aerodynamic model; it amounts to a small fraction of the energy losses during launch.

Robert Braeunig did some super detailed simulations of the launch of the Saturn V, using basically the same physics as meetsitaram is using, and his results were very close to actual launch data. Too bad the link to the description of the code shows an "under construction" page.

Quote
further modding KSP for this purpose sounds a lot easier to me that writing a new program from scratch.

Well, coding it up yourself is not that hard (don't know if modding KSP is really simpler). Plus it's a learning experience. And the results he got so far are pretty nice. You really should show off your work, meetsitaram.

I'd definitely be interested in simulating this with KSP too, of course. You'll need kOS for "manually" automating the launch profile (somebody posted the link a few comments up); MechJeb could do too but it's not as customizable.

its really a good question if theres a way to run the KSP physics sim "headless"

Well, what meetsitaram's been doing is basically simulating "KSP in headless mode" ;). He's just not simulating the graphics and a bunch of other things (part physics, for instance) in KSP that are not relevant for a launch simulation of this kind. The physics he's simulating are pretty much those of stock KSP.

Quote
By the way, there is an awesome video about how SpaceX does their in house fluid dynamic simulation.

That video was great, thanks for sharing it. Really nice visualizations.

Tags: SpaceX falcon Landing