Files
thesis/ingest_mission2.jl
2022-04-18 10:59:25 -06:00

99 lines
4.0 KiB
Julia

using Thesis
using SPICE
using LinearAlgebra
using Dates
using PlotlyJS
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(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.
return 3norm_mass + norm_C3
end
function get_id(m::Mission)
letters = "E"
for phase in m.phases letters *= phase.planet.name[1] end
letters *= " "
letters *= cost(m)
return letters
end
missions = Vector{Mission}()
folders = readdir("/home/connor/projects/thesis/archive/EM_3-29", 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)
println(get_id.(sorted_missions1[1:5]))
# long, short = improve.(sorted_missions2[1:2], n=7)#, use_cost=true)
# Display Orbit Plot
# display(Thesis.plot(long,
# title="Sample Algorithm Result Mission",
# mode="light",
# planet_colors=false,
# phase_colors=["#F00","#F0F","#6AF"],
# markers=false,
# camera=((-0.2, -0.3, -0.2),(1.75,-1.75,1.5))));
# Save Orbit Plot
# savefig(Thesis.plot(short, title="EMS Mission Profile", mode="light", planet_colors=false,
# phase_colors=["#F00","#F0F","#6AF"], markers=false, legend=false,
# camera=((-0.2, 0.1, -0.3),(-2.,-2.,1.))),
# "/home/connor/projects/thesis/LaTeX/fig/EMS_plot.png",
# width=850, height=400)
# savefig(Thesis.plot(short, title="EMS Mission Profile", mode="light", planet_colors=false,
# phase_colors=["#F00","#F0F","#6AF"], markers=false, planets=false, legend=false,
# camera=((-0.2, 0.1, -0.3),(-2.,-2.,1.))),
# "/home/connor/projects/thesis/LaTeX/fig/EMS_plot_noplanets.png",
# width=850, height=400)
# savefig(Thesis.plot(long, title="EMJS Mission Profile", mode="light", planet_colors=false,
# phase_colors=["#F00","#F0F","#6AF"], markers=false, legend=false,
# camera=((-0.2, -0.3, -0.2),(1.75,-1.75,1.5))),
# "/home/connor/projects/thesis/LaTeX/fig/EMJS_plot.png",
# width=850, height=400)
# savefig(Thesis.plot(long, title="EMJS Mission Profile", mode="light", planet_colors=false,
# phase_colors=["#F00","#F0F","#6AF"], markers=false, planets=false, legend=false,
# camera=((-0.2, -0.3, -0.2),(2.,-2.,1.5))),
# "/home/connor/projects/thesis/LaTeX/fig/EMJS_plot_noplanets.png",
# width=850, height=400)
# Display Thrust Plots
# display(plot_thrust(display_mission, title="Thrust Magnitude vs Time", mode="light"))
# display(plot_thrust_components(display_mission, title="Thrust Components vs Time", mode="light"))
# Save Thrust Plots
# savefig(plot_thrust(short, title="Thrust Magnitude vs Time", mode="light", legend=false),
# "/home/connor/projects/thesis/LaTeX/fig/EMS_thrust_mag.png",
# width=850, height=400)
# savefig(plot_thrust_components(short, title="Thrust Components vs Time", mode="light", legend=false),
# "/home/connor/projects/thesis/LaTeX/fig/EMS_thrust_components.png",
# width=850, height=400)
# savefig(plot_thrust(long, title="Thrust Magnitude vs Time", mode="light", legend=false),
# "/home/connor/projects/thesis/LaTeX/fig/EMJS_thrust_mag.png",
# width=850, height=400)
# savefig(plot_thrust_components(long, title="Thrust Components vs Time", mode="light", legend=false),
# "/home/connor/projects/thesis/LaTeX/fig/EMJS_thrust_components.png",
# width=850, height=400)
# Save Thrust Plots (VNB)
# display(plot_thrust_components(short, title="Thrust Components vs Time", mode="light", vnb=true))
# display(plot_thrust_components(long, title="Thrust Components vs Time", mode="light", vnb=true))
# Save mission
# store(display_mission, "/home/connor/projects/thesis/archive/best/long_mission")