Additional display functions and section 6 draft done
This commit is contained in:
61
julia/ingest_mission.jl
Normal file
61
julia/ingest_mission.jl
Normal file
@@ -0,0 +1,61 @@
|
||||
using Thesis
|
||||
using SPICE
|
||||
using LinearAlgebra
|
||||
using Dates
|
||||
|
||||
try
|
||||
furnsh("../../spice_files/naif0012.tls")
|
||||
furnsh("../../spice_files/de430.bsp")
|
||||
catch
|
||||
furnsh("spice_files/naif0012.tls")
|
||||
furnsh("spice_files/de430.bsp")
|
||||
end
|
||||
|
||||
function cost_1(m::Union{Mission, Mission_Guess})
|
||||
norm_mass = (m.start_mass - prop(m)[7]) / m.start_mass
|
||||
norm_C3 = ( m.launch_v∞ ⋅ m.launch_v∞ ) / 200.
|
||||
tof = sum([p.tof for p in m.phases])/(20Thesis.year)
|
||||
return 2norm_mass + norm_C3 + tof
|
||||
end
|
||||
|
||||
function cost_2(m::Union{Mission, Mission_Guess})
|
||||
norm_mass = (m.start_mass - prop(m)[7]) / m.start_mass
|
||||
norm_C3 = ( m.launch_v∞ ⋅ m.launch_v∞ ) / 200.
|
||||
tof = sum([p.tof for p in m.phases])/(20Thesis.year)
|
||||
return 2norm_mass + norm_C3# + tof
|
||||
end
|
||||
|
||||
function get_id(m::Mission)
|
||||
letters = "E"
|
||||
for phase in m.phases
|
||||
letters *= phase.planet.name[1]
|
||||
end
|
||||
letters *= " "
|
||||
letters *= Dates.format(m.launch_date, "yyyy-mm-dd HH:MM:SS")
|
||||
return letters
|
||||
end
|
||||
|
||||
missions = Vector{Mission}()
|
||||
folders = readdir("/home/connor/projects/thesis/archive/saturn", join=true)
|
||||
for folder in folders
|
||||
try
|
||||
push!(missions, ingest(folder * "/mission"))
|
||||
catch e
|
||||
println("Ingestion failure")
|
||||
end
|
||||
end
|
||||
|
||||
sorted_missions1 = sort(missions, by=cost_1)
|
||||
sorted_missions2 = sort(missions, by=cost_2)
|
||||
|
||||
println(get_id.(sorted_missions1[1:10]))
|
||||
println(get_id.(sorted_missions2[1:10]))
|
||||
|
||||
display_mission = improve(sorted_missions2[1], n=5)
|
||||
# display(plot(display_mission,
|
||||
# title="Sample Algorithm Result Mission",
|
||||
# mode="light",
|
||||
# planet_colors=false,
|
||||
# phase_colors=["#F00","#0F0","#00F"],
|
||||
# markers=false));
|
||||
store(display_mission, "/home/connor/projects/thesis/archive/best/long_mission")
|
||||
Reference in New Issue
Block a user