Lunar Ascent Trajectory Optimization
Lunar Ascent Trajectory Optimization
Lunar Ascent Trajectory Optimization
This document is the user’s manual for a Fortran computer program called lascent_ocs that uses the
Sparse Optimization Suite distributed by Applied Mathematical Analysis to solve the single-stage,
finite-burn lunar ascent trajectory optimization problem. The trajectory is modeled with a user-defined
vertical rise phase, pitch-over phase and initial and final boundary conditions for an ascent-to-orbit
phase. This computer program attempts to maximize the final mass placed into lunar orbit or minimize
the time to ascend to the final orbit. The lunar mission orbit can be circular or elliptical.
Additional information about the mathematical techniques and numerical methods used in the Sparse
Optimization Suite can be found in the book, “Practical Methods for Optimal Control and Estimation
Using Nonlinear Programming” by John. T. Betts, SIAM, 2010.
The lascent_ocs software consists of Fortran routines that perform the following tasks:
set algorithm control parameters and call the transcription/optimal control subroutine
define the problem structure and perform initialization related to scaling, lower and upper
bounds, initial conditions, etc.
compute the right-hand-side differential equations
evaluate any point and path constraints
display the optimal solution results and create an output file
The Sparse Optimization Suite will use this information to automatically transcribe the user’s problem
and perform the optimization using a sparse nonlinear programming method. The software allows the
user to select the type of initial guess, collocation method and other important algorithm control
parameters.
page 1
Program execution
An input file created by the user can be run from the command line or a simple batch file with a
statement similar to the following:
lascent_ocs lascent1.in
If the software is executed without an input file on the command line, the computer program will display
the following information screen and file name prompt:
*************************************
* program lascent_ocs *
* *
* lunar ascent trajectory *
* optimization *
* *
* March 22, 2011 *
*************************************
The user should respond to this prompt with the name of a compatible input data file including the
filename extension.
The lascent_ocs software is “data-driven” by a user-created text file. The following is a typical input
file used by this computer program. In the following discussion the actual input file contents are in
courier font and all explanations are in times italic font.
This data file defines a typical maximum payload simulation with throttling enabled and a circular final
mission orbit with an inclination constraint. For this simulation, the initial azimuth is bounded so that
the software can determine the correct azimuth after the pitch-over maneuver.
Each data item within an input file is preceded by one or more lines of annotation text. Do not delete
any of these annotation lines or increase or decrease the number of lines reserved for each comment.
However, you may change them to reflect your own explanation. The annotation line also includes the
correct units and when appropriate, the valid range of the input. ASCII text input is not case sensitive
but must be spelled correctly.
The first six lines of any input file are reserved for user comments. These lines are ignored by the
software. However the input file must begin with six and only six initial text lines.
**********************************
** lunar launch vehicle simulation
** lv1.in
** November 15, 2005
** maximize payload to orbit
**********************************
The first input is an integer that defines the type of simulation. Option 2 is equivalent to a full throttle or
constant thrust simulation.
page 2
type of trajectory optimization
*******************************
1 = maximize final mass
2 = minimize flight time
------------------------
1
The next three inputs allow the user to specify the duration of the vertical rise and pitch-over maneuvers
along with the total pitch angle.
vertical rise time (seconds)
10
These next two inputs define the propulsion characteristics for the simulation. Here the user can specify
the maximum thrust and specific impulse.
**************************
propulsion characteristics
**************************
The initial vehicle mass and a guess for the final mass are defined by the next two data inputs.
****************************
vehicle mass characteristics
****************************
The following series of data items are reserved for user-defined initial conditions. To fix one or more
initial conditions, the user should input identical lower and upper bounds. To free or un-constrain one
or more initial states, set the lower and/or upper bounds to 1.0d99. Please note the units and valid data
range for each item.
************************************
initial flight conditions and bounds
************************************
NOTE 1: set upper and lower bounds to
the initial value to constrain or
"fix" the flight azimuth.
NOTE 2: set bound to 1.0d99 to ignore
-------------------------------------
upper bound for initial flight azimuth (0 <= azimuth <= 360; degrees)
page 3
360.0
lower bound for initial flight azimuth (0 <= azimuth <= 360; degrees)
0.0
The following series of data items allow the user to define the final flight conditions. To fix one or more
conditions, the user should input identical lower and upper bounds. To free or un-constrain one or
more final states set the lower and/or upper bounds to 1.0d99. Please note the units and valid data
range for each item.
****************************************************
initial guess for final flight conditions and bounds
****************************************************
NOTE 1: set upper and lower bounds
to the final value to constrain or
"fix" a flight condition.
NOTE 2: set bound to 1.0d99 to ignore
-------------------------------------
final flight path angle (-90 <= fpa <= +90; degrees)
0.0
upper bound for final flight path angle (-90 <= fpa <= +90; degrees)
+90.0
lower bound for final flight path angle (-90 <= fpa <= +90; degrees)
-90.0
page 4
final flight azimuth (0 <= azimuth <= 360; degrees)
90.0
upper bound for final flight azimuth (0 <= azimuth <= 360; degrees)
360.0
lower bound for final flight azimuth (0 <= azimuth <= 360; degrees)
0.0
upper bound for final declination (-90 <= declination <= +90; degrees)
+90.0
lower bound for final declination (-90 <= declination <= +90; degrees)
-90.0
upper bound for final east longitude (0 <= longitude <= 360; degrees)
360.0
lower bound for final east longitude (0 <= longitude <= 360; degrees)
0.0
The next series of data inputs define lower and upper bounds on the state variables during the ascent-to-
orbit phase. To free or unconstrain one or more states, set the lower and/or upper bounds to the value
1.0d99.
*************************************************************
upper and lower bounds on the flight conditions during ascent
*************************************************************
NOTE: set bound to 1.0d99 to ignore
-----------------------------------
upper bound for flight path angle (-90 <= fpa <= +90; degrees)
+90.0
lower bound for flight path angle (-90 <= fpa <= +90; degrees)
-90.0
upper bound for flight azimuth (0 <= azimuth <= 360; degrees)
360.0
page 5
lower bound for flight azimuth (0 <= azimuth <= 360; degrees)
0.0
upper bound for declination (-90 <= declination <= +90; degrees)
+90.0
lower bound for declination (-90 <= declination <= +90; degrees)
-90.0
upper bound for east longitude (0 <= longitude <= 360; degrees)
360.0
lower bound for east longitude (0 <= longitude <= 360; degrees)
0.0
This next section of the input file defines the initial guesses and bounds for the control variables. To
free or unconstrain one or more control variables set the lower and/or upper bounds to 1.0d99.
**********************************
initial flight controls and bounds
**********************************
NOTE 1: set upper and lower bounds
to the initial value to constrain
or "fix" a flight control.
NOTE 2: set bound to 1.0d99 to ignore
-------------------------------------
This section of the input file defines the final guesses and bounds for the control variables. To free one
or more control variables set the lower and/or upper bounds to 1.0d99.
********************************
final flight controls and bounds
********************************
page 6
NOTE 1: set upper and lower bounds
to the final value to constrain
or "fix" a flight control.
NOTE 2: set bound to 1.0d99 to ignore
-------------------------------------
This section of the input file defines the lower and upper bounds for the control variables during the
ascent-to-orbit phase. To free or un-constrain one or more control variables, set the lower and/or upper
bounds to 1.0d99.
**********************************************************
upper and lower bounds on the flight controls during phase
**********************************************************
NOTE: set bound to 1.0d99 to ignore
-----------------------------------
page 7
These next three inputs allow the user to specify the final orbit characteristics. Please note that an input
of 1.0d99 for the final orbital inclination will tell the software to ignore the orbital inclination
constraint.
***********************
final orbit constraints
***********************
The software also creates a comma-separated-variable (csv) ascii data file that contains the optimal
control solution and other flight parameters. This next integer input specifies the type of solution data
file to create.
******************************************
type of comma-delimited solution data file
******************************************
1 = OC-defined nodes
2 = user-defined nodes
3 = user-defined step size
---------------------------
1
For options 2 or 3, this next input defines either the number of data points or the time step size of the
data output in the solution file.
number of user-defined nodes or print step size in solution data file
1.0
The name of this output file is specified in the next line of information. Please consult Appendix B for
information about the contents of this file.
name of comma-delimited solution data file
lv1.csv
The next series of program inputs are algorithm control options and parameters for the software. The
first input is an integer that specifies the type of collocation method to use during the solution process.
For most simulations, the trapezoidal method is recommended.
*********************************
discretization/collocation method
*********************************
1 = trapezoidal
2 = separated Hermite-Simpson
3 = compressed Hermite-Simpson
-------------------------------
1
The next integer defines the number of initial grid points to use in the collocation modeling of the ascent
trajectory.
number of initial guess grid points to use
25
page 8
The next series of program inputs are algorithm control options and parameters for the Sparse
Optimization Suite.
****************************
algorithm control parameters
****************************
The next input defines the relative error in the solution of the differential equations.
relative error in the solution of the differential equations
1.0d-7
The next input is an integer that defines the maximum number of mesh refinement iterations.
maximum number of mesh refinement iterations
20
The next input is an integer that defines the maximum number of function evaluations.
maximum number of function evaluations
100000
The next input is an integer that defines the maximum number of algorithm iterations.
maximum number of algorithm iterations
10000
The level of output from the NLP algorithm is controlled with the following integer input.
***************************
sparse NLP iteration output
***************************
1 = none
2 = terse
3 = standard
4 = interpretive
5 = diagnostic
---------------
2
The level of output from the optimal control algorithm is controlled with the following integer input.
Please note that option 4 will create lots of information.
**********************
optimal control output
**********************
1 = none
2 = terse
3 = standard
4 = interpretive
-----------------
1
The level of output from the differential equations algorithm is controlled with the following integer
input. Please note that option 5 will create lots of information.
page 9
****************************
differential equation output
****************************
1 = none
2 = terse
3 = standard
4 = interpretive
5 = diagnostic
---------------
1
The level of output can be further controlled by the user with this final text input. This program option
sets the value of the SOCOUT character variable described in the Sparse Optimization Suite user’s
manual. To ignore this special output control, input the simple character string no.
*******************
user-defined output
-------------------
input no to ignore
*******************
a0b0c0d0e0f0g0h0i0j2k0l0m0n0o0p0q0r0
Before attempting to optimize the trajectory, the software will display the conditions at the beginning
and end of the vertical rise as well as the flight conditions at the end of the pitch-over maneuver. The
following is the program output for this example.
liftoff
-------
end of pitch-over
-----------------
page 10
After convergence, the software will display the flight path conditions immediately after the pitch-over
and the flight path conditions and classical orbital elements at mission orbit injection. The following is
the program output for this example.
program lascent_ocs
--------------------
page 11
The following are trajectory characteristics plots created from the user-defined summary file. The first
plot illustrates the behavior of the angle of attack and bank angle during the ascent trajectory. Notice the
bank reversal as the angle of attack passes through zero. This behavior is explained on page 1192 of
“Advanced Launch System Trajectory Optimization”, by P. Daniel Burkhart and David G. Hull, AAS
96-168. An examination of the azimuth differential equation given in the Technical Discussion later in
this document will help explain this behavior.
The time evolution of altitude and velocity are illustrated in this next plot.
page 12
This plot illustrates the behavior of the orbital eccentricity and inclination during the ascent to the final
circular mission orbit.
The evolution of the relative flight path and azimuth angles is shown in this next plot. These angles are
computed with respect to a rotating Moon.
This final plot illustrates how the throttle setting and accumulated delta-v change during the ascent from
the end of the pitch-over maneuver to injection into the final mission orbit.
page 13
Verification of the optimal control solution
The optimal solution determined by the Sparse Optimization Suite can be verified by numerically
integrating the spacecraft’s selenocentric equations of motion using the optimal control-computed initial
conditions and the optimal control angles and throttle setting determined by the algorithm. This
computer program uses a Runge-Kutta-Fehlberg 7(8) variable step size method to explicitly integrate the
flight path equations of motion.
The following is the program output summarizing the final flight path coordinates, classical orbital
elements and state vector computed using this explicit numerical integration method. The vehicle mass
and accumulated delta-v are computed by including the instantaneous propellant flow rate and thrust
acceleration in the first-order equations of motion.
********************************************
* verification of optimal control solution *
********************************************
page 14
vehicle mass 1448.95131132294 kilograms
The software uses a linear interpolation guess based on the flight conditions after the pitch-over
maneuver and the final flight conditions provided by the user. This is accomplished within the software
by setting init = 1. The Sparse Optimization Suite attempts to obtain problem feasibility before
trying to solve the optimal control problem. If the software cannot get feasible, the user will have to
provide a better initial guess.
Problem setup
This section provides additional details about the Sparse Optimization Suite software implementation. It
briefly explains such things as point constraints and the performance index options. The lascent_ocs
simulation consists of a vertical rise followed by a pitch-over maneuver and a final, optimized ascent-to-
orbit propulsive phase.
The performance index for the maximize final mass option is the final spacecraft mass given by
J m f m t f
For the minimize flight time program option, the performance index is
J tf
The value of the maxmin indicator in the Sparse Optimization Suite algorithm tells the software whether
the user is minimizing or maximizing the performance index.
The path constraints enforced by the software are based on the lower and upper bounds for the dynamic
variables provided by the user. For example,
L U
L U
and so forth. The subscripts L and U correspond to lower and upper bounds provided by the user.
page 15
(3) Point constraints
The number and type of point functions enforced by the software is a function of the orbital elements of
the final mission orbit. This section discusses the point constraints or final boundary conditions
implemented in the lascent_ocs computer program.
Circular orbit
For a final circular mission orbit, the user provides the semimajor axis of this orbit. The software then
uses the following three point constraints or boundary conditions to “target” a final circular orbit.
rf v f
rf au vf sin f 0
au rf v f
If the user also specifies an orbital inclination for the final mission orbit, the software enforces the
following point constraint at the final time
sin i f
h fz
r f v f z
sin iu
hf rf v f
In these equations, the f subscript refers to mission characteristics computed by the software at the final
time and the u subscript refers to user-provide final or “target” orbital conditions.
Elliptical orbit
For a user-defined elliptical mission orbit, the software constrains the final specific orbital energy and
final angular momentum magnitude according to
2 2
f v 2f u vu2
rf ru
rf v f ru v u
hf hu
rf v f ru v u
If the user also specifies an orbital inclination for the final mission orbit, the software enforces the
following point constraint
hf
sin i f z
rf v f z sin i
rf v f
u
hf
In these equations, the f subscript refers to mission characteristics computed by the software at the final
time and the u subscript refers to user-provided final orbital conditions. The user-defined position
vector ru and velocity vector v u are determined from the semimajor axis, orbital eccentricity and
inclination input by the user. All other angular orbital elements are set to 0.
page 16
Technical Discussion
This section describes the equations of motion implemented in this computer program along with other
important numerical algorithms.
The first-order flight path equations of motion relative to a rotating, spherical Moon are as follows:
selenocentric radius
dr
r V sin
dt
selenographic longitude
d cos sin
V
dt r cos
selenocentric declination
d cos cos
V
dt r
speed
dV T cos
V g sin 2 r cos sin cos sin cos cos
dt m
d V T sin g cos
cos cos 2 sin cos
dt r mV V
r
2 cos cos sin sin cos cos
V
flight azimuth
d V T sin
tan sin cos sin
dt r mV cos
r
2 sin cos cos tan 2 sin cos sin
V cos
where
page 17
r selenocentric radius
V relative speed
flight path angle
selenocentric declination
selenographic longitude east
flight azimuth clockwise from north
bank angle for a right turn
angle of attack
req lunar equatorial radius
lunar inertial rotation rate
lunar gravitational constant
g acceleration of gravity r 2
T propulsive thrust
m spacecraft mass
During the vertical rise part of the trajectory, the software uses a subset of the full equations of motion.
This set of equations includes r, v, , with 0 . This is necessary in order to avoid singularities
in the flight path and azimuth differential equations during the trajectory evolution. Furthermore, during
the numerical integration of the vertical rise differential equations, 0 , 0 , 90 , 0 and the
throttle setting is equal to 1.
Pitch-over phase
During the pitch-over part of the trajectory, the software also uses a subset of the full equations of
motion. This set of equations includes r, v, , , with 0 . This is necessary because azimuth is
poorly defined until the end of the pitch-over part of the ascent trajectory. Furthermore, during the
numerical integration of the pitch-over differential equations, 0 , 0 , 90 , 0 and the
throttle setting is equal to 1.
The angle of attack during the pitch-over phase is determined from 90 t t p where is
the pitch rate, t is the time since launch and t p is the time since launch at which the pitch-over maneuver
begins. The constant pitch rate is determined from the pitch angle and pitch-over maneuver duration
provided by the user.
For a realistic and contiguous ascent trajectory, the launch vehicle should pitch over to the azimuth
direction determined by the ascent-to-final orbit optimization.
page 18
Crossrange and downrange calculations
The crossrange angle is determined from the following expression which can be derived from spherical
trigonometry relationships:
sin sin1 sin 2 cos1 cos cos1 cos1 sin sin1 cos2 sin 1
sin cos 1 sin 2 cos 1 cos sin 1 cos 1 sin cos 1 cos 2 sin 1
where
1 selenocentric declination of the initial point
1 flight azimuth at the initial point
2 selenocentric declination of the final point
2 1
Please note that the inverse tangent above is a four quadrant calculation.
The software uses the following expressions to calculate the selenocentric, inertial position and velocity
vectors of the spacecraft at the final time:
rx r cos cos
ry r cos sin
rz r sin
v x v cos cos sin sin cos cos sin sin sin
page 19
v x v x ry
v y v y rx
The inertial speed can also be computed from the following expression
where all coordinates on the right-hand-side of these equations are relative to a rotating Moon.
page 20
References and Bibliography
(1) “Direct Trajectory Optimization Using Nonlinear Programming and Collocation”, C. R. Hargraves
and S. W. Paris, AIAA Journal of Guidance, Control and Dynamics, Vol. 10, No. 4, July-August, 1987,
pp. 338-342.
(2) “Optimal Finite-Thrust Spacecraft Trajectories Using Direct Transcription and Nonlinear
Programming”, Paul J. Enright, Ph.D. Thesis, University of Illinois at Urbana-Champaign, 1991.
(3) “Using Sparse Nonlinear Programming to Compute Low Thrust Orbit Transfers”, John T. Betts, The
Journal of the Astronautical Sciences, Vol. 41, No. 3, July-September 1993, pp. 349-371.
(4) “Optimization of Thrust Direction Histories and Vehicle Parameters for Three-dimensional Ascent
Trajectories”, C. Tucker Battle and Robert G. Gottlieb, AIAA 64-663.
(5) “Improved Collocation Methods with Application to Direct Trajectory Optimization”, Albert L.
Herman, Ph.D. Thesis, University of Illinois at Urbana-Champaign, 1995.
(6) “Optimal Low Thrust Interplanetary Trajectories by Direct Method Techniques”, Craig A. Kluever,
The Journal of the Astronautical Sciences, Vol. 45, No. 3, July-September 1997, pp. 247-262.
(7) “Survey of Numerical Methods for Trajectory Optimization”, John T. Betts, AIAA Journal of
Guidance, Control and Dynamics, Vol. 21, No. 2, March-April 1998, pp. 193-207.
(8) “Design and Evaluation of a 3-D Optimal Ascent Guidance Algorithm”, Anthony J. Calise, Nahum
Melamed and Seungjae Lee, AIAA 97-3707.
(9) “Optimization of Launch Vehicle Ascent Trajectories with Path Constraints and Coast Arcs”, C. P.
Gath and A. J. Calise, AIAA Journal of Guidance, Control and Dynamics, Vol. 24, No. 2, March-April,
2001, pp. 296-304.
(10) “Advanced Launch System Trajectory Optimization Using Suboptimal Control”, Douglas A.
Shaver and David G. Hull, AIAA 90-3413.
(11) “Solving the Optimal Control Problem Using a Nonlinear Programming Technique, Part 2: Optimal
Shuttle Ascent Trajectories”, T. Bauer, J. Betts, W. Huffman and K. Zondervan, AIAA 84-2038.
(12) “Semi-Analytical Formulas for Launcher Performance Evaluation”, Emanuele Di Sotto and Paolo
Teofilatto, AIAA Journal of Guidance, Control and Dynamics, Vol. 25, No. 3, May-June, 2002, pp. 538-
545.
page 21
APPENDIX A
Contents of the Simulation Summary CSV File
This appendix is a brief summary of the information contained in the CSV data file produced by the
lascent_ocs software. The comma-separated-variable disk file is created by the odeprt subroutine
and contains the following information:
page 22
APPENDIX B
Fortran Functions and Subroutines
This appendix is a brief summary of the major Fortran functions and subroutines included in the
lascent_ocs computer program.
fpeqms1.for - subroutine that evaluates flight path equations of motion during the
vertical rise phase
fpeqms2.for - subroutine that evaluates flight path equations of motion during the
pitch-over phase
fpeqms3.for - subroutine that evaluates flight path equations of motion for the
verification computations
oderhs.for - subroutine that evaluates the equations of motion and any algebraic
equations
readfpn.for - read and echo floating point number from an input file subroutine
page 23
APPENDIX C
Example Fortran Subroutine
This appendix contains the source code for a single Fortran 77 routine and illustrates typical
programming conventions used in the lascent_ocs software. This subroutine is the differential-
algebraic equations routine required by the Sparse Optimization Suite.
c input
c state variables
c output
c ************************************
include 'socxcom1.inc'
iferr = 0
rmag = ydyn(1)
elon = ydyn(2)
dec = ydyn(3)
vrel = ydyn(4)
fpa = ydyn(5)
page 24
azim = ydyn(6)
xmass = ydyn(7)
alfa = ydyn(8)
bank = ydyn(9)
throttle = ydyn(10)
c *********************
c propulsion properties
c *********************
c *******************
c equations of motion
c *******************
sfpa = sin(fpa)
cfpa = cos(fpa)
sazim = sin(azim)
cazim = cos(azim)
salfa = sin(alfa)
calfa = cos(alfa)
sbank = sin(bank)
cbank = cos(bank)
sdec = sin(dec)
cdec = cos(dec)
c ****************************
c state differential equations
c ****************************
xlift = 0.0d0
drag = 0.0d0
page 25
rdot = vrel * sfpa
c *******************************
c first-order equations of motion
c *******************************
frhs(1) = rdot
frhs(2) = elondot
frhs(3) = decdot
frhs(4) = vdot
frhs(5) = gamdot
frhs(6) = azidot
frhs(7) = -xmdot
return
end
page 26
APPENDIX D
Minimum Time, Elliptical Final Orbit Example
This appendix summarizes the lascent_ocs solution and trajectory graphics for a minimum time
ascent to an elliptical final mission orbit.
page 27
Since this is a minimum time solution, the throttle setting during the pitch-over to final mission injection
phase is always 100 percent.
page 28
Here’s the program output for this example.
program lascent_ocs
--------------------
page 29
********************************************
* verification of optimal control solution *
********************************************
page 30