diff --git a/LaTeX/approach.tex b/LaTeX/approach.tex index 6a8d7b7..178ac86 100644 --- a/LaTeX/approach.tex +++ b/LaTeX/approach.tex @@ -88,9 +88,13 @@ In this formulation the cost function $F$ is a user provided function of the input Guess. The constraint function $G$ defines the following conditions that must be met: + \begin{spacing}{1.0} \begin{itemize} + \setlength\itemsep{-0.5em} \item For every phase other than the final: + \vspace{-0.5em} \begin{itemize} + \setlength\itemsep{0em} \item The minimum periapsis of the hyperbolic flyby arc must be above some user-specified minimum safe altitude. \item The magnitude of the incoming hyperbolic velocity must match the magnitude @@ -99,12 +103,15 @@ at the end of the phase. \end{itemize} \item For the final phase: + \vspace{-0.5em} \begin{itemize} + \setlength\itemsep{0em} \item The spacecraft position must match the planet's position (within bounds) at the end of the phase. \item The final mass must be greater than the dry mass of the craft. \end{itemize} \end{itemize} + \end{spacing} \begin{figure}[H] \centering diff --git a/LaTeX/conclusion.tex b/LaTeX/conclusion.tex new file mode 100644 index 0000000..257f9b2 --- /dev/null +++ b/LaTeX/conclusion.tex @@ -0,0 +1,41 @@ +\chapter{Conclusion} \label{conclusion} + + This thesis explored an approach for automating the initial analysis and discovery of useful + interplanetary, low-thrust trajectories including the difficult task of optimizing the flyby + parameters. This makes the mission designer's job significantly simpler in that they can + simply explore a number of different flyby selection options in order to get a good + understanding of the mission scope and search space for a given spacecraft, launch window, + and target. + + In performing this examination, two results were selected for further analysis. These + results are outlined in Table~\ref{results_table}. As can be seen in the table, both + resulting trajectories have trade-offs in mission length, launch energy, fuel usage, and + more. However, both results show very interesting trajectories that could indicate some + favorable possibilities for such a mission profile. Each of these trajectories should be + within the capabilities of existing launch vehicles in terms of $C_3$. + + \section{Recommendations for Future Work}\label{improvement_section} + + In the course of producing this algorithm, a large number of improvement possibilities were + noted. This work was based, in large part, on the work of Jacob Englander in a number of + papers\cite{englander2014tuning}\cite{englander2017automated} \cite{englander2012automated} + in which they explored the hybrid optimal control problem of multi-objective low-thrust + interplanetary trajectories. + + In light of this, there are a number of additional approaches that Englander took in + preparing their algorithm that were not implemented here in favor of reducing complexity and + time constraints. For instance, many of the Englander papers explore the concept of an outer + loop that utilizes a genetic algorithm to compare many different flyby planet choices + against each other. + + Further improvements, in the name of performance stem from the field of computer science. An + evolutionary algorithm such as the one proposed by Englander would benefit from high levels + of parallelization. Therefore, it would be worth considering a GPU-accelerated or even + cluster-computing capable implementation of the monotonic basin hopping algorithm. + + Finally, the monotonic basin hopping algorithm as currently written provides no guarantees + of actual global optimization. Generally optimization is achieved by running the algorithm + until it fails to produce newer, better trajectories for a sufficiently long time. But it + would be worth investigating the robustness of the NLP solver as well as the robustness of + the MBH algorithm basin drilling procedures in order to quantify the search granularity + needed to completely traverse the search space. diff --git a/LaTeX/fig/EMJS_plot.png b/LaTeX/fig/EMJS_plot.png index d035262..fddb2e2 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 2aa8823..81e1db9 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 index a39148c..0fd0a94 100644 Binary files a/LaTeX/fig/EMJS_thrust_components.png 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 index 4b8d4d4..4ff5930 100644 Binary files a/LaTeX/fig/EMJS_thrust_mag.png and b/LaTeX/fig/EMJS_thrust_mag.png differ diff --git a/LaTeX/fig/EMS_plot.png b/LaTeX/fig/EMS_plot.png index 536519b..c88dca8 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 6509c23..bfe7aff 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 index e5447e7..6ee1c71 100644 Binary files a/LaTeX/fig/EMS_thrust_components.png 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 index cfc62dd..6cbd6e8 100644 Binary files a/LaTeX/fig/EMS_thrust_mag.png and b/LaTeX/fig/EMS_thrust_mag.png differ diff --git a/LaTeX/results.tex b/LaTeX/results.tex index cafb1b6..c611df3 100644 --- a/LaTeX/results.tex +++ b/LaTeX/results.tex @@ -1,35 +1,10 @@ -\chapter{Results Analysis} \label{results} +\chapter{Sample Saturn Trajectory Analysis} \label{results} The algorithm described in this thesis is quite flexible in its design and could be used as a tool for a mission designer on a variety of different mission types. However, to consider 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 @@ -91,7 +66,17 @@ used by the mass at launch and the $C_3$ number is determined by dividing the $C_3$ at launch by the maximum allowed. These two numbers are then weighted, with the fuel usage value getting a weight of three and the launch energy value getting a weight - of one. The values are summed and returned as the cost value. + of one. The values are summed and returned as the cost value, represented as the value + $J$ below: + + \begin{equation} + J(\vec{x}, m_{dry}, C_{3,max}) = 3 \left| \frac{h(\vec{x})}{m_{dry}} \right| + + \left| \frac{k(\vec{x})}{C_{3,max}} \right| + \end{equation} + + \noindent + Where $h(\vec{x})$ represents the total fuel mass used during the trajectory and + $k(\vec{x})$ represents the launch $C_3$ of the initial phase. \subsection{Flybys Analyzed} @@ -102,9 +87,12 @@ the mission. For this particular mission scenario, the following flyby profiles were - investigated: + investigated (E: Earth, M: Mars, V: Venus, J: Jupiter, S: Saturn). These flyby choices + were initially sampled randomly, but as patterns were noticed during the previous runs, + certain trajectories were chosen to investigate phases that seemed promising. \begin{itemize} + \setlength\itemsep{-0.5em} \item EJS \item EMJS \item EMMJS @@ -128,17 +116,17 @@ contrast to the usual dichotomy of low-thrust travel. The cost function used for this analysis did not include the time of flight as a component of the overall cost, and yet this trajectory still managed to be the lowest cost trajectory of all trajectories found - by the algorithm. + by the algorithm, meaning that it has merit for both a flyby mission as well as a capture + mission. - The mission begins in late June of 2024 and proceeds first to an initial gravity assist - with Mars after three and one half years to rendezvous in mid-December 2027. - Unfortunately, the launch energy required to effectively used the gravity assist with - Mars at this time is quite high. The $C_3$ value was found to be $60.4102$ kilometers - per second squared. However, for this phase, the thrust magnitudes are quite low, - raising slowly only as the spacecraft approaches Mars, allowing for a nearly-natural - trajectory to Mars rendezvous. Note also that the in-plane thrust direction was neither - zero nor $\pi$, implying that these thrusts were steering thrusts rather than - momentum-increasing thrusts. + The mission begins in late June of 2024 and proceeds first to an initial gravity assist with + Mars after three and one half years to rendezvous in mid-December 2027. Unfortunately, the + launch energy required to effectively used the gravity assist with Mars at this time is + quite high. The $C_3$ value was found to be $60.4102 \frac{\text{km}^2}{\text{s}^2}$. However, + for this phase, the thrust magnitudes are quite low, raising slowly only as the spacecraft + approaches Mars, allowing for a nearly-natural trajectory to Mars rendezvous. Note also that + the in-plane thrust angle was neither zero nor $\pi$, implying that these thrusts were + steering thrusts rather than momentum-increasing thrusts. \begin{figure}[H] \centering @@ -158,15 +146,15 @@ \end{figure} The second and final leg of this trip exits the Mars flyby and, initially burns quite - heavily along the velocity vector in order to increase it's semi-major axis. After an - initial period of thrusting, though, the spacecraft effectively coasts with minor - adjustments until its rendezvous with Saturn just four and a half years later in June of - 2032. The arrival $v_\infty$ is not particularly small, at $5.816058$ kilometers per - second, but this is to be expected as the arrival excess velocity was not considered as - a part of the cost function. If capture was not the final intention of the mission, this - may be of little concern. Otherwise, the low fuel usage of $446.92$ kilograms for a - $3500$ kilogram launch mass leaves much margin for a large impulsive thrust to enter - into a capture orbit at Saturn. + heavily along the velocity vector in order to increase its semi-major axis. After an initial + period of thrusting, though, the spacecraft effectively coasts with minor adjustments until + its rendezvous with Saturn just four and a half years later in June of 2032. The arrival + $v_\infty$ is not particularly small, at $5.816058 \frac{\text{km}}{\text{s}}$, but this is + to be expected as the arrival excess velocity was not considered as a part of the cost + function. If capture was not the final intention of the mission, this may be of little + concern. Otherwise, the low fuel usage of $446.92$ kilograms for a $3500$ kilogram launch + mass leaves much margin for a large impulsive thrust to enter into a capture orbit at + Saturn. \begin{figure}[H] \centering @@ -183,7 +171,7 @@ \label{ems_components} \end{figure} - In this case the algorithm effectively realized that a higher-powered launch from + In this case the algorithm effectively discovered 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 effective thrusting. It also determined that the most effective way to achieve this @@ -202,12 +190,11 @@ \section{Slower, More Efficient Trajectory} - Next we'll analyze the nominally second-best trajectory. While the cost function - provided to the algorithm can be a useful tool for narrowing down the field of search - results, it can also be very useful to explore options that may or may not be of similar - "efficiency" in terms of the cost function, but beneficial for other reasons. By - outputting many different optimal trajectories, the MBH algorithm can allow for this - type of mission design flexibility. + Next we'll analyze the nominally second-best trajectory. While the cost function provided to + the algorithm can be a useful tool for narrowing down the field of search results, it can + also be very useful to explore options that may or may not have quite as small of a cost + function value, but beneficial for other reasons. By outputting many different optimal + trajectories, the MBH algorithm can allow for this type of mission design flexibility. To highlight the flexibility, a second trajectory has been selected, which has nearly equal value by the cost function, coming in slightly lower. However, this trajectory @@ -276,81 +263,51 @@ While the fuel use is also slightly higher at $530.668$ kilograms, plenty of payload mass is still capable of delivery into the vicinity of Saturn. Also, it should be noted that the incoming excess hyperbolic velocity at arrival to Saturn is significantly - lower, at only $3.4774$ kilometers per second, meaning that less of the delivered + lower, at only $3.4774\frac{\text{km}}{\text{s}}$, meaning that less of the delivered payload mass would need to be taken up by impulsive thrusters and fuel for Saturn orbit capture, should the mission designer desire this. - Also, as mentioned before, the launch energy requirements are quite a bit lower. Having - a second mission trajectory capable of launching on a smaller vehicle could be valuable - to a mission designer presenting possibilities. According to an analysis of the Delta IV - and Atlas V launch configurations\cite{c3capabilities} in Figure~\ref{c3}, this + \section{Final Trajectory Analysis} + + Ultimately, two optimized trajectories were selected to be excellent candidates for further + consideration. The resultant flyby selection, launch and arrival dates, and relevant cost + function input 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} + + As mentioned before, the launch energy requirements of the second trajectory are quite a bit + lower. Having a second mission trajectory capable of launching on a smaller vehicle could be + valuable to a mission designer presenting possibilities. According to an analysis of the + Delta IV and Atlas V launch configurations\cite{c3capabilities} in Figure~\ref{c3}, this reduction of $C_3$ from around 60 to around 40 brings the sample mission to just within - range of both the Delta IV Heavy and the Atlas V in its largest configuration, neither - of which are possible for the other result, meaning that either different launch - vehicles must be found or mission specifications must change. + range of both the Delta IV Heavy and the Atlas V in its largest configuration, neither of + which are possible for the other result, meaning that either different launch vehicles must + be found or mission specifications must change. \begin{figure}[H] \centering \includegraphics[width=\textwidth]{fig/c3} \caption{Plot of Delta IV and Atlas V launch vehicle capabilities as they relate to - payload mass} + payload mass \cite{c3capabilities} from a source from 2007} \label{c3} \end{figure} - -\chapter{Conclusion} \label{conclusion} - - \section{Overview of Results} - - A mission designer's job is quite a difficult one and it can be very useful to have - tools to automate some of the more complex analysis. This paper attempted to explore one - such tool, meant for automating the initial analysis and discovery of useful - interplanetary, low-thrust trajectories including the difficult task of optimizing the - flyby parameters. This makes the mission designer's job significantly simpler in that - they can simply explore a number of different flyby selection options in order to get a - good understanding of the mission scope and search space for a given spacecraft, launch - window, and target. - - In performing this examination, two results were selected for further analysis. These - results are outlined in Table~\ref{results_table}. As can be seen in the table, both - resulting trajectories have trade-offs in mission length, launch energy, fuel usage, and - more. However, both results should be considered very useful low-thrust trajectories in - comparison to other missions that have launched on similar interplanetary trajectories, - using both impulsive and low-thrust arcs with planetary flybys. Each of these missions - should be feasible or nearly feasible (feasible with some modifications) using existing - launch vehicle and certainly even larger missions should be reasonable with advances in - launch capabilities currently being explored. - - \section{Recommendations for Future Work}\label{improvement_section} - - In the course of producing this algorithm, a large number of improvement possibilities - were noted. This work was based, in large part, on the work of Jacob Englander in a - number of papers\cite{englander2014tuning}\cite{englander2017automated} - \cite{englander2012automated} in which he explored the hybrid optimal control problem of - multi-objective low-thrust interplanetary trajectories. - - In light of this, there are a number of additional approaches that Englander took in - preparing his algorithm that were not implemented here in favor of reducing complexity - and time constraints. For instance, many of the Englander papers explore the concept of - an outer loop that utilizes a genetic algorithm to compare many different flyby planet - choice against each other. This would create a truly automated approach to low-thrust - interplanetary mission planning. However, a requirement of this approach is that the - monotonic basin hopping algorithm algorithm must converge on optimal solutions very - quickly. Englander typically runs his for 20 minutes each for evolutionary fitness - evaluation, which is over an order of magnitude faster than the implementation in this - paper to achieve satisfactory results. - - Further improvements to performance stem from the field of computer science. An - evolutionary algorithm such as the one proposed by Englander would benefit from high - levels of parallelization. Therefore, it would be worth considering a GPU-accelerated or - even cluster-computing capable implementation of the monotonic basin hopping algorithm. - These cluster computing concepts scale very well with new cloud infrastructures such as - that provided by AWS or DigitalOcean. - - Finally, the monotonic basin hopping algorithm as currently written provides no - guarantees of actual global optimization. Generally optimization is achieved by running - the algorithm until it fails to produce newer, better trajectories for a sufficiently - long time. But it would be worth investigating the robustness of the NLP solver as well - as the robustness of the MBH algorithm basin drilling procedures in order to quantify - the search granularity needed to completely traverse the search space. From this - information, a new MBH algorithm could be written that is guaranteed to explore the - entire space. diff --git a/LaTeX/thesis.tex b/LaTeX/thesis.tex index cc1a09c..ba01f91 100644 --- a/LaTeX/thesis.tex +++ b/LaTeX/thesis.tex @@ -20,26 +20,40 @@ \abstract{ \OnePageChapter - There are a variety of approaches to finding and optimizing low-thrust trajectories in - interplanetary space. This thesis analyzes one such approach, namely the application of a - Monotonic Basin Hopping (MBH) algorithm to a series of Sims-Flanagan transcribed trajectory arcs - and its applications in a multiple-shooting non-linear solver for the purpose of finding valid - low-thrust trajectories between planets given poor initial conditions. These valid arcs are then - fed into the MBH algorithm, which combines them in order to find and optimize interplanetary - trajectories, given a set of flyby planets. This allows for a fairly rapid searching of a very - large solution space of low-thrust profiles via a medium fidelity inner-loop solver and a - well-suited optimization routine. The trajectories found by this method can then be optimized - further by feeding the solutions back, once again, into the non-linear solver, this time - allowing the solver to perform optimization. + Much work has been performed recently to utilize the increasingly viable technology of + low-thrust electric propulsion systems on missions of interplanetary scope. This thesis analyzes + a technique for the initial analysis of feasibility of utilizing a combination of low-thrust + propulsion systems and natural gravity flybys for missions to the outer planets. First, a method + for finding local optima by utilizing an interior-point linesearch algorithm to directly + optimize the entire trajectory as a Non-Linear Programming problem is presented. Then, a + Monotonic Basin Hopping algorithm is utilized to traverse the search space, improve the local + optima determined by the internal optimizer, and determine the global optima. This allows for a + medium-fidelity, fully automated global optimization of the low thrust controls and flyby + parameters for a given mission objective. } \dedication[Dedication]{ - Dedicated to some people. + \begin{center} + I'd like to dedicate this work to anyone with an interest in space. + + We're all exploring this together. + \end{center} } \acknowledgements{ \OnePageChapter - This will be an acknowledgement. + I owe just about everything that I am today to the circumstances that I grew up in and in no + area of my life is that more apparent than in my loving family. I'd like to thank them for + providing me with the emotional support I needed to grow confident in my own abilities and the + logistical support I needed to nurture my curiosities. + + I'd also like to thank my girlfriend, Rachael, for supporting me through this process. This has + not been an easy time for me, and I owe a lot to your support this past year. + + Finally, I'd like to give a huge thanks to Dr. Bosanac, who provided me with the structure I + needed to stay on track, the motivation I needed to really get the most out of this paper, and + the guidance I needed to finish this up. It's no exxageration to say that this thesis wouldn't be + written to anywhere near the level of quality it was without you. } \emptyLoT @@ -58,6 +72,8 @@ \input LaTeX/results.tex + \input LaTeX/conclusion.tex + \bibliographystyle{plain} \nocite{*} \bibliography{thesis} diff --git a/LaTeX/trajectory_design.tex b/LaTeX/trajectory_design.tex index f892a2e..d82a9f4 100644 --- a/LaTeX/trajectory_design.tex +++ b/LaTeX/trajectory_design.tex @@ -85,45 +85,6 @@ Since the spacecraft is acting only under the gravitational influence of the planet and no other forces, we can define the total specific mechanical energy as: - - We may also wish to utilize the total orbital energy for a spacecraft within this model. - Since the spacecraft is acting only under the gravitational influence of the planet and - no other forces, we can define the total specific mechanical energy as: - - - We may also wish to utilize the total orbital energy for a spacecraft within this model. - Since the spacecraft is acting only under the gravitational influence of the planet and - no other forces, we can define the total specific mechanical energy as: - - - We may also wish to utilize the total orbital energy for a spacecraft within this model. - Since the spacecraft is acting only under the gravitational influence of the planet and - no other forces, we can define the total specific mechanical energy as: - - - We may also wish to utilize the total orbital energy for a spacecraft within this model. - Since the spacecraft is acting only under the gravitational influence of the planet and - no other forces, we can define the total specific mechanical energy as: - - - We may also wish to utilize the total orbital energy for a spacecraft within this model. - Since the spacecraft is acting only under the gravitational influence of the planet and - no other forces, we can define the total specific mechanical energy as: - - - We may also wish to utilize the total orbital energy for a spacecraft within this model. - Since the spacecraft is acting only under the gravitational influence of the planet and - no other forces, we can define the total specific mechanical energy as: - - - We may also wish to utilize the total orbital energy for a spacecraft within this model. - Since the spacecraft is acting only under the gravitational influence of the planet and - no other forces, we can define the total specific mechanical energy as: - - - We may also wish to utilize the total orbital energy for a spacecraft within this model. - Since the spacecraft is acting only under the gravitational influence of the planet and - no other forces, we can define the total specific mechanical energy as \cite{vallado2001fundamentals}: \begin{equation} \label{energy} @@ -660,7 +621,7 @@ The primary use of SPICE in this thesis, however, was to determine the planetary ephemeris at a known epoch. Using the NAIF0012 and DE430 kernels, ephemeris in the - ecliptic plane J2000 frame could be easily determined for a given epoch, provided as + ecliptic plane J2000 frame (ICRF) could be easily determined for a given epoch, provided as a decimal Julian Day since the J2000 epoch. \subsubsection{Porkchop Plots} diff --git a/julia/ingest_mission.jl b/julia/ingest_mission.jl index e71f392..e7a0964 100644 --- a/julia/ingest_mission.jl +++ b/julia/ingest_mission.jl @@ -53,7 +53,6 @@ println(get_id.(sorted_missions1[1:5])) println(get_id.(sorted_missions2[1:5])) # long, short = improve.(sorted_missions2[1:2], n=7)#, use_cost=true) -display_mission = long # Display Orbit Plot # display(Thesis.plot(long, @@ -66,22 +65,22 @@ display_mission = long # Save Orbit Plot savefig(Thesis.plot(short, title="EMS Mission Profile", mode="light", planet_colors=false, - phase_colors=["#F00","#F0F","#6AF"], markers=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, + 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, - phase_colors=["#F00","#F0F","#6AF"], markers=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, - phase_colors=["#F00","#F0F","#6AF"], markers=false, planets=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) @@ -90,16 +89,16 @@ 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"), +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"), +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"), +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"), +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) diff --git a/julia/src/utilities/plotting.jl b/julia/src/utilities/plotting.jl index ae41a22..d786473 100644 --- a/julia/src/utilities/plotting.jl +++ b/julia/src/utilities/plotting.jl @@ -320,6 +320,7 @@ function plot(m::Union{Mission, Mission_Guess}; markers=true, planets=true, camera=nothing, + legend=true, ) # First plot the earth # Then plot phase plus planet phase @@ -402,6 +403,8 @@ function plot(m::Union{Mission, Mission_Guess}; layout["scene_camera_eye_z"] = camera[2][3] end + layout["showlegend"] = legend + # Plot PlotlyJS.plot( PlotlyJS.Plot( traces, layout ) ) @@ -434,6 +437,7 @@ end function plot_thrust(m::Union{Mission, Mission_Guess}; title::String="Mission Plot", mode::String="dark", + legend=true, ) times = Vector{String}() vals = Vector{Float64}() @@ -467,6 +471,8 @@ function plot_thrust(m::Union{Mission, Mission_Guess}; yaxis_range=[0.0,maximum(vals)*1.02], ) + layout["showlegend"] = legend + # Plot PlotlyJS.plot( PlotlyJS.Plot( traces, layout ) ) @@ -475,6 +481,7 @@ end function plot_thrust_components(m::Union{Mission, Mission_Guess}; title::String="Mission Plot", mode::String="dark", + legend=true, ) traces = Vector{PlotlyJS.AbstractTrace}() times = Vector{String}() @@ -519,6 +526,8 @@ function plot_thrust_components(m::Union{Mission, Mission_Guess}; yaxis_range=[min(minimum(αs),minimum(βs))*1.02,max(maximum(αs),maximum(βs))*1.02], ) + layout["showlegend"] = legend + # Plot PlotlyJS.plot( PlotlyJS.Plot( traces, layout ) )