diff --git a/LaTeX/fig/EMJS_plot.png b/LaTeX/fig/EMJS_plot.png index a291a17..e745295 100644 Binary files a/LaTeX/fig/EMJS_plot.png and b/LaTeX/fig/EMJS_plot.png differ diff --git a/LaTeX/fig/EMJS_plot_noplanets.png b/LaTeX/fig/EMJS_plot_noplanets.png index 4fb4843..50229e2 100644 Binary files a/LaTeX/fig/EMJS_plot_noplanets.png and b/LaTeX/fig/EMJS_plot_noplanets.png differ diff --git a/LaTeX/fig/EMJS_thrust_components.png b/LaTeX/fig/EMJS_thrust_components.png new file mode 100644 index 0000000..19f0cca Binary files /dev/null and b/LaTeX/fig/EMJS_thrust_components.png differ diff --git a/LaTeX/fig/EMJS_thrust_mag.png b/LaTeX/fig/EMJS_thrust_mag.png new file mode 100644 index 0000000..342a067 Binary files /dev/null and b/LaTeX/fig/EMJS_thrust_mag.png differ diff --git a/LaTeX/fig/EMS_plot.png b/LaTeX/fig/EMS_plot.png index a6a1ea9..f314a5d 100644 Binary files a/LaTeX/fig/EMS_plot.png and b/LaTeX/fig/EMS_plot.png differ diff --git a/LaTeX/fig/EMS_plot_noplanets.png b/LaTeX/fig/EMS_plot_noplanets.png index 452e21a..d027f32 100644 Binary files a/LaTeX/fig/EMS_plot_noplanets.png and b/LaTeX/fig/EMS_plot_noplanets.png differ diff --git a/LaTeX/fig/EMS_thrust_components.png b/LaTeX/fig/EMS_thrust_components.png new file mode 100644 index 0000000..3a22131 Binary files /dev/null and b/LaTeX/fig/EMS_thrust_components.png differ diff --git a/LaTeX/fig/EMS_thrust_mag.png b/LaTeX/fig/EMS_thrust_mag.png new file mode 100644 index 0000000..d27910a Binary files /dev/null and b/LaTeX/fig/EMS_thrust_mag.png differ diff --git a/LaTeX/thesis.tex b/LaTeX/thesis.tex index fee1a49..3a3e37e 100644 --- a/LaTeX/thesis.tex +++ b/LaTeX/thesis.tex @@ -919,7 +919,7 @@ phase complete one ``Mission Guess'' which is fed to the non-linear solver to generate one valid trajectory within the vicinity of the original Mission Guess. - \begin{figure} + \begin{figure}[H] \centering \includegraphics[width=\textwidth]{flowcharts/nlp} \caption{A flowchart of the Non-Linear Problem Solving Formulation} @@ -980,7 +980,7 @@ period, the state should remain exactly the same as it began. In Figure~\ref{laguerre_plot} an example of such an orbit is provided. - \begin{figure} + \begin{figure}[H] \centering \includegraphics[width=\textwidth]{fig/laguerre_plot} \caption{Example of a natural trajectory propagated via the Laguerre-Conway @@ -1007,7 +1007,7 @@ designer to trade-off speed of propagation and the fidelity of the results quite effectively. - \begin{figure} + \begin{figure}[H] \centering \includegraphics[width=\textwidth]{fig/spiral_plot} \caption{An example trajectory showing that classic continuous-thrust orbit @@ -1122,7 +1122,7 @@ Section~\ref{mbh_subsection}, but Figure~\ref{mbh_flow} outlines the process steps of the algorithm. - \begin{figure} + \begin{figure}[H] \centering \includegraphics[width=\textwidth]{flowcharts/mbh} \caption{A flowchart visualizing the steps in the monotonic basin hopping @@ -1208,7 +1208,7 @@ If this radius of periapse is then found to be less than the minimum safe radius (currently set to the radius of the planet plus 100 kilometers), then the process is repeated with new random flyby velocities until a valid seed flyby is found. These - checks are also performed each time a mission is perturbed or generated by the nlp + checks are also performed each time a mission is perturbed or generated by the NLP solver. The final requirement then, is the thrust controls, which are actually quite simple. @@ -1307,6 +1307,31 @@ a relatively simple but representative mission design objective, a sample mission to Saturn was investigated. + Ultimately, two optimized trajectories were selected. The results of those trajectories can + be found in Table~\ref{results_table} below: + + \begin{table}[h!] + \begin{small} + \centering + \begin{tabular}{ | c c c c c c | } + \hline + \bfseries Flyby Selection & + \bfseries Launch Date & + \bfseries Mission Length & + \bfseries Launch $C_3$ & + \bfseries Arrival $V_\infty$ & + \bfseries Fuel Usage \\ + & & (years) & $\left( \frac{km}{s} \right)^2$ & ($\frac{km}{s}$) & (kg) \\ + \hline + EMS & 2024-06-27 & 7.9844 & 60.41025 & 5.816058 & 446.9227 \\ + EMJS & 2023-11-08 & 14.1072 & 40.43862 & 3.477395 & 530.6683 \\ + \hline + \end{tabular} + \end{small} + \caption{Comparison of the two most optimal trajectories} + \label{results_table} + \end{table} + \section{Mission Constraints} The sample mission was defined to represent a general case for a near-future low-thrust @@ -1357,31 +1382,6 @@ efficacy of the lower fidelity method. Orbits can be found quickly in the lower fidelity model and easily refined later by re-running the NLP solver at a higher $n$ value. - Finally, the relevant values for the two selected missions are listed below for - reference: - - \begin{table}[h!] - \begin{small} - \centering - \begin{tabular}{ | c c c c c c | } - \hline - \bfseries Flyby Selection & - \bfseries Launch Date & - \bfseries Mission Length & - \bfseries Launch $C_3$ & - \bfseries Arrival $V_\infty$ & - \bfseries Fuel Usage \\ - & & (years) & $\left( \frac{km}{s} \right)^2$ & ($\frac{km}{s}$) & (kg) \\ - \hline - EMS & 2024-06-27 & 7.9844 & 60.41025 & 5.816058 & 446.9227 \\ - EMJS & 2023-11-08 & 14.1072 & 40.43862 & 3.477395 & 530.6683 \\ - \hline - \end{tabular} - \end{small} - \caption{Comparison of the two most optimal trajectories} - \label{results_table} - \end{table} - \subsection{Cost Function} Each mission optimization also allows for the definition of a cost function. This @@ -1439,18 +1439,18 @@ per second squared. However, for this phase, the thrusters are almost entirely turned off, allowing for a nearly-natural trajectory to Mars rendezvous. - \begin{figure} + \begin{figure}[H] \centering - \includegraphics[width=\textwidth]{fig/EMS_plot} + \includegraphics[width=0.9\textwidth]{fig/EMS_plot} \caption{Depictions of the faster Earth-Mars-Saturn trajectory found by the algorithm to be most efficient; planetary ephemeris arcs are shown during the phase in which the spacecraft approached them} \label{ems} \end{figure} - \begin{figure} + \begin{figure}[H] \centering - \includegraphics[width=\textwidth]{fig/EMS_plot_noplanets} + \includegraphics[width=0.9\textwidth]{fig/EMS_plot_noplanets} \caption{Another depiction of the EMS trajectory, without the planetary ephemeris arcs} \label{ems_nop} @@ -1467,6 +1467,21 @@ $3500$ kilogram launch mass leaves much margin for a large impulsive thrust to enter into a capture orbit at Saturn. + \begin{figure}[H] + \centering + \includegraphics[width=0.9\textwidth]{fig/EMS_thrust_mag} + \caption{The magnitude of the unit thrust vector over time for the EMS trajectory} + \label{ems_mag} + \end{figure} + + \begin{figure}[H] + \centering + \includegraphics[width=0.9\textwidth]{fig/EMS_thrust_components} + \caption{The inertial x, y, and z components of the unit thrust vector over time for + the EMS trajectory} + \label{ems_components} + \end{figure} + In this case the algorithm effectively realized that a higher-powered launch from the Earth, then a natural coasting arc to Mars flyby would provide the spacecraft with enough velocity that a short but efficient powered-arc to Saturn was possible with @@ -1509,18 +1524,18 @@ flyby occurring in mid-April of 2026. This will prove to be helpful in comparison with the other result, as this mission profile is much longer. - \begin{figure} + \begin{figure}[H] \centering - \includegraphics[width=\textwidth]{fig/EMJS_plot} + \includegraphics[width=0.9\textwidth]{fig/EMJS_plot} \caption{Depictions of the slower Earth-Mars-Jupiter-Saturn trajectory found by the algorithm to be the second most efficient; planetary ephemeris arcs are shown during the phase in which the spacecraft approached them} \label{emjs} \end{figure} - \begin{figure} + \begin{figure}[H] \centering - \includegraphics[width=\textwidth]{fig/EMJS_plot_noplanets} + \includegraphics[width=0.9\textwidth]{fig/EMJS_plot_noplanets} \caption{Another depiction of the EMJS trajectory, without the planetary ephemeris arcs} \label{emjs_nop} @@ -1533,6 +1548,21 @@ beginning of the phase, very similarly to the previous result. In this trajectory, the Jupiter flyby occurs late July of 2029. + \begin{figure}[H] + \centering + \includegraphics[width=0.9\textwidth]{fig/EMJS_thrust_mag} + \caption{The magnitude of the unit thrust vector over time for the EMJS trajectory} + \label{emjs_mag} + \end{figure} + + \begin{figure}[H] + \centering + \includegraphics[width=0.9\textwidth]{fig/EMJS_thrust_components} + \caption{The inertial x, y, and z components of the unit thrust vector over time for + the EMJS trajectory} + \label{emjs_components} + \end{figure} + Finally, this mission also has a third phase. The Jupiter flyby provides quite a strong $\Delta V$ for the spacecraft, allowing the following phase to largely be a coasting arc to Saturn almost one revolution later. Because of this long coasting period, the mission @@ -1556,7 +1586,7 @@ of which are possible for the other result, meaning that either different launch vehicles must be found or mission specifications must change. - \begin{figure} + \begin{figure}[H] \centering \includegraphics[width=\textwidth]{fig/c3} \caption{Plot of Delta IV and Atlas V launch vehicle capabilities as they relate to diff --git a/julia/ingest_mission.jl b/julia/ingest_mission.jl index e3fe894..4f9ee56 100644 --- a/julia/ingest_mission.jl +++ b/julia/ingest_mission.jl @@ -51,11 +51,13 @@ 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_mission = improve(sorted_missions2[1], n=7) # display(plot(display_mission, # title="Sample Algorithm Result Mission", # mode="light", # planet_colors=false, -# phase_colors=["#F00","#0F0","#00F"], +# phase_colors=["#F00","#F0F","#6AF"], # markers=false)); -store(display_mission, "/home/connor/projects/thesis/archive/best/long_mission") +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")) +# store(display_mission, "/home/connor/projects/thesis/archive/best/long_mission") diff --git a/julia/src/utilities/plotting.jl b/julia/src/utilities/plotting.jl index d9b8cfd..3bd20f2 100644 --- a/julia/src/utilities/plotting.jl +++ b/julia/src/utilities/plotting.jl @@ -3,7 +3,7 @@ using Random, PlotlyJS, Base.Iterators -export plot +export plot, plot_values, plot_thrust, plot_thrust_components function random_color() num1 = rand(0:255) @@ -48,6 +48,7 @@ function standard_layout(limit::Float64, title::AbstractString; mode="dark") Layout( title=attr( font_color="rgb(250,250,250)", + font_size="32", yanchor="top", y=0.95, text=title @@ -380,3 +381,97 @@ function plot(m::Union{Mission, Mission_Guess}; PlotlyJS.plot( PlotlyJS.Plot( traces, layout ) ) end + +function plot_values(m::Union{Mission, Mission_Guess}, + value::Function; + title::String="Mission Plot", + mode::String="dark", + ) + i = 1 + times = Vector{Float64}() + vals = Vector{Float64}() + for phase in m.phases + # First get the path + path = prop(phase.thrust_profile, start, m.sc, phase.tof) + push!(times, collect(LinRange(0,phase.tof,size(phase.thrust_profile)[2]))...) + push!(vals, value.(path)...) + end + trace = Scatter(;xs=times, ys=vals) + + # Determine layout details + layout = standard_layout(0., title, mode=mode) + + # Plot + PlotlyJS.plot( PlotlyJS.Plot( [trace], layout ) ) + +end + +function plot_thrust(m::Union{Mission, Mission_Guess}; + title::String="Mission Plot", + mode::String="dark", + ) + times = Vector{Float64}() + vals = Vector{Float64}() + time = datetime2julian(m.launch_date) + start = state(Earth, time, m.launch_v∞, m.start_mass) + for phase in m.phases + # First get the path + path = prop(phase.thrust_profile, start, m.sc, phase.tof) + time += phase.tof/86400. + mass = path[end,end] + start = state(phase.planet, time, phase.v∞_out, mass) + n = size(phase.thrust_profile)[1] + println(n) + for i in 1:n + push!(times, time + i*phase.tof/(86400n)) + push!(vals, norm(phase.thrust_profile[i])) + end + end + trace = scatter(;x=times, y=vals) + + # Determine layout details + layout = Layout(;title=title, xaxis_title="Time (JD)", yaxis_title="Thrust (% of Max)") + + # Plot + PlotlyJS.plot( PlotlyJS.Plot( [trace], layout ) ) + +end + +function plot_thrust_components(m::Union{Mission, Mission_Guess}; + title::String="Mission Plot", + mode::String="dark", + ) + times = Vector{Float64}() + vals1 = Vector{Float64}() + vals2 = Vector{Float64}() + vals3 = Vector{Float64}() + time = datetime2julian(m.launch_date) + start = state(Earth, time, m.launch_v∞, m.start_mass) + for phase in m.phases + # First get the path + path = prop(phase.thrust_profile, start, m.sc, phase.tof) + time += phase.tof/86400. + mass = path[end,end] + start = state(phase.planet, time, phase.v∞_out, mass) + n = size(phase.thrust_profile)[1] + println(n) + for i in 1:n + push!(times, time + i*phase.tof/(86400n)) + push!(vals1, phase.thrust_profile[i,1]) + push!(vals2, phase.thrust_profile[i,2]) + push!(vals3, phase.thrust_profile[i,3]) + end + end + trace1 = scatter(;x=times, y=vals1, name="x component") + trace2 = scatter(;x=times, y=vals2, name="y component") + trace3 = scatter(;x=times, y=vals3, name="z component") + + # Determine layout details + layout = Layout(;title=title, + xaxis_title="Time (JD)", + yaxis_title="Thrust (% of Max)") + + # Plot + PlotlyJS.plot( PlotlyJS.Plot( [trace1, trace2, trace3], layout ) ) + +end diff --git a/notes.md b/notes.md index 36894cc..85c6bb9 100644 --- a/notes.md +++ b/notes.md @@ -55,7 +55,7 @@ Todo: - [x] In the introduction, include some context for the existing literature. Compare to what people have done before and explain the goal in comparison to how it's based on someone else's, as well as the places where I've done things differently than the source work. -- [ ] Red/Green colorblindness problem in the plots +- [x] Red/Green colorblindness problem in the plots - [x] Move table 7.1 to the beginning of Section 6 when the trajectories are introduced. - [x] Double check that the math is in the definitions of key points, for instance the cost function and the constraints to the NLP solver @@ -64,5 +64,8 @@ Todo: - [x] Include how mass is being decremented in the SFT propagator section - [ ] Think about how to include plots that show the MBH algorithm jumping through the space and looking at various basins. -- [ ] Include some plots of the thrust vectors rather than the raw data in the appendix +- [x] Include some plots of the thrust vectors rather than the raw data in the appendix + - [ ] Format dates better and include lines where the flybys are + - [ ] Reconsider wording on analysis + - [ ] Reconsider plotting the angles instead - [ ] Submit thesis defense form