First draft of presentation

This commit is contained in:
Connor
2022-03-21 09:39:47 -06:00
parent e731ed16f5
commit 30fc2fbac8
26 changed files with 1393 additions and 68 deletions

View File

@@ -64,22 +64,22 @@ println(get_id.(sorted_missions2[1:5]))
# 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="EMS Mission Profile", mode="light", planet_colors=false,
# 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="EMS Mission Profile", mode="light", planet_colors=false,
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",
@@ -89,18 +89,22 @@ savefig(Thesis.plot(long, title="EMS Mission Profile", mode="light", planet_colo
# 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)
# 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")

View File

@@ -1,4 +1,15 @@
export oe_to_rθh, rθh_to_xyz, oe_to_xyz, xyz_to_oe, xyz_to_rθh, conv_T, spiral, gen_orbit
export oe_to_rθh, rθh_to_xyz, oe_to_xyz, xyz_to_oe, xyz_to_rθh, xyz_to_vnb, conv_T, spiral, gen_orbit
function xyz_to_vnb(vec::Vector, rv::Vector)
r = rv[1:3]
v = rv[4:6]
h = cross(r,v)
n_hat = h/norm(h)
v_hat = v/norm(v)
b = cross(h,v)
b_hat = b/norm(b)
return [ dot(vec,v_hat), dot(vec,n_hat), dot(vec,b_hat) ]
end
function oe_to_rθh(oe::Vector,μ::Real) :: Vector

View File

@@ -481,30 +481,32 @@ end
function plot_thrust_components(m::Union{Mission, Mission_Guess};
title::String="Mission Plot",
mode::String="dark",
legend=true,
vnb=false,
)
traces = Vector{PlotlyJS.AbstractTrace}()
times = Vector{String}()
xs = Vector{Float64}()
ys = Vector{Float64}()
zs = Vector{Float64}()
αs = Vector{Float64}()
βs = Vector{Float64}()
comps1 = Vector{Float64}()
comps2 = Vector{Float64}()
comps3 = Vector{Float64}()
time = datetime2julian(m.launch_date)
start = state(Earth, time, m.launch_v∞, m.start_mass)
for phase in m.phases
n = size(phase.thrust_profile)[1]
path = prop(phase.thrust_profile, start, m.sc, phase.tof)
for i in 1:n
push!(times, format(julian2datetime(time + i*phase.tof/(86400n)),"yyyy-mm-dd HH:MM:SS"))
push!(xs, phase.thrust_profile[i,1])
push!(ys, phase.thrust_profile[i,2])
push!(zs, phase.thrust_profile[i,3])
r, θ, h = xyz_to_rθh(phase.thrust_profile[i,1:3], xyz_to_oe(path[i+1,1:6],Sun.μ))
β = asin(h)
α = atan(r/cos(β),θ/cos(β))
push!(αs, α)
push!(βs, β)
if !vnb
push!(times, format(julian2datetime(time + i*phase.tof/(86400n)),"yyyy-mm-dd HH:MM:SS"))
fr, , fh = xyz_to_rθh(phase.thrust_profile[i,1:3], xyz_to_oe(path[i+1,1:6],Sun.μ))
push!(comps1, )
push!(comps2, fh)
push!(comps3, fr)
else
push!(times, format(julian2datetime(time + i*phase.tof/(86400n)),"yyyy-mm-dd HH:MM:SS"))
fv, fn, fb = xyz_to_vnb(phase.thrust_profile[i,1:3], path[i+1,1:6])
push!(comps1, fv)
push!(comps2, fn)
push!(comps3, fb)
end
end
time += phase.tof/86400.
time_string = format(julian2datetime(time),"yyyy-mm-dd HH:MM:SS")
@@ -512,21 +514,23 @@ function plot_thrust_components(m::Union{Mission, Mission_Guess};
y=[-10.0,10.0],
mode="lines",
line_color="#000",
name=phase.planet.name*" Flyby"))
name=phase.planet.name*" Flyby",
showlegend=false))
mass = path[end,end]
start = state(phase.planet, time, phase.v∞_out, mass)
end
push!(traces, scatter(;x=times, y=αs, name="in-plane angle"))
push!(traces, scatter(;x=times, y=βs, name="out-of-plane angle"))
push!(traces, scatter(;x=times, y=comps1, name="velocity component"))
push!(traces, scatter(;x=times, y=comps2, name="out of plane component"))
push!(traces, scatter(;x=times, y=comps3, name="cross-track component"))
# Determine layout details
layout = Layout(;title=title,
xaxis_title="Year",
yaxis_title="Thrust Angle (Radians)",
yaxis_range=[min(minimum(αs),minimum(βs))*1.02,max(maximum(αs),maximum(βs))*1.02],
)
layout["showlegend"] = legend
yaxis_range=[minimum(minimum.([comps1, comps2, comps3]))*1.02,
maximum(maximum.([comps1, comps2, comps3]))*1.02],
legend_orientation="h",
)
# Plot
PlotlyJS.plot( PlotlyJS.Plot( traces, layout ) )