MOARdV / AvionicsSystems

MOARdV's Avionics Systems for Kerbal Space Program - a new generation of IVA enhancement.
Other
52 stars 26 forks source link

Support maneuver planning with higher eccentricity starting orbits #119

Open MOARdV opened 6 years ago

MOARdV commented 6 years ago

The current maneuver planner works well enough for near-circular orbits. Can I modify it to handle higher eccentricity starting orbits as well? I think the main issue is that the delta-V for the maneuver node is added to the current velocity at the time of the maneuver, instead of it being applied from an ideal-circular orbit at that time. I've got code in there somewhere that applies the extra adjustments for some of the maneuvers, so I think it's just a case of adding those smarts to other computations.

MOARdV commented 6 years ago

Specific example cases from Issue #107 comment -

sovetskysoyuz commented 3 years ago

I was playing around with circularization for hyperbolic orbits recently. I have a working method to suggest for calculating the circularization burn at any valid altitude of a hyperbolic orbit. This might be suitable as an alternative method for CircularizeAltitude to try for hyperbolic orbits, which it currently doesn't accept.

The gist of it is:

  1. Use the vis viva equation to determine the future speed when passing through the desired altitude (since it's conservation of energy, it works in any kind of orbit).
  2. Determine the specific angular momentum of the orbit (radius at periapsis times speed at periapsis).
  3. Since specific angular momentum is conserved along the orbit, the circumferential speed before the burn is the specific angular momentum divided by the radius of the desired circular orbit.
  4. Trigonometry ensues to work out the total delta-V required and the retrograde and radial components thereof (ignoring the normal component because no inclination change should be happening).
  5. Create the maneuver node, using the same functions as CircularizeAltitude and the components that were determined.

What I'm testing right now will only create nodes after the periapsis, but I'm not expecting any trouble to make it try for nodes before the periapsis because everything should be symmetrical except for whether the radial component of the burn is inward or outward.

This approach in general (doing everything based on conservation of energy and angular momentum, rather then using the KSP functions that focus on time-to-true-anomaly) might be more robust/accurate for other transfer functions too.

My briefly-tested implementation is attached. It produces perfectly circular orbits at a variety of altitudes from an initial hyperbolic orbit. CircularizeAltitudeHyp.txt

sovetskysoyuz commented 1 year ago

Included my work discussed above in #368