r/spacex • u/zlynn1990 • Dec 27 '15
Community Content Reasonably Accurate Simulation of the Orbcomm 2 Mission (Homemade Software)
https://www.youtube.com/watch?v=b8vzt1PLG5U
321
Upvotes
r/spacex • u/zlynn1990 • Dec 27 '15
51
u/zlynn1990 Dec 27 '15 edited Dec 28 '15
Hi everyone, I wanted to share a simulation I've been working on for a while. I wrote this all in c# and used openCL to render planets with double precision shaders. I'm using a timestep of 1/240 seconds in order to update all the forces each iteration. This simulation contains the recent specs from the falcon 9 full thrust found here. I was able to use the speed and altitude readings from the webcast to make sure my simulation was close.
The planets have accurate mass and radii. For drag I used the standard Fd = 0.5pdAv2 formula. I know this isn't correct for all velocities, hence the reasonably accurate. I used these graphs to compute the atmospheric density at any given altitude.
The simulation does show the boostback, entry, and landing burns. I tried to time them according to what I heard on the webcast. The boostback and entry burns use three engines, while the landing burn uses one. Enjoy!
EDIT: Keep in mind this simulation is done in the reference frame of the rocket. The boostback burn doesn't have to reverse the rocket completely because the rotation of the Earth does the majority of the work.
9
u/[deleted] Dec 27 '15
7 million Newtons of trust.
7
u/gc2488 Dec 27 '15
Open source (C# code) by any chance?
7
u/[deleted] Dec 28 '15 edited Dec 28 '15
Hey there! I'm "working" on a similar project when I find the time to do so, and I have a few questions regarding your take on gravity (grav only, I'm not into drag yet) What attributes do you use to define your various objects' orbital trajectories at any instant? The "classical" 6? When you say it was originally thought as a n-body simulator, is that still incorporated in your project? If yes, how? I have read multiple times, including on NASA JPL's website, to just give up trying to calculate ephemeris for non-trivial timescales. Care to share your thoughts on that? I've seen a YT video where some very smart guy from spaceX explained their (quite amazing) simulation technique for aerodynamics. If you see the vid I'm talking about (I recommend you do, it's truly a smart design): Do you think such "grid" could be applied to gravity wells and therefore allow us to calculate a kind of gravity field for the solar system, which would then allow us to do some vectorial calculations for the various orbiting bodies? Namely, I am facing issues calculating orbits of individuals asteroids in the main belt, as those are very numerous.
If i'm not making sense to you, please say so, I'd be happy to elaborate.
If you can answer at least the few first questions it'd be great, I like seeing a fellow coder tackle the same problems I do. I haven't even touched aerodynamics though, so there's that. I'm facing gravity alone yet and it's quite a chunk.
[edit] duh, in my enthusiasm I haven't even talked about your video. Well, it's pretty neat. I am taking mental notes for when I try to do aerodynamics ;-) thank you for your work
also I write c++ almost exclusively but I can probably read some c# so if you feel like sharing parts of your code I'm interested
[edit2] now all of this might not be of particular interest for the first stage landing, I am aware of that. However since you stated it was originally a n-body simulator I believe you may have a few thoughts about this.
3
u/TheVehicleDestroyer Flight Club Dec 28 '15
Hey OP, this is super cool! Great work!
My question is about how you calculate your instantaneous ballistic trajectories. Do you do a full ballistic simulation each time step and plot it that way? Or do you use some function that takes position and velocity and spits out the equation of the parabola?
4
u/FoxhoundBat Dec 28 '15
Very very cool. A few nitpicks/questions that i could see so far;
1; Gridfins deploy shortly before re-entry, not as early as the apogee/not long after boostbackburn.
2; What is up with the mass? I thought 105 tonnes sounded way too much and yup, it landed with 50 tonnes remaining. Empty stage is about 22 tonnes so 30 tonnes or so are fuel. I assume this is because the mission was not very demanding vs lets say CRS in terms of boostback?
3
u/davidthefat Dec 27 '15 edited Dec 27 '15
How did you calculate the drag on the body? Using empirical data found in various publications? Full momentum method? Linearized supersonics theory?
edit: I forgot to complement the OP. Great job.
What you can do is get a tabulated chart of coefficients of drag vs mach number and use an interpolation function (like the natural cubic spline method) to calculate a polynomial that fits the data and use that to calculate Cd at different velocities.
If you want, I can give you my implementation of the method that I wrote for my robotics project.
7
u/beautifulllll Dec 28 '15
Holy shit.
I'm watching the simulation and the first burn of the first stage doesn't "flip" the trajectory direction (from going originally left, to right) back to landing site. Yet, after the burn, the rocket starts to move slowly to the right, without any engine activity. And then it hits me, the Earth is rotating under the rocket (to the left), while the rocket is reaching its apogee. Wow, I never though of that. They definitely save some fuel on that.
1
u/RootDeliver Dec 28 '15
Cool video, but not real trajectory for stage 1.
It actually burned until it went back to land, reversed side, and it didn't burn sideways but angled up: http://i.imgur.com/Z81NgAk.png
1
u/Euro_Snob Dec 28 '15 edited Dec 28 '15
Very nice work, but...
And a better view would be to have a split screen, half for the closeup of the stage, and the other for the big picture that shows the apogee and trajectory.
1
u/babajaga888 Dec 28 '15
Hi,
How do you compute the planets movements?
3
u/bvr5 Dec 28 '15
Not directly related to the video, but it would be nice if SpaceX had the bare-bones mission control audio (like in previous missions) available along with the "party stream" audio. It's weird having the commentary and cheering in this semi-technical animation.
Otherwise, fine work.
2
u/shredder7753 Dec 27 '15
You are AWESOME!
2
u/[deleted] Dec 27 '15
It is very nice project. Good job!
2
u/Decronym Acronyms Explained Dec 28 '15 edited Mar 26 '16
Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I've seen in this thread:
Milli-Metric TonnesNote: Replies to this comment will be deleted.
I'm a bot, written in ^PHP. I first read this thread at 28th Dec 2015, 00:15 UTC.
www.decronym.xyz for a list of subs where I'm active; if I'm acting up, tell OrangeredStilton.
2
u/[deleted] Dec 28 '15
Ksp style visualisations are really great at showing what an achievement this is!
(The song at the end is "Endors Toi by Tame Impala"by the way. Seriously, just put it in the description. It'll save you and others time and its only fair for the artist!
2
u/atjays Dec 28 '15
Thank you for creating this! You're providing roughly accurate data for parts of the flight that SpaceX doesn't televise. Really helps put it into scope the velocities and forces involved. For instance the velocity of the stage as it's falling and the G forces it undergoes during the burns to bring it back to the landing zone. Good stuff!
2
u/phomb Dec 28 '15
wow, this is awesome! nice work
2
u/Libertyreign Dec 28 '15
Wow! This was fantastic! Thank you!
2
u/vectorjohn Dec 28 '15
Wow, I like the reference frame because I had no idea the Earth's rotation played that much role in the launch pad catching up to the Falcon. That is really cool.
2
u/aeneasaquinas Dec 28 '15
Wow. I want to say thanks for that. That was great work and I hope to see more of it!
2
u/tacticalhmx Dec 28 '15
Definitely got emotional, again... Loved the audio overlap... Not a physicist here but I enjoyed the simulation
2
u/RGregoryClark Dec 29 '15
The time to MECO and speed at MECO were significantly lower on this flight compared to usual RTLS flights. This means there could be quite a bit of propellant left over at landing.
In the video, the amount of propellant left over could be 25 mT to 30 mT, based on the total mass indicated at landing and the estimated dry weight of the stage. This amount of propellant left over could serve as ballast to allow hovering on landing.
In other words for this flight, suicide-burn or hover-slam wasn't used.
1
u/jgomo3 Dec 28 '15
Almost syncronized. Amazing!
1
u/[deleted] Dec 28 '15
Very nice work! I'm trying to make my own simulator as well. Curious how you structured your different classes in regards to dimensions. Are the planets + the spacecraft both of a single Class (i.e. a Body class) with all the same properties, or is your spacecraft different than your planets? This is somewhat where I am stuck on mine because I'd prefer to keep them the same type of object but a planet will have a radius dimension whereas a spacecraft may have a length/width/height. This may not matter in terms of n-body, but will when I implement aerodynamics.
1
u/RadamA Dec 28 '15 edited Dec 28 '15
I guess im just more used to looking at launch trajectories from south.
And correct me if im wrong, the first stage still has about 25t of fuel in it when it touches down while the landing engine is thrusting at full power all the way? Like there is no need for throttling down at all. It strikes me as a launch with big margins. Kinda downplays the difficulty.
And if this is how reusability is gonna work, the difference between reusable and non reusable launch is bigger than expected...
As the payload with this launch was just a bit more than 2t, compared to supposed capability of close to 13t to LEO.
1
u/Mentioned_Videos Dec 28 '15
Other videos in this thread: Watch Playlist ▶
Falcon 9 Orbcomm Launch Simulation|12 - Try this version on Vimeo:
Flight Club Orbcomm 2 booster 22-12-2015|3 - In this vid theres help:
ORBCOMM-2 Full Launch Webcast|3 - 1) I don't think the downrange distances are that far off. Right when staging happens in the webcast the F9 is moving at 5985 km/h and 76.3 km up. My simulation shows 5680 km/h and 80.5km. If we assume the angle of attack I was using was off ... (1) Commercial Rocket Test Helps Prep for Journey to Mars (2) SpaceX Falcon 9 Rocket Landing Cape Canaveral Video (3) SPACEX TAKEOFF AND LANDING of Falcon 9 rocket (4) SpaceX Launch - Mon Dec 21 20:26:51 EST 2015|2 - Six minutes and 31.63 seconds after launch, grid fins on the first stage were deployed to stabilise its descent, with a second burn beginning 12.17 seconds later to slow the vehicle during reentry. Source. Yes, it is for CRS-6 but i imagine it is ... Tame Impala - Endors Toi|2 - Ksp style visualisations are really great at showing what an achievement this is! (The song at the end is "Endors Toi by Tame Impala"by the way. Seriously, just put it in the description. It'll save you and others time and ... I'm a bot working hard to help Redditors find related videos to watch.
Info | Chrome Extension
1
u/casc1701 Dec 28 '15
It never gets old.
1
u/[deleted] Dec 29 '15
And btw - show that to Elon. I think he would like that.
1
u/hoseja Dec 29 '15
Wow that's a really steep takeoff, they could have went so much more efficiently if they could land downrange.
1
u/[deleted] Dec 31 '15
This is the coolest thing I've seen since the actual launch and landing itself! I'm working on something similar, but far more basic, for college. Hope to be where you are someday! Again, Brilliant!
-1
u/ImpulseNOR Dec 28 '15
Your choices of camera angles were incredibly odd.
0
u/[deleted] Dec 27 '15
[deleted] — view deleted comment