Skip to content

Commit

Permalink
🔧 Update all algorithms related to sun sync orbits
Browse files Browse the repository at this point in the history
  • Loading branch information
ronisbr committed Aug 6, 2023
1 parent 824a0ff commit 648e42d
Show file tree
Hide file tree
Showing 5 changed files with 1,138 additions and 90 deletions.
1 change: 1 addition & 0 deletions src/SatelliteAnalysis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ using TerminalPager
include("./beta_angle.jl")
include("./eclipse_time.jl")
include("./lighting_condition.jl")
include("./ground_repeating_orbits.jl")
include("./sun_synchronous_orbits.jl")

include("./misc/find_crossing.jl")
Expand Down
114 changes: 114 additions & 0 deletions src/ground_repeating_orbits.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# Description
# ==========================================================================================
#
# Functions related to ground repeating orbits.
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# Remarks
# ==========================================================================================
#
# A ground repeating orbit is any orbit that the number of revolutions per day is a
# rational number. Hence, this type of orbit repeats its ground trace after a finite
# number of days.
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

export ground_repeating_orbit_adjacent_track_angle
export ground_repeating_orbit_adjacent_track_distance

"""
ground_repeating_orbit_adjacent_track_angle(h::T1, orbit_period::T2, i::T3, orbit_cycle::Integer) where {T1 <: Number, T2 <: Number, T3 <: Number} -> T
Compute the adjacent track distance [m] at Equator in a ground repeating orbit. The orbit
is described by its altitude at Equator `h` [m], orbital period `orbit_period` [s],
inclination `i` [rad], and orbit cycle `orbit_cyle` [day].
!!! warning
The code does not check if the altitude `h` is correct for the orbit with the period
`orbit_period`.
!!! note
Internally, this function uses the precision obtained by promoting `T1` and `T2` to a
float-pointing number `T`.
# Extended help
A ground repeating orbit is any orbit that the number of revolutions per day is a rational
number. Hence, this type of orbit repeats its ground trace after a finite number of days.
The information `orbit_period` and `orbit_cyle` is redundant. However, they are necessary to
improve the algorithm precision. Otherwise, the `orbit_cycle` must be obtained by converting
the floating-point number `orbit_period` to a rational number, leading to numerical
problems.
"""
function ground_repeating_orbit_adjacent_track_angle(
h::T1,
orbit_period::T2,
i::T3,
orbit_cycle::Integer
) where {T1 <: Number, T2 <: Number, T3 <: Number}
T = float(promote_type(T1, T2, T3))
R₀ = T(EARTH_EQUATORIAL_RADIUS)

# Angle between two adjacent tracks at Equator measured from the Earth's center.
θ = T(orbit_period) / T(orbit_cycle) * T(π) / 43200

# Angle between two adjacent tracks along the satellite's path measured from the Earth's
# center. The projection of this angle in the Earth's surface is the distance between
# the two adjacent tracks.
β = asin(sin(θ) * sin(T(i)))

# Compute the angle between the two ground tracks measured from the satellite. α is an
# auxiliary angle and γ is the angle we are looking for.
sin_βo2, cos_βo2 = sincos/ 2)
α = (R₀^2 + (R₀ + T(h))^2 - 2R₀ * (R₀ + T(h)) * cos_βo2)
γ = asin(R₀ / α * sin_βo2)

return γ
end

"""
ground_repeating_orbit_adjacent_track_distance(orbit_period::T1, i::T2, orbit_cycle::Integer) where {T1 <: Number, T2 <: Number} -> T
Compute the adjacent track distance [m] at Equator in a ground repeating orbit. The orbit
is described by its orbital period `orbit_period` [s], inclination `i` [rad], and orbit
cycle `orbit_cyle` [day].
!!! note
Internally, this function uses the precision obtained by promoting `T1` and `T2` to a
float-pointing number `T`.
# Extended help
A ground repeating orbit is any orbit that the number of revolutions per day is a rational
number. Hence, this type of orbit repeats its ground trace after a finite number of days.
The information `orbit_period` and `orbit_cyle` is redundant. However, they are necessary to
improve the algorithm precision. Otherwise, the `orbit_cycle` must be obtained by converting
the floating-point number `orbit_period` to a rational number, leading to numerical
problems.
"""
function ground_repeating_orbit_adjacent_track_distance(
orbit_period::T1,
i::T2,
orbit_cycle::Integer
) where {T1 <: Number, T2 <: Number}
T = float(promote_type(T1, T2))
R₀ = T(EARTH_EQUATORIAL_RADIUS)

# Angle between two adjacent tracks at Equator measured from the Earth's center.
θ = T(orbit_period) / T(orbit_cycle) * T(π) / 43200

# Angle between two adjacent tracks along the satellite's path measured from the Earth's
# center. The projection of this angle in the Earth's surface is the distance between
# the two adjacent tracks.
β = asin(sin(θ) * sin(T(i)))

# Distance between two adjacent tracks on the Earth's surface.
d = R₀ * β

return d
end
Loading

0 comments on commit 648e42d

Please sign in to comment.