/kerbal-calculator

Basic orbital calculator

Primary LanguagePython

Info

This is a basic library for calculating orbital changes. Up to now, there is only information for hohmann transfer maneuver. The are listed in the following list.

Orbits

Time of Hohmann transfer equation

The time (in seconds) of the transfer is calculated by

equation

Which is done by:

def t_h(self, _target):
    return ( pi * sqrt((_target.periapsis + self.apoapsis + (2 * self.planet.radius))**3 / (8 * self.planet.mue)) )

The semi major axis of Hohmann transer Orbit equation

The semi major axis of the transfer is calculated via:

equation

Which is done by:

def a_h(self, _target):
    return ( 0.5 * (2 * self.planet.radius + self.periapsis + _target.periapsis) )

The Energy of Hohmann transer equation

The Energy of the transfer is calculated by:

equation

Which is done by:

def E_h(self, _target):
    return ( -1 * ((self.planet.mue) / (2 * self.a_h(_target))) )

The Velocity needed at the Priapsis of the Hohmann transer (v_{\pi,hohmann})

Is calculated by:

equation

Which is done by:

def v_p_h(self, _target):
    # r_1: inner circle radi / r_2: outer circle radi
    r_1 = self.planet.radius + (self.periapsis if self.periapsis < _target.periapsis else _target.periapsis)
    r_2 = self.planet.radius + (_target.periapsis if _target.periapsis > self.periapsis else self.periapsis)
    return ( sqrt(self.planet.mue * ((2 / r_1) - (2 / (r_1 + r_2)))) )

The Velocity needed at the Apoapsis of the Hohmann transer equation

Is calculated by:

equation

Which is done by:

def v_a_h(self, _target):
    # r_1: inner circle radi / r_2: outer circle radi
    r_1 = self.planet.radius + (self.periapsis if self.periapsis < _target.periapsis else _target.periapsis)
    r_2 = self.planet.radius + (_target.periapsis if _target.periapsis > self.periapsis else self.periapsis)
    return ( sqrt(self.planet.mue * ((2 / r_2) - (2 / (r_1 + r_2)))) )

The initial Velocity before the Hohmann transer equation

Is calculated by:

equation

Which is done by:

def v_c_1(self, _target):
    # r_1: inner circle radi
    r_1 = self.planet.radius + (self.periapsis if self.periapsis < _target.periapsis else _target.periapsis)
    return ( sqrt(self.planet.mue / r_1) )

The final Velocity after the Hohmann transer equation

Is calculated by:

equation

Which is done by:

def v_c_2(self, _target):
    # r_2: outer circle radi
    r_2 = self.planet.radius + (_target.periapsis if _target.periapsis > self.periapsis else self.periapsis)
    return ( sqrt(self.planet.mue / r_2) )

The difference in Velocity at Periapsis of Hohmann transer equation

Is calculated by:

equation

Which is done by:

def delta_vph(self, _target):
    return ( self.v_p_h(_target) - self.v_c_1(_target) )

The difference in Velocity at Apoapsis of Hohmann transer equation

Is calculated by:

equation

Which is done by:

def delta_vah(self, _target):
    return ( self.v_c_2(_target) - self.v_a_h(_target) )

The total difference in Velocity of the Hohmann transer equation

Is calculated by:

equation

Which is done by:

def delta_vth(self, _target):
    return ( self.delta_vph(_target) + self.delta_vah(_target) )

The specific angular Momentum of Hohmann transer equation

Is calculated by:

equation

Which is done by:

def h_h(self, _target):
    # r_1: inner circle radi
    r_1 = self.planet.radius + (self.periapsis if self.periapsis < _target.periapsis else _target.periapsis)
    return ( r_1 * self.v_p_h(_target) )

The Eccentricity of the Hohmann transer Elipsis equation

Is calculated by:

equation

Which is done by:

def ecc_h(self, _target):
    return ( sqrt(1 + ((2 * self.E_h(_target) * (self.h_h(_target) ** 2)) / (self.planet.mue ** 2))) )

equation Formula

equation