KSP-0.1: A library with the kerbal space program universe and demo code

System.KSP.OrbitalMechanics

Description

Synopsis

Documentation

Radius of Orbit at the current Position

type Speed = Double Source

Speed is an alias for Double

var_G [Nm^2/kg^2] is the Gravitation constant in newton meter squared over kilo gramms squared

semiMajor calculates the semi major axis of an orbit.

v takes an orbit and a radius (from the center of the centerBody) and calculates the orbital speed at that position.

v_e calculates the escape velocity of that body.

burnProgradeFromCircOrb calculates the transformed orbit, after the supplied delta V is applied to the initial orbit.

A prograde burn is done through a positive Speed parameter, a retrograde burn respective through a negative Speed.

updateOrbit is a function that takes an orbit and two heights. It updates the apoapsis with the bigger height and the periapsis with the smaller.

burnAt :: (Orbit Body -> Double) -> Orbit Body -> Speed -> Orbit Body Source

burnAt calculates the new orbit after a burn of Speed delta V is applied to the given orbit.

• f is the function that calculates returns the distance of the body within orbit, to the center body. Typical this is one of apoapsis or periapsis
• o is the initial orbit
• dV is the amount of delta V to apply to the orbit.

burnAtPeriapsis calculates the new orbit after a burn of Speed delta V is applied to the given orbit at the periapsis.

burnAt calculates the new orbit after a burn of Speed delta V is applied to the given orbit at the apoapsis.

hohmann takes two orbits around the same centerBody. It calculates both (v1 and v2 ) delta V changes for a hohmann transfair.