Compute a 3D optimal transfer to Mars

Modified on Fri, 29 Sep, 2023 at 11:17 AM

The demo MarsOptimalTransfer uses JPL ephemeris and fmincon to find a fully 3D trajectory for continuous thrust. This requires the MathWorks Optimization Toolbox. The total acceleration over the trajectory is minimized while the orbit meets the constraints of the final circular orbit. This is a fixed endtime optimization. A related function FindDepartureDate can search for the best time of year to leave the departure planet. This direct optimization is quite fast, requiring only seconds.


Once the optimization has found the best acceleration profile, you can use it to size a spacecraft given engine parameters with SpacecraftFromAccel. This function will take the exhaust velocity, specific power, and efficiency of the engine and compute the power, engine mass, and fuel mass given a payload mass.


This demo provides an example for a 6 month transfer to Mars with a fixed departure date of June 19, 2022. 

%% Compute the optimal trajectory
% Launch date
jD0 = Date2JD([2022 6 19 0 0 0]);
% Planet IDs
planet1 = 3;
planet2 = 4;
% long, low-thrust transfer
years = 0.5;
nPts  = 50;
s     = TrajectoryBetweenTwoPlanets( jD0, planet1, planet2, years, nPts );

The trajectory looks as expected; the acceleration is plotted using quiver, which shows both the direction and the relative magnitude. The most acceleration occurs at the beginning and end of the trajectory with less in the middle. This makes sense as the optimal solution for a power-limited rocket can be shown analytically to be a linear profile.

Here is a plot of the actual acceleration, both the x, y, z components and the magnitude. The acceleration is mostly planar (x/y) with a small z component to correct the inclination. The ephemeris is in the ecliptic plane.

The SpacecraftFromAccel function computes the fuel mass and total mass for the vehicle given engine parameters and a payload mass. 

%% Size the spacecraft
% This will compute the power required to move the requested payload given
% the acceleration profile returned from the optimization. Not all
% combinations of parameters will converge.
sC = SpacecraftFromAccel;
sC.uE    = 50;    % exhaust velocity, km/s
sC.sigma = 300;   % specific power, W/kg
sC.fS    = 0.08;  % fuel structural fraction
sC.eff   = 0.8;   % efficiency to jet thrust power
sC.mP    = 10000;  % payload mass, kg
SpacecraftFromAccel(sC,s);

It prints the results to the command line as well as plots the mass and thrust over time. In this example, for a payload mass of 10,000 kg, the total mass was just over 40,000 kg, for a payload fraction of just under 25%.


Total mission DV:     23.2 km/s
Max thrust power:    3.496 MW
Total mass:        40712.9 kg
Payload mass:     10000 kg
Engine mass:      11654 kg
Fuel mass:        15121 kg
Structural mass:  1210 kg
Payload Fraction: 0.245622




Module: Orbit/Optimization

Children: TrajectoryBetweenTwoPlanets, SpacecraftFromAccel, PlanetPosJPL

Demo: MarsOptimalTransfer

Edition: SCT Profressional Edition

Version: 2023.1

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article