Update for ky
This commit is contained in:
63
julia/find_neptune.jl
Normal file
63
julia/find_neptune.jl
Normal file
@@ -0,0 +1,63 @@
|
||||
using Thesis
|
||||
using Dates
|
||||
using SPICE
|
||||
using LinearAlgebra
|
||||
using PlotlyJS: savefig
|
||||
|
||||
try
|
||||
furnsh("../../spice_files/naif0012.tls")
|
||||
furnsh("../../spice_files/de430.bsp")
|
||||
catch
|
||||
furnsh("spice_files/naif0012.tls")
|
||||
furnsh("spice_files/de430.bsp")
|
||||
end
|
||||
|
||||
"""
|
||||
The cost function for the mission
|
||||
"""
|
||||
function easy_cost(m::Union{Mission, Mission_Guess}, C3::Float64, v∞::Float64)
|
||||
norm_mass = (m.start_mass - prop(m)[7]) / m.start_mass
|
||||
norm_C3 = ( m.launch_v∞ ⋅ m.launch_v∞ ) / C3
|
||||
norm_v∞ = norm(m.phases[end].v∞_in) / v∞
|
||||
return norm_mass + norm_C3# + norm_v∞
|
||||
end
|
||||
|
||||
# Using some fairly realistic parameters now
|
||||
sc = Sc("mySat", 200., 3200., 0.00025, 1, 1.0)
|
||||
fuel = 3300.
|
||||
max_c3 = 200.
|
||||
max_v∞ = 500.
|
||||
voyager_launch = DateTime(1977,9,5)
|
||||
launch_window = voyager_launch - Year(2), voyager_launch + Year(2)
|
||||
latest_arrival = voyager_launch + Year(25)
|
||||
println("Max thrust at full bore: $(fuel/(mfr(sc)*Thesis.year)) years")
|
||||
println("Max mission length: $((latest_arrival - launch_window[1]).value/(1000Thesis.year)) years")
|
||||
|
||||
# Convenience function for these tests
|
||||
Thesis.mbh(fbs) = mbh(fbs,
|
||||
sc,
|
||||
sc.dry_mass + fuel,
|
||||
launch_window,
|
||||
max_c3,
|
||||
max_v∞,
|
||||
latest_arrival,
|
||||
easy_cost,
|
||||
search_patience=20_000,
|
||||
drill_patience=200,
|
||||
verbose=true)
|
||||
|
||||
function log(m::Mission, archive::Vector{Mission}, planets::Vector{Body})
|
||||
abbrev = join([ planet.name[1] for planet in planets ])
|
||||
p = plot(m, title="Best $(abbrev) Trajectory")
|
||||
savefig(p,"archive/$(abbrev).html")
|
||||
store(m, "archive/$(abbrev)")
|
||||
store(archive, "archive/$(abbrev)_archive")
|
||||
end
|
||||
|
||||
log(_::Nothing, _::Vector{Mission}, _::Vector{Body}) = println("No Mission Found...")
|
||||
|
||||
planets = [Earth, Jupiter, Saturn, Uranus, Neptune]
|
||||
best, archive = mbh(planets)
|
||||
log(best, archive, planets)
|
||||
|
||||
println("Complete!")
|
||||
Reference in New Issue
Block a user