License | CC0 |
---|---|

Maintainer | frosch03@frosch03.de |

Stability | experimental |

Safe Haskell | Safe-Inferred |

Language | Haskell2010 |

# Simple Calculation

The folowing should show some basic calculations that can be done with this library.

## Orbital Velocity

The orbital velocity of something in an 80k orbit around kerbin could be calculated by:

`>>>`

2278.9316462467027`v_orbKerbin 80e3`

The corresponding velocity of a 100k orbit is calculated via:

`>>>`

2246.1395532335027`v_orbKerbin 100e3`

## Paths

Paths are always calculated within an existing system. Typically is such a system the one around kerbol.

`>>>`

`let ksp_system = (system . celestial $ kKerbol) :: KSystem Body`

`>>>`

ksp_system :: KSystem Body`:t ksp_system`

An easy path is the one between mun and minmus, via kerbin. This one is calculated via:

`>>>`

[R/Mun,R/Kerbin,R/Minmus]`pathBetween ksp_system kMun kMinmus`

A much wieder path would be the one between kerbins moon minmus and jools moon tylo. The path could be calculated via:

`>>>`

[R/Minmus,R/Kerbin,R/Kerbol,R/Jool,R/Tylo]`pathBetween ksp_system kMinmus kTylo`

## Paths with Orbits

The function `pathOBetween`

calculates not only the path between two
given bodys. It also calculates the orbit, of each body. For the path
between mun and minmus, the orbits of mun and minmus (each around
kerbin) are also returned.

`>>>`

[(R/Mun,Around R/Kerbin (1.14e7|1.14e7)),(R/Minmus,Around R/Kerbin (4.64e7|4.64e7))]`pathOBetween ksp_system kMun kMinmus`

## Path speeds

To calculate the differences in deltaV between different orbits, do
the following. First calculate the `pathOBetween`

, then take that
result and feed it into `pathSpeeds`

to get the orbital speeds along
the path.

`>>>`

`let pathMunMinmus = pathOBetween ksp_system kMun kMinmus`

`>>>`

[542.4942415070719,274.11754059162286]`pathSpeeds pathMunMinmus`

The orbital velocity of the Mun is 542.5 m/s, the one around Minmus is 274.1 m/s.

## Hohmann Transfair

To do a hohmann transfair of a low kerbin orbit (100km) to the orbit of Mun (47Mm) the following burns must be done.

`>>>`

`let o1 = mkCircOrbit kKerbin 100e3`

`>>>`

`let o2 = mkCircOrbit kKerbin 47000e3`

`>>>`

(907.2791882798308,226.01062520890378)`hohmann o1 o2`

Lets save these two speeds:

`>>>`

`let (v1, v2) = hohmann o1 o2`

To calculate the transfair orbit from orbit o1 to orbit o2, the speed v1 has to be applied within the orbit o1.

`>>>`

Around R/Kerbin (4.7000000000000596e7|100000.0)`burnFromCircOrb o1 v1`

Again save that orbit into o12

`>>>`

`let o12 = burnFromCircOrb o1 v1`

And apply the speed v2 to the transfair orbit o12:

`>>>`

Around R/Kerbin (4.700000000000125e7|4.7000000000000596e7)`burnAtApoapsis o12 v2`

Which is the desired, circular orbit, with the height of round 47Mm.

# Documentation

v_orbKerbin :: Height -> Speed Source

To calculate the orbital velocity of a circular orbit around
kerbin, `v_orbKerbin`

uses `v_orb`

with `kKerbin`

as default
parameter.