Skip to content

Instantly share code, notes, and snippets.

@josh-kaplan
Created February 14, 2018 17:43
Show Gist options
  • Save josh-kaplan/3f91e2215d04b5a40bbf943cb7183d2b to your computer and use it in GitHub Desktop.
Save josh-kaplan/3f91e2215d04b5a40bbf943cb7183d2b to your computer and use it in GitHub Desktop.
Computations for FESS 1 Problem Set #2, Problem #2
#!/usr/bin/env julia
################################################################################
# pset2-2.jl
#
# Josh Kaplan
# _jk@jhu.edu
#
# Computations for Problem Set #2, Problem #2.
################################################################################
#----------( Constants )----------#
R_E = 6378.1 # Radius of Earth [km]
µ_E = 3.986e5 # µ of Earth [km^3/s^2]
K_A = 2.556e8 # For km^2
η = 0
η = η + 10
θ = 10
#----------( Functions )----------#
"""Computes the angular radius of earth in degrees given a radius.
Source: Space Mission Engineering, Eq. 8-26."""
angular_radius(r) = asind(R_E / r)
"""Computes the elevation angle (in degrees) for a given nadir and radius.
Source: Space Mission Engineering, Eq. 8-28."""
function ε(η, r)
frac = sind(η) / (R_E / r)
# Typical satellite geometry
if 0 <= frac <= 1
return acosd(frac)
# Satellite FOV extends beyond Earth
elseif frac > 1
return 0
else
println("An error occurred.")
exit(1)
end
end
"""Computes lambda max for a given nadir and radius.
Source: Space Mission Engineering, Eq. 8-37."""
λ(η, r) = 90 - η - ε(η, r)
"""Computes the Instantaneous Access Area (IAA) in km^2 given a nadir angle and
radius. Source: Space Mission Engineering. Appendix C, Eq. C-29."""
function IAA(η, r)
return K_A * (1 - cosd(λ(η, r)))
end
"""Computes Footprint Area, FA, in km^2.
Source: SME, Eq. 10-3"""
function FA(η, r)
D = R_E * sind(λ(η, r)) / sind(η) # SME Eq. 8-31
Wf = D * sind(θ) # SME Eq. 10-2b
elev = ε(η, r)
if abs(elev) < .001
Lf = D
else
Lf = D * sind(θ) / sind(elev) # SME Eq. 10-1b
end
return (π/4)*Wf*Lf
end
"""Computes average Area Coverage Rate (ACR_avg) in km^2/s.
Source: SME Eq. 10-5."""
function ACR_avg(η, r)
DC = 1 # Duty cycle, given
O_avg = 0.25 # 0.25, given
T = 1 # 1 sec exposure time, given
return DC * (1 - O_avg) * FA(η, r)/T
end
"""Computes Area Access Rate in km^2/s.
Source: SME Eq C-30."""
function AAR(η, r)
P = 2*π*sqrt(r^3/µ_E)
return 2*K_A*(sind(λ(η, r))/P)
end
"""Computes the ground speed in km/s."""
function ground_speed(r)
P = P = 2*π*sqrt(r^3/µ_E)
return 2*π*R_E / P
end
################################################################################
## Problem 1 ##
################################################################################
th = "Orbit IAA FA ACR_avg AAR Ground Speed\n"
un = " [km^2] [km^2] [km^2/s] [km/s] [km/s] \n"
sp = "----- ----------- --------- ---------- -------- ------------\n"
write(STDOUT, "\n")
write(STDOUT, th) # Print table headers
write(STDOUT, un) # Print units
write(STDOUT, sp) # Print separator
##############################
## Orbit #1 - Planet Labs ##
##############################
a = R_E + 410 # Semi-major axis (circular) [km]
i = 51.7 # Inclination [deg]
P = 92.77*60 # Period [s]
v = 7.663 # Velocity [km/s]
# Print results
@printf("#1")
@printf("%15.2f", IAA(η, a))
@printf("%14.2f", FA(η, a))
@printf("%13.2f ", ACR_avg(η, a))
@printf("%9.2f", AAR(η, a))
@printf("%14.2f\n", ground_speed(a))
##############################
### Orbit #2 - Skybox ##
##############################
a = R_E + 600 # Semi-major axis (circular) [km]
i = 97.6 # Inclination [deg]
P = 96.69*60 # Period [s]
v = 7.558 # Velocity [km/s]
# Print results
@printf("#2")
@printf("%15.2f", IAA(η, a))
@printf("%14.2f", FA(η, a))
@printf("%13.2f ", ACR_avg(η, a))
@printf("%9.2f", AAR(η, a))
@printf("%14.2f\n", ground_speed(a))
###############################
### Orbit #4 - GEO Telecom ##
###############################
a = R_E + 35786 # Semi-major axis (circular) [km]
i = 0 # Inclination [deg]
# Print results
@printf("#4")
@printf("%15.2f", IAA(η, a))
@printf("%14.2f", FA(η, a))
@printf("%13.2f ", ACR_avg(η, a))
@printf("%9.2f", AAR(η, a))
@printf("%14.2f\n", ground_speed(a))
println("")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment