Determining how much sunlight a body is receiving.
Determining the eclipses a satellite will encounter is a major driving factor when designing a mission in space. Thermal and power budgets have to be made with the fact that a satellite will periodically be in the complete darkness of space with no solar radiation to power the solar panels and keep the spacecraft from freezing.
using Unitful
using LinearAlgebra
using SatelliteToolbox
using Plots
using Colors
:ggplot2) theme(
= tle"""
ISS ISS (ZARYA)
1 25544U 98067A 21103.84943184 .00000176 00000-0 11381-4 0 9990
2 25544 51.6434 300.9481 0002858 223.8443 263.8789 15.48881793278621
"""
= init_orbit_propagator(Val(:twobody), ISS[1]);
orbit = 0:0.1:((24 / ISS[1].n) .* 60 * 60);
time , r, v = propagate!(orbit, time); o
function sunlight(Rbody, r_sun_body, r_body_sc)
= 695_700u"km"
Rsun
= Rbody * norm(r_sun_body) / (Rsun - Rbody)
hu
= acos((r_sun_body ⋅ r_body_sc) / (norm(r_sun_body) * norm(r_body_sc)))
θe
= atan(Rbody / hu)
θu = hu * sin(θu) / sin(θe + θu)
du
= π - atan(norm(r_sun_body) / (Rsun + Rbody))
θp = Rbody * sin(θp) / cos(θe - θp)
dp
= 1
S if (θe < π / 2) && (norm(r_body_sc) < du)
= 0
S end
if (θe < π / 2) && ((du < norm(r_body_sc)) && (norm(r_body_sc) < dp))
= (norm(r_body_sc .|> u"km") - du) / (dp - du) |> ustrip
S end
return S
end
= r .|> R -> sunlight(6371u"km", [0.5370, 1.2606, 0.5466] .* 1e8u"km", R .* u"m") S
= range(colorant"black", stop = colorant"yellow", length = 101);
light_range = [light_range[unique(round(Int, 1 + s * 100))][1] for s in S];
light_colors
plot(LinRange(0, 24, length(S)),
.* 100,
S = 5,
linewidth = false,
legend = light_colors,
color ;
)
!("Time (hr)");
xlabel!("Sunlight (%)");
ylabel!("ISS Sunlight Over a Day") title
Figure 1: Rocket Motor Data: [@thrustcurve]
If you see mistakes or want to suggest changes, please create an issue on the source repository.
Text and figures are licensed under Creative Commons Attribution CC BY 4.0. Source code is available at https://gitlab.com/lander-team/air-prop-simulation, unless otherwise noted. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".