Library
Documentation for SatelliteToolbox.jl.
Public Functions
SatelliteToolbox.equation_of_time — Method
equation_of_time(t::Union{Number, DateTime}) -> TCompute the difference between the Sun apparent local time and the Sun mean local time [rad], which is called Equation of Time, at the time t [UT1], which can be represented by a Julian Day or DateTime. The algorithm was adapted from [1, p. 178, 277-279].
References
- [1] Vallado, D. A (2013). Fundamentals of Astrodynamics and Applications. 4th ed. Microcosm Press, Hawthorne, CA.
SatelliteToolbox.ltan_to_raan — Method
ltan_to_raan(ltan::Union{Number, Time}, t::Union{Number, DateTime}) -> Float64Compute the RAAN [rad] in the interval [0, 2π], referenced to the MOD (mean equator and equinox of date) frame, so that the local time of ascending node (LTAN) is ltan at instant t [UT1].
ltan can be represented as a Number, indicating the hour, or by a Time object.
t can be represented as a Julian Day [UT1] or DateTime [UT1]. Strictly speaking, the Sun position model expects t in the TDB time scale. However, using UT1 leads to a negligible error in this low-precision computation.
SatelliteToolbox.ltdn_to_raan — Method
ltdn_to_raan(ltdn::Union{Number, Time}, t::Union{Number, DateTime}) -> Float64Compute the RAAN [rad] in the interval [0, 2π], referenced to the MOD (mean equator and equinox of date) frame, so that the local time of descending node (LTDN) is ltdn at instant t [UT1].
ltdn can be represented as a Number, indicating the hour, or by a Time object.
t can be represented as a Julian Day [UT1] or DateTime [UT1]. Strictly speaking, the Sun position model expects t in the TDB time scale. However, using UT1 leads to a negligible error in this low-precision computation.
SatelliteToolbox.orbital_angular_velocity — Method
orbital_angular_velocity(a::Number, e::Number, i::Number; kwargs...) -> T
orbital_angular_velocity(orb::Orbit; kwargs...) -> TCompute the angular velocity [rad / s] of an object in an orbit with semi-major axis a [m], eccentricity e [-], and inclination i [rad]. The orbit can also be specified by orb (see Orbit). The inputs are validated and this function throws an error if they do not describe a valid elliptical orbit.
The angular velocity is defined here based on the nodal period, i.e. the time between two consecutive passages by the ascending node. Hence, it is the sum of the perturbed mean motion and the argument of perigee time derivative.
Keywords
perturbation::Symbol: Symbol to select the perturbation terms that will be used. (Default::J2)m0::Number: Standard gravitational parameter for Earth [m³ / s²]. (Default:GM_EARTH)J2::Number: J₂ perturbation term. (Default:EGM_2008_J2)J4::Number: J₄ perturbation term. (Default:EGM_2008_J4)R0::Number: Earth's equatorial radius [m]. (Default:EARTH_EQUATORIAL_RADIUS)
Perturbations
The keyword argument perturbation can be used to select the perturbation terms that will be considered in the computation. The possible values are:
:J0: Consider a Keplerian orbit.:J2: Consider the perturbation terms up to J2.:J4: Consider the perturbation terms J2, J4, and J2².
If perturbation is omitted, it defaults to :J2.
Extended help
Throws
ArgumentError: Ifperturbationis not:J0,:J2, or:J4.ArgumentError: If the eccentricityeis not in the interval [0, 1).ArgumentError: If the perigee radiusa * (1 - e)is not positive.
SatelliteToolbox.orbital_angular_velocity_to_semimajor_axis — Method
orbital_angular_velocity_to_semimajor_axis(
angvel::Number,
e::Number,
i::Number;
kwargs...
) -> T, BoolCompute the semi-major axis [m] that will provide an angular velocity angvel [rad / s] in an orbit with eccentricity e [-] and inclination i [rad]. The inputs are validated and this function throws an error if they do not describe a valid elliptical orbit.
Notice that the angular velocity angvel is related to the nodal period, i.e. the time between two consecutive passages by the ascending node.
Keywords
max_iterations::Int: Maximum number of iterations allowed in the Newton-Raphson algorithm. (Default:20)perturbation::Symbol: Symbol to select the perturbation terms that will be used. (Default::J2)tolerance::Union{Nothing, Number}: Relative tolerance to verify if the numerical method has converged. The algorithm converges when the absolute difference between the angular velocity of the estimated orbit andangvelis lower than or equal totolerance * angvel. It must be greater than 0, otherwise this function throws anArgumentError. If it isnothing,√eps(T)will be used, whereTis the internal type for the computations. (Default:nothing)m0::Number: Standard gravitational parameter for Earth [m³ / s²]. (Default:GM_EARTH)J2::Number: J₂ perturbation term. (Default:EGM_2008_J2)J4::Number: J₄ perturbation term. (Default:EGM_2008_J4)R0::Number: Earth's equatorial radius [m]. (Default:EARTH_EQUATORIAL_RADIUS)
Returns
T: Semi-major axis [m].Bool:trueif the numerical method converged,falseotherwise.
Perturbations
The keyword argument perturbation can be used to select the perturbation terms that will be considered in the computation. The possible values are:
:J0: Consider a Keplerian orbit.:J2: Consider the perturbation terms up to J2.:J4: Consider the perturbation terms J2, J4, and J2².
If perturbation is omitted, it defaults to :J2.
Extended help
Throws
ArgumentError: Ifperturbationis not:J0,:J2, or:J4.ArgumentError: If the angular velocityangvelis not positive.ArgumentError: If the eccentricityeis not in the interval [0, 1).ArgumentError: If the keywordtoleranceis notnothingand not positive.
SatelliteToolbox.orbital_period — Method
orbital_period(a::Number, e::Number, i::Number; kwargs...) -> T
orbital_period(orb::Orbit; kwargs...) -> TCompute the orbital period [s] of an object in an orbit with semi-major axis a [m], eccentricity e [-], and inclination i [rad]. The orbit can also be specified by orb (see Orbit). The inputs are validated and this function throws an error if they do not describe a valid elliptical orbit.
The period is defined here based on the nodal period, i.e. the time between two consecutive passages by the ascending node.
Keywords
perturbation::Symbol: Symbol to select the perturbation terms that will be used. (Default::J2)m0::Number: Standard gravitational parameter for Earth [m³ / s²]. (Default:GM_EARTH)J2::Number: J₂ perturbation term. (Default:EGM_2008_J2)J4::Number: J₄ perturbation term. (Default:EGM_2008_J4)R0::Number: Earth's equatorial radius [m]. (Default:EARTH_EQUATORIAL_RADIUS)
Perturbations
The keyword argument perturbation can be used to select the perturbation terms that will be considered in the computation. The possible values are:
:J0: Consider a Keplerian orbit.:J2: Consider the perturbation terms up to J2.:J4: Consider the perturbation terms J2, J4, and J2².
If perturbation is omitted, it defaults to :J2.
Extended help
Throws
ArgumentError: Ifperturbationis not:J0,:J2, or:J4.ArgumentError: If the eccentricityeis not in the interval [0, 1).ArgumentError: If the perigee radiusa * (1 - e)is not positive.
SatelliteToolbox.raan_time_derivative — Method
raan_time_derivative(a::Number, e::Number, i::Number; kwargs...) -> T
raan_time_derivative(orb::Orbit; kwargs...) -> TCompute the time derivative of the right ascension of the ascending node (RAAN) [rad / s] in an orbit with semi-major axis a [m], eccentricity e [-], and inclination i [rad]. The orbit can also be specified by orb (see Orbit). The inputs are validated and this function throws an error if they do not describe a valid elliptical orbit.
Keywords
perturbation::Symbol: Symbol to select the perturbation terms that will be used. (Default::J2)m0::Number: Standard gravitational parameter for Earth [m³ / s²]. (Default:GM_EARTH)J2::Number: J₂ perturbation term. (Default:EGM_2008_J2)J4::Number: J₄ perturbation term. (Default:EGM_2008_J4)R0::Number: Earth's equatorial radius [m]. (Default:EARTH_EQUATORIAL_RADIUS)
Perturbations
The keyword argument perturbation can be used to select the perturbation terms that will be considered in the computation. The possible values are:
:J0: Consider a Keplerian orbit.:J2: Consider the perturbation terms up to J2.:J4: Consider the perturbation terms J2, J4, and J2².
If perturbation is omitted, it defaults to :J2.
Extended help
Throws
ArgumentError: Ifperturbationis not:J0,:J2, or:J4.ArgumentError: If the eccentricityeis not in the interval [0, 1).ArgumentError: If the perigee radiusa * (1 - e)is not positive.
SatelliteToolbox.raan_to_ltan — Method
raan_to_ltan(raan::Number, t::Union{Number, DateTime}) -> Float64Compute the local time of the ascending node (LTAN) [hour] given the raan [rad] at instant t [UT1]. The raan must be referenced to the MOD (mean equator and equinox of date) frame.
t can be represented as a Julian Day [UT1] or DateTime [UT1]. Strictly speaking, the Sun position model expects t in the TDB time scale. However, using UT1 leads to a negligible error in this low-precision computation.
SatelliteToolbox.raan_to_ltdn — Method
raan_to_ltdn(raan::Number, t::Union{Number, DateTime}) -> Float64Compute the local time of the descending node (LTDN) [hour] given the raan [rad] at instant t [UT1]. The raan must be referenced to the MOD (mean equator and equinox of date) frame.
t can be represented as a Julian Day [UT1] or DateTime [UT1]. Strictly speaking, the Sun position model expects t in the TDB time scale. However, using UT1 leads to a negligible error in this low-precision computation.
Private Functions
SatelliteToolbox._angular_velocity_polynomial_coefficients — Method
_angular_velocity_polynomial_coefficients(
perturbation::Symbol,
e::T,
i::T,
J₂::T,
J₄::T
) where {T <: Number} -> NTuple{4, T}Compute the coefficients (c₁, c₂, c₃, c₄) of the polynomial that provides the orbital angular velocity as a function of x = 1 / √(a / R₀), where a is the semi-major axis and R₀ is the Earth's equatorial radius, for an orbit with eccentricity e [-] and inclination i [rad] using the secular theory selected by perturbation (:J0, :J2, or :J4) and the zonal harmonics J₂ and J₄.
The angular velocity is given by:
angvel(x) = √(μ / R₀³) ⋅ x³ ⋅ (1 + c₁ y + c₂ y² + c₃ y³ + c₄ y⁴), y = x⁴ .Extended help
Throws
ArgumentError: Ifperturbationis not:J0,:J2, or:J4.
SatelliteToolbox._mean_sun_right_ascension — Method
_mean_sun_right_ascension(t::Union{Number, DateTime}) -> Float64Compute the right ascension [rad] of the mean Sun in the MOD (mean equator and equinox of date) frame at the instant t [UT1], which can be represented as a Julian Day or DateTime.
The mean Sun is a fictitious body that moves uniformly along the celestial equator, and its right ascension defines the mean solar time. It is obtained by adding the equation of time to the right ascension of the apparent Sun.
SatelliteToolbox._secular_coefficients — Method
_secular_coefficients(
perturbation::Symbol,
e::T,
i::T,
J₂::T,
J₄::T
) where {T <: Number} -> NTuple{8, T}
_secular_coefficients(
::Val{:J0},
e::T,
i::T,
J₂::T,
J₄::T
) where {T <: Number} -> NTuple{8, T}
_secular_coefficients(
::Val{:J2},
e::T,
i::T,
J₂::T,
J₄::T
) where {T <: Number} -> NTuple{8, T}
_secular_coefficients(
::Val{:J4},
e::T,
i::T,
J₂::T,
J₄::T
) where {T <: Number} -> NTuple{8, T}Compute the coefficients (A, B, C, D, E, F, G, H) of the secular theory selected by perturbation (:J0, :J2, or :J4) for an orbit with eccentricity e [-] and inclination i [rad], using the zonal harmonics J₂ and J₄.
The coefficients relate the unperturbed mean motion n₀ and the normalized semi-latus rectum p₀ [er] to the perturbed mean motion n̄, the argument of perigee time derivative ∂ω, and the RAAN time derivative ∂Ω as follows:
n̄ = n₀ ⋅ (1 + A / p₀² + B / p₀⁴)
∂ω = n̄ ⋅ (C / p₀² + D / p₀⁴) + n₀ ⋅ E / p₀⁴
∂Ω = n̄ ⋅ (F / p₀² + G / p₀⁴) + n₀ ⋅ H / p₀⁴Extended help
Throws
ArgumentError: Ifperturbationis not:J0,:J2, or:J4.
SatelliteToolbox._secular_rates — Method
_secular_rates(
perturbation::Symbol,
a::T,
e::T,
i::T,
μ::T,
R₀::T,
J₂::T,
J₄::T
) where {T <: Number} -> T, T, TCompute the perturbed mean motion [rad / s], the argument of perigee time derivative [rad / s], and the RAAN time derivative [rad / s] of an orbit with semi-major axis a [m], eccentricity e [-], and inclination i [rad] using the secular theory selected by perturbation (:J0, :J2, or :J4), the standard gravitational parameter μ [m³ / s²], the Earth's equatorial radius R₀ [m], and the zonal harmonics J₂ and J₄.
Returns
T: Perturbed mean motionn̄[rad / s].T: Argument of perigee time derivative∂ω[rad / s].T: RAAN time derivative∂Ω[rad / s].
Extended help
Throws
ArgumentError: Ifperturbationis not:J0,:J2, or:J4.ArgumentError: If the eccentricityeis not in the interval [0, 1).ArgumentError: If the perigee radiusa * (1 - e)is not positive.