TriggerAu / TransferWindowPlanner

An ingame implementation of Alexmun's Launch Window Planner
MIT License
64 stars 36 forks source link

add mid-course plane change transfer #20

Open m4v opened 9 years ago

m4v commented 9 years ago

TWP seems to only offer ballistic transfers, why one can be preferable over the other is explained here:

It all depends on how expensive it is to do the plane change required to intercept your target. The two factors that go into determining how expensive the plane change is are:

  • The delta-v required for a plane change is directly related to your orbital velocity. So if you're in an eccentric orbit, the closer you are to apoapsis the cheaper it is.

  • The delta-v is also related to the sine of the half angle of the inclination change you need to make. Your inclination change is smallest if you change your plane 90 degrees before intercept and increases to 90 degrees if you wait until you're directly "under" your intercept point before making your plane change maneuver.

So for a transfer to an outer planet the mid-course strategy works to find the point at which the decreasing delta-v because you are getting farther from the sun starts to get counteracted by the increasing delta-v as the angle you have to achieve increases towards 90 degrees.

Now, when you're doing a ballistic transfer the raw delta-v for the inclination change is probably a lot higher than the inclination change delta-v for the mid-course strategy. For one thing, your orbital velocity around Kerbin is probably pretty high, and for another to shift your transfer orbit by a degree might take several degrees of inclination change to your ejection orbit (compare your ejection orbit inclination with your transfer orbit inclination to see what I mean). Both of those factors would seem to suggest that the mid-course plane change should always be better. However, there is one big factor in the ballistic strategy's favor and that is the law of cosines.

What the law of cosines says is that if you combine two maneuvers into one you don't have to spend the sum of their delta-v's, instead it's related to the square root of the sum of their squares and the cosine of the angle between them (for a 90 degree angle, this is just the pythagorean theorem). So if we combine our ejection burn with the plane change burn the net delta-v becomes: sqrt(v0^2 + (v0 + dv[ejection])^2 - 2v0(v0 + dv[ejection])*cos(angle)).

For a typical Duna transfer, the ejection delta-v without any plane change is about 1040 m/s. To do a ballistic transfer takes about a 2 degree ejection inclination in order to get about a 0.1 degree transfer inclination. Doing the plane change alone in a 100km Kerbin orbit (which has an orbital velocity of about 2250 m/s) would take about 80 m/s. Plugging into the formula we get sqrt(2250^2 + 3290^2 - 2 2250 3290 * cos(2)) = 1044 m/s. So by combining the maneuvers we get to do an 80 m/s plane change maneuver for only 4 m/s more than the ejection would otherwise take.

TL;DR: It works out that for transfers outer planets with small inclination changes and for transfers to inner planets with moderate inclination changes the ballistic transfer tends to be cheaper because the benefits from combining the maneuvers outweigh the cost of doing the plane change at a less optimal time. However for transfers to outer planets with significant inclination changes or transfers to inner planets with extreme inclination changes the benefits of a cheaper plane change exceed the benefit from combining maneuvers. Like

https://forum.kerbalspaceprogram.com/index.php?/topic/30367-web-app-launch-window-planner/&do=findComment&comment=516122

edit: fixed the dead link

TriggerAu commented 9 years ago

I would love to, but the maths is over my head - I can approach alex again and see if he has time, or if someone can workout the maths I can take a pull request

TriggerAu commented 9 years ago

BTW I like "mid-curse" plane change - thats how I play

wcmille commented 8 years ago

Might get to a pull request, but the algorithm is this:

  1. Create a flight trajectory coplanar with the current orbit.
  2. When the true anomaly from intercept would be 90 degrees short of the intercept true anomaly, this is when you apply mid-course.
  3. The dV required for midcourse is 2 * v * sin(theta/2), where theta is the angular change required to fix the intercept. v is the speed of the ship at midcourse, which can be determined from a=1/((2/r)-(v^2/GM)).
Kerbinator-Fras commented 2 years ago

What, was that the old ksp.olex.biz website? (the forum link was unavailable) normally saying, ksp.olex.biz was very, very imprecise for high (relative) inclination transfer, like Eve-Moho. Usually when transferring, you preburned the normal delta-v upon departure, which is usually most efficient. A big problem is that it will complicate the porkchop plot, and it don't seems to save much delta-v