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

LicenseCC0
Maintainerfrosch03@frosch03.de
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

System.KSP.OrbitalMechanics

Description

 

Synopsis

Documentation

type Radius = Double Source

Radius of Orbit at the current Position

type Speed = Double Source

Speed is an alias for Double

var_G :: GravConst Source

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

semiMajor :: Orbit Body -> Double Source

semiMajor calculates the semi major axis of an orbit.

v :: Orbit Body -> Radius -> Speed Source

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

v_e :: Body -> Speed Source

v_e calculates the escape velocity of that body.

burnFromCircOrb :: Orbit Body -> Speed -> Orbit Body Source

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 :: Orbit Body -> Double -> Double -> Orbit Body Source

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 :: Orbit Body -> Speed -> Orbit Body Source

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

burnAtApoapsis :: Orbit Body -> Speed -> Orbit Body Source

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

hohmann :: Orbit Body -> Orbit Body -> (Double, Double) Source

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