latom.utils.keplerian_orbit¶
@authors: Alberto FOSSA’ Giuliana Elena MICELI
Functions
|
Change of Coordinates from Classical Orbital Elements to State Vector in body-centred inertial reference frame. |
|
Rotation matrix from perifocal reference frame to inertial, body-centred equatorial reference frame. |
|
Find a root of a vector function. |
Classes
|
KepOrb defines a Keplerian Orbit. |
|
Defines a two-dimensional orbit from its keplerian parameters. |
-
class
latom.utils.keplerian_orbit.TwoDimOrb(gm, **kwargs)[source]¶ Bases:
objectDefines a two-dimensional orbit from its keplerian parameters.
- Parameters
gm (float) – Central body standard gravitational parameter [m^3/s^2]
- Other Parameters
T (float) – Orbital period [s]
a (float) – Semi-major axis [m]
e (float) – Eccentricity [-]
ra (float) – Apoapsis radius [m]
rp (float) – Periapsis radius [m]
- Variables
GM (float, optional) – Central body standard gravitational parameter [m^3/s^2]
T (float) – Orbit period [s]
a (float) – Semi-major axis [m]
e (float) – Eccentricity [-]
ra (float) – Apoapsis radius [m]
rp (float) – Periapsis radius [m]
va (float) – Velocity at the apoapsis [m/s]
vp (float) – Velocity at the periapsis [m/s]
h (float) – Specific angular momentum magnitude [m^2/s]
energy (float) – Specific energy of the orbit in 2BP [m^2/s^2]
-
static
coe2polar(gm, ta, **kwargs)[source]¶ Transforms the classical orbital elements into polar coordinates.
- Parameters
gm (float) – Central body standard gravitational parameter [m^3/s^2]
ta (float or ndarray) – True anomaly [rad]
- Other Parameters
a (float) – Semi-major axis [m]
e (float) – Eccentricity [-]
h (float) – Specific angular momentum magnitude [m^2/s]
- Returns
r (float or ndarray) – Position in polar coordinates [m]
u (float or ndarray) – radial velocity [m/s]
v (float or ndarray) – tangential velocity [m/s]
-
static
polar2coe(gm, r, u, v)[source]¶ Transforms the polar coordinates into classical orbital elements.
- Parameters
gm (float) – Central body standard gravitational parameter [m^3/s^2]
r (float or ndarray) – Position in polar coordinates [m]
u (float or ndarray) – radial velocity [m/s]
v (float or ndarray) – tangential velocity [m/s]
- Returns
a (float) – Orbit semi-major axis [m]
e (float) – Orbit eccentricity [-]
h (float) – Orbit specific angular momentum magnitude [m^2/s]
ta (float or ndarray) – True anomaly [rad]
-
static
polar2energy(gm, r, u, v)[source]¶ Returns the energy given the polar coordinates.
- Parameters
gm (float) – Central body standard gravitational parameter [m^3/s^2]
r (float or ndarray) – Position in polar coordinates [m]
u (float or ndarray) – radial velocity [m/s]
v (float or ndarray) – tangential velocity [m/s]
- Returns
(u**2 + v**2)*0.5 - gm/r – Specific energy of the orbit in 2BP [m^2/s^2]
- Return type
float or ndarray
-
static
propagate(gm, a, e, tai, taf, nb, tp=0.0)[source]¶ Propagates the orbit states in polar coordinates for the orbital period duration.
- Parameters
gm (float) – Central body standard gravitational parameter [m^3/s^2]
a (float) – Orbit semi-major axis [m]
e (float) – Orbit eccentricity [-]
tai (float) – True anomaly initial angle [rad]
taf (float) – True anomaly final angle [rad]
nb (int) – number of point where the True Anomaly is calculated [-]
tp (float) – Time at periapsis passage [s]
- Returns
t (ndarray) – Time vector [s]
states (ndarray) – List of the states values propagated in time [m, m/s, m/s]
-
class
latom.utils.keplerian_orbit.KepOrb(a, e, i, raan, w, ta, gm)[source]¶ Bases:
objectKepOrb defines a Keplerian Orbit.
- Parameters
a (float) – Semi-major axis [m]
e (float) – Eccentricity [-]
i (float) – Inclination [rad]
raan (float) – Right Ascension of the Ascending Node [rad]
w (float) – Argument of Periapsis [rad]
ta (float) – True anomaly [rad]
gm (float) – Central body standard gravitational parameter [m^3/s^2]
- Variables
eps (float) – Smallest number such that
1.0 + eps != 1.0a (float) – Semi-major axis [m]
e (float) – Eccentricity [-]
i (float) – Inclination [rad]
W (float) – Right Ascension of the Ascending Node [rad]
w (float) – Argument of Periapsis [rad]
ta (float) – True anomaly [rad]
GM (float, optional) – Central body standard gravitational parameter [m^3/s^2]
n (float) – Mean motion [rad/s]
R (ndarray) – Position vector [m]
V (ndarray) – Velocity vector [m/s]
H (ndarray) – Specific angular momentum vector [m^2/s]
E (ndarray) – Eccentricity vector [-]
h (float) – Specific angular momentum magnitude [m^2/s]
r (float) – Position vector magnitude [m]
vr (float) – Radial velocity [m/s]
-
set_state_vector(r, v)[source]¶ Set the spacecraft state vector and compute the corresponding COE, H, E.
- Parameters
r (ndarray) – Position vector [m]
v (ndarray) – Velocity vector [m/s]
-
set_classical_orbital_elements(a, e, i, raan, w, ta)[source]¶ Set the spacecraft COE and compute the corresponding state vector, H, E.
- Parameters
a (float) – Semi-major axis [km]
e (float) – Eccentricity [-]
i (float) – Inclination [rad]
raan (float) – Right Ascension of the Ascending Node [rad]
w (float) – Argument of Periapsis [rad]
ta (float) – True anomaly [rad]
-
set_true_anomaly(ta)[source]¶ Set the spacecraft true anomaly and update the corresponding state vector.
- Parameters
ta (float) – True anomaly [rad]
-
compute_classical_orbital_elements()[source]¶ Computes the spacecraft classical orbital elements, specific angular momentum vector and eccentricity vector from its state vector.
-
compute_state_vector()[source]¶ Computes the spacecraft state vector, specific angular momentum vector and eccentricity vector from its COE.
-
compute_eccentric_anomaly(ta)[source]¶ Compute the eccentric anomaly from a given true anomaly.
- Parameters
ta (float) – True anomaly [rad]
- Returns
ea – Eccentric anomaly [rad]
- Return type
float
-
compute_true_anomaly(ea)[source]¶ Compute the true anomaly from a given eccentric anomaly.
- Parameters
ea (ndarray or float) – Eccentric anomaly [-]
- Returns
ta – True anomaly [rad]
- Return type
ndarray or float
-
compute_periapsis_passage(ta, t)[source]¶ Compute the time at periapsis passage given the current time and true anomaly.
- Parameters
t (float) – Time [s]
ta (float) – True anomaly [rad]
- Returns
tp – Time at periapsis passage [s]
- Return type
float
-
propagate(ta, t_vec, mode)[source]¶ Propagate the orbit forward or backward in time solving the Kepler’s time of flight equation.
- Parameters
ta (float) – Initial true anomaly [rad]
t_vec (ndarray) – Time vector [s]
mode (str) –
fwdfor forward propagation orbackfor backward propagation
- Returns
r_vec (ndarray) – Position vector time series [m]
v_vec (ndarray) – Velocity vector time series [m/s]
-
static
kepler_eqn(ea, e, n, t, tp)[source]¶ Kepler’s Time of Flight equation.
- Parameters
ea (float) – Eccentric anomaly [rad]
e (float) – Eccentricity [-]
n (float) – Mean motion [rad/s]
t (float) – Time [s]
tp (float) – Time at periapsis passage [s]
- Returns
f – Current value of Kepler’s equation written as E - e*sin(E) - Me = 0
- Return type
float
-
static
kepler_eqn_prime(ea, e, n, t, tp)[source]¶ First derivative of Kepler’s time of flight equation wrt eccentric anomaly.
- Parameters
ea (float) – Eccentric anomaly [rad]
e (float) – Eccentricity [-]
n (float) – Mean motion [rad/s]
t (float) – Time [s]
tp (float) – Time at periapsis passage [s]
- Returns
fprime – First derivative of Kepler’s equation wrt eccentric anomaly
- Return type
float
-
static
kepler_eqn_second(ea, e, n, t, tp)[source]¶ Second derivative of Kepler’s time of flight equation wrt eccentric anomaly.
- Parameters
ea (float) – Eccentric anomaly [rad]
e (float) – Eccentricity [-]
n (float) – Mean motion [rad/s]
t (float) – Time [s]
tp (float) – Time at periapsis passage [s]
- Returns
fsecond – Second derivative of Kepler’s equation wrt eccentric anomaly
- Return type
float