# How to design a lunar flyby trajectory in GMAT?

I am trying to design a flyby mission to the moon using electric propulsion on GMAT. I've gone through the tutorials, however, the most useful one "Lunar Flyby to the moon using multiple shooting" requires the use of the VF13ad plugin which is not compatible for GMAT 2018a.

What could be done alternatively to achieve the flyby simulation? How do I go about starting the mission design process?

• Excellent question!
– uhoh
May 10, 2020 at 14:44

Are you required to use 2018a instead of 2020a? If not, I would recommend 2020a.

The VF13 pluging allows for SQP optimization: this is needed because in a low-thrust optimization scenario, your problem is not of rank 1, so there isn't an obvious solutio.

There are other SQP solvers, such as SNOPT, IPOPT, or OpEn. Of those, IPOPT is an interior point optimizer which, I was told, isn't great for very large sparse Jacobians (1000 or more rows). SNOPT is free for students but costs a lot for corporations: it also used to be a pain in the neck to compile into GMAT so you'll probably need to reach out to Steve Hughes to compile it correctly.

More generally, astrodynamics engineers do not use GMAT to generate thrust profiles for low thrust optimization. In my experience, one approach consists in generating the low thrust optimization thrusting angles in a custom low-fidelity tool and import that into GMAT via Python.

By mid-April 2021, Nyx should have multiple shooting implemented (using OpEn) which will allow for solving low thrust optimization problems directly in high fidelity. The toolkit is validated against GMAT. (Disclaimer: I am the author of Nyx.)

If you know how to use the Lunar B-plane to target a gravity assist, GMAT can target a Lunar Gravity Assist using its Differential Corrector, i.e. Target and Achieve BdotR and Achieve BdotT. B-Plane targeting is discussed in Vallado 4th ed1. pp. 961 - 964. I use a python userfunction to calculate BdotT and BdorR from his algorithm 79 on p. 963, then use the DC to target those two parameters. There is a Mars flyby example in the samples folder that shows how to do that. You need to know your incoming and outgoing velocities at symmetrical points before and after the flyby in order to use algorithm 79. If you know Lambert, you can calculate the desired outgoing velocity at a point beyond the flyby (to whatever target position), then propagate your earth departure trajectory to a symmetrical position inbound (relative to Luna). I use PyKep's Lambert Problem in another python userfunction. As an aside, I haven't had much luck using Vallado's algorithm 78, which uses incoming position and velocity.

1Fundamentals of Astrodynamics and Applications, 4th ed. by David A. Vallado (Author), James Wertz (Editor) Microcosm Press, (2013)