# How can I find the time of flight between spheres of influence?

I'm simulating an interplanetary trajectory between two spheres of influence. I have already simulated a hyperbolic escape within the sphere of influence and have arrived at the boundary of the sphere of influence of the starting planet, where I'm trying to patch the escape hyperbola conic to an hohmann transfer ellipse and determine how long it will take to reach the other planet's sphere of influence (where I would need to patch from the hohmann transfer ellipse to another hyperbola within the destination planet's sphere of influence). In the simulation I can simply do this by trial and error (i.e. simulate the trajectories of the transfer ellipse and see when it falls within the sphere of influence's radius).

However, I was wondering if there is a way to do this analytically using orbital mechanics principles. Given that I have the spacecraft's initial position and velocity with respect to the sun (and therefore can derive all other orbital elements as required), as well as the destination planet's initial position and velocity w.r.t. the sun, how can I find the time of flight to reach the sphere of influence of the destination planet?

I think the key to solving this problem lies in parameterizing the true anomalies of the spacecraft's trajectory and the planet's trajectory as a function of time and starting anomaly. Is there a way to do this?

Sorry, I can't promise you a perfect answer. Firstly, I found this page helpful - http://www.bogan.ca/orbits/gravasst/gravasst.html. Unfortunately the structure has changed a bit since I used it, but useful info is still there.

I made a tool to model 'grand Tour' scenarios. I did this by modelling a closed ellipse intersecting with the orbit path of the target 'slingshot' planet. At the point the planet became the dominant gravitational influence the model switched to hyperbolic transition. Once the sun became the dominant gravitational influence again I switched to a closed ellipse with the next planet (for slingshot) as target. I can share the matlab code for the transition and ellipse models if this helps. I would say it wasn't a perfect solution, but it did verify the Voyager trajectories. Best wishes Stephen

There probably isn't a straightforward way to do this that doesn't involve numerical methods of some type. When I was solving a similar problem for my Kerbal Space Program persistence file reader, my method was basically:

Create a function that accepts time as argument and:

• Calculates True Anomaly as a function of time from the orbital parameters. (Since there's no closed-form way to go from Eccentric Anomaly to Mean Anomaly, I relied on Newton's Method for that step.)
• Uses that True Anomaly, and the orbital parameters (Argument of Periapsis, Oribital Inclination, Longitude of the Ascending Node) to convert that into Cartesian Coordinates for both the planet and the spacecraft.
• Outputs the distance between the planet and the spacecraft at the specified time.

Edit: Whoops, forgot a step in my method.

Form there, I defined a time range for investigation of a sphere of influence intercept by calculating the next times that the spacecraft would be at a distance from the star between [Planet's Periapsis - Sphere of Influence Radius] and [Planet's Apoapsis + Sphere of influence radius]

I used a Golden Section Search on the function to find the time of closest approach during that time range,(ignoring Sphere of Influence effects) and calculated the distance at that time. If that distance was greater than the Sphere of Influence radius, I assumed no interception of the Sphere of Influence would occur during that time range, and could move to the time period where the spacecraft was in range of interception to check, if desired.

If the distance was less than the sphere of influence radius., I wound up using Ridder's Method on the resulting function to find the very next time that the distance between the spacecraft and the planet was exactly the radius of the planet's Sphere of Influence. The initial boundaries on this search were the start of the interception range period, and the previously determined closest-approach time.

If a root was found in the time range specified, I had my intercept time, and time of flight is just subtraction once you've got that.

Edit: My initial writeup left out finding the closest-approach time. I needed to do that to ensure that the requirements for using Ridder's Method were met

• Thanks for pointing out Riddler's method. I only knew of Brent's method (via SciPy's Brentq). It's great when people take the time to post a substantial answer with detailed explanations! – uhoh Feb 4 '18 at 2:47
• Being a creature of habit, I didn't try Riddler's method in this answer but I will next time ;-) – uhoh Mar 14 '18 at 18:13