Mathematics behind IMFD

Alexrey

New member
Joined
Nov 16, 2013
Messages
65
Reaction score
0
Points
0
Hi guys,

I recently started using IMFD and was blown away by its ease of use and accuracy when finding interplanetary trajectories. Does anyone know if IMFD's author, Jarmo I think, has released documentation covering the mathematics used? I'm guessing it was some sort of advanced Lambert solver. I'd love to see its inner workings.

Cheers,
Alexrey
 

Topper

Addon Developer
Addon Developer
Donator
Joined
Mar 28, 2008
Messages
666
Reaction score
20
Points
33
Hi Alexrey,

I don't know if this answers your question, but IMFD is using the "Runge-Kutta method" to calculate orbital trajectory.

See here:
http://en.wikipedia.org/wiki/Runge–Kutta_methods

I also want to implement this method in a little project of mine but I havn't had the time to deal with it...
 

Alexrey

New member
Joined
Nov 16, 2013
Messages
65
Reaction score
0
Points
0
Thanks for the reply Topper. I'm not too worried about how the trajectories were plotted :thankyou:. I'm actually more interested in how Jarmo was able to find the required interplanetary trajectory between two planets. I'm assuming he used a Lambert solver since this is generally used when finding interplanetary trajectories (AFAIK, but I could be very wrong about this). But, how he managed to calculate where the spacecraft's thrust vector must point during the escape burn and at what part in the orbit the burn should start in order to give the correct escape velocity really amazes me. I'm guessing he used a lot of coordinate transformations, but I'd love to know what he used as reference points (did he use the escape planet's velocity vector)?
 

jedidia

shoemaker without legs
Addon Developer
Joined
Mar 19, 2008
Messages
10,866
Reaction score
2,128
Points
203
Location
between the planets
But, how he managed to calculate where the spacecraft's thrust vector must point during the escape burn and at what part in the orbit the burn should start in order to give the correct escape velocity really amazes me.

Once you have the desired trajectory, calculating the DV required to achieve it sounds like the easy part... :shifty:
 

Alexrey

New member
Joined
Nov 16, 2013
Messages
65
Reaction score
0
Points
0
AFAIK a Lambert solver ignores the gravitational attraction from the source and target planets, and only takes into consideration the Sun's gravitational acceleration. So if you find the DV required to get from Earth to Mars using a Lambert solver, this would be the DV required if you ignored the gravity of Earth, which wouldn't be enough DV :/. The reason I'm asking this is because I recently programmed a Lambert solver which works great for satellite rendezvous about Earth (since you can ignore the gravitation from both satellites and only consider that from the Earth), but I think this won't work for plotting an accurate Earth to Mars trajectory.
 

jedidia

shoemaker without legs
Addon Developer
Joined
Mar 19, 2008
Messages
10,866
Reaction score
2,128
Points
203
Location
between the planets
So if you find the DV required to get from Earth to Mars using a Lambert solver, this would be the DV required if you ignored the gravity of Earth, which wouldn't be enough DV :/

As far as I'm aware, it's a 3-step calculation (this becomes much more apparent if you use TransX, where you do each of these steps manually, while IMFD throws a finished solution at you).
Basically, everything done analytically is merely a two-body solution: Your vessel and a reference body. So you split stuff up: You calculate the escape trajectory relative to earth ignoring the sun until the trajectory gets out of SOI. Then you switch to the sun as a reference, and calculate the trajectory relative to the sun. When the trajectory reaches the SOI of the target, you switch to target relative calculation, again ignoring any other sources. If the target is a moon of another body it happens to orbit, you do the same thing a fourth time when the trajectory enters its SOI.

The tricky thing in the whole affair (once you have a reliable trajectory solver - that's still the most difficult part) is transfering the trajectory from one frame of reference to the other, over and over again.
 

Alexrey

New member
Joined
Nov 16, 2013
Messages
65
Reaction score
0
Points
0
So patched conics it is ey :hmm:. I'm guessing then that I'll have to have the spacecraft's escape velocity equal to the velocity readout given by a valid Lambert trajectory solution at the point when the spacecraft makes its transition out of the Earth's SOI?

Currently my simulation takes into account the gravitational attraction from the Sun, Earth and Mars making a continuous trajectory from circular orbit around Earth to capture and circular orbit about Mars possible, so I guess it'll be like a pseudo-patched conic approximation. Hopefully this'll make it a bit less laborious instead of trying to patch 3 sections together using 3 different simulations. I'm just a little concerned about how accurate the numerical results will be considering the scales from circular orbit around the Earth to transfer orbit about the Sun are at such different scales.
 

dgatsoulis

ele2png user
Donator
Joined
Dec 2, 2009
Messages
1,924
Reaction score
340
Points
98
Location
Sparta
In patched conics the relationship between the injection velocity and the transfer delta-V is pythagorean. Imagine a right triangle with the local escape velocity and and the heliocentric transfer delta-v as its perpendicular sides.
The hypotenuse of that triangle is the injection velocity.

Vinj = sqrt(Vesc²+DVtr²)

where, Vesc = local escape velocity (the higher the orbit, the lower it is)
and DVtr = heliocentric transfer delta-v


The injection delta-v is simply the injection velocity minus the orbital velocity of the parking orbit.

DVinj = Vinj - Vorb

AFAIK, TransX uses restricted patched conics, while IMFD uses a Lambert solver for the normal target intercept program. The Runge-Kutta method only comes into play in the map program, giving much more accurate predictions for the trajectory of the spacecraft.

---------- Post added at 23:40 ---------- Previous post was at 23:17 ----------

Here are a couple of pics of a guide that I've been working on and off for a while. Don't take the "car in the pit" analogy too seriously. It's just a tool to help with visualization.



better quality here.


This is the comparison of IMFD and TransX on an Earth→Mars journey. Both arrive at the same Injection delta-V for the same heliocentric transfer delta-v.


better quality here.
 
Last edited:

jroly

Donator
Donator
Joined
Jan 26, 2014
Messages
404
Reaction score
1
Points
18
dgatsoulis, That is really excellent, I really like the car in pit transx guide for visualization. Is this part of a book you are working on?
 

dgatsoulis

ele2png user
Donator
Joined
Dec 2, 2009
Messages
1,924
Reaction score
340
Points
98
Location
Sparta
I have been working on a TransX manual for a while. It's a project that I've started and scrapped and restarted multiple times over the past year.

I don't want it to be a "press this button and this will happen" kind of manual, since those rarely give the reader an actual insight of what's going on during a spaceflight.
So it is slowly turning into an "Interplanetary Spaceflight Handbook for Dummies", where I am the dummy explaining some aspects of spaceflight, using crude analogies and drawings.
It is much more important to gain a rudimentary, intuitive understanding of what's going on. After that, how and where those numbers in TransX (TotalDV, Injection DV, Capture DV, Circ DV, etc) come from.

The maths involved is middle-school level, the only thing slightly more "advanced" is the rocket equation which uses a natural log. But as soon as you learn that ln(a) = b → a = e^b, you are back at middle-school level maths for the rest of the things needed. (Moving things around in an equation and solving for x, some roots and powers that's all).

Anyway, work is slow and those drawings take a lot of time, but I think they are worth the trouble. The important part is pinning down a more or less correct analogy to an everyday experience and then making the drawing fit the maths.
Obviously, in the real world if you use Pythagoras to push a toy car out of a pit, you won't get to your target, but that's the problem with analogies. They break down at some point, so it's best not to take them too seriously and to use them just as a visualization tool.
 
Top