Documente Academic
Documente Profesional
Documente Cultură
Mission Analysis
cdeaglejr@yahoo.com
http://celestialandorbitalmechanicswebsite.yolasite.com/
A MATLAB Script for Preliminary Lunar Mission Design and Analysis
This document is the user’s guide for a MATLAB script called lunar1 that can be used to design
preliminary lunar missions from Earth park orbit to B-plane encounter at the moon. The software
assumes that trans-lunar injection (TLI) occurs impulsively from a circular Earth park orbit. The B-
plane coordinates are expressed in a moon-centered (selenocentric) mean equator and IAU node of
epoch coordinate system. The results from this scientific simulation can be used as an initial guess for
a more sophisticated trajectory optimization program.
The first part of this MATLAB script solves for the minimum TLI delta-v using a two-body Lambert
solution for the transfer trajectory from the Earth park orbit to the center of the moon. The second part
of the script implements a shooting method that attempts to minimize the TLI delta-v while
numerically integrating the spacecraft equations of motion and targeting to user-defined constraints.
In the shooting algorithm, the spacecraft motion model includes the Earth’s oblate gravity effect and
the point-mass perturbations of the sun and moon. The B-plane targets are enforced via a user-defined
periapsis radius and orbital inclination of the arrival hyperbola relative to the moon.
The program inputs and major computational steps implemented in this script are as follows:
Software Inputs
Output
• TLI delta-v vector and transfer time
• Classical orbital elements of geocentric transfer trajectory
• Selenocentric orbital elements of the encounter hyperbola
• B-plane coordinates
This MATLAB script uses the SNOPT nonlinear programming (NLP) method for both optimization
algorithms of the lunar transfer problem implemented in this script. The lunar coordinates required by
this script are computed using the JPL DE421 ephemeris.
page 1
Input data file
The lunar1 MATLAB script is “data-driven” by a simple text file created by the user. This section
describes a typical input data file. In the following discussion the actual input file contents are in
courier font and all explanations are in times italic font.
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.
The first four lines of any input file are reserved for user comments. These lines are ignored by the
software. However the input file must begin with four and only four initial text lines.
***************************
* input file for lunar1.m
* lunar1.in – April 4, 2005
***************************
The software allows the user to specify an initial guess for the TLI calendar date and lower and upper
bounds on the actual date found during both the two-body and numerically integrated TLI delta-v
optimization processes. For any guess for the TLI time tTLI and user-defined lower and upper bounds
∆tl and ∆tu , the actual TLI time t is constrained as follows:
The first five inputs define the initial guesses for the TLI calendar date and the lower and upper
bounds, respectively. Be sure to include all four digits of the calendar year. The first set of bounds
are used during the two-body optimization, and the second set is used during the numerical integration
and b-plane targeting.
The TLI calendar date is a control variable in the NLP formulation and must always have a lower and
upper bound. For a fixed TLI calendar date, input small values (e.g., plus and minus 1.0e-8) for the
bounds.
initial guess for TLI calendar date (month, day, year)
10,1,2008
lower bound for TLI calendar date search (two-body optimization; hours)
-240.0
upper bound for TLI calendar date search (two-body optimization; hours)
+24.0
lower bound for TLI calendar date search (b-plane optimization; hours)
-12.0
upper bound for TLI calendar date search (b-plane optimization; hours)
+12.0
The next input is the user’s initial guess for the TLI-to-B-plane transfer time, in hours.
initial guess for transfer time (hours)
96.0
page 2
The next two numbers define the fixed values for park orbit altitude and orbital inclination.
***********************************
circular park orbit characteristics
***********************************
altitude (kilometers)
185.32
This next integer input defines the type of TLI maneuver to perform. The script uses this indicator to
compute the park orbit RAAN.
type of TLI maneuver
(1 = ascending, 2 = descending)
2
The next two inputs define the periapsis radius and orbital inclination to use during the numerically
integrated solution. These coordinates refer to the selenocentric hyperbola. The orbital inclination
should be specified in the lunar equator and equinox of J2000 coordinate system.
************************************
final lunar orbit characteristics
(lunar equator and equinox of J2000)
************************************
This next integer input defines the type of targeting algorithm to use. The b-plane algorithm is
recommended with the orbital elements algorithm a backup in case the software has trouble
establishing a hyperbolic orbit encounter during the shooting calculations.
type of targeting
(1 = b-plane, 2 = orbital elements, 3 = user-defined b-plane targets)
1
For option 3, the software allows the user to input b-plane targets directly using the following two
program inputs.
user-defined b dot r target (kilometers)
6000.0
The last three integer inputs define the types of perturbations to include during the numerical
integration of the spacecraft’s motion. The first option will include the effect of J 2 in the equations of
motion, and options 2 and 3 will include the point mass gravity of the moon and sun.
************************
trajectory perturbations
************************
page 3
include lunar perturbation (1 = yes, 0 = no)
1
The following is the solution created by the computer program for this example. The output is
organized by the following major sections:
• First pass
1. two body Lambert solution
2. TLI delta-v vector and magnitude
• Targeting pass
1. pre-TLI and post-TLI flight conditions
2. TLI delta-v vector and magnitude
3. time and conditions at lunar closest approach
4. classical orbital elements of the lunar transfer trajectory
The first output section summarizes the two-body Lambert solution. The solution is presented in the
Earth mean equator of J2000 coordinate system (EME2000). The trajectory characteristics are given
before and after the TLI maneuver.
***********************
lunar1 - Matlab version
***********************
b-plane targeting
-----------------------------------------------
minimum TLI delta-v - two-body Lambert solution
-----------------------------------------------
page 4
+1.77705546439843e+002 +1.80000000000000e+002 +1.80000000000000e+002 +8.81955595103076e+001
This section of the program output is created after the B-plane targeting problem has been solved. It
includes a summary of the solution, the TLI delta-v vector and magnitude, the final B-plane
coordinates and the orbital elements and state vector of the encounter hyperbola.
*******************************
numerically integrated solution
*******************************
page 5
+2.19200741591069e-001 +6.85325845368647e+000 -3.70353538115570e+000 +7.79303373004449e+000
c3 -1.96490252 (km/sec)^2
page 6
v-infinity 903.510524 meters/second
r-periapsis 1837.999985 kilometers
decl-asymptote 14.480312 degrees
rasc-asymptote 88.900344 degrees
The lunar1 script can also create graphic displays of the geocentric transfer orbit and the
selenocentric hyperbola within the sphere-of-influence of the moon. This section describes the user
interaction with this software option and also provides typical graphic displays for this example.
After the software has computed the trajectory solution, it will display the following graphics menu:
graphics menu
<4> none
If the user elects option 1, 2 or 3, the script will request the plot duration with this next menu:
This menu allows the user to create graphics from trans-lunar injection until either the time of closest
approach to the moon or a simulation duration defined by the user.
For the second plot duration option, the software will ask for this input with the following request:
Finally, the MATLAB script will request the plot step size with
A plot step size of ten minutes is recommended. However, for zoomed plots of either the geocentric or
selenocentric trajectory, smaller plot step sizes will create “smoother” trajectory displays.
The following is a plot of the geocentric transfer trajectory for this example. Please note that the
coordinates are displayed in the units of Earth radii (ER). The asterisk symbol is the position of the
moon at the moment of trans-lunar injection and the moon’s orbit is marked with a small blue dot
symbol at 24 hour intervals. The park orbit trace is red.
page 7
The interactive graphic features of MATLAB will allow the user to rotate and “zoom” the displays in
and out. These capabilities allow the user to interactively find the “best” viewpoint as well as verify
the basic orbital geometry of the geocentric and selenocentric trajectories.
This next plot is a “zoomed” display of the first plot closer to the Earth. The initial park orbit is
displayed in red, the transfer trajectory is blue, and an inertial, Earth-centered coordinate system is on
the plot. The x-axis of this system is red, the y-axis green and the z-axis blue. The location on the
park orbit at which TLI occurs is marked with a small dot symbol.
page 8
The following is a plot of the selenocentric hyperbola within the moon’s sphere-of-influence. The
coordinate units are lunar radii (LR). The entry into the SOI is marked with an asterisk. In this
MATLAB script the radius of the moon’s SOI is “hardwired” to a value of 64,000 kilometers.
The final plot is a “zoomed” display of the previous plot. This display is labeled with a selenocentric,
inertial coordinate system. The x-axis is red, the y-axis green and the z-axis blue. The small red dot is
periapsis of the approach hyperbola.
page 9
The lunar1 MATLAB script can also create these types of graphic displays for the two-body
solution.
Technical Discussion
This section provides additional details about the numerical algorithms used in this computer program.
The computational methods discussed here include solving the two body Lambert problem, the method
used for propagating the spacecraft’s geocentric trajectory, the algorithm used for targeting to the B-
plane, and the geocentric-to-selenocentric coordinate transformation.
y ( t )
z=
u ( t )
consisting of the state variables y and the control variables u for any time t. In this discussion
vectors are denoted in bold.
The system dynamics are defined by a vector system of ordinary differential equations called the state
equations that can be represented as follows:
dy
y
= = f y ( t ) , u ( t ) , p, t
dt
page 10
The initial dynamic variables at time t0 are defined by ψ0 ≡ ψ y ( t0 ) , u ( t0 ) , t0 and the terminal
conditions at the final time t f are defined by ψ f ≡ ψ y ( t f ) , u ( t f ) , t f . These conditions are called
the boundary values of the trajectory problem.
For any mission time t there are also simple bounds on the state variables
yl ≤ y (t ) ≤ yu
the control variables
ul ≤ u ( t ) ≤ uu
p l ≤ p ( t ) ≤ pu
The basic nonlinear programming problem (NLP is to determine the control vector history and
problem parameters that minimize the scalar performance index or objective function given by
J = φ y ( t0 ) , t0 , y ( t f ) , t f , p
During the two-body trajectory optimization, the control variables are the TLI calendar date and the
true anomaly of the TLI maneuver. For the numerical integration optimization, the control variables
consist of the TLI calendar date, the RAAN of the park orbit, the true anomaly of the TLI maneuver,
and the Cartesian components of the TLI delta-v vector.
For both types of optimization, the objective function or performance index is the scalar magnitude of
the TLI delta-v.
In addition to the bounds on the TLI calendar date mentioned earlier, the true anomaly during the two-
body optimization is bounded according to
−180 ≤ θ ≤ +180
During the second part of the trajectory optimization, the RAAN and true anomaly bounds are
page 11
where ΩTB and θTB are the RAAN and true anomaly found during the two-body optimization. The
bounds on the components of the TLI delta-v are given by
− ( ∆v + 0.1 ∆v ) ≤ ∆v x , y ,z ≤ + ( ∆v + 0.1 ∆v )
The final boundary conditions are the B-plane coordinates of the incoming selenocentric hyperbola.
Lambert’s problem is concerned with the determination of an orbit that passes between two positions
within a specified time-of-flight. This classic astrodynamic problem is also known as the orbital two-
point boundary value problem (TPBVP).
The time to traverse a trajectory depends only upon the length of the semimajor axis a of the transfer
trajectory, the sum ri + rf of the distances of the initial and final positions relative to a central body,
and the length c of the chord joining these two positions. This relationship can be stated as follows:
tof tof ( ri + rf , c, a )
=
a3
t=
− t0 ( E − e sin E )
µ
we can write
a3
=t E − E0 − e ( sin E − sin E0 )
µ
where E is the eccentric anomaly associated with radius r, E0 is the eccentric anomaly at r0 , and t = 0
when r = r0 .
At this point we need to introduce the following trigonometric sun and difference identities:
α−β a+β
sin α − sin β =
2sin cos
2 2
α−β a+β
cos α − cos β =
−2sin sin
2 2
α−β a+β
cos α + cos β =
2 cos cos
2 2
page 12
If we let E = α and E0 = β and substitute the first trig identity into the second equation above, we
have the following equation:
a3 E − E0 E + E0
=t E − E0 − 2sin e cos
µ 2 2
E + E0 α+β
e cos = cos
2 2
E − E0 α−β
sin = sin
2 2
a3 α−β α+β
=t (α − β ) − 2sin cos
µ 2 2
r a (1 − e cos E )
=
=x a ( cos E − e )
=y a sin E 1 − e 2
r + r0 c r + r0 + c s
cos α =1 − − =−
1 =−
1
2a 2a 2a a
r + r0 c r + r0 − c s−c
sin β =1 − + =−
1 =−
1
2a 2a 2a a
This part of the derivation makes use of the following three relationships:
α−β α+β r + r0
cos cos = 1−
2 2 2
α−β α+β E − E0 E + E0
2
sin =sin sin 1 − e cos
2 2 2 2
α−β α + β x − x0 y − y0 c
2 2 2 2
sin sin = + =
2 2 2a 2a 2a
page 13
With the use of the half angle formulas given by
α s β s−c
=sin = sin
2 2a 2 2a
and several additional substitutions, we have the time-of-flight form of Lambert’s theorem
a3
=t (α − β ) − ( sin α − sin β )
µ
A discussion about the angles α and β can be found in “Geometrical Interpretation of the Angles α
and β in Lambert’s Problem” by J. E. Prussing, AIAA Journal of Guidance and Control, Volume 2,
Number 5, Sept.-Oct. 1979, pages 442-443.
The algorithm used in this MATLAB script is based on the method described in “A Procedure for the
Solution of Lambert’s Orbital Boundary-Value Problem” by R. H. Gooding, Celestial Mechanics and
Dynamical Astronomy 48: 145-165, 1990. This iterative solution is valid for elliptic, parabolic and
hyperbolic transfer orbits which may be either posigrade or retrograde, and involve one or more
revolutions about the central body.
This part of the trajectory analysis implements a special perturbation technique which numerically
integrates the vector system of second-order, nonlinear differential equations of motion of a spacecraft
given by
(
a ( r , v , t ) = )
r r , r , t =a g ( r ) + am ( r , t ) + as ( r , t )
where
t= dynamical time
r= inertial position vector of the satellite
v= inertial velocity vector of the satellite
ag = acceleration due to the Earth's gravity
am = acceleration due to the Moon
as = acceleration due to the Sun
y=
1 v=
x y4
y=
2 v=
y y5
y=
2 v=
z y6
page 14
rx 3 J 2 req 5rz2
2
− µ 3 1 +
y 4 = 1 − 2
r 2 r 2 r
r 3 J 2 req2 5rz2
− µ y3 1 +
y 5 = 1 − 2
r 2 r 2 r
r 3 J 2 req 5rz2
2
− µ z3 1 +
y 6 = −
r 2 r 2 r 2
3
where r = rx2 + ry2 + rz2 = y12 + y22 + y32 . In these equations µ and req are the gravitational constant
and equatorial radius of the Earth, respectively and J 2 is the oblateness gravity coefficient.
r
re−m
am ( r , t ) =
− µm 3 + 3
m −b
r re−m
m −b
where
µm = gravitational constant of the moon
rm −b = position vector from the moon to the satellite
re−m = position vector from the Earth to the moon
r
re− s
as ( r , t ) =
− µs 3 + 3
s −b
r re− s
s −b
where
µ s = gravitational constant of the sun
rs −b = position vector from the sun to the satellite
re− s = position vector from the Earth to the sun
In this MATLAB script the heliocentric coordinates of the sun and moon are based on the JPL
Development Ephemeris DE421. These coordinates are provided in the Earth mean equator and
equinox of J2000 coordinate system (EME2000).
For a given TLI injection time, there are two possible locations on the initial park orbit at which to
perform the propulsive maneuver. One opportunity occurs during the ascending part of the park orbit
and the other during the descending motion. The park orbit RAAN Ω p at these two locations can be
page 15
determined from spherical trigonometry relationships involving the park orbit inclination and the right
ascension and declination of the moon at encounter.
ascending
tan δ m
Ω p =−180 + α m + sin −1
tan i
p
descending
tan δ m
Ω p = α m − sin −1
tan i
p
where
For this targeting option, the equality constraints enforced by the SNOPT nonlinear programming
algorithm are
rp − rca =
0
cos i − hˆ z =
0
where rp and i are the user-defined periapsis radius and selenocentric orbital inclination, respectively,
and hˆ z is the z-component of the unit angular momentum vector at closest approach to the moon.
Closest approach is determined during the numerical integration of the spacecraft equations of motion
by finding the time since TLI at which the selenocentric flight path angle is zero.
B-plane targeting
The derivation of B-plane coordinates is described in the classic JPL reports, “A Method of Describing
Miss Distances for Lunar and Interplanetary Trajectories” and “Some Orbital Elements Useful in
Space Trajectory Calculations”, both by William Kizner. The following diagram illustrates the
fundamental geometry of the B-plane coordinate system.
page 16
The software solves the B-plane targeting problem by minimizing the delta-v vector at the TLI while
satisfying two nonlinear equality constraint equations. These constraint equations are the differences
between components of the required B-plane and the B-plane components predicted by the software.
Given the user-defined closest approach radius rca and orbital inclination i, and the incoming v-infinity
magnitude v∞ and the right ascension α ∞ and declination δ ∞ of the incoming asymptote vector at the
moment of closest approach, the following series of equations can be used to determine the required
B-plane target components:
BT = bt cos θ
BR = bt sin θ
where
2 µ rca 2µ
bt= 2
+ rca2 = rca 1 +
v∞ rca v∞2
and
cos i
cos θ =
cos δ ∞
sin θ =− 1 − cos2 θ
sin δ ∞ = sˆ × zˆ = s x2 + s 2y
page 17
zˆ = [ 0 0 1]
T
cos δ ∞ cos α ∞
Sˆ = cos δ ∞ sin α ∞
sin δ
∞
where δ ∞ and α ∞ are the declination and right ascension of the asymptote of the incoming hyperbola.
Important note!!
This technique only works for lunar orbit inclinations that satisfy
i > δ∞
If this inequality is not satisfied, the software will print the following error message
It will also display the actual declination of the asymptote and stop. The user should then edit the input
file, include a valid orbital inclination and restart the simulation.
The following computational steps summarize the calculation of the predicted B-plane vector from a
moon-centered position vector r and velocity vector v at closest approach.
h
hˆ =
h
radius rate
r v
r =
r
semiparameter
h2
p=
µ
semimajor axis
r
a=
r v2
2 − µ
page 18
orbital eccentricity
=
e 1− p a
true anomaly
p−r
cos θ =
er
r h
sin θ =
eµ
B-plane magnitude
B= pa
fundamental vectors
r v − r r
zˆ =
h
S vector
a b
S=
− pˆ + qˆ
a 2 + b2 a 2 + b2
B vector
b2 ab
=B pˆ + qˆ
a 2 + b2 a 2 + b2
T vector
(S , − S x2 ,0 )
2 T
T=
y
S x2 + S y2
R vector
R =S × T =( − S zTy , S zTx , S xTy − S yTx )
T
The mission elapsed time at which the spacecraft reaches closest approach to the moon is predicted
using the event prediction capability of the MATLAB ode45 algorithm. During the numerical
integration of the spacecraft’s geocentric equations of motion, the ode45 numerical method searches
for the time at which the flight path angle with respect to the moon is nearly zero within a small
tolerance. This constraint corresponds to closest approach to the moon. The predicted B-plane
coordinates are based on the selenocentric flight conditions at closest approach. Close approach is
predicted with the following mission constraint
page 19
r v
γ = sin −1
r v
where r and v are the moon-centered position and velocity vectors, respectively.
This section describes the transformation of coordinates between the Earth mean equator and equinox
2000 (EME2000) and lunar mean equator and equinox of 2000 coordinate systems. This
transformation is used to compute the B-plane coordinates at encounter.
A unit vector in the direction of the pole of the moon can be determined from
cos α p cos δ p
pˆ Moon = sin α p cos δ p
sin δ p
The right ascension and declination of the lunar pole in the EME2000 coordinate system are given by
the following expressions
page 20
where =d JD − 2451545 is the number of days since January 1.5, 2000. These equations are given in
“Report of the IAU/IAG Working Group on Cartographic Coordinates and Rotational Elements of the
Planets and Satellites: 2000”, Celestial Mechanics and Dynamical Astronomy, 82: 83-110, 2002.
The unit vector in the x-axis direction of this selenocentric coordinate system is given by
xˆ= zˆ × pˆ Moon
where zˆ = [ 0 0 1] . The unit vector in the y-axis direction can be determined using
T
=yˆ pˆ Moon × xˆ
Finally, the components of the matrix that transforms coordinates from the EME2000 system to the
moon-centered (selenocentric) mean equator and equinox of 2000 system are as follows:
M = [ xˆ yˆ pˆ Moon ]
T
“Circumlunar Trajectory Calculations”, MIT Instrumentation Laboratory Report R-353, April 1962.
“Optimal Low Thrust Trajectories to the Moon”, John T. Betts and Sven O. Erb, SIAM Journal on
Applied Dynamical Systems, Vol. 2, No. 2, pp. 144-170, 2003.
page 21
Program Lunar1
A Computer Program for Lunar Mission Design and Analysis
This document is the user’s guide for a Fortran computer program called lunar1 that can be used to
design and optimize lunar missions from Earth park orbit to B-plane encounter at the moon. The
software assumes that trans-lunar injection (TLI) occurs impulsively from a circular Earth park orbit.
The B-plane coordinates and final orbital elements are expressed in a moon-centered (selenocentric)
mean lunar equator and IAU node of epoch coordinate system.
The first part of the software solves for the minimum TLI impulsive delta-v using a two-body Lambert
solution for the transfer trajectory from the Earth park orbit to the center of the moon. The second part
of the computer program implements a simple shooting method that attempts to minimize the
impulsive TLI delta-v while numerically integrating the spacecraft equations of motion and targeting
to components of the B-plane. In the shooting algorithm, the spacecraft motion model includes the
Earth’s non-spherical gravity effect and the point-mass perturbations of the sun and moon. The B-
plane targets are enforced via a user-defined periapsis radius and orbital inclination of the arrival
hyperbola relative to the moon.
The program inputs and major computational steps implemented in this software are as follows:
Software Inputs
Output
• TLI delta-v vector and transfer time
• Classical orbital elements of geocentric transfer trajectory
• Selenocentric orbital elements of the encounter hyperbola
• B-plane coordinates
This computer program uses the SNOPT nonlinear programming (NLP) method and the lunar
coordinates required by the software are computed using the JPL DE421 ephemeris.
page 1
Input data file
The lunar1 Computer program is “data-driven” by a simple text file created by the user. This section
describes a typical input data file. In the following discussion the actual input file contents are in
courier font and all explanations are in times italic font. 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.
The first five lines of any input file are reserved for user comments. These lines are ignored by the
software. However the input file must begin with five and only five initial text lines.
**************************************
* input file for lunar1
* lunar1.in - January 9, 2006
* polar lunar orbit at 100 km altitude
**************************************
The software allows the user to specify an initial guess for the TLI calendar date and lower and upper
bounds on the actual date found during both the two-body and numerically integrated TLI delta-v
optimization processes. For any guess for the TLI time tTLI and user-defined lower and upper bounds
∆tl and ∆tu , the actual TLI time t is constrained as follows:
The first five inputs define the initial guesses for the TLI calendar date and the lower and upper
bounds, respectively. Be sure to include all four digits of the calendar year. The first set of bounds is
used during the two-body optimization, and the second set is used during the numerical integration
and B-plane targeting.
The TLI calendar date is a control variable in the NLP formulation and must always have a lower and
upper bound. For a fixed TLI calendar date, input small values (e.g., plus and minus 1.0e-8) for the
bounds.
initial guess for TLI calendar date (month, day, year)
10,1,2008
lower bound for TLI calendar date search (two-body optimization; hours)
-240.0
upper bound for TLI calendar date search (two-body optimization; hours)
+24.0
lower bound for TLI calendar date search (b-plane optimization; hours)
-12.0
upper bound for TLI calendar date search (b-plane optimization; hours)
+12.0
The next input is the user’s initial guess for the TLI-to-B-plane transfer time, in hours.
initial guess for transfer time (hours)
96.0
page 2
The next two numbers define the fixed values for park orbit altitude and orbital inclination. The
altitude ius measured with respect to a spherical Earth model.
***********************************
circular park orbit characteristics
***********************************
altitude (kilometers)
185.32
This next integer input defines the type of TLI maneuver to perform. The software uses this indicator
to compute the park orbit RAAN.
type of TLI maneuver
(1 = ascending, 2 = descending)
2
The next two inputs define the periapsis radius and orbital inclination to use during the numerically
integrated solution. These coordinates refer to the selenocentric hyperbola. The orbital inclination
should be specified in the mean lunar equator and IAU node of epoch coordinate system.
******************************************
final lunar orbit characteristics
(mean lunar equator and IAU node of epoch)
******************************************
This next integer input defines the type of targeting algorithm to use. The B-plane algorithm is
recommended with the orbital elements algorithm a backup in case the software has trouble
establishing a hyperbolic orbit encounter during the shooting calculations.
type of targeting
(1 = b-plane, 2 = orbital elements, 3 = user-defined b-plane targets)
1
For targeting option 3, the software allows the user to input B-plane targets directly using the
following two program inputs.
user-defined b dot r target (kilometers)
6000.0d0
The next three integer inputs define the types of perturbations to include during the numerical
integration of the spacecraft’s equations of motion. The first option allows the user to specify the
order and degree (up to 70) of the EGM96 gravity model in the equations of motion, and options 2 and
3 will include the point mass gravity of the moon and sun.
************************
trajectory perturbations
************************
page 3
order of Earth gravity model (zonals)
8
The next two inputs are algorithm control parameters. The first input is the truncation error tolerance
for the Runge-Kutta-Felhberg integrator and determines how well the equations of orbital motion are
solved. The second input is the root-finding tolerance and it determines how accurately close
approach to the moon is predicted.
****************************
algorithm control parameters
****************************
root-finding tolerance
1.0d-4
The final two inputs specify the name of the solution disk file and the time step at which the data is
created and written.
***************************
output file characteristics
***************************
The following is the solution created by the computer program for this example. The output is
organized by the following major sections:
• First pass
1. optimized two body Lambert solution
2. TLI delta-v vector and magnitude
3. pre-TLI and post-TLI flight conditions
• Targeting pass
1. pre-TLI and post-TLI flight conditions
2. TLI delta-v vector and magnitude
3. time and conditions at lunar closest approach
4. classical orbital elements of the lunar transfer trajectory
5. B-plane coordinates at closest approach to the moon
page 4
The first output section summarizes the optimized two-body Lambert solution. The solution is
presented in the Earth mean equator of J2000 coordinate system (EME2000). The trajectory
characteristics are given before and after the impulsive TLI maneuver.
--------------------------------------
two-body lunar trajectory optimization
--------------------------------------
descending transfer
page 5
This section of the program output is created after the B-plane targeting problem has been solved. It
includes a summary of the solution, the TLI delta-v vector and magnitude, the final B-plane
coordinates and the orbital elements and state vector of the incoming hyperbola.
--------------------------------------
numerically integrated n-body solution
--------------------------------------
inform = 9
descending transfer
page 6
rx (km) ry (km) rz (km) rmag (km)
0.655727973465D+04 -.620025922760D+02 0.277843053026D+03 0.656345630000D+04
page 7
decl-asy 14.480918876969049 degrees
rasc-asy 88.906344197521022 degrees
-------------------------------------------------
coordinates of the moon at closest approach
(geocentric - Earth equator and equinox of J2000)
-------------------------------------------------
The lunar1 software suite also includes an interactive MATLAB script called lplot.m that can be
used to create three-dimensional geocentric and selenocentric graphics of the solution. The graphics
data is displayed at the user-defined step size provided in the input file. A plot step size of ten minutes
is recommended. However, for zoomed plots of either the geocentric or selenocentric trajectory,
smaller plot step sizes will create “smoother” trajectory displays.
Important note!!
You must delete the first or “header” line of the lunar1 solution file in order for the lplot script to
work. This script uses the MATLAB csvread function to read the data file which can only contain
comma-separated-variable numerical data.
The following is a plot of the geocentric transfer trajectory for this example. Please note that the
coordinates are displayed in the units of Earth radii (ER). The asterisk symbol is the position of the
moon at the moment of trans-lunar injection and the park orbit trace is red.
The interactive graphic features of MATLAB will allow the user to rotate and “zoom” the displays in
and out. These capabilities allow the user to interactively find the “best” viewpoint as well as verify
the basic orbital geometry of the geocentric and selenocentric trajectories.
page 8
Geocentric Transfer Trajectory
50
40
30
Z coordinate (ER)
20
10
-10
-20
-30
0 -60
10
-40
20
30 -20
40
0
X coordinate (ER)
Y coordinate (ER)
This next plot is a “zoomed” display of the first plot closer to the Earth. The initial park orbit is
displayed in red, the transfer trajectory is blue, and an inertial, Earth-centered coordinate system is on
the plot. The x-axis of this system is red, the y-axis green and the z-axis blue. The location on the
park orbit at which TLI occurs is marked with a small dot symbol.
The following is a plot of the selenocentric hyperbola within the moon’s sphere-of-influence. The
coordinate units are lunar radii (LR). The entry into the SOI is marked with an asterisk. In this
MATLAB script the radius of the moon’s SOI is “hardwired” to a value of 64,000 kilometers.
page 9
Selenocentric Trajectory
15
10
Z coordinate (MR)
5
-5
-10
-15
-20
20 -30
10 -20
0
-10
-10
-20 0
Y coordinate (MR)
X coordinate (MR)
The final plot is a “zoomed” display of the previous plot. This display is labeled with a selenocentric,
inertial coordinate system. The x-axis is red, the y-axis green and the z-axis blue. The small red dot is
periapsis of the approach hyperbola.
page 10
Technical Discussion
This section provides additional details about the numerical algorithms used in this computer program.
The computational methods discussed here include solving the two body Lambert problem, the method
used for propagating the spacecraft’s geocentric trajectory, the algorithm used for targeting to the B-
plane, and the geocentric-to-selenocentric coordinate transformation.
y ( t )
z=
u ( t )
consisting of the state variables y and the control variables u for any time t. In this discussion
vectors are denoted in bold.
The system dynamics are defined by a vector system of ordinary differential equations called the state
equations that can be represented as follows:
dy
y
= = f y ( t ) , u ( t ) , p, t
dt
The initial dynamic variables at time t0 are defined by ψ0 ≡ ψ y ( t0 ) , u ( t0 ) , t0 and the terminal
conditions at the final time t f are defined by ψ f ≡ ψ y ( t f ) , u ( t f ) , t f . These conditions are called
the boundary values of the trajectory problem.
For any mission time t there are also simple bounds on the state variables
yl ≤ y (t ) ≤ yu
the control variables
ul ≤ u ( t ) ≤ uu
p l ≤ p ( t ) ≤ pu
The basic nonlinear programming problem (NLP is to determine the control vector history and
problem parameters that minimize the scalar performance index or objective function given by
page 11
J = φ y ( t0 ) , t0 , y ( t f ) , t f , p
During the two-body trajectory optimization, the control variables are the TLI calendar date and the
true anomaly of the TLI maneuver. For the numerical integration optimization, the control variables
consist of the TLI calendar date, the RAAN of the park orbit, the true anomaly of the TLI maneuver,
and the Cartesian components of the TLI delta-v vector.
For both types of optimization, the objective function or performance index is the scalar magnitude of
the TLI impulsive delta-v.
In addition to the bounds on the TLI calendar date mentioned earlier, the true anomaly during the two-
body optimization is bounded according to
−180 ≤ θ ≤ +180
During the second part of the trajectory optimization, the RAAN and true anomaly bounds are
where ΩTB and θTB are the RAAN and true anomaly found during the two-body optimization. The
bounds on the components of the TLI delta-v are given by
− ( ∆v + 0.1 ∆v ) ≤ ∆v x , y ,z ≤ + ( ∆v + 0.1 ∆v )
The final boundary conditions are the B-plane coordinates of the incoming selenocentric hyperbola.
Lambert’s problem is concerned with the determination of an orbit that passes between two positions
within a specified time-of-flight. This classic astrodynamic problem is also known as the orbital two-
point boundary value problem (TPBVP).
The time to traverse a trajectory depends only upon the length of the semimajor axis a of the transfer
trajectory, the sum ri + rf of the distances of the initial and final positions relative to a central body,
and the length c of the chord joining these two positions. This relationship can be stated as follows:
tof tof ( ri + rf , c, a )
=
page 12
a3
t=
− t0 ( E − e sin E )
µ
we can write
a3
=t E − E0 − e ( sin E − sin E0 )
µ
where E is the eccentric anomaly associated with radius r, E0 is the eccentric anomaly at r0 , and t = 0
when r = r0 .
At this point we need to introduce the following trigonometric sun and difference identities:
α−β a+β
sin α − sin β =
2sin cos
2 2
α−β a+β
cos α − cos β =
−2sin sin
2 2
α−β a+β
cos α + cos β =
2 cos cos
2 2
If we let E = α and E0 = β and substitute the first trig identity into the second equation above, we
have the following equation:
a3 E − E0 E + E0
=t E − E0 − 2sin e cos
µ 2 2
E + E0 α+β
e cos = cos
2 2
E − E0 α−β
sin = sin
2 2
a3 α−β α+β
=t (α − β ) − 2sin cos
µ 2 2
page 13
r a (1 − e cos E )
=
=x a ( cos E − e )
=y a sin E 1 − e 2
r + r0 c r + r0 + c s
cos α =1 − − =−
1 =−
1
2a 2a 2a a
r + r0 c r + r0 − c s−c
sin β =1 − + =−
1 =−
1
2a 2a 2a a
This part of the derivation makes use of the following three relationships:
α−β α+β r + r0
cos cos = 1−
2 2 2
α−β α+β
E − E0 E + E0
2
sin =sin sin 1 − e cos
2 2 2 2
α−β α + β x − x0 y − y0 c
2 2 2 2
sin sin = + =
2 2 2a 2a 2a
α s β s−c
=sin = sin
2 2a 2 2a
and several additional substitutions, we have the time-of-flight form of Lambert’s theorem
a3
=t (α − β ) − ( sin α − sin β )
µ
A discussion about the angles α and β can be found in “Geometrical Interpretation of the Angles α
and β in Lambert’s Problem” by J. E. Prussing, AIAA Journal of Guidance and Control, Volume 2,
Number 5, Sept.-Oct. 1979, pages 442-443.
The algorithm used in this computer program is based on the method described in “A Procedure for the
Solution of Lambert’s Orbital Boundary-Value Problem” by R. H. Gooding, Celestial Mechanics and
Dynamical Astronomy 48: 145-165, 1990. This iterative solution is valid for elliptic, parabolic and
hyperbolic transfer orbits which may be either posigrade or retrograde, and involve one or more
revolutions about the central body.
page 14
Propagating the spacecraft’s trajectory
This part of the trajectory analysis implements a special perturbation technique which numerically
integrates the vector system of second-order, nonlinear differential equations of motion of a spacecraft
given by
(
a ( r , v , t ) = )
r r , r , t =a g ( r ) + am ( r , t ) + as ( r , t )
where
t= dynamical time
r= inertial position vector of the spacecraft
v= inertial velocity vector of the spacecraft
ag = acceleration due to the Earth's gravity
am = acceleration due to the Moon
as = acceleration due to the Sun
This computer program uses a spherical harmonic representation of the Earth’s geopotential function
given by
µ µ ∞ 0R 0 µ ∞ n R m
n n
where φ is the geocentric latitude of the spacecraft, λ is the geocentric east longitude of the spacecraft
and r = r = x 2 + y 2 + z 2 is the geocentric distance of the spacecraft. In this expression the S’s and
C’s are unnormalized harmonic coefficients of the geopotential, and the P’s are associated Legendre
polynomials of degree n and order m with argument u = sin φ .
The software calculates the spacecraft’s acceleration due to the Earth’s gravity field with a vector
equation derived from the gradient of the potential function expressed as
a g ( r, t ) = ∇Φ ( r, t )
This acceleration vector is a combination of pure two-body or point mass gravity acceleration and the
gravitational acceleration due to higher order nonspherical terms in the Earth’s geopotential. In terms
of the Earth’s geopotential Φ , the inertial rectangular cartesian components of the spacecraft’s
acceleration vector are as follows:
1 ∂Φ z ∂Φ 1 ∂Φ
x= − x− 2 y
r ∂ r r 2 x 2 + y 2 ∂φ x + y 2
∂λ
1 ∂Φ z ∂Φ 1 ∂Φ
y= − y+ 2 x
r ∂ r r x + y ∂φ
2 2 2
x + y 2
∂λ
1 ∂Φ x 2 + y 2 ∂Φ
=
z z +
r ∂r r 2
∂φ
page 15
The three partial derivatives of the geopotential with respect to r , φ , λ are given by
∂Φ 1 µ N R
n
∂Φ µ N R n
n
= ∑ ∑ ( Cnm cos mλ + Snm sin mλ ) Pnm +1 ( sin φ ) − m tan φ Pnm ( sin φ )
∂φ =
r n 2=
r m0
∂Φ µ N R n
n
where
R = radius of the Earth
r = geocentric distance of the spacecraft
Snm , Cnm = harmonic coefficients
z
=φ =
geocentric latitude of the spacecraft sin −1
r
λ= longitude of the spacecraft= α − α g
y
α = right ascension of the spacecraft = tan −1
x
α g = right ascension of Greenwich
Right ascension is measure positive east of the vernal equinox, longitude is measured positive east of
Greenwich, and latitude is positive above the Earth’s equator and negative below.
For m = 0, the coefficients are called zonal terms, when m = n the coefficients are sectorial terms, and
for n > m ≠ 0 the coefficients are called tesseral terms.
The Legendre polynomials with argument sin φ are computed using recursion relationships given by:
1
Pn0 ( sin=
φ) ( 2n − 1) sin φ Pn0−1 ( sin φ ) − ( n − 1) Pn0−2 ( sin φ )
n
Pnn ( sin φ ) =( 2n − 1) cos φ Pnn−−11 ( sin φ ) , m ≠ 0, m < n
Pnm ( sin
= φ ) Pnm−2 ( sin φ ) + ( 2n − 1) cos φ Pnm−1−1 ( sin φ ) , m ≠=
0, m n
page 16
The trigonometric arguments are determined from expansions given by
( m 1) tan φ + tan φ
m tan φ =−
r
r
am ( r , t ) =
− µ m m − b 3 + e − m 3
r re−m
m −b
where
µm = gravitational constant of the moon
rm −b = position vector from the moon to the satellite
re−m = position vector from the Earth to the moon
r
re− s
as ( r , t ) =
− µs 3 + 3
s −b
r re− s
s −b
where
µ s = gravitational constant of the sun
rs −b = position vector from the sun to the satellite
re− s = position vector from the Earth to the sun
In this computer program the heliocentric coordinates of the sun and moon are based on the JPL
Development Ephemeris DE421. These coordinates are provided in the Earth mean equator and
equinox of J2000 coordinate system (EME2000).
For a given TLI injection time, there are two possible locations on the initial park orbit at which to
perform the propulsive maneuver. One opportunity occurs during the ascending part of the park orbit
and the other during the descending motion. The park orbit RAAN Ω p at these two locations can be
determined from spherical trigonometry relationships involving the park orbit inclination and the right
ascension and declination of the moon at encounter.
ascending
tan δ m
Ω p =−180 + α m + sin −1
tan i
p
page 17
descending
tan δ m
Ω p = α m − sin −1
tan i
p
where
B-plane targeting
The derivation of B-plane coordinates is described in the classic JPL reports, “A Method of Describing
Miss Distances for Lunar and Interplanetary Trajectories” and “Some Orbital Elements Useful in
Space Trajectory Calculations”, both by William Kizner. The following diagram illustrates the
fundamental geometry of the B-plane coordinate system.
The software solves the B-plane targeting problem by minimizing the delta-v vector at the TLI while
satisfying two nonlinear equality constraint equations. These constraint equations are the differences
between components of the required B-plane and the B-plane components predicted by the software.
Given the user-defined closest approach radius rca and orbital inclination i, and the incoming v-infinity
magnitude v∞ and the right ascension α ∞ and declination δ ∞ of the incoming asymptote vector at the
page 18
moment of closest approach, the following series of equations can be used to determine the required
B-plane target components:
BT = bt cos θ
BR = bt sin θ
where
2 µ rca 2µ
bt= 2
+ rca2 = rca 1 +
v∞ rca v∞2
and
cos i
cos θ =
cos δ ∞
sin θ =− 1 − cos2 θ
sin δ ∞ = sˆ × zˆ = s x2 + s 2y
zˆ = [ 0 0 1]
T
cos δ ∞ cos α ∞
Sˆ = cos δ ∞ sin α ∞
sin δ
∞
where δ ∞ and α ∞ are the declination and right ascension of the asymptote of the incoming hyperbola.
Important note!!
This technique only works for lunar orbit inclinations that satisfy
i > δ∞
If this inequality is not satisfied, the software will print the following error message
It will also display the actual declination of the asymptote and stop. The user should then edit the input
file, include a valid orbital inclination and restart the simulation.
The following computational steps summarize the calculation of the predicted B-plane vector from a
moon-centered position vector r and velocity vector v at closest approach.
page 19
angular momentum vector
h= r × v
h
hˆ =
h
radius rate
r v
r =
r
semiparameter
h2
p=
µ
semimajor axis
r
a=
r v2
−
µ
2
orbital eccentricity
=
e 1− p a
true anomaly
p−r
cos θ =
er
r h
sin θ =
eµ
B-plane magnitude
B= pa
fundamental vectors
r v − r r
zˆ =
h
S vector
a b
S=
− pˆ + qˆ
a 2 + b2 a 2 + b2
B vector
b2 ab
=B pˆ + qˆ
a +b
2 2
a + b2
2
page 20
T vector
(S , − S x2 ,0 )
2 T
T=
y
S x2 + S y2
R vector
R =S × T =( − S zTy , S zTx , S xTy − S yTx )
T
For this targeting option, the equality constraints enforced by the SNOPT nonlinear programming
algorithm are
rp − rca =
0
cos i − hˆ z =
0
where rp and i are the user-defined periapsis radius and selenocentric orbital inclination, respectively,
and hˆ z is the z-component of the unit angular momentum vector at closest approach to the moon.
For both types of targeting techniques, closest approach is determined during the numerical integration
of the spacecraft equations of motion by finding the time since TLI at which the selenocentric flight
path angle is zero. This mission constraint is computed as follows
r v
γ = sin −1
r v
where r and v are the moon-centered position and velocity vectors, respectively.
This section describes the transformation of coordinates between the Earth mean equator and equinox
2000 (EME2000) and lunar mean equator and IAU node of epoch coordinate systems. This
transformation is used to compute the B-plane coordinates at encounter.
A unit vector in the direction of the pole of the moon can be determined from
cos α p cos δ p
pˆ Moon = sin α p cos δ p
sin δ p
The right ascension and declination of the lunar pole in the EME2000 coordinate system are given by
the following expressions
page 21
α P = 269.9949 + 0.0031T − 3.8787sin E1 − 0.1204sin E 2
+0.0700sin E 3 − 0.0172sin E 4 + 0.0072sin E 6
−0.0052sin E10 + 0.0043sin E13
where =d JD − 2451545 is the number of days since January 1.5, 2000. These equations are given in
“Report of the IAU/IAG Working Group on Cartographic Coordinates and Rotational Elements of the
Planets and Satellites: 2000”, Celestial Mechanics and Dynamical Astronomy, 82: 83-110, 2002.
The unit vector in the x-axis direction of this selenocentric coordinate system is given by
xˆ= zˆ × pˆ Moon
where zˆ = [ 0 0 1] . The unit vector in the y-axis direction can be determined using
T
=yˆ pˆ Moon × xˆ
Finally, the components of the matrix that transforms coordinates from the EME2000 system to the
moon-centered (selenocentric) mean equator and IAU node of epoch system are as follows:
M = [ xˆ yˆ pˆ Moon ]
T
page 22
References and Bibliography
“Circumlunar Trajectory Calculations”, MIT Instrumentation Laboratory Report R-353, April 1962.
“Optimal Low Thrust Trajectories to the Moon”, John T. Betts and Sven O. Erb, SIAM Journal on
Applied Dynamical Systems, Vol. 2, No. 2, pp. 144-170, 2003.
page 23
APPENDIX A
Compiling and Running the Software
This appendix describes how to compile and run the lunar1 computer program. This software was
created using Compaq Visual Fortran and version 5.3.5 of SNOPT. However, it should compile and
run with any “modern” Fortran 77 compiler.
A DOS/Windows version of lunar1 using Compaq Visual Fortran version 6.6C can be created with
the following command:
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:
lunar1 lunar1.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 lunar1 *
* *
* lunar trajectory *
* design & optimization *
* *
* January 9, 2006 *
*************************************
The source code that reads the name of an input file included on the command line is
The source code that creates the file name input prompt is as follows:
c clear screen
isys = system("cls")
page 24
print *, ' '
If your compiler does not accept input from a command line, you will have to modify this source code
for your particular Fortran compiler. You may also choose to eliminate the code that accepts a
command line input file. Please note also that your compiler may have a different command to clear
the screen.
page 25
APPENDIX B
Contents of the Simulation Summary and CSV Files
This appendix is a brief summary of the information contained in the simulation summary screen
displays and the CSV data files produced by the lunar1 software.
transfer time = total time from the TLI maneuver to closest approach at the moon
arglat (deg) = argument of latitude in degrees. The argument of latitude is the sum of
true anomaly and argument of perigee.
vmag (km/sec) = scalar magnitude of the spacecraft’s velocity vector in kilometers per
second
page 26
r-periapsis = periapsis of incoming hyperbola
page 27
argper-geo (deg) = geocentric argument of perigee of the spacecraft in degrees
raan-geo (deg) = geocentric right ascension of the ascending node of the spacecraft in
degrees
raan-sel (deg) = selocentric right ascension of the ascending node of the spacecraft in
degrees
The geocentric coordinates of the spacecraft and the TLI delta-v components are with respect to the
Earth mean equator and equinoc of J2000 coordinate system.. The selenocentric coordinates are with
respect to the lunar equator and IAU node of epoch coordinate system.
page 28
APPENDIX C
Fortran Functions and Subroutines
This appendix is a brief summary of the major Fortran functions and subroutines included in the
lunar1 computer program.
readfpn.for - read and echo floating point number from an input file subroutine
page 29
uvector.for - unit vector subroutine
page 30
APPENDIX D
Nonlinear Programming Software
This appendix provides additional information about the two types of optimization performed within
the lunar1 software. It provides Fortran source code that illustrates how the problems are solved with
SNOPT, and discusses how the user can adapt the software to use other NLP codes.
As provided, the lunar1 computer program is written to use version 5.3.5 of the SNOPT nonlinear
programming software (www.sbsi-sol-optimize.com/asp/sol_product_snopt.htm). However, the
software should work with any good multi-dimensional algorithm that can handle bounds on the
control variables and equality constraints. Since analytic derivatives for this problem would be
difficult to derive, the software should also use some form of numerical differencing for gradient
information. Of course, this last requirement would not be necessary if the user chooses to use some
form of genetic or evolutionary algorithm.
Two-body optimization
The part of the code that solves the two-body optimization problem is shown below.
c ***************************************
c optimize two body lunar Lambert problem
c ***************************************
c control variables
c initial guesses
x(1) = 0.0d0
x(2) = 0.0d0
bl(1) = tlilwr1
bu(1) = tliupr1
bl(2) = -pi
bu(2) = +pi
n = 2
nclin = 0
ncnln = 0
lda = 1
page 31
ldj = 0
ldr = 2
ip = 0
is = 0
call npopt (n, nclin, ncnln, lda, ldj, ldr, a, bl, bu,
& funcon1, funobj1, inform, iter, istate, c, cjac,
& clamda, f, g, r, x, iw, leniw, w, lenw)
The source code that solves the numerically integrated, b-plane targeting problem is as follows:
c control variables
c initial guesses
x(1) = 0.0d0
x(2) = oevpo(5)
x(3) = oevpo(6)
x(4) = deltav(1)
x(5) = deltav(2)
x(6) = deltav(3)
page 32
bu(1) = tliupr2 / 24.0d0
dvm = vecmag(deltav)
do i = 4, 6
bl(i) = -(dvm + 0.1d0 * dvm)
bl(7) = 0.0d0
bu(7) = 0.0d0
bl(8) = 0.0d0
bu(8) = 0.0d0
n = 6
nclin = 0
ncnln = 2
lda = 1
ldj = 0
ldr = 2
ip = 0
is = 0
page 33
call npseti('derivative level', 0, ip, is, inform, iw, leniw,
& w, lenw)
call npopt (n, nclin, ncnln, lda, ldj, ldr, a, bl, bu,
& funcon2, funobj2, inform, iter, istate, c, cjac,
& clamda, f, g, r, x, iw, leniw, w, lenw)
In both optimization problems, we are calling the npopt subroutine which is part of the SNOPT
software suite. This routine requires a subroutine that evaluates the objective function
(funobj*.for) and a second subroutine (funcon*.for) that computes the current values of the
mission constraints. Other NLP codes often include both types of computations within a single
subroutine.
page 34
A Matlab Script for Parametric Analysis of Minimum TLI Delta-V,
Two-Body Lunar Transfer Trajectories
This document is the user’s guide for a Matlab script called tli_sweep that can be used to perform a
parametric analysis of two-body lunar transfer trajectories. The software assumes that trans-lunar
injection (TLI) occurs impulsively from a circular Earth park orbit. The software solves for the
minimum TLI delta-v using a two-body Lambert solution for the transfer trajectory from the Earth
park orbit to the center of the moon.
This computer program uses the SNOPT nonlinear programming (NLP) method to solve this classic
trajectory optimization problem. The lunar coordinates required by the software are computed using
the JPL DE421 ephemeris.
The tli_sweep Matlab script is “data-driven” by a simple text file created by the user. This section
describes a typical input data file. In the following discussion the actual input file contents are in
courier font and all explanations are in times italic font.
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.
The first four lines of any input file are reserved for user comments. These lines are ignored by the
software. However the input file must begin with four and only four initial text lines.
*****************************************
* data file for tli_sweep.m Matlab script
* tli_sweep1.in March 22, 2007
*****************************************
The first inputs define the calendar date of the TLI maneuver. Be sure to include all four digits of the
calendar year.
initial calendar date (month, day, year)
1, 1, 2008
The next input specifies the type of TLI maneuver. Please see the Technical Discussion later in this
document for an explanation of this maneuver.
type of TLI maneuver (1 = ascending, 2 = descending)
2
The next two inputs define the value of the altitude and orbital inclination of the circular park orbit.
park orbit altitude (kilometers)
185.2
page 1
The duration of the lunar transfer trajectory is set by this next input.
transfer time (hours)
84.0
The total simulation duration and time step size of the parametric sweep are specified using these next
two inputs.
simulation duration (days)
90
The final input is the name of the data file created by the software.
name of summary data file
tli_sweep1.txt
When the tli_sweep script is started, the software will display the following screen which allows the
user to select a data file for processing.
The file type defaults to names with a *.in filename extension. However, you can select any
tli_sweep compatible ASCII data file.
Program example
This section contains plots of the behavior of the TLI characteristics for a descending node transfer for
a period of three months at a step size of 0.25 days. The initial calendar date and time is 0 hours TDB
on January 1, 2008 and the transfer time from TLI until lunar encounter is 84 hours. The first plot
shows the variation of the magnitude of the TLI impulsive delta-v as a function of the calendar date.
page 2
This next plot illustrates the variation of the RAAN of the circular park orbit as a function of the TLI
calendar date.
page 3
This plot illustrates the behavior of the true anomaly of the impulsive TLI maneuver on the circular
park orbit.
This next plot shows the geocentric declination of the moon at the encounter time.
page 4
This final plot illustrates the evolution of the geocentric orbital inclination of the moon.
The following printout illustrates the first eight days of the ASCII data file created by the software.
time (days) delta-v (mps) RAAN (deg) tanom (deg) C3 (km/sec)^2 rasc moon (deg) decl moon (deg)
0.0000 3154.26737087 293.97720168 124.15265786 -1.61934856 235.30494550 -24.88171236
0.2500 3154.10755774 300.07998669 121.43863512 -1.62284758 238.51328259 -25.52261158
0.5000 3153.92108565 306.18899458 118.78003988 -1.62693022 241.76185305 -26.09405035
0.7500 3153.70956707 312.27105277 116.20237412 -1.63156114 245.04889036 -26.59310552
1.0000 3153.47466323 318.27587296 113.74525870 -1.63670395 248.37203799 -27.01699195
1.2500 3153.21807014 324.12620286 111.47115679 -1.64232148 251.72836258 -27.36310665
1.5000 3152.94150459 329.70348264 109.47812284 -1.64837611 255.11438384 -27.62907362
1.7500 3152.64669058 334.83384588 107.91237414 -1.65483008 258.52612185 -27.81278819
2.0000 3152.33534590 339.29720864 106.96076958 -1.66164574 261.95916197 -27.91245900
2.2500 3152.00916934 342.90037697 106.78724986 -1.66878588 265.40873611 -27.92664613
2.5000 3151.66982838 345.59681652 107.42827767 -1.67621397 268.86981815 -27.85429366
2.7500 3151.31894760 347.51770675 108.76580390 -1.68389442 272.33723019 -27.69475548
3.0000 3150.95809788 348.87041621 110.61617181 -1.69179282 275.80575572 -27.44781301
3.2500 3150.58878652 349.83824198 112.81769985 -1.69987616 279.27025487 -27.11368444
3.5000 3150.21244835 350.55047096 115.25658720 -1.70811303 282.72577716 -26.69302501
3.7500 3149.83043793 351.09098660 117.85912117 -1.71647375 286.16766702 -26.18691865
4.0000 3149.44402299 351.51330030 120.57835280 -1.72493057 289.59165809 -25.59686166
4.2500 3149.05437905 351.85197000 123.38400735 -1.73345776 292.99395329 -24.92473926
4.5000 3148.66258545 352.12984663 126.25608979 -1.74203168 296.37128831 -24.17279654
4.7500 3148.26962268 352.36245136 129.18102625 -1.75063089 299.72097775 -23.34360505
5.0000 3147.87637123 352.56061151 132.14934287 -1.75923610 303.04094375 -22.44002675
5.2500 3147.48361174 352.73207185 135.15424927 -1.76783024 306.32972830 -21.46517665
5.5000 3147.09202675 352.88250179 138.19075473 -1.77639837 309.58649079 -20.42238568
5.7500 3146.70220373 353.01614031 141.25510436 -1.78492764 312.81099308 -19.31516495
6.0000 3146.31463962 353.13621913 144.34441082 -1.79340719 316.00357459 -18.14717236
6.2500 3145.92974670 353.24524687 147.45640856 -1.80182799 319.16511990 -16.92218251
6.5000 3145.54785963 353.34520404 150.58928667 -1.81018275 322.29702133 -15.64406028
6.7500 3145.16924384 353.43767974 153.74157300 -1.81846564 325.40113864 -14.31673867
7.0000 3144.79410489 353.52396921 156.91205262 -1.82667219 328.47975778 -12.94420090
7.2500 3144.42259882 353.60514493 160.09970917 -1.83479899 331.53555002 -11.53046696
7.5000 3144.05484329 353.68210933 163.30368231 -1.84284348 334.57153281 -10.07958448
7.7500 3143.69092941 353.75563458 166.52323564 -1.85080366 337.59103280 -8.59562377
8.0000 3143.33093406 353.82639333 169.75773259 -1.85867787 340.59765177 -7.08267690
page 5
A guide to the items captured in this data file is as follows;
RAAN (deg) = park orbit right ascension of the ascending node in degrees
tanom (deg) = park orbit true anomaly of the TLI maneuver in degrees
rasc moon (deg) = geocentric right ascension of the moon in degrees at arrival
Please note that all angular coordinates are measured with respect to the Earth mean equator and
equinox of J2000 (EME2000) coordinate system.
Technical Discussion
This section describes several of the major algorithms implemented in the tli_sweep Matlab script.
y t
z
u t
consisting of the state variables y and the control variables u for any time t. In this discussion
vectors are denoted in bold.
The system dynamics are defined by a vector system of ordinary differential equations called the state
equations that can be represented as follows:
dy
y f y t , u t , p, t
dt
The initial dynamic variables at time t0 are defined by ψ0 ψ y t0 , u t0 , t0 and the terminal
conditions at the final time t f are defined by ψ f ψ y t f , u t f , t f . These conditions are called
the boundary values of the trajectory problem. The problem may also be subject to path constraints of
the form g y t , u t , t 0 .
The basic nonlinear programming problem (NLP) is to determine the control vector history and
problem parameters that minimize the scalar performance index or objective function given by
page 6
J y t0 , t0 , y t f , t f , p
During the two-body trajectory optimization, the main control variable is the park orbit true anomaly at
the time of the TLI maneuver. The objective function or performance index is the scalar magnitude of
the TLI delta-v vector. The final boundary conditions are the components of the moon’s inertial
position vector at encounter.
An initial guess for the park orbit true anomaly at the time of the impulsive TLI maneuver is obtained
iteratively. This iteration involves setting the park orbit true anomaly equal to the argument of perigee
of the TLI maneuver of the Earth-to-Moon elliptical transfer orbit. This process is repeated until the
change in true anomaly between successive iterations is small. The argument of perigee of the transfer
orbit is determined by resolving the two-body Lambert problem which is a function of the current park
orbit position vector and the position vector of the Moon at encounter.
For the first calendar date of the parametric sweep, the initial true anomaly guess is set to zero.
Subsequent days in the sweep use the previous optimal true anomaly for their initial guess.
1 10 1 10
where 1 is the true anomaly computed from the initial guess iteration.
For a given TLI calendar date, there are two possible locations on the initial park orbit at which to
perform the propulsive maneuver. One opportunity occurs during the ascending part of the park orbit
and the other during the descending motion. The park orbit RAAN p at these two locations can be
determined from spherical trigonometry relationships involving the park orbit inclination and the
geocentric right ascension and declination of the moon at encounter.
In this Matlab script, the park orbit RAAN is held fixed during the numerical optimization. The
RAAN option used is selected by the user.
ascending maneuver
1 tan m
p 180 m sin
tan i p
descending maneuver
1 tan m
p m sin
tan i p
page 7
where
m right ascension of the moon at encounter
m declination of the moon at encounter
ip park orbit inclination
Lambert’s problem is concerned with the determination of an orbit that passes between two positions
within a specified time-of-flight. This classic astrodynamic problem is also known as the orbital two-
point boundary value problem (TPBVP).
The time to traverse a trajectory depends only upon the length of the semimajor axis a of the transfer
trajectory, the sum ri rf of the distances of the initial and final positions relative to a central body,
and the length c of the chord joining these two positions. This relationship can be stated as follows:
tof tof ri rf , c , a
a3
t t0 E e sin E
we can write
a3
t E E0 e sin E sin E0
where E is the eccentric anomaly associated with radius r, E0 is the eccentric anomaly at r0 , and t 0
when r r0 .
At this point we need to introduce the following trigonometric sun and difference identities:
a
sin sin 2sin cos
2 2
a
cos cos 2sin sin
2 2
a
cos cos 2 cos cos
2 2
If we let E and E0 and substitute the first trig identity into the second equation above, we
have the following equation:
a3 E E0 E E0
t E E0 2sin e cos
2 2
page 8
With the two substitutions given by
E E0
e cos cos
2 2
E E0
sin sin
2 2
a3
t 2sin cos
2 2
r a 1 e cos E
x a cos E e
y a sin E 1 e2
r r0 c r r0 c s
cos 1 1 1
2a 2a 2a a
r r0 c r r0 c s c
sin 1 1 1
2a 2a 2a a
This part of the derivation makes use of the following three relationships:
r r0
cos cos 1
2 2 2
2
E E0 E E0
sin sin sin 1 e cos
2 2 2 2
2 2 2 2
x x0 y y0 c
sin sin
2 2 2a 2a 2a
s s c
sin sin
2 2a 2 2a
and several additional substitutions, we have the time-of-flight form of Lambert’s theorem
page 9
a3
t sin sin
A discussion about the angles and can be found in “Geometrical Interpretation of the Angles
and in Lambert’s Problem” by J. E. Prussing, AIAA Journal of Guidance and Control, Volume 2,
Number 5, Sept.-Oct. 1979, pages 442-443.
The algorithm used in this MATLAB script is based on the method described in “A Procedure for the
Solution of Lambert’s Orbital Boundary-Value Problem” by R. H. Gooding, Celestial Mechanics and
Dynamical Astronomy 48: 145-165, 1990. This iterative solution is valid for elliptic, parabolic and
hyperbolic transfer orbits which may be either posigrade or retrograde, and involve one or more
revolutions about the central body.
“Circumlunar Trajectory Calculations”, MIT Instrumentation Laboratory Report R-353, April 1962.
“Optimal Low Thrust Trajectories to the Moon”, John T. Betts and Sven O. Erb, SIAM Journal on
Applied Dynamical Systems, Vol. 2, No. 2, pp. 144-170, 2003.
“Nonimpact Lunar Transfer Trajectories Using the Pseudostate Technique”, R. V. Ramanan and V.
Adimurthy, AIAA Journal of Guidance, Control and Dynamics, Vol. 28, No. 2, March-April 2005, pp.
217-225.
“Injection Conditions for Lunar Trajectories”, R. Kolenkiewicz and W. Putney, NASA TM X-55390,
November 1965.
“Coplanar Three-Body Trans-Earth Lunar Trajectory Simulation Methodology”, H. Ikawa, AIAA 88-
0381, AIAA 26th Aerospace Sciences Meeting, Reno, Nevada, January 11-14, 1988.
“User’s Guide for SNOPT Version 6, A Fortran Package for Large-Scale Nonlinear Programming”,
Philip E. Gill, Walter Murray and Michael A. Saunders, December 2002.
page 10
A Computer Program for Parametric Analysis of Minimum TLI Delta-V,
Two-Body Lunar Transfer Trajectories
This document is the user’s guide for a Windows-compatible computer program called tli_sweep
that can be used to perform a parametric analysis of two-body lunar transfer trajectories. The software
assumes that trans-lunar injection (TLI) occurs impulsively from a circular Earth park orbit. The
software solves for the minimum TLI delta-v using a two-body Lambert solution for the transfer
trajectory from the Earth park orbit to the center of the moon.
This computer program uses a nonlinear programming (NLP) method to solve this classic trajectory
optimization problem. The lunar coordinates required by the software are computed using the JPL
DE421 ephemeris. The software creates a simple comma-separated-variable (CSV) summary text file
of the analysis results. The tli_sweep computer program was created using Intel Visual Fortran.
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:
tli_sweep tli_sweep1.in
If the software is executed without an input file on the command line, the computer program will
display the following prompt:
At this point the user should input the name of a valid input file, including the filename extension.
The tli_sweep computer program is “data-driven” by a simple text file created by the user. This
section describes a typical input data file. In the following discussion the actual input file contents are
in courier font and all explanations are in times italic font.
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.
The first four lines of any input file are reserved for user comments. These lines are ignored by the
software. However the input file must begin with four and only four initial text lines.
*****************************************
* data file for tli_sweep
* tli_sweep1.in December 7, 2010
*****************************************
The first input defines the initial calendar date of the TLI analysis sweep. Be sure to include all four
digits of the calendar year.
page 1
initial calendar date (month, day, year)
1, 1, 2008
The next input specifies the type of TLI maneuver. Please see the Technical Discussion later in this
document for an explanation of the maneuver type.
type of TLI maneuver (1 = ascending, 2 = descending)
2
The next two inputs define the value of the altitude and orbital inclination of the circular park orbit.
park orbit altitude (kilometers)
185.32
The fixed duration of the lunar transfer trajectory is set by this next input.
transfer time (hours)
84.0
The total simulation duration and time step size of the parametric sweep are specified using these next
two inputs. Both inputs should be input in days.
simulation duration (days)
90
The final input is the name of the summary data file created by the software.
name of summary data file
tli_sweep1.txt
Program example
The following printout illustrates the first eight days of the ASCII data file created by the software for
this example input file.
time (days) , delta-v (mps) , RAAN (deg) , tanom (deg) , C3 (km/sec)**2 , rasc moon (deg) , decl moon (deg)
0.0000000000000000D+00, 0.3154237240720148D+04, 0.2939772016817301D+03, 0.1241527540037006D+03, -.1619347313399913D+01, 0.2353049454982873D+03, -.2488171235979486D+02,
0.2500000000000000D+00, 0.3154077426068113D+04, 0.3000799866902164D+03, 0.1214387300464090D+03, -.1622846333371825D+01, 0.2385132825880984D+03, -.2552261158134712D+02,
0.5000000000000000D+00, 0.3153890952209858D+04, 0.3061889945772383D+03, 0.1187801338655062D+03, -.1626928971784480D+01, 0.2417618530514432D+03, -.2609405035352827D+02,
0.7500000000000000D+00, 0.3153679431620233D+04, 0.3122710527657329D+03, 0.1162024672537953D+03, -.1631559896441956D+01, 0.2450488903609971D+03, -.2659310551528822D+02,
0.1000000000000000D+01, 0.3153444525558491D+04, 0.3182758729576013D+03, 0.1137453509300226D+03, -.1636702705910395D+01, 0.2483720379854596D+03, -.2701699195180769D+02,
0.1250000000000000D+01, 0.3153187930027161D+04, 0.3241262028642868D+03, 0.1114712491685794D+03, -.1642320237905594D+01, 0.2517283625844008D+03, -.2736310665059587D+02,
0.1500000000000000D+01, 0.3152911361859615D+04, 0.3297034826366919D+03, 0.1094782143465262D+03, -.1648374874428853D+01, 0.2551143838418896D+03, -.2762907362402288D+02,
0.1750000000000000D+01, 0.3152616545046504D+04, 0.3348338458801500D+03, 0.1079124649300287D+03, -.1654828842266355D+01, 0.2585261218453762D+03, -.2781278819289479D+02,
0.2000000000000000D+01, 0.3152305197412984D+04, 0.3392972086352405D+03, 0.1069608598057150D+03, -.1661644505026914D+01, 0.2619591619652265D+03, -.2791245900400300D+02,
0.2250000000000000D+01, 0.3151979017759757D+04, 0.3429003769708635D+03, 0.1067873398303938D+03, -.1668784645288156D+01, 0.2654087361133375D+03, -.2792664612751861D+02,
0.2500000000000000D+01, 0.3151639673580780D+04, 0.3455968165197433D+03, 0.1074283675462962D+03, -.1676212733913204D+01, 0.2688698181513981D+03, -.2785429366273458D+02,
0.2750000000000000D+01, 0.3151288789469656D+04, 0.3475177067495920D+03, 0.1087658938800532D+03, -.1683893184181315D+01, 0.2723372301933363D+03, -.2769475547739188D+02,
0.3000000000000000D+01, 0.3150927936324485D+04, 0.3488704162092085D+03, 0.1106162621042927D+03, -.1691791588334610D+01, 0.2758057557171905D+03, -.2744781300836680D+02,
0.3250000000000000D+01, 0.3150558621457198D+04, 0.3498382419822936D+03, 0.1128177906783877D+03, -.1699874934197638D+01, 0.2792702548681340D+03, -.2711368443875289D+02,
0.3500000000000000D+01, 0.3150182279708502D+04, 0.3505504709568317D+03, 0.1152566771647722D+03, -.1708111799594761D+01, 0.2827257771628555D+03, -.2669302500655103D+02,
0.3750000000000000D+01, 0.3149800265662989D+04, 0.3510909865971357D+03, 0.1178592115299426D+03, -.1716472523023526D+01, 0.2861676670176645D+03, -.2618691865482936D+02,
0.4000000000000000D+01, 0.3149413847050604D+04, 0.3515133002950020D+03, 0.1205784436033404D+03, -.1724929347457319D+01, 0.2895916580914668D+03, -.2559686166249513D+02,
0.4250000000000000D+01, 0.3149024199410908D+04, 0.3518519700036982D+03, 0.1233840989068707D+03, -.1733456537228435D+01, 0.2929939532895729D+03, -.2492473926297592D+02,
0.4500000000000000D+01, 0.3148632402085117D+04, 0.3521298466278018D+03, 0.1262561822160166D+03, -.1742030465349785D+01, 0.2963712883133450D+03, -.2417279653808047D+02,
0.4750000000000000D+01, 0.3148239435587899D+04, 0.3523624513587097D+03, 0.1291811196193405D+03, -.1750629670752318D+01, 0.2997209777483139D+03, -.2334360505064286D+02,
0.5000000000000000D+01, 0.3147846180396259D+04, 0.3525606115052031D+03, 0.1321494372260798D+03, -.1759234884416429D+01, 0.3030409437480232D+03, -.2244002674920664D+02,
0.5250000000000000D+01, 0.3147453417177175D+04, 0.3527320718492223D+03, 0.1351543444661071D+03, -.1767829024014162D+01, 0.3063297283000082D+03, -.2146517664916018D+02,
0.5500000000000000D+01, 0.3147061828458590D+04, 0.3528825017890921D+03, 0.1381908506647593D+03, -.1776397156961792D+01, 0.3095864907902939D+03, -.2042238568410906D+02,
0.5750000000000000D+01, 0.3146672001730351D+04, 0.3530161403078042D+03, 0.1412552017287281D+03, -.1784926432211819D+01, 0.3128109930821022D+03, -.1931516495063971D+02,
0.6000000000000000D+01, 0.3146284433943244D+04, 0.3531362191294632D+03, 0.1443445087274235D+03, -.1793405981271192D+01, 0.3160035745914986D+03, -.1814717236230353D+02,
0.6250000000000000D+01, 0.3145899537354936D+04, 0.3532452468659792D+03, 0.1474565070193246D+03, -.1801826790181380D+01, 0.3191651198996198D+03, -.1692218250649683D+02,
0.6500000000000000D+01, 0.3145517646652878D+04, 0.3533452040424814D+03, 0.1505893856722551D+03, -.1810181543166877D+01, 0.3222970213255037D+03, -.1564406027924430D+02,
0.6750000000000000D+01, 0.3145139027264779D+04, 0.3534376797381462D+03, 0.1537416721218106D+03, -.1818464440542982D+01, 0.3254011386402415D+03, -.1431673867134131D+02,
0.7000000000000000D+01, 0.3144763884749192D+04, 0.3535239692053073D+03, 0.1569121526508003D+03, -.1826670993115741D+01, 0.3284797577771587D+03, -.1294420090356834D+02,
0.7250000000000000D+01, 0.3144392375140826D+04, 0.3536051449308609D+03, 0.1600998103836742D+03, -.1834797795469655D+01, 0.3315355500241936D+03, -.1153046696289316D+02,
0.7500000000000000D+01, 0.3144024616108828D+04, 0.3536821093321296D+03, 0.1633037836067529D+03, -.1842842281748659D+01, 0.3345715328057993D+03, -.1007958447612396D+02,
0.7750000000000000D+01, 0.3143660698770940D+04, 0.3537556345821970D+03, 0.1665233375564573D+03, -.1850802467263307D+01, 0.3375910327960111D+03, -.8595623769932406D+01,
0.8000000000000000D+01, 0.3143300699993345D+04, 0.3538263933265177D+03, 0.1697578347264995D+03, -.1858676679101450D+01, 0.3405976517664502D+03, -.7082676902271969D+01,
page 2
A guide to the items captured in this data file is as follows;
RAAN (deg) = park orbit right ascension of the ascending node in degrees
tanom (deg) = park orbit true anomaly of the TLI maneuver in degrees
rasc moon (deg) = geocentric right ascension of the moon in degrees at arrival
Please note that all angular coordinates are measured with respect to the Earth mean equator and
equinox of J2000 (EME2000) coordinate system.
This next section contains plots of the behavior of the TLI characteristics for a descending node
transfer for a period of three months at a step size of 0.25 days. The initial calendar date is January 1,
2008 at 0 hours Barycentric Dynamical Time (TDB), and the fixed transfer time from TLI until lunar
encounter is 84 hours.
The first plot shows the variation of the magnitude of the TLI impulsive delta-v in meters per second
as a function of the elapsed time since January 1, 2008 in days.
page 3
This next plot illustrates the variation of the RAAN of the circular park orbit as a function of the TLI
calendar date.
This plot illustrates the behavior of the true anomaly of the impulsive TLI maneuver on the circular
park orbit.
page 4
This next plot shows the geocentric declination of the moon at the encounter time.
This final plot illustrates the specific orbital energy of the transfer trajectory.
page 5
Technical Discussion
y t
z
u t
consisting of the state variables y and the control variables u for any time t. In this discussion
vectors are denoted in bold.
The system dynamics are defined by a vector system of ordinary differential equations called the state
equations that can be represented as follows:
dy
y f y t , u t , p, t
dt
The initial dynamic variables at time t0 are defined by ψ0 ψ y t0 , u t0 , t0 and the terminal
conditions at the final time t f are defined by ψ f ψ y t f , u t f , t f . These conditions are called
the boundary values of the trajectory problem. The problem may also be subject to path constraints of
the form g y t , u t , t 0 .
The basic nonlinear programming problem (NLP) is to determine the control vector history and
problem parameters that minimize the scalar performance index or objective function given by
J y t0 , t0 , y t f , t f , p
During the two-body trajectory optimization, the main control variable is the park orbit true anomaly at
the time of the TLI maneuver. The objective function or performance index is the scalar magnitude of
the TLI delta-v vector. The final boundary conditions are the components of the moon’s geocentric
inertial position vector at encounter.
For each calendar date of the parametric sweep, the initial true anomaly guess for the location of the
TLI impulsive maneuver is set to zero. During the numerical optimization, the true anomaly is
bounded according to
360 360
page 6
Park orbit RAAN
For a given TLI calendar date, there are two possible locations on the initial park orbit at which to
perform the propulsive maneuver. One opportunity occurs during the ascending part of the park orbit
and the other during the descending motion. The park orbit RAAN p at these two locations can be
determined from spherical trigonometry relationships involving the park orbit inclination and the
geocentric right ascension and declination of the moon at encounter.
In this application, the park orbit RAAN is held fixed during the numerical optimization. The RAAN
option used is selected by the user.
ascending maneuver
tan m
p 180 m sin 1
tan i
p
descending maneuver
tan m
p m sin 1
tan i
p
where
m right ascension of the moon at encounter
m declination of the moon at encounter
i p park orbit inclination
Lambert’s problem is concerned with the determination of an orbit that passes between two positions
within a specified time-of-flight. This classic astrodynamic problem is also known as the orbital two-
point boundary value problem (TPBVP).
The time to traverse a trajectory depends only upon the length of the semimajor axis a of the transfer
trajectory, the sum ri rf of the distances of the initial and final positions relative to a central body,
and the length c of the chord joining these two positions. This relationship can be stated as follows:
tof tof ri rf , c, a
a3
t t0 E e sin E
we can write
page 7
a3
t E E0 e sin E sin E0
where E is the eccentric anomaly associated with radius r, E0 is the eccentric anomaly at r0 , and t 0
when r r0 .
At this point we need to introduce the following trigonometric sun and difference identities:
a
sin sin 2sin cos
2 2
a
cos cos 2sin sin
2 2
a
cos cos 2 cos cos
2 2
If we let E and E0 and substitute the first trig identity into the second equation above, we
have the following equation:
a3 E E0 E E0
t E E0 2sin e cos
2 2
E E0 E E0
e cos cos sin sin
2 2 2 2
a3
t 2sin cos
2 2
r a 1 e cos E
x a cos E e
y a sin E 1 e 2
page 8
r r0 c r r0 c s
cos 1 1 1
2a 2a 2a a
r r0 c r r0 c sc
sin 1 1 1
2a 2a 2a a
This part of the derivation makes use of the following three relationships:
r r0
cos cos 1
2 2 2
E E0 E E0
2
sin sin sin 1 e cos
2 2 2 2
x x0 y y0 c
2 2 2 2
sin sin
2 2 2a 2a 2a
s sc
sin sin
2 2a 2 2a
and several additional substitutions, we have the time-of-flight form of Lambert’s theorem
a3
t sin sin
A discussion about the angles and can be found in “Geometrical Interpretation of the Angles
and in Lambert’s Problem” by J. E. Prussing, AIAA Journal of Guidance and Control, Volume 2,
Number 5, Sept.-Oct. 1979, pages 442-443.
The algorithm used in this computer program is based on the method described in “A Procedure for the
Solution of Lambert’s Orbital Boundary-Value Problem” by R. H. Gooding, Celestial Mechanics and
Dynamical Astronomy 48: 145-165, 1990. This iterative solution is valid for elliptic, parabolic and
hyperbolic transfer orbits which may be either posigrade or retrograde, and involve one or more
revolutions about the central body.
page 9
References and Bibliography
“Circumlunar Trajectory Calculations”, MIT Instrumentation Laboratory Report R-353, April 1962.
“Optimal Low Thrust Trajectories to the Moon”, John T. Betts and Sven O. Erb, SIAM Journal on
Applied Dynamical Systems, Vol. 2, No. 2, pp. 144-170, 2003.
“Nonimpact Lunar Transfer Trajectories Using the Pseudostate Technique”, R. V. Ramanan and V.
Adimurthy, AIAA Journal of Guidance, Control and Dynamics, Vol. 28, No. 2, March-April 2005, pp.
217-225.
“Injection Conditions for Lunar Trajectories”, R. Kolenkiewicz and W. Putney, NASA TM X-55390,
November 1965.
“Coplanar Three-Body Trans-Earth Lunar Trajectory Simulation Methodology”, H. Ikawa, AIAA 88-
0381, AIAA 26th Aerospace Sciences Meeting, Reno, Nevada, January 11-14, 1988.
“User’s Guide for SNOPT Version 6, A Fortran Package for Large-Scale Nonlinear Programming”,
Philip E. Gill, Walter Murray and Michael A. Saunders, December 2002.
page 10
A MATLAB Script for Trans-Lunar Trajectory Optimization
This document is the user’s guide for a MATLAB script named tlto_matlab that can be used to
design preliminary lunar missions from Earth park orbit to B-plane encounter at the moon. The software
assumes trans-lunar injection (TLI) occurs impulsively from a circular Earth park orbit. The B-plane
coordinates used for targeting the final conditions at the moon are expressed in a moon-centered
(selenocentric) mean equator and IAU node of epoch coordinate system. The results from this scientific
simulation can be used as an initial guess for a finite-burn trajectory optimization program.
The first part of this MATLAB script solves for the minimum TLI delta-v using a two-body Lambert
solution for the transfer trajectory from the Earth park orbit to the center of the moon. The second part
of the script implements a shooting method that attempts to minimize the TLI delta-v while numerically
integrating the spacecraft’s n-body equations of motion and targeting to user-defined constraints.
In the shooting algorithm, the spacecraft motion model includes the Earth’s non-spherical gravity effect
and the point-mass perturbations of the sun and moon. The B-plane targets are enforced via a user-
defined periapsis radius and orbital inclination of the arrival hyperbola relative to the moon.
The program inputs and major computational steps implemented in this script are as follows:
Software Inputs
Step 2: Using output from Step 1 as initial conditions, optimize the numerically
integrated spacecraft motion problem with B-plane targets
Output
TLI delta-v vector and transfer time
Classical orbital elements of geocentric transfer trajectory
Selenocentric orbital elements of the encounter hyperbola
B-plane coordinates
This MATLAB script uses the SNOPT nonlinear programming (NLP) method for both optimization
tasks required for the lunar transfer problem implemented in this script. The solar and lunar coordinates
required by this script are computed using the JPL DE421 ephemeris.
page 1
The tlto_matlab script uses routines from the MICE software suite to read and evaluate the JPL
binary ephemeris file. Platform-specific MICE mex files, support functions and the binary ephemeris
file (de421.bsp) are available at naif.jpl.nasa.gov/naif/toolkit_MATLAB.html. MICE is a MATLAB
implementation of the SPICE library created by JPL.
MATLAB versions of SNOPT for several computer platforms can be found at Professor Philip Gill’s
web site which is located at http://scicomp.ucsd.edu/~peg/. Professor Gill’s web site also includes a
PDF version of the SNOPT software user’s guide.
The tlto_matlab MATLAB script is “data-driven” by a simple text file created by the user. This
section describes a typical input data file. In the following discussion the actual input file contents are in
courier font and all explanations are in times italic font.
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.
The first four lines of any input file are reserved for user comments. These lines are ignored by the
software. However the input file must begin with four and only four initial text lines.
******************************
* input file for tlto_matlab
* tlto1.in - February 11, 2013
******************************
The software allows the user to specify an initial guess for the TLI calendar date and lower and upper
bounds on the actual date found during both the two-body and numerically integrated TLI delta-v
optimization processes. For any guess for the TLI time tTLI and user-defined lower and upper bounds
tl and tu , the actual TLI time t is constrained as follows:
The first five inputs define the initial guesses for the TLI calendar date and the lower and upper bounds,
respectively. Be sure to include all four digits of the calendar year. The first set of bounds is used
during the two-body optimization, and the second set is used during the numerical integration and b-
plane targeting.
The TLI calendar date is a control variable in the NLP formulation and must always have a lower and
upper bound. For a fixed TLI calendar date, input small values (e.g., plus and minus 1.0e-8) for the
bounds.
initial guess for TLI calendar date (month, day, year)
9,15,2008
lower bound for TLI calendar date search (two-body optimization; hours)
0.0
page 2
upper bound for TLI calendar date search (two-body optimization; hours)
+24.0
lower bound for TLI calendar date search (b-plane optimization; hours)
-12.0
upper bound for TLI calendar date search (b-plane optimization; hours)
+12.0
The next input is the user’s initial guess for the TLI-to-B-plane transfer time, in hours.
initial guess for transfer time (hours)
110.0
The next two numbers define the fixed values for park orbit altitude and orbital inclination.
***********************************
circular park orbit characteristics
***********************************
altitude (kilometers)
185.32
This next integer input defines the type of TLI maneuver to perform. The script uses this indicator to
compute the park orbit RAAN.
type of TLI maneuver
(1 = ascending, 2 = descending)
2
The next two inputs define the periapsis radius and orbital inclination to use during the numerically
integrated n-body solution. These coordinates refer to the selenocentric hyperbola. The orbital
inclination should be specified in the lunar mean equator and IAU node of epoch coordinate system.
******************************************
final lunar orbit characteristics
(lunar mean equator and IAU node of epoch)
******************************************
This next integer input defines the type of targeting algorithm to use. The b-plane algorithm is
recommended with the orbital elements algorithm a backup in case the software has trouble establishing
a hyperbolic orbit encounter during the shooting calculations.
type of targeting
(1 = b-plane, 2 = orbital elements, 3 = user-defined b-plane targets)
1
page 3
For option 3, the software allows the user to input b-plane targets directly using the following two
program inputs.
user-defined b dot r target (kilometers)
6000.0
The last set of inputs defines the types of perturbations to include during the numerical integration of the
spacecraft’s motion. The first input is the name of the Earth gravity model data file and the next two
integers define the order and degree of the model. The last two integers determine if the simulation
includes the point mass gravity of the moon and sun.
************************
trajectory perturbations
************************
The prompt for the name of the simulation definition input date file is similar to the following;
The file type defaults to names with a *.in filename extension. However, you can select any
tlto_matlab compatible ASCII data file by selecting the Files of type: field or by typing the name of
the file directly in the File name: field.
page 4
Program example and trajectory graphics
The following is the solution created by the tlto_matlab script for this example. The output is
organized by the following major sections:
First pass
1. two body Lambert solution
2. TLI delta-v vector and magnitude
Targeting pass
1. pre-TLI and post-TLI flight conditions
2. TLI delta-v vector and magnitude
3. time and conditions at lunar closest approach
4. classical orbital elements of the lunar transfer trajectory
The first output section summarizes the optimized two-body Lambert solution. The solution is presented
in the Earth mean equator of J2000 coordinate system (EME2000). The trajectory characteristics are
given before and after the impulsive TLI maneuver.
===============================================
minimum TLI delta-v (two-body Lambert solution)
===============================================
page 5
TDB Julian Date 2454725.06117188
This section of the program output is created after the B-plane targeting problem has been solved. It
includes a summary of the solution, the TLI delta-v vector and magnitude, the final B-plane coordinates
and the orbital elements, state vector and flight path angle of the encounter hyperbola.
=======================
optimal n-body solution
=======================
page 6
TLI TDB time 13:28:05.251
c3 -2.08104039 kilometer^2/second^2
Appendix A contains a brief summary of the numerical information provided by this script.
After the n-body optimization finishes, the software will verify the solution by numerically integrating
the equations of motion using a Runge-Kutta-Fehlberg 7(8) numerical method. The integration starts
with the position and velocity vector of the trans-lunar transfer orbit immediately after the TLI
impulsive maneuver and propagates to closest approach to the moon predicted by the software.
===============================
verification of n-body solution
===============================
page 8
calendar date 19-Sep-2008
The important results from solving this orbital initial value problem (IVP) are the selenocentric periapsis
radius and orbital inclination, and the flight path angle. For a valid solution, the periapsis radius and
orbital inclination should be very close to the user-defined values and the selenocentric flight path angle
at closest approach should be very near zero.
The tlto_matlab script can also create graphic displays of the geocentric transfer orbit and the
selenocentric hyperbola within the sphere-of-influence of the moon. This section describes the user
interaction with this software option and also provides typical graphic displays.
After the software has computed the trajectory solution, it will display the following graphics menu:
page 9
graphics menu
<4> none
If the user elects option 1, 2 or 3, the script will request the plot duration with this next menu:
plot duration menu
This menu option allows the user to create graphics from trans-lunar injection until either the time of
closest approach to the moon or a simulation duration defined by the user.
For the second plot duration option, the software will ask for this input with the following request:
please input the simulation duration (hours)
?
Finally, the MATLAB script will request the plot step size with
please input the plot step size (minutes)
?
A plot step size of ten minutes is recommended. However, for zoomed plots of either the geocentric or
selenocentric trajectory, smaller plot step sizes will create “smoother” displays. The following is a plot
of the geocentric transfer trajectory for this example. The coordinates are displayed in the units of Earth
radii (ER). The asterisk symbol is the position of the moon at the moment of trans-lunar injection and
the moon’s orbit is marked with a small blue dot symbol at 24 hour intervals. The park orbit trace is red.
page 10
The interactive graphic features of MATLAB will allow the user to rotate and “zoom” the displays in
and out. These capabilities allow the user to interactively find the “best” viewpoint as well as verify the
basic orbital geometry of the geocentric and selenocentric trajectories.
Selenocentric Trajectory
This next plot is a “zoomed” display of the first plot closer to the Earth. The initial park orbit is
displayed in red, the transfer trajectory is blue, and an inertial, Earth-centered coordinate system is on
the plot. The x-axis of this system is red, the y-axis green and the z-axis blue. The location on the park
orbit at which TLI occurs is marked with a small dot symbol.
30
20
The following is a plot of the selenocentric hyperbola within the moon’s sphere-of-influence. The
coordinate units are lunar radii (LR). The entry into the SOI is marked with an asterisk. In this
MATLAB script the radius of the moon’s SOI is “hardwired” to a value of 64,000 kilometers.
10
-10
-20 The final plot is a “zoomed” display of the previous plot. This display is labeled with a selenocentric,
inertial coordinate system. The x-axis is red, the y-axis green and the z-axis blue. The small red dot is
periapsis of the approach hyperbola.
page 11
-30
The tlto_matlab MATLAB script can also create these types of graphic displays for the optimized
two-body solution.
Finally, the main script will create color postscript graphic disk files (with TIFF preview) of these
images. These images are created with source code similar to
Technical Discussion
This section provides additional details about the numerical algorithms used in this computer program.
The computational methods discussed here include solving the two body Lambert problem, the method
used for propagating the spacecraft’s geocentric trajectory, the algorithm used for targeting to the B-
plane, and the geocentric-to-selenocentric coordinate transformation. A brief discussion of trajectory
optimization is also provided along with the MATLAB source code for the two-body optimization.
Lambert’s problem is concerned with the determination of an orbit that passes between two positions
within a specified time-of-flight. This classic astrodynamic problem is also known as the orbital two-
point boundary value problem (TPBVP).
The time to traverse a trajectory depends only upon the length of the semimajor axis a of the transfer
trajectory, the sum ri rf of the distances of the initial and final positions relative to a central body, and
the length c of the chord joining these two positions. This relationship can be stated as follows:
tof tof ri rf , c, a
a3
t t0 E e sin E
page 12
we can write
a3
t E E0 e sin E sin E0
where E is the eccentric anomaly associated with radius r, E0 is the eccentric anomaly at r0 , and t 0
when r r0 .
At this point we need to introduce the following trigonometric sun and difference identities:
a
sin sin 2sin cos
2 2
a
cos cos 2sin sin
2 2
a
cos cos 2 cos cos
2 2
If we let E and E0 and substitute the first trig identity into the second equation above, we have
the following equation:
a3 E E0 E E0
t E E0 2sin e cos
2 2
E E0
e cos cos
2 2
E E0
sin sin
2 2
a3
t 2sin cos
2 2
r a 1 e cos E
x a cos E e
y a sin E 1 e 2
page 13
r r0 c r r0 c s
cos 1 1 1
2a 2a 2a a
r r0 c r r0 c sc
sin 1 1 1
2a 2a 2a a
This part of the derivation makes use of the following three relationships:
r r0
cos cos 1
2 2 2
E E0 E E0
2
sin sin sin 1 e cos
2 2 2 2
x x0 y y0 c
2 2 2 2
sin sin
2 2 2a 2a 2a
s sc
sin sin
2 2a 2 2a
and several additional substitutions, we have the time-of-flight form of Lambert’s theorem
a3
t sin sin
A discussion about the angles and can be found in “Geometrical Interpretation of the Angles
and in Lambert’s Problem” by J. E. Prussing, AIAA Journal of Guidance and Control, Volume 2,
Number 5, Sept.-Oct. 1979, pages 442-443.
The algorithm used in this MATLAB script is based on the method described in “A Procedure for the
Solution of Lambert’s Orbital Boundary-Value Problem” by R. H. Gooding, Celestial Mechanics and
Dynamical Astronomy 48: 145-165, 1990. This iterative solution is valid for elliptic, parabolic and
hyperbolic transfer orbits which may be either posigrade or retrograde, and involve one or more
revolutions about the central body.
The spacecraft’s orbital motion is modeled with respect to the Earth mean equator and equinox of J2000
(EME2000) coordinate system. The following figure illustrates the geometry of the EME2000
coordinate system. The origin of this Earth-centered-inertial (ECI) inertial coordinate system is the
geocenter and the fundamental plane is the Earth’s mean equator. The z-axis of this system is normal to
the Earth’s mean equator at epoch J2000, the x-axis is parallel to the vernal equinox of the Earth’s mean
orbit at epoch J2000, and the y-axis completes the right-handed coordinate system. The epoch J2000 is
the Julian Date 2451545.0 which corresponds to January 1, 2000, 12 hours Terrestrial Time (TT).
page 14
Figure 1. Earth mean equator and equinox of J2000 coordinate system
The trajectory analysis implements a special perturbation technique which numerically integrates the
vector system of second-order, nonlinear differential equations of motion of a spacecraft given by
a r , v , t r r , r , t ag r am r , t as r , t
where
t dynamical time
r inertial position vector of the spacecraft
v inertial velocity vector of the spacecraft
a g acceleration due to the Earth's gravity
am acceleration due to the Moon
as acceleration due to the Sun
This computer program uses a spherical harmonic representation of the Earth’s geopotential function
given by
0R 0 n R m
n n
where is the geocentric latitude of the spacecraft, is the geocentric east longitude of the spacecraft
and r r x 2 y 2 z 2 is the geocentric distance of the spacecraft. In this expression the S’s and C’s
are unnormalized harmonic coefficients of the geopotential, and the P’s are associated Legendre
polynomials of degree n and order m with argument u sin .
page 15
The software calculates the spacecraft’s acceleration due to the Earth’s gravity field with a vector
equation derived from the gradient of the potential function expressed as
a g r, t r, t
This acceleration vector is a combination of pure two-body or point mass gravity acceleration and the
gravitational acceleration due to higher order nonspherical terms in the Earth’s geopotential. In terms of
the Earth’s geopotential , the inertial rectangular cartesian components of the spacecraft’s acceleration
vector are as follows:
1 z 1
x x 2 y
r r r 2 x 2 y 2 x y 2
1 z 1
y y 2 x
r r r 2 x 2 y 2 x y 2
1 x2 y2
z z
r r r 2
The three partial derivatives of the geopotential with respect to r, , are given by
1 N R
n
r r r n 2 r m 0
N R
n n
r n2 r
C
m 0
m
n cos m Snm sin m Pnm1 sin m tan Pnm sin
N R
n n
r n2 r
mS
m 0
m
n cos m Cnm sin m Pnm sin
where
R radius of the Earth
r geocentric distance of the spacecraft
Snm , Cnm harmonic coefficients
geocentric latitude of the spacecraft sin 1 z r
longitude of the spacecraft g
right ascension of the spacecraft tan 1 y x
g right ascension of Greenwich
Right ascension is measure positive east of the vernal equinox, longitude is measured positive east of
Greenwich, and latitude is positive above the Earth’s equator and negative below.
page 16
For m 0 , the coefficients are called zonal terms, when m n the coefficients are sectorial terms, and
for n m 0 the coefficients are called tesseral terms.
The Legendre polynomials with argument sin are computed using recursion relationships given by:
1
Pn0 sin 2n 1 sin Pn01 sin n 1 Pn02 sin
n
Pnn sin 2n 1 cos Pnn11 sin , m 0, m n
and Pi j 0 for j i .
The tlto_matlab zipped file contains an un-normalized 18 by 18 version of the EGM96 gravity
model data file. The software can also read and process user-defined gravity model files in the correct
format. These gravity model data files are simple fixed-format, space delimited ASCII data files. The
following is a portion of a typical gravity model data file. In this file, column one is the degree index,
column two is the model order index, and columns three and four are the corresponding un-normalized
gravity coefficients (zonals and tesserals, respectively).
2 0 -1.08262668355E-003 0.00000000000E+000
3 0 2.53265648533E-006 0.00000000000E+000
4 0 1.61962159137E-006 0.00000000000E+000
5 0 2.27296082869E-007 0.00000000000E+000
6 0 -5.40681239107E-007 0.00000000000E+000
7 0 3.52359908418E-007 0.00000000000E+000
8 0 2.04799466985E-007 0.00000000000E+000
9 0 1.20616967365E-007 0.00000000000E+000
10 0 2.41145438626E-007 0.00000000000E+000
11 0 -2.44402148325E-007 0.00000000000E+000
12 0 1.88626318279E-007 0.00000000000E+000
13 0 2.19788001661E-007 0.00000000000E+000
14 0 -1.30744533118E-007 0.00000000000E+000
Gravity model coefficients are often published in normalized form. The relationship between
normalized Cl ,m , Sl ,m and un-normalized gravity coefficients Cl ,m , Sl ,m is given by the following
expression:
page 17
l m ! Cl ,m
12
Cl ,m 1
Sl ,m 2 m 0 2l 1 l m ! Sl ,m
r r
am r , t m m b 3 e m 3
r rem
m b
where
m gravitational constant of the moon
rmb position vector from the moon to the satellite
rem position vector from the Earth to the moon
r r
a s r , t s s b 3 e s 3
r res
s b
where
s gravitational constant of the sun
rs b position vector from the sun to the satellite
re s position vector from the Earth to the sun
3 3qk qk2
f qk qk 3
1 1 qk
where
r T r 2sk
qk
sTk sk
n
k
r r f qk s k
k 1 d k3
page 18
In these equations, s k is the vector from the primary body to the secondary body, k is the gravitational
constant of the secondary body and dk r sk , where r is the position vector of the spacecraft relative
to the primary body.
The derivation of the f q functions is described in Section 8.4 of “An Introduction to the Mathematics
and Methods of Astrodynamics, Revised Edition”, by Richard H. Battin, AIAA Education Series, 1999.
In this computer program the heliocentric coordinates of the sun and moon are based on the JPL
Development Ephemeris DE421. These coordinates are evaluated in the Earth mean equator and
equinox of J2000 coordinate system (EME2000). The default name of this binary date file is
de421.bsp, and it must reside in the same directory as the tlto_matlab script. The name of the
source ephemeris can be changed by editing the ephname = 'de421.bsp'; source code in the main
MATLAB script.
For a given TLI injection time, there are two possible locations on the initial park orbit at which to
perform the propulsive maneuver. One opportunity occurs during the ascending part of the park orbit
and the other during the descending motion. The park orbit RAAN p at these two locations can be
determined from spherical trigonometry relationships involving the park orbit inclination and the right
ascension and declination of the moon at encounter.
ascending
tan m
p 180 m sin 1
tan i
p
Descending
tan m
p m sin 1
tan i
p
where m right ascension of the moon at encounter , m declination of the moon at encounter , and
i p park orbit inclination . These opportunities are valid whenever m i p .
For this targeting option, the equality constraints enforced by the SNOPT nonlinear programming
algorithm are
rp rca 0
cos i hˆ z 0
where rp and i are the user-defined periapsis radius and selenocentric orbital inclination, respectively,
and hˆ z is the z-component of the unit angular momentum vector at closest approach to the moon.
page 19
B-plane targeting
The derivation of B-plane coordinates is described in the classic JPL reports, “A Method of Describing
Miss Distances for Lunar and Interplanetary Trajectories” and “Some Orbital Elements Useful in Space
Trajectory Calculations”, both by William Kizner. The following diagram illustrates the fundamental
geometry of the B-plane coordinate system.
The software solves the B-plane targeting problem by minimizing the TLI delta-v vector while
satisfying two nonlinear equality constraint equations. These constraint equations are the differences
between components of the required B-plane and the B-plane components predicted by the software.
Given the user-defined closest approach radius rca and orbital inclination i, and the incoming v-infinity
magnitude v and the right ascension and declination of the incoming asymptote vector at the
moment of closest approach, the following series of equations can be used to determine the required B-
plane target components:
B T bt cos
B R bt sin
where
2 rca 2
bt 2
rca2 rca 1
v rca v2
and
cos i
cos sin 1 cos2
cos
page 20
sin sˆ zˆ sx2 s 2y
zˆ 0 0 1
T
cos cos
Sˆ cos sin
sin
where and are the declination and right ascension of the asymptote of the incoming hyperbola.
Important note!!
This technique only works for lunar orbit inclinations that satisfy
i
If this inequality is not satisfied, the software will print the following error message
It will also display the actual declination of the asymptote and stop. The user should then edit the input
file, include a valid orbital inclination and restart the simulation.
The following computational steps summarize the calculation of the predicted B-plane vector from a
moon-centered position vector r and velocity vector v at closest approach.
radius rate r r v r
semiparameter p h2
r
semimajor axis a
r v2
2
orbital eccentricity e 1 p a
pr rh
true anomaly cos sin tan 1 sin ,cos
er e
page 21
B-plane magnitude B pa
fundamental vectors
r v rr
zˆ pˆ cos rˆ sin zˆ qˆ sin rˆ cos zˆ
h
a b
S vector S pˆ qˆ
a 2 b2 a 2 b2
b2 ab
B vector B pˆ qˆ
a b
2 2
a b2
2
S , S ,0
2 2 T
T
y x
T vector
S x2 S y2
The mission elapsed time at which the spacecraft reaches closest approach to the moon is predicted
using the event prediction capability of the MATLAB ode45 algorithm. During the numerical
integration of the spacecraft’s geocentric equations of motion, the ode45 numerical method searches for
the time at which the sine of the flight path angle with respect to the moon is nearly zero.
This constraint corresponds to closest approach to the moon. The predicted B-plane coordinates are
based on the selenocentric flight conditions at closest approach. Close approach is predicted with the
following mission constraint
rv
sin
rv
where r and v are the moon-centered position and velocity vectors, respectively.
The following is the MATLAB source code that determines the time and trajectory conditions at closest
approach to the moon.
[t, ysol, tevent, yevent, ie] = ode45(@tlto_eqm, [0 tend], [ri vi], options);
page 22
Note that the numerical values for RelTol and AbsTol determine how well the algorithm integrates the
equations of motion and predicts closest approach.
The following is the MATLAB source code which calculates the sine of the flight path angle relative to
the moon.
% required by tlto_matlab.m
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
global jdtdb_tli
isterminal = 1;
direction = [];
This section describes the transformation of coordinates between the Earth mean equator and equinox
2000 (EME2000) and lunar mean equator and IAU node of epoch coordinate systems. This
transformation is used to compute the B-plane coordinates at encounter.
This figure illustrates the orientation of the lunar mean equator and IAU node of epoch coordinate
system relative to the Earth’s mean equator and north pole of J2000. The x-axis or Q-vector is formed
from the cross product of the Earth’s mean pole of J2000 and the Moon’s north pole relative to
EME2000. The x-axis is aligned with the IAU node of epoch.
page 23
Figure 2. Moon mean equator and IAU node of epoch coordinate system
A unit vector in the direction of the pole of the moon can be determined from
cos p cos p
pˆ Moon sin p cos p
sin p
The right ascension and declination of the lunar pole in the EME2000 coordinate system are given by
the following expressions
where T is the time in Julian centuries given by T JD 2451545.0 / 36525 and JD is the Barycentric
Dynamical Time (TDB) Julian Date.
page 24
E1 125.045 0.0529921d
E 2 250.089 0.1059842d
E 3 260.008 13.0120009d
E 4 176.625 13.3407154d
E 6 311.589 26.4057084d
E 7 134.963 13.0649930d
E10 15.134 0.1589763d
E13 25.053 12.9590088d
where d JD 2451545 is the number of days since January 1.5, 2000. These equations are given in
“Report of the IAU/IAG Working Group on Cartographic Coordinates and Rotational Elements of the
Planets and Satellites: 2000”, Celestial Mechanics and Dynamical Astronomy, 82: 83-110, 2002.
The unit vector in the x-axis direction of this selenocentric coordinate system is given by
xˆ zˆ pˆ Moon
where zˆ 0 0 1 . The unit vector in the y-axis direction can be determined using
T
yˆ pˆ Moon xˆ
Finally, the components of the matrix that transforms coordinates from the EME2000 system to the
moon-centered (selenocentric) mean equator and equinox of 2000 system are as follows:
M xˆ yˆ pˆ Moon
T
y t
z
u t
consisting of the state variables y and the control variables u for any time t. In this discussion vectors
are denoted in bold.
The system dynamics are defined by a vector system of ordinary differential equations called the state
equations that can be represented as follows:
dy
y f y t , u t , p, t
dt
page 25
The initial dynamic variables at time t0 are defined by ψ0 ψ y t0 , u t0 , t0 and the terminal
conditions at the final time t f are defined by ψ f ψ y t f , u t f , t f . These conditions are called the
boundary values of the trajectory problem.
For any mission time t there are also simple bounds on the state variables
yl y t yu
the control variables
ul u t u u
pl p t pu
The basic nonlinear programming problem (NLP is to determine the control vector history and problem
parameters that minimize the scalar performance index or objective function given by
J y t0 , t0 , y t f , t f , p
During the two-body trajectory optimization, the control variables are the TLI Julian date and the true
anomaly of the TLI maneuver. For the n-body numerical integration optimization, the control variables
consist of the TLI Julian date, the RAAN of the park orbit, the true anomaly of the TLI maneuver, and
the Cartesian components of the TLI delta-v vector.
For both types of optimization, the objective function or performance index is the scalar magnitude of
the TLI delta-v.
In addition to the bounds on the TLI calendar date mentioned earlier, the true anomaly during the two-
body optimization is bounded according to
180 180
During the second part of the trajectory optimization, the RAAN and true anomaly bounds are
TB 30 TB 30
TB 30 TB 30
page 26
where TB and TB are the RAAN and true anomaly found during the two-body optimization. The
bounds on the individual components of the TLI delta-v are given by
v 0.1 v v x , y ,z v 0.1 v
where v is the scalar magnitude of the two-body TLI delta-v vector. The final boundary conditions
are the B-plane coordinates of the incoming selenocentric hyperbola.
The following MATLAB source code illustrates typical interaction with the SNOPT nonlinear
programming function. This code provides initial guesses (xg) and lower and upper bounds (xlwr and
xupr) for the control variables and the objective function (flow and fupp). This implementation will
also read a SNOPT specs file named tlto_specs.txt.
% required by tlto_matlab.m
% control variables
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
oev1 = oev;
% initial guesses
xg(1) = 0.0d0;
xg(2) = 0.0d0;
xg = xg';
% delta-tli bounds
xlwr(1) = tli_lwr1;
xupr(1) = tli_upr1;
xlwr(2) = -pi;
xupr(2) = +pi;
xlwr = xlwr';
xupr = xupr';
page 27
flow(1) = 0.0d0;
fupp(1) = +Inf;
% find optimum
snscreen off;
snspec('tlto_specs.txt');
[x, f, inform, xmul, fmul] = snopt(xg, xlwr, xupr, flow, fupp, 'tlto_func_snopt');
revmax = 0;
sv1(1:3) = ri;
sv1(4:6) = vi;
sv2(1:3) = svmoon(1:3);
sv2(4:6) = svmoon(4:6);
rto = ri;
The following is the MATLAB source code for the tlto_func_snopt objective function. This
function evaluates the current value of the TLI Julian date and park orbit true anomaly of the maneuver,
solves the two-body form of Lambert’s equation, and calculates the scalar value of the TLI impulsive
delta-v maneuver.
% required by tlto_matlab.m
% input
% control variable
% output
page 28
% Orbital Mechanics with MATLAB
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
rmoon = svmoon(1:3);
vmoon = svmoon(4:6);
if (itli_type == 1)
oev1(5) = raan1;
else
oev1(5) = raan2;
end
oev1(6) = x(2);
revmax = 0;
sv1(1:3) = ri;
sv1(4:6) = vi;
sv2(1:3) = rmoon;
sv2(4:6) = vmoon;
page 29
[vito, vfto] = glambert(emu, sv1, sv2, tof, revmax);
for i = 1:1:3
end
f(1) = norm(dv_tli);
% no derivatives
g = [];
page 30
Algorithm resources
“Circumlunar Trajectory Calculations”, MIT Instrumentation Laboratory Report R-353, April 1962.
“Optimal Low Thrust Trajectories to the Moon”, John T. Betts and Sven O. Erb, SIAM Journal on
Applied Dynamical Systems, Vol. 2, No. 2, pp. 144-170, 2003.
“Integrated Algorithm for Lunar Transfer Trajectories Using a Pseudostate Technique”, R. V. Ramanan,
AIAA Journal of Guidance, Control and Dynamics, Vol. 25, No. 5, September-October 2002, pp. 946-
952.
“Nonimpact Lunar Transfer Trajectories Using the Pseudostate Technique”, R. V. Ramanan and V.
Adimurthy, AIAA Journal of Guidance, Control and Dynamics, Vol. 28, No. 2, March-April 2005, pp.
217-225.
“Injection Conditions for Lunar Trajectories”, R. Kolenkiewicz and W. Putney, NASA TM X-55390,
November 1965.
“Coplanar Three-Body Trans-Earth Lunar Trajectory Simulation Methodology”, H. Ikawa, AIAA 88-
0381, AIAA 26th Aerospace Sciences Meeting, Reno, Nevada, January 11-14, 1988.
“Lunar Constants and Models Document”, JPL D-32296, September 23, 2005.
page 31
APPENDIX A
Contents of the Simulation Summary
This appendix is a brief summary of the information contained in the simulation summary screen
displays produced by the tlto_matlab software.
transfer time = total time from the TLI maneuver to closest approach at the moon
arglat (deg) = argument of latitude in degrees. The argument of latitude is the sum of
true anomaly and argument of perigee.
c3 = twice the specific orbital energy in kilometers squared per second squared
vmag (km/sec) = scalar magnitude of the spacecraft’s velocity vector in kilometers per
second
page 32
b dot t = dot product of the b-vector and t-vector in kilometers
The geocentric coordinates of the spacecraft and the TLI delta-v components are with respect to the
Earth mean equator and equinox of J2000 (EME2000) coordinate system. The selenocentric coordinates
are with respect to the mean lunar equator and IAU node of epoch coordinate system.
The declination and right ascension of the moon at closest approach are with respect to the EME2000
coordinate system.
page 33
APPENDIX B
Time Systems
This appendix is a brief explanation of the time scales used in this MATLAB script.
Coordinated Universal Time (UTC) is the time scale available from broadcast time signals. It is a
compromise between the highly stable atomic time and the irregular earth rotation. UTC is the
international basis of civil and scientific time.
Terrestrial Time, TT
Terrestrial Time is the time scale that would be kept by an ideal clock on the geoid - approximately, sea
level on the surface of the Earth. Since its unit of time is the SI (atomic) second, TT is independent of
the variable rotation of the Earth. TT is meant to be a smooth and continuous “coordinate” time scale
independent of Earth rotation. In practice TT is derived from International Atomic Time (TAI), a time
scale kept by real clocks on the Earth's surface, by the relation TT = TAI + 32s.184. It is the time scale
now used for the precise calculation of future astronomical events observable from Earth.
In this equation, the coefficients are in seconds, the angular arguments are in radians, and T is the
number of Julian centuries of TT from J2000; T = (Julian Date(TT) – 2451545.0) / 36525.
page 34
Leap seconds calculation
The difference between International Atomic Time (TAI) and Universal Coordinated Time (UTC) is the
number of current leap seconds. International Atomic Time (TAI, Temps Atomique International) is a
physical time scale with the unit of the SI (System International) second and derived from a statistical
timescale based on a large number of atomic clocks. Coordinated Universal Time (UTC) is the time
scale available from broadcast time signals. It is a compromise between the highly stable atomic time
and the irregular earth rotation. UTC is the international basis of civil and scientific time.
The calculation of leap seconds in this MATLAB script is performed by a function that reads a simple
ASCII data file and evaluates the current value of leap seconds. The leap second function must be
initialized by including the following statements in the main script.
readleap;
The readleap MATLAB function reads the contents of the following simple comma-separated-
variable (csv) two column data file. The name of this file is tai-utc.dat.
2441317.5, 10.0
2441499.5, 11.0
2441683.5, 12.0
2442048.5, 13.0
2442413.5, 14.0
2442778.5, 15.0
2443144.5, 16.0
2443509.5, 17.0
2443874.5, 18.0
2444239.5, 19.0
2444786.5, 20.0
2445151.5, 21.0
2445516.5, 22.0
2446247.5, 23.0
2447161.5, 24.0
2447892.5, 25.0
2448257.5, 26.0
2448804.5, 27.0
2449169.5, 28.0
2449534.5, 29.0
2450083.5, 30.0
2450630.5, 31.0
2451179.5, 32.0
2453736.5, 33.0
2454832.5, 34.0
The first column of this data file is the Julian date, on the UTC time scale, at which the leap second
became valid. The second column is the leap second value, in seconds.
Note that this data is passed between the leap second MATLAB functions by way of a global statement.
The MATLAB function that actually reads and evaluates the current value of leap seconds has the
following syntax and single argument.
page 35
function leapsecond = findleap(jdate)
% input
% output
The leap seconds data file should be updated whenever the International Earth Rotation and Reference
Systems Service (IERS) announces a new leap second.
Time conversion
The fundamental time argument for the ephemeris function used in this MATLAB script is “ephemeris”
time. As implemented here, we assume this time argument to be Barycentric Dynamic Time (TDB). To
report the time of important trajectory events in Universal Coordinated Time (UTC) or civil time, we
need an algorithm to make this time conversion.
The following is the MATLAB source code for a function which iteratively performs this calculation
using Brent’s root-finding method.
% input
% output
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
global jdsaved
jdsaved = jdtdb;
% convergence tolerance
rtol = 1.0d-8;
x1 = jdsaved - 0.1;
x2 = jdsaved + 0.1;
page 36
[xroot, froot] = brent ('jdfunc', x1, x2, rtol);
jdutc = xroot;
end
This function calls the following MATLAB objective function during the calculations.
% input
% output
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
global jdsaved
tai_utc = findleap(jdin);
end
Notice that this function requires the findleap function which calculates the number of leap seconds
for the current UTC Julian date value. The jdfunc function is computing the difference between the
TDB Julian date input by the user and the value computed by the utc2tdb MATLAB function. The
algorithm has converged whenever this value is less than or equal to the user-defined tolerance rtol.
page 37
A Computer Program for Trans-Lunar Trajectory Optimization
This document is the user’s guide for a Windows-compatible computer program called tlto.exe that
can be used to design and optimize lunar missions from Earth park orbit to B-plane encounter at the
moon. The software assumes that trans-lunar injection (TLI) occurs impulsively from a circular Earth
park orbit. The B-plane coordinates and final orbital elements are expressed in a moon-centered
(selenocentric) mean lunar equator and IAU node of epoch coordinate system.
The first part of the software solves for the minimum TLI impulsive delta-v using a two-body Lambert
solution for the transfer trajectory from the Earth park orbit to the center of the moon. The second part
of the computer program implements a simple shooting method that attempts to minimize the impulsive
TLI delta-v while numerically integrating the spacecraft equations of motion and targeting to
components of the B-plane. In the shooting algorithm, the spacecraft motion model includes the Earth’s
non-spherical gravity effect and the point-mass perturbations of the sun and moon. The B-plane targets
are enforced using the combination of user-defined periapsis radius and orbital inclination of the arrival
hyperbola at the moon.
The program inputs and major computational steps implemented in this software are as follows:
Software Inputs
Step 2: Using output from Step 1 as initial conditions, optimize the numerically
integrated spacecraft motion problem with B-plane targets
Output
TLI delta-v vector and transfer time
Classical orbital elements of geocentric transfer trajectory
Selenocentric orbital elements of the encounter hyperbola
B-plane coordinates
This computer program was written and compiled using Intel Visual Fortran. The lunar coordinates
required by the software are computed using the JPL DE421 ephemeris.
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:
tlto tlto1.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 tlto *
* *
* trans-lunar trajectory *
* optimization *
* *
* April 22, 2013 *
************************************
At this point the user should input the name of a valid input file, including the filename extension.
To create a DOS command window in Windows 7, select start, then All Programs, then Accessories
and finally Command Prompt. The size, font and other characteristics of the screen can be controlled
by the user with the c:\ icon in the upper left corner of the window. To log into the subdirectory created
during the installation of the Fortran executable and support files, type root:\ and then cd subdirectory
from the DOS command line where root is the name of the root directory, usually c:, and subdirectory is
the name of the subdirectory created by the user.
The tlto computer program is “data-driven” by a simple text file created by the user. This section
describes a typical input data file. In the following discussion the actual input file contents are in
courier font and all explanations are in times italic font. 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.
The first five lines of any input file are reserved for user comments. These lines are ignored by the
software. However the input file must begin with five and only five initial text lines.
**************************************
* input file for program tlto
* tlto1.in – December 4, 2010
* polar lunar orbit at 100 km altitude
**************************************
page 2
The software allows the user to specify an initial guess for the TLI calendar date and lower and upper
bounds on the actual date found during both the two-body and numerically integrated TLI delta-v
optimization processes. For any guess for the TLI time tTLI and user-defined lower and upper bounds
tl and tu , the actual TLI time t is constrained as follows:
The first five inputs define the initial guesses for the TLI calendar date and the lower and upper bounds,
respectively. Be sure to include all four digits of the calendar year. The first set of bounds is used
during the two-body optimization, and the second set is used during the numerical integration and B-
plane targeting.
The TLI calendar date is a control variable in the NLP formulation and must always have a lower and
upper bound. For a fixed TLI calendar date, input small values (e.g., plus and minus 1.0e-8) for the
bounds.
initial guess for TLI calendar date (month, day, year)
9,15,2008
lower bound for TLI calendar date search (two-body optimization; hours)
0.0
upper bound for TLI calendar date search (two-body optimization; hours)
+24.0
lower bound for TLI calendar date search (integrated optimization; hours)
-12.0
upper bound for TLI calendar date search (integrated optimization; hours)
+12.0
The next input is the user’s initial guess for the TLI-to-B-plane transfer time, in hours.
initial guess for transfer time (hours)
110.0
The next two numbers define the fixed values for park orbit altitude and orbital inclination. The altitude
ius measured with respect to a spherical Earth model.
***********************************
circular park orbit characteristics
***********************************
altitude (kilometers)
185.32
This next integer input defines the type of TLI maneuver to perform. The software uses this indicator to
compute the park orbit RAAN.
type of TLI maneuver
(1 = ascending, 2 = descending)
2
This next integer input defines the type of targeting algorithm to use.
page 3
*****************************
type of final orbit targeting
-----------------------------
1 = periapsis radius and inclination
2 = user-defined b-plane coordinates
************************************
1
The next two inputs define the periapsis radius and orbital inclination to use during the numerically
integrated solution. These coordinates refer to the selenocentric hyperbola. The orbital inclination
should be specified in the mean lunar equator and IAU node of epoch coordinate system.
------------------------------------------
final lunar orbit characteristics
(mean lunar equator and IAU node of epoch)
------------------------------------------
For targeting option 2, the software allows the user to input B-plane targets directly using the following
two program inputs.
------------------------------------------
user-defined b-plane targets
(mean lunar equator and IAU node of epoch)
------------------------------------------
The next series of inputs define the types of perturbations to include during the numerical integration of
the spacecraft’s equations of motion. The first text input is the name of the Earth gravity model data file
to use. Items 2 and 3 allow the user to specify the order and degree (up to 70) of the Earth gravity
model in the equations of motion, and items 4 and 5 specify options to include the point mass gravity of
the moon and sun.
************************
trajectory perturbations
************************
page 4
The next two inputs are algorithm control parameters. The first input is the truncation error tolerance
for the Runge-Kutta-Felhberg integrator and determines how well the equations of orbital motion are
solved. The second input is the root-finding tolerance and it determines how accurately close approach
to the moon is predicted.
****************************
algorithm control parameters
****************************
root-finding tolerance
1.0d-8
The final two inputs specify the name of the solution disk file and the time step at which the data is
created and written to this file.
***************************
output file characteristics
***************************
The following is the solution created by the computer program for this example. The output is
organized by the following major sections:
First pass
Targeting pass
The first output section summarizes the optimized two-body Lambert solution. The solution is presented
in the Earth mean equator of J2000 coordinate system (EME2000). The trajectory characteristics are
given before and after the impulsive TLI maneuver. The event time is provided in both Universal
Coordinated Time (UTC) and Barycentric Dynamical Time (TDB).
page 5
======================================
two-body lunar trajectory optimization
======================================
descending transfer
page 6
deltav-x 2721.42782925067 meters/second
deltav-y -1391.40979772003 meters/second
deltav-z -679.977617407291 meters/second
The components of the unit thrust vector of the TLI impulsive maneuver are displayed in both the Earth-
centered-inertial (ECI) and radial, tangential and normal (RTN) coordinate systems.
This section of the program output is created after the B-plane targeting problem has been solved. It
includes a summary of the solution, the TLI delta-v vector and magnitude, the final B-plane coordinates
and the orbital elements and state vector of the incoming hyperbola.
=======================
optimal n-body solution
=======================
descending transfer
page 7
sma (km) eccentricity inclination (deg) argper (deg)
0.656345630000D+04 0.716042246482D-16 0.285000000000D+02 0.000000000000D+00
page 8
time and conditions at lunar closest approach
(selenocentric lunar mean equator & IAU node of epoch)
------------------------------------------------------
----------------------------------------------------
coordinates of the moon at closest approach
(geocentric Earth mean equator and equinox of J2000)
----------------------------------------------------
page 9
vx (kps) vy (kps) vz (kps) vmag (kps)
-.880138031538D+00 0.553045427398D+00 0.224951785729D+00 0.106353444008D+01
The tlto software suite also includes an interactive MATLAB script called lplot.m that can be used
to create three-dimensional geocentric and selenocentric graphics of the solution. The graphics data is
displayed at the user-defined step size provided in the input file. A plot step size of ten minutes is
recommended. However, for zoomed plots of either the geocentric or selenocentric trajectory, smaller
plot step sizes will create “smoother” trajectory displays.
Important note!!
You must delete the first or “header” line of the tlto solution file in order for the lplot script to work.
This script uses the MATLAB csvread function to read the data file which can only contain comma-
separated-variable (CSV) numerical data. The lplot script will also create color Postscript graphic
disk files with a TIFF preview using MATLAB statements similar to
print -depsc -tiff -r300 tlto1.eps
The following is a plot of the geocentric transfer trajectory for this example. Please note that the
coordinates are displayed in the units of Earth radii (ER). The asterisk symbol is the position of the
moon at the moment of trans-lunar injection and the park orbit trace is red. The interactive graphic
features of MATLAB will allow the user to rotate and “zoom” the displays in and out. These
capabilities allow the user to interactively find the “best” viewpoint as well as verify the basic orbital
geometry of the geocentric and selenocentric trajectories.
Geocentric Transfer Trajectory
50
40
30
Z coordinate (ER)
20
10
-10
-20
-30
0 -60
10
20 -40
30 -20
40
0
X coordinate (ER)
Y coordinate (ER)
page 10
This next plot is a “zoomed” display of the first plot closer to the Earth. The initial park orbit is
displayed in red, the transfer trajectory is blue, and an inertial, Earth-centered coordinate system is on
the plot. The x-axis of this system is red, the y-axis green and the z-axis blue. The location on the park
orbit at which TLI occurs is marked with a small dot symbol.
This plot illustrates the geocentric trajectory of the spacecraft in the vicinity of the moon. In this
display, the location of the spacecraft when it enters the sphere-of-influence of the moon is marked with
a blue asterisk. The spacecraft trajectory at closest approach to the moon is the small blue dot and the
location of the moon at closest approach is the green asterisk.
-10
page 11
The following is a plot of the selenocentric hyperbola within the moon’s sphere-of-influence. The
coordinate units are lunar radii (LR). The entry into the SOI is marked with an asterisk. In this
MATLAB script the radius of the moon’s SOI is “hardwired” to a value of 64,000 kilometers.
Selenocentric Trajectory
15
10
Z coordinate (MR)
-5
-10
-15
-20
20 -30
10 -20
0
-10
-10
-20 0
Y coordinate (MR)
X coordinate (MR)
The final plot is a “zoomed” display of the previous plot. This display is labeled with a selenocentric,
inertial coordinate system. The x-axis is red, the y-axis green and the z-axis blue. The small red dot is
periapsis of the approach hyperbola.
page 12
Verification of the solution
After the n-body optimization finishes, the software will verify the solution by numerically integrating
the equations of motion using a Runge-Kutta-Fehlberg 7(8) numerical method. The integration starts
with the position and velocity vector of the trans-lunar transfer orbit immediately after the TLI
impulsive maneuver and propagates to closest approach to the moon predicted by the software.
===================================
verification of the n-body solution
===================================
page 13
vx (kps) vy (kps) vz (kps) vmag (kps)
0.130967216081D+01 -.862213632161D+00 -.189576660132D+01 0.246020009815D+01
Technical discussion
This section provides additional details about the numerical algorithms used in this computer program.
The computational methods discussed here include solving the two body Lambert problem, the method
used for propagating the spacecraft’s geocentric trajectory, the algorithm used for targeting to the B-
plane, and the geocentric-to-selenocentric coordinate transformation.
y t
z
u t
consisting of the state variables y and the control variables u for any time t. In this discussion vectors
are denoted in bold.
The system dynamics are defined by a vector system of ordinary differential equations called the state
equations that can be represented as follows:
dy
y f y t , u t , p, t
dt
The initial dynamic variables at time t0 are defined by ψ0 ψ y t0 , u t0 , t0 and the terminal
conditions at the final time t f are defined by ψ f ψ y t f , u t f , t f . These conditions are called the
boundary values of the trajectory problem.
page 14
For any mission time t there are also simple bounds on the state variables
yl y t yu
the control variables
ul u t uu
pl p t pu
The basic nonlinear programming problem (NLP is to determine the control vector history and problem
parameters that minimize the scalar performance index or objective function given by
J y t0 , t0 , y t f , t f , p
During the two-body trajectory optimization, the control variables are the TLI calendar date and the true
anomaly of the TLI maneuver. For the numerical integration optimization, the control variables consist
of the TLI calendar date, the RAAN of the park orbit, the true anomaly of the TLI maneuver, and the
Cartesian components of the TLI delta-v vector.
For both types of optimization, the objective function or performance index is the scalar magnitude of
the TLI impulsive delta-v.
In addition to the bounds on the TLI calendar date mentioned earlier, the true anomaly during the two-
body optimization is bounded according to
180 180
During the second part of the trajectory optimization, the RAAN and true anomaly bounds are
TB 30 TB 30
TB 30 TB 30
where TB and TB are the RAAN and true anomaly found during the two-body optimization. The
bounds on the components of the TLI delta-v are given by
v 0.1 v v x , y ,z v 0.1 v
The final boundary conditions are the B-plane coordinates of the incoming selenocentric hyperbola.
page 15
Solving the two body Lambert problem
Lambert’s problem is concerned with the determination of an orbit that passes between two positions
within a specified time-of-flight. This classic astrodynamic problem is also known as the orbital two-
point boundary value problem (TPBVP).
The time to traverse a trajectory depends only upon the length of the semimajor axis a of the transfer
trajectory, the sum ri rf of the distances of the initial and final positions relative to a central body, and
the length c of the chord joining these two positions. This relationship can be stated as follows:
tof tof ri rf , c, a
a3
t t0 E e sin E
we can write
a3
t E E0 e sin E sin E0
where E is the eccentric anomaly associated with radius r, E0 is the eccentric anomaly at r0 , and t 0
when r r0 .
At this point we need to introduce the following trigonometric sun and difference identities:
a
sin sin 2sin cos
2 2
a
cos cos 2sin sin
2 2
a
cos cos 2 cos cos
2 2
If we let E and E0 and substitute the first trig identity into the second equation above, we have
the following equation:
a3 E E0 E E0
t E E0 2sin e cos
2 2
page 16
E E0
e cos cos
2 2
E E0
sin sin
2 2
a3
t 2sin cos
2 2
r a 1 e cos E
x a cos E e
y a sin E 1 e 2
r r0 c r r0 c s
cos 1 1 1
2a 2a 2a a
r r0 c r r0 c sc
sin 1 1 1
2a 2a 2a a
This part of the derivation makes use of the following three relationships:
r r0
cos cos 1
2 2 2
E E0 E E0
2
sin sin sin 1 e cos
2 2 2 2
x x0 y y0 c
2 2 2 2
sin sin
2 2 2a 2a 2a
s sc
sin sin
2 2a 2 2a
and several additional substitutions, we have the time-of-flight form of Lambert’s theorem
page 17
a3
t sin sin
A discussion about the angles and can be found in “Geometrical Interpretation of the Angles
and in Lambert’s Problem” by J. E. Prussing, AIAA Journal of Guidance and Control, Volume 2,
Number 5, Sept.-Oct. 1979, pages 442-443.
The algorithm used in this computer program is based on the method described in “A Procedure for the
Solution of Lambert’s Orbital Boundary-Value Problem” by R. H. Gooding, Celestial Mechanics and
Dynamical Astronomy 48: 145-165, 1990. This iterative solution is valid for elliptic, parabolic and
hyperbolic transfer orbits which may be either posigrade or retrograde, and involve one or more
revolutions about the central body.
The spacecraft’s orbital motion is modeled with respect to the Earth mean equator and equinox of J2000
(EME2000) coordinate system. The following figure illustrates the geometry of the EME2000
coordinate system. The origin of this Earth-centered-inertial (ECI) inertial coordinate system is the
geocenter and the fundamental plane is the Earth’s mean equator. The z-axis of this system is normal to
the Earth’s mean equator at epoch J2000, the x-axis is parallel to the vernal equinox of the Earth’s mean
orbit at epoch J2000, and the y-axis completes the right-handed coordinate system. The epoch J2000 is
the Julian Date 2451545.0 which corresponds to January 1, 2000, 12 hours Terrestrial Time (TT).
This part of the trajectory analysis implements a special perturbation technique which numerically
integrates the vector system of second-order, nonlinear differential equations of motion of a spacecraft
given by
a r , v , t r r , r , t ag r am r , t as r , t
page 18
where
t dynamical time
r inertial position vector of the spacecraft
v inertial velocity vector of the spacecraft
a g acceleration due to the Earth's gravity
am acceleration due to the Moon
as acceleration due to the Sun
This computer program uses a spherical harmonic representation of the Earth’s geopotential function
given by
n R
n n
R
r, , Cn0 Pn0 u Pnm u Snm sin m Cnm cos m
r r n 1 r r n 1 m1 r
where is the geocentric latitude of the spacecraft, is the geocentric east longitude of the spacecraft
and r r x 2 y 2 z 2 is the geocentric distance of the spacecraft. In this expression the S’s and C’s
are unnormalized harmonic coefficients of the geopotential, and the P’s are associated Legendre
polynomials of degree n and order m with argument u sin .
The software calculates the spacecraft’s acceleration due to the Earth’s gravity field with a vector
equation derived from the gradient of the potential function expressed as
a g r, t r, t
This acceleration vector is a combination of pure two-body or point mass gravity acceleration and the
gravitational acceleration due to higher order nonspherical terms in the Earth’s geopotential. In terms of
the Earth’s geopotential , the inertial rectangular cartesian components of the spacecraft’s acceleration
vector are as follows:
1 z 1
x x 2 y
r r r 2 x 2 y 2 x y 2
1 z 1
y y 2 x
r r r x y
2 2 2
x y 2
1 x2 y2
z z
r r r 2
The three partial derivatives of the geopotential with respect to r, , are given by
1 N R
n
r r r n 2 r m 0
N R
n n
r n 2 r
C
m 0
m
n cos m Snm sin m Pnm1 sin m tan Pnm sin
page 19
N R
n n
r n 2 r
mS
m 0
m
n cos m Cnm sin m Pnm sin
where
R radius of the Earth
r geocentric distance of the spacecraft
Snm , Cnm harmonic coefficients
geocentric latitude of the spacecraft sin 1 z r
longitude of the spacecraft g
right ascension of the spacecraft tan 1 y x
g right ascension of Greenwich
Right ascension is measure positive east of the vernal equinox, longitude is measured positive east of
Greenwich, and latitude is positive above the Earth’s equator and negative below.
For m 0 , the coefficients are called zonal terms, when m n the coefficients are sectorial terms, and
for n m 0 the coefficients are called tesseral terms.
The Legendre polynomials with argument sin are computed using recursion relationships given by:
1
Pn0 sin 2n 1 sin Pn01 sin n 1 Pn02 sin
n
Pnn sin 2n 1 cos Pnn11 sin , m 0, m n
and Pi j 0 for j i .
page 20
r r
am r , t m mb 3 em 3
r rem
m b
where
m gravitational constant of the moon
rmb position vector from the moon to the satellite
rem position vector from the Earth to the moon
r r
a s r , t s s b 3 e s 3
r res
s b
where
s gravitational constant of the sun
rs b position vector from the sun to the satellite
re s position vector from the Earth to the sun
3 3qk qk2
f qk qk 3
1 1 qk
where
r T r 2sk
qk
sTk sk
n
k
r r f qk s k
k 1 d k3
In these equations, s k is the vector from the primary body to the secondary body, k is the gravitational
constant of the secondary body and dk r sk , where r is the position vector of the spacecraft relative
to the primary body. The derivation of the f q functions is described in Section 8.4 of “An
Introduction to the Mathematics and Methods of Astrodynamics, Revised Edition”, by Richard H.
Battin, AIAA Education Series, 1999.
In this computer program the heliocentric coordinates of the sun and moon are based on the JPL
Development Ephemeris DE421. These coordinates are provided in the Earth mean equator and
equinox of J2000 coordinate system (EME2000). The name of this binary date file is de421.bin, and
it must reside in the same directory as the tlto.exe computer program.
page 21
Park orbit RAAN
For a given TLI injection time, there are two possible locations on the initial park orbit at which to
perform the propulsive maneuver. One opportunity occurs during the ascending part of the park orbit
and the other during the descending motion. The park orbit RAAN p at these two locations can be
determined from spherical trigonometry relationships involving the park orbit inclination and the right
ascension and declination of the moon at encounter.
where
m right ascension of the moon at encounter
m declination of the moon at encounter
i p park orbit inclination
B-plane targeting
The derivation of B-plane coordinates is described in the classic JPL reports, “A Method of Describing
Miss Distances for Lunar and Interplanetary Trajectories” and “Some Orbital Elements Useful in Space
Trajectory Calculations”, both by William Kizner. The following diagram illustrates the fundamental
geometry of the B-plane coordinate system.
page 22
The software solves the B-plane targeting problem by minimizing the delta-v vector at the TLI while
satisfying two nonlinear equality constraint equations. These constraint equations are the differences
between components of the required B-plane and the B-plane components predicted by the software.
Given the user-defined closest approach radius rca and orbital inclination i, and the incoming v-infinity
magnitude v and the right ascension and declination of the incoming asymptote vector at the
moment of closest approach, the following series of equations can be used to determine the required B-
plane target components:
B T bt cos
B R bt sin
where
2 rca 2
bt 2
rca2 rca 1
v rca v2
and
cos i
cos sin 1 cos2 tan 1 sin ,cos
cos
sin sˆ zˆ sx2 s 2y
zˆ 0 0 1
T
cos cos
Sˆ cos sin
sin
where and are the declination and right ascension of the asymptote of the incoming hyperbola.
Important note!!
This technique only works for lunar orbit inclinations that satisfy
i
If this inequality is not satisfied, the software will print the following error message
b-plane targeting error!!
|inclination| must be > |asymptote declination|
page 23
It will also display the actual declination of the asymptote and stop. The user should then edit the input
file, include a valid orbital inclination and restart the simulation.
The following computational steps summarize the calculation of the predicted B-plane vector from a
moon-centered position vector r and velocity vector v at closest approach.
radius rate r r v r
semiparameter p h2
r
semimajor axis a
r v2
2
orbital eccentricity e 1 p a
pr rh
true anomaly cos sin tan 1 sin ,cos
er e
B-plane magnitude B pa
fundamental vectors
r v rr
zˆ pˆ cos rˆ sin zˆ qˆ sin rˆ cos zˆ
h
a b
S vector S pˆ qˆ
a b2 2
a b2
2
b2 ab
B vector B pˆ qˆ
a b
2 2
a b2
2
S , S ,0
2 2 T
T
y x
T vector
S x2 S y2
For this targeting option, the equality constraints enforced by the nonlinear programming algorithm are
page 24
rp rca 0
cos i hˆ z 0
where rp and i are the user-defined periapsis radius and selenocentric orbital inclination, respectively.
In the second equation hˆ is the z-component of the spacecraft’s unit angular momentum vector at
z
closest approach to the moon.
For both types of targeting techniques, closest approach is determined during the numerical integration
of the spacecraft equations of motion by finding the time since TLI at which the selenocentric flight path
angle is zero. This mission constraint is computed as follows
rv
sin 0
r v
where r and v are the spacecraft’s moon-centered position and velocity vectors, respectively.
This section describes the transformation of coordinates between the Earth mean equator and equinox
2000 (EME2000) and lunar mean equator and IAU node of epoch coordinate systems. This
transformation is used to compute the B-plane coordinates at encounter.
The following diagram illustrates the orientation of the lunar mean equator and IAU node of epoch
coordinate frame.
A unit vector in the direction of the pole of the moon can be determined from
page 25
cos p cos p
pˆ Moon sin p cos p
sin p
where p and p are the right ascension and declination of the lunar pole.
The right ascension and declination of the lunar pole in the EME2000 coordinate system are given by
the following expressions
where T is the time in Julian centuries given by T JD 2451545.0 / 36525 and JD is the Dynamical
Barycentric Time (TDB) Julian Date.
E1 125.045 0.0529921d
E 2 250.089 0.1059842d
E 3 260.008 13.0120009d
E 4 176.625 13.3407154d
E 6 311.589 26.4057084d
E 7 134.963 13.0649930d
E10 15.134 0.1589763d
E13 25.053 12.9590088d
where d JD 2451545 is the number of days since January 1.5, 2000. These equations are given in
“Report of the IAU Working Group on Cartographic Coordinates and Rotational Elements: 2009”,
Celestial Mechanics and Dynamical Astronomy, 109: 101-135, 2011.
The unit vector in the x-axis direction of this selenocentric coordinate system is given by
xˆ zˆ pˆ Moon
where zˆ 0 0 1 . The unit vector in the y-axis direction can be determined using
T
page 26
yˆ pˆ Moon xˆ
Finally, the components of the matrix that transforms coordinates from the EME2000 system to the
moon-centered (selenocentric) mean equator and IAU node of epoch system are as follows:
M xˆ yˆ pˆ Moon
T
Time systems
This section is a brief explanation of the time scales used in this computer program.
Coordinated Universal Time (UTC) is the time scale available from broadcast time signals. It is a
compromise between the highly stable atomic time and the irregular earth rotation. UTC is the
international basis of civil and scientific time.
Terrestrial Time, TT
Terrestrial Time is the time scale that would be kept by an ideal clock on the geoid - approximately, sea
level on the surface of the Earth. Since its unit of time is the SI (atomic) second, TT is independent of
the variable rotation of the Earth. TT is meant to be a smooth and continuous “coordinate” time scale
independent of Earth rotation. In practice TT is derived from International Atomic Time (TAI), a time
scale kept by real clocks on the Earth's surface, by the relation TT = TAI + 32s.184. It is the time scale
now used for the precise calculation of future astronomical events observable from Earth.
page 27
TDB TT 0.001657sin 628.3076T 6.2401
0.000022sin 575.3385T 4.2970
0.000014sin 1256.6152T 6.1969
0.000005sin 606.9777T 4.0212
0.000005sin 52.9691T 0.4444
0.000002sin 21.3299T 5.5431
0.000010T sin 628.3076T 4.2490
In this equation, the coefficients are in seconds, the angular arguments are in radians, and T is the
number of Julian centuries of TT from J2000; T = (Julian Date(TT) – 2451545.0) / 36525.
page 28
Algorithm resources
“Circumlunar Trajectory Calculations”, MIT Instrumentation Laboratory Report R-353, April 1962.
“Optimal Low Thrust Trajectories to the Moon”, John T. Betts and Sven O. Erb, SIAM Journal on
Applied Dynamical Systems, Vol. 2, No. 2, pp. 144-170, 2003.
“Integrated Algorithm for Lunar Transfer Trajectories Using a Pseudostate Technique”, R. V. Ramanan,
AIAA Journal of Guidance, Control and Dynamics, Vol. 25, No. 5, September-October 2002, pp. 946-
952.
“Nonimpact Lunar Transfer Trajectories Using the Pseudostate Technique”, R. V. Ramanan and V.
Adimurthy, AIAA Journal of Guidance, Control and Dynamics, Vol. 28, No. 2, March-April 2005, pp.
217-225.
“Injection Conditions for Lunar Trajectories”, R. Kolenkiewicz and W. Putney, NASA TM X-55390,
November 1965.
“Coplanar Three-Body Trans-Earth Lunar Trajectory Simulation Methodology”, H. Ikawa, AIAA 88-
0381, AIAA 26th Aerospace Sciences Meeting, Reno, Nevada, January 11-14, 1988.
“Lunar Constants and Models Document”, JPL D-32296, September 23, 2005.
page 29
APPENDIX A
Contents of the Simulation Summary and CSV Files
This appendix is a brief summary of the information contained in the simulation summary screen
displays and the CSV data files produced by the tlto software.
transfer time = total time from the TLI maneuver to closest approach at the moon
arglat (deg) = argument of latitude in degrees. The argument of latitude is the sum of
true anomaly and argument of perigee.
vmag (km/sec) = scalar magnitude of the spacecraft’s velocity vector in kilometers per
second
page 30
theta = orientation of the b-plane vector
page 31
ecc-geo = geocentric orbital eccentricity of the spacecraft(non-dimensional)
raan-geo (deg) = geocentric right ascension of the ascending node of the spacecraft in
degrees
raan-sel (deg) = selocentric right ascension of the ascending node of the spacecraft in
degrees
The geocentric coordinates of the spacecraft and the TLI delta-v components are with respect to the
Earth mean equator and equinox of J2000 (EME2000) coordinate system. The selenocentric coordinates
are with respect to the mean lunar equator and IAU node of epoch coordinate system.
page 32
Program tlto_ocs
Finite-burn Trans-lunar Trajectory Optimization
This document is the user’s manual for a Fortran computer program called tlto_ocs that uses the
Sparse Optimization Suite distributed by Applied Mathematical Analysis to solve the classic finite-burn,
trans-lunar injection (TLI) trajectory optimization problem. The software attempts to maximize the
spacecraft mass at the end of the TLI propulsive maneuver while targeting to a user-defined periapsis
radius and orbital inclination relative to the moon. Since the TLI is a continuous thrust maneuver,
maximizing the spacecraft mass is equivalent to minimizing the propellant required.
single, continuous thrust propulsive maneuver followed by a coast to lunar close approach
combination of modified equinoctial and cartesian equations of motion
valid for circular and elliptical park orbits
Earth J 2 gravity model and sun and moon point-mass gravity
JPL DE421 lunar and solar ephemeris
B-plane coordinates at lunar close approach
The Sparse Optimization Suite is a direct transcription method that can be used to solve a variety of
trajectory optimization problems using the following combination of numerical methods:
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 tlto_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. The tlto_ocs 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:
tlto_ocs tlto1.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 tlto_ocs *
* *
* finite-burn lunar trajectory *
* optimization *
* *
* March 17, 2011 *
************************************
The user should respond to this prompt with the name of a compatible input data file including the
filename extension.
The tlto_ocs computer program is “data-driven” by a simple user-created text file. The following is a
typical input or “simulation definition” file used by the software. In this discussion the actual input file
contents are in courier font and all explanations are in times italic font. 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. Please note that the fundamental time argument in this simulation is Barycentric Dynamical
Time (TDB) which is the time argument of the DE421 ephemeris. Furthermore, the fundamental
coordinate system is the Earth mean equator and equinox of J2000 (EME2000).
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.
*************************************************
** finite-burn translunar trajectory optimization
** two phase, 3-body geocentric motion
** input file for tlto_ocs
** tlto1.in – August 7, 2012
*************************************************
The software allows the user to specify an initial guess for the calendar date and time of the TLI
maneuver and lower and upper bounds on the actual date found during the optimization process. For
any guess for maneuver time tTLI and user-defined lower and upper bounds tl and tu , the TLI
maneuver time t is constrained as follows:
page 2
tTLI tl t tTLI tu
For a fixed maneuver time, the lower and upper bounds should be set to zero.
The user inputs for the initial calendar date, TDB time, and search boundary are as follows:
initial calendar date (month, day, year)
10, 13, 2008
The next three inputs define the initial spacecraft mass, the thrust magnitude and specific impulse of the
propulsion system, respectively.
initial spacecraft mass (kilograms)
1000.0
The type of propulsion initial guess is determined by the next integer input.
********************************
type of propulsive initial guess
********************************
1 = thrust duration
2 = delta-v
-------------------
2
For option 1, the next input is the user’s initial guess for the magnitude of the maneuver delta-v.
initial guess for delta-v (meters/second)
3150.0
For option 2, the next three inputs are the user’s initial guess for the thrust duration and lower and
upper bounds for this duration.
initial guess for thrust duration (seconds)
3000.0
The next series of inputs define the characteristics of the initial park orbit. The angular orbital elements
should be with respect to the EME2000 system.
page 3
******************
initial park orbit
******************
This next integer input allows the user to define the type of initial park orbit constraints to use during
the simulation. Option 1 will constrain all elements of the park orbit except the true longitude to the
values input by the user. Option 2 will constrain the semimajor axis, eccentricity and orbital
inclination. The RAAN and true longitude will be bounded.
*****************************
park orbit constraint options
*****************************
1 = constrain all initial orbital elements except true longitude
2 = constrained a, e, i; bounded raan & true longitude
------------------------------------------------------
2
The next set of inputs defines the user’s initial guess for the lunar transfer time, along with a lower and
upper bound for the transfer time. The transfer time here refers to the time from burnout of the
propulsive maneuver to the entrance to the lunar sphere-of-influence (SOI).
transfer time initial guess (hours)
96.0
The next two inputs define the periapsis radius and orbital inclination of the lunar trajectory relative to
the moon. The inclination should be specified relative to the mean lunar equator.
------------------------------------------
final lunar orbit characteristics
(lunar mean equator and IAU node of epoch)
------------------------------------------
page 4
The next three inputs define the types of perturbations to include during the numerical solution of the
spacecraft’s equations of motion. The solar and lunar perturbations are modeled as point-mass bodies.
************************
trajectory perturbations
************************
The next program input is the user-defined radius of the lunar sphere-of-influence (SOI) used by the
software during the trajectory optimization. Typical values for this parameter are between 64,000 and
20,000 kilometers.
------------------------------------------------
radius of lunar sphere-of-influence (kilometers)
------------------------------------------------
25000.0
This next input defines the type of initial guess to use. Please see the technical discussion section for
information about how the first option is modeled. Option 2 requires either a binary restart file created
from a previous run using either initial guess option 1 or an updated binary restart file. This feature is
described in the next two sections.
********************************
* initial guess/restart option *
********************************
1 = numerical integration
2 = binary data file
---------------------
1
If the user elects to use a binary data file (option 2 above) for the initial guess, the following text input
specifies the name of the file to use.
name of initial guess/restart input data file
tlto1.rsbin
The following input can be used to create or update an initial guess binary file. The creation or update
process uses the filename defined above. For initial guess option 1, the software will create a binary
restart file. For initial guess option 2, an input of yes to this item will update the binary file used to
initialize the simulation.
******************************
* binary restart file option *
******************************
This next input specifies the type of comma-delimited or comma-separated-variable (CSV) solution data
file to create. Option 1 will create a solution file at each collocation point or node determined by the
page 5
Sparse Optimization Suite. Options 2 and 3 allow the user to specify either the number of nodes or time
step size used to create the data file.
**********************************************
* 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
The name of the solution data file is defined in this next line. Please consult Appendix A for a
description of the information written to this file.
name of solution output file
tlto1.csv
The next series of program inputs are algorithm control options and parameters for the Sparse
Optimization Suite. 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.
********************************
* algorithm control parameters *
********************************
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
propulsive maneuver (phase 1) and the lunar coast phase (phase 2).
number of grid points in phase 1 (TLI thrust maneuver)
10
The next input defines the relative error in the objective function. A value of 1.0d-5 is recommended.
relative error in the objective function (performance index)
1.0d-5
The next input defines the relative error in the solution of the differential equations. A value of 1.0d-7 is
recommended.
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.
page 6
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
50000
The next input is an integer that defines the maximum number of algorithm iterations.
maximum number of algorithm iterations
5000
The level of output from the NLP algorithm is controlled with the following integer input. Additional
information about these algorithm items can be found in the Sparse Optimization Suite user’s manual.
***************************
sparse NLP iteration output
---------------------------
1 = none
2 = terse
3 = standard
4 = interpretive
5 = diagnostic
---------------
1
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.
****************************
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
-------------------
page 7
input no to ignore
------------------
a0b0c0d0e0f0g0h0i0j2k0l0m0n0o0p0q0r0
The last series of inputs allow the reading and writing of configuration input files. The user should
create a configuration file before attempting to read one. These configuration files are simple text files
which can be edited external to the tlto_ocs software. Please consult Appendix E.
***************************************
* optimal control configuration options
***************************************
The following is the program output created by the tlto_ocs scientific simulation for this example.
This display summarizes the characteristics of the optimized TLI maneuver and the orbital transfer
conditions before and after the propulsive maneuver. It also displays the conditions at the lunar SOI, the
closest approach to the moon, and the corresponding B-plane characteristics. The delta-v magnitude is
determined from a cubic spline integration of the thrust acceleration evaluated at the grid points
determined by the Sparse Optimization Suite.
----------------
program tlto_ocs
----------------
------------------------------------------------------
park orbit initial conditions
(geocentric - Earth mean equator and equinox of J2000)
------------------------------------------------------
page 8
rx (km) ry (km) rz (km) rmag (km)
-.475930402705D+04 -.337158742648D+04 -.300978517350D+04 0.656333630000D+04
------------------------------------------------------
time and conditions at end of TLI finite burn
(geocentric - Earth mean equator and equinox of J2000)
------------------------------------------------------
------------------------------------------------------
time and conditions at beginning of trans-lunar coast
(geocentric - Earth mean equator and equinox of J2000)
------------------------------------------------------
------------------------------------------------------
time and conditions at lunar sphere-of-influence
(geocentric - Earth mean equator and equinox of J2000)
------------------------------------------------------
page 9
calendar date October 16, 2008
------------------------------------------------------
time and conditions at lunar sphere-of-influence
(selenocentric lunar mean equator & IAU node of epoch)
------------------------------------------------------
------------------------------------------------------
time and conditions at lunar closest approach
(selenocentric lunar mean equator & IAU node of epoch)
------------------------------------------------------
page 10
------------------------------------------------------
b-plane coordinates of incoming hyperbola
(selenocentric lunar mean equator & IAU node of epoch)
------------------------------------------------------
------------------------------------------------------
coordinates of the moon at closest approach
(geocentric - Earth mean equator and equinox of J2000)
------------------------------------------------------
The following plots illustrate the behavior of the pitch, yaw, right ascension and declination angles
during the propulsive maneuver.
page 11
These next two plots illustrate the behavior of the individual components of the RTN and ECI unit thrust
vector during the maneuver.
The final two plots display the orbital evolution of the semimajor axis, eccentricity, RAAN and orbital
inclination during the propulsive maneuver.
page 12
The tlto_ocs software will create three comma-separated-variable (csv) output files. The first file is
named parkorb.csv and contains the geocentric, EME 2000 state vector of the park orbit prior to the
orbital maneuver. The second file contains the state vectors and orbital elements of the geocentric
transfer orbit with the name specified by the user in the main input data file. The third file is named
soiorb.csv and contains the state vector of the selenocentric orbit at the lunar sphere-of-influence.
This software package also includes a MATLAB script called lplot.m that can be used to create
trajectory graphic displays using these three data files. The interactive graphic features of MATLAB
allow the user to rotate and zoom the displays. These capabilities allow the user to interactively find the
best viewpoint as well as verify basic orbital geometry of the geocentric and selenocentric trajectories.
The lplot MATLAB script will also create two color encapsulated postscript (eps) files (with TIFF
preview) of the screen images and save them to disk with the names tlto_ocs1.eps and
tlto_ocs2.eps. These file names can be changed by editing the lplot script. The user can also
change the perspective by editing the view command on lines 273 and 363 of the script. The lplot
script and support functions were created with version 7.10 of MATLAB.
Important note!!
You must delete the first or “header” line of the user-defined solution file in order for the lplot script
to work properly. This script uses the MATLAB csvread function to read the data file which can only
contain comma-separated-variable numerical data.
The following is the transfer trajectory from burnout of the TLI maneuver to the lunar SOI for this
example. The park orbit trajectory is red, the lunar transfer is blue and the moon’s orbit is green. The
location of the moon at the time of the TLI maneuver is marked with a green asterisk. The coordinates
are in the units of Earth radius (ER). This display is also labeled with a geocentric, inertial coordinate
system. The x-axis of this system is red, the y-axis is green and the z-axis is blue.
page 13
The following is a “zoomed” plot of the park orbit and initial portion of the lunar transfer trajectory.
The following is a plot of the selenocentric hyperbola within the user-defined lunar sphere-of-influence
(SOI). The coordinate units are lunar radii (MR). The entry into the SOI is marked with an asterisk and
the location of the periapsis or lunar closest approach is marked with a red dot. This display is labeled
with a selenocentric, inertial coordinate system (lunar mean equator and IAU node of epoch). The x-
axis is red, the y-axis is green and the z-axis is blue.
page 14
Verification of the Optimal Control Solution
The optimal control solution determined by the software can be verified by numerically integrating the
orbital equations of motion with the computed initial park orbit conditions and the optimal control
solution. This is equivalent to solving an initial value problem (IVP) that uses the optimal unit thrust
vector solution. This part of the tlto_ocs computer program uses a Runge-Kutta-Fehlberg 7(8)
variable step size method to integrate the orbital equations of motion.
The following is the program output of the final solution computed using this explicit numerical
integration method.
========================================
verification of optimal control solution
========================================
------------------------------------------------------
time and conditions at end of TLI finite burn
(geocentric - Earth mean equator and equinox of J2000)
------------------------------------------------------
page 15
raan (deg) true anomaly (deg) arglat (deg) period (hrs)
0.287146402598D+03 0.184559496421D+02 0.321620525978D+03 0.226432269197D+03
------------------------------------------------------
time and conditions at lunar sphere-of-influence
(selenocentric lunar mean equator & IAU node of epoch)
------------------------------------------------------
------------------------------------------------------
time and conditions at lunar closest approach
(selenocentric lunar mean equator & IAU node of epoch)
------------------------------------------------------
page 16
------------------------------------------------------
b-plane coordinates of incoming hyperbola
(selenocentric lunar mean equator & IAU node of epoch)
------------------------------------------------------
This section describes the algorithms used in tlto_ocs to create an initial guess for the software. The
software 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.
The software allows the user to input either a delta-v magnitude or thrust duration initial guess. For a
delta-v initial guess, the software estimates the thrust duration using the rocket equation. The user
should also provide lower and upper bounds for the total thrust duration. These three inputs should be in
units of seconds.
For trans-lunar injection from circular and near-circular orbits, the delta-v magnitude can be estimated
from A Computer Program for Preliminary Trans-Lunar Mission Analysis described in Appendix D.
This algorithm calculates the impulsive delta-v required to perform the TLI maneuver. The lguess
computer program described in Appendix D will also provide a park orbit right ascension of the
ascending node (RAAN) and the park orbit true anomaly at the TLI impulse.
For the numerical integration initial guess option, the software models the maneuver using tangential
thrusting. For this case, the unit thrust vector in the modified equinoctial frame at all times is simply
uT 0 1 0 . Please note that this type of steering method creates a coplanar initial guess that
T
An estimate of the thrust duration can be determined from the following expression:
I sp m p g m pVex
td
F F
The propellant mass required for a given V is a function of the initial mass of the spacecraft and the
exhaust velocity as follows:
V
m p mi 1 e Vex
page 17
In these equations
mi initial mass
m p propellant mass
Vex exhaust velocity g I sp
I sp specific impulse
V impulsive velocity increment
F thrust
g acceleration of gravity
Since a finite burn maneuver will require a thrust duration longer than this impulsive estimate, the user
can increase this value by about 10% and use it for the initial guess required by tlto_ocs.
The initial guess for the Sparse Optimization Suite is created by numerically integrating the modified
equinoctial equations of motion for the user-defined initial guess or rocket equation calculation for the
orbital maneuver time.
Binary restart data files can also be used to initialize a tlto_ocs simulation. A typical scenario is
This techniques works well provided the two simulations are not dramatically different. Sometimes it is
necessary to make successive small changes in the mission definition and run multiples simulations to
eventually reach the final desired solution.
Problem Setup
This section describes several methods that can be used to create an initial guess for tlto_ocs. The
Sparse Optimization Suite attempts to obtain problem feasibility before trying to solve the optimal
control problem. If the optimal control algorithm cannot find a feasible solution, the software will print
warnings and the user will have to provide a better initial guess.
The software allows the user to select one of the following initial orbit constraint options:
1) constrain all initial orbital elements except the true longitude
2) constrain semimajor axis, eccentricity and inclination; bounded RAAN and true longitude
page 18
i
h 2 k 2 tan
2
where i is the user-defined park orbit inclination. Furthermore, the semiparameter is constrained to the
initial value according to
pL pU pi
If the park orbit is circular, the software enforces the following two constraints:
f 0 g 0
f 2 g2 e
For program option 1, both lower and upper bounds for the h and k modified equinoctial elements are set
equal to the initial elements as follows:
hL hU hi
k L kU ki
360 Li 360
and for option 2, the RAAN of the initial park orbit is bounded according to
i 30 i 30
The spacecraft mass at the initial time is constrained to the user-defined initial value.
In optimal control terminology, these constraints or boundary conditions are called point functions.
The objective function or performance index J for this simulation is the mass of the spacecraft at
burnout of the lunar injection stage. This is simply
J mf
page 19
The value of the maxmin indicator in the code tells the software whether the user is minimizing or
maximizing the performance index. Since this simulation involves a single continuous maneuver, this is
equivalent to minimizing the required propellant mass.
During the TLI propulsive maneuver, the scalar magnitude of the components of the unit thrust vector at
any time during the maneuver is constrained as follows:
At the user-defined sphere-of-influence of the Moon, the point function enforced by the software is
given by
rSOI p rSOI 0
where rSOI p is the predicted SOI radius and rSOI is the scalar value defined by the user.
For user-defined periapsis radius and orbital inclination targets at the moon, the following point
functions or equality constraints are enforced
rp rca 0
cos i hˆ z 0
where rp and i are the user-defined periapsis radius and selenocentric orbital inclination of the encounter
hyperbola, respectively. In the second equation, hˆ z is the z-component of the predicted unit angular
momentum vector. These orbital elements are determined from the spacecraft’s state vector at closest
approach to the moon. The orbital inclination point function is expressed in the lunar mean equator and
IAU node of epoch coordinate system.
The elapsed time from the lunar SOI until closest approach to the moon is determined by an algorithm
that includes Brent’s one-dimensional root-finder embedded within a Runge-Kutta-Fehlberg 7(8)
numerical integration method. This technique searches for the time at which the selenocentric flight
path angle of the spacecraft is zero. This mission constraint is computed as follows
r v
sin 1
r v
where r and v are the selenocentric position and velocity vectors, respectively.
page 20
The RKF78 method numerically solves the following system of six first-order, nonlinear differential
equations of orbital motion
y1 vx y2 v y y2 vz
rx 3 J 2m reqm 5rz2
2
y4 m 3 1 1 2 a s x aex
r 2 r 2 r
ry 3 J 2m req2 m 5rz2
y5 m 3 1 1 2 a s y ae y
r 2 r 2 r
rz 3 J 2m reqm 5rz2
2
y6 m 3 1 3 2 a s z a ez
r 2 r 2 r
In these equations, m and reqm are the gravitational constant and equatorial radius of the moon,
respectively and J 2m is the non-dimensional oblateness gravity coefficient. The coefficient used by this
computer program corresponds to the GLGM-1 value of 2.037448533865259d-4. The additional
terms in the equations of motion, asx , as y , asz and aex , aey , aez represent the EME2000 ECI components of
the point-mass gravitational acceleration due to the sun and Earth, respectively.
Technical Discussion
This section summarizes the algorithms implemented in the tlto_ocs software. It includes a summary
of the equations of motion used during the TLI propulsive maneuver phase and the geocentric coast to
lunar encounter phase.
The spacecraft’s orbital motion is modeled with respect to the Earth mean equator and equinox of J2000
(EME2000) coordinate system. The following figure illustrates the geometry of the EME2000
coordinate system. The origin of this Earth-centered-inertial (ECI) inertial coordinate system is the
geocenter and the fundamental plane is the Earth’s mean equator. The z-axis of this system is normal to
the Earth’s mean equator at epoch J2000, the x-axis is parallel to the vernal equinox of the Earth’s mean
orbit at epoch J2000, and the y-axis completes the right-handed coordinate system. The epoch J2000 is
the Julian Date 2451545.0 which corresponds to January 1, 2000, 12 hours Terrestrial Time (TT).
Terrestrial Time (TT) is the time scale that would be kept by an ideal clock on the geoid -
approximately, sea level on the surface of the Earth. Since its unit of time is the SI (atomic) second, TT
is independent of the variable rotation of the Earth. TT is meant to be a smooth and continuous
“coordinate” time scale independent of Earth rotation. In practice TT is derived from International
Atomic Time (TAI), a time scale kept by real clocks on the Earth's surface
Barycentric Dynamical Time (TDB) is the time scale that would be kept by an ideal clock, free of
gravitational fields, co-moving with the solar system barycenter. It is always within 2 milliseconds of
TT, the difference caused by relativistic effects. TDB is the time scale now used for investigations of
the dynamics of solar system bodies.
page 21
Modified equinoctial equations of motion (phase 1 – TLI propulsive maneuver)
The modified equinoctial orbital elements are a set of orbital elements that are useful for trajectory
analysis and optimization. They are valid for circular, elliptic, and hyperbolic orbits. These equations
exhibit no singularity for zero eccentricity and orbital inclinations equal to 0 and 90 degrees. However,
two components of the orbital element set are singular for an orbital inclination of 180 degrees.
The relationship between direct modified equinoctial and classical orbital elements is defined by the
following definitions
p a 1 e2 f e cos
k tan i 2 sin L
where
p semiparameter
a semimajor axis
e orbital eccentricity
i orbital inclination
argument of periapsis
right ascension of the ascending node
true anomaly
L true longitude
page 22
The relationship between classical and modified equinoctial orbital elements is:
p
semimajor axis a
1 f 2 g2
orbital eccentricity e f 2 g2
The mathematical relationships between an inertial state vector and the corresponding modified
equinoctial elements are summarized as follows:
position vector
r
s 2 cos L cos L 2hk sin L
2
r 2 sin L sin L 2hk cos L
r 2
s
2r
h sin L k cos L
s2
velocity vector
1
2 sin L 2 sin L 2hk cos L g 2 f h k 2 g
s p
1
v 2 cos L 2
cos L 2 hk sin L f 2 gh k 2
f
s p
2
h cos L k sin L f h gk
s2 p
where
2 h2 k 2 s2 1 h2 k 2
p
r w 1 f cos L g sin L
w
page 23
The system of first-order modified equinoctial equations of orbital motion are given by
dp 2 p p
p t
dt w
df p g
f r sin L w 1 cos L f t h sin L k cos L n
dt w w
dg p f n
g r cos L w 1 sin L g t h sin L k cos L
dt w w
dh p s2n
h cos L
dt 2w
dk p s 2n
k sin L
dt 2w
2
dL w 1 p
L p h sin L k cos L n
dt p w
where r , t , n are non-two-body perturbations in the radial, tangential and normal directions,
respectively. For a lunar spacecraft, the radial direction is along the geocentric radius vector of the
spacecraft measured positive in a direction away from the gravitational center, the tangential direction is
perpendicular to this radius vector measured positive in the direction of orbital motion, and the normal
direction is positive along the angular momentum vector of the spacecraft’s orbit.
The equations of orbital motion can also be expressed in vector form as follows:
dy
y A y P b
dt
where
T
w
2
b 0 0 0 0 0 p
p
and
page 24
2p p
0 0
w
w 1 cos L f
p p 1 p g
sin L h sin L k cos L
w w
w 1 sin L g
p p 1 p f
cos L h sin L k cos L
w w
A
2
0 0
p s cos L
2w
p s 2 sin L
0 0
2w
p 1
0 0 h sin L k cos L
w
P r ˆi r t ˆit n ˆin
where ˆir , ˆit and ˆin are unit vectors in the radial, tangential and normal directions. These unit vectors can
be computed from the inertial position vector r and velocity vector v according to
ˆi r ˆi r v ˆi ˆi ˆi r v r
rv rv r
r n t n r
r
For unperturbed two-body motion, P 0 and the first five equations of motion are simply
p f g h k 0 . Therefore, for two-body motion these modified equinoctial orbital elements are
constant. The true longitude is often called the fast variable of this orbital element set.
g g N ˆi N gr ˆir
where
ˆi
eˆ N eˆ TN ˆi r ˆi r
eˆ ˆi ˆi
N
eˆ N T
N r r
and
eˆ N 0 0 1
T
page 25
In these equations the north direction component is indicated by subscript N and the radial direction
component is subscript r.
cos
k
4
Re '
gN
r2
Pk J k
k 2 r
k
4
R
gr 2 k 1 e Pk J k
r k 2 r
where
gravitational constant
r geocentric distance of the spacecraft
Re equatorial radius of the Earth
geocentric latitude
J k zonal gravity coefficient
Pk k th order Legendre polynomial
For a zonal only Earth gravity model, the east component is identically zero.
J2
n
r4
1 h 2
k
2 2
The general vector equation for secondary body point-mass perturbations such as the Moon, Sun or
planets is given by
page 26
n
d j sj
t j 3 3
j 1 d j sj
In this equation, s j is the vector from the primary body to the secondary body j, j is the gravitational
constant of the secondary body and d j r s j , where r is the position vector of the spacecraft relative
to the primary body.
The perturbation due to secondary bodies in the modified equinoctial coordinate system is given by
aTB QT t , where Q ˆi r ˆit ˆin .
This part of the trajectory analysis implements a special perturbation technique which numerically
solves the vector system of second-order, nonlinear differential equations of motion of a spacecraft
using the method of order reduction. The second-order equations of motion are given by
a r , v , t r r , r , t a g r a s r , t am r , t
where
t dynamical time
r inertial position vector of the spacecraft v inertial velocity vector of the spacecraft
a g acceleration due to the Earth's gravity as acceleration due to the Sun
am acceleration due to the Moon
After order reduction, the system of six first-order differential equations is defined by
y1 vx y4 y2 v y y5 y2 vz y6
rx 3 J 2 req 5rz2
2
ry 3 J 2 req2 5rz2
y5 3 1 1 2 am y as y aTy
r 2 r 2 r
rz 3 J 2 req 5rz2
2
Propulsive thrust
page 27
T
aT uˆ T t
m t
T
where T is the thrust magnitude, m is the spacecraft mass and uˆ T uTr uTt uTn is the unit pointing
thrust vector expressed in the spacecraft-centered radial-tangential-normal coordinate system.
The components of this unit vector are the control variables for this problem.
dm T
m
dt g I sp
where g is the acceleration of gravity and I sp is the specific impulse of the propulsive system. The
product g I sp is also called the exhaust velocity.
The spacecraft mass at any mission elapsed time t is given by m t msci mt where msci is the initial
mass of the spacecraft.
The components of the unit thrust vector can also be defined in terms of the in-plane pitch angle and
the out-of-plane yaw angle as follows:
Finally, the pitch and yaw angles can be determined from the components of the unit thrust vector
according to
sin 1 uTr tan 1 uTn , uTt
The pitch angle is positive above the “local horizontal” and the yaw angle is positive in the direction of
the angular momentum vector.
The relationship between a unit thrust vector in the ECI coordinate system uˆ TECI and the corresponding
unit thrust vector in the modified equinoctial system uˆ TMEE is given by
uˆ TECI ˆir ˆi
t
ˆi uˆ
n TMEE
where
ˆi r rˆ ˆi r v hˆ ˆi ˆi ˆi r v r
rv rv r
r n t n r
r
page 28
This relationship can also be expressed as
rˆ
x hˆ rˆ x
hˆ x
uˆ TECI Q uˆ TMEE rˆy
hˆ rˆ y
ˆh uˆ
y TMEE
rˆz hˆ rˆ z
hˆ z
In these equations, r is the inertial position vector and v is the inertial velocity vector of the spacecraft.
In the tlto_ocs computer program, the components of the inertial unit thrust vector are defined in
terms of the right ascension and the declination angle as follows:
Finally, the right ascension and declination angles can be determined from the components of the ECI
unit thrust vector according to
The derivation of B-plane coordinates is described in the classic JPL reports, “A Method of Describing
Miss Distances for Lunar and Interplanetary Trajectories” and “Some Orbital Elements Useful in Space
Trajectory Calculations”, both by William Kizner. The following diagram illustrates the fundamental
geometry of the B-plane coordinate system.
page 29
The arrival asymptote unit vector Ŝ is given by
cos cos
Sˆ cos sin
sin
where and are the declination and right ascension of the asymptote of the incoming hyperbola.
The following computational steps summarize the calculation of the B-plane vector from a moon-
centered position vector r and velocity vector v at closest approach.
radius rate r r v r
semiparameter p h2
r
semimajor axis a
r v2
2
orbital eccentricity e 1 p a
pr rh
true anomaly cos sin tan 1 sin ,cos
er e
B-plane magnitude B pa
fundamental vectors
r v rr
zˆ pˆ cos rˆ sin zˆ qˆ sin rˆ cos zˆ
h
a b
S vector S pˆ qˆ
a b2 2
a b2
2
b2 ab
B vector B pˆ qˆ
a 2 b2 a 2 b2
S , S ,0
2 2 T
T
y x
T vector
S x2 S y2
page 30
R S T SzTy , SzTx , S xTy S yTx
T
R vector
This section describes the transformation of coordinates between the Earth mean equator and equinox of
J2000 (EME2000) and lunar mean equator and IAU node of epoch coordinate systems. This
transformation is used to compute the selenocentric orbital inclination and B-plane coordinates at lunar
encounter.
The following diagram illustrates the orientation of the lunar mean equator and IAU node of epoch
coordinate frame.
A unit vector in the direction of the pole of the moon can be determined from
cos p cos p
pˆ Moon sin p cos p
sin p
The right ascension and declination of the lunar pole in the EME2000 coordinate system are given by
the following expressions
page 31
P 66.5392 0.0130T 1.5419cos E1 0.0239cos E 2
0.0278cos E 3 0.0068cos E 4 0.0029cos E 6
0.0009cos E 7 0.0008cos E10 0.0009cos E13
where T is the time in Julian centuries given by T JD 2451545.0 / 36525 and JD is the TDB Julian
Date.
E1 125.045 0.0529921d
E 2 250.089 0.1059842d
E 3 260.008 13.0120009d
E 4 176.625 13.3407154d
E 6 311.589 26.4057084d
E 7 134.963 13.0649930d
E10 15.134 0.1589763d
E13 25.053 12.9590088d
where d JD 2451545 is the number of days since January 1.5, 2000. These equations are given in
“Report of the IAU Working Group on Cartographic Coordinates and Rotational Elements: 2009”,
Celestial Mechanics and Dynamical Astronomy, 109: 101-135, 2011.
The unit vector in the x-axis direction of this selenocentric coordinate system is given by
xˆ zˆ pˆ Moon
where zˆ 0 0 1 . The unit vector in the y-axis direction can be determined using
T
yˆ pˆ Moon xˆ
Finally, the components of the matrix that transforms coordinates from the EME2000 system to the
moon-centered (selenocentric) mean equator and IAU node of epoch system are as follows:
xˆ
M yˆ
pˆ Moon
Circularization delta-v
The impulsive delta-v required to circularize the spacecraft’s trajectory at closest approach to the moon
can be computed from
page 32
m
v v p v p vlc
rp
where v p is the velocity of the incoming hyperbola at periapsis, rp is the periapsis radius at closest
approach, and m is the gravitational constant of the moon. For capture into an elliptical orbit at the
moon, the impulsive delta-v is determined using
2 m m
v v p
rp a
The range of orbital inclinations possible at closest approach to the moon is a function of the declination
of the incoming hyperbola. This range is governed by the following constraint
i
where i is the selenocentric inclination of the final lunar orbit and is the selenocentric declination of
the incoming hyperbola.
page 33
Algorithm Resources
“Circumlunar Trajectory Calculations”, MIT Instrumentation Laboratory Report R-353, April 1962.
“Optimal Low Thrust Trajectories to the Moon”, John T. Betts and Sven O. Erb, SIAM Journal on
Applied Dynamical Systems, Vol. 2, No. 2, pp. 144-170, 2003.
“Integrated Algorithm for Lunar Transfer Trajectories Using a Pseudostate Technique”, R. V. Ramanan,
AIAA Journal of Guidance, Control and Dynamics, Vol. 25, No. 5, September-October 2002, pp. 946-
952.
“Nonimpact Lunar Transfer Trajectories Using the Pseudostate Technique”, R. V. Ramanan and V.
Adimurthy, AIAA Journal of Guidance, Control and Dynamics, Vol. 28, No. 2, March-April 2005, pp.
217-225.
“Injection Conditions for Lunar Trajectories”, R. Kolenkiewicz and W. Putney, NASA TM X-55390,
November 1965.
“Coplanar Three-Body Trans-Earth Lunar Trajectory Simulation Methodology”, H. Ikawa, AIAA 88-
0381, AIAA 26th Aerospace Sciences Meeting, Reno, Nevada, January 11-14, 1988.
“Lunar Constants and Models Document”, JPL D-32296, September 23, 2005.
page 34
APPENDIX A
Contents of the Simulation Summary and CSV Files
This appendix is a brief summary of the information contained in the simulation summary screen
displays and CSV data file produced by the tlto_ocs software.
The user-defined comma-separated-variable disk file is created by the odeprt subroutine and contains
the following information:
page 35
vmag (km/sec) = scalar velocity vector in kilometers per second
page 36
APPENDIX B
Fortran Functions and Subroutines
This appendix is a brief summary of the major Fortran functions and subroutines included in the
tlto_ocs computer program.
linput.for - read and echo a line of text from an input file subroutine
oderhs.for - subroutine that evaluates the equations of motion and any algebraic
equations
readfpn.for - read and echo floating point number from input file subroutine
page 37
rkf78cn.for - evaluate RKF78 integration coefficients subroutine
page 38
APPENDIX C
Example Fortran Subroutine
This appendix contains a Fortran 77 routine that illustrates typical programming conventions used in the
tlto_ocs software. This subroutine is the point function routine required by the software.
c ************************************
include 'socscom1.inc'
iferr = 0
c -------------------------------------------------------
c phase 1 - TLI propulsive maneuver
c load modified equinoctial elements into local variables
c -------------------------------------------------------
pmee = y(1)
fmee = y(2)
gmee = y(3)
hmee = y(4)
xkmee = y(5)
xlmee = y(6)
else
c ------------------------------------------------
c phase 2 - coast to lunar SOI
page 39
c load cartesian state vector into local variables
c ------------------------------------------------
reci(1) = y(1)
reci(2) = y(2)
reci(3) = y(3)
veci(1) = y(4)
veci(2) = y(5)
veci(3) = y(6)
end if
xmass = y(7)
c *********************************************************************
c compute point functions for state vector continuity at phase boundary
c *********************************************************************
c ------------------------------------
c "working" eci state vector at the
c end of the TLI propulsive maneuver
c ------------------------------------
do i = 1, 3
ptf(i) = reci(i)
ptf(i + 3) = veci(i)
end do
end if
c -----------------------------------
c "working" eci state vector at the
c beginning of the coast to lunar SOI
c -----------------------------------
do i = 1, 3
ptf(i) = reci(i)
ptf(i + 3) = veci(i)
end do
end if
c ******************************************
c compute mission constraint point functions
page 40
c ******************************************
if (iphase .eq. 1 .and. ioev1 .eq. 2 .and. iphend .eq. -1) then
c -----------------------------------------------------
c park orbit inclination and raan prior to TLI maneuver
c -----------------------------------------------------
c cosine(inclination)
hmag = vecmag(hv)
c RAAN (radians)
ptf(2) = oev(5)
end if
c ---------------------------------
c selenocentric mission constraints
c ---------------------------------
do i = 1, 3
rtmp(i) = reci(i) - rmoon(i)
c -------------------------------------
c selenocentric distance point function
c -------------------------------------
ptf(1) = vecmag(rm2sc)
c ---------------------------------
c find closest approach to the moon
c ---------------------------------
page 41
call findca(xjdate, rm2sc, vm2sc, icaerr)
iferr = 1
return
end if
ptf(2) = vecmag(rca)
c ---------------------------------------
c cos(orbital inclination) point function
c ---------------------------------------
hmag = vecmag(hv)
end if
return
end
page 42
APPENDIX D
This appendix describes a Fortran computer program called lguess that can be used to perform a
preliminary performance assessment of trans-lunar trajectories. The software can also be used to create
an initial guess for the tlto_ocs computer program. This algorithm assumes that trans-lunar injection
(TLI) occurs impulsively from a circular Earth park orbit. The software solves for the minimum TLI
delta-v using a two-body Lambert solution for the transfer trajectory from the Earth park orbit to the
center of the moon.
The program inputs, major computational step and outputs for this implementation are as follows:
Software Inputs
This computer program uses the BOBYQA algorithm written by M.J.D. Powell to solve this classic
trajectory optimization problem. The lunar coordinates required by the software are computed using the
JPL DE421 ephemeris. The source code for the lguess computer program was created using the Intel
Visual Fortran compiler, version 11.1.
The lguess computer program is “data-driven” by a simple text file created by the user. This section
describes a typical input data file. In the following discussion the actual input file contents are in
courier font and all explanations are in times italic font.
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.
The first four lines of any input file are reserved for user comments. These lines are ignored by the
software. However the input file must begin with four and only four initial text lines.
page 43
*******************************
* input file for program lguess
* lguess1.in – December 7, 2010
*******************************
The software allows the user to specify an initial guess for the TLI calendar date and lower and upper
bounds on the actual date found during both the two-body TLI delta-v optimization process. For any
guess for the TLI time tTLI and user-defined lower and upper bounds tl and tu , the actual TLI time t
is constrained as follows:
tTLI tl t tTLI tu
The first five inputs define the user-defined TLI calendar date and the lower and upper bounds,
respectively. Be sure to include all four digits of the calendar year.
IMPORTANT: The TLI calendar date is a control variable in the NLP formulation and must always
have a lower and upper bound.
TLI calendar date (month, day, year)
9,15,2008
The next input is the user-defined number for the TLI-to-lunar encounter transfer time, in hours.
TLI-to-lunar encounter transfer time (hours)
110.0
The next two numbers define the fixed values for the park orbit altitude and orbital inclination.
***********************************
circular park orbit characteristics
***********************************
altitude (kilometers)
185.32
This next integer input defines the type of TLI maneuver to perform. The software uses this indicator to
compute the park orbit RAAN. Please see the Technical Discussion later in this document for
information about how the park orbit RAAN is determined.
type of TLI maneuver
(1 = ascending, 2 = descending)
2
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:
lguess lguess1.in
page 44
If the software is executed without an input file on the command line, the lguess computer program
will display the following prompt:
At this point the user should input the name of a valid input file, including the filename extension.
Program example
The following is the solution created by the computer program for this example. The results are
presented in the Earth mean equator and equinox of J2000 coordinate system (EME2000). The
trajectory characteristics are given before and after the impulsive TLI maneuver. The geocentric orbital
elements and the state vectors of the spacecraft and the moon at encounter are also displayed.
program lguess
DE421 ephemeris
page 45
(geocentric EME2000 coordinates)
--------------------------------
page 46
rx (km) ry (km) rz (km) rmag (km)
0.183855964261D+06 0.278989583980D+06 0.156328383523D+06 0.368885845565D+06
The final two items of the program output are the geocentric right ascension and declination of the moon
at encounter, in the EME2000 system.
The specific orbital energy displayed by the software is calculated using the expression E v 2 2 r .
TDB is the barycentric dynamic time which is the fundamental time argument for the JPL lunar
ephemeris used by the code.
arglat (deg) = argument of latitude in degrees. The argument of latitude is the sum of
true anomaly and argument of perigee.
page 47
Technical Discussion
This section describes several of the algorithms implemented in the lguess computer program.
y t
z
u t
consisting of the state variables y and the control variables u for any time t. In this discussion vectors
are denoted in bold.
The system dynamics are defined by a vector system of ordinary differential equations called the state
equations that can be represented as follows:
dy
y f y t , u t , p, t
dt
The initial dynamic variables at time t0 are defined by ψ0 ψ y t0 , u t0 , t0 and the terminal
conditions at the final time t f are defined by ψ f ψ y t f , u t f , t f . These conditions are called the
boundary values of the trajectory problem. The problem may also be subject to path constraints of the
form g y t , u t , t 0 .
The basic nonlinear programming problem (NLP) is to determine the control vector history and problem
parameters that minimize the scalar performance index or objective function given by
J y t0 , t0 , y t f , t f , p
During the two-body trajectory optimization, the control variables are the TLI calendar date and the true
anomaly of the TLI maneuver. The objective function or performance index is the scalar magnitude of
the TLI delta-v vector.
In addition to the bounds on the TLI calendar date mentioned earlier, the true anomaly during the two-
body optimization is bounded according to
180 180
The final boundary conditions are the components of the moon’s inertial position vector at encounter.
page 48
Solving the two body Lambert problem
Lambert’s problem is concerned with the determination of an orbit that passes between two positions
within a specified time-of-flight. This classic astrodynamic problem is also known as the orbital two-
point boundary value problem (TPBVP).
The time to traverse a trajectory depends only upon the length of the semimajor axis a of the transfer
trajectory, the sum ri rf of the distances of the initial and final positions relative to a central body, and
the length c of the chord joining these two positions. This relationship can be stated as follows:
tof tof ri rf , c, a
a3
t t0 E e sin E
we can write
a3
t E E0 e sin E sin E0
where E is the eccentric anomaly associated with radius r, E0 is the eccentric anomaly at r0 , and t 0
when r r0 .
At this point we need to introduce the following trigonometric sun and difference identities:
a
sin sin 2sin cos
2 2
a
cos cos 2sin sin
2 2
a
cos cos 2 cos cos
2 2
If we let E and E0 and substitute the first trig identity into the second equation above, we have
the following equation:
a3 E E0 E E0
t E E0 2sin e cos
2 2
page 49
E E0
e cos cos
2 2
E E0
sin sin
2 2
a3
t 2sin cos
2 2
r a 1 e cos E
x a cos E e
y a sin E 1 e 2
r r0 c r r0 c s
cos 1 1 1
2a 2a 2a a
r r0 c r r0 c sc
sin 1 1 1
2a 2a 2a a
This part of the derivation makes use of the following three relationships:
r r0
cos cos 1
2 2 2
E E0 E E0
2
sin sin sin 1 e cos
2 2 2 2
x x0 y y0 c
2 2 2 2
sin sin
2 2 2a 2a 2a
s sc
sin sin
2 2a 2 2a
and several additional substitutions, we have the time-of-flight form of Lambert’s theorem
page 50
a3
t sin sin
A discussion about the angles and can be found in “Geometrical Interpretation of the Angles
and in Lambert’s Problem” by J. E. Prussing, AIAA Journal of Guidance and Control, Volume 2,
Number 5, Sept.-Oct. 1979, pages 442-443.
The algorithm used in this computer program is based on the method described in “A Procedure for the
Solution of Lambert’s Orbital Boundary-Value Problem” by R. H. Gooding, Celestial Mechanics and
Dynamical Astronomy 48: 145-165, 1990. This iterative solution is valid for elliptic, parabolic and
hyperbolic transfer orbits which may be either posigrade or retrograde, and involve one or more
revolutions about the central body.
For a given TLI calendar date, there are two possible locations on the initial park orbit at which to
perform the propulsive maneuver. One opportunity occurs during the ascending part of the park orbit
and the other during the descending motion. The park orbit RAAN p at these two locations can be
determined from spherical trigonometry relationships involving the park orbit inclination and the
geocentric right ascension and declination of the moon at encounter. The equations implemented in this
computer program are as follows:
ascending
tan m
p 180 m sin 1
tan i
p
descending
tan m
p m sin 1
tan i
p
where
Additional information about these equations can be found in Appendix A of the journal reference,
“Integrated Algorithm for Lunar Transfer Trajectories Using a Pseudostate Technique”, R. V. Ramanan,
AIAA Journal of Guidance, Control and Dynamics, Vol. 25, No. 5, September-October 2002, pp. 946-
952.
page 51
APPENDIX E
Typical Sparse Optimization Suite Configuration File
The tlto_ocs computer progran can read and use a user-defined configuration file. A description of
each element in this file can be found in the INSOCX routine in section 6.2, Subprograms for Optimal
Control, and the INSNLP routine in Section 2.2, Subprograms for Optimization of the Sparse
Optimization Suite user’s manual. Please note that the tlto_ocs software can read and use a subset of
the information in this file. For example, a subset configuration file might contain only the following
information;
ODETOL=0.1D-06
INSNLP:IOFLAG=5
SOCOUT=I4K4
The following is a typical “full version” configuration file created during the execution of the
tlto_ocs software.
AEQTOL=0.1000000000000000D-02
DTAUX=0.0000000000000000D+00
OBJCTL=0.1000000000000000D-04
ODETOL=0.1000000011686097D-06
PGDCTL=0.1000000000000000D-02
PRTMSD=0.1490116119384766D-07
PRTMXD=0.1000000000000000D-02
PRTSFD=0.1000000000000000D-04
QDRTOL=0.1000000000000000D-02
RESTOL=0.1000000000000000D-04
SMLTOL=0.1490116119384766D-10
TOLJSD=0.1000000000000000D-05
TOLM5A=0.1490116119384766D-07
TOLM5R=0.1490116119384766D-07
IDSCPH=0
IDSCND=0
IDSCVR=0
IDSCFN=0
IDTSFD=-1
IPFAUX=0
IPFSFD=0
IPRSFD=1
IPGRD=0
IPNLP=10
IPODE=0
IPUAUX=0
IPUOCP=6
IRSTRT=2
ISCALE=0
ISFHES=41
ISFINP=42
ISFRST=43
ISFSCL=44
ITSWCH=2
M5DTYP=0
MITODE=20
MTSWCH=-1
MXDATA=0
MXPARM=10
MXPCON=20
MXSTAT=20
MXTERM=50
NPTAUX=100
NSSWCH=-1
SOCOUT=A0B0C0D0E0F0G0H0I0J2K0L0M0N0O0P0Q0R0S1T0U0V0W0X0Y0Z0
SPRTHS=SPARSE
NLPALG=SNLPMN
NLPOMR=M
page 52
KEYDPL=.lueiLUE
RHSTMP=RHSTMPLT
RSTFIL=tlto1.rsbin
SCLFIL=scalewgt.fil
INSNLP:ALFLWR=0.0000000000000000D+00
INSNLP:ALFUPR=0.1000000000000000D+01
INSNLP:CONTOL=0.1490116119384766D-07
INSNLP:EPSRLF=0.1490116119384766D-07
INSNLP:OBJTOL=0.9999999747378752D-05
INSNLP:PGDTOL=0.1000000000000000D-04
INSNLP:SLPTOL=0.9000000000000000D+00
INSNLP:SFZTOL=0.1000000000000000D-01
INSNLP:TOLFIL=0.2000000000000000D+01
INSNLP:TOLKTC=0.1110953834938985D+26
INSNLP:TOLPVT=0.1000000000000000D-02
INSNLP:IHESHN=0
INSNLP:IOFLAG=5
INSNLP:IOFLIN=-1
INSNLP:IOFMFR=0
INSNLP:IOFPAT=0
INSNLP:IOFSHR=0
INSNLP:IOFSRC=0
INSNLP:IPUDRF=0
INSNLP:IPUFZF=0
INSNLP:IPUMF1=11
INSNLP:IPUMF2=12
INSNLP:IPUMF3=13
INSNLP:IPUMF4=14
INSNLP:IPUMF5=15
INSNLP:IPUMF6=16
INSNLP:IPUMF7=17
INSNLP:IPUNLP=6
INSNLP:IPUSTF=0
INSNLP:IRELAX=1
INSNLP:ITDRQP=-1
INSNLP:ITFZQP=-1
INSNLP:IT1MAX=20
INSNLP:JACPRM=0
INSNLP:LYNFNC=0
INSNLP:LYNOUT=0
INSNLP:LYNPLT=0
INSNLP:LYNPNT=101
INSNLP:LYNVAR=0
INSNLP:MAXLYN=5
INSNLP:MAXNFE=50000
INSNLP:MNSAME=2
INSNLP:NEWTON=0
INSNLP:NITMAX=1000
INSNLP:NITMIN=0
INSNLP:NORMAL=0
INSNLP:ALGOPT=FM
INSNLP:KTOPTN=SMALL
INSNLP:QPOPTN=SPARSE
INSNLP:BIGCON=-0.1000000000000000D+01
INSNLP:FEATOL=0.1000000000000000D-01
INSNLP:PMULWR=0.1000000000000000D+00
INSNLP:PTHTOL=0.1000000000000000D+02
INSNLP:RHOLWR=0.1000000000000000D+03
INSNLP:IMAXMU=10
INSNLP:MUCALC=3
INSNLP:MXQPIT=1
page 53
Program lascent_ocs
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
Computer Methods for TransEarth TCM
Delta-V Design and Optimization
This document describes three computer programs that can be used to design and optimize an
impulsive trajectory correction maneuver (TCM) during the transEarth phase of lunar flight. The first
algorithm “targets” the maneuver to achieve Earth relative flight path coordinates at the Earth entry
interface (EI). The other two numerical methods attempt to minimize the magnitude of the TCM delta-
v and also achieve the EI targets or mission constraints.
The following is a summary of the numerical methods used in each computer program.
Each computer program is data-driven by a simple ASCII input file created by the user. The software
allows the user to specify the order and degree of the Earth gravity model used in the geocentric
equations of motion. The user also has the option to include point-mass gravity perturbations of the
Sun and Moon. The solar and lunar ephemeris is based on the JPL DE421 development ephemeris.
The user can choose a subset of EI flight path coordinates that includes the geodetic altitude, geodetic
latitude, geographic longitude, and the relative azimuth angle. Please note that the relative flight path
angle must be specified for all three algorithms. Finally, the user can also provide an initial guess for
the three components of the TCM delta-v maneuver.
This section illustrates a typical input data file for the TCM software suite.
*****************************************
** transearth TCM trajectory optimization
** n-body geocentric motion
** Moon-to-Earth data file - tcm1.in
** July 22, 2008
*****************************************
TCM epoch
Aug 6 2018 15:59:59.994 TDB
************************************************
geocentric EME2000 orbital elements prior to TCM
************************************************
page 1
argument of perigee (degrees)
0.347338533437D+03
**********************************************************
initial guess and bounds for geocentric TCM delta-v vector
**********************************************************
*****************************************************
entry interface constraints (set to 1.0d99 to ignore)
*****************************************************
************************
trajectory perturbations
************************
**********************************************
root-finding and integration algorithm control
**********************************************
page 2
root-finding tolerance
1.0d-8
PROGRAM OUTPUT
The following is a summary of the program output from each computer simulation for this example.
The entry interface targets for this example were the geodetic altitude (121.92 kilometers) and geodetic
latitude (-19.5 degrees), and the geographic east longitude (121 degrees). The EI relative flight path
angle target is -6.2 degrees.
The following is the delta-v summary and the targets achieved at the entry interface.
======================
program transearth_tcm
======================
----------------------------------
time and conditions prior to TCM
(geocentric - EME2000 coordinates)
----------------------------------
----------------------------------
time and conditions after the TCM
(geocentric - EME2000 coordinates)
----------------------------------
page 3
rx (km) ry (km) rz (km) rmag (km)
0.127984235359D+06 0.947167455303D+05 -.126124998721D+05 0.159719446334D+06
--------------------------------
TCM delta-v vector and magnitude
(geocentric EME2000 coordinates)
--------------------------------
--------------------------------------
time and conditions at entry interface
(geocentric - EME2000 coordinates)
--------------------------------------
page 4
UTC epoch 2018 AUG 07 08:00:24.72001
The following is the delta-v summary and the targets achieved at the entry interface using this
numerical method.
--------------------------------
TCM delta-v vector and magnitude
(geocentric EME2000)
--------------------------------
The following is the delta-v summary and the targets achieved at the entry interface.
page 5
deltav 10.109089360122415 meters/second
TECHNICAL DISCUSSION
This section describes the fundamental algorithms implemented in this software suite. It includes a
summary of the simple shooting method used in the first two computer programs, the equations of
motion, and the transformation of the inertial state vector at the entry interface to the corresponding
flight path coordinates which are targets or mission constraints. In these applications, the fundamental
time system is barycentric dynamical time (TDB) and the coordinate system is the Earth mean equator
and equinox of J2000 (EME2000).
The first program attempts to solve a system of three nonlinear constraint equations similar to
hp ht 0 p t 0 p t 0
where the p subscript denotes a predicted coordinate and the t subscript is a user-defined target.
The other two programs attempt to minimize a scalar performance index given by
where Vx , Vy , Vz are the components of the impulsive TCM delta-v.
Shooting method
The elapsed time from the TCM until the spacecraft reaches the entry interface with the user-defined
relative flight path angle is determined by an algorithm that includes a Runge-Kutta-Fehlberg 7(8)
numerical integration method embedded within Brent’s one-dimensional root-finder. This technique
searches for the time at which the difference between the predicted and user-defined relative flight path
angles is within a small tolerance p t .
page 6
Geocentric equations of motion
The TCM computer programs implement a special perturbation technique which numerically
integrates the vector system of second-order, nonlinear differential equations of motion of a spacecraft
given by
a r, t r r, t a g r, t a m r, t a s r, t
where
t barycentric dynamical time
r inertial position vector of the spacecraft
a g acceleration due to the Earth's gravity
a m acceleration due to the Moon
a s acceleration due to the Sun
This computer program uses a spherical harmonic representation of the Earth’s geopotential function
given by
n R m
n n
0 R
r, ,
r
C n
r n 1 r
n
P 0
u Pn u Sn sin m Cn cos m
r n 1 m1 r
m m
where is the geocentric latitude of the spacecraft, is the geocentric east longitude of the spacecraft
and r r x 2 y 2 z 2 is the geocentric distance of the spacecraft. In this expression the S’s and
C’s are unnormalized harmonic coefficients of the geopotential, and the P’s are associated Legendre
polynomials of degree n and order m with argument u sin .
The software calculates the spacecraft’s acceleration due to the Earth’s gravity field with a vector
equation derived from the gradient of the potential function expressed as a g r, t r, t .
This acceleration vector is a combination of pure two-body or point mass gravity acceleration and the
gravitational acceleration due to higher order nonspherical terms in the Earth’s geopotential. In terms
of the Earth’s geopotential , the inertial rectangular cartesian components of the spacecraft’s
acceleration vector are as follows:
1 x y
2 2
z z
r r r2
page 7
The three partial derivatives of the geopotential with respect to r, , are given by
1 N R
n
r r r n 2 r m 0
N R
n n
r n 2 r
C
m 0
m
n cos m Snm sin m Pnm 1 sin m tan Pnm sin
N R
n n
r n 2 r
m S
m 0
m
n cos m Cnm sin m Pnm sin
where
R radius of the Earth
r geocentric distance of the spacecraft
Snm , Cnm harmonic coefficients
geocentric latitude of the spacecraft sin 1 z r
longitude of the spacecraft g
right ascension of the spacecraft tan 1 ry rx
g right ascension of Greenwich
Right ascension is measured positive east of the vernal equinox, longitude is measured positive east of
Greenwich, and latitude is positive above the Earth’s equator and negative below.
For m 0 , the coefficients are called zonal terms, when m n the coefficients are sectorial terms, and
for n m 0 the coefficients are called tesseral terms.
The Legendre polynomials with argument sin are computed using recursion relationships given by:
1
Pn0 sin 2n 1 sin Pn01 sin n 1 Pn02 sin
n
Pnn sin 2n 1 cos Pnn11 sin , m 0, m n
and Pi j 0 for j i .
page 8
The trigonometric arguments are determined from expansions given by
The true-of-date position vector required in the previous equations is computed according to
The east longitude required in the gravity model calculations is computed from the x and y components
of the true-of-date position vector according to
tan 1 ry , rx g
The true-of-date gravity vector is converted to the EME2000 system for use in the equations of motion
using the transpose of the combined precession-nutation matrix as follows
r r
am r , t m mb 3 em 3
r rem
m b
where
m gravitational constant of the moon
rmb position vector from the moon to the spacecraft
rem position vector from the Earth to the moon
Likewise, the acceleration contribution of the sun represented by a point mass is given by
r r
a s r , t s s b 3 e s 3
r res
s b
page 9
where
s gravitational constant of the sun
rs b position vector from the sun to the spacecraft
re s position vector from the Earth to the sun
3 3qk qk2
f qk qk 3
1 1 qk
where
r T r 2s k
qk
sTk sk
n
k
r r f qk s k
k 1 d k3
In these equations, sk is the vector from the primary body to the secondary body, k is the
gravitational constant of the secondary body, and dk r sk , where r is the position vector of the IRIS
spacecraft relative to the primary body. The derivation of the f q functions is described in Section
8.4 of “An Introduction to the Mathematics and Methods of Astrodynamics, Revised Edition”, by
Richard H. Battin, AIAA Education Series, 1999.
This section describes the algorithms used to compute the following flight path coordinates at the entry
interface.
r geocentric radius
V speed
flight path angle
geocentric declination
geographic longitude east
flight azimuth clockwise from north
The transformation of an Earth-centered inertial (ECI) position vector rECI to an Earth-centered fixed
(ECF) position vector rECF is given by the following vector-matrix operation
page 10
where the elements of the transformation matrix T are given by
cos sin 0
T sin cos 0
0 0 1
and is the Greenwich apparent sidereal time at the moment of interest. Greenwich sidereal time is
given by the following expression:
g 0 et
where g 0 is the Greenwich sidereal time at 0 hours UTC, e is the inertial rotation rate of the Earth,
and t is the elapsed time since 0 hours UTC.
Finally, the flight path coordinates are determined from the ECF coordinates of the vehicle using
following set of equations
r rECF
2
rECF
2
y
rECF
2
v vECF
2
vECF
2
y
vECF
2
z
tan 1 rECF , rECF y x
rECFz
sin 1
rECF
vRz
sin 1
v R
tan 1 vR , vR
y x
where
sin cos sin sin cos
v R sin cos 0 v ECF
cos cos cos sin sin
Please note that the two argument inverse tangent calculation is a four quadrant operation.
These computer programs use a series solution to convert geocentric radius and declination to geodetic
altitude and latitude. The following diagram illustrates the geometric relationship between geocentric
and geodetic coordinates.
page 11
In this diagram, is the geocentric declination, is the geodetic latitude, r is the geocentric distance,
and h is the geodetic altitude.
The exact mathematical relationship between geocentric and geodetic coordinates is given by the
following system of two nonlinear equations
c h cos r cos 0
s h sin r sin 0
req
c
1 2 f f 2 sin 2
s c 1 f
2
and req is the Earth equatorial radius and f is the flattening factor for the Earth.
In these computer programs, the geodetic latitude is determined using the following expansion in
flattening factor:
sin 2 1 1
f 2 sin 4 f 2
4
page 12
1 cos 2
1 1
hˆ rˆ 1 f 1 cos 4 f 2
2 4 16
In these equations, is the geocentric distance of the satellite, hˆ h / req and rˆ / req .
page 13
Lunar Free-Return Trajectory Analysis with MATLAB
This document is the user’s guide for a MATLAB script named free_return that can be used to
design two-dimensional lunar free-return trajectories. The system dynamics are modeled as a simplified
circular-restricted three-body problem (CRTBP). Additional modeling assumptions are;
the massless third body is subject only to the point-mass gravity of the earth and moon
the moon is subject only to the point mass gravity of the earth
the moon’s orbit is circular and all motion lies in the moon’s orbital plane
departure from the earth park orbit is the counterclockwise direction
trans-lunar injection (TLI) occurs impulsively from a circular earth park orbit
the TLI departure maneuver is applied tangential to the earth park orbit
the earth orbit insertion (EOI) impulsive maneuver is applied tangential to the return trajectory
the lunar flyby is a no maneuver, ballistic trajectory
The algorithm implemented in this MATLAB script is based on the technical report “Optimal Free-
Return Trajectories for Moon and Mars Missions”, by A. Miele, T. Wang and S. Mancuso, The Journal
of the Astronautical Sciences, Vol. 48, Nos. 2 and 3, April-September 2000, pp. 183-206.
The free_return script uses the SNOPT nonlinear programming (NLP) method for optimizing the
lunar free-return problem implemented in this script. MATLAB versions of SNOPT mex and support
m-files for several computer platforms can be found at Professor Philip Gill’s web site which is located
at http://scicomp.ucsd.edu/~peg/. Professor Gill’s web site also includes a PDF version of the SNOPT
software user’s guide.
The free_return MATLAB script is “data-driven” by a simple text file created by the user. This
section describes a typical input data file. In the following discussion the actual input file contents are in
courier font and all explanations are in times italic font.
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 data.
The first four lines of any input file are reserved for user comments. These lines are ignored by the
software. However the input file must begin with four and only four initial text lines.
=================================
input file for free_return.m
free_return1.in January 17, 2014
=================================
The first four inputs define the gravitational constants and radius of the earth and moon.
page 1
gravitational constant of the moon (kilometers^3/second^2)
4902.8
The next two inputs specify the (constant) distance from the earth to the moon and the radius of the
lunar sphere-of-influence (SOI).
The next two inputs define the altitudes of the circular earth park orbit and the lunar close approach.
The final two numeric inputs specify the user’s initial guess for the geocentric angular location of the
TLI maneuver and the scalar magnitude of the TLI delta-v.
initial guess for geocentric angular location of the tli delta-v (degrees)
227.5
After typing free_return in the MATLAB command window, the software will ask you for the name
of the input data file with a display similar to
page 2
The file type defaults to names with a *.in filename extension. However, you can select any
free_return compatible ASCII data file by selecting the Files of type: field or by typing the name of
the file directly in the File name: field.
The following is the script output for the example given earlier. The first part of the output summarize
the SNOPT algorithm results.
page 3
rx (km) ry (km) rz (km) rmag (km)
-4.62495669538951e+03 -5.04092968264503e+03 +0.00000000000000e+00 +6.84114000000000e+03
Please see the Technical Discussion section for an explanation of these last four items.
page 4
The simulation summary screen display contains the following information:
arglat (deg) = argument of latitude in degrees. The argument of latitude is the sum of
true anomaly and argument of perigee.
rmag (km) = scalar magnitude of the third body position vector in kilometers
vx (km/sec) = x-component of the third body velocity vector in kilometers per second
vy (km/sec) = y-component of the third body velocity vector in kilometers per second
vz (km/sec) = z-component of the third body velocity vector in kilometers per second
vmag (km/sec) = scalar magnitude of the third body velocity vector in kilometers per
second
All altitudes are with respect to a spherical earth or moon. The flight path angle is the angle of
the velocity vector relative to the “local” horizontal, measured positive above and negative below the
horizontal. The circularization delta-v is the scalar magnitude of the maneuver required to
create a circular orbit at earth closest approach on the return trajectory.
The moon-third body geocentric separation angle is the geocentric separation angle
between the third body and the moon at lunar closest approach.
After the main calculations are finished, the free_return script will ask if you would like to create
graphic displays of the solution with the following prompt;
A user response of yes will create several graphic displays which are described in the next section.
Each display will also be saved to a disk file in encapsulated Postscript format with a MATLAB
command similar to the following;
page 5
This first plot illustrates the entire free-return trajectory in a geocentric inertial coordinate system. The
surface of the earth and the circular park orbit are green, the third body trajectory is blue, and the
circular orbit of the moon is red. The moon in its orbit is marked every twelve hours. Note that all
graphics are to scale with the fundamental measurement unit being the radius of the earth.
The next two plots depict the earth departure and arrival trajectory and the lunar flyby trajectory. Both
plots are relative to the inertial coordinate system. The departure/arrival trajectory is geocentric and the
flyby trajectory is selenocentric or “moon-centered”. The surface of the moon and the lunar circular
park orbit are black. Notice that the third body travels around the moon in a clockwise direction.
page 6
This next plot illustrates the entire free-return trajectory in a geocentric rotating coordinate system. As
before, all graphics are to scale with the fundamental measurement unit being the earth radius.
The next two “zoomed-in” plots illustrate the earth departure and arrival trajectory and the lunar flyby
trajectory. Both plots are relative to the rotating coordinate system.
The final plot is the hyperbolic lunar flyby trajectory in a selenocentric inertial coordinate system. The
fundamental distance unit for this display is the radius of the moon. The large black circle represents the
lunar sphere-of-influence with a radius equal to 64,000 kilometers (~36.8 lunar radii).
page 7
The field of view of each trajectory display is set with a MATLAB command similar to
The syntax of this MATLAB command is axis xmin xmax ymin ymax where the minimum and maximum
x-coordinates are xmin and xmax . The minimum and maximum y-coordinates are ymin and ymax . The
user can edit any or all of the default axis commands in the free_return script to change the
geocentric and/or selenocentric views.
Technical Discussion
This section provides additional details about the numerical algorithms implemented in this computer
program. It includes a discussion about coordinate systems, equations of motion, and verification of the
“image trajectory” solution. A brief outline of trajectory optimization is also provided.
Coordinate systems
The origin of the inertial coordinate system is the center of the earth. The x-axis points in the direction
of the moon at the initial time and the y-axis is perpendicular to the x-axis. Since the moon’s orbit
around the earth is circular, the y-axis is also parallel to the initial inertial velocity of the moon.
The origin of the rotating coordinate is also the center of the earth. The x-axis of this system points at
the instantaneous location of the moon. It is also parallel to the initial x-axis of the inertial system. The
y-axis is perpendicular to the instantaneous x-axis. The axes of this system rotate at constant angular
speed relative to the axes of the inertial system. In this rotating coordinate system, the moon appears at
rest relative to the earth.
In the graphic images described earlier, the inertial x-axis is the horizontal line positive to the right.
page 8
Equations of motion
The geocentric second-order differential equations of motion of the third body in a simplified two-
dimensional circular-restricted system are given by
xE B 3 E xE B 3 M xE B xE M
rE B rM B
yE B 3 E yE B 3 M yE B yE M
rE B rM B
where the subscript E-B denotes the location of the third body relative to the earth, M-B is the location of
the third body relative to the moon, and E-M is the location of the moon relative to the earth. In these
two equations, E and M are the gravitational constants of the earth and moon, respectively.
The geocentric and selenocentric (moon-centered) distances of the third body are determined from the x
and y components of the position vector according to
The selenocentric x and y coordinates of the third body are determined from
xM B xE B xE M y M B yE B yE M
The geocentric inertial x and y coordinates of the moon are computed from
xE M rE M cos( t ) yE M rE M sin( t )
where t is the elapsed time since the TLI departure maneuver. In these equations, is the rotation rate
or mean motion of the moon in its circular orbit around the earth which is given by E rE3 M . The
velocity of the moon in its orbit is VM E rE M .
y (1) xE B y (2) yE B
y (3) 3 E xE B 3 M xE B xE M
rE B rM B
y (4) 3 E yE B 3 M yE B yE M
rE B rM B
page 9
The x- and y-coordinates of the third body in the rotating system are given by
The mission elapsed time at which the third body reaches closest approach to the moon is calculated
using the event prediction capability of the MATLAB ode45 algorithm. During the numerical
integration of the third body’s geocentric equations of motion, the ode45 numerical method searches for
the time at which the sine of the flight path angle with respect to the moon is nearly zero.
rv
sin
rv
where r and v are the moon-centered or selenocentric position and velocity vectors, respectively.
The following is the MATLAB source code that determines the time and trajectory conditions at closest
approach to the moon.
[t, ysol, tevent, yevent, ie] = ode45(@free_return_eqm, [0 tend], [ri vi], options);
Note that the numerical values for RelTol and AbsTol determine how well the algorithm integrates the
equations of motion.
The following is the MATLAB source code which calculates the sine of the selenocentric flight path
angle required by the event prediction code.
% input
% output
page 10
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
theta_moon = omega_moon * t;
isterminal = 1;
direction = [];
y t
z
u t
consisting of the state variables y and the control variables u for any time t. In this discussion vectors
are denoted in bold.
The system dynamics are defined by a vector system of ordinary differential equations called the state
equations that can be represented as follows:
dy
y f y t , u t , p, t
dt
page 11
The initial dynamic variables at time t0 are defined by ψ0 ψ y t0 , u t0 , t0 and the terminal
conditions at the final time t f are defined by ψ f ψ y t f , u t f , t f . These conditions are called the
boundary values of the trajectory problem.
For any mission time t there are also simple bounds on the state variables
yl y t yu
The basic nonlinear programming problem (NLP is to determine the control vector history and problem
parameters that minimize the scalar performance index or objective function given by
J y t0 , t0 , y t f , t f , p
In this MATLAB script, the control variables consist of the geocentric angular location of the TLI
maneuver and the scalar magnitude of this maneuver. The objective function or performance index is
the scalar magnitude of the TLI delta-v.
The geocentric angular location of the TLI maneuver during the optimization is bounded according to
g 10 g 10
where g corresponds to the user’s initial guess in degrees. Note that this angle is also equal to the
argument of latitude of the TLI maneuver at earth departure. It is measured positive counterclockwise
relative to the x-axis of the inertial coordinate system.
where Vg is the initial guess for the scalar magnitude of the TLI delta-v maneuver in meters per
second. Values for both the angular location and maneuver magnitude initial guesses are taken from the
technical paper mentioned at the being of this document.
page 12
The additional mission constraints for this problem are the user-defined lunar radius at closest approach
and the y-component of the third body velocity in the geocentric rotating coordinate system. The first
constraint ensures that the user’s lunar flyby altitude is satisfied. The second constraint ensures that at
the moment of lunar closest approach, the third body is exactly on the line from the earth to the moon in
either the inertial or rotating coordinate systems.
rfbp rM rfbu rM 0
yER B 0
In the first equation, rfbp represents the radius at the lunar flyby predicted by the software and rfbu is the
user-defined flyby radius. Notice that both values are normalized by the radius of the moon rM for
improved problem scaling.
Notice that the flight path angle constraint described earlier indirectly satisfies the image trajectory
mission constraint that the x-component of third body velocity in the rotating system is zero at the
moment of lunar closest approach.
The following MATLAB source code illustrates how the main script interacts with the SNOPT
nonlinear programming function. This code provides initial guesses (xg) and lower and upper bounds
(xlwr and xupr) for the control variables (theta_tli and deltav_tli) and the objective function
(flow and fupp).
% initial guesses
xg(2) = deltav_tli;
xg = xg';
xlwr = xlwr';
xupr = xupr';
flow(1) = 0.0d0;
fupp(1) = +Inf;
page 13
flow(2) = radius_lmo / radius_moon;
flow(3) = 0.0;
fupp(3) = 0.0;
flow = flow';
fupp = fupp';
snscreen on;
[x, f, inform, xmul, fmul] = snopt(xg, xlwr, xupr, flow, fupp, 'free_return_shoot');
% extract solution
theta_tli = x(1);
deltav_tli = x(2);
In the call to the SNOPT algorithm, the free_return_shoot MATLAB function implements a simple
shooting method that predicts lunar closest approach while solving the mission constraint equations.
% input
% output
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
theta_pe = x(1);
page 14
vpe = vlc_leo + x(2);
[t, ysol, tevent, yevent, ie] = ode45(@free_return_eqm, [0 tend], [ri vi], options);
rrel(3) = 0.0;
f(1) = x(2);
% f(4) = vrel(1);
f = f';
% no derivatives
g = [];
After the free_return script solves for the orbital characteristics and transfer time of the outbound or
departure trajectory, the program then propagates the equations of motion for the entire free-return
mission. Here is the MATLAB source code that calculates the initial conditions for the optimal solution
(inertial geocentric position and velocity vectors), the total time of flight and performs these calculations
using the MATLAB ode45 function.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% propagate system of first-order differential equations
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
The following is the MATLAB source code for the function that evaluates the first-order inertial
equations of motion. It uses Professor Richard Battin’s f q functions to calculate the point-mass
gravity acceleration due to the moon.
% input
% output
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
page 16
global mu_moon mu_earth omega_moon distance_e2m
r1 = sqrt(r2);
r3 = r2 * r1;
for i = 1:1:3
end
theta_moon = omega_moon * t;
rmoon(3) = 0.0;
for i = 1:1:3
end
% f(q) formulation
for i = 1:1:3
end
d3moon = norm(rm2sc)^3;
for i = 1:1:3
end
ydot = [ y(4)
y(5)
y(6)
agrav(1) + amoon(1)
page 17
agrav(2) + amoon(2)
agrav(3) + amoon(3)];
At the end of the numerical calculations, the free_return script provides information about how well
the solution satisfied the trajectory constraints at lunar closest approach. Here is that information for the
trajectory example solved earlier.
The first data item is the value for the y-component of the relative position vector. This number defines
how close the third body was to the earth-moon line at the time of lunar closest approach.
The second item is the x-component of the relative velocity vector, also at lunar closest approach. This
number indicates how “perpendicular” the trajectory was at closest approach.
The third data item is the angle between the moon and third body as seen from the earth, also at closest
approach. This angle is computed from cos1 uˆ E B uˆ E M where uˆ E B is a unit pointing vector
from the earth to the third body and uˆ E M is a unit pointing vector from the earth to the moon, both
calculated at the time of lunar closest approach.
Finally, the last data item is the geocentric inertial flight path angle of the third body at lunar closest
approach. It too is a measure of the orthogonality of the flyby trajectory.
Additional information about the unique properties of image trajectories can be found in Professor
Angelo Miele’s classic paper, “Theorem of Image Trajectories in the Earth-Moon Space”, XI
International Astronautical Congress, Stockholm, 1960.
page 18
Algorithm resources
“Revisit of the Theorem of Image Trajectories in the Earth-Moon Space”, Angelo Miele, Journal of
Optimization Theory and Applications, 2010.
“Automated Lunar Free Return Trajectory Generation”, Mark C. Jesick and Cesar A. Ocampo, AAS 09-
192, American Astronautical Society.
“Circumlunar Trajectory Calculations”, MIT Instrumentation Laboratory Report R-353, April 1962.
“Design of Earth-Moon Free-Return Trajectories”, Qinqin Luo, Jianfeng Yin and Chao Han, AIAA
Journal of Guidance, Control and Dynamics, Vol. 36, No. 1, January-February 2013, pp. 263-271.
“Injection Conditions for Lunar Trajectories”, R. Kolenkiewicz and W. Putney, NASA TM X-55390,
November 1965.
“Coplanar Three-Body Trans-Earth Lunar Trajectory Simulation Methodology”, H. Ikawa, AIAA 88-
0381, AIAA 26th Aerospace Sciences Meeting, Reno, Nevada, January 11-14, 1988.
“Lunar Constants and Models Document”, JPL D-32296, September 23, 2005.
page 19
Program ca_sc2moon
This document is the user’s manual for a computer program called ca_sc2moon that can be used to
estimate the time of closest approach between a spacecraft and the Moon. This information can be
used to access an initial guess for other lunar trajectory analysis computer programs.
The software also includes the option to propagate a spacecraft’s trajectory for a user-specified time
duration. This allows the user to access the effects of such trajectory characteristics as TLI calendar
date, initial park orbit orientation and so forth.
The important numerical methods used in this computer program are as follows:
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:
ca_sc2moon lro1.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 ca_sc2moon *
* *
* closest approach between *
* a spacecraft and the Moon *
* *
* July 25, 2005 *
*************************************
At this point the user should supply the name of a compatible input file. The next section of this
document describes the proper format for an input file for this computer program.
page 1
Typical input file
The ca_sc2moon software is “data-driven” by a user-created text file. The following is a typical
input file used by this computer program. This example searches for closest approach using a
gravity-turn propulsive 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.
In the following discussion the actual input file contents are in courier font and all explanations
are in times italic font.
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.
*****************************************************
** closest approach between a spacecraft and the moon
** n-body geocentric motion
** continuous, low-thrust TLI maneuver
** lro1.in - July 25, 2005
*****************************************************
The first program input is an integer that specifies the type of simulation. Option 1 will simply
propagate the spacecraft for a user-defined duration and option 2 will search for close approach.
simulation type (1 = propagation, 2 = close approach)
2
The next inputs are the initial spacecraft mass, thrust magnitude and specific impulse.
initial spacecraft mass (kilograms)
1000.0
The next input is a number that represents either a guess for the transfer time to closest approach
or the time duration for the orbit propagation option.
transfer time guess or propagation duration (hours)
120
page 2
These inputs define the trans-lunar injection (TLI) launch calendar date and universal time. Be
sure to include all four digits of the calendar year.
******************
* TLI CONDITIONS *
******************
The next six inputs are the classical orbital elements of the park orbit at the beginning of the TLI
propulsive maneuver. These elements should be specified with respect to the Earth mean equator
and equinox of J2000 (EME2000) coordinate system.
******************
initial park orbit
******************
The next two inputs specify the third-body perturbations to include in the simulation.
*********************
orbital perturbations
*********************
The next input is the name of the data file that will contain the trajectory information.
name of solution output file
lro1.csv
The final input specifies the time step size for the data in the output file.
output file step size (minutes)
10.0
page 3
Program solution and graphics
The software will display the characteristics of the finite-burn TLI maneuver and the trajectory
characteristics at closest approach or at the end of the propagation interval.
program ca_sc2moon
page 4
conditions at lunar closest approach
(Earth mean equator and equinox of J2000)
-----------------------------------------
-----------------------------------------
page 5
The ca_sc2moon software will create a comma-separated-variable (csv) output file. This file
contains the EME2000 position vectors of the spacecraft and moon. The following plot is a view of
the trajectory and planetary orbits from the Earth’s north pole looking down on the equatorial plane.
40
Lunar Orbit
lunar transfer
trajectory
20
y coordinate (ER)
0
TLI
-20
0 20 40 60
x coordinate (ER)
400000
spacecraft-to-moon distance (km)
300000
200000
100000
0
0 40 80 120
mission elapsed time (hours)
page 6
Technical Discussion
f ( t ) = r ( t ) = rm − rsc
where rp is the geocentric position vector of the Moon and rsc is the geocentric position vector of
the spacecraft at any simulation time t. This close approach algorithm uses the launch date, thrust
and spacecraft mass provided by the user.
The software allows the user to select the type of steering method used to generate an initial guess
for the trajectory. The two options available are tangential or gravity turn steering. For gravity turn
steering the thrust vector is aligned with the instantaneous velocity vector. For tangential thrusting
the unit thrust vector in the modified equinoctial frame at all times is simply uT = 0 1 0 .
T
For the gravity-turn steering option, the software creates the unit thrust vector in the Earth-centered-
inertial (ECI) coordinate system and integrates the equations of motion in the modified equinoctial
or radial frame system. The relationship between a unit thrust vector in the ECI coordinate system
uˆ TECI and the corresponding unit thrust vector in the modified equinoctial system uˆ TMEE is given by
uˆ TECI = ˆi r ˆi
t
ˆi uˆ
n TMEE
where
ˆi = r ˆi = r v ˆi = ˆi ˆi = ( r v ) r
rv rv r
r n t n r
r
rˆ
x ( hˆ rˆ ) x
hˆ x
uˆ TECI = Q uˆ TMEE = rˆy
( hˆ rˆ ) y
hˆ y uˆ TMEE
rˆz ( hˆ rˆ ) z
hˆ z
Finally, the transformation of the unit thrust vector in the ECI system to the modified equinoctial
coordinate system is given by
uˆ TMEE = Q uˆ TECI
T
page 7
For tangential thrusting, the unit thrust vector in the modified equinoctial frame at all times is
uT = 0 1 0 .
T
The modified equinoctial orbital elements are a set of orbital elements that are useful for trajectory
analysis and optimization. They are valid for circular, elliptic, and hyperbolic orbits. These
equations exhibit no singularity for zero eccentricity and orbital inclinations equal to 0 and 90
degrees. However, two components of the orbital element set are singular for an orbital inclination
of 180 degrees.
The relationship between direct modified equinoctial and classical orbital elements is defined by the
following definitions
p = a (1 − e 2 )
f = e cos ( + )
g = e sin ( + )
h = tan ( i 2 ) cos
k = tan ( i 2 ) sin
L = + +
where
p= semiparameter
a= semimajor axis
e= orbital eccentricity
i= orbital inclination
= argument of periapsis
= right ascension of the ascending node
= true anomaly
L= true longitude
The relationship between classical and modified equinoctial orbital elements is summarized as
follows:
semimajor axis
p
a=
1 − f 2 − g2
orbital eccentricity
e= f 2 + g2
orbital inclination
page 8
i = 2 tan −1 ( h2 + k 2 )
argument of periapsis
= tan−1 ( g f ) − tan−1 ( k h )
= tan −1 ( k h )
true anomaly
= L − ( + ) = L − tan−1 ( g f )
The mathematical relationships between an inertial state vector and the corresponding modified
equinoctial elements are summarized as follows:
position vector
r
s 2 ( cos L + cos L + 2hk sin L )
2
r = 2 ( sin L − 2 sin L + 2hk cos L )
r
s
2r
( h sin L −k cos L )
s2
velocity vector
1
− 2 ( sin L + 2 sin L − 2hk cos L + g − 2 f h k + 2 g )
s p
1
v = − 2 ( − cos L + 2 cos L + 2hk sin L − f + 2 gh k + 2 f )
s p
2
( h cos L + k sin L + f h + gk )
s2 p
where
2 = h2 − k 2
s2 = 1 + h2 + k 2
p
r=
w
w = 1 + f cos L + g sin L
page 9
The system of first-order modified equinoctial equations of orbital motion are given by
dp 2 p p
p= = t
dt w
df p g
f = = r sin L + ( w + 1) cos L + f t − ( h sin L − k cos L ) n
dt w w
dg p g
g= = − r cos L + ( w + 1) sin L + g t + ( h sin L − k cos L ) n
dt w w
dh p s2 n
h= = cos L
dt 2w
dk p s2 n
k= = sin L
dt 2w
2
dL w 1 p
L= = p + ( h sin L − k cos L ) n
dt p w
where r , t , n are non-two-body perturbations in the radial, tangential and normal directions,
respectively. For a lunar spacecraft, the radial direction is along the geocentric radius vector of the
spacecraft measured positive in a direction away from the gravitational center, the tangential
direction is perpendicular to this radius vector measured positive in the direction of orbital motion,
and the normal direction is positive along the angular momentum vector of the spacecraft’s orbit.
The equations of orbital motion can also be expressed in vector form as follows:
dy
y= = A (y) P + b
dt
where
2 T
w
b = 0 0 0 0 0 p
p
and
page 10
2p p
0 0
w
p p 1 p g
sin L ( w + 1) cos L + f − h sin L − k cos L
w w
− p p p f
cos L ( w + 1) sin L + g h sin L − k cos L
w
A=
p s 2 cos L
0 0
2w
2
p s sin L
0 0
2w
p
0 0 h sin L − k cos L
where ˆir , ˆit and ˆin are unit vectors in the radial, tangential and normal directions. These unit
vectors can be computed from the inertial position vector r and velocity vector v according to
ˆi = r
r
r
ˆi = r v
rv
n
ˆi = ˆi ˆi = ( r v ) r
rv r
t n r
For unperturbed two-body motion, P = 0 and the first five equations of motion are simply
p = f = g = h = k = 0 . Therefore, for two-body motion these modified equinoctial orbital
elements are constant. The true longitude is often called the fast variable of this orbital element set.
g = g N ˆi N − gr ˆir
where
page 11
ˆi = ( )
eˆ N − eˆ TN ˆi r ˆi r
− ( eˆ ˆi ) ˆi
N
eˆ N T
N r r
and
eˆ N = 0 0 1
T
In these equations, the north direction component is indicated by subscript N and the radial direction
component is subscript r.
cos
k
4
Re '
gN = −
r2
Pk J k
k =2 r
k
4
R
gr = − 2 ( k + 1) e Pk J k
r k =2 r
where
= gravitational constant
r = geocentric distance of the spacecraft
Re = equatorial radius of the Earth
= geocentric latitude
J k = zonal gravity coefficient
Pk = k th order Legendre polynomial
For a zonal-only Earth gravity model, the east component is identically zero.
ag = QT g
where Q = ˆi r ˆit ˆi n .
page 12
6 J 2 Re2 (1 − h − k ) ( h sin L − k cos L )
2 2
J2 =−
n
r4
(1 + h 2
+ k )
2 2
Propulsive thrust
T
aT = uˆ
m
where T is the thrust, m is the spacecraft mass and uˆ = ur ut un is the unit pointing thrust vector
expressed in the spacecraft-centered radial-tangential-normal coordinate system. The components
of the unit thrust vector can also be defined in terms of the in-plane pitch angle and the out-of-
plane yaw angle as follows:
ur = sin
ut = cos cos
un = cos sin
Finally, the pitch and yaw angles can be determined from the components of the unit thrust vector
according to
= sin −1 ( ur )
= tan −1 ( un , ut )
The pitch angle is positive above the “local horizontal” and the yaw angle is positive in the direction
of the angular momentum vector.
During the TLI propulsive maneuver, the system of equations of motion also include the thrust
acceleration and the propellant flow rate given by
dm F
m= =
dt g I sp
where F is the thrust, g is the acceleration of gravity, and I sp is the specific impulse. The thrust
acceleration is used to predict the accumulated delta-v and the propellant flow rate is used to predict
the propellant consumed during the TLI propulsive maneuver.
The B-plane
The derivation of B-plane coordinates is described in the classic JPL reports, “A Method of
Describing Miss Distances for Lunar and Interplanetary Trajectories” and “Some Orbital Elements
page 13
Useful in Space Trajectory Calculations”, both by William Kizner. The following diagram
illustrates the fundamental geometry of the B-plane coordinate system.
cos cos
Sˆ = cos sin
sin
where and are the declination and right ascension of the asymptote of the incoming
hyperbola.
The following computational steps summarize the calculation of the predicted B-plane vector from
a moon-centered position vector r and velocity vector v at closest approach.
h
hˆ =
h
page 14
radius rate
rv
r=
r
semiparameter
h2
p=
semimajor axis
r
a=
r v2
−
2
orbital eccentricity
e = 1− p a
true anomaly
p−r
cos =
er
rh
sin =
e
B-plane magnitude
B= pa
fundamental vectors
r v − rr
zˆ =
h
pˆ = cos rˆ − sin zˆ
qˆ = sin rˆ + cos zˆ
S vector
a b
S=− pˆ + qˆ
a 2 + b2 a 2 + b2
B vector
b2 ab
B= pˆ + qˆ
a 2 + b2 a 2 + b2
page 15
T vector
(S , − S x2 ,0 )
2 T
T=
y
S x2 + S y2
R vector
R = S T = ( − S zTy , S zTx , S xTy − S yTx )
T
In this computer program the B-plane coordinates are based on the selenocentric flight conditions at
closest approach.
If the encounter trajectory is not hyperbolic, these coordinates can not be computed and the
software will display zeroes for this information.
This section describes the transformation of coordinates between the Earth mean equator and
equinox of J2000 (EME2000) and lunar mean equator and IAU node of epoch coordinate systems.
This transformation is used to compute the B-plane coordinates at lunar encounter.
A unit vector in the direction of the pole of the moon can be determined from
cos p cos p
pˆ Moon = sin p cos p
sin p
The right ascension and declination of the lunar pole in the EME2000 coordinate system are given
by the following expressions
where T is the time in Julian centuries given by T = ( JD − 2451545.0) / 36525 and JD is the TDB
Julian Date.
page 16
E1 = 125.045 − 0.0529921d
E 2 = 250.089 − 0.1059842d
E 3 = 260.008 + 13.0120009d
E 4 = 176.625 + 13.3407154d
E 6 = 311.589 + 26.4057084d
E 7 = 134.963 + 13.0649930d
E10 = 15.134 − 0.1589763d
E13 = 25.053 + 12.9590088d
where d = JD − 2451545 is the number of days since January 1.5, 2000. These equations are given
in “Report of the IAU/IAG Working Group on Cartographic Coordinates and Rotational Elements
of the Planets and Satellites: 2000”, Celestial Mechanics and Dynamical Astronomy, 82: 83-110,
2002.
The unit vector in the x-axis direction of this selenocentric coordinate system is given by
xˆ = zˆ pˆ Moon
where zˆ = 0 0 1 .
T
yˆ = pˆ Moon xˆ
Finally, the components of the matrix that transforms coordinates from the EME2000 system to the
moon-centered (selenocentric) mean equator and IAU node of epoch system are as follows:
xˆ
M = yˆ
pˆ Moon
The software models the coordinates of the sun and moon using the DE405 algorithm from JPL.
This numerical method and binary data file provide position and velocity vectors of the sun and
moon relative to the Earth mean equator and equinox of J2000. The binary data file is named
de405.bin and must be located in the same directory as the ca_sc2moon program.
page 17
References and Bibliography
“Optimal Interplanetary Orbit Transfers by Direct Transcription”, John T. Betts, The Journal of the
Astronautical Sciences, Vol. 42, No. 3, July-September 1994, pp. 247-268.
“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.
“Optimal Low Thrust Trajectories to the Moon”, John T. Betts and Sven O. Erb, SIAM Journal on
Applied Dynamical Systems, Vol. 2, No. 2, pp. 144-170, 2003.
“Modern Astrodynamics”, Victor R. Bond and Mark C. Allman, Princeton University Press, 1996.
page 18
A MATLAB Script for Propagating Trajectories from the Earth to the Moon
This document is the user’s manual for a MATLAB script called pprop_lunar that can be used to
numerically integrate the geocentric orbital equations of motion of a trajectory from the Earth to the
Moon. This scientific simulation begins at a user-defined epoch and geocentric state vector (position
and velocity vectors) representing the point of trans-lunar injection (TLI) and ends at (1) closest
approach to the Moon, (2) a user-defined Moon-centered (selenocentric) distance, or (3) at a user-
defined final epoch.
All internal calculations and the output provided by the pprop_lunar software are performed in the
metric system. The geocentric equations of motion include the non-spherical gravity effects of the Earth
and Moon, and (optionally) the point-mass gravity of the sun. The option to include the effect of solar
radiation pressure during the trajectory propagation is also provided.
This manual also includes a technical discussion that summarizes the numerical technique and methods
implemented in this computer program. Barycentric Dynamical Time (TDB) is the fundamental time
argument for this simulation and the fundamental solar and lunar ephemeris is based on a JPL
Development Ephemeris such as DE421 or perhaps DE424. This script also uses a MATLAB version of
the Naval Observatory Vector Astrometry Software (NOVAS) library for sidereal time calculations.
The pprop_lunar script will interactively prompt the user for the name of a simulation definition data
file with a window similar to the following;
The file type defaults to names with a *.in filename extension. However, you can select any
compatible ASCII data file by selecting the Files of type: field or by typing the name of the file directly
in the File name: field.
The pprop_lunar software is “data-driven” by a user-created text file. The following is a typical input
file used by this MATLAB script. 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 change the number of lines reserved
for each comment and data item. However, you may change them to reflect your own explanation or
page 1
information. The annotation line also includes the correct units and when appropriate, the valid range of
the input data items. ASCII text input is not case sensitive but must be spelled correctly. In the
following discussion, the actual input file contents are in bold courier font and all explanations are in
times italic font.
The first four lines of any input file are reserved for user comments. These lines are read but ignored by
the software. However the input file must begin with four and only four initial text lines.
**********************************************
* pprop_lunar input data file - pprop_lunar.in
* Earth-to-Moon trajectory propagation example
**********************************************
The second program input is the difference between ephemeris time (Barycentric Dynamical Time) and
Universal Coordinated Time (UTC) in seconds.
ET-UTC (seconds)
65.184
This next option specifies the type of final conditions of the propagated trajectory. Option 1 propagates
to closest approach at the Moon, option 2 propagates to a user-defined selenocentric distance, and
option 3 propagates to a user-defined final epoch.
type of propagation final condition
1 = lunar closest approach
2 = user-defined selenocentric distance
3 = user-defined final epoch
-----------------------------
1
The next two sets of inputs define the calendar date and UTC time of the final epoch for option 3
described above. Be sure to include all four digits of the calendar year.
user-defined final calendar date
(1 <= month <= 12, 1 <= day <= 31, year = all digits!)
------------------------------------------------------
9, 20, 2008
The next input defines the user-defined selenocentric distance for program option 2 described above.
user-defined selenocentric distance (kilometers)
10000.0
The next two inputs define the calendar date and UTC at the initial time.
initial calendar date
(1 <= month <= 12, 1 <= day <= 31, year = all digits!)
------------------------------------------------------
9, 15, 2008
initial UTC
(0 <= hours <= 24, 0 <= minutes <= 60, 0 <= seconds <= 60)
----------------------------------------------------------
9, 54, 1.015
page 2
The next three data items define the x, y, and z components of the geocentric position vector of the
trajectory at the initial time.
initial geocentric position vector components
(mean equator and equinox j2000 - kilometers)
---------------------------------------------
-3358.54711130
-4871.14690579
-2840.95894469
The next three data items define the x, y, and z components of the geocentric velocity vector of the
trajectory at the initial time. The position and velocity vectors must be specified relative to the Earth
mean equator and equinox of J2000 (EME2000) coordinate system.
initial geocentric velocity vector components
(mean equator and equinox j2000 - kilometers/second)
----------------------------------------------------
9.36637513219
-5.17963813841
-2.19458266670
The next integer allows the user to include the point-mass gravity of the sun during the trajectory
propagation. To activate this option, the input should be set to 1. Otherwise, the input should be 0.
include solar point-mass perturbation (1 = yes, 0 = no)
-------------------------------------------------------
1
The name of the ASCII data file containing the Earth gravity model data is specified in the next line.
Please see the Technical Discussion section later in this document for a description and format of the
data in this file.
name of Earth gravity model data file
-------------------------------------
egm96.dat
The order (zonals) of the Earth gravity model is an integer defined in the next line.
order of the gravity model (zonals)
-----------------------------------
8
The degree (tesserals) of the Earth gravity model is an integer defined in this next line.
degree of the gravity model (tesserals)
---------------------------------------
8
The name of the ASCII data file containing the lunar gravity model data is specified in the next line.
name of lunar gravity model data file
-------------------------------------
lp150q.dat
The order (zonals) of the lunar gravity model is an integer defined in the next line.
order of the gravity model (zonals)
-----------------------------------
8
page 3
The degree (tesserals) of the lunar gravity model is an integer defined in this next line.
degree of the gravity model (tesserals)
---------------------------------------
8
The next series of inputs define the characteristics used for solar radiation pressure perturbation
calculations. These three items include the reference mass, reference cross-sectional area, and
reflectivity coefficient. To exclude this perturbation, input a mass of zero.
mass (kilograms; input 0 to ignore SRP calculations)
----------------------------------------------------
2000.0d0
SRP reference area (square meters)
----------------------------------
18.75
Important utility and astrodynamics constants required by this script are defined in a MATLAB function
called om_constants.m. The following is a typical constants and models function. Please note the
proper units for each data item.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% pprop_lunar astrodynamic and utility constants
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
global aunit clight psr emu req omega mmu req_moon smu
aunit = 149597870.691;
clight = 299792458.0;
psr = 1366.1;
emu = 398600.4415;
req = 6378.1363;
omega = 7.292115486e-5;
mmu = 4902.800238;
req_moon = 1738.0;
page 4
% sun gravitational constant (km**3/sec**2)
smu = 132712440040.9446;
Script example
The following is the program output for a typical closest approach simulation. Explanatory text is
provided in italic times Roman font. Appendix A contains a brief explanation of these data items.
The first part of the output summarizes the file names of the data used in the simulation along with the
type of propagation final condition.
page 5
sma (km) eccentricity inclination (deg) argper (deg)
-2.26126009998755e+05 +2.62734917647342e+00 +9.01741981723714e+01 +1.61033560890649e+02
This section of the display summarizes the time and conditions at closest approach to the Moon. It
includes both the selenocentric coordinates and the B-plane coordinates of the trajectory with respect to
a Moon-centered mean equator and IAU node of epoch coordinate system.
time and selenocentric conditions at lunar closest approach
(lunar mean equator and IAU node of epoch)
------------------------------------------
The last part of the simulation displays the geocentric coordinates of the Moon at the time of closest
approach along with the propagation duration in hours and days.
time and geocentric conditions of the Moon at closest approach
(Earth mean equator and equinox of J2000)
-----------------------------------------
page 6
calendar date 19-Sep-2008
The pprop_lunar script will also create a graphics display of the geocentric trajectory. Please note
that the coordinates are displayed in the units of Earth radii (ER). The transfer trajectory is red and the
Moon’s orbit is blue with a small dot every four hours. The blue asterisk symbol is the beginning of the
trajectory and the red asterisk is the spacecraft location at the final event. A three-dimensional plot of
the Earth is labeled with an EME2000 coordinate system. The x-axis of this system is red, the y-axis is
green and the z-axis blue. The following is the graphics display for this example.
page 7
If the trajectory passes within 64,000 kilometers of the Moon, the pprop_lunar script will also create a
graphics display of the selenocentric trajectory. This threshold can be changed by the user in line 466 of
the main script source code which reads if (norm(rsc) <= 64000.0). Please note that the
coordinates are displayed in the units of the Moon’s radius (MR). The blue asterisk symbol is the
beginning of the selenocentric trajectory as it enters the lunar sphere-of-influence (SOI). A three-
dimensional plot of the Moon is labeled with a lunar mean equator and IAU node of epoch coordinate
system. The x-axis of this system is red, the y-axis is green and the z-axis blue.
Trajectory image files are saved to disk in both encapsulated, color Postscript format and MATLAB fig
format. The disk file names for the geocentric trajectory are pprop_lunar1.eps, and
pprop_lunar1.fig. The disk file names for the selenocentric trajectory are pprop_lunar2.eps,
and pprop_lunar2.fig. These files are created with MATLAB source code similar to
print('-depsc', 'pprop_lunar2.eps');
saveas(h, 'pprop_lunar2.fig');
The interactive features of MATLAB graphics allow the user to re-load and manipulate the fig version
of the trajectory display. These capabilities allow the user to interactively find the best viewpoint as
well as verify basic three-dimensional geometry of the trajectory.
Technical Discussion
The orbital motion is modeled with respect to the Earth mean equator and equinox of J2000 (EME2000)
coordinate system. The following figure illustrates the geometry of the EME2000 coordinate system.
The origin of this Earth-centered-inertial (ECI) inertial coordinate system is the geocenter and the
fundamental plane is the Earth’s mean equator. The z-axis of this system is normal to the Earth’s mean
equator at epoch J2000, the x-axis is parallel to the vernal equinox of the Earth’s mean orbit at epoch
J2000, and the y-axis completes the right-handed coordinate system. The epoch J2000 is the Julian Date
2451545.0 which corresponds to January 1, 2000, 12 hours Terrestrial Time (TT).
page 8
Figure 1. Earth mean equator and equinox of J2000 coordinate system
In this computer program the heliocentric coordinates of the sun, Moon and planets are based on a JPL
Development Ephemeris such as DE421 or DE424. These coordinates are provided in the Earth mean
equator and equinox of J2000 coordinate system (EME2000). The binary ephemeris files, located at
www.cdeagle.com, were created for use on Windows-compatible computers. However, they have also
been tested on an Intel-based MacBook Air. For other platforms, you may need to create binary files
specific to that system. Information and computer programs for creating these files can be found at the
JPL solar system FTP site located at ftp://ssd.jpl.nasa.gov/pub/eph/planets/.
This section describes the transformation of coordinates between the Earth mean equator and equinox of
J2000 (EME2000) and lunar mean equator and IAU node of epoch coordinate systems. This
transformation is used to compute the B-plane coordinates, state vector and classical orbital elements at
lunar encounter. The following diagram illustrates the orientation of the lunar mean equator and IAU
node of epoch coordinate frame.
Figure 2. Lunar mean equator and IAU node of epoch coordinate system
page 9
A unit vector in the direction of the pole of the Moon can be determined from
cos p cos p
pˆ Moon sin p cos p
sin p
where p and p are the right ascension and declination of the lunar pole. The right ascension and
declination of the lunar pole in the EME2000 coordinate system are given by the following expressions
where T is the time in Julian centuries given by T JD 2451545.0 / 36525 and JD is the Dynamical
Barycentric Time (TDB) Julian Date.
where d JD 2451545 is the number of days since January 1.5, 2000. These equations are given in
“Report of the IAU Working Group on Cartographic Coordinates and Rotational Elements: 2009”,
Celestial Mechanics and Dynamical Astronomy, 109: 101-135, 2011.
The unit vector in the x-axis direction of this selenocentric coordinate system is given by
xˆ zˆ pˆ Moon
where zˆ 0 0 1 . The unit vector in the y-axis direction can be determined using
T
yˆ pˆ Moon xˆ
Finally, the components of the matrix that transforms coordinates from the EME2000 system to the
Moon-centered (selenocentric) mean equator and IAU node of epoch system are as follows:
M xˆ yˆ pˆ Moon
T
page 10
Propagating the geocentric trajectory
The pprop_lunar MATLAB script implements a special perturbation technique which numerically
integrates the vector system of second-order, nonlinear differential equations of motion given by
where
t dynamical time
r inertial geocentric position vector
a g acceleration due to Earth gravity
a s acceleration due to the sun
a m acceleration due to the Moon
a srp acceleration due to solar radiation pressure
The software uses a spherical harmonic representation of the Earth’s geopotential function given by
n R
n n
R
r, , C Pn0 u Pnm u Snm sin m Cnm cos m
0
n
r r n 1 r r n 1 m1 r
where is the geocentric latitude, is the geocentric east longitude and r r x 2 y 2 z 2 is the
geocentric distance. In this expression the S’s and C’s are harmonic coefficients of the geopotential, and
the P’s are associated Legendre polynomials of degree n and order m with argument u sin .
The software calculates the acceleration due to the Earth’s gravity field with a vector equation derived
from the gradient of the potential function expressed as
a g r, t r, t
This acceleration vector is a combination of pure two-body or point mass gravity acceleration and the
gravitational acceleration due to higher order nonspherical terms in the Earth’s geopotential. In terms of
the Earth’s geopotential , the inertial rectangular cartesian components of the acceleration vector are
as follows:
1 z 1
x x 2 y
r r r 2 x 2 y 2 x y 2
1 x2 y2
z z
r r r 2
page 11
The three partial derivatives of the geopotential with respect to r, , are given by
1 N R
n
r r r n 2 r m 0
N R
n n
r n2 r
C
m 0
m
n cos m Snm sin m Pnm1 sin m tan Pnm sin
N R
n n
r n2 r
mS
m 0
m
n cos m Cnm sin m Pnm sin
where
R radius of the Earth
r geocentric distance
Snm , Cnm harmonic coefficients
geocentric declination sin 1 z r
longitude g
right ascension tan 1 y x
g right ascension of Greenwich
The right ascension is measure positive east of the vernal equinox, longitude is measured positive east of
Greenwich, and declination is positive above the Earth’s equator and negative below.
For m 0 the coefficients are called zonal terms, when m n the coefficients are sectorial terms, and
for n m 0 the coefficients are called tesseral terms.
The Legendre polynomials with argument sin are computed using recursion relationships given by:
1
Pn0 sin 2n 1 sin Pn01 sin n 1 Pn02 sin
n
Pnn sin 2n 1 cos Pnn11 sin , m 0, m n
Pnm sin Pnm2 sin 2n 1 cos Pnm11 sin , m 0, m n
page 12
sin m 2 cos sin m 1 sin m 2
cos m 2 cos cos m 1 cos m 2
m tan m 1 tan tan
The gravity model data files included with this MATLAB script are simple space delimited ASCII data
files. The following is a portion of a typical gravity model data file. In this file, column one is the
degree index, column two is the model order index, and columns three and four are the corresponding
un-normalized gravity coefficients (zonals and tesserals, respectively).
2 0 -0.10826300D-02 0.00000000D+00
3 0 0.25321531D-05 0.00000000D+00
4 0 0.16109876D-05 0.00000000D+00
5 0 0.23578565D-06 0.00000000D+00
6 0 -0.54316985D-06 0.00000000D+00
7 0 0.33237640D-06 0.00000000D+00
8 0 0.17721040D-06 0.00000000D+00
9 0 0.14459876D-06 0.00000000D+00
10 0 0.23339780D-06 0.00000000D+00
11 0 -0.27870829D-06 0.00000000D+00
12 0 0.17036617D-06 0.00000000D+00
13 0 0.25024428D-06 0.00000000D+00
Gravity model coefficients are often published in normalized form. The relationship between
normalized Cl ,m , Sl ,m and un-normalized gravity coefficients Cl ,m , Sl ,m is given by the following
expression:
l m ! Cl ,m
12
Cl ,m 1
Sl ,m 2 m 0 2l 1 l m ! Sl ,m
r r
am r, t m m sc 3 em 3
r rem
m sc
where
m gravitational constant of the Moon
rm sc position vector from the Moon to the trajectory
rem position vector from the Earth to the Moon
The first term within the bracket is called the direct contribution and the second term is called the
indirect contribution. The software uses a spherical harmonic representation of the Moon’s
selenopotential function to calculate the direct contribution. The terms in the potential are as follows
page 13
R radius of the moon
r selenocentric distance of the satellite
Snm , Cnm harmonic coefficients
selenocentric declination of the satellite sin 1 z r
longitude of the satellite pm
right ascension of the satellite tan 1 y x
pm right ascension of the selenocentric prime meridian
In the pprop_lunar software, right ascension is measure positive east of the vernal equinox, longitude
is measured positive east of the lunar prime meridian, and declination is positive above the moon’s
equator and negative below.
According to “Report of the IAU/IAG Working Group on Cartographic Coordinates and Rotational
Elements: 2010”, the transformation matrix from the Earth mean equator and equinox of J2000
(EME2000) coordinate system to the moon-centered, body-fixed lunar principal axis (PA) system is
given by the following (3-1-3) rotation sequence;
M EME 2000 Rz Rx Rz
PA
In this equation, is the angle along the ICRF (International Celestial Reference Frame) equator, from
the ICRF x-axis to the ascending node of the lunar equator, is the inclination of the lunar equator to
the ICRF equator, and is the angle along the lunar equator from the node to the lunar prime meridian.
These three Euler angles represent the numerically integrated physical librations of the Moon.
The principal axis frame is aligned with the three maximum moments of inertia of the Moon. The
LP150Q lunar gravity model was developed using this frame.
The relationship between these angles and the classical IAU (International Astronomical Union)
orientation angles is
90
90
W
In this MATLAB script, the lunar libration angles are obtained from the same JPL binary ephemeris
used to compute the solar and lunar coordinates. Developmental Ephemeris DE421 is considered the
best currently available lunar ephemeris and Chebyshev polynomial representations of the Euler angles
and their rates in the PA system are included in the DE421 ephemeris file.
After the non-spherical lunar gravity vector is computed in the principal axis system, it is transformed
back to the EME2000 system using the transpose of the M EME 2000 matrix given earlier and included in
PA
page 14
Geocentric acceleration due to the point-mass gravity of the sun
r r
a s r, t s s sc 3 es 3
r res
s sc
where
s gravitational constant of the sun
rs sc position vector from the sun to the trajectory
re s position vector from the Earth to the sun
3 3qk qk2
f qk qk 3
1 1 qk
where
r T r 2sk
qk
sTk sk
n
k
r r f qk s k
k 1 d k3
In these equations, s k is the vector from the primary body to the secondary body, k is the gravitational
constant of the secondary body and dk r sk , where r is the position vector relative to the primary
body. The derivation of the f q functions is described in Section 8.4 of “An Introduction to the
Mathematics and Methods of Astrodynamics, Revised Edition”, by Richard H. Battin, AIAA Education
Series, 1999.
The first-order system of equations required by this computer program can be created from the second-
order system by the method of order reduction. With the following definitions,
y1 rx y2 ry y3 rz
y4 v x y5 v y y6 v z
where vx , v y , vz are the velocity vector components, the first-order system of differential equations is
given by
page 15
y1 v x y2 v y y3 v z
y4 a x e a x m ax s ax srp
y5 a y e a y m a y s a y srp
y6 az e az m az s az srp
In these equations, ax e , a y e and az e are the x, y and z gravitational contributions of the Earth,
ax m , a y m and az m are the x, y and z gravitational contributions of the Moon, ax s , a y s and az s are the
x, y and z gravitational contributions of the sun, and ax srp , a y srp and az srp are the x, y and z
gravitational contributions due to solar radiation pressure.
We can define a solar radiation constant as a function of its size, mass and surface reflective properties
according to the equation:
A
Csrp Ps a 2
m
where
reflectivity constant
Ps solar radiation pressure constant
a astronomical unit
A surface area normal to the incident radiation
m mass
The reflectivity constant is a dimensionless number between 0 and 2. For a perfectly absorbent body
1 , for a perfectly reflective body 2 , and for a translucent body 1 . For example, the
reflectivity constant for an aluminum surface is approximately 1.96.
The value of the solar radiation pressure on a perfectly absorbing surface at a distance of one
Astronomical Unit from the Sun is
G Newton
Ps 1
c meters 2
where G1 is the solar flux at a distance of one Astronomical Unit in watts per square meter, and c is the
speed of light in meters per second. The values of the solar flux and speed of light used during a
simulation are defined by the user in the constants and models MATLAB function.
rsc s
a srp csrp 3
rsc s
page 16
where
rsc = geocentric, inertial position vector
re s = geocentric, inertial position vector of the sun
rsc s rsc re s
During the geocentric integration process, the software must determine if the trajectory is in Earth
shadow or sunlight. Obviously, there can be no solar radiation perturbation during Earth eclipse of the
orbit. The software makes use of a shadow parameter to determine eclipse conditions. This parameter
is defined by the following expression:
rsc res
sign(rsc res )
re s
where rsc is the geocentric, inertial position vector of the trajectory and re s is the geocentric, inertial
position vector of the sun relative to the trajectory.
The critical values of the shadow parameter for the penumbra (subscript p) and umbra part (subscript u)
of the shadow are given by:
p rsc sin p
u rsc sin u
p p
u u
They are the angles between the geocentric anti-sun vector and the vector to the trajectory at the time of
shadow entrance or exit.
re
sin 1
rsc
rs re
p sin 1
re s
rs re
u sin 1
re s
page 17
where
If the condition u p is true, the geocentric trajectory is in the penumbra part of the Earth’s
shadow, and if the inequality 0 u is true, the trajectory is in the umbra part of the shadow. If the
absolute value of the shadow parameter is larger than the penumbra value, the trajectory is in full
sunlight. The shadow calculations used in this MATLAB script also assume the Earth’s atmosphere
increases the radius of the Earth by 90 kilometers.
Closest approach is determined during the numerical integration of the geocentric equations of motion
by finding the time at which the flight path angle relative to the Moon is essentially zero. This mission
constraint is computed as follows
rv
sin 0
rv
where r and v are the Moon-centered position and velocity vectors, respectively. Closest approach is
predicted using the event prediction capability of the built-in ode45 MATLAB function.
The following is the MATLAB source code for the function that determines closest approach.
% input
% output
% NOTE: rm2sc and vm2sc => Moon mean equator and IAU node of epoch
% re2sc and ve2sc => Earth mean equator and equinox of J2000
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
page 18
tend = 7.0 * 86400.0;
[t, ysol, tevent, yevent, ie] = ode45(@pprop_eqm, [0 tend], [ri vi], options);
re2sc = yevent(1:3);
ve2sc = yevent(4:6);
rmoon = svmoon(1:3);
vmoon = svmoon(4:6);
tmatrix = mm2000(jdtdb_ca);
The following is the MATLAB function that evaluates the current value of the selenocentric flight path
angle required by the findca function.
% required by pprop_lunar.m
% input
% output
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
global jdtdb_tli
page 19
% form the selenocentric position and velocity
tmatrix = mm2000(jdate);
isterminal = 1;
direction = [];
The trajectory conditions at the boundary of a user-defined selenocentric distance are determined during
the numerical integration of the geocentric equations of motion by finding the time at which the
difference between the selenocentric distance and the user-defined value is essentially zero. This
mission constraint is computed as follows
r rsc ruser 0
where rsc is the selenocentric position vector of the trajectory and ruser is the user-specified value of the
selenocentric distance. Selenocentric distance conditions are also predicted using the event prediction
capability of the built-in ode45 MATLAB function. The following is the source code for the function
that performs this calculation.
% input
% output
% NOTE: rm2sc and vm2sc => Moon mean equator and IAU node of epoch
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
page 20
options = odeset('RelTol', 1.0e-10, 'AbsTol', 1.0e-10, 'Events', @rm_event);
[t, ysol, tevent, yevent, ie] = ode45(@pprop_eqm, [0 tof], [ri vi], options);
re2sc = yevent(1:3);
ve2sc = yevent(4:6);
rmoon = svmoon(1:3);
vmoon = svmoon(4:6);
tmatrix = mm2000(jdtdb_rm);
The following is the MATLAB source code for the function that evaluates the difference between the
current selenocentric distance and the user-defined value defined by rmag_user.
% required by pprop_lunar.m
% input
% output
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
page 21
jdate = jdtdb_tli + t / 86400.0;
rmoon = svmoon(1:3);
% selenocentric distance
isterminal = 1;
direction = [];
For this program option, the software simply integrates the geocentric equations of motion from the
initial time to the user-defined final time.
The B-plane
The derivation of B-plane coordinates is described in the classic JPL reports, “A Method of Describing
Miss Distances for Lunar and Interplanetary Trajectories” and “Some Orbital Elements Useful in Space
Trajectory Calculations”, both by William Kizner. The following diagram illustrates the fundamental
geometry of the B-plane coordinate system.
page 22
The arrival asymptote unit vector Ŝ is given by
cos cos
Sˆ cos sin
sin
where and are the declination and right ascension of the asymptote of the incoming hyperbola at
lunar encounter.
The following computational steps summarize the calculation of the B-plane vector from a Moon-
centered position vector r and velocity vector v evaluated at closest approach to the Moon.
radius rate
r r v r
semiparameter
p h2
semimajor axis
r
a
r v2
2
orbital eccentricity
e 1 p a
true anomaly
pr rh
cos sin
er e
B-plane magnitude
B pa
fundamental vectors
r v rr
zˆ
h
page 23
S vector
a b
S pˆ qˆ
a 2 b2 a 2 b2
B vector
b2 ab
B pˆ qˆ
a 2 b2 a 2 b2
T vector
S , S ,0
2 2 T
T
y x
S x2 S y2
R vector
R S T SzTy , SzTx , S xTy S yTx
T
Time systems
Terrestrial Time, TT
Terrestrial Time is the time scale that would be kept by an ideal clock on the geoid - approximately, sea
level on the surface of the Earth. Since its unit of time is the SI (atomic) second, TT is independent of
the variable rotation of the Earth. TT is meant to be a smooth and continuous “coordinate” time scale
independent of Earth rotation. In practice TT is derived from International Atomic Time (TAI), a time
scale kept by real clocks on the Earth's surface, by the relation TT = TAI + 32s.184. It is the time scale
now used for the precise calculation of future astronomical events observable from Earth.
page 24
TDB TT 0.001657sin 628.3076T 6.2401
0.000022sin 575.3385T 4.2970
0.000014sin 1256.6152T 6.1969
0.000005sin 606.9777T 4.0212
0.000005sin 52.9691T 0.4444
0.000002sin 21.3299T 5.5431
0.000010T sin 628.3076T 4.2490
In this equation, the coefficients are in seconds, the angular arguments are in radians, and T is the
number of Julian centuries of TT from J2000; T = (Julian Date(TT) – 2451545.0) / 36525.
page 25
Algorithm and Modeling Resources
(2) “Earth-Moon Trajectories”, JPL Technical Report No. 32-503, May 1, 1964.
(3) “Three-Dimensional Lunar Trajectories”, V. A. Egorov, Mechanics of Space Flight Series, Israel
Program for Scientific Translations, Jerusalem 1969.
(4) “Circumlunar Trajectory Calculations”, MIT Instrumentation Laboratory Report R-353, April 1962.
(5) “Optimal Low Thrust Trajectories to the Moon”, John T. Betts and Sven O. Erb, SIAM Journal on
Applied Dynamical Systems, Vol. 2, No. 2, pp. 144-170, 2003.
(6) “Integrated Algorithm for Lunar Transfer Trajectories Using a Pseudostate Technique”, R. V.
Ramanan, AIAA Journal of Guidance, Control and Dynamics, Vol. 25, No. 5, September-October 2002,
pp. 946-952.
(7) “Nonimpact Lunar Transfer Trajectories Using the Pseudostate Technique”, R. V. Ramanan and V.
Adimurthy, AIAA Journal of Guidance, Control and Dynamics, Vol. 28, No. 2, March-April 2005, pp.
217-225.
(8) “Injection Conditions for Lunar Trajectories”, R. Kolenkiewicz and W. Putney, NASA TM X-55390,
November 1965.
(9) “Coplanar Three-Body Trans-Earth Lunar Trajectory Simulation Methodology”, H. Ikawa, AIAA
88-0381, AIAA 26th Aerospace Sciences Meeting, Reno, Nevada, January 11-14, 1988.
(10) “Lunar Constants and Models Document”, JPL D-32296, September 23, 2005.
(11) NOVAS (Naval Observatory Vector Astrometry Subroutines) software package, version 3.1, U.S.
Naval Observatory, March 2011.
(13) “The Planetary and Lunar Ephemeris DE 421”, W. M. Folkner, J. G. Williams, D. H. Boggs, JPL
IOM 343R-08-003, 31-March-2008.
(14) “Report of the IAU/IAG Working Group on Cartographic Coordinates and Rotational Elements of
the Planets and Satellites: 2009”, Celestial Mechanics and Dynamical Astronomy, 109: 101-135, 2011.
(16) W. Kizner, “A Method of Describing Miss Distances for Lunar and Interplanetary Trajectories”,
Publication 674, Jet Propulsion Laboratory, August 1, 1959.
(17) R. H. Battin, An Introduction to the Mathematics and Methods of Astrodynamics, AIAA, 1987.
page 26
APPENDIX A
Contents of the Simulation Summary
This appendix is a brief summary of the information contained in the simulation summary screen display
produced by the pprop_lunar MATLAB script.
UTC julian date = Julian Date of trajectory event on UTC time scale
TDB julian date = Julian Date of trajectory event on TDB time scale
arglat (deg) = argument of latitude in degrees. The argument of latitude is the sum of
true anomaly and argument of perigee.
vmag (kps) = scalar magnitude of the velocity vector in kilometers per second
page 27
rasc-asymptote = right ascension of incoming asymptote at the Moon in degrees
flight path angle = flight path angle relative to the Moon in degrees
right ascension = EME2000 right ascension of the Moon at the final event in degrees
propagation duration = trajectory time from the initial conditions to the final user-
defined event in both hours and days
page 28
APPENDIX B
Additional Script Examples
This appendix summarizes typical output data created by the pprop_lunar software for the other two
program options. The initial epoch and state vector for both examples are the same as the close
approach example given earlier in this document.
The first output summary is for the user-defined selenocentric distance option. The user-defined Moon
relative distance for this example is 10,000 kilometers.
page 29
raan (deg) true anomaly (deg) arglat (deg) period (days)
+2.01442461168241e+02 +1.78813508839874e+02 +1.41161838993003e+02 +9.58867244518236e+00
page 30
Here’s the selenocentric graphics display for this example.
The second example exercises the user-defined final epoch option. The final epoch for this case is about
four hours past closest approach.
page 31
calendar date 20-Sep-2008
page 32
rx (km) ry (km) rz (km) rmag (km)
+1.95160587951349e+05 +2.72638429282301e+05 +1.53827075478875e+05 +3.68893124578677e+05
page 33
A Computer Program for Propagating Spacecraft Trajectories from Earth to the Moon
This document is the user’s manual for a Windows compatible executable computer program called
pprop_lunar that can be used to numerically integrate the geocentric orbital equations of motion of a
spacecraft traveling from the Earth to the Moon. This scientific simulation begins at a user-defined
epoch and state vector somewhere along the trans-lunar trajectory and ends at (1) closest approach to the
moon, (2) a user-defined lunar (selenocentric) distance, or (3) at a user-defined epoch.
This manual also includes a technical discussion that summarizes the numerical technique and methods
implemented in this computer program. Barycentric Dynamical Time (TDB) is the fundamental time
argument for this simulation and the fundamental solar, lunar and planetary ephemeris is DE421. This
computer program also uses version 3.1 of the Naval Observatory Vector Astrometry Software
(NOVAS) library for coordinate conversions. The software was created using Intel Visual Fortran.
All internal calculations and the output provided by the pprop_lunar software are performed in the
metric system. The geocentric equations of spacecraft motion include the non-spherical gravity effects
of the Earth and the point-mass gravity of the moon and (optionally) the point-mass gravity of the sun
and planets. The option to include the effect of solar radiation pressure in the trans-lunar trajectory is
also provided.
The pprop_lunar software is “data-driven” by a user-created text file. The following is a typical input
file used by this computer program. 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 change the number of lines reserved
for each comment and data item. However, you may change them to reflect your own explanation or
information. 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. In the following
discussion the actual input file contents are in courier font and all explanations are in times italic font.
The first four lines of any input file are reserved for user comments. These lines are ignored by the
software. However the input file must begin with four and only four initial text lines.
**********************************************
* pprop_lunar input data file - pprop_lunar.in
* Earth-to-Moon trajectory example
**********************************************
The first program input is the name of a constants and models data file. This ASCII data file contains
user-defined astrodynamic constants and other information.
name of constants and models data file
--------------------------------------
pprop_lunar_cm.dat
The following is a typical constants and models data file. Do not delete any of these annotation lines or
increase or decrease the number of lines reserved for each comment or data item. Also, please note the
proper units for each data item.
********************************************
* pprop_lunar constants and models data file
********************************************
page 1
astronomical unit (kilometers)
------------------------------
149597870.691d0
The second program input is the difference between ephemeris time (ET) and Universal Coordinated
Time (UTC) in seconds.
ET-UTC (seconds)
65.184d0
This next option specifies the type of final conditions of the propagated trajectory. Option 1 propagates
to closest approach to the Moon, option 2 propagates to a user-defined selenocentric distance, and
option 3 propgates to a user-defined final epoch.
type of propagation final condition
1 = lunar closest approach
2 = user-defined lunar distance
3 = user-defined final epoch
-----------------------------
1
The next two sets of inputs define the calendar date and UTC time of the final epoch for option 3
described above. Be sure to include all four digits of the calendar year.
user-defined final calendar date
(1 <= month <= 12, 1 <= day <= 31, year = all digits!)
------------------------------------------------------
9, 20, 2008
The next input defines the final user-defined lunar distance for program option 2 described above.
user-defined lunar distance (kilometers)
10000.0d0
page 2
The next two inputs define the calendar date and UTC at the initial time.
initial calendar date
(1 <= month <= 12, 1 <= day <= 31, year = all digits!)
------------------------------------------------------
9, 15, 2008
The next three data items define the x, y, and z components of the geocentric position vector of the
spacecraft at the initial time.
Earth departure geocentric position vector components
(mean equator and equinox j2000 - kilometers)
---------------------------------------------
-0.335854711130D+04
-0.487114690579D+04
-0.284095894469D+04
The next three data items define the x, y, and z components of the geocentric velocity vector of the
spacecraft at the initial time. The position and velocity vectors must be specified relative to the Earth
mean equator and equinox of J2000 (EME2000) coordinate system.
Earth departure geocentric velocity vector components
(mean equator and equinox j2000 - kilometers/second)
----------------------------------------------------
0.936637513219D+01
-0.517963813841D+01
-0.219458266670D+01
The next two integers allow the user to specify what types of third body point-mass gravity perturbations
are included during the geocentric trajectory propagation. To activate an option, the input should be
set to 1. Otherwise, the input should be 0.
include solar point-mass perturbation (1 = yes, 0 = no)
-------------------------------------------------------
1
The name of the ASCII data file containing the Earth gravity model data is specified in the next line.
name of Earth gravity model data file
egm96.dat
The order (zonals) of the Earth gravity model is an integer defined in the next line.
order of the gravity model (zonals)
8
The degree (tesserals) of the Earth gravity model is an integer defined in this next line.
degree of the gravity model (tesserals)
8
page 3
The next series of inputs define the spacecraft characteristics used for solar radiation pressure
perturbation calculations. These three items include the spacecraft’s mass, reference cross-sectional
area, and reflectivity coefficient. To exclude this perturbation, input a spacecraft mass of zero.
spacecraft mass (kilograms; input 0 to ignore SRP calculations)
---------------------------------------------------------------
0.0d0
This next text input is the name of the data file that contains the geocentric flight conditions of the
spacecraft.
name of geocentric flight conditions data file
----------------------------------------------
pprop_lunar_geo.csv
The next input is the step size for the information in the geocentric data file.
step size for geocentric flight conditions data file (minutes)
--------------------------------------------------------------
10.0
This next text input is the name of the data file that contains the selenocentric flight conditions of the
spacecraft.
name of selenocentric flight conditions data file
-------------------------------------------------
pprop_lunar_sel.csv
The next input is the step size for the information in the selenocentric data file.
step size for selenocentric flight conditions data file (minutes)
-----------------------------------------------------------------
10.0
The final input is the user-defined value for the selenocentric distance at which the simulation will start
capturing the selenocentric flight conditions.
selenocentric distance to begin creating data file (kilometers)
---------------------------------------------------------------
50000.0
Program execution
The pprop_lunar computer program can be executed by typing the following from a DOS command
line
pprop_lunar input_file
where input_file is the name of the input data file, including the file name extension.
page 4
If the user types pprop_lunar without a file name, the software will request a file name with the
following interactive prompt,
please input the name of the simulation definition file
At this point the user should provide a compatible file name, complete with extension.
To create a DOS command window in Windows 7, select start, then All Programs, then Accessories
and finally Command Prompt. The size, font and other characteristics of the screen can be controlled
by the user with the c:\ icon in the upper left corner of the window. To log into the subdirectory created
during the installation of the Fortran executable and support files, type root:\ and then cd subdirectory
from the DOS command line where root is the name of the root directory, usually c:, and subdirectory is
the name of the subdirectory created by the user. The DOS command line prompt looks similar to
C:\pprop_lunar>_.
Program example
The following is the program output for a typical simulation. Explanatory text is provided in italic times
Roman font. Appendix A contains a brief explanation of these data items.
The first part of the output summarizes the file names of the data used in the simulation.
program pprop_lunar
-------------------
DE421 ephemeris
The next part of the output summarizes the geocentric initial time and flight conditions.
initial time and flight conditions
(geocentric Earth mean equator and equinox of J2000)
----------------------------------------------------
page 5
rx (km) ry (km) rz (km) rmag (km)
-.335854711130D+04 -.487114690579D+04 -.284095894469D+04 0.656345630000D+04
This section of the display summarizes the time and conditions at closest approach to the Moon. It
includes both the EME2000 geocentric state along with the selenocentric coordinates and the B-plane
coordinates of the spacecraft with respect to a Moon-centered mean equator and IAU node of epoch
coordinate system.
time and conditions at lunar closest approach
(geocentric Earth mean equator and equinox of J2000)
----------------------------------------------------
page 6
vx (kps) vy (kps) vz (kps) vmag (kps)
0.130806368237D+01 -.864539484913D+00 -.189545707588D+01 0.245992208100D+01
The pprop_lunar computer program will also create two comma-separated-variable (csv) data files
with filenames and step sizes defined by the user. The first file contains the geocentric flight conditions
of the spacecraft and the second file consists of the selenocentric flight conditions. A summary of the
information contained in these files can be found in Appendix A.
page 7
The pprop_lunar software suite also includes two interactive MATLAB scripts that can be used to
create three-dimensional geocentric and selenocentric graphics of the solution. The script that creates
selenocentric graphics is called lplt1.m and the script that displays geocentric graphics is called
lplot2.m. Each script will prompt the user for the name of a flight conditions data file. The graphics
data is displayed at the user-defined step sizes provided in the input file. A plot step size of ten minutes
is recommended. However, for zoomed plots of either the geocentric or selenocentric trajectory, smaller
plot step sizes will create “smoother” trajectory displays.
Important note!!
You must delete the first or “header” line of the solution file in order for the MATLAB scripts to work.
These scripts use the MATLAB csvread function to read the data file which can only contain comma-
separated-variable numerical data.
The following is a plot of the geocentric transfer trajectory and the Moon’s orbit for this example.
Please note that the coordinates are displayed in the units of Earth radii (ER). The blue asterisk symbol
is the beginning of the trajectory and the red asterisk is the spacecraft location at the final event. The x-
axis of this EME2000 coordinate system is red, the y-axis green and the z-axis blue.
The interactive graphic features of MATLAB will allow the user to rotate and “zoom” the displays in
and out. These capabilities allow the user to interactively find the “best” viewpoint as well as verify the
basic orbital geometry of the geocentric and selenocentric trajectories.
The following is a plot of the seleocentric or Moon-centered trajectory for this example. Please note that
the coordinates are displayed in the units of the Moon’s radius (MR). The blue asterisk symbol is the
beginning of the selenocentric trajectory as defined by the user in the selenocentric distance to
begin creating data file section of the input data file. The x-axis of this lunar mean equator
and IAU node of epoch coordinate system is red, the y-axis green and the z-axis blue.
page 8
Technical Discussion
The spaceraft’s orbital motion is modeled with respect to the Earth mean equator and equinox of J2000
(EME2000) coordinate system. The following figure illustrates the geometry of the EME2000
coordinate system. The origin of this Earth-centered-inertial (ECI) inertial coordinate system is the
geocenter and the fundamental plane is the Earth’s mean equator. The z-axis of this system is normal to
the Earth’s mean equator at epoch J2000, the x-axis is parallel to the vernal equinox of the Earth’s mean
orbit at epoch J2000, and the y-axis completes the right-handed coordinate system. The epoch J2000 is
the Julian Date 2451545.0 which corresponds to January 1, 2000, 12 hours Terrestrial Time (TT).
page 9
Program pprop_lunar implements a special perturbation technique which numerically integrates the
vector system of second-order, nonlinear differential equations of motion of a spacecraft given by
where
t dynamical time
r inertial position vector of the spacecraft
a g acceleration due to Earth gravity
a s acceleration due to the sun
am acceleration due to the moon
a p acceleration due to the planets
a srp acceleration due to solar radiation pressure
The software uses a spherical harmonic representation of the Earth’s geopotential function given by
n R
n n
R
r, , C Pn0 u Pnm u Snm sin m Cnm cos m
0
n
r r n 1 r r n 1 m1 r
where is the geocentric latitude of the spacecraft, is the geocentric east longitude of the spacecraft
and r r x 2 y 2 z 2 is the geocentric distance of the spacecraft. In this expression the S’s and
C’s are harmonic coefficients of the geopotential, and the P’s are associated Legendre polynomials of
degree n and order m with argument u sin .
The software calculates the spacecraft’s acceleration due to the Earth’s gravity field with a vector
equation derived from the gradient of the potential function expressed as
a g r, t r, t
This acceleration vector is a combination of pure two-body or point mass gravity acceleration and the
gravitational acceleration due to higher order nonspherical terms in the Earth’s geopotential.
In terms of the Earth’s geopotential , the inertial rectangular cartesian components of the spacecraft’s
acceleration vector are as follows:
1 N R
n
r r r n 2 r m 0
N R
n n
r n2 r
C
m 0
m
n cos m Snm sin m Pnm1 sin m tan Pnm sin
N R
n n
r n2 r
mS
m 0
m
n cos m Cnm sin m Pnm sin
where
R radius of the Earth
r geocentric distance of the satellite
Snm , Cnm harmonic coefficients
z
geocentric declination of the satellite sin 1
r
longitude of the satellite g
y
right ascension of the satellite tan 1
x
g right ascension of Greenwich
The right ascension is measure positive east of the vernal equinox, longitude is measured positive east of
Greenwich, and declination is positive above the Earth’s equator and negative below.
For m 0 the coefficients are called zonal terms, when m n the coefficients are sectorial terms, and
for n m 0 the coefficients are called tesseral terms.
The Legendre polynomials with argument sin are computed using recursion relationships given by:
1
Pn0 sin 2n 1 sin Pn01 sin n 1 Pn02 sin
n
Pn sin 2n 1 cos Pnn11 sin ,
n
m 0, m n
Pnm sin Pnm2 sin 2n 1 cos Pnm11 sin , m 0, m n
page 11
sin m 2 cos sin m 1 sin m 2
cos m 2 cos cos m 1 cos m 2
m tan m 1 tan tan
These gravity model data files are simple space delimited ASCII data files. The following is a portion
of a typical gravity model data file. In this file, column one is the degree index, column two is the
model order index, and columns three and four are the corresponding un-normalized gravity coefficients
(zonals and tesserals, respectively).
2 0 -0.10826300D-02 0.00000000D+00
3 0 0.25321531D-05 0.00000000D+00
4 0 0.16109876D-05 0.00000000D+00
5 0 0.23578565D-06 0.00000000D+00
6 0 -0.54316985D-06 0.00000000D+00
7 0 0.33237640D-06 0.00000000D+00
8 0 0.17721040D-06 0.00000000D+00
9 0 0.14459876D-06 0.00000000D+00
10 0 0.23339780D-06 0.00000000D+00
11 0 -0.27870829D-06 0.00000000D+00
12 0 0.17036617D-06 0.00000000D+00
13 0 0.25024428D-06 0.00000000D+00
14 0 -0.13764093D-06 0.00000000D+00
15 0 -0.30920023D-07 0.00000000D+00
16 0 0.55350560D-07 0.00000000D+00
Gravity model coefficients are often published in normalized form. The relationship between
normalized Cl ,m , Sl ,m and un-normalized gravity coefficients Cl ,m , Sl ,m is given by the following
expression:
l m ! Cl ,m
12
Cl ,m 1
Sl ,m 2 m 0 2l 1 l m ! Sl ,m
r r
am r, t m msc 3 em 3
r rem
msc
where
m gravitational constant of the moon
rmsc position vector from the moon to the spacecraft
rem position vector from the Earth to the moon
page 12
The acceleration contribution of the sun represented by a point mass is given by
r r
a s r, t s s sc 3 es 3
r res
s sc
where
s gravitational constant of the sun
rs sc position vector from the sun to the spacecraft
re s position vector from the Earth to the sun
r re p
a p r, t p s sc
rs sc 3 re p 3
where
s gravitational constant of the sun
rs sc position vector from the sun to the spacecraft
re p position vector from the Earth to the planet
The first-order system of equations required by this computer program can be created from the second-
order system by the method of order reduction. With the following definitions,
y1 rx y2 ry y3 rz
y4 v x y5 v y y6 v z
where vx , v y , vz are the velocity vector components of the spacecraft, the first-order system of
differential equations is given by
y1 v x y2 v y y3 v z
rx
y4 s a x m a x p a x srp
r3
r
y5 s y3 a y m a y p a y srp
r
r
y6 s z3 a z m a z p a z srp
r
In these equations, s is the gravitational constant of the sun, ax p , a y p and az p are the x, y and z
gravitational contributions of the planets, ax m , a y m and az m are the x, y and z gravitational
contributions of the moon, and ax srp , a y srp and az srp are the x, y and z gravitational contributions due to
solar radiation pressure.
page 13
To avoid numerical problems, use is made of Richard Battin’s f q function given by
3 3qk qk2
f qk qk 3
1 1 qk
where
r T r 2sk
qk
sTk sk
In these equations, s k is the vector from the primary body to the secondary body, k is the gravitational
constant of the secondary body and dk r sk , where r is the position vector of the spacecraft relative
to the primary body. The derivation of the f q functions is described in Section 8.4 of “An
Introduction to the Mathematics and Methods of Astrodynamics, Revised Edition”, by Richard H.
Battin, AIAA Education Series, 1999.
We can define a solar radiation constant for any spacecraft as a function of its size, mass and surface
reflective properties according to the equation:
A
Csrp Ps a 2
m
where
reflectivity constant
Ps solar radiation pressure constant
a astronomical unit
A surface area normal to the incident radiation
m mass of the spacecraft
The reflectivity constant is a dimensionless number between 0 and 2. For a perfectly absorbent body
1 , for a perfectly reflective body 2 , and for a translucent body 1 . For example, the
reflectivity constant for an aluminum surface is approximately 1.96.
The value of the solar radiation pressure on a perfectly absorbing spacecraft surface at a distance of one
Astronomical Unit from the Sun is
G Newton
Ps 1
c meters 2
page 14
where G1 is the solar flux at a distance of one Astronomical Unit in watts per square meter, and c is the
speed of light in meters per second. The values of the solar flux and speed of light used during a
simulation are defined by the user in the constants and models data file.
The acceleration vector of the spacecraft due to solar radiation pressure is given by:
rsc s
a srp csrp 3
rsc s
where
rsc = geocentric, inertial position vector of the spacecraft
re s = geocentric, inertial position vector of the sun
rsc s rsc res
During the geocentric integration process, the software must determine if the spacecraft is in Earth
shadow or sunlight. Obviously, there can be no solar radiation perturbation during Earth eclipse of the
spacecraft orbit. The software makes use of a shadow parameter to determine eclipse conditions. This
parameter is defined by the following expression:
rsc res
sign(rsc res )
res
where rsc is the geocentric, inertial position vector of the spacecraft and re s is the geocentric, inertial
position vector of the sun relative to the spacecraft.
The critical values of the shadow parameter for the penumbra (subscript p) and umbra part (subscript u)
of the shadow are given by:
p rsc sin p
u rsc sin u
p p
u u
They are the angles between the geocentric anti-sun vector and the vector to a spacecraft at the time of
shadow entrance or exit.
re
sin 1
rsc
page 15
rs re rs re
p sin 1 u sin 1
res res
where
re radius of the Earth
rs radius of the sun
re s distance from the Earth to the sun
If the condition u p is true, the spacecraft is in the penumbra part of the Earth’s shadow, and if
the inequality 0 u is true, the spacecraft is in the umbra part of the shadow. If the absolute value
of the shadow parameter is larger than the penumbra value, the spacecraft is in full sunlight. The
shadow calculations used in this computer program also assume the Earth’s atmosphere increases the
radius of the Earth by two percent.
This section describes the transformation of coordinates between the Earth mean equator and equinox
2000 (EME2000) and lunar mean equator and IAU node of epoch coordinate systems. This
transformation is used to compute the B-plane coordinates and classical orbital elements at encounter.
The following diagram illustrates the orientation of the lunar mean equator and IAU node of epoch
coordinate frame.
Figure 2. Lunar mean equator and IAU node of epoch coordinate system
page 16
A unit vector in the direction of the pole of the moon can be determined from
cos p cos p
pˆ Moon sin p cos p
sin p
where p and p are the right ascension and declination of the lunar pole. The right ascension and
declination of the lunar pole in the EME2000 coordinate system are given by the following expressions
where T is the time in Julian centuries given by T JD 2451545.0 / 36525 and JD is the Dynamical
Barycentric Time (TDB) Julian Date.
E1 125.045 0.0529921d
E 2 250.089 0.1059842d
E 3 260.008 13.0120009d
E 4 176.625 13.3407154d
E 6 311.589 26.4057084d
E 7 134.963 13.0649930d
E10 15.134 0.1589763d
E13 25.053 12.9590088d
where d JD 2451545 is the number of days since January 1.5, 2000. These equations are given in
“Report of the IAU Working Group on Cartographic Coordinates and Rotational Elements: 2009”,
Celestial Mechanics and Dynamical Astronomy, 109: 101-135, 2011.
The unit vector in the x-axis direction of this selenocentric coordinate system is given by
xˆ zˆ pˆ Moon
where zˆ 0 0 1 . The unit vector in the y-axis direction can be determined using
T
yˆ pˆ Moon xˆ
page 17
Finally, the components of the matrix that transforms coordinates from the EME2000 system to the
moon-centered (selenocentric) mean equator and IAU node of epoch system are as follows:
M xˆ yˆ pˆ Moon
T
Closest approach is determined during the numerical integration of the spacecraft’s geocentric equations
of motion by finding the time at which the spacecraft’s flight path angle relative to the Moon is
essentially zero. This mission constraint is computed as follows
rv
sin 1 0
r v
where r and v are the Moon-centered (selenocentric) position and velocity vectors, respectively. Both
orbital events are predicted using a Runge-Kutta-Fehlberg (RKF7(8)) integrator embedded with a one-
dimensional form of Brent’s root-finding method.
The trajectory conditions at a user-defined selenocentric distance are determined during the numerical
integration of the spacecraft’s geocentric equations of motion by finding the time at which the difference
between the selenocentric distance and the user-defined value is essentially zero. This mission
constraint is computed as follows
r rsc ruser 0
where rsc is the selenocentric position vector of the spacecraft and ruser is the user-defined value of the
selenocentric distance.
For this program option, the software simply integrates the geocentric equations of motion from the
initial to the user-defined final time.
The truncation error tolerance for the variable step size numerical method implemented in the
pprop_lunar software is “hard-wired” to a value of 1.0d-15. The root-finding tolerance in the
software is hard-wired to a value of 1.0d-8.
The B-plane
The derivation of B-plane coordinates is described in the classic JPL reports, “A Method of Describing
Miss Distances for Lunar and Interplanetary Trajectories” and “Some Orbital Elements Useful in Space
Trajectory Calculations”, both by William Kizner. The following diagram illustrates the fundamental
geometry of the B-plane coordinate system.
page 18
The arrival asymptote unit vector Ŝ is given by
cos cos
Sˆ cos sin
sin
where and are the declination and right ascension of the asymptote of the incoming hyperbola at
lunar encounter.
The following computational steps summarize the calculation of the B-plane vector from a selenocentric
position vector r and velocity vector v evaluated at closest approach to the Moon.
radius rate
r r v r
semiparameter
p h2
semimajor axis
r
a
2 r v2
page 19
orbital eccentricity
e 1 p a
true anomaly
pr rh
cos sin
er e
B-plane magnitude
B pa
fundamental vectors
r v rr
zˆ
h
S vector
a b
S pˆ qˆ
a b
2 2
a b2
2
B vector
b2 ab
B pˆ qˆ
a 2 b2 a 2 b2
T vector
S , S ,0
2 2 T
T
y x
S x2 S y2
R vector
R S T SzTy , SzTx , S xTy S yTx
T
page 20
Algorithm and Modeling Resources
(2) “Earth-Moon Trajectories”, JPL Technical Report No. 32-503, May 1, 1964.
(3) “Three-Dimensional Lunar Trajectories”, V. A. Egorov, Mechanics of Space Flight Series, Israel
Program for Scientific Translations, Jerusalem 1969.
(4) “Circumlunar Trajectory Calculations”, MIT Instrumentation Laboratory Report R-353, April 1962.
(5) “Optimal Low Thrust Trajectories to the Moon”, John T. Betts and Sven O. Erb, SIAM Journal on
Applied Dynamical Systems, Vol. 2, No. 2, pp. 144-170, 2003.
(6) “Integrated Algorithm for Lunar Transfer Trajectories Using a Pseudostate Technique”, R. V.
Ramanan, AIAA Journal of Guidance, Control and Dynamics, Vol. 25, No. 5, September-October 2002,
pp. 946-952.
(7) “Nonimpact Lunar Transfer Trajectories Using the Pseudostate Technique”, R. V. Ramanan and V.
Adimurthy, AIAA Journal of Guidance, Control and Dynamics, Vol. 28, No. 2, March-April 2005, pp.
217-225.
(8) “Injection Conditions for Lunar Trajectories”, R. Kolenkiewicz and W. Putney, NASA TM X-55390,
November 1965.
(9) “Coplanar Three-Body Trans-Earth Lunar Trajectory Simulation Methodology”, H. Ikawa, AIAA
88-0381, AIAA 26th Aerospace Sciences Meeting, Reno, Nevada, January 11-14, 1988.
(10) “Lunar Constants and Models Document”, JPL D-32296, September 23, 2005.
(11) NOVAS (Naval Observatory Vector Astrometry Subroutines) software package, version 3.1, U.S.
Naval Observatory, March 2011.
(13) “The Planetary and Lunar Ephemeris DE 421”, W. M. Folkner, J. G. Williams, D. H. Boggs, JPL
IOM 343R-08-003, 31-March-2008.
(14) “Report of the IAU/IAG Working Group on Cartographic Coordinates and Rotational Elements of
the Planets and Satellites: 2009”, Celestial Mechanics and Dynamical Astronomy, 109: 101-135, 2011.
(16) W. Kizner, “A Method of Describing Miss Distances for Lunar and Interplanetary Trajectories”,
Publication 674, Jet Propulsion Laboratory, August 1, 1959.
(17) R. H. Battin, An Introduction to the Mathematics and Methods of Astrodynamics, AIAA, 1987.
page 21
APPENDIX A
Contents of the Simulation Summary and Data Files
This appendix is a brief summary of the information contained in the simulation summary screen display
and the data files produced by the pprop_lunar computer program. It is possible to “redirect” the
screen output to a simple text file with a DOS command similar to
pprop_lunar pprop_lunar.in >pprop_lunar.txt
UTC Julian Date = Julian Date of trajectory event on UTC time scale
TDB Julian Date = Julian Date of trajectory event on TDB time scale
arglat (deg) = argument of latitude in degrees. The argument of latitude is the sum of
true anomaly and argument of perigee.
vmag (kps) = scalar magnitude of the spacecraft’s velocity vector in kilometers per
second
page 22
v-infinity = magnitude of incoming v-infinity vector at the Moon in kilometers/second
selenocentric flight path angle = flight path angle relative to the Moon in degrees
right ascension = right ascension of the Moon at the final event in degrees
propagation duration = trajectory time from the initial conditions to the final user-
defined event in both hours and days
The geocentric and selenocentric flight conditions data files contain the following information:
vsc-x (km/sec) = x-component of the spacecraft’s velocity vector in kilometers per second
vsc-y (km/sec) = y-component of the spacecraft’s velocity vector in kilometers per second
vsc-z (km/sec) = z-component of the spacecraft’s velocity vector in kilometers per second
vsc-mag (km/sec) = scalar magnitude of the spacecraft’s velocity vector in kilometers per
second
The geocentric flight conditions data file also includes the geocentric position vector (in kilometers) and
the declination and right ascension of the Moon (both in degrees) in the data columns labeled rmoon-x
(km), rmoon-y (km), rmoon-z (km), decl_moon (deg) and rasc_moon (deg).
In addition to their use in the MATLAB plotting scripts, the flight conditions data in these files can be
plotted by other computer programs. The following are two typical plots created with version 9 of
Grapher (www.goldensoftware.com).
page 23
This first plot illustrates the behavior of the geocentric velocity as a function of mission elapsed time.
The next plot illustrates the behavior of the selenocentric inclination as a function of mission elapsed
time. Notice that the plot begins at the selenocentric distance specified by the user in the input data file.
page 24
A MATLAB Script for Predicting the Evolution of Lunar Orbits
This document is the user’s manual for a MATLAB script named lprop_matlab which can be used to
predict the long-term evolution of lunar orbits. The software integrates the selenocentric or moon-
centered Cartesian equations of motion using a variable step size Runge-Kutta-Fehlberg 7(8) numerical
method. The selenocentric equations of motion include the non-spherical gravity of the moon and
(optionally) the point-mass gravity of the earth and sun. The ephemeris source for this script is JPL
DE421 and the default lunar gravity model is LP150q.
The prompt for the name of the simulation definition input data file is similar to the following;
The file type defaults to names with a *.in filename extension. However, you can select any
lprop_matlab compatible ASCII data file by selecting the Files of type: field or by typing the name of
the file directly in the File name: field.
The lprop_matlab software is “data-driven” by a user-created text file. This text file should be
simple ASCII format with no special characters.
The following is a typical input file used by this MATLAB script. In the following discussion the actual
input file contents are in courier font and all explanations are in times italic font. This example
propagates a polar lunar orbit at 100 kilometers altitude.
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.
page 1
The first five lines of any input file are reserved for user comments. These lines are ignored by the
software. However the input file must begin with five and only five initial text lines.
***********************************
input data file for lprop_matlab
propagation of selenocentric orbits
llo_50x50.in - February 21, 2013
***********************************
The first inputs to the program define the initial UTC calendar date and time for the simulation. The
data for the calendar year should include all four digits.
******************
INITIAL CONDITIONS
******************
The next six inputs are the initial classical orbital elements for the simulation. The angular elements
should be provided in the moon_j2000 coordinate system. The orientation of this coordinate system is
defined in the Technical discussion section later in this document. Please note the units for each orbital
element and the appropriate data range.
semimajor axis (kilometers)
---------------------------
1838.0
right ascension of the ascending node (0 degrees <= RAAN <= 360 degrees)
------------------------------------------------------------------------
0.0
The next two integer inputs define the order (zonals) and degree (tesserals) of the lunar gravity model to
use during the simulation.
page 2
order of lunar gravity model (zonals)
-------------------------------------
50
The next two integer inputs allow the user to include the point-mass gravity perturbations of the sun and
earth during the simulation.
include solar point-mass gravity (1 = yes, 0 = no)
--------------------------------------------------
1
This next numerical input defines the truncation error tolerance for the RKF numerical method used to
integrate the equations of motion. A smaller value improves the orbit propagation at the expense of
longer run times. A value between 1.0d-10 and 1.0d-15 is recommended.
********************
algorithm parameters
********************
The next two text inputs define the names of the lunar gravity model file to use and the name of the
output file created by the software.
name of gravity model data file
-------------------------------
lp150q_unnorm.dat
The final program input specifies the step size of the data file created by the software.
data file step size (minutes)
-----------------------------
60.0d0
The lprop_matlab software also requires a simple data file named constants.dat. This file allows
the user to define fundamental utility and astrodynamic data values for the simulation. The following
illustrates the contents of a typical data file. The data items are self-explanatory. However, please note
the proper units for each data value.
********************************************
utility and astrodynamic constants data file
********************************************
page 3
astronomical unit (DE421 value - kilometers)
--------------------------------------------
149597870.6996262
The following is the script output for the data file described earlier. It summarizes the initial and final
conditions for this 180 day orbit propagation.
program lprop_matlab
arglat (deg) = argument of latitude in degrees. The argument of latitude is the sum of
true anomaly and argument of perigee.
vmag (km/sec) = scalar magnitude of the velocity vector in kilometers per second
Appendix A provides additional information about time scales and conversions. It also summarizes the
algorithm used to calculate leap seconds.
page 5
The lprop_matlab script will also create a comma separated variable (csv) data file with the filename
specified by the user in the simulation definition data file. This simple text file contains the following
information;
Please note that the periapsis and apoapsis altitudes are with respect to a spherical moon.
Graphic displays of the data contained in the csv files created by lprop_matlab can be read and
displayed with an included MATLAB script named lplot.m. The following is a typical user
interaction with this script.
The prompt for the name of the output or results data file is similar to the following;
The software will then ask you to select the orbital element to plot. This interactive prompt appears as
follows;
page 6
please select the orbital element to plot
? 3
The software will ask you to provide a name for the disk file with this prompt.
please input a name for the graphics disk file
(be sure to include the filename extension)
? llo_50x50_inc.eps
The lplot script will also create a color Postscript disk file with TIFF preview using the filename
(plotfname) provided by the user. This is accomplished with the following line of source code.
After the plot is created and displayed, the script will ask if you would like to create another plot with
For additional plots, the script uses the original data file selected by the user.
The following are several graphic images created with the lplot script. They illustrate the long-term
behavior of important orbital conditions. The first two images depict the orbital evolution of the
eccentricity and inclination as a function of the elapsed time.
page 7
The next two plots illustrate the long-term evolution of the periapsis and apoapsis altitudes.
These altitudes are with respect to a spherical moon with a radius equal to the value provided by the user
in the constants.dat data file.
Technical discussion
This section describes the numerical methods implemented in the lprop_matlab computer program.
It summarizes several lunar coordinate systems, the non-spherical lunar gravity model, and the
selenocentric orbital equations of motion.
Appendix A provides additional information about time scales and conversions. It also summarizes the
algorithm used to calculate leap seconds.
The following figure illustrates the orientation of this coordinate system relative to the Earth’s mean
equator and north pole of J2000 (EME2000). The x-axis or Q-vector is formed from the cross product
of the Earth’s mean pole of J2000 and the Moon’s north pole relative to EME2000.
In general, the x-axis is called the IAU node of epoch. For this scientific simulation, we will set or
“freeze” the epoch to J2000 (January 1, 2000, 12 hours Terrestrial Time [TT]) and call this frame the
“moon_j2000” system.
page 8
Figure 1. Moon mean equator and IAU node of epoch coordinate system
According to “Report of the IAU/IAG Working Group on Cartographic Coordinates and Rotational
Elements: 2010”, the transformation matrix from the Earth mean equator and equinox of J2000
(EME2000) coordinate system to the moon-centered, body-fixed lunar principal axis (PA) system is
given by the following (3-1-3) rotation sequence;
M EME 2000 Rz Rx Rz
PA
In this equation, is the angle along the ICRF (International Celestial Reference Frame) equator, from
the ICRF x-axis to the ascending node of the lunar equator, is the inclination of the lunar equator to
the ICRF equator, and is the angle along the lunar equator from the node to the lunar prime meridian.
These three Euler angles represent the numerically integrated physical librations of the Moon.
The principal axis frame is aligned with the three maximum moments of inertia of the Moon. The
LP150Q lunar gravity model was developed using this frame.
The relationship between these angles and the classical IAU (International Astronomical Union)
orientation angles is
90
90
W
The transformation from the moon_j2000 to the lunar PA system is given by the following matrix
multiplication
N moon _ j 2000 M EME 2000 Pmoon _ j 2000
PA PA EME 2000
page 9
The numerical components of the constant moon_j2000-to-EME2000 transformation matrix are as
follows;
For accurate orbital analysis, the lunar libration angles can be obtained from a lunar ephemeris. The JPL
Developmental Ephemeris DE421 is considered the best currently available lunar ephemeris.
Chebyshev polynomial representations of the Euler angles and their rates in the PA system are included
in the DE421 ephemeris file which is available from www.cdeagle.com.
The following is source code listing for the MATLAB function which computes the transformation
matrix from lunar mean equator and IAU node of j2000 to the lunar principal axes system.
% transformation matrix from lunar mean equator and IAU node of j2000
% to the lunar principal axes system using JPL binary ephemeris
% input
% output
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
global tmatrix2
phi = sv(1);
theta = sv(2);
psi = sv(3);
In this MATLAB function, jplephem is a function that evaluates the binary ephemeris file, matran is
a function that performs a sequence of ordered rotations, and matxmat is a MATLAB function that
multiplies two matrices. The jplephem function was ported from the Fortran source code provided by
JPL (ssd.jpl.nasa.gov). Fortran routines for creating a binary DE421 ephemeris file from the ASCII
source data along with routines that open and read the binary file are available at the JPL website.
page 10
Acceleration due to non-spherical lunar gravity
The lprop_matlab software calculates the satellite’s acceleration due to the moon’s non-spherical
gravity field with a vector equation derived from the gradient of the potential function expressed as
ag r , t r , t
This acceleration vector is a combination of pure two-body or point mass gravity acceleration and the
gravitational acceleration due to higher order nonspherical terms in the moon’s geopotential.
The software uses a spherical harmonic representation of the moon’s geopotential function given by
n R
n n
R
r, , C Pn0 u Pnm u Snm sin m Cnm cos m
0
n
r r n 1 r r n 1 m1 r
where is the selenocentric latitude of the satellite, is the selenocentric east longitude of the satellite
and r r x 2 y 2 z 2 is the geocentric distance of the satellite. In this expression the S’s and C’s
are harmonic coefficients of the geopotential, and the P’s are associated Legendre polynomials of degree
n and order m with argument u sin .
In terms of the moon’s geopotential , the inertial rectangular cartesian components of the satellite’s
acceleration vector are as follows:
The three partial derivatives of the geopotential with respect to r, , are given by
1 N R
n
r r r n 2 r m 0
N R
n n
r n2 r
C
m 0
m
n cos m Snm sin m Pnm1 sin m tan Pnm sin
N R
n n
r n2 r
mS
m 0
m
n cos m Cnm sin m Pnm sin
page 11
where
R radius of the moon
r selenocentric distance
S , C harmonic coefficients
m
n
m
n
z
selenocentric declination sin 1
r
longitude of the satellite pm
y
right ascension tan 1
x
pm right ascension of selenocentric prime meridian
In the lprop_matlab software, right ascension is measure positive east of the vernal equinox,
longitude is measured positive east of the lunar prime meridian, and declination is positive above the
moon’s equator and negative below.
For m 0 the coefficients are called zonal terms, when m n the coefficients are sectorial terms, and
for n m 0 the coefficients are called tesseral terms.
The Legendre polynomials with argument sin are computed using recursion relationships given by:
1
Pn0 sin 2n 1 sin Pn01 sin n 1 Pn02 sin
n
Pn sin 2n 1 cos Pnn11 sin ,
n
m 0, m n
Pnm sin Pnm2 sin 2n 1 cos Pnm11 sin , m 0, m n
The lprop_matlab zipped file contains an unnormalized 75 by 75 version of the LP150Q gravity
model data file. The software can also read and process user-defined gravity model files in the correct
format. These gravity model data files are simple fixed-format, space delimited ASCII data files. The
following is a portion of a typical gravity model data file. In this file, column one is the degree index,
column two is the model order index, and columns three and four are the corresponding un-normalized
gravity coefficients (zonals and tesserals, respectively).
page 12
2 0 -2.032610275331e-004 +0.000000000000e+000
3 0 -8.474531095709e-006 +0.000000000000e+000
4 0 +9.642286350840e-006 +0.000000000000e+000
5 0 -7.330068349584e-007 +0.000000000000e+000
6 0 +1.357414571103e-005 +0.000000000000e+000
7 0 +2.174024283964e-005 +0.000000000000e+000
8 0 +9.563704527335e-006 +0.000000000000e+000
9 0 -1.544103258131e-005 +0.000000000000e+000
10 0 -4.275709406172e-006 +0.000000000000e+000
11 0 -4.605691861384e-006 +0.000000000000e+000
12 0 -9.434608127000e-006 +0.000000000000e+000
13 0 +1.343987395589e-006 +0.000000000000e+000
14 0 +1.757181057884e-006 +0.000000000000e+000
15 0 -5.414822625081e-007 +0.000000000000e+000
16 0 +1.829333227080e-006 +0.000000000000e+000
17 0 -6.142233531520e-006 +0.000000000000e+000
18 0 -2.268490144731e-006 +0.000000000000e+000
Gravity model coefficients are often published in normalized form. The relationship between
normalized Cl ,m , Sl ,m and un-normalized gravity coefficients Cl ,m , Sl ,m is given by the following
expression:
l m ! Cl ,m
12
Cl ,m 1
Sl ,m 2 m 0 2l 1 l m ! Sl ,m
The following is the MATLAB source code for the function that opens and reads a lunar gravity model
file (fname) and creates matrices of the un-normalized coefficients.
% input
% output
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
gdata = dlmread(fname);
% initialize coefficients
idim = gdata(nrows, 1) + 1;
for n = 1:nrows
i = gdata(n, 1);
j = gdata(n, 2);
end
Selenocentric acceleration due to the point-mass gravity of the sun and earth
r r
a s r, t s s sc 3 m s 3
r rm s
s sc
where
s gravitational constant of the sun
rs sc position vector from the sun to the spacecraft
rm s position vector from the moon to the sun
The selenocentric acceleration contribution of the earth represented by a point mass is given by
r r
ae r, t e esc 3 me 3
r rme
esc
where
e gravitational constant of the earth
resc position vector from the earth to the spacecraft
rme position vector from the moon to the earth
The first-order system of equations required by this computer program can be created from the second-
order system by the method of order reduction. With the following definitions,
y1 rx y2 ry y3 rz
y4 v x y5 v y y6 v z
where vx , v y , vz are the velocity vector components of the spacecraft, the first-order system of
differential equations is given by
y1 vx y2 v y y3 vz
page 14
rx
y 4 m a x e a x s
r3
r
y5 m y3 a y e a y s
r
r
y6 m z3 a z e a z s
r
In these equations, m is the gravitational constant of the moon, rx , ry and rz are the x, y and z
components of the spacecraft’s selenocentric position vector, ax e , a y e and az e are the x, y and z
gravitational contributions of the earth, and ax s , a y s and az s are the x, y and z gravitational
contributions of the sun. Also, r rx2 ry2 rx2 is the selenocentric radius.
To avoid numerical problems, use is made of Professor Richard Battin’s f q function given by
3 3qk qk2
f qk qk 3
1 1 qk
where
r T r 2sk
qk
sTk sk
n
k
r r f qk s k
k 1 d k3
In these equations, s k is the vector from the primary body to the secondary body, k is the gravitational
constant of the secondary body and dk r sk , where r is the position vector of the spacecraft relative
to the primary body.
The derivation of the f q functions is described in Section 8.4 of “An Introduction to the Mathematics
and Methods of Astrodynamics, Revised Edition”, by Richard H. Battin, AIAA Education Series, 1999.
page 15
Algorithm resources
(1) “Lunar Constants and Models Document”, JPL D-32296, September 23, 2005.
(3) “The Planetary and Lunar Ephemeris DE 421”, W. M. Folkner, J. G. Williams, D. H. Boggs, JPL
IOM 343R-08-003, 31-March-2008.
(4) “Report of the IAU/IAG Working Group on Cartographic Coordinates and Rotational Elements of
the Planets and Satellites: 2009”, Celestial Mechanics and Dynamical Astronomy, 109: 101-135, 2011.
(5) “IERS Conventions (2003)”, IERS Technical Note 32, November 2003.
(6) R. H. Battin, An Introduction to the Mathematics and Methods of Astrodynamics, AIAA, 1987.
page 16
APPENDIX A
Time Systems
This appendix is a brief explanation of the time scales used in this MATLAB script.
Coordinated Universal Time (UTC) is the time scale available from broadcast time signals. It is a
compromise between the highly stable atomic time and the irregular earth rotation. UTC is the
international basis of civil and scientific time.
Terrestrial Time, TT
Terrestrial Time is the time scale that would be kept by an ideal clock on the geoid - approximately, sea
level on the surface of the Earth. Since its unit of time is the SI (atomic) second, TT is independent of
the variable rotation of the Earth. TT is meant to be a smooth and continuous “coordinate” time scale
independent of Earth rotation. In practice TT is derived from International Atomic Time (TAI), a time
scale kept by real clocks on the Earth's surface, by the relation TT = TAI + 32s.184. It is the time scale
now used for the precise calculation of future astronomical events observable from Earth.
Barycentric Dynamical Time is the time scale that would be kept by an ideal clock, free of gravitational
fields, co-moving with the solar system barycenter. It is always within 2 milliseconds of TT, the
difference caused by relativistic effects. TDB is the time scale now used for investigations of the
dynamics of solar system bodies.
In this equation, the coefficients are in seconds, the angular arguments are in radians, and T is the
number of Julian centuries of TT from J2000; T = (Julian Date(TT) – 2451545.0) / 36525.
page 17
Leap seconds calculation
The difference between International Atomic Time (TAI) and Universal Coordinated Time (UTC) is the
number of current leap seconds. International Atomic Time (TAI, Temps Atomique International) is a
physical time scale with the unit of the SI (System International) second and derived from a statistical
timescale based on a large number of atomic clocks. Coordinated Universal Time (UTC) is the time
scale available from broadcast time signals. It is a compromise between the highly stable atomic time
and the irregular earth rotation. UTC is the international basis of civil and scientific time.
The calculation of leap seconds in this MATLAB script is performed by a function that reads a simple
ASCII data file and evaluates the current value of leap seconds. The leap second function must be
initialized by including the following statements in the main script.
readleap;
The readleap MATLAB function reads the contents of the following simple comma-separated-
variable (csv) two column data file. The name of this file is tai-utc.dat.
2441317.5, 10.0
2441499.5, 11.0
2441683.5, 12.0
2442048.5, 13.0
2442413.5, 14.0
2442778.5, 15.0
2443144.5, 16.0
2443509.5, 17.0
2443874.5, 18.0
2444239.5, 19.0
2444786.5, 20.0
2445151.5, 21.0
2445516.5, 22.0
2446247.5, 23.0
2447161.5, 24.0
2447892.5, 25.0
2448257.5, 26.0
2448804.5, 27.0
2449169.5, 28.0
2449534.5, 29.0
2450083.5, 30.0
2450630.5, 31.0
2451179.5, 32.0
2453736.5, 33.0
2454832.5, 34.0
The first column of this data file is the Julian date, on the UTC time scale, at which the leap second
became valid. The second column is the leap second value, in seconds.
Note that this data is passed between the leap second MATLAB functions by way of a global statement.
The MATLAB function that actually reads and evaluates the current value of leap seconds has the
following syntax and single argument.
page 18
function leapsecond = findleap(jdate)
% input
% output
The leap seconds data file should be updated whenever the International Earth Rotation and Reference
Systems Service (IERS) announces a new leap second.
Time conversion
The fundamental time argument for the ephemeris function used in this MATLAB script is “ephemeris”
time. As implemented here, we assume this time argument to be Barycentric Dynamic Time (TDB). To
report the time of important trajectory events in Universal Coordinated Time (UTC) or civil time, we
need an algorithm to make this time conversion.
The following is the MATLAB source code for a function which iteratively performs this calculation
using Brent’s root-finding method.
% input
% output
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
global jdsaved
jdsaved = jdtdb;
% convergence tolerance
rtol = 1.0d-8;
x1 = jdsaved - 0.1;
x2 = jdsaved + 0.1;
jdutc = xroot;
end
This function calls the following MATLAB objective function during the calculations.
% input
% output
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
global jdsaved
tai_utc = findleap(jdin);
end
Notice that this function requires the findleap function which calculates the number of leap seconds
for the current UTC Julian date value. The jdfunc function is computing the difference between the
TDB Julian date input by the user and the value computed by the utc2tdb MATLAB function. The
algorithm has converged whenever this value is less than or equal to the user-defined tolerance rtol.
page 20
Program lprop
This document is the user’s manual for a Windows compatible Fortran computer program called
lprop.exe that can be used to numerically propagate the moon-centered or selenocentric motion of a
spacecraft in orbit around the moon. The software integrates the Cartesian equations of motion using a
variable step size Runge-Kutta-Fehlberg 7(8) numerical method. The software implementation includes
several JPL SPICE utility routines and the JPL DE421 ephemeris
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:
lprop llo_50x50.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:
The user should respond to this prompt with the name of a compatible input data file including the
filename extension.
The screen output created by the lprop computer program can be re-directed to a text file with a
command line similar to
lprop llo_50x50.in >llo_50x50.txt
To create a DOS command window in Windows 7, select start, then All Programs, then Accessories
and finally Command Prompt. The size, font and other characteristics of the screen can be controlled
by the user with the c:\ icon in the upper left corner of the window. To log into the subdirectory created
during the installation of the Fortran executable and support files, type root:\ and then cd subdirectory
from the DOS command line where root is the name of the root directory, usually c:, and subdirectory is
the name of the subdirectory created by the user.
The lprop software is “data-driven” by a user-created text file. This text file should be simple ASCII
format with no special characters.
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 example
propagates the motion of a spacecraft in a polar lunar orbit at 100 kilometer altitude.
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.
page 1
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 five lines of any input file are reserved for user comments. These lines are ignored by the
software. However the input file must begin with five and only five initial text lines.
***********************************
data file for program lprop.exe
propagation of selenocentric orbits
llo_50x50.in - May 19, 2012
***********************************
The first inputs to the program define the initial calendar date and time for the simulation. The
calendar date should be input in the format three character calendar month, two digit calendar day and
four digit calendar year. The initial time should be input in the format hh:mm:ss followed by a three
character SPICE compatible time system abbreviation. Typical time systems are utc (universal
coordinate time), tdb (barycentric dynamical time), etc.
******************
INITIAL CONDITIONS
******************
epoch
-----
Oct 01 2020 00:00:00 tdb
The next six inputs are the initial classical orbital elements for the simulation. The angular elements
should be provided in the moon_j2000 coordinate system. The orientation of this coordinate system is
defined in the Technical discussion section later in this document. Please note the units for each orbital
element and the appropriate data range.
semimajor axis (kilometers)
---------------------------
1838.0
right ascension of the ascending node (0 degrees <= RAAN <= 360 degrees)
------------------------------------------------------------------------
0.0
*********************
orbital perturbations
*********************
The next two integer inputs define the order (zonals) and degree (tesserals) of the lunar gravity model to
use during the simulation.
The next two integer inputs allow the user to include the point-mass gravity perturbations of the sun and
earth during the simulation.
include solar point-mass gravity (1 = yes, 0 = no)
--------------------------------------------------
1
This next numerical input defines the truncation error tolerance for the Runge-Kutta-Fehlberg
numerical method used to integrate the equations of motion. A smaller value improves the numerical
method at the expense of longer run times. A value between 1.0d-10 and 1.0d-15 is recommended.
********************
algorithm parameters
********************
The next two text inputs define the names of the lunar gravity model file to use and the name of the
output file created by the software.
name of gravity model data file
-------------------------------
lp150q_unnorm.dat
The final program input specifies the step size of the data file created by the software.
data file step size (minutes)
-----------------------------
60.0d0
The lprop software also requires a simple data file named constants.dat. This file allows the user
to define fundamental utility and astrodynamic data values for the simulation. The following illustrates
page 3
the contents of a typical data file. The data items are self-explanatory. However, please note the proper
units for each data value.
********************************************
utility and astrodynamic constants data file
********************************************
The last data item is the name of the SPICE formatted leap seconds data file. The current version of this
data file can be downloaded at http://naif.jpl.nasa.gov/naif/.
The following is the program output for the data file example described earlier. It summarizes the initial
and final conditions for this orbit propagation.
===============================================
program lprop - selenocentric orbit propagation
===============================================
------------------------------------------
initial time and conditions
(lunar mean equator and IAU node of J2000)
------------------------------------------
------------------------------------------
final time and conditions
(lunar mean equator and IAU node of J2000)
------------------------------------------
UTC epoch = simulation calendar date and UTC time (yyyy mm dd hh:mm:ss.sss)
arglat (deg) = argument of latitude in degrees. The argument of latitude is the sum of
true anomaly and argument of perigee.
page 5
vmag (km/sec) = scalar magnitude of the spacecraft’s velocity vector in kilometers per
second
The lprop software will also create a comma separated variable (csv) data file with the filename
specified by the user in the simulation definition input data file. This simple text file contains the
following information;
vsc-x (kps) = inertial x-component of the selenocentric velocity vector in kilometers per
second
vsc-y (kps) = inertial y-component of the selenocentric velocity vector in kilometers per
second
vsc-z (kps) = inertial z-component of the selenocentric velocity vector in kilometers per
second
vmag (kps) = magnitude of the selenocentric velocity vector in kilometers per second
Please note that the periapsis and apoapsis altitudes are with respect to a spherical moon.
This section provides several graphic images which illustrate the long-term behavior of important orbital
conditions. The first two images depict the orbital evolution of the eccentricity and inclination.
page 6
The next two plots illustrate the long-term evolution of the periapsis and apoapsis altitudes.
The final two images are plots of the selenocentric position and velocity magnitudes.
page 7
Technical discussion
This section describes the numerical methods implemented in the lprop computer program. It
summarizes several lunar coordinate systems, the non-spherical lunar gravity model, and the orbital
equations of selenocentric motion.
The following figure illustrates the orientation of this coordinate system relative to the Earth’s mean
equator and north pole of J2000 (EME2000). The x-axis or Q-vector is formed from the cross product
of the Earth’s mean pole of J2000 and the Moon’s north pole relative to EME2000.
In general, the x-axis is called the IAU node of epoch. For this scientific simulation, we will set or
“freeze” the epoch to J2000 (January 1.5, 2000) and call this frame the “moon_j2000” system.
page 8
Figure 1. Moon mean equator and IAU node of epoch coordinate system
According to “Report of the IAU/IAG Working Group on Cartographic Coordinates and Rotational
Elements: 2010”, the transformation matrix from the Earth mean equator and equinox of J2000
(EME2000) coordinate system to the moon-centered, body-fixed lunar principal axis (PA) system is
given by the following (3-1-3) rotation sequence;
M EME 2000 Rz Rx Rz
PA
In this equation, is the angle along the ICRF (International Celestial Reference Frame) equator, from
the ICRF x-axis to the ascending node of the lunar equator, is the inclination of the lunar equator to
the ICRF equator, and is the angle along the lunar equator from the node to the lunar prime meridian.
These three Euler angles represent the numerically integrated physical librations of the Moon.
The principal axis frame is aligned with the three maximum moments of inertia of the Moon. The
LP150Q lunar gravity model was developed using this frame.
The relationship between these angles and the classical IAU (International Astronomical Union)
orientation angles is
90
90
W
The transformation from the moon_j2000 to the lunar PA system is given by the following matrix
multiplication
N moon _ j 2000 M EME 2000 Pmoon _ j 2000
PA PA EME 2000
page 9
The numerical components of the constant moon_j2000-to-EME2000 transformation matrix are as
follows;
For accurate orbital analysis, the lunar libration angles can be obtained from a lunar ephemeris. The JPL
Developmental Ephemeris DE421 is considered the best currently available lunar ephemeris.
Chebyshev polynomial representations of the Euler angles and their rates in the PA system are included
in the DE421 ephemeris file which is available from http://ssd.jpl.nasa.gov.
The following is the source code listing for a Fortran subroutine that evaluates the DE421 ephemeris file
and computes this coordinate transformation.
c moon_j2000-to-moon_pa transformation
c matrix using DE421.bin binary ephemeris
c input
c output
c ************************************
dimension tmatrix(3, 3)
data tmatrix2
& / 0.998496505205088d0,
& -5.481540926807404d-2,
& 0.0d0,
& 4.993572939853833d-2,
& 0.909610125238044d0,
& 0.412451018902688d0,
& -2.260867140418499d-2,
& -0.411830900942612d0,
& 0.910979778593430d0 /
icent = 0
itarg = 15
phi = sv(1)
theta = sv(2)
page 10
psi = sv(3)
end
In this subroutine, jpleph is a subroutine that evaluates the binary ephemeris file, matran is a
subroutine that performs a sequence of ordered rotations, and matxmat is a Fortran subroutine that
multiplies two matrices. The source code for the jpleph subroutine is provided by JPL as are routines
for creating a binary DE421 ephemeris file from the ASCII source data. It also includes routines that
open and reads the binary file.
The lprop software calculates the satellite’s acceleration due to the moon’s non-spherical gravity field
with a vector equation derived from the gradient of the potential function expressed as
ag r , t r , t
This acceleration vector is a combination of pure two-body or point mass gravity acceleration and the
gravitational acceleration due to higher order nonspherical terms in the moon’s geopotential.
The software uses a spherical harmonic representation of the moon’s geopotential function given by
n R
n n
R
r, , C Pn0 u Pnm u Snm sin m Cnm cos m
0
n
r r n 1 r r n 1 m1 r
where is the selenocentric latitude of the satellite, is the selenocentric east longitude of the satellite
and r r x 2 y 2 z 2 is the geocentric distance of the satellite. In this expression the S’s and C’s
are harmonic coefficients of the geopotential, and the P’s are associated Legendre polynomials of degree
n and order m with argument u sin .
In terms of the moon’s geopotential , the inertial rectangular cartesian components of the satellite’s
acceleration vector are as follows:
page 11
1 z 1
x x 2 y
r r r 2 x 2 y 2 x y 2
1 z 1
y y 2 x
r r r 2 x 2 y 2 x y 2
1 x2 y2
z z
r r r 2
The three partial derivatives of the geopotential with respect to r, , are given by
1 N R
n
r r r n 2 r m 0
N R
n n
r n2 r
C
m 0
m
n cos m Snm sin m Pnm1 sin m tan Pnm sin
N R
n n
r n2 r
mS
m 0
m
n cos m Cnm sin m Pnm sin
where
R radius of the moon
r selenocentric distance of the satellite
S , C harmonic coefficients
m
n
m
n
z
selenocentric declination of the satellite sin 1
r
longitude of the satellite pm
y
right ascension of the satellite tan 1
x
pm right ascension of selenocentric prime meridian
In the lprop software, right ascension is measure positive east of the vernal equinox, longitude is
measured positive east of the lunar prime meridian, and declination is positive above the moon’s equator
and negative below.
For m 0 the coefficients are called zonal terms, when m n the coefficients are sectorial terms, and
for n m 0 the coefficients are called tesseral terms.
The Legendre polynomials with argument sin are computed using recursion relationships given by:
page 12
1
Pn0 sin 2n 1 sin Pn01 sin n 1 Pn02 sin
n
Pn sin 2n 1 cos Pnn11 sin ,
n
m 0, m n
Pnm sin Pnm2 sin 2n 1 cos Pnm11 sin , m 0, m n
The lprop zipped file contains an unnormalized 70 by 70 version of the LP150Q gravity model data
file. The software can also read and process user-defined gravity model files in the correct format.
These gravity model data files are simple fixed-format, space delimited ASCII data files. The following
is a portion of a typical gravity model data file. In this file, column one is the degree index, column two
is the model order index, and columns three and four are the corresponding un-normalized gravity
coefficients (zonals and tesserals, respectively).
2 0 -2.032610275331e-004 +0.000000000000e+000
3 0 -8.474531095709e-006 +0.000000000000e+000
4 0 +9.642286350840e-006 +0.000000000000e+000
5 0 -7.330068349584e-007 +0.000000000000e+000
6 0 +1.357414571103e-005 +0.000000000000e+000
7 0 +2.174024283964e-005 +0.000000000000e+000
8 0 +9.563704527335e-006 +0.000000000000e+000
9 0 -1.544103258131e-005 +0.000000000000e+000
10 0 -4.275709406172e-006 +0.000000000000e+000
11 0 -4.605691861384e-006 +0.000000000000e+000
12 0 -9.434608127000e-006 +0.000000000000e+000
13 0 +1.343987395589e-006 +0.000000000000e+000
14 0 +1.757181057884e-006 +0.000000000000e+000
15 0 -5.414822625081e-007 +0.000000000000e+000
16 0 +1.829333227080e-006 +0.000000000000e+000
17 0 -6.142233531520e-006 +0.000000000000e+000
18 0 -2.268490144731e-006 +0.000000000000e+000
Gravity model coefficients are often published in normalized form. The relationship between
normalized Cl ,m , Sl ,m and un-normalized gravity coefficients Cl ,m , Sl ,m is given by the following
expression:
l m ! Cl ,m
12
Cl ,m 1
Sl ,m 2 m 0 2l 1 l m ! Sl ,m
Selenocentric acceleration due to the point-mass gravity of the sun and earth
r r
a s r, t s s sc 3 m s 3
r rm s
s sc
where
s gravitational constant of the sun
rs sc position vector from the sun to the spacecraft
rm s position vector from the moon to the sun
The selenocentric acceleration contribution of the earth represented by a point mass is given by
r r
ae r, t e esc 3 me 3
r rme
esc
where
e gravitational constant of the earth
resc position vector from the earth to the spacecraft
rme position vector from the moon to the earth
The first-order system of equations required by this computer program can be created from the second-
order system by the method of order reduction. With the following definitions,
y1 rx y2 ry y3 rz
y4 v x y5 v y y6 v z
where vx , v y , vz are the velocity vector components of the spacecraft, the first-order system of
differential equations is given by
y1 vx y2 v y y3 vz
rx
y 4 m a x e a x s
r3
r
y5 m y3 a y e a y s
r
r
y6 m z3 a z e a z s
r
page 14
In these equations, m is the gravitational constant of the moon, rx , ry and rz are the x, y and z
components of the spacecraft’s selenocentric position vector, ax e , a y e and az e are the x, y and z
gravitational contributions of the earth, and ax s , a y s and az s are the x, y and z gravitational
contributions of the sun. Also, r rx2 ry2 rx2 is the selenocentric radius.
To avoid numerical problems, use is made of Professor Richard Battin’s f q function given by
3 3qk qk2
f qk qk 3
1 1 qk
where
r T r 2sk
qk
sTk sk
n
k
r r f qk s k
k 1 d k3
In these equations, s k is the vector from the primary body to the secondary body, k is the gravitational
constant of the secondary body and dk r sk , where r is the position vector of the spacecraft relative
to the primary body. The derivation of the f q functions is described in Section 8.4 of “An
Introduction to the Mathematics and Methods of Astrodynamics, Revised Edition”, by Richard H.
Battin, AIAA Education Series, 1999.
page 15
Algorithm resources
(1) “Lunar Constants and Models Document”, JPL D-32296, September 23, 2005.
(3) “The Planetary and Lunar Ephemeris DE 421”, W. M. Folkner, J. G. Williams, D. H. Boggs, JPL
IOM 343R-08-003, 31-March-2008.
(4) “Report of the IAU/IAG Working Group on Cartographic Coordinates and Rotational Elements of
the Planets and Satellites: 2009”, Celestial Mechanics and Dynamical Astronomy, 109: 101-135, 2011.
(5) “IERS Conventions (2003)”, IERS Technical Note 32, November 2003.
(6) R. H. Battin, An Introduction to the Mathematics and Methods of Astrodynamics, AIAA, 1987.
page 16
Orbital Mechanics with MATLAB
This document describes a MATLAB script named moon_plot.m that can be used to graphically
display orbital information about the Moon. The lunar motion is modeled using the JPL DE421
ephemeris and this script uses routines from the MICE software suite to read and evaluate this
ephemeris. MICE is a MATLAB implementation of the SPICE library created by JPL. The MICE
routines and ephemeris file are available at naif.jpl.nasa.gov/naif/toolkit_MATLAB.html.
Script example
program moon_plot
<2> eccentricity
page 1
Orbital Mechanics with MATLAB
? 3
Here’s a graphics display of the orbital inclination relative to the ecliptic plane for this same time period.
page 2
Orbital Mechanics with MATLAB
In this MATLAB script, the orbital motion of the Moon is evaluated in the Earth mean equator and
equinox of J2000 (EME2000) coordinate system. The following figure illustrates the geometry of the
EME2000 coordinate system. The origin of this ECI inertial coordinate system is the geocenter and the
fundamental plane is the Earth’s mean equator. The z-axis of this system is normal to the Earth’s mean
equator at epoch J2000, the x-axis is parallel to the vernal equinox of the Earth’s mean orbit at epoch
J2000, and the y-axis completes the right-handed coordinate system. The epoch J2000 is the Julian Date
2451545.0 which corresponds to January 1, 2000, 12 hours Terrestrial Time (TT).
Figure 1. Earth mean equator and equinox of J2000 (EME2000) coordinate system
The ecliptic inclination, argument of perigee and longitude of the ascending node are computed using
the geocentric position and velocity vectors of the Moon in the Earth mean ecliptic and equinox of
J2000 coordinate system.
T T
1 0 0 1 0 0
v ec 0 cos sin v eq 0 0.917482062069182 -0.397777155931914 v eq
0 sin cos 0 0.397777155931914 0.917482062069182
where v ec is a vector in the ecliptic frame, v eq is a vector in the Earth equatorial frame and is the
mean obliquity of the ecliptic at J2000. The J2000 value of the mean obliquity of the ecliptic is equal to
23 2621.448 .
page 3
Orbital Mechanics with MATLAB
The moon_plot MATLAB script will also create a comma separated variable (csv) data file of the lunar
coordinates used to create the graphic displays. The name of this data file is moon_plot.csv. It
contains the Julian date on the Barycentric Dynamical Time (TDB) scale in column 1, the three
components of the EME2000 geocentric position vector of the Moon in columns 2, 3 and 4, and the
geocentric velocity vector in columns 5, 6, and 7. The units are kilometers for the position vector and
kilometers per second for the velocity vector. The data is written at the step size specified by the user.
This MATLAB script will also create a color encapsulated Postscript (eps) graphic image with a TIFF
preview. The name of the disk file is moon_plot.eps. The following source code performs this
operation.
page 4
Orbital Mechanics with MATLAB
This document describes a MATLAB script named levents.m that can be used to compute important
orbital events of the Moon. The motion of the Moon is modeled using the JPL DE421 binary ephemeris
and this script uses routines from the MICE software suite to read and evaluate this ephemeris. The
MICE routines and ephemeris file are available at naif.jpl.nasa.gov/naif/toolkit_MATLAB.html. MICE
is a MATLAB implementation of the SPICE library created by JPL.
Using a combination of one-dimensional minimization and root-finding, the levents MATLAB script
computes the following geocentric characteristics of the Moon’s orbital motion.
Script options 1, 2, and 6 are minimum and maximum conditions of the lunar orbit. The nodal crossings
correspond to times when the Moon crosses the Earth’s equatorial plane.
The levents MATLAB script will prompt you for the calendar date at which to start the events search
along with a search duration in days. The following illustrates these two prompts along with typical user
inputs shown in bold font. Please be sure to provide all digits of the calendar year.
program levents
The script will then display a list of event options with the following menu;
page 1
Orbital Mechanics with MATLAB
<5> user-defined true anomaly
For menu option 3, the script will also prompt for the user-defined value of geocentric right ascension
with the following display;
For menu option 4, the script will also prompt for the user-defined value of geocentric declination with
the following display;
For menu option 5, the script will also prompt for the user-defined value of true anomaly with the
following display;
For each of these script options, the input unit is degrees. Please note the range of valid input.
Script example
The following is a typical user interaction with this MATLAB script along with the program output for
the minimum and maximum geocentric declination of the moon during January 2014.
program levents
page 2
Orbital Mechanics with MATLAB
? 2
page 3
Orbital Mechanics with MATLAB
The orbital event summary screen contains the following information:
TDB Julian date = Julian Date of trajectory event on TDB time scale
UTC Julian date = Julian Date of trajectory event on UTC time scale
arglat (deg) = argument of latitude in degrees. The argument of latitude is the sum of
true anomaly and argument of perigee.
vmag (kps) = scalar magnitude of the Moon’s velocity vector in kilometers per second
Technical Discussion
In this MATLAB script, the orbital motion of the Moon is evaluated in the Earth mean equator and
equinox of J2000 (EME2000) coordinate system. The following figure illustrates the geometry of the
EME2000 coordinate system. The origin of this ECI inertial coordinate system is the geocenter and the
fundamental plane is the Earth’s mean equator. The z-axis of this system is normal to the Earth’s mean
equator at epoch J2000, the x-axis is parallel to the vernal equinox of the Earth’s mean orbit at epoch
J2000, and the y-axis completes the right-handed coordinate system. The epoch J2000 is the Julian Date
2451545.0 which corresponds to January 1, 2000, 12 hours Terrestrial Time (TT).
page 4
Orbital Mechanics with MATLAB
MATLAB functions
In this MATLAB script, the geocentric position and velocity vectors of the Moon are computed using a
function named jpleph_mice which requires initialization the first time it is called. The proper
initialization for this function is as follows:
iephem = 1;
ephname = 'de421.bsp';
km = 1;
The second item is the name of the binary ephemeris file to use for all calculations. The third item
determines the units of the output. If km = 1, the output will be in the units of kilometers and
kilometers per second. If km = 0, the output will be in the units of Astronomical Units and
Astronomical Units per day. These three items should be placed in a global statement at the beginning
of the main script which calls either of these functions.
Note that the value of the Astronomical Unit, in kilometers, used in a particular JPL ephemeris is
available as the constant au which is placed in global by the main script. The actual value used in a
particular JPL ephemeris can be found in the header file posted on the JPL website. For example, the
following are the first three lines in the header.421 data file. The value of Astronomical Unit used in
this ephemeris is the first number in row three of this data file.
% reads the jpl planetary ephemeris and gives the position and velocity
% of the point 'ntarg' with respect to point 'ncent' using MICE routines
% input
% 1 = mercury 8 = neptune
% 2 = venus 9 = pluto
% 3 = earth 10 = moon
% 4 = mars 11 = sun
% 5 = jupiter
% 6 = saturn
% 7 = uranus
% output
% global
It is good programming practice to close the binary ephemeris file at the end of the main script with the
following statement:
% unload ephemeris
cspice_unload('de421.bsp');
Time systems
Coordinated Universal Time (UTC) is the time scale available from broadcast time signals. It is a
compromise between the highly stable atomic time and the irregular earth rotation. UTC is the
international basis of civil and scientific time.
page 6
Orbital Mechanics with MATLAB
Terrestrial Time, TT
Terrestrial Time is the time scale that would be kept by an ideal clock on the geoid - approximately, sea
level on the surface of the Earth. Since its unit of time is the SI (atomic) second, TT is independent of
the variable rotation of the Earth. TT is meant to be a smooth and continuous “coordinate” time scale
independent of Earth rotation. In practice TT is derived from International Atomic Time (TAI), a time
scale kept by real clocks on the Earth's surface, by the relation TT = TAI + 32s.184. It is the time scale
now used for the precise calculation of future astronomical events observable from Earth.
In this equation, the coefficients are in seconds, the angular arguments are in radians, and T is the
number of Julian centuries of TT from J2000; T = (Julian Date(TT) – 2451545.0) / 36525.
The following is the MATLAB source code for the routine ported from the NOVAS Fortran subroutine.
Notice that the NOVAS name was simply times and the ported version is named novas_times to
avoid confusion with the built-in MATLAB function.
% input
page 7
Orbital Mechanics with MATLAB
% tdbjd = tdb julian date
% output
%%%%%%%%%%%%%%%%%%%%%%%
t0 = 2451545.0d0;
The fundamental time argument for the lunar ephemeris function used in this MATLAB script is
“ephemeris” time. As implemented here, we assume this time argument to be Barycentric Dynamical
Time (TDB). To report the time of these celestial events in Universal Coordinated Time (UTC) or civil
time, we need an algorithm to make this time conversion.
The following is the MATLAB source code for a function which iteratively performs this calculation
using Brent’s root-finding method.
% input
% output
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
global jdsaved
page 8
Orbital Mechanics with MATLAB
jdsaved = jdtdb;
% convergence tolerance
rtol = 1.0d-8;
x1 = jdsaved - 0.1;
x2 = jdsaved + 0.1;
jdutc = xroot;
end
This function calls the following MATLAB objective function during the calculations.
% input
% output
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
global jdsaved
tai_utc = findleap(jdin);
end
Notice that this function requires the findleap function which calculates the number of leap seconds
for the current UTC Julian date value. The jdfunc function is computing the difference between the
TDB Julian date input by the user and the value computed by the utc2tdb MATLAB function. The
algorithm has converged whenever this value is less than or equal to the user-defined tolerance rtol.
The difference between International Atomic Time (TAI) and Universal Coordinated Time (UTC) is the
number of current leap seconds. International Atomic Time (TAI, Temps Atomique International) is a
physical time scale with the unit of the SI (System International) second and derived from a statistical
page 9
Orbital Mechanics with MATLAB
timescale based on a large number of atomic clocks. Coordinated Universal Time (UTC) is the time
scale available from broadcast time signals. It is a compromise between the highly stable atomic time
and the irregular earth rotation. UTC is the international basis of civil and scientific time.
The calculation of leap seconds in this MATLAB script is performed by a function that reads a simple
ASCII data file and evaluates the current value of leap seconds. The leap second function must be
initialized by including the following statements in the main script.
readleap;
The readleap MATLAB function reads the contents of the following simple comma-separated-
variable (csv) two column data file. The name of this file is tai-utc.dat.
2441317.5, 10.0
2441499.5, 11.0
2441683.5, 12.0
2442048.5, 13.0
2442413.5, 14.0
2442778.5, 15.0
2443144.5, 16.0
2443509.5, 17.0
2443874.5, 18.0
2444239.5, 19.0
2444786.5, 20.0
2445151.5, 21.0
2445516.5, 22.0
2446247.5, 23.0
2447161.5, 24.0
2447892.5, 25.0
2448257.5, 26.0
2448804.5, 27.0
2449169.5, 28.0
2449534.5, 29.0
2450083.5, 30.0
2450630.5, 31.0
2451179.5, 32.0
2453736.5, 33.0
2454832.5, 34.0
The first column of this data file is the Julian date, on the UTC time scale, at which the leap second
became valid. The second column is the leap second value, in seconds.
Note that this data is passed between the leap second MATLAB functions by way of a global statement.
The MATLAB function that actually reads and evaluates the current value of leap seconds has the
following syntax and single argument.
page 10
Orbital Mechanics with MATLAB
% input
% output
The leap seconds data file should be updated whenever the International Earth Rotation and Reference
Systems Service (IERS) announces a new leap second.
page 11
Orbital Mechanics with MATLAB
Appendix A
Additional Script Examples
This appendix includes output created by several of the other levents script options.
program levents
? 3
program levents
? 6
page 13
Orbital Mechanics with MATLAB
calendar date 30-Jan-2014
program levents
? 7
page 14
Orbital Mechanics with MATLAB
page 15
Orbital Mechanics with MATLAB
Most of the information in this section was extracted from JPL D-32296, “Lunar Constants and Models
Document” which is available at ssd.jpl.nasa.gov/dat/lunar_cmd_2005_jpl_d32296.pdf. Another useful
reference is “Report of the IAU Working Group on Cartographic Coordinates and Rotational Elements:
2009”, Celestial Mechanics and Dynamical Astronomy, 109: 101-135, 2011.
The following figure illustrates the geometry of the EME2000 coordinate system. The origin of this ECI
inertial coordinate system is the geocenter and the fundamental plane is the Earth’s mean equator. The
z-axis of this system is normal to the Earth’s mean equator at epoch J2000, the x-axis is parallel to the
vernal equinox of the Earth’s mean orbit at epoch J2000, and the y-axis completes the right-handed
coordinate system. The epoch J2000 is the Julian Date 2451545.0 which corresponds to January 1,
2000, 12 hours Terrestrial Time (TT).
Figure 1. Earth mean equator and equinox of J2000 (EME2000) coordinate system
The following figure illustrates the orientation of the lunar mean equator and IAU node of epoch
coordinate system relative to the Earth’s mean equator and north pole of J2000. The x-axis or Q-vector
is formed from the cross product of the Earth’s mean pole of J2000 and the Moon’s north pole relative
to EME2000. The x-axis is aligned with the IAU node of epoch.
page 1
Orbital Mechanics with MATLAB
Figure 2. Moon mean equator and IAU node of epoch coordinate system
The following two equations describe the time evolution of the right ascension and declination of the
moon’s mean pole, in degrees, with respect to the Earth mean equator and equinox of J2000 (EME2000)
coordinate system.
The equation for the prime meridian of the Moon, in degrees, with respect to the IAU node vector is
given by the following expression
In these equations, T is the time in Julian centuries given by T JD 2451545.0 / 36525 and JD is the
Barycentric Dynamical Time (TDB) Julian Date.
page 2
Orbital Mechanics with MATLAB
E1 125.045 0.0529921d
E 2 250.089 0.1059842d
E 3 260.008 13.0120009d
E 4 176.625 13.3407154d
E 5 357.529 0.9856003d
E 6 311.589 26.4057084d
E 7 134.963 13.0649930d
E8 276.617 0.3287146d
E 9 34.226 1.7484877d
E10 15.134 0.1589763d
E11 119.743 0.0036096d
E12 239.961 0.1643573d
E13 25.053 12.9590088d
where d JD 2451545 is the number of days since January 1.5, 2000. These equations can also be
found in “Report of the IAU Working Group on Cartographic Coordinates and Rotational Elements:
2009”, Celestial Mechanics and Dynamical Astronomy, 109: 101-135, 2011.
A unit vector in the direction of the pole of the moon can be determined from
cos p cos p
pˆ Moon sin p cos p
sin p
The unit vector in the x-axis direction of this selenocentric coordinate system is given by
xˆ zˆ pˆ Moon
where zˆ 0 0 1 . The unit vector in the y-axis direction can be determined using
T
yˆ pˆ Moon xˆ
Finally, the components of the matrix that transforms coordinates from the EME2000 system to the
moon-centered (selenocentric) mean equator and IAU node of epoch system are as follows:
xˆ
M yˆ
pˆ Moon
page 3
Orbital Mechanics with MATLAB
This MATLAB function computes the orientation angles of the moon with respect to EME2000. It
implements the polynomial equations described above.
% input
% output
This MATLAB function computes the matrix which transforms coordinates between the Earth mean
equator and equinox of J2000 (EME2000) and lunar mean equator and IAU node of epoch coordinate
systems. It implements the equations described above.
% input
% output
This MATLAB function computes lunar libration angles and rates using information available on
modern JPL binary ephemeris files. Binary ephemeris files for Windows compatible computers can be
downloaded from the Celestial and Orbital Mechanics web site located at www.cdeagle.com.
page 4
Orbital Mechanics with MATLAB
% input
% output
This software suite includes a MATLAB script named demo_llib that demonstrates how to interact
with this function. The following is a summary of the results computed by this script.
program demo_llib
This MATLAB function determines a matrix that can be used to transform coordinates from the lunar
mean equator and IAU node of J2000 (which we’ll call the moon_j2000 system) to the lunar principal
axes (PA) system. The principal axis frame is aligned with the three maximum moments of inertia of
the Moon.
% transformation matrix from lunar mean equator and IAU node of j2000
% to the lunar principal axes system using JPL binary ephemeris
% input
% output
This MATLAB function determines a matrix that can be used to transform coordinates from the lunar
mean equator and IAU node of J2000 (which we’ll call the moon_j2000 system) to the lunar principal
axes (PA) system. The principal axis frame is aligned with the three maximum moments of inertia of
the Moon.
% transformation matrix from lunar mean equator and IAU node of j2000
% to the lunar principal axes system using JPL approximate equations
% input
% output
According to “Report of the IAU Working Group on Cartographic Coordinates and Rotational
Elements: 2009”, Celestial Mechanics and Dynamical Astronomy, 109: 101-135, 2011, the
transformation matrix from the Earth mean equator and equinox of J2000 (EME2000) coordinate system
to the moon-centered, body-fixed lunar principal axis (PA) system is given by the following (3-1-3)
rotation sequence;
M EME 2000 Rz Rx Rz
PA
In this equation, is the angle along the International Celestial Reference Frame (ICRF) equator, from
the ICRF x-axis to the ascending node of the lunar equator, is the inclination of the lunar equator to
the ICRF equator, and is the angle along the lunar equator from the node to the lunar prime meridian.
These three Euler angles represent the numerically integrated physical librations of the Moon.
The relationship between these angles and the classical IAU orientation angles is
90
90
W
The transformation from the moon_j2000 system to the PA system is given by the following matrix
multiplication;
page 6
Orbital Mechanics with MATLAB
Approximate lunar pole right ascension, declination and prime meridian in the PA system
Page 7 of the JPL document also provides the following “tweaks” to the orientation of the moon in order
to approximate the orientation in the PA system.
This MATLAB function determines a matrix that can be used to transform coordinates from the lunar
Mean Earth/polar axis (ME) to the lunar principal axes (PA) system. The principal axis frame is aligned
with the three maximum moments of inertia of the Moon.
page 7
Orbital Mechanics with MATLAB
% output
According to JPL D-32296, “Lunar Constants and Models Document” and the IAU 2000 resolutions, the
constant transformation matrix from the lunar Mean Earth/polar axis (ME) system to the lunar Principal
axis (PA) system is given by the following (1-2-3) rotation sequence;
This software suite includes a MATLAB script named demo_moon that demonstrates how to interact
with several of these coordinate transformation functions. The following is a summary of the results
computed by this script.
program demo_moon
page 8
Orbital Mechanics with MATLAB
moon_pa1 function
moon_pa2 function
page 9
Transformation to and from the lunar ME and PA Coordinate Systems
According to JPL D-32296, “Lunar Constants and Models Document” and the IAU 2000
resolutions, the constant transformation matrix from the lunar Mean Earth/polar axis
(ME) system to the lunar Principal axis (PA) system is given by the following (1-2-3)
rotation sequence;
These numbers have been confirmed using the following Fortran call to the sxform
subroutine of the JPL Spice library;
The following Fortran data statement can be used to include the ME-to-PA
transformation matrix in an analysis program.
data tm_me2pa
& / 0.999999878527094d0, -3.097891271165531d-4,
& 3.833751355924360d-4,
& 3.097894216177013d-4, 0.999999952015005d0,
& -7.087975496937868d-7,
& -3.833748976184077d-4, 8.275630251118771d-7,
& 0.999999926511499d0 /
π
The conversion from arc-seconds to radians is given by .
648000
Approximate lunar pole right ascension, declination and prime meridian in the PA
system
Page 1
Page 7 of the JPL document also provides the following “tweaks” to the orientation of the
moon in order to approximate the orientation in the PA system.
Wp = 38.3213 + Wd − 1.4i10−12 d 2
and
α IAU = 269.9949 + 0.0031T − 3.8787 sin E1 − 0.1204sin E 2
+0.0700sin E 3 − 0.0172sin E 4 + 0.0072sin E 6
−0.0052sin E10 + 0.0043sin E13
Page 2
E1 = 125.045 − 0.0529921d
E 2 = 250.089 − 0.1059842d
E 3 = 260.008 + 13.0120009d
E 4 = 176.625 + 13.3407154d
E 5 = 357.529 + 0.9856003d
E 6 = 311.589 + 26.4057084d
E 7 = 134.963 + 13.0649930d
E 8 = 276.617 + 0.3287146d
E 9 = 34.226 + 1.7484877d
E10 = 15.134 − 0.1589763d
E11 = 119.743 + 0.0036096d
E12 = 239.961 + 0.1643573d
E13 = 25.053 + 12.9590088d
where d = JD − 2451545 is the number of days since January 1.5, 2000. These equations
are given in “Report of the IAU/IAG Working Group on Cartographic Coordinates and
Rotational Elements of the Planets and Satellites: 2000”, Celestial Mechanics and
Dynamical Astronomy, 82: 83-110, 2002.
Page 3
A Moon-Centered, Inertial Coordinate System for Spice
This memo describes the steps used to create a right-handed, orthogonal selenocentric or moon-
centered inertial frame definition and data file (“frame kernel”) for Spice. The fundamental
plane of this inertial system is the lunar mean equator and the fundamental x-axis is the IAU
node of J2000. The y-axis is advanced 90 degrees along the lunar equator from the x-axis, and
the z-axis is perpendicular to the mean equator of the moon. The term mean indicates that
precession has been accounted for, but not the effect of nutation.
The following figure illustrates the orientation of this coordinate system relative to the Earth’s
mean equator and north pole of J2000 (EME2000). The x-axis or Q-vector is formed from the
cross product of the Earth’s mean pole of J2000 and the Moon’s north pole relative to EME2000.
In general, the x-axis is called the IAU node of epoch. For this application, we will set or
“freeze” the epoch to J2000 (January 1.5, 2000).
Figure 1. Moon mean equator and IAU node of epoch coordinate system
Page 1
Lunar pole right ascension and declination relative to EME2000
The following two equations describe the time evolution of the right ascension and declination of
the moon’s mean pole, in degrees, with respect to the Earth mean equator and equinox of J2000
(EME2000) coordinate system.
T JD 2451545.0 / 36525
The trigonometric arguments, in degrees, for the pole orientation equations are
E1 125.045 0.0529921d
E 2 250.089 0.1059842d
E 3 260.008 13.0120009d
E 4 176.625 13.3407154d
E 6 311.589 26.4057084d
E 7 134.963 13.0649930d
E10 15.134 0.1589763d
E13 25.053 12.9590088d
where d JD 2451545 is the number of days since January 1.5, 2000. These equations are
given in “Report of the IAU/IAG Working Group on Cartographic Coordinates and Rotational
Elements of the Planets and Satellites: 2000”, Celestial Mechanics and Dynamical Astronomy,
82: 83-110, 2002.
The three rotation angles used to create an Euler frame definition file for Spice are given by
1 90
2 90
3 0
Page 2
In order to define a frame relative to the IAU node of J2000, the values of both T and d used in
the polynomials evaluated to compute these angles are identically zero.
The following are the contents of a simple ASCII text file named moon_j2000.tf that provides
the frame definition information needed by Spice.
\begintext
\begindata
FRAME_MOON_J2000 = 4902
FRAME_4902_NAME = 'MOON_J2000'
FRAME_4902_CLASS = 5
FRAME_4902_CLASS_ID = 4902
FRAME_4902_CENTER = 301
FRAME_4902_RELATIVE = 'J2000'
FRAME_4902_DEF_STYLE = 'PARAMETERIZED'
FRAME_4902_FAMILY = 'EULER'
FRAME_4902_EPOCH = @2000-JAN-1/12:00:00
FRAME_4902_AXES = ( 3 1 3 )
FRAME_4902_UNITS = 'DEGREES'
FRAME_4902_ANGLE_1_COEFFS = ( -356.857733 0.0 0.0 )
FRAME_4902_ANGLE_2_COEFFS = ( -24.3588973 0.0 0.0 )
FRAME_4902_ANGLE_3_COEFFS = ( 0.0 0.0 0.0 )
Additional information can be found in the “FRAMES Required Reading” document, NAIF
Document No. 349.10, last modified 27 NOV 2006.
The numerical elements of the EME2000-to-Moon mean equator and IAU node of J2000
transformation matrix are as follows.
The following is the Fortran subroutine that was used to compute the two angles defined in the
Spice frame definition file. For the example described in this document, the input argument
xjdate was equal to 2451545.
c input
c output
Page 3
c tmatrix = transformation matrix
c ************************************
c time arguments
d = xjdate - 2451545.0d0
e1 = 125.045d0 - 0.0529921d0 * d
e2 = 250.089d0 - 0.1059842d0 * d
e3 = 260.008d0 + 13.0120009d0 * d
e4 = 176.625d0 + 13.3407154d0 * d
e5 = 357.529d0 + 0.9856003d0 * d
e6 = 311.589d0 + 26.4057084d0 * d
e7 = 134.963d0 + 13.0649930d0 * d
e8 = 276.617d0 + 0.3287146d0 * d
Page 4
& + 0.0239d0 * cos(dtr * e2)
& - 0.0278d0 * cos(dtr * e3)
& + 0.0068d0 * cos(dtr * e4)
& - 0.0029d0 * cos(dtr * e6)
& + 0.0009d0 * cos(dtr * e7)
& + 0.0008d0 * cos(dtr * e10)
& - 0.0009d0 * cos(dtr * e13)
zhat(1) = 0.0d0
zhat(2) = 0.0d0
zhat(3) = 1.0d0
c compute y-direction
tmatrix(1, 1) = xhat(1)
tmatrix(1, 2) = xhat(2)
tmatrix(1, 3) = xhat(3)
tmatrix(2, 1) = yhat(1)
tmatrix(2, 2) = yhat(2)
tmatrix(2, 3) = yhat(3)
tmatrix(3, 1) = phat_moon(1)
tmatrix(3, 2) = phat_moon(2)
tmatrix(3, 3) = phat_moon(3)
return
end
The following figure illustrates the geometry of the EME2000 coordinate system. Both
coordinate system illustrations used in this memo were extracted from JPL D-32296, “Lunar
Constants and Models Document” dated September 23, 2005.
Page 5
Figure 2. Earth mean equator and equinox of J2000 coordinate system
Page 6
Coordinate Transformation from the Moon Mean Equator and
IAU Node of J2000 System to the Lunar PA Coordinate System
M EME 2000 Rz Rx Rz
PA
In this equation, is the angle along the ICRF (International Celestial Reference Frame)
equator, from the ICRF x-axis to the ascending node of the lunar equator, is the
inclination of the lunar equator to the ICRF equator, and is the angle along the lunar
equator from the node to the lunar prime meridian. These three Euler angles represent
the numerically integrated physical librations of the Moon.
The principal axis frame is aligned with the three maximum moments of inertia of the
Moon. The LP150Q lunar gravity model was developed using this frame.
The relationship between these angles and the classical IAU (International Astronomical
Union) orientation angles is
90
90
W
For long-term orbit prediction of low lunar orbits (LLO), we require the transformation
between the inertial Moon mean equator and IAU node of J2000 system and the body-
fixed PA coordinate system.
The transformation from this inertial system which we will call moon_j2000 to the PA
system is given by the following matrix multiplication;
Page 1
For accurate orbital analysis, the lunar libration angles can be obtained from a lunar
ephemeris. The JPL Developmental Ephemeris DE403 is considered the best currently
available lunar ephemeris. Chebyshev polynomial representations of the Euler angles
and their rates in the PA system are included in the DE403 ephemeris file which is
available from http://ssd.jpl.nasa.gov.
Fortran subroutine
The following is the source code listing for a Fortran subroutine that evaluates the DE403
ephemeris file and computes this coordinate transformation.
c moon_j2000-to-moon_pa transformation
c matrix using DE403.bin binary ephemeris
c input
c output
c ************************************
dimension tmatrix(3, 3)
data tmatrix2
& / 0.998496505205088d0,
& -5.481540926807404d-2,
& 0.0d0,
& 4.993572939853833d-2,
& 0.909610125238044d0,
& 0.412451018902688d0,
& -2.260867140418499d-2,
& -0.411830900942612d0,
& 0.910979778593430d0 /
icent = 0
itarg = 15
Page 2
phi = sv(1)
theta = sv(2)
psi = sv(3)
end
In this subroutine, jpleph is a subroutine that evaluates the binary ephemeris file,
matran is a subroutine that performs a sequence of ordered rotations, and matxmat is a
Fortran subroutine that performs multiplies two matrices. The source code for the
jpleph subroutine is provided by JPL as are routines for creating a binary DE403
ephemeris file from the ASCII source data. It also includes routines that open and read
the binary file.
Page 3
Orbital Mechanics with MATLAB
The second function, jpleph_mice.m, uses routines from the MICE software suite to read and
evaluate binary ephemeris files available at naif.jpl.nasa.gov/naif/toolkit_MATLAB.html. MICE is a
MATLAB implementation of the SPICE library created by JPL.
Each ephemeris function requires initialization the first time it is called. The following three statements
in the main MATLAB script will perform the proper initialization for jplephem:
iephem = 1;
ephname = 'de405.bin';
km = 1;
iephem = 1;
ephname = 'de405.bsp';
km = 1;
The second item is the name of the binary ephemeris file to use for all calculations. The third item
determines the units of the output. If km = 1, the output will be in the units of kilometers and
kilometers per second. If km = 0, the output will be in the units of AUs and AUs per day. These three
items should be placed in a global statement at the beginning of the main script which calls either of
these functions.
Note that the value of the Astronomical Unit, in kilometers, used in a particular JPL ephemeris is
available as the constant au which is placed in global by the jplephem function. However, when using
the jpleph_mice function, the user must define this numerical value in the main script and also make
it available in a global statement. The actual value used in a particular JPL ephemeris can be found in
the header file posted on the JPL website. For example, the following are the first three lines in the
header.421 data file. The value of Astronomical Unit used in this ephemeris is the first number in
row three of this data file.
page 1
Orbital Mechanics with MATLAB
demo_jpl is a simple MATLAB script that demonstrates how to interact with the jplephem function.
Binary ephemeris files for Windows compatible computers can be downloaded from the Celestial and
Orbital Mechanics web site located at www.cdeagle.com.
The coordinates calculated by this function are with respect to the International Celestial Reference
System (ICRS) which is described in “The International Celestial Reference Frame as Realized by Very
Long Baseline Interferometry”, C. Ma, E. Arias, T. Eubanks, A. Fey, A. Gontier, C. Jacobs, O. Sovers,
B. Archinal and P. Charlot, The Astronomical Journal, 116:516-546, 1998, July.
% input
% 1 = mercury 8 = neptune
% 2 = venus 9 = pluto
% 3 = earth 10 = moon
% 4 = mars 11 = sun
% 5 = jupiter 12 = solar-system barycenter
% 6 = saturn 13 = earth-moon barycenter
% 7 = uranus 14 = nutations (longitude and obliq)
% 15 = librations, if on ephemeris file
% output
page 2
Orbital Mechanics with MATLAB
The following is a typical user interaction with this script using the DE421 ephemeris file.
<1> Mercury
<2> Venus
<3> Earth
<4> Mars
<5> Jupiter
<6> Saturn
<7> Uranus
<8> Neptune
<9> Pluto
<10> Moon
<11> Sun
<1> Mercury
<2> Venus
<3> Earth
<4> Mars
<5> Jupiter
<6> Saturn
<7> Uranus
<8> Neptune
<9> Pluto
<10> Moon
<11> Sun
<12> solar-system barycenter
<13> Earth-Moon barycenter
program demo_jpl
page 3
Orbital Mechanics with MATLAB
state vector
Note that UTC is the Coordinates Universal Time and TDB is the Barycentric Dynamical Time.
% reads the jpl planetary ephemeris and gives the position and velocity
% of the point 'ntarg' with respect to point 'ncent' using MICE routines
% input
% 1 = mercury 8 = neptune
% 2 = venus 9 = pluto
% 3 = earth 10 = moon
% 4 = mars 11 = sun
% 5 = jupiter
% 6 = saturn
% 7 = uranus
% output
% global
demo_jpl_mice is a simple MATLAB script that demonstrates how to interact with the jpleph_mice
function. Binary ephemeris files for can be downloaded from the JPL NAIF website located at
naif.jpl.nasa.gov/naif/toolkit_MATLAB.html.
page 4
Orbital Mechanics with MATLAB
The following is a typical user interaction with this script using the DE421 ephemeris file.
<1> Mercury
<2> Venus
<3> Earth
<4> Mars
<5> Jupiter
<6> Saturn
<7> Uranus
<8> Neptune
<9> Pluto
<10> Moon
<11> Sun
<1> Mercury
<2> Venus
<3> Earth
<4> Mars
<5> Jupiter
<6> Saturn
<7> Uranus
<8> Neptune
<9> Pluto
<10> Moon
<11> Sun
program demo_jpl_mice
page 5
Orbital Mechanics with MATLAB
TDB Julian date 2451107.50073128
state vector
It is good programming practice to close the binary ephemeris file at the end of the main script with the
following statement:
% unload ephemeris
cspice_unload('de421.bsp');
Please note the following extracted from JPL IOM 343R-08-003, dated 31-March 2008.
In a resolution adopted by the International Astronomical Union in 2006 (GA26.3), the time scale TDB
(Temps Dynamique Barycentrique, Barycentric Dynamical Time) was defined to be consistent with the
JPL ephemeris time.
The axes of the ephemeris are oriented with respect to the International Celestial Reference Frame
(ICRF).
Furthermore, the relationship between the ICRF and EME 2000 coordinate frames is described in the
moon_080317.tf text file which is located on the JPL ftp server at
ftp://naif.jpl.nasa.gov/pub/naif/generic_kernels/fk/satellites/,
The IERS Celestial Reference Frame (ICRF) is offset from the J2000 reference frame (equivalent to
EME 2000) by a small rotation; the J2000 pole offset magnitude is about 18 milliarcseconds (mas) and
the equinox offset magnitude is approximately 78 milliarcseconds.
The following describes a MATLAB function that can be used to compute the J2000-to-ICRS
transformation matrix.
This MATLAB function returns the transformation matrix from the mean dynamical equator and
equinox at J2000 to the International Celestial Reference System (ICRS). There are two options for this
matrix based on different data types via the itype argument.
% input
page 6
Orbital Mechanics with MATLAB
% output
To transform coordinates from the ICRS system to the J2000 system, the programmer should use the
transpose of the matrix returned by this function.
The difference between International Atomic Time (TAI) and Universal Coordinated Time (UTC) is the
number of current leap seconds. International Atomic Time (TAI, Temps Atomique International) is a
physical time scale with the unit of the SI (System International) second and derived from a statistical
timescale based on a large number of atomic clocks. Coordinated Universal Time (UTC) is the time
scale available from broadcast time signals. It is a compromise between the highly stable atomic time
and the irregular earth rotation. UTC is the international basis of civil and scientific time.
The calculation of leap seconds in these MATLAB scripts is performed by a function that reads a simple
ASCII data file and evaluates the current value of leap seconds. The leap second function must be
initialized by including the following statements in the main script.
readleap;
The readleap MATLAB function reads the contents of the following simple comma-separated-
variable (csv) two column data file. The name of this file is tai-utc.dat.
2441317.5, 10.0
2441499.5, 11.0
2441683.5, 12.0
2442048.5, 13.0
2442413.5, 14.0
2442778.5, 15.0
2443144.5, 16.0
2443509.5, 17.0
2443874.5, 18.0
2444239.5, 19.0
2444786.5, 20.0
2445151.5, 21.0
2445516.5, 22.0
2446247.5, 23.0
2447161.5, 24.0
2447892.5, 25.0
2448257.5, 26.0
2448804.5, 27.0
page 7
Orbital Mechanics with MATLAB
2449169.5, 28.0
2449534.5, 29.0
2450083.5, 30.0
2450630.5, 31.0
2451179.5, 32.0
2453736.5, 33.0
2454832.5, 34.0
The first column of this data file is the Julian date, on the UTC time scale, at which the leap second
became valid. The second column is the leap second value, in seconds.
Note that this data is passed between the leap second MATLAB functions by way of a global statement.
The MATLAB function that actually reads and evaluates the current value of leap seconds has the
following syntax and single argument.
% input
% output
The leap seconds data file should be updated whenever the International Earth Rotation and Reference
Systems Service (IERS) announces a new leap second.
page 8
Orbital Mechanics with MATLAB
JED 2451545
t
36525
where JED is the Julian Date on the terrestrial time (TDT or TT) scale.
The osculating orbital elements are calculated from series of the form
a 383397.6 Sa tSa
where
30
Sa an cos n n t n 104 t 2 n 106 t 3 n 108 t 4
0 1 2 3 4
n 1
3
Sa an cos n n t
0 1
n 1
The first few multipliers and trigonometric arguments for this orbital element are
% input
page 1
Orbital Mechanics with MATLAB
% output
This software suite includes a script called demo_elp that demonstrates how to interact with this
MATLAB function. The following is a typical user interaction with this script.
program demo_elp
? 9
The following are two graphics displays created for this example. The first plot is the geocentric orbital
inclination of the moon and the second display is the orbital eccentricity of the moon’s orbit.
page 2
Orbital Mechanics with MATLAB
page 3