OHM Trajectory Optimization Tool v2.1

OrbitHangar

Addon Comments
Joined
Apr 9, 2008
Messages
3,832
Reaction score
13
Points
0

Author: arrowstar


The Trajectory Optimization Tool is a MATLAB-based utility used for finding the optimal trajectory between any number of bodies in the solar system.  Given an initial planet, the subsequent bodies to visit, and a range of dates for launch and arrival, this tool will provide the user with the optimal flight plan for accomplishing the mission's goals.  It is a perfect complement to TransX or similar Orbiter MFDs in that it can provide launch and arrival dates, deltaV estimates, and other necessary figures needed to execute an interplanetary mission.

The internals of the software use a Gooding solver in order to solve Lambert's problem.  A patched conics approximation is used when computing flyby manuevers.  Ephemerides provided are from JPL's Navigation and Ancillary Information Facility.

This software was created and tested on MATLAB 2010b and requires the MATLAB Compiler Runtime, version 7.14 (included) to execute.

Version History
Version 2.0 – Major Revision. Completely rewrote application from scratch. Now includes ability to globally optimize arbitrary trajectory using genetic algorithms. Completely new user interface. Ability to generate individual pork chop plots independent of optimization run. Trajectories are now plotted as a visual aid. Documentation completely rewritten. Numerous other rewrites, updates, and corrections.

Version 2.1 – Major Revision.  Added the Departure Analysis Tool, Date Conversion Tool, and Flight Constraints to the software.  Numerous bug fixes and updates to the analysis code, menus, and displays.  Updated documentation.

Version 2.1.1– Minor revision.  Changed the working reference frame from J2000 (Earth mean equator) to J2000 (ecliptic plane).  Added constraint options on C3 energy, fly-by Delta-V, and arrival speed.  Changed the “pre-departure” reference frame in the Departure Analysis Tool (DAT) from J200 to the local, non-inertial (landmass-fixed) IAU reference frame for the departure body.  Corrected how the DAT computed hyperbolic semi-major axes.  Added additional hard constraints to DAT optimization.  Revised documentation.  Procured new TOT logo.

Note
Version 1.1.2 is still available on OHM.  Upgrading to version 2.0 is highly recommended, however.

DOWNLOAD
 

usmc3891

OFSS III Pilot
Joined
Oct 9, 2008
Messages
80
Reaction score
0
Points
0
Location
New Orleans
How do I go about using the flight plan generated by the TOT with Transx?
 

SuprunP

New member
Joined
Nov 28, 2011
Messages
76
Reaction score
0
Points
0
Are there any special settings to be able to calculate an Earth-Moon trajectory?

Whenever I try to do this I get 'funny' results:
Code:
OPTIMUM EARTH DEPARTURE DATE: 9/27/2017 12:32:46 - C3: 0.00036871 kmІ/secІ
OPTIMUM MOON ARRIVAL DATE: 3/10/2018 16:51:23 - Body-centric Arrival Velocity: 0.89091 km/sec

TOTAL COST: 1.7821829

It's a tad long journey, isn't it? :rolleyes:

Thanks.
 

Arrowstar

Probenaut
Addon Developer
Joined
May 23, 2008
Messages
1,785
Reaction score
0
Points
36
For now, TOT is only able to compute interplanetary (Sun-centered) trajectories. The reason you're getting odd results is because the Sun is at the center of your trajectory.

There are two main technical hurdles to allowing what you want. First, I need to implement user-definable central bodies, so you can change that from the Sun to Earth. There are some places where that will be easy and some where it will be hard. Second, you would have to define the orbit you're in around the Earth, since you couldn't just say you were at "Earth" when Earth is the central body. Lambert solvers go crazy if you ask for a trajectory that goes through <0,0,0>. However, at the moment, the TOT gets all of its positions from the position of the body you're going, so there's no way to define an orbit ATM.

To be honest, I may write a separate Earth-Moon trajectory optimizer tool that allows you to enter the desired departure orbit from Earth and the type of orbit you want to be at the Moon (free return or specific inclination, RAAN, argument of periapse, SMA, ECC, things like that). By doing this, I can get around the limitations of the two-body solver that's currently implemented and which works great for interplanetary flights, but not so great when you need to include the gravity of the Earth, Moon, and Sun, and start at a location not defined by the location of a planet/moon/etc.

So long story short, I have some work to do in order to allow you to do what you're after. :)
 

n72.75

Move slow and try not to break too much.
Orbiter Contributor
Addon Developer
Tutorial Publisher
Donator
Joined
Mar 21, 2008
Messages
2,696
Reaction score
1,355
Points
128
Location
Saco, ME
Website
mwhume.space
Preferred Pronouns
he/him
Minor UI bug:
 

Attachments

  • tot_problem.jpg
    tot_problem.jpg
    148 KB · Views: 104

Arrowstar

Probenaut
Addon Developer
Joined
May 23, 2008
Messages
1,785
Reaction score
0
Points
36
Hmm, I've never seen that before. Does restarting the program fix the issue? Is this a common occurrence, or does it happen randomly?
 

n72.75

Move slow and try not to break too much.
Orbiter Contributor
Addon Developer
Tutorial Publisher
Donator
Joined
Mar 21, 2008
Messages
2,696
Reaction score
1,355
Points
128
Location
Saco, ME
Website
mwhume.space
Preferred Pronouns
he/him
Hmm, I've never seen that before. Does restarting the program fix the issue? Is this a common occurrence, or does it happen randomly?

It happens every time I open the program in exactly the same way.

I'm running Windows 7 x64 service pack 1, build 7601.
I've installed the included Matlab Runtime Compiler.

I also have Matlab 7.8.0.347 student installed.

Processor is an AMD E-350(MMX, SSE, SSE2, SSE3, SSSE3, SSE4A), I have 8192MB ram.
 

Vast fury

New member
Joined
Dec 20, 2011
Messages
39
Reaction score
0
Points
0
Location
Zamboanga del norte
Its great having programmers like you devoting your efforts for all. Um, are you even recieving funds? I hope so. cuz programming is damn hard and tiring...


Anyways, Thank you for creating and sharing amazing tools for us.:tiphat:

---------- Post added at 07:12 AM ---------- Previous post was at 07:09 AM ----------

"And the night followed day
And the story tellers say
That the score brave souls inside
For many a lonely day
Sailed across the milky seas
Ne'er looked back never feared never cried."

Awesome! who originally qouted this?
 

Arrowstar

Probenaut
Addon Developer
Joined
May 23, 2008
Messages
1,785
Reaction score
0
Points
36
It happens every time I open the program in exactly the same way.

Sorry, I just saw this now. Did the issue ever resolve itself? I don't suppose you'd be willing to uninstall the old version of MATLAB and see if it works then?

Its great having programmers like you devoting your efforts for all. Um, are you even recieving funds? I hope so. cuz programming is damn hard and tiring...

Anyways, Thank you for creating and sharing amazing tools for us.

Nope, I'm doing this for the fun of it. :)
 

aftercolumbia

New member
Joined
Aug 17, 2011
Messages
14
Reaction score
0
Points
0
Hi, all

I want to let you guys know there is a naif0010.tls file due to a new leap second introduced for July 1 of this year. All of the SPICEy trajectory planners i can find at www.orbithangar.com are still using naif0009.tls. (I want to install it in my thermostat, lol. I live in a no-DST time zone and the silly thing leaped an hour for daylight savings time. *punt*)

Also, particular to this trajectory planner, I am missing all the listings except for waypoint body whenever I make a flight plan, and the optimizer won't run (I put my original post on the thread for the version that doesn't have the MATLAB redist package.) I suspect they are related.

I'm off to bug the other big SPICE supporting trajectory planner thread now to point out his C++ redist dlls don't work...

Terry

---------- Post added at 08:26 PM ---------- Previous post was at 12:57 AM ----------

Now that I've got it working (apparently, it works best in XP/SP3 compatibility mode :huh:), the results are pretty much as good as I could have expected.

Let me tell just a little story to introduce my problem: Once upon a time, there was MarsDrive Consortium, and they want to get people to Mars. To help coordinate their efforts, they set up a mailing list here:

http://groups.yahoo.com/group/MarsDriveMission

Before I go any further off topic, if you get the jist of "Flyby Earth Return Vehicle" and are not interested in the story behind it, skip to the next :thumbup:

It tends to be most productive when the smartest two or three people are hissing at each other like cats but not taking it personally. Currently, the top three cats are Michael J. Bloxham, David B. Gooding, and... what was my name again?

A big problem we had on a previous version was that we needed to assemble a huge vehicle for returning the crew to Earth. Unlike Robert Zubrin (a long time ago, in a galaxy far, far away, he came up with the brilliant idea of making your own fuel on Mars for the return trip, forgetting that landing on Mars is literally pulling a miracle out of thin air to begin with. While his ERV is very elegant, landing directly on Mars and returning directly to Earth, it is also downright enormous and asks the impossible task of building a hydrogen tank both light enough for use in a planetary ascent vehicle and well insulated enough to store liquid hydrogen for something like a year.) We do not ask the impossible of our Destiny MAV, who has the following problems:

1. She needs to fit in the little Stampede Lander we're using. Failing that, her parts from different Stampede Landers must be easy to assemble.
2. As a result of the lander constraint, little other functionality is included with the Destiny first stage, which, until recently, was the only stage.
3. Hydrogen from Earth is shipped in separately.
4. The spacecraft provided for the crew is of limited functio- well... I guess I should just admit that there isn't one: the crew are basically seatbelted to the top of the booster and launched in their spacesuits. I'm oversimplifying it a bit, but that's the jist of it.
5. The launched crew then must rendezvous pretty fast with the ERV, and well...

Due to problems germain to the EDL system, aerocapture started looking really bad really fast, and the ERV is just too big to consider aerocapture. Aerocapture was ruled out for capturing the crew outbound element to Mars to wait out the potential global dust storm, and for a time, propulsive capture was used instead. This was also dropped, since if we couldn't provide the same benefit for the supplies, Destiny MAV, and other surface elements, providing it for the crew led to very little benefit. The ERV was a bigger problem. We were launching this little re-entry module with this somewhat larger, but still relatively small space habitat, and to push it out of Earth orbit, capture it into Mars orbit, and then launch it out of Mars orbit once the crew had ascended to it, it had a long string of space maneuver stages attached to it.

Michael's crazy idea: Let's make Destiny go a bit faster (we had kept the ERV in a relatively high orbit, so this idea didn't add a lot of difficulty to the ascent from Mars, relatively speaking) and catch a flyby ERV as it went past Mars. To pull this off, we added a second stage to the Destiny MAV (more expensive than it looks because we have two Destiny vehicles just in case one crashes during her landing attempt.) This eliminated most of the maneuver stages, but the art of planning this ERV's trajectory is much harder to paint. So far, I have found two brushes. One is STK, which I can't use for a number of reasons. Can anyone guess what the other one is? :thumbup:

So, I've been running an analysis of:

1. It launches from Earth
2. It flies by Mars
3. It comes back to Earth
4. Earliest launch 2023 January 1
5. Latest return to Earth 2026 January 1
6. Weight 0.25 on Departure C3
7. Weight 5.00 on Flyby Delta-v (i.e.: it must be zero, or there's no point.)
8. Weight 1.00 on Arrival speed

So far, I haven't tried anything other than crossoverheuristic, but after watching its travails so far, I'm going to. For selection, I've used selectionuniform, selectionstochunif, and selectionroulette. Selectionroulette has given the best results.

At first, I ran it completely unconstrained, but there is a mission requirement that the return leg is 180 days for the crew, based on a perspective of supply mass, life support state-of-the-art and cosmic radiation exposure. I began applying this constraint more recently.

As a practical matter, the ERV must flyby Mars at an altitude of about 200km where the Destiny MAV can perform the rendezvous kick. I can't apply this constraint in TOT yet, but I'll try to coax out something, possibly by figuring out from the algorithm monitoring window, the behaviour showing when the Delta-v has reached zero and then stopping it manually. The results will suck, but it should be good enough (along with more typical solutions) as an initial proof of concept. I also need something flyable in Orbiter. Another constraint that I am not worried about is that the areocentric equatorial inclination of the ERV's flyby trajectory must be at least the latitude of Destiny's launch site. This could be more significant if we decide to land in Hellas Basin because of EDL problems.

(Note: If you're not otaku no Mars, Hellas Basin is a large area in the southern hemisphere averaging MOLA-8km, the lowest on Mars. Relative to Earth features, this basin makes the Dead Sea look like a backyard gully.)

On the TOT's behaviour.

If it acts like the genetic algorithms that have been generally marketed to prove Evolution (in which, I can usually get much further under the hood than with TOT), it starts out with a bunch of crazy garbage not even Jorde la Forge and Montgomery Scott could team up to fly, except for maybe one or two. These one or two then determine the overall direction of the evolution within a few generations.

TOT almost immediately (I know from stopping it manually) begins to follow an Earth resonant orbit with a distant flyby of Mars, and within a few generations, finds it to be inescapable, even if it is really poor (one was a retrograde two year orbit, with a minimum weight of just over 1000!)

For this reason, I selected a more random selection algorithm with the hopes of it being more likely to "jump" to a better solution. Something else that helps is using a really large population. 50s and 100s usually fail. The highest I've tried is 500 and I've still had it stabilize on a one year orbit with an outbound periapsis near Mercury, weight of about 65, and outbound C3 of about 210km/s2 (note, the real life record is New Horizons at about 100.) To prevent this, I put a constraint on the minimum trip time. I'm going to try some runs with it turned off, as it is not critical to our mission plan. What is critical is a feasible departure C3 (the usual two year orbit gives an outbound C3 of about 27km2/s2, which is a bit high), a survivable Earth arrival speed (the usual is about 12415m/s hitting the atmosphere), and a zero delta-v during the Mars flyby (it usually has about 1 mm/s, I think that's an effect of the algorithm.)

The crossover algorithm seems to affect the "homing" function, and I'd guess there's nothing much that can be done to help the stubborn Pacific Salmon spawning in the St. Lawrence River find the handier Columbia. I haven't fiddled around with vectors enough with textbook and paper to visualize what crossoverscattered would look like, but I'd expect that the fastest homing algorithms would be crossoverheuristic, crossoverintermediate, and crossoverarithmetic. Based on Arrowstar's suggestion, I think that what I call the "tangental" case of parents being nearly equal distance from the minimum is rather rare. In this case, crossoverheuristic would spit the child out on the line passing through the two parent points, on the side of the "mother". In this tangental case, the child would obviously be further away from the minimum than the mother, and possibly both parents. If this happened a lot, crossoverintermediate (which puts the child between the parents) would home much faster. I'll try crossoverarithmetic, because its behaviour is between the two. I don't have enough waypoints for crossoversinglepoint to be effective, and with just three waypoints, crossovertwopoint is useless (it essentially kicks daddy out of bed and you wind up with a bunch of cloned girls. Eventually, it would get unlucky enough to have nothing but cloned girls and the run would stop early; bigger populations would put that off.)

Other suggestions:

1. The ability to zoom in on the monitoring graph!! Usually in the first generation, there is a rediculous mutant with a cost in the hundreds of thousands, or millions, whom I call "the guy guarding the goat path" after Ephialtes in the Battle of Thermopylae (the hunchback in 300). This guy sizes the graph, and so the rest of the points (almost all of which are under a thousand) wind up flattened near the bottom, making it impossible to observe any pattern except by either taking notes of the numbers or running CamStudio to automate the same process. Another option would be to plot these points on a logarithmic scale.

2. The ability to grab a point and draw it on the main output window. If I have to pause the optimization to do this, I don't care. It would also be neat if I could "freeze" a population and later be able to load it up from the freezer and run it, to see what different solutions are possible from a partially optimized population (this might also be handy if the population were immature enough to select, say, 1.5, 2 or 3 year orbits, but the obvious death traps of retrograde and 1 year orbits have been ruled out already. Also, the ability to drop the population size in this case might speed up the final homing phase of the optimization.

3. The ability to set the fitness function tolerance to zero. This means it'll run until either I stop it on purpose or it hits the iteration limit. For safety, I'd set an alarm to detect if the user puts on both a zero fitness tolerance and an infinite number of iterations. Setting zero function tolerance, infinite iterations, and unchecking Monitor would lock the program, and the only way to kill it would be the Task Manager or the power switch.

4. Animation function similar to what www.astrojava.com has. This would be the fastest way to tell if the population has evolved into a retrograde solution (even for a guy like me who can figure it out pretty fast from four figure C3s.)

5. The ability to view the output from within the ecliptic plane. This would allow me to see what the inclination of the orbit is.

I remember there being a B-plane plot or something like that. I thought it was in this tool (an earlier version of it?) but now I can't find it anywhere. It showed how the spacecraft could approach a planetary flyby and how much delta-v it would require to stick to the flight plan depending on where it decided to go. An example would be a gravitational flyby of Venus to go from Earth to Jupiter (such as depicted in the manual artwork.) Say for a particular plan, the departure windows didn't quite line up, and you needed to do a maneuver at Venus to make it to Jupiter. The optimal point would be at the minimum radius over the night side (could be the day side, but not for this example) and this would be drawn as blue. The worst would be on the day side minimum radius, and colored red. The plot of intermediate values was an adorable quasi-magnetic flower with the planet in the middle having pastel neutral colors over the poles. Does that ring a bell for anyone?

6. Just in case you missed it, can I set constraints for flyby or arrival radii, pretty please??? I remember that Mariners 2 and 4 had such constraints for radiometry, photometry, and occultation experiments even though they were not to proceed to other destinations beyond. Mariner 10, Pioneer 11, Voyager 1, and Voyager 2 also had such constraints for their flybies when they were heading to destinations beyond. Cassini also could not get too close to Jupiter lest she be fried by the planetary particle radiation belts. Those are just a few cases other than my own.

Thanks for the work done so far, and I hope you keep at it!!

Terry
 

orbekler

Member
Joined
Nov 25, 2010
Messages
340
Reaction score
0
Points
16
Hello, I'm trying to make a trip to Mars, followed by Venus, and I'm puzzled with the following situation:

If I set Earliest date to 2012 and Latest to 2015 I got this plan:

Code:
RESULTS
--------------------------------
OPTIMUM EARTH DEPARTURE DATE: 12/13/2013 23:20:46 - C3: 9.0105 km²/sec²
OPTIMUM MARS SWINGBY DATE: 10/17/2014 21:48:1 - Powered Delta-V Required: 20.6605 km/sec
OPTIMUM VENUS ARRIVAL DATE: 3/29/2015 13:36:59 - Body-centric Arrival Velocity: 5.4746 km/sec

TOTAL COST: 14.4850841

case 1.jpg
GOOD!

But if I change ONLY the Latest date to 2020 I got this:

Code:
RESULTS
--------------------------------
OPTIMUM EARTH DEPARTURE DATE: 11/15/2013 2:10:8 - C3: 20.694 km²/sec²
OPTIMUM MARS SWINGBY DATE: 7/3/2014 20:4:6 - Powered Delta-V Required: 408.9287 km/sec
OPTIMUM VENUS ARRIVAL DATE: 3/20/2017 1:23:10 - Body-centric Arrival Velocity: 17.7094 km/sec

TOTAL COST: 38.4033360

case 2.jpg

that of course is much worse than the the first one, even if the date span covers both cases.
Shouldn't TOT find the best energy within date span?
 

Furet

Active member
Joined
Aug 7, 2011
Messages
199
Reaction score
55
Points
28
Location
France
It is a very powerful tool, but I'm really frustrated as I'm unable to translate the plans into TransX terms (i.e. prograde/outward/ch. plane velocity).

Anyway, this is a very impressive work. Thank you so much for sharing it. :tiphat:
 

Furet

Active member
Joined
Aug 7, 2011
Messages
199
Reaction score
55
Points
28
Location
France
Departure Inclination

Hi.

I'm trying to use the Departure Analysis Tool, and I wondered why the inclination of the first leg is different of the one computed by the Trajectory Optimization Tool.

DAT Capture.JPG

On this capture we have 21.74675 degrees from the Optimization Report, and 0.37955 in the Departure Analysis Tool.

I've just realised that 21.74675 degrees is 0.37955 radians. Is it deliberate ? As a result, I don't really know what number to fill the Pre-departure Orbit Inclination with. I've tried both degrees and radians, but nothing matches the first leg Inclination on the sketch at the right of the window. :shrug:

Any explanation ?
 

blixel

Donator
Donator
Joined
Jun 29, 2010
Messages
647
Reaction score
0
Points
16
It happens every time I open the program in exactly the same way.

I'm running Windows 7 x64 service pack 1, build 7601.
I've installed the included Matlab Runtime Compiler.

Did you ever solve this UI problem? I'm getting the same thing.

ZoA7A.png
 

Nyrath

New member
Joined
Feb 8, 2012
Messages
1
Reaction score
0
Points
0
I'm having a problem with the software.

Windows 7, service pack 1.

I download the file, unpack it, run the MCRInstaller.exe.
But when I try to run trajOptTool2.exe it complains:

Could not find the version 7.14 of the MCR.
Attempting to load mclmcrrt7_14.dll.
Please install the correct version of the MCR.
Contact your vendor if you do not have an installer for the MCR.


MATLAB apparently installed to
C:\Program Files (x86)\MATLAB\MATLAB Compiler Runtime\v714
but Trajectory Optimization Tool cannot seem to find it.

What am I doing wrong?

---------- Post added 08-18-13 at 01:01 PM ---------- Previous post was 08-17-13 at 11:07 PM ----------

Ah, I fixed it. I had to re-boot the computer so it could re-read the System path variable. Sorry for the bother.
 
Last edited by a moderator:

Arrowstar

Probenaut
Addon Developer
Joined
May 23, 2008
Messages
1,785
Reaction score
0
Points
36
Jeez, did this get popular again? :p

To be honest, folks, I haven't updated TOT in something like 2 years. I probably wouldn't even know where to begin to fix bugs, to be honest. I hate to say it, but any actual development here has probably stopped: I just don't have the creativity for it right now. I'm certainly happy to help answer questions, of course! It's just that fixing bugs probably won't happen for a long time, if ever.

Sorry about that guys, but better to be honest about it than dodge the question.
 

Tenmu-101

New member
Joined
Sep 16, 2013
Messages
24
Reaction score
0
Points
0
Location
Chiang Mai
Okay , this is my interpretation at Departure analysis tool
(I don't sure whether if I'm right or I'm wrong)

Outbound transfer orbit information is auto enter by TOT (if you run optimization)

Pre-departure orbit information
Precise information can be found by scenario editor
Code:
Semi major axis = Semimajor axis of your orbit , in km
Eccentricity = No need to say
Inclination = Equatorial inclination
Right ascension of ascending node = Simply , enter your Equatorial LAN (tested on J2000 and J2014.6) (takes me long time to figured it out)
Argument of Periapse = Longitude of periapsis - LAN
Information box
Code:
V component = Prograde if + , Retrograde if - (in m/s)
N component = Normal if + , antinormal if -
C component = Outward if + , Inward if -

to convert True anomaly to Mean anomaly , informations can be found here
http://en.wikipedia.org/wiki/Eccentric_anomaly
http://en.wikipedia.org/wiki/Mean_anomaly
And convert Mean anomaly to Mean longitude
Mean longitude = Mean anomaly +  Longitude of periapsis
 

GodAtum

Member
Joined
Jun 1, 2014
Messages
82
Reaction score
5
Points
8
Website
godatum.blogspot.com
I'm reading the manual and just trying to work out how to get the dV. I'm familiar with the Trajectory Planner but not sure how to use this tool to export to transX?
 
Last edited:

wingnut

Donator
Donator
Joined
May 10, 2013
Messages
129
Reaction score
0
Points
16
I'm afraid you cannot directly export the tool's results to transX. It will help you to setup your transX plan, i. e. when to set the departure date and round-about when the encounter(s) should happen.

As I recall there had been a similar question regarding the departure analysis tool which was not really resolved.
 
Top