Does anyone know how the Flight Club website is able to provide falcon 9 launch simulations? Given the estimated weight, fuel mass, thrust, ect, how are they able to provide a graph of how it could play out?
-
$\begingroup$ What sort of answer are you looking for here? I've written an orbital launcher sim that could provide similar plots, but I don't know which aspects of the sim you care about. I based my approach largely on Joan Creus-Costa's launchsim, though mine is a complete rewrite in a different language: $\endgroup$– Russell BorogoveCommented Sep 25, 2018 at 21:02
-
$\begingroup$ An explanation if possible. How are they able to simulate a realistic plausible looking trajectory and landing calculation from nothing? $\endgroup$– UndefinedUsernameCommented Sep 25, 2018 at 21:10
-
1$\begingroup$ Short answer, they aren't working from nothing. Flight Club is reverse engineered from available telemetry from every flight. Payload mass, known fuel and vehicle masses, and speed and elevation data from launches, plus final orbits. It isn't perfectly, but a best fit of available inputs and results. I don't feel well enough versed on the details to make a real answer, but it's not 'from nothing.' $\endgroup$– SaibooguCommented Sep 25, 2018 at 21:19
-
$\begingroup$ You say that, @Saiboogu and I felt a sense of semi-simulation too, but you can customise the fuel, weight and various other factors and it will produce a result unseen from telemetry. $\endgroup$– UndefinedUsernameCommented Sep 25, 2018 at 21:23
-
1$\begingroup$ Declan Murphy, creator of the website, has been pinged. $\endgroup$– uhohCommented Sep 26, 2018 at 3:42
2 Answers
Flight Club creator here. Thanks for the ping @uhoh ;)
@RussellBorogove got the implementation of the code spot on and it's actually almost exactly what I do. The only points that I feel are worth mentioning are that I use a leapfrog integrator instead of RK4, because it conserves energy over time and is reversible. This means that the 100th orbit will look identical to the 1st (assuming gravity is the only external force). Also I can implement coast periods between stage separations and ignitions.
The only thing that could do with some more fleshing out, I feel, is talking about the guidance algorithms. In Flight Club's case, 'algorithm' is an extremely generous word, as the guidance profile is completely user-defined. The user defines the elevation, azimuth, and throttle profile of every stage with time. These can be validated by comparing the resulting trajectory with webcast data, and also with some domain knowledge of orbital launches which I've just garnered through experience - for example a SpaceX GTO launch will have a parking orbit of about 170x450km, give or take, and the upper stage usually loses a small bit of altitude towards the end of it's first burn.
I'm working on automating the guidance profile definitions in the background to make my life easier in the future (currently I am manually creating flight profiles for every launch that my Patrons will be photographing - usually I can reuse an old flight profile, but it's trickier when I'm modelling a vehicle for the first time, like D4H for Parker Solar Probe, or Delta II's last flight).
At this time, the only thing that is automated is the landing burn throttle profile, but it's a very simple recalculation of the throttle profile during descent to ensure zero velocity at zero altitude. There is nothing ensuring that the touchdown coordinates are correct - this also needs to be validated and tweaked by the user after the simulation has completed.
All of these manual tasks are semi-easily automated, but most of my development work at the moment is going into developing more of the front-end and migrating the backend to more scalable technologies. When I'm happy with those things, I can get back into improving the GNC stuff
-
$\begingroup$ Excellent! So you use software similar to @RussellBorogove answer for simulation on Flight Club? That is very interesting. You say you do landing profiles manually? How come they can equally be different given the user defined values? $\endgroup$ Commented Sep 26, 2018 at 21:30
-
$\begingroup$ Well yes, the mathematical and analytical techniques are similar, but I wrote my own software just as Russell wrote his own, so we have no common code. And quite the opposite about the landing profiles, they are automated in FC. The user defines when the burn should start, and FC determines how best to throttle the stage in that time $\endgroup$ Commented Sep 26, 2018 at 21:48
-
$\begingroup$ "There is nothing ensuring that the touchdown coordinates are correct - this also needs to be validated and tweaked by the user after the simulation has completed." -- throw the dart and then draw the bullseye around where it hits. :D $\endgroup$ Commented Sep 27, 2018 at 17:28
-
$\begingroup$ The problem with moving the bullseye is that it also moves the thrower! Luckily the thrower's arm is completely deterministic :P $\endgroup$ Commented Sep 27, 2018 at 20:44
I don't know exactly how Flight Club does it, but I've created a simulation modeled on Joan Creus-Costa's launchsim and I believe it's probably not too dissimilar from what Flight Club does. I also got a lot of insight from Braeunig's Saturn V simulation page.
The basic approach is discrete time simulation: start with known initial conditions and simulate the passage of time in short chunks, updating the state of the simulation according to physical law at each step. I use a time step of 1/100 second; even at that rate, my laptop is fast enough to simulate a launch at about 50 times faster than real time (i.e. ascent to Earth orbit for most launchers in around 12 seconds).
Given the known mass of the rocket (recalculated on each time step as fuel is consumed) and the thrust of the currently active stage's engines, acceleration from thrust is applied, along with acceleration from gravity, and retarding force from drag. I do use RK4 when applying the physics, but with a small enough time step it doesn't matter much.
For drag purposes I just track cross section and an arbitrarily fixed coefficient of drag -- varying Cd with speed is on my list of to-dos. (See discussion here and here.)
I simulate varying air density with altitude according to a fixed model based on this NASA page. I don't do anything for weather, crosswind, etc. Nothing in my sim presently is randomized.
Given sea level and vacuum specific impulse figures for an engine, I linearly interpolate the specific impulse as air pressure goes from 1 to 0 atmospheres. This is a very good match to the actual performance of the Saturn V's F-1 engines; I haven't found Isp-versus-pressure curves for other engines, but the F-1s are so linear that I suspect there's a fundamental physical law controlling it.
A guidance system is simulated to determine what direction to apply thrust in -- I don't simulate the actual gimbal angle and control authority, I just assume the desired thrust angle is achievable. I've got a variety of guidance algorithms that I'm not yet happy with.
When the fuel runs out on a stage I just disconnect the mass and engines associated with the stage and activate the next instantly; it would be more realistic to add some interstage delay time.
Launchers are defined as a list of stages. Stages have dry mass, fuel mass, cross sectional area, and a list of engines. Engines have fuel flow rate, specific-impulse-by-altitude function, min and max throttle settings, etc. In my launcher definition code, I can add scheduled events, like throttle-down or jettisoning LES systems (and thus reducing mass of the remaining rocket) at a given point in the flight. I'm not yet modeling Isp falloff with throttle-down. In principle, you can define any rocket you like, real or fictional; you just need the stage masses and engine specs.
The Earth (or whatever body being launched from) is modeled as a uniformly rotating sphere; my coordinate system supports launch site latitude, but always rotates the world so that the launch site is at the coordinate system's zero X coordinate. Initial velocity from planetary rotation is included. Gravitational falloff with altitude is modeled.
Here's a screenshot of my embarrassingly bad UI:
This is modeling the ascent of an Apollo LM from the moon (in the service of answering an earlier question on the site). Graph 1 on the left is altitude versus time; graph 2 is acceleration versus time. We're paused at 25 simulated seconds after insertion into a 18 km x 87 km orbit.
Flight Club does things like tracking the detached first stage separately; my sim only works with one vehicle at a time, but it wouldn't be too difficult to change that.
-
$\begingroup$ This is a really good answer. I've currently been trying to replicate one of the Falcon 9 launches in Excel of all programs and I just cannot seem to reproduce the steep curve seen thought various telemetry postings. Calculating a plausible landing trajectory is another question. $\endgroup$ Commented Sep 25, 2018 at 23:16
-
$\begingroup$ Yeah, I haven't done anything towards simulating landings. The upper stage velocity curve is going to be really sensitive to trajectory; what are you using for guidance? $\endgroup$ Commented Sep 25, 2018 at 23:27
-
$\begingroup$ That graph in my question of course describes KM travel in seconds. When calculating trajectory using the mass and force of Falcon 9 provides an embarrassing worm path. Velocity per second generated in Excel And while it is a bit steeper than the others, the KM per second looks like a worm. Generated in Excel It baffles me how velocity can be so similar, yet KM per second isn't even remotely similar. $\endgroup$ Commented Sep 25, 2018 at 23:31
-
$\begingroup$ This is the basic approach we used in the Shuttle Mission Simulator, although our giant mainframe could only crank out 25 frames per second, and we ran in hard realtime. $\endgroup$ Commented Sep 26, 2018 at 11:34
-
1$\begingroup$ @OrganicMarble I’m guessing one or two aspects might have been modeled in higher fidelity. $\endgroup$ Commented Sep 26, 2018 at 15:40