Você está na página 1de 270

Program ca_sc2moon

Closest Approach Between a Spacecraft and the Moon

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:

• Equations of motion based on modified equinoctial orbital elements


• B-plane coordinates at closest approach
• JPL DE405 ephemeris and sun and moon point-mass gravity
• Tangential or gravity turn steering
• Brent’s method for one-dimensional minimization
• Runge-Kutta-Fehlberg 7(8) numerical integration method

Running the computer program

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 *
*************************************

please input the name of the simulation definition file

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

thrust magnitude (newtons)


5000.0

specific impulse (seconds)


450.0

thrust duration (seconds)


450.0

type of steering method (1 = gravity turn, 2 = tangential)


1

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 *
******************

TLI calendar date (month, day, year)


10, 12, 2008

TLI universal time (hours, minutes, seconds)


4,23,5.376

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
******************

semimajor axis (kilometers)


6563.34

orbital eccentricity (non-dimensional)


0.0d0

orbital inclination (degrees)


28.5d0

argument of perigee (degrees)


0.0d0

right ascension of the ascending node (degrees)


289.996

true anomaly (degrees)


280.5758

The next two inputs specify the third-body perturbations to include in the simulation.
*********************
orbital perturbations
*********************

include solar point-mass gravity (1 = yes, 0 = no)


1

include lunar point-mass gravity (1 = yes, 0 = no)


1

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

closest approach between a spacecraft and the moon


==================================================

conditions at beginning of TLI propulsive maneuver


(Earth mean equator and equinox of J2000)
-----------------------------------------

calendar date October 12, 2008

TDB time 04:23:05.376

TDB Julian date 2454751.682701110839844

sma (km) eccentricity inclination (deg) argper (deg)


0.656334000000D+04 0.109294907647D-15 0.285000000000D+02 0.000000000000D+00

raan (deg) true anomaly (deg) arglat (deg) period (min)


0.289996000000D+03 0.280575800000D+03 0.280575800000D+03 0.881956335064D+02

rx (km) ry (km) rz (km) rmag (km)


-.491626555370D+04 -.307087258346D+04 -.307855591752D+04 0.656334000000D+04

vx (kps) vy (kps) vz (kps) vmag (kps)


0.380079445708D+01 -.676901185656D+01 0.682481695207D+00 0.779303158492D+01

conditions at end of TLI propulsive maneuver


(Earth mean equator and equinox of J2000)
-----------------------------------------

calendar date October 12, 2008

TDB time 04:30:35.376

TDB Julian date 2454751.687909444328398

sma (km) eccentricity inclination (deg) argper (deg)


0.182182408149D+06 0.963689475858D+00 0.285122681403D+02 0.296686390532D+03

raan (deg) true anomaly (deg) arglat (deg) period (min)


0.289941643145D+03 0.193524224957D+02 0.316038813028D+03 0.128979113590D+05

rx (km) ry (km) rz (km) rmag (km)


-.223099128979D+04 -.601926372743D+04 -.225450892411D+04 0.680379808962D+04

vx (kps) vy (kps) vz (kps) vmag (kps)


0.821222424436D+01 -.618487272440D+01 0.304775038350D+01 0.107229688080D+02

spacecraft mass 490.141893511035732 kilograms

deltav 3146.729982208522415 meters/second

thrust duration 450.000000000000000 seconds

page 4
conditions at lunar closest approach
(Earth mean equator and equinox of J2000)
-----------------------------------------

calendar date October 17, 2008

TDB time 02:33:01.791

TDB Julian date 2454756.606270729564130

sma (km) eccentricity inclination (deg) argper (deg)


0.179122336690D+06 0.963056247650D+00 0.285136918580D+02 0.296744891710D+03

raan (deg) true anomaly (deg) arglat (deg) period (min)


0.289916718628D+03 0.181609059549D+03 0.118353951259D+03 0.125743153965D+05

rx (km) ry (km) rz (km) rmag (km)


0.196735748666D+06 0.247092412043D+06 0.146215327323D+06 0.348049618354D+06

vx (kps) vy (kps) vz (kps) vmag (kps)


-.227770023258D+00 0.353250301545D-01 -.109801063175D+00 0.255310232315D+00

closest approach distance 16925.351468373439275 kilometers

conditions at lunar closest approach


(selenocentric - lunar equator and equinox of J2000)
----------------------------------------------------

calendar date October 17, 2008

TDB time 02:33:01.791

TDB Julian date 2454756.606270729564130

sma (km) eccentricity inclination (deg) argper (deg)


-.189171252628D+05 0.189471054635D+01 0.147060655084D+02 0.115217394887D+03

raan (deg) true anomaly (deg) arglat (deg) period (min)


0.111866994762D+03 0.142733977216D-03 0.115217537621D+03 0.000000000000D+00

rx (km) ry (km) rz (km) rmag (km)


-.110592598603D+05 -.122086061001D+05 0.388718807555D+04 0.169253514793D+05

vx (kps) vy (kps) vz (kps) vmag (kps)


0.658763135705D+00 -.628282202390D+00 -.990412465936D-01 0.915705500328D+00

-----------------------------------------

b-plane coordinates of incoming hyperbola


(selenocentric - lunar equator and equinox of J2000)

b-magnitude 30443.809071734696772 kilometers


b dot r -7679.966257239961124
b dot t 29459.185818414796813
theta 345.388301920592198 degrees
v-infinity 509.089956780863986 meters/second
r-periapsis 16925.351479275006568 kilometers
decl-asy 1.681732863833258 degrees
rasc-asy 285.444089399385518 degrees

flight path angle 9.342542810087221E-005 degrees

lunar coast time 118.040670845657587 hours

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.

Lunar Trajectory Analysis


Finite-Burn Gravity-turn Steering
Mass = 1000 kg Thrust = 5000 N Isp = 450 s

40

Lunar Orbit

lunar transfer
trajectory
20
y coordinate (ER)

0
TLI

-20
0 20 40 60
x coordinate (ER)

The following is a plot of the selenocentric distance of the spacecraft.

Lunar Trajectory Analysis


Finite-Burn Gravity-turn Steering
Mass = 1000 kg Thrust = 5000 N Isp = 450 s

400000
spacecraft-to-moon distance (km)

300000

200000

100000

0
0 40 80 120
mission elapsed time (hours)

page 6
Technical Discussion

The closest approach encounter time can be computed by performing a one-dimensional


minimization while numerically integrating the equations of motion. This process determines future
close approach conditions between the spacecraft in its lunar transfer orbit and the Moon. This
computational process is performed using Brent’s minimization algorithm with the following
objective function

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
r×v r×v r
r n t n r
r

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ˆ 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

Modified equinoctial orbital elements

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 )

right ascension of the ascending node

Ω = 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 ⎪
⎪ ⎪
⎪ p s 2 sin L ⎪
⎪ 0 0 ⎪
⎪ µ 2w ⎪
⎪ p ⎪
⎪ 0 0 [ h sin L − k cos L] ⎪
⎩⎪ µ ⎭⎪

The total non-two-body acceleration vector is given by

P = ∆ r ˆi r + ∆ t ˆit + ∆ n ˆi n

where ˆi r , ˆ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
r×v
n

ˆi = ˆi × ˆi = ( r × v ) × r
r×v 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.

Non-spherical Earth Gravity

The non-spherical gravitational acceleration vector can be expressed as

g = g N ˆi N − g r ˆi r

where

page 11
ˆi = ( )
eˆ N − eˆ TN ˆi r ˆi r
− ( eˆ ˆi ) ˆi
N
T
eˆ N 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.

The contributions due to the zonal gravity effects of J 2 , J 3 , J 4 are as follows:

µ cos φ
k
4
⎛ Re ⎞ '
gN = −
r2
∑ ⎜ ⎟ Pk J k
k =2 ⎝ r ⎠

µ
k
4
⎛R ⎞
g r = − 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.

Finally, the zonal gravity perturbation contribution is

a g = QT g
where Q = ⎡⎣ ˆi r ˆit ˆi n ⎤⎦ .

For J 2 effects only, the three components are as follows:

3µ J 2 Re2 ⎡⎢ 12 ( h sin L − k cos L ) ⎤⎥


2

∆ J2 = − 1 −
r
2r 4 ⎢
⎣ (1 + h 2
+ k ) ⎥⎦
2 2

12 µ J 2 Re2 ⎡⎢ ( h sin L − k cos L )( h cos L + k sin L ) ⎤⎥


∆ J2 = −
t
r4 ⎢
⎣ (1 + h 2
+ k )
2 2 ⎥

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 ⎥

These are the equations modeled in this computer program,

Propulsive thrust

The acceleration due to propulsive thrust can be expressed as

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.

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 predicted B-plane vector from
a moon-centered position vector r and velocity vector v at closest approach.

angular momentum vector


h =r×v
h
hˆ =
h

page 14
radius rate
ri 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

rh
sin θ =

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.

Geocentric-to-selenocentric coordinate transformation

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

α 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

δ P = 66.5392 + 0.0130T + 1.5419 cos E1 + 0.0239 cos E 2


−0.0278cos E 3 + 0.0068cos E 4 − 0.0029 cos E 6
+0.0009 cos E 7 + 0.0008cos E10 − 0.0009 cos E13

where T is the time in Julian centuries given by T = ( JD − 2451545.0 ) / 36525 and JD is the TDB
Julian Date.

The trigonometric arguments, in degrees, for these equations are

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

The unit vector in the y-axis direction can be determined using

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 ⎥⎦

Lunar and solar ephemeris

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

“A Set of Modified Equinoctial Orbital Elements”, M. J. H. Walker, B. Ireland and J. Owens,


Celestial Mechanics, Vol. 36, pp. 409-419, 1985.

“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.

“Equinoctial Orbit Elements: Application to Optimal Transfer Problems”, Jean A. Kechichian,


AIAA 90-2976, AIAA/AAS Astrodynamics Conference, Portland, OR, 20-22 August 1990.

“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
Orbital Mechanics with MATLAB

Osculating Orbital Elements of the Moon


This document describes a MATLAB function that calculates the osculating classical orbital elements of
the Moon in the mean ecliptic and mean equinox of date coordinate system. It is based on the book
Lunar Tables and Programs From 4000 B.C. TO A.D. 8000 by Michelle Chapront-Touze and Jean
Chapront. This book and its optional companion software are available from Willmann-Bell at
www.willbell.com.

The fundamental time argument of this algorithm is

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 104 t 2   n 106 t 3   n 108 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

n an  n0  n1  n 2  n3  n 4


1 3400.4 235.7004 890534.2230 -32.601 3.664 -1.769
2 -635.6 100.7370 413335.3554 -122.571 -10.684 5.028

n an  n0  n1


1 -0.55 238.2 854535.2
2 0.10 103.2 377336.3

The syntax for this MATLAB function is

function oev = elp2000(tjd)

% osculating orbital elements of the moon

% mean ecliptic and mean equinox of date

% input

% tjd = tdt Julian date

page 1
Orbital Mechanics with MATLAB

% output

% oev(1) = semimajor axis (kilometers)


% oev(2) = orbital eccentricity (non-dimensional)
% (0 <= eccentricity < 1)
% oev(3) = orbital inclination (radians)
% (0 <= inclination <= pi)
% oev(4) = argument of perigee (radians)
% (0 <= argument of perigee <= 2 pi)
% oev(5) = right ascension of ascending node (radians)
% (0 <= raan <= 2 pi)
% oev(6) = true anomaly (radians)
% (0 <= true anomaly <= 2 pi)

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

< orbital elements of the moon >

please input a UTC calendar date

please input the calendar date


(1 <= month <= 12, 1 <= day <= 31, year = all digits!)
? 4,1,2013

please input the simulation period (days)


? 180

please input the graphics step size (days)


? 0.1

please select the orbital element to plot

<1> semimajor axis


<2> eccentricity
<3> orbital inclination
<4> argument of perigee
<5> right ascension of the ascending node
<6> true anomaly
<7> apogee radius
<8> perigee radius
<9> geocentric distance

? 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
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.

Input data file

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.

gravitational constant of the earth (kilometers^3/second^2)


398600.4415

page 1
gravitational constant of the moon (kilometers^3/second^2)
4902.8

radius of the earth (kilometers)


6378.14

radius of the moon (kilometers)


1738.0

The next two inputs specify the (constant) distance from the earth to the moon and the radius of the
lunar sphere-of-influence (SOI).

distance from the earth to the moon (kilometers)


384400.0

lunar sphere-of-influence radius (kilometers)


64000.0

The next two inputs define the altitudes of the circular earth park orbit and the lunar close approach.

altitude of the circular earth park orbit (kilometers)


463.0

altitude of lunar close approach (kilometers)


100.0

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

initial guess for tli delta-v magnitude (kilometers/second)


3.093

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.

Script example and trajectory graphics

The following is the script output for the example given earlier. The first part of the output summarize
the SNOPT algorithm results.

Lunar free return trajectory analysis


=====================================

please wait, solving optimization problem ...

Nonlinear constraints 2 Linear constraints 1


Nonlinear variables 2 Linear variables 0
Jacobian variables 2 Objective variables 0
Total constraints 3 Total variables 2

The user has defined 0 out of 4 first derivatives

Major Minors Step nCon Feasible Optimal MeritFunction nS Penalty


0 1 1 9.5E+00 7.8E-05 3.0930000E+00 r
1 0 1.0E+00 2 5.2E-01 6.9E-06 3.0929029E+00 n r
2 0 1.0E+00 3 4.6E-03 6.5E-03 3.0928921E+00 sm
2 0 1.0E+00 3 4.6E-03 6.5E-03 3.0928922E+00 7.8E-05 sm c
3 0 1.0E+00 4 8.4E-06 5.3E-06 3.0928922E+00 8.1E-05 m c
4 0 1.0E+00 5 (7.4E-08)(4.6E-08) 3.0928922E+00 2.9E-03 n c

SNOPTA EXIT 0 -- finished successfully


SNOPTA INFO 1 -- optimality conditions satisfied
Problem name
No. of iterations 1 Objective value 3.0928921545E+00
No. of major iterations 4 Linear objective 3.0928921545E+00
Penalty parameter 2.919E-03 Nonlinear objective 0.0000000000E+00
No. of calls to funobj 39 No. of calls to funcon 39
Calls with modes 1,2 (known g) 5 Calls with modes 1,2 (known g) 5
Calls for forward differencing 6 Calls for forward differencing 6
Calls for central differencing 12 Calls for central differencing 12
No. of degenerate steps 0 Percentage .00
Max x 1 4.0E+00 Max pi 3 1.0E+00
Max Primal infeas 0 0.0E+00 Max Dual infeas 2 9.3E-07
Nonlinear constraint violn 4.4E-07

Solution printed on file 9

TLI delta-v 3092.89215449 meters/second

one way time of flight 68.86984088 hours


2.86957670 days

round trip time of flight 137.73968176 hours


5.73915341 days

geocentric orbital elements and state vector at Earth departure


---------------------------------------------------------------

sma (km) eccentricity inclination (deg) argper (deg)


+2.68940565889181e+05 +9.74562632537856e-01 +0.00000000000000e+00 +2.27464212649094e+02

raan (deg) true anomaly (deg) arglat (deg) period (hrs)


+0.00000000000000e+00 +0.00000000000000e+00 +2.27464212649094e+02 +3.85560869878036e+02

page 3
rx (km) ry (km) rz (km) rmag (km)
-4.62495669538951e+03 -5.04092968264503e+03 +0.00000000000000e+00 +6.84114000000000e+03

vx (kps) vy (kps) vz (kps) vmag (kps)


+7.90355112502884e+00 -7.25135718891348e+00 +0.00000000000000e+00 +1.07260571258572e+01

altitude 463.00000000 kilometers

flight path angle -0.00000000 degrees

selenocentric orbital elements and state vector at lunar flyby


--------------------------------------------------------------

sma (km) eccentricity inclination (deg) argper (deg)


-4.12030624842125e+03 +1.44608334663421e+00 +1.80000000000000e+02 +3.22368803066883e+02

raan (deg) true anomaly (deg) arglat (deg)


+0.00000000000000e+00 +4.07110999227330e-13 +3.22368803066884e+02

rx (km) ry (km) rz (km) rmag (km)


+1.45561753333692e+03 +1.12223954586784e+03 +0.00000000000000e+00 +1.83800000045362e+03

vx (kps) vy (kps) vz (kps) vmag (kps)


+1.55964235903821e+00 -2.02295737296920e+00 +0.00000000000000e+00 +2.55437679698135e+00

altitude 100.00000045 kilometers

flight path angle 0.00000000 degrees

mission time at flyby 68.86984088 hours


2.86957670 days

geocentric orbital elements and state vector at Earth arrival


-------------------------------------------------------------

sma (km) eccentricity inclination (deg) argper (deg)


+2.68940565843722e+05 +9.74562632622988e-01 +0.00000000000000e+00 +2.07798181207688e+02

raan (deg) true anomaly (deg) arglat (deg) period (hrs)


+0.00000000000000e+00 +3.59999995751323e+02 +2.07798176959011e+02 +3.85560869780278e+02

rx (km) ry (km) rz (km) rmag (km)


-6.05164378768879e+03 -3.19042373948091e+03 +0.00000000000000e+00 +6.84113997594814e+03

vx (kps) vy (kps) vz (kps) vmag (kps)


+5.00218820872306e+00 -9.48822507116623e+00 +0.00000000000000e+00 +1.07260571449436e+01

altitude 462.99997595 kilometers

flight path angle -0.00000210 degrees

circularization deltav 3092.89216016 meters/second

image trajectory mission constraints at lunar closest approach


--------------------------------------------------------------

y-component of relative position vector 0.00044392 meters

x-component of relative velocity vector -0.00000000 meters/second

moon-third body geocentric separation angle 0.00000000 degrees

geocentric inertial flight path angle 0.00000002 degrees

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:

sma (km) = semimajor axis in kilometers

eccentricity = orbital eccentricity (non-dimensional)

inclination (deg) = orbital inclination in degrees

argper (deg) = argument of perigee in degrees

raan (deg) = right ascension of the ascending node in degrees

true anomaly (deg) = true anomaly in degrees

arglat (deg) = argument of latitude in degrees. The argument of latitude is the sum of
true anomaly and argument of perigee.

period (hrs) = orbital period in hours

rx (km) = x-component of the third body position vector in kilometers

ry (km) = y-component of the third body position vector in kilometers

rz (km) = z-component of the third body position vector in kilometers

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;

would you like to display trajectory graphics (y = yes, n = no)


?

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;

print -depsc -tiff -r300 free_return1.eps

The following are typical graphic displays created by this script.

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

axis([-5.0 60.0 -5.0 60.0]);

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

rE  B  xE2  B  yE2  B rM  B  xM2  B  yM2  B

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 .

Using the method of order reduction, we can define the following

y(1)  xE  B y(2)  yE  B y(3)  xE  B y(4)  yE  B

and create the equivalent first-order system of differential equations given by

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

xER B  xE  B cos  t   yE  B sin  t 

yER B  xE  B sin  t   yE  B cos  t 

Predicting closest approach to the moon

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.

Close approach is predicted with the following mission constraint

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.

% set up options for ode45

options = odeset('RelTol', 1.0e-10, 'AbsTol', 1.0e-10, 'Events', @fpa_event);

% solve for lunar closest approach conditions

tend = 7.0 * 86400.0;

[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.

function [value, isterminal, direction] = fpa_event(t, y)

% selenocentric flight path angle event function

% input

% t = simulation time (seconds)


% y = third body geocentric state vector (km, km/sec)

% output

% value = sine of selenocentric flight path angle

% Orbital Mechanics with MATLAB

page 10
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

global distance_e2m vlc_moon omega_moon

% inertial geocentric lunar position vector (kilometers)

theta_moon = omega_moon * t;

rmoon(1) = distance_e2m * cos(theta_moon);

rmoon(2) = distance_e2m * sin(theta_moon);

% inertial geocentric lunar velocity vector (kilometers/second)

vmoon(1) = -vlc_moon * sin(theta_moon);

vmoon(2) = vlc_moon * cos(theta_moon);

% form the selenocentric third body position and velocity

rm2sc(1) = y(1) - rmoon(1);

rm2sc(2) = y(2) - rmoon(2);

vm2sc(1) = y(3) - vmoon(1);

vm2sc(2) = y(4) - vmoon(2);

% sine of the selenocentric flight path angle

value = rm2sc * vm2sc' / (norm(rm2sc) * norm(vm2sc));

isterminal = 1;

direction = [];

Nonlinear programming problem

A trajectory optimization problem can be described by a system of dynamic variables

 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

where p is a vector of problem parameters that is not time dependent.

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.

The problem may also be subject to path constraints of the form g  y  t  , u  t  , t   0 .

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

and the problem parameters


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

while satisfying all the user-defined mission constraints.

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.

The bounds on the scalar value of TLI delta-v are given by

Vg  100  V  Vg  100

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.

These are implemented as equality constraints according to

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(1) = dtr * theta_tli;

xg(2) = deltav_tli;

xg = xg';

% lower and upper bounds for TLI theta (radians)

xlwr(1) = xg(1) - 10.0 * dtr;

xupr(1) = xg(1) + 10.0 * dtr;

% lower and upper bounds for TLI delta-v (meters/second)

xlwr(2) = xg(2) - 0.100;

xupr(2) = xg(2) + 0.100;

xlwr = xlwr';

xupr = xupr';

% bounds on objective function

flow(1) = 0.0d0;

fupp(1) = +Inf;

% bounds on selenocentric close approach (normalized) radius constraint

page 13
flow(2) = radius_lmo / radius_moon;

fupp(2) = radius_lmo / radius_moon;

% bounds on selenocentric relative position constraint (kilometers)

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.

The following is the source code for this function.

function [f, g] = free_return_shoot(x)

% lunar free return simple shooting method

% input

% x(1) = current update to TLI departure angle


% x(2) = current update to TLI deltav

% output

% f(1) = objective function (tli delta-v magnitude)


% f(2) = selenocentric radius (normalized)
% f(3) = y-component of relative position vector (kilometers)
% f(4) = x-component of relative velocity vector (kilometers/second)

% Orbital Mechanics with MATLAB

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

global distance_e2m vlc_moon radius_moon omega_moon

global radius_leo vlc_leo tevent yevent rm2sc vm2sc rrel vrel

% current TLI maneuver angle

theta_pe = x(1);

% current inertial TLI state vector

ri(1) = radius_leo * cos(theta_pe);

ri(2) = radius_leo * sin(theta_pe);

page 14
vpe = vlc_leo + x(2);

vi(1) = -vpe * sin(theta_pe);

vi(2) = vpe * cos(theta_pe);

% set up options for ode45

options = odeset('RelTol', 1.0e-10, 'AbsTol', 1.0e-10, 'Events', @fpa_event);

% solve for lunar closest approach conditions

tend = 7.0 * 86400.0;

[t, ysol, tevent, yevent, ie] = ode45(@free_return_eqm, [0 tend], [ri vi], options);

% geocentric inertial lunar position vector (kilometers)

theta_moon = omega_moon * tevent;

re2m(1) = distance_e2m * cos(theta_moon);

re2m(2) = distance_e2m * sin(theta_moon);

% geocentric inertial lunar velocity vector (kilometers/second)

ve2m(1) = -vlc_moon * sin(theta_moon);

ve2m(2) = vlc_moon * cos(theta_moon);

% compute selenocentric inertial state vector of the third body

rm2sc(1) = yevent(1) - re2m(1);

rm2sc(2) = yevent(2) - re2m(2);

vm2sc(1) = yevent(3) - ve2m(1);

vm2sc(2) = yevent(4) - ve2m(2);

% third body position vector in rotating system

rrel(1) = yevent(1) * cos(theta_moon) ...


+ yevent(2) * sin(theta_moon);

rrel(2) = -yevent(1) * sin(theta_moon) ...


+ yevent(2) * cos(theta_moon);

rrel(3) = 0.0;

% angular rotation vector (radians/second)

omegav = omega_moon * [0.0 0.0 1.0];

% third body velocity vector in rotating system

vrel = cross(omegav, rrel);

% objective function (tli deltav, kilometers/second)

f(1) = x(2);

% current selenocentric periapsis radius (normalized)

f(2) = norm(rm2sc) / radius_moon;

% y-component of relative position vector (kilometers)


page 15
f(3) = rrel(2);

% x-component of relative velocity vector (kilometers/second)

% 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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

ttof = 2.0 * tevent;

r(1) = radius_leo * cos(theta_tli);

r(2) = radius_leo * sin(theta_tli);

vpe = vlc_leo + deltav_tli;

v(1) = -vpe * sin(theta_tli);

v(2) = vpe * cos(theta_tli);

options = odeset('RelTol', 1.0e-10, 'AbsTol', 1.0e-10);

[tn, xn] = ode45('free_return_eqm', [0.0 ttof], [r v], options);

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.

function ydot = eci_eqm (t, y)

% geocentric equations of motion

% version for free_return.m

% input

% t = simulation time (seconds)


% y = state vector (kilometers and kilometers/second)

% output

% ydot = integration vector

% Orbital Mechanics with MATLAB

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

page 16
global mu_moon mu_earth omega_moon distance_e2m

% acceleration due to the earth

r2 = y(1) * y(1) + y(2) * y(2) + y(3) * y(3);

r1 = sqrt(r2);

r3 = r2 * r1;

for i = 1:1:3

agrav(i) = -mu_earth * y(i) / r3;

end

theta_moon = omega_moon * t;

% geocentric position vector of the moon (kilometers)

rmoon(1) = distance_e2m * cos(theta_moon);

rmoon(2) = distance_e2m * sin(theta_moon);

rmoon(3) = 0.0;

% selenocentric position vector of the third body

for i = 1:1:3

rm2sc(i) = y(i) - rmoon(i);

end

% f(q) formulation

for i = 1:1:3

vtmp(i) = y(i) - 2.0d0 * rmoon(i);

end

dot1 = dot(y(1:3), vtmp);

dot2 = dot(rmoon, rmoon);

qmoon = dot1 / dot2;

fmoon = qmoon * ((3.0d0 + 3.0d0 * qmoon + qmoon * qmoon) ...


/ (1.0d0 + (1.0d0 + qmoon)^1.5d0));

d3moon = norm(rm2sc)^3;

% point-mass gravity of the moon

for i = 1:1:3

amoon(i) = -mu_moon * (y(i) + fmoon * rmoon(i)) / d3moon;

end

% compute total integration vector

ydot = [ y(4)
y(5)
y(6)
agrav(1) + amoon(1)
page 17
agrav(2) + amoon(2)
agrav(3) + amoon(3)];

Image trajectory verification

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.

image trajectory mission constraints at lunar closest approach


--------------------------------------------------------------

y-component of relative position vector 0.00044392 meters

x-component of relative velocity vector -0.00000000 meters/second

moon-third body geocentric separation angle 0.00000000 degrees

geocentric inertial flight path angle 0.00000002 degrees

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   cos1  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

“Theorem of Image Trajectories in the Earth-Moon Space”, Angelo Miele, XI International


Astronautical Congress, Stockholm, 1960.

“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
Celestial Computing with MATLAB

A MATLAB Script for Predicting Lunar Eclipses

This document describes a MATLAB script named leclipse.m that can be used to predict local
circumstances of lunar eclipses. This software provides the eclipse type, the universal times and
topocentric coordinates of the Moon at the beginning and end of the penumbra contacts, and the time
and coordinates at maximum eclipse. The source ephemeris for this routine is a JPL binary ephemeris
file. This application uses several functions ported to MATLAB from the Fortran version of the
NOVAS (Naval Observatory Vector Astrometry Subroutines) source code developed at the United
States Naval Observatory (www.usno.navy.mil/USNO/astronomical-applications/software-
products/novas). JPL binary ephemeris files for Windows compatible computers can be downloaded at
www.cdeagle.com.

This MATLAB script uses a combination of one-dimensional minimization and root-finding to solve
this classic problem. The objective function used in these calculations involves the geocentric
separation angle between the center of the Moon and the anti-Sun position vector or shadow axis, and
the semidiameter and horizontal parallax of the Sun and Moon. This function is given by the following
expression:

f  t   cos1  uˆ m  uˆ s   f1  sm

where
uˆ s  geocentric unit position vector of the Sun
uˆ m  geocentric unit position vector of the Moon
f1  1.02  1   s  ss   size of penumbra shadow
 1  0.99834 m  corrected parallax
 m  horizontal parallax of the Moon
 s  horizontal parallax of the Sun
sm  semidiameter of the Moon
ss  semidiameter of the Sun

If we let  represent the minimum geocentric separation angle of the Moon relative to the shadow axis,
a penumbral lunar eclipse occurs whenever the following geometric condition is satisfied:

  1.02 1   s  ss   sm

A partial lunar eclipse will happen whenever the following is true:

  1.02 1   s  ss   sm

The geometric condition for a total lunar eclipse is given by

  1.02 1   s  ss   sm

page 1
Celestial Computing with MATLAB

In these expressions
 req   req 
 m  sin 1    s  sin 1  
 dm   ds 

r  r 
sm  sin 1  m  ss  sin 1  s 
 dm   ds 

where req is the equatorial radius of the Earth (6378.14 kilometers), rm is the radius of the Moon (1738
kilometers), rs is the radius of the Sun (696,000 kilometers), d m is the geocentric distance of the Moon,
and d s is the geocentric distance of the Sun.

The following is a typical user interaction with this script. The screen output created by the script
illustrates the local circumstances of a total lunar eclipse. The initial calendar date was January 1, 2000,
the search duration was 30 days, and the observer was located at the Chamberlin Observatory in Denver,
Colorado. The calendar date and time displayed is on the UTC time scale.

local circumstances of lunar eclipses


=====================================

please input an initial UTC calendar date

please input the calendar date


(1 <= month <= 12, 1 <= day <= 31, year = all digits!)
? 1,1,2000

please input the search duration (days)


? 30

please input the geographic latitude of the observer


(-90 <= degrees <= +90, 0 <= minutes <= 60, 0 <= seconds <= 60)
(north latitude is positive, south latitude is negative)
? 39,40,36

please input the geographic longitude of the observer


(0 <= degrees <= 360, 0 <= minutes <= 60, 0 <= seconds <= 60)
(east longitude is positive, west longitude is negative)
? -104,57,12

please input the altitude of the observer (meters)


(positive above sea level, negative below sea level)
? 1644

total lunar eclipse


===================

begin penumbral phase of lunar eclipse


--------------------------------------

calendar date 21-Jan-2000

universal time 02:02:54.489

UTC Julian date 2451564.5854

page 2
Celestial Computing with MATLAB

lunar azimuth angle +83d 04m 19.72s

lunar elevation angle +22d 44m 02.19s

greatest eclipse conditions


---------------------------

calendar date 21-Jan-2000

universal time 04:43:57.941

UTC Julian date 2451564.6972

lunar azimuth angle +111d 30m 10.33s

lunar elevation angle +52d 11m 23.72s

end penumbral phase of lunar eclipse


------------------------------------

calendar date 21-Jan-2000

universal time 07:24:07.313

UTC Julian date 2451564.8084

lunar azimuth angle +184d 38m 54.13s

lunar elevation angle +69d 27m 43.86s

event duration +05h 21m 12.8232s

The following are the results for this same eclipse using the Multiyear Interactive Computer Almanac
(MICA) published by the United States Naval Observatory.

Total Eclipse of the Moon of 2000 Jan. 21


Delta T: 63.8s

Chamberlin Obs., Denver


Location: W104°57'12.0", N39°40'36.0", 1644m
(Longitude referred to Greenwich meridian)

Moon's Position
UT1 Altitude Azimuth Angle
d h m ° ° °
Moon enters penumbra 21 02:03.0 22.7 83.1 85.8
Moon enters umbra 21 03:01.5 33.6 91.9 79.9
Moon enters totality 21 04:04.6 45.2 102.9 238.3
Maximum Eclipse 21 04:43.5 52.1 111.4 6.7
Moon exits totality 21 05:22.4 58.6 122.2 135.2
Moon exits umbra 21 06:25.5 66.9 148.5 293.6
Moon exits penumbra 21 07:24.1 69.5 184.6 287.6

Penumbral Duration: 5h 21.2m


Umbral Duration: 3h 24.0m
Duration of Totality: 1h 17.8m
Magnitude: 1.330

page 3
Orbital Mechanics with MATLAB

A MATLAB Script for Predicting Orbital Events of the Moon

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.

1) apogee and perigee


2) minimum and maximum geocentric declination
3) user-defined geocentric right ascension
4) user-defined geocentric declination
5) user-defined true anomaly
6) minimum and maximum orbital eccentricity
7) nodal crossings

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.

Interacting with the script

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

< orbital events of the moon >

please input the initial calendar date


(1 <= month <= 12, 1 <= day <= 31, year = all digits!)
? 1,1,2014

please input the search duration (days)


? 30

The script will then display a list of event options with the following menu;

please select the lunar event to predict

<1> apogee and perigee

<2> minimum and maximum geocentric declination

<3> user-defined geocentric right ascension

<4> user-defined geocentric declination

page 1
Orbital Mechanics with MATLAB
<5> user-defined true anomaly

<6> minimum and maximum orbital eccentricity

<7> nodal crossings

For menu option 3, the script will also prompt for the user-defined value of geocentric right ascension
with the following display;

please input the geocentric right ascension (degrees)


(0 <= right ascension <= 360)
?

For menu option 4, the script will also prompt for the user-defined value of geocentric declination with
the following display;

please input the geocentric declination (degrees)


(-90 <= declination <= +90)

For menu option 5, the script will also prompt for the user-defined value of true anomaly with the
following display;

please input the true anomaly (degrees)


(0 <= true anomaly <= 360)

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

< orbital events of the moon >

please input the initial calendar date


(1 <= month <= 12, 1 <= day <= 31, year = all digits!)
? 1,1,2014

please input the search duration (days)


? 30

please select the lunar event to predict

<1> apogee and perigee

<2> minimum and maximum geocentric declination

<3> user-defined geocentric right ascension

<4> user-defined geocentric declination

<5> user-defined true anomaly

<6> minimum and maximum orbital eccentricity

page 2
Orbital Mechanics with MATLAB

<7> nodal crossings

? 2

time and conditions at minimum declination


==========================================

calendar date 27-Jan-2014

TDB time 16:55:48.131

TDB Julian date 2456685.20541819

UTC time 16:54:41.947

UTC Julian date 2456685.20465216

geocentric declination -19.38236906 degrees

geocentric orbital elements and state vector


(Earth mean equator and equinox J2000)
--------------------------------------

sma (km) eccentricity inclination (deg) argper (deg)


+3.88526254363298e+05 +8.01745529529702e-02 +1.93823690622682e+01 +3.10295086963237e+02

raan (deg) true anomaly (deg) arglat (deg) period (days)


+3.51862407979640e+02 +3.19704913531811e+02 +2.70000000495048e+02 +2.78950919892399e+01

rx (km) ry (km) rz (km) rmag (km)


-4.85753538318047e+04 -3.39710302374387e+05 -1.20729016559839e+05 +3.63783108429581e+05

vx (kps) vy (kps) vz (kps) vmag (kps)


+1.07446967239062e+00 -1.03431188427361e-01 +1.74857394845693e-02 +1.07957808365677e+00

time and conditions at maximum declination


==========================================

calendar date 09-Feb-2014

TDB time 15:50:13.403

TDB Julian date 2456698.15987735

UTC time 15:49:07.218

UTC Julian date 2456698.15911132

geocentric declination 19.29480971 degrees

geocentric orbital elements and state vector


(Earth mean equator and equinox J2000)
--------------------------------------

sma (km) eccentricity inclination (deg) argper (deg)


+3.86033424966801e+05 +5.33702230739854e-02 +1.92948097076573e+01 +3.01922689183831e+02

raan (deg) true anomaly (deg) arglat (deg) period (days)


+3.52061507031174e+02 +1.48077310699116e+02 +8.99999998829470e+01 +2.76270558739407e+01

rx (km) ry (km) rz (km) rmag (km)


+5.25578732820930e+04 +3.76904041635659e+05 +1.33228329807996e+05 +4.03198182670332e+05

vx (kps) vy (kps) vz (kps) vmag (kps)


-9.58447892208817e-01 +1.61018650533875e-01 +9.48906430849668e-03 +9.71925619705914e-01

Additional script examples can be found in Appendix A.

page 3
Orbital Mechanics with MATLAB
The orbital event summary screen contains the following information:

calendar date = calendar date of trajectory event

TDB time = TDB time of trajectory event

TDB Julian date = Julian Date of trajectory event on TDB time scale

UTC time = UTC time of trajectory event

UTC Julian date = Julian Date of trajectory event on UTC time scale

sma (km) = semimajor axis in kilometers

eccentricity = orbital eccentricity (non-dimensional)

inclination (deg) = orbital inclination in degrees

argper (deg) = argument of perigee in degrees

raan (deg) = right ascension of the ascending node in degrees

true anomaly (deg) = true anomaly in degrees

arglat (deg) = argument of latitude in degrees. The argument of latitude is the sum of
true anomaly and argument of perigee.

period (days) = orbital period in days

rx (km) = x-component of the Moon’s position vector in kilometers

ry (km) = y-component of the Moon’s position vector in kilometers

rz (km) = z-component of the Moon’s position vector in kilometers

rmag (km) = scalar magnitude of the Moon’s position vector in kilometers

vx (kps) = x-component of the Moon’s velocity vector in kilometers per second

vy (kps) = y-component of the Moon’s velocity vector in kilometers per second

vz (kps) = z-component of the Moon’s velocity vector in kilometers per second

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.

0.421000000000000000D+03 0.421000000000000000D+03 0.000000000000000000D+00


0.120080211181117000D+17 0.000000000000000000D+00 0.299792458000000000D+06
0.149597870699626200D+09 0.813005690699153000D+02 0.491254957186794000D-10

The following is the syntax for the jpleph_mice MATLAB function:


page 5
Orbital Mechanics with MATLAB

function rrd = jpleph_mice (et, ntarg, ncent)

% reads the jpl planetary ephemeris and gives the position and velocity
% of the point 'ntarg' with respect to point 'ncent' using MICE routines

% input

% et = TDB julian date at which interpolation is wanted

% ntarg = integer number of 'target' point

% ncent = integer number of center point

% the numbering convention for 'ntarg' and 'ncent' is:

% 1 = mercury 8 = neptune
% 2 = venus 9 = pluto
% 3 = earth 10 = moon
% 4 = mars 11 = sun
% 5 = jupiter
% 6 = saturn
% 7 = uranus

% output

% rrd = output 6-word array containing position and velocity


% of point 'ntarg' relative to 'ncent'. the units are
% determined by the value of km passed via global.

% global

% iephem = initialization flag (1 = initialize)


% ephname = name of ephemeris binary data file (de421.bsp, etc.)
% km = state vector units flag (1 = km & km/sec, 0 = au & au/day)
% au = numerical value of astronomical unit (kilometers)

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

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.

TT = TAI + 32.184 seconds

TT = UTC + (number of leap seconds) + 32.184 seconds

Barycentric Dynamical Time, TDB


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.

TDB = TT + periodic corrections

where typical periodic corrections (USNO Circular 179) are

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.

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.

function [ttjd, secdif] = novas_times (tdbjd)

% this function computes the terrestrial time (tt) julian date


% corresponding to a barycentric dynamical time (tdb) julian date.
% the expression used in this version is a truncated form of a
% longer and more precise series given by fairhead & bretagnon
% (1990) a&a 229, 240. the result is good to about 10 microseconds.

% input

page 7
Orbital Mechanics with MATLAB
% tdbjd = tdb julian date

% output

% ttjd = tt julian date

% secdif = difference tdbjd - ttjd, in seconds

% ported from NOVAS 3.0

%%%%%%%%%%%%%%%%%%%%%%%

% t0 = tdb julian date of epoch j2000.0 (tt)

t0 = 2451545.0d0;

t = (tdbjd - t0) / 36525.0d0;

% expression given in usno circular 179, eq. 2.6

secdif = 0.001657d0 * sin(628.3076d0 * t + 6.2401d0) ...


+ 0.000022d0 * sin(575.3385d0 * t + 4.2970d0) ...
+ 0.000014d0 * sin(1256.6152d0 * t + 6.1969d0) ...
+ 0.000005d0 * sin(606.9777d0 * t + 4.0212d0) ...
+ 0.000005d0 * sin(52.9691d0 * t + 0.4444d0) ...
+ 0.000002d0 * sin(21.3299d0 * t + 5.5431d0) ...

+ 0.000010d0 * t * sin(628.3076d0 * t + 4.2490d0);

ttjd = tdbjd - secdif / 86400.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.

function jdutc = tdb2utc (jdtdb)

% convert TDB julian date to UTC julian date

% input

% jdtdb = TDB julian date

% output

% jdutc = UTC julian date

% Orbital Mechanics with MATLAB

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

global jdsaved

page 8
Orbital Mechanics with MATLAB
jdsaved = jdtdb;

% convergence tolerance

rtol = 1.0d-8;

% set lower and upper bounds

x1 = jdsaved - 0.1;

x2 = jdsaved + 0.1;

% solve for UTC julian date using Brent's method

[xroot, froot] = brent ('jdfunc', x1, x2, rtol);

jdutc = xroot;

end

This function calls the following MATLAB objective function during the calculations.

function fx = jdfunc (jdin)

% objective function for tdb2utc

% input

% jdin = current value for UTC julian date

% output

% fx = delta julian date

% Orbital Mechanics with MATLAB

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

global jdsaved

tai_utc = findleap(jdin);

fx = utc2tdb (jdin, tai_utc) - jdsaved;

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.

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
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.

% read leap seconds data file

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.

global jdateleap leapsec

The MATLAB function that actually reads and evaluates the current value of leap seconds has the
following syntax and single argument.

function leapsecond = findleap(jdate)

% find number of leap seconds for utc julian date

page 10
Orbital Mechanics with MATLAB

% input

% jdate = utc julian date

% input via global

% jdateleap = array of utc julian dates


% leapsec = array of leap seconds

% output

% leapsecond = number of leap seconds

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

< orbital events of the moon >

please input the initial calendar date


(1 <= month <= 12, 1 <= day <= 31, year = all digits!)
? 1,1,2014

please input the search duration (days)


? 30

please select the lunar event to predict

<1> apogee and perigee

<2> minimum and maximum geocentric declination

<3> user-defined geocentric right ascension

<4> user-defined geocentric declination

<5> user-defined true anomaly

<6> minimum and maximum orbital eccentricity

<7> nodal crossings

? 3

please input the geocentric right ascension (degrees)


(0 <= right ascension <= 360)
? 120

time and conditions at user-defined right ascension


===================================================

calendar date 16-Jan-2014

TDB time 11:15:07.295

TDB Julian date 2456673.96883443

UTC time 11:14:01.110

UTC Julian date 2456673.96806841

geocentric orbital elements and state vector


(Earth mean equator and equinox J2000)
--------------------------------------

sma (km) eccentricity inclination (deg) argper (deg)


+3.92030629436879e+05 +3.69860119614338e-02 +1.94692410906878e+01 +3.02260247507493e+02

raan (deg) true anomaly (deg) arglat (deg) period (days)


+3.51692297464799e+02 +1.84418516689778e+02 +1.26678764197271e+02 +2.82733481403732e+01

rx (km) ry (km) rz (km) rmag (km)


-1.95846297076435e+05 +3.39215737025722e+05 +1.08655677168906e+05 +4.06483879760918e+05

vx (kps) vy (kps) vz (kps) vmag (kps)


-8.48917032439884e-01 -4.31347035509562e-01 -1.94249162125556e-01 +9.71829784476637e-01
page 12
Orbital Mechanics with MATLAB

geocentric right ascension 120.00000000 degrees

program levents

< orbital events of the moon >

please input the initial calendar date


(1 <= month <= 12, 1 <= day <= 31, year = all digits!)
? 1,1,2014

please input the search duration (days)


? 30

please select the lunar event to predict

<1> apogee and perigee

<2> minimum and maximum geocentric declination

<3> user-defined geocentric right ascension

<4> user-defined geocentric declination

<5> user-defined true anomaly

<6> minimum and maximum orbital eccentricity

<7> nodal crossings

? 6

time and conditions at minimum eccentricity


===========================================

calendar date 16-Jan-2014

TDB time 04:52:54.743

TDB Julian date 2456673.70341138

UTC time 04:51:48.559

UTC Julian date 2456673.70264536

orbital eccentricity 0.03693123 degrees

geocentric orbital elements and state vector


(Earth mean equator and equinox J2000)
--------------------------------------

sma (km) eccentricity inclination (deg) argper (deg)


+3.92053087994261e+05 +3.69312337246207e-02 +1.94726115663969e+01 +3.02140356572455e+02

raan (deg) true anomaly (deg) arglat (deg) period (days)


+3.51677918019766e+02 +1.81410918479402e+02 +1.23551275051857e+02 +2.82757777504264e+01

rx (km) ry (km) rz (km) rmag (km)


-1.76083175319990e+05 +3.48573938945866e+05 +1.12939911436396e+05 +4.06527365792596e+05

vx (kps) vy (kps) vz (kps) vmag (kps)


-8.74212262361963e-01 -3.84589848574662e-01 -1.79290695107703e-01 +9.71751812266335e-01

time and conditions at maximum eccentricity


===========================================

page 13
Orbital Mechanics with MATLAB
calendar date 30-Jan-2014

TDB time 20:39:04.380

TDB Julian date 2456688.36046737

UTC time 20:37:58.196

UTC Julian date 2456688.35970134

orbital eccentricity 0.08890970 degrees

geocentric orbital elements and state vector


(Earth mean equator and equinox J2000)
--------------------------------------

sma (km) eccentricity inclination (deg) argper (deg)


+3.91932987684056e+05 +8.89096980310241e-02 +1.93622366218224e+01 +3.10956166896728e+02

raan (deg) true anomaly (deg) arglat (deg) period (days)


+3.51994152637177e+02 +6.55117989479818e+00 +3.17507346791526e+02 +2.82627858762572e+01

rx (km) ry (km) rz (km) rmag (km)


+2.29164286094128e+05 -2.62160869103048e+05 -8.00133662056496e+04 +3.57276825558916e+05

vx (kps) vy (kps) vz (kps) vmag (kps)


+8.50430760916976e-01 +6.47881277899118e-01 +2.67078849953152e-01 +1.10195904708765e+00

program levents

< orbital events of the moon >

please input the initial calendar date


(1 <= month <= 12, 1 <= day <= 31, year = all digits!)
? 1,1,2014

please input the search duration (days)


? 30

please select the lunar event to predict

<1> apogee and perigee

<2> minimum and maximum geocentric declination

<3> user-defined geocentric right ascension

<4> user-defined geocentric declination

<5> user-defined true anomaly

<6> minimum and maximum orbital eccentricity

<7> nodal crossings

? 7

time and conditions at ascending node


=====================================

calendar date 06-Jan-2014

TDB time 06:20:10.745

TDB Julian date 2456663.76401325

UTC time 06:19:04.561

page 14
Orbital Mechanics with MATLAB

UTC Julian date 2456663.76324723

geocentric orbital elements and state vector


(Earth mean equator and equinox J2000)
--------------------------------------

sma (km) eccentricity inclination (deg) argper (deg)


+3.85971581783473e+05 +7.29960147093920e-02 +1.94780509815064e+01 +2.94421396272985e+02

raan (deg) true anomaly (deg) arglat (deg) period (days)


+3.51369706512152e+02 +6.55786037242167e+01 +3.59999999997201e+02 +2.76204172908247e+01

rx (km) ry (km) rz (km) rmag (km)


+3.68448269004108e+05 -5.59218397063176e+04 -6.06983962825325e-06 +3.72667920658947e+05

vx (kps) vy (kps) vz (kps) vmag (kps)


+2.15458420574909e-01 +9.68255200707477e-01 +3.50017330824906e-01 +1.05188050489184e+00

time and conditions at descending node


======================================

calendar date 20-Jan-2014

TDB time 22:25:09.075

TDB Julian date 2456678.43413281

UTC time 22:24:02.890

UTC Julian date 2456678.43336679

geocentric orbital elements and state vector


(Earth mean equator and equinox J2000)
--------------------------------------

sma (km) eccentricity inclination (deg) argper (deg)


+3.86990262729164e+05 +5.03492563329996e-02 +1.93974648943419e+01 +3.08657935121614e+02

raan (deg) true anomaly (deg) arglat (deg) period (days)


+3.51811237252316e+02 +2.31342064875707e+02 +1.79999999997321e+02 +2.77298357719506e+01

rx (km) ry (km) rz (km) rmag (km)


-3.94480609837439e+05 +5.67665516047724e+04 +6.18902717874903e-06 +3.98544091561793e+05

vx (kps) vy (kps) vz (kps) vmag (kps)


-9.26836051146707e-02 -9.24576725110698e-01 -3.26877925301143e-01 +9.85028704821669e-01

page 15
Celestial Computing with MATLAB

A MATLAB Script for Predicting Lunar Occultations

This document describes a MATLAB script named loccult.m that can be used to predict the local
circumstances of lunar occultations of a planet or star. The source ephemeris for this routine is a JPL
binary ephemeris file. This application uses several functions ported to MATLAB from the Fortran
version of the NOVAS (Naval Observatory Vector Astrometry Subroutines) source code developed at
the United States Naval Observatory (www.usno.navy.mil/USNO/astronomical-applications/software-
products/novas). JPL binary ephemeris files for Windows compatible computers can be downloaded at
www.cdeagle.com.

This script uses a combination of one-dimensional minimization and root-finding to solve this problem.
The objective function used in these calculations is the topocentric separation angle between the center
of the Moon and the object being occulted. This function is given by the following expression:

f  t   cos1  uˆ m  uˆ b    sm  sb 

where
uˆ m  topocentric unit position vector of the Moon
uˆ b  topocentric unit position vector of the object
sm  semidiameter of the Moon
sb  semidiameter of the object

The semidiameter of the Moon is given by

r 
sm  sin 1  m 
 dm 

where rm is the radius of the Moon (1738 kilometers) and d m is the topocentric distance of the Moon.

The semidiameter of a star is zero and the semidiameter of a planet is

s p0
sp 
rp

where s p0 is the semidiameter of the planet at a distance of one astronomical unit and rp is the
topocentric distance of the planet.

If the target body is a star, the software will prompt you for the name of the star data file with a screen
display similar to

page 1
Celestial Computing with MATLAB

The file type defaults to names with a *.dat filename extension. However, you can select any
loccult 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 a typical star data file named spica.dat. Do not delete any lines of text or data as the
software expects to find exactly 20 lines of information. Please note the proper units.

star name
SPICA

J2000 right ascension (hours)


13.4198852780

J2000 declination (degrees)


-11.1613083330

J2000 proper motion in right ascension (seconds/Julian century)


-0.2780

J2000 proper motion in declination (arcseconds/Julian century)


-2.8300

parallax (arcseconds)
0.0210

radial velocity (kilometers/second)


1.0

The following is a typical user interaction with this MATLAB script. It illustrates a lunar occultation of
the star Spica relative to an observer located in Denver, Colorado.

local circumstances of lunar occultations


=========================================

please input an initial UTC calendar date

please input the calendar date


(1 <= month <= 12, 1 <= day <= 31, year = all digits!)
? 2,1,1987
page 2
Celestial Computing with MATLAB

please input the search duration (days)


? 30

target body menu

<1> Mercury
<2> Venus
<3> Mars
<4> Jupiter
<5> Saturn
<6> Uranus
<7> Neptune
<8> Pluto
<9> Star

please select the target body


? 9

please input the geographic latitude of the observer


(-90 <= degrees <= +90, 0 <= minutes <= 60, 0 <= seconds <= 60)
(north latitude is positive, south latitude is negative)
? 40,0,0

please input the geographic longitude of the observer


(0 <= degrees <= 360, 0 <= minutes <= 60, 0 <= seconds <= 60)
(east longitude is positive, west longitude is negative)
? -105,0,0

please input the altitude of the observer (meters)


(positive above sea level, negative below sea level)
? 0

begin lunar occultation


-----------------------

calendar date 18-Feb-1987

universal time 12:26:26.300

UTC Julian date 2446845.0184

lunar azimuth angle +213d 46m 13.25s

lunar elevation angle +32d 44m 24.80s

end lunar occultation


---------------------

calendar date 18-Feb-1987

universal time 13:17:31.899

UTC Julian date 2446845.0538

lunar azimuth angle +225d 54m 29.72s

lunar elevation angle +26d 25m 12.26s

event duration +00h 51m 5.5985s

page 3
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.

1. System of nonlinear constraint equations with simple shooting method


2. Nonlinear optimization with simple shooting method
3. Nonlinear optimization with collocation and direct transcription method

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 DE405 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. 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.

INPUT DATA FILE

This section illustrates a typical input data file for the TCM software suite.

******************************************
** trans-Earth TCM trajectory optimization
** n-body geocentric motion
** Moon-to-Earth data file - cev1.in
** November 19, 2007
******************************************

TCM epoch
Aug 6 2018 15:59:59.994 TDB

************************************************
geocentric EME2000 orbital elements prior to TCM
************************************************

semimajor axis (kilometers)


0.220615448822D+06

orbital eccentricity (non-dimensional)


0.970867462750D+00

orbital inclination (degrees)


0.509115579289D+02

page 1
argument of perigee (degrees)
0.347338533437D+03

right ascension of the ascending node (degrees)


0.212814404333D+03

true anomaly (degrees)


0.198500745260D+03

**********************************************************
initial guess and bounds for geocentric TCM delta-v vector
**********************************************************

x-component of TCM velocity vector (meters/second)


0.0

y-component of TCM velocity vector (meters/second)


0.0

z-component of TCM velocity vector (meters/second)


0.0

*****************************************************
entry interface constraints (set to 1.0d99 to ignore)
*****************************************************

geodetic altitude (kilometers)


121.92

relative flight path angle (degrees)


-6.2

geodetic latitude (degrees)


-19.5

east longitude (degrees)


121.0

relative azimuth (degrees)


1.0d99

************************
trajectory perturbations
************************

name of Earth gravity model data file


egm96.dat

order of Earth gravity model (zonals)


8

degree of Earth gravity model (tesserals)


8

include solar perturbations (1 = yes, 0 = no)


1

include lunar perturbations (1 = yes, 0 = no)


1

**********************************************
root-finding and integration algorithm control
**********************************************

page 2
root-finding tolerance
1.0d-8
RKF7(8) truncation error tolerance
1.0d-12

nonlinear equations tolerance


1.0d-8

PROGRAM OUTPUT

The following is a summary of the program output from each computer program for this example. The
entry interface targets for this example were the geodetic altitude (121.92 kilometers) and latitude (-
19.5 degrees), and the geographic east longitude (121 degrees). The EI relative flight path angle target
is -6.2 degrees.

System of nonlinear equations

----------------------------------
time and conditions prior to TCM
(geocentric - EME2000 coordinates)
----------------------------------

UTC epoch 2018 AUG 06 15:58:54.81085

TDB Julian date 2458337.166666597127914

sma (km) eccentricity inclination (deg) argper (deg)


0.220615448822D+06 0.970867462750D+00 0.509115579289D+02 0.347338533437D+03

raan (deg) true anomaly (deg) arglat (deg) period (min)


0.212814404333D+03 0.198500745260D+03 0.185839278697D+03 0.171875356468D+05

rx (km) ry (km) rz (km) rmag (km)


0.127984235359D+06 0.947167455303D+05 -.126124998721D+05 0.159719446334D+06

vx (kps) vy (kps) vz (kps) vmag (kps)


-.157405686429D+01 -.814842228516D+00 -.207047943056D+00 0.178451442138D+01

----------------------------------
time and conditions after the TCM
(geocentric - EME2000 coordinates)
----------------------------------

UTC epoch 2018 AUG 06 15:58:54.81085

TDB Julian date 2458337.166666597127914

sma (km) eccentricity inclination (deg) argper (deg)


0.218504581817D+06 0.970593697065D+00 0.520348622452D+02 0.347302049817D+03

raan (deg) true anomaly (deg) arglat (deg) period (min)


0.212960097720D+03 0.198446474921D+03 0.185748524738D+03 0.169414489885D+05

rx (km) ry (km) rz (km) rmag (km)


0.127984235359D+06 0.947167455303D+05 -.126124998721D+05 0.159719446334D+06

vx (kps) vy (kps) vz (kps) vmag (kps)


-.156626163176D+01 -.817656773678D+00 -.212836396881D+00 0.177961721460D+01

page 3
--------------------------------
TCM delta-v vector and magnitude
(geocentric EME2000)
--------------------------------

delta-vx 7.795232530234879 meters/second


delta-vy -2.814545162388447 meters/second
delta-vz -5.788453824811932 meters/second

deltav 10.109080687853677 meters/second

pitch angle 29.868179822739332 degrees

yaw angle 269.983507149289210 degrees

--------------------------------------
time and conditions at entry interface
(geocentric - EME2000 coordinates)
--------------------------------------

UTC epoch 2018 AUG 07 08:00:24.72001

TDB Julian date 2458337.834373878780752

sma (km) eccentricity inclination (deg) argper (deg)


0.223705147066D+06 0.971280418492D+00 0.519434659014D+02 0.347329965385D+03

raan (deg) true anomaly (deg) arglat (deg) period (min)


0.212885279070D+03 0.347743436481D+03 0.335073401866D+03 0.175498615680D+05

rx (km) ry (km) rz (km) rmag (km)


-.586479273288D+04 -.178173078828D+04 -.215629990858D+04 0.649769095120D+04

vx (kps) vy (kps) vz (kps) vmag (kps)


0.492973713131D+00 -.731828662424D+01 0.819193017342D+01 0.109958202133D+02

flight path coordinates


-----------------------

geodetic altitude 121.920000000000982 kilometers

geodetic latitude -19.500000000000203 degrees

east longitude 120.999999999999773 degrees

flight path angle -6.200000000000979 degrees

relative azimuth 38.982987221134493 degrees

relative velocity 10.710749566513961 km/sec

Optimization with shooting method

--------------------------------
TCM delta-v vector and magnitude
(geocentric EME2000)
--------------------------------

page 4
delta-vx 7.795236204346402 meters/second
delta-vy -2.814543163808415 meters/second
delta-vz -5.788454575706034 meters/second

deltav 10.109083394527207 meters/second


pitch angle 29.868198388869313 degrees

yaw angle 269.983507074416423 degrees

flight path coordinates


-----------------------

geodetic altitude 121.920000001642620 kilometers

geodetic latitude -19.500000000001112 degrees

east longitude 120.999999729731172 degrees

flight path angle -6.200000000001102 degrees

relative azimuth 38.982987117364509 degrees

relative velocity 10.710749566463926 km/sec

Optimization with collocation method

The following is the delta-v summary and the targets achieved at the entry interface.

TCM delta-v vector and magnitude

delta-vx 7.795234075235853 meters/second


delta-vy -2.814552459976289 meters/second
delta-vz -5.788463341273181 meters/second

deltav 10.109089360122415 meters/second

pitch angle 29.868136313642808 degrees

yaw angle 269.983531314061622 degrees

flight path coordinates


-----------------------

geodetic altitude 121.920000000216532 kilometers

geodetic latitude -19.500000000000028 degrees

east longitude 121.000000542124639 degrees

flight path angle -6.200000000009567 degrees

relative azimuth 38.982985574963863 degrees

relative velocity 10.710749577250612 km/sec

page 5
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

J = ∆V = ∆Vx2 + ∆Vy2 + ∆Vz2

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 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 difference between the predicted and user-defined relative flight path
angles is within a small tolerance ( γ p − γ t < ε ) .

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

page 6
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⎞
∞ 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 m =1 ⎝ 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 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

= − ⎜ ⎟ ∑ ⎜ ⎟ ( n + 1) ∑ ( Cnm cos mλ + Snm sin mλ ) Pnm ( sin φ )


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 φ ) ⎤⎦

page 7
∂Φ ⎛µ⎞ 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 φ 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

where the first few associated Legendre functions are given by

P00 ( sin φ ) = 1, P10 ( sin φ ) = sin φ , P11 ( sin φ ) = cos φ

and Pi j = 0 for j > i .

The trigonometric arguments are determined from expansions given by

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 true-of-date position vector required in the previous equations is computed according to

page 8
rTOD = [ PN ] rEME 2000

where [ PN ] is the combined precession-nutation matrix.

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

where α g is the apparent right ascension of Greenwich at the time of interest.

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

a EME 2000 = [ PN ] aTOD


T

Point mass acceleration of the sun and moon

The acceleration contribution of the moon represented by a point mass is given by

⎛ G G
G G rm −b re−m ⎞
am ( r , t ) = − µ m ⎜ +
G 3 G 3 ⎟⎟
⎜ rm −b re−m ⎠

where
µm = gravitational constant of the moon
G
rm −b = position vector from the moon to the spacecraft
G
re−m = position vector from the Earth to the moon

Likewise, the acceleration contribution of the sun represented by a point mass is given by

G G ⎛ rG G
re− s ⎞
as ( r , t ) = − µ s ⎜ G 3 + G 3 ⎟
s −b
⎜r re− s ⎟⎠
⎝ s −b

where
µ s = gravitational constant of the sun
G
rs −b = position vector from the sun to the spacecraft
G
re− s = position vector from the Earth to the sun

To avoid numerical problems, use is made of Richard Battin’s f ( q ) function given by

page 9
⎡ 3 + 3qk + qk2 ⎤
f ( qk ) = qk ⎢ 3⎥
(
⎢⎣1 + 1 + qk ⎥⎦ )
where
r T ( r − 2s k )
qk =
sTk sk

The point-mass acceleration due to n gravitational bodies can now be expressed as

n
µk
r = −∑
 ⎡r + f ( qk ) s k ⎤⎦
k =1 d k3 ⎣

Flight path coordinates at the entry interface

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

rECF = [ T ] rECI

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 UT, ω e is the inertial rotation rate of the Earth,
and t is the elapsed time since 0 hours UT.

page 10
Finally, the flight path coordinates are determined from the following set of equations

r = rECF
2
+ rECF
2
y
+ rECF
2

v = vECF
2
+ vECF
2
y
+ vECF
2
z

(
λ = tan −1 rECF , rECFy 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.

Geodetic altitude and latitude

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

where the geodetic constants c and s are given by

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 expression:

⎛ sin 2δ ⎞ ⎡⎛ 1 1 ⎞ ⎤
φ =δ +⎜ ⎟ f + ⎢⎜ 2 − ⎟ sin 4δ ⎥ f 2
⎝ ρ ⎠ ⎣⎝ ρ 4ρ ⎠ ⎦

The geodetic altitude is calculated from

⎧⎪⎛ 1 − cos 2δ ⎞ ⎡⎛ 1 1⎞ ⎤ 2 ⎫⎪
hˆ = ( rˆ − 1) + ⎨⎜ ⎟ f + ⎢⎜ − ⎟ (1 − cos 4δ ) ⎥f ⎬
⎩⎪⎝ 2 ⎠ ⎣⎝ 4 ρ 16 ⎠ ⎦ ⎪⎭

In these equations, ρ is the geocentric distance of the satellite, hˆ = h / req and rˆ = ρ / req .

page 12
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;

[ PA] = Rz ( 63.8986" ) Ry ( 79.0768" ) Rx ( 0.1462" ) [ ME ]


The transformation matrix from the PA system to the ME system is given by

Rx ( −0.1462" ) Ry ( −79.0768" ) Rz ( −63.8986" )

The numerical components of the ME-to-PA transformation matrix are as follows;


0.999999878527094 3.097894216177013E-004 -3.833748976184077E-004
-3.097891271165531E-004 0.999999952015005 8.275630251118771E-007
3.833751355924360E-004 -7.087975496937868E-007 0.999999926511499

The PA-to-ME transformation is the transpose of this matrix.

These numbers have been confirmed using the following Fortran call to the sxform
subroutine of the JPL Spice library;

call sxform('moon_me', 'moon_pa', eph_time, xform1)

The following Fortran data statement can be used to include the ME-to-PA
transformation matrix in an analysis program.

c ME-to-PA transformation matrix

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 /

where tm_me2pa is dimensioned 3, 3.

π
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.

α PA = α IAU + 0.0553cos W p + 0.0034 cos (Wp + E1)

δ PA = δ IAU + 0.0220sin Wp + 0.0007 sin (Wp + E1)

WPA = WIAU + 0.01775 − 0.0507 cos Wp − 0.0034 cos (Wp + E1)

where W p is the polynomial part of the prime meridian equation given by

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

δ IAU = 66.5392 + 0.0130T + 1.5419 cos E1 + 0.0239 cos E 2


−0.0278cos E 3 + 0.0068cos E 4 − 0.0029 cos E 6
+0.0009 cos E 7 + 0.0008cos E10 − 0.0009 cos E13

WIAU = W p + 3.5610sin E1 + 0.1208sin E 2 +


−0.0642sin E 3 + 0.0158sin E 4 + 0.0252 cos E 5
−0.0066sin E 6 − 0.0047 sin E 7 − 0.0046 cos E 8
+0.0028sin E 9 + 0.0052sin E10 + 0.0040sin E11
+0.0019sin E12 − 0.0044sin E13

In these equations, W = 13.17635815 degrees/day and T is the time in Julian centuries


given by T = ( JD − 2451545.0 ) / 36525 and JD is the TDB Julian Date.

The trigonometric arguments, in degrees, for these equations are

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.

  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

  66.5392  0.0130T  1.5419 cos E1  0.0239 cos E 2


0.0278cos E 3  0.0068cos E 4  0.0029 cos E 6
0.0009 cos E 7  0.0008cos E10  0.0009 cos E13

In these equations, T is the time in Julian centuries given by

T   JD  2451545.0  / 36525

and JD is the TDB (Barycentric Dynamical Time) Julian Date.

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.

Spice frame definition

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

lunar mean equator and IAU node of J2000 frame definition

\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.

0.998496505205088 -5.481540926807404E-2 0.000000000000000


4.993572939853833E-2 0.909610125238044 0.412451018902688
-2.260867140418499E-2 -0.411830900942612 0.910979778593430

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.

subroutine mm2000 (xjdate, tmatrix)

c eme2000 to moon mean equator and IAU node


c of epoch transformation matrix

c input

c xjdate = TDB julian date

c output

Page 3
c tmatrix = transformation matrix

c Orbital Mechanics with Fortran

c ************************************

implicit double precision (a-h, o-z)

dimension phat_moon(3), rmoon(3), vmoon(3)

dimension xvec(3), xhat(3), yvec(3), yhat(3)

dimension zhat(3), hv(3), hhat(3), tmatrix(3, 3)

c conversion factor – degrees to radians

data dtr /1.745329251994330d-2/

c time arguments

t = (xjdate - 2451545.0d0) / 36525.0d0

d = xjdate - 2451545.0d0

c iau 2000 pole orientation

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

e10 = 15.134d0 - 0.1589763d0 * d

e13 = 25.053d0 + 12.9590088d0 * d

rasc_pole = 269.9949d0 + 0.0031d0 * t


& - 3.8787d0 * sin(dtr * e1)
& - 0.1204d0 * sin(dtr * e2)
& + 0.0700d0 * sin(dtr * e3)
& - 0.0172d0 * sin(dtr * e4)
& + 0.0072d0 * sin(dtr * e6)
& - 0.0052d0 * sin(dtr * e10)
& + 0.0043d0 * sin(dtr * e13)

decl_pole = 66.5392d0 + 0.0130d0 * t


& + 1.5419d0 * cos(dtr * e1)

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)

c compute the unit vector in the direction of the moon's pole

phat_moon(1) = cos(rasc_pole * dtr) * cos(decl_pole * dtr)

phat_moon(2) = sin(rasc_pole * dtr) * cos(decl_pole * dtr)

phat_moon(3) = sin(decl_pole * dtr)

c define eme2000 z-axis unit vector

zhat(1) = 0.0d0
zhat(2) = 0.0d0
zhat(3) = 1.0d0

c compute x-direction (IAU node of epoch)

call vcross (zhat, phat_moon, xvec)

call uvector(xvec, xhat)

c compute y-direction

call vcross (phat_moon, xhat, yvec)

call uvector(yvec, yhat)

c load elements of transformation matrix

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

According to “Report of the IAU/IAG Working Group on Cartographic Coordinates and


Rotational Elements: 2006”, 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 

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;

 N moon _ j 2000   M EME 2000  P moon _ j 2000


PA PA EME 2000

The numerical components of the constant moon_j2000-to-EME200 transformation


matrix are as follows;

0.998496505205088 4.993572939853833E-2 -2.260867140418499E-2


-5.481540926807404E-2 0.909610125238044 -0.411830900942612
0.000000000000000 0.412451018902688 0.910979778593430

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.

subroutine moon_pa(xjdate, tmatrix)

c moon_j2000-to-moon_pa transformation
c matrix using DE403.bin binary ephemeris

c input

c xjdate = TDB julian date

c output

c tmatrix = moon_j2000-to-moon_pa transformation matrix

c Orbital Mechanics with Fortran

c ************************************

implicit double precision (a-h, o-z)

dimension sv(6), tmatrix1(3, 3), tmatrix2(3, 3)

dimension tmatrix(3, 3)

c moon_j2000-to-j2000 transformation matrix

data tmatrix2
& / 0.998496505205088d0,
& -5.481540926807404d-2,
& 0.0d0,
& 4.993572939853833d-2,
& 0.909610125238044d0,
& 0.412451018902688d0,
& -2.260867140418499d-2,
& -0.411830900942612d0,
& 0.910979778593430d0 /

c compute lunar libration angles (radians)

icent = 0

itarg = 15

call jpleph (xjdate, itarg, icent, sv)

Page 2
phi = sv(1)

theta = sv(2)

psi = sv(3)

c compute lunar libration matrix

call matran (phi, 3, theta, 1, psi, 3, 0.0d0, 0, tmatrix1)

c create moon_j2000-to-moon_pa transformation matrix

call matxmat (tmatrix1, tmatrix2, tmatrix, 3, 3, 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

Graphics Display of the Orbital Characteristics of the Moon

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

The following is a typical user interaction with this MATLAB script.

program moon_plot

< orbital characteristics of the moon >

please input the initial calendar date


(1 <= month <= 12, 1 <= day <= 31, year = all digits!)
? 12,1,2013

please input the simulation period (days)


? 120

please input the graphics step size (days)


? 0.25

please select the orbital element to plot

<1> semimajor axis

<2> eccentricity

<3> orbital inclination

<4> argument of perigee

<5> right ascension of the ascending node

<6> true anomaly

<7> argument of latitude

<8> apogee radius

<9> perigee radius

<10> geocentric distance

<11> geocentric speed

<12> geocentric declination

<13> ecliptic inclination

page 1
Orbital Mechanics with MATLAB

<14> ecliptic argument of perigee

<15> longitude of ascending node

? 3

The following is the graphics display for this example.

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.

The required coordinate transformation is given by

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 2621.448 .

page 3
Orbital Mechanics with MATLAB

CSV data file

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.

Graphics disk file

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.

% create color eps graphics image with tiff preview

print -depsc -tiff -r300 moon_plot.eps

page 4
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.

Input file format and contents

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

speed of light (meters/second)


------------------------------
299792458.0d0

solar flux at 1 AU (watts/meters**2)


------------------------------------
1366.1d0

Earth gravitational constant (km**3/sec**2)


-------------------------------------------
398600.4415d0

Earth equatorial radius (kilometers)


------------------------------------
6378.1363d0

lunar gravitational constant (km**3/sec**2)


-------------------------------------------
4902.800238d0

lunar equatorial radius (kilometers)


------------------------------------
1738.0d0

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

user-defined final UTC


(0 <= hours <= 24, 0 <= minutes <= 60, 0 <= seconds <= 60)
----------------------------------------------------------
0, 0, 0

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

initial departure UTC


(0 <= hours <= 24, 0 <= minutes <= 60, 0 <= seconds <= 60)
----------------------------------------------------------
9, 54, 1.015

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

include planetary point-mass perturbations (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

SRP reference area (square meters)


----------------------------------
18.75

reflectivity coefficient (non-dimensional)


------------------------------------------
1.4d0

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
-------------------

precision propagation from Earth to the Moon

input file ==> pprop_lunar.in

models/constants file ==> pprop_lunar_cm.dat

geocentric csv file ==> pprop_lunar_geo.csv

selenocentric csv file ==> pprop_lunar_sel.csv

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)
----------------------------------------------------

calendar date September 15, 2008

UTC time 09:54:01.015

UTC Julian date 2454724.91251175

TDB time 09:55:06.199

TDB Julian date 2454724.91326619

sma (km) eccentricity inclination (deg) argper (deg)


0.191019260010D+06 0.965639819698D+00 0.285000095012D+02 0.245098495629D+03

raan (deg) true anomaly (deg) arglat (deg) period (hrs)


0.353244686744D+03 0.131500072200D-01 0.245111645637D+03 0.230793842263D+03

page 5
rx (km) ry (km) rz (km) rmag (km)
-.335854711130D+04 -.487114690579D+04 -.284095894469D+04 0.656345630000D+04

vx (kps) vy (kps) vz (kps) vmag (kps)


0.936637513219D+01 -.517963813841D+01 -.219458266670D+01 0.109258330320D+02

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)
----------------------------------------------------

calendar date September 19, 2008

UTC time 20:25:20.573

UTC Julian date 2454729.35093256

TDB time 20:26:25.757

TDB Julian date 2454729.35168700

sma (km) eccentricity inclination (deg) argper (deg)


-.226245472429D+06 0.262624205002D+01 0.901719175704D+02 0.161166906756D+03

raan (deg) true anomaly (deg) arglat (deg)


0.231768137167D+03 0.354547856310D+03 0.155714763066D+03

rx (km) ry (km) rz (km) rmag (km)


0.207867514538D+06 0.264586543710D+06 0.151818781333D+06 0.369139384350D+06

vx (kps) vy (kps) vz (kps) vmag (kps)


0.430256749643D+00 0.537130575593D+00 -.185682397383D+01 0.198025892137D+01

time and conditions at lunar closest approach


(selenocentric mean equator and IAU node of epoch)
--------------------------------------------------

calendar date September 19, 2008

UTC time 20:25:20.573

UTC Julian date 2454729.35093256

TDB time 20:26:25.757

TDB Julian date 2454729.35168700

sma (km) eccentricity inclination (deg) argper (deg)


-.683159249752D+04 0.126911369609D+01 0.900779883363D+02 0.140402056981D+03

raan (deg) true anomaly (deg) arglat (deg)


0.146632337106D+03 0.559777623938D-12 0.140402056981D+03

rx (km) ry (km) rz (km) rmag (km)


0.118397229795D+04 -.777817619413D+03 0.117183619518D+04 0.183847510718D+04

page 6
vx (kps) vy (kps) vz (kps) vmag (kps)
0.130806368237D+01 -.864539484913D+00 -.189545707588D+01 0.245992208100D+01

B-plane coordinates at lunar closest approach


(selenocentric mean equator and IAU node of epoch)
--------------------------------------------------

b-magnitude 5338.48444953029 kilometers


b dot r -5338.47950030206
b dot t -7.26930061703646
theta 269.921981532771 degrees
v-infinity 0.847151575372048 kilometers/second
r-periapsis 1838.47510717866 kilometers
decl-asymptote 1.59242454929836 degrees
rasc-asymptote 326.634505199896 degrees

selenocentric flight path angle 3.111053396720252E-013 degrees

time and conditions of the Moon at closest approach


(geocentric Earth mean equator and equinox of J2000)
----------------------------------------------------

calendar date September 19, 2008

UTC time 20:25:20.573

UTC Julian date 2454729.35093256

TDB time 20:26:25.757

TDB Julian date 2454729.35168700

sma (km) eccentricity inclination (deg) argper (deg)


0.387058607856D+06 0.469277196254D-01 0.274682423912D+02 0.654886547613D+02

raan (deg) true anomaly (deg) arglat (deg) period (hrs)


0.352456400322D+03 0.357078919498D+03 0.625675742595D+02 0.665692363944D+03

rx (km) ry (km) rz (km) rmag (km)


0.206629318632D+06 0.265693864645D+06 0.151030934925D+06 0.368916316165D+06

vx (kps) vy (kps) vz (kps) vmag (kps)


-.880061989244D+00 0.553144598707D+00 0.225008151526D+00 0.106353501129D+01

declination 24.1665697025103 degrees

right ascension 52.1279005815525 degrees

propagation duration 106.522099424154 hours


4.43842080933973 days

Graphic displays of flight conditions

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).

Figure 1. Earth mean equator and equinox of J2000 coordinate system

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

a r, t   r r, t   a g r, t   as r, t   am r, t   a p r, t   asrp r, t 

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 m1  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 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
 
 
page 10
The three partial derivatives of the geopotential with respect to r, ,  are given by

 1   N  R
n

        n  1  Cnm cos m  Snm sin m  Pnm  sin  


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 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  Pn01  sin     n  1 Pn02  sin  
n
Pn  sin     2n  1 cos  Pnn11  sin   ,
n
m  0, m  n
Pnm  sin    Pnm2  sin     2n  1 cos  Pnm11  sin   , m  0, m  n

where the first few associated Legendre functions are given by

P00 sin    1, P10 sin    sin  , P11 sin    cos 


and Pi j  0 for j  i .

The trigonometric arguments are determined from expansions given by

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 

where  m 0 is equal to 1 if m is zero and equal to zero if m is greater than zero.

Geocentric acceleration due to the sun, moon and planets

The acceleration contribution of the moon represented by a point mass is given by

 r r 
am  r, t    m  msc 3  em 3 
r rem 
 msc

where
m  gravitational constant of the moon
rmsc  position vector from the moon to the spacecraft
rem  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  es 3 
r res 
 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

The acceleration contribution of a planet represented by a point mass is given by

 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

The point-mass acceleration due to n gravitational bodies can now be expressed as


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.

Geocentric acceleration due to solar radiation pressure

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  res
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  res
  sign(rsc  res )
res

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

The penumbra and umbra shadow angles are found from:

 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.

If we represent the shadow as a cylinder, the shadow angle is given by:

 re 
  sin 1  
 rsc 

The corresponding penumbra and umbra cone angles are as follows:

page 15
 rs  re   rs  re 
 p  sin 1   u  sin 1  
 res   res 

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.

Geocentric-to-selenocentric coordinate transformation

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

 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
 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 Dynamical
Barycentric Time (TDB) Julian Date.

The trigonometric arguments, in degrees, for these 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 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

Predicting closest approach to the moon

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.

Predicting the conditions at a user-defined selenocentric distance

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.

Predicting the conditions at a user-defined final epoch

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.

angular momentum vector


h  rv

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
pr rh
cos   sin  
er 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 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

(1) “Lunar Trajectories”, NASA TN D-866, August 1961.

(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.

(12) Explanatory Supplement to the Astronomical Almanac, Edited by P. K. Seidelmann, University


Science Books, 1992.

(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.

(15) R. P. Brent, Algorithms for Minimization Without Derivatives, Prentice-Hall, 1972.

(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

The simulation summary screen display contains the following information:

calendar date = calendar date of trajectory event

UTC time = UTC time of trajectory event

UTC Julian Date = Julian Date of trajectory event on UTC time scale

TDB time = TDB time of trajectory event

TDB Julian Date = Julian Date of trajectory event on TDB time scale

sma (km) = semimajor axis in kilometers

eccentricity = orbital eccentricity (non-dimensional)

inclination (deg) = orbital inclination in degrees

argper (deg) = argument of periapsis in degrees

raan (deg) = right ascension of the ascending node in degrees

true anomaly (deg) = true anomaly in degrees

arglat (deg) = argument of latitude in degrees. The argument of latitude is the sum of
true anomaly and argument of perigee.

period (days) = orbital period in hours

rx (km) = x-component of the spacecraft’s position vector in kilometers

ry (km) = y-component of the spacecraft’s position vector in kilometers

rz (km) = z-component of the spacecraft’s position vector in kilometers

rmag (km) = scalar magnitude of the spacecraft’s position vector in kilometers

vx (kps) = x-component of the spacecraft’s velocity vector in kilometers per second

vy (kps) = y-component of the spacecraft’s velocity vector in kilometers per second

vz (ksp) = z-component of the spacecraft’s velocity vector in kilometers per second

vmag (kps) = scalar magnitude of the spacecraft’s velocity vector in kilometers per
second

b-magnitude = magnitude of the b-plane vector

b dot r = dot product of the B-plane b-vector and r-vector

b dot t = dot product of the B-plane b-vector and t-vector

theta = orientation of the b-plane vector in degrees

page 22
v-infinity = magnitude of incoming v-infinity vector at the Moon in kilometers/second

r-periapsis = periapsis radius of incoming hyperbola at the Moon in kilometers

decl-asymptote = declination of incoming asymptote at the Moon in degrees

rasc-asymptote = right ascension of incoming asymptote at the Moon in degrees

selenocentric flight path angle = flight path angle relative to the Moon in degrees

declination = declination of the Moon at the final event 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:

time (sec) = mission elapsed time in seconds

time (min) = mission elapsed time in minutes

time (hr) = mission elapsed time in hours

rsc-x (km) = x-component of the spacecraft’s position vector in kilometers

rsc-y (km) = y-component of the spacecraft’s position vector in kilometers

rsc-z (km) = z-component of the spacecraft’s position vector in kilometers

rsc-mag (km) = scalar magnitude of the spacecraft’s position vector in kilometers

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

sma (km) = semimajor axis in kilometers

ecc = orbital eccentricity

inc = orbital inclination in degrees

argper (deg) = argument of periapsis in degrees

raan (deg) = right ascension of the ascending node in degrees

tanom (deg) = true anomaly in degrees

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
Program lprop

A Computer Program for Propagating Selenocentric Spacecraft Orbits

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:

please input the name of the simulation definition file

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 DOS command line prompt looks similar to C:\lprop>_.

Input File Format and Contents

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

orbital eccentricity (non-dimensional; 0 <= e < 1)


--------------------------------------------------
0.0

orbital inclination (0 degrees <= inclination <= 180 degrees)


-------------------------------------------------------------
90.0

argument of periapsis (0 degrees <= argument of periapsis <= 360 degrees)


-------------------------------------------------------------------------
0.0

right ascension of the ascending node (0 degrees <= RAAN <= 360 degrees)
------------------------------------------------------------------------
0.0

true anomaly (0 degrees <= true anomaly <= 360 degrees)


-------------------------------------------------------
0.0

The next input is the total simulation duration in days.


propagation duration (days)
---------------------------
page 2
167.45

*********************
orbital perturbations
*********************

The next two integer inputs define the order (zonals) and degree (tesserals) of the lunar gravity model to
use during the simulation.

order of lunar gravity model (zonals)


-------------------------------------
50

degree of lunar gravity model (tesserals)


-----------------------------------------
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

include earth 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
********************

truncation error tolerance


--------------------------
1.0d-15

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

name of output data file


------------------------
llo_50x50.csv

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
********************************************

lunar inertial rotation rate (radians/second)


---------------------------------------------
2.6621916d-6

astronomical unit (DE421 value - kilometers)


--------------------------------------------
149597870.691d0

lunar equatorial radius (kilometers)


------------------------------------
1738.0

lunar gravitational constant (DE421 value - km**3/sec**2)


---------------------------------------------------------
4902.800076d0

sun gravitational constant (DE421 value - km**3/sec**2)


-------------------------------------------------------
132712440040.944d0

earth gravitational constant (DE421 value - km**3/sec**2)


---------------------------------------------------------
398600.436233d0

name of NAIF leap seconds data file


-----------------------------------
naif0010.tls

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/.

Typical program output

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
===============================================

input data file ==> llo_50x50.in

------------------------------------------
initial time and conditions
(lunar mean equator and IAU node of J2000)
------------------------------------------

UTC epoch 2020 SEP 30 23:58:52.818

sma (km) eccentricity inclination (deg) argper (deg)


0.183800000000D+04 0.000000000000D+00 0.900000000000D+02 0.000000000000D+00

raan (deg) true anomaly (deg) arglat (deg) period (min)


page 4
0.000000000000D+00 0.000000000000D+00 0.000000000000D+00 0.117848697375D+03

rx (km) ry (km) rz (km) rmag (km)


0.183800000000D+04 0.000000000000D+00 0.000000000000D+00 0.183800000000D+04

vx (kps) vy (kps) vz (kps) vmag (kps)


0.000000000000D+00 -.625296190644D-15 0.163323748329D+01 0.163323748329D+01

------------------------------------------
final time and conditions
(lunar mean equator and IAU node of J2000)
------------------------------------------

UTC epoch 2021 MAR 17 10:46:52.814

sma (km) eccentricity inclination (deg) argper (deg)


0.183669472950D+04 0.536412911967D-01 0.899582810466D+02 0.319783056896D+03

raan (deg) true anomaly (deg) arglat (deg) period (min)


0.150247241984D+01 0.313418760264D+03 0.273201817160D+03 0.117723182863D+03

rx (km) ry (km) rz (km) rmag (km)


0.986525659796D+02 0.130304127921D+01 -.176353086240D+04 0.176628851815D+04

vx (kps) vy (kps) vz (kps) vmag (kps)


0.168970448905D+01 0.444348123403D-01 0.158404341571D+00 0.169769480423D+01

The following is a brief summary of the information provided by the program.

UTC epoch = simulation calendar date and UTC time (yyyy mm dd hh:mm:ss.sss)

sma (km) = semimajor axis in kilometers

eccentricity = orbital eccentricity (non-dimensional)

inclination (deg) = orbital inclination in degrees

argper (deg) = argument of perigee in degrees

raan (deg) = right ascension of the ascending node in degrees

true anomaly (deg) = true anomaly in degrees

arglat (deg) = argument of latitude in degrees. The argument of latitude is the sum of
true anomaly and argument of perigee.

period (min) = orbital period in minutes

rx (km) = x-component of the spacecraft’s position vector in kilometers

ry (km) = y-component of the spacecraft’s position vector in kilometers

rz (km) = z-component of the spacecraft’s position vector in kilometers

rmag (km) = scalar magnitude of the spacecraft’s position vector in kilometers

vx (km/sec) = x-component of the spacecraft’s velocity vector in kilometers per second

vy (km/sec) = y-component of the spacecraft’s velocity vector in kilometers per second

vz (km/sec) = z-component of the spacecraft’s velocity vector in kilometers per second

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;

time (hours) = mission elapsed time in hours


time (days) = mission elapsed time in days

rsc-x (km) = inertial x-component of the selenocentric position vector in kilometers


rsc-y (km) = inertial y-component of the selenocentric position vector in kilometers
rsc-z (km) = inertial z-component of the selenocentric position vector in kilometers
rmag (km) = magnitude of the inertial selenocentric position vector in kilometers

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

semimajor axis (km) = semimajor axis in kilometers


eccentricity = orbital eccentricity (non-dimensional)
inclination (deg) = orbital inclination in degrees
arg of periapsis (deg) = argument of periapsis in degrees
raan (deg) = right ascension of the ascending node in degrees
true anomaly (deg) = true anomaly in degrees

periapsis alt (km) = periapsis altitude in kilometers


apoapsis alt (km) = apoapsis altitude in kilometers

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.

Lunar coordinate systems and transformations

We begin the technical discussion by defining a right-handed, orthogonal selenocentric or moon-


centered inertial coordinate system. 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 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  Pmoon _ j 2000
PA PA EME 2000

page 9
The numerical components of the constant moon_j2000-to-EME2000 transformation matrix are as
follows;

0.998496505205088 4.993572939853833E-2 -2.260867140418499E-2


-5.481540926807404E-2 0.909610125238044 -0.411830900942612
0.000000000000000 0.412451018902688 0.910979778593430

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.

subroutine moon_pa(xjdate, tmatrix)

c moon_j2000-to-moon_pa transformation
c matrix using DE421.bin binary ephemeris

c input

c xjdate = TDB julian date

c output

c tmatrix = moon_j2000-to-moon_pa transformation matrix

c Orbital Mechanics with Fortran

c ************************************

implicit double precision (a-h, o-z)

dimension sv(6), tmatrix1(3, 3), tmatrix2(3, 3)

dimension tmatrix(3, 3)

c moon_j2000-to-j2000 transformation matrix

data tmatrix2
& / 0.998496505205088d0,
& -5.481540926807404d-2,
& 0.0d0,
& 4.993572939853833d-2,
& 0.909610125238044d0,
& 0.412451018902688d0,
& -2.260867140418499d-2,
& -0.411830900942612d0,
& 0.910979778593430d0 /

c compute lunar libration angles (radians)

icent = 0

itarg = 15

call jpleph (xjdate, itarg, icent, sv)

phi = sv(1)

theta = sv(2)
page 10
psi = sv(3)

c compute lunar libration matrix

call matran (phi, 3, theta, 1, psi, 3, 0.0d0, 0, tmatrix1)

c create moon_j2000-to-moon_pa transformation matrix

call matxmat (tmatrix1, tmatrix2, tmatrix, 3, 3, 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.

Acceleration due to non-spherical lunar gravity

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 m1  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

        n  1  Cnm cos m  Snm sin m  Pnm  sin  


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 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  Pn01  sin     n  1 Pn02  sin  
n
Pn  sin     2n  1 cos  Pnn11  sin   ,
n
m  0, m  n
Pnm  sin    Pnm2  sin     2n  1 cos  Pnm11  sin   , m  0, m  n

where the first few associated Legendre functions are given by

P00 sin    1, P10 sin    sin  , P11 sin    cos 


and Pi j  0 for j  i .

The trigonometric arguments are determined from expansions given by

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 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 

where  m 0 is equal to 1 if m is zero and equal to zero if m is greater than zero.


page 13
Please note that lprop can accommodate a gravity model data file up to degree and order 70.

Selenocentric acceleration due to the point-mass gravity of the sun and earth

The acceleration contribution of the sun represented by a point mass is given by

 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  esc 3  me 3 
r rme 
 esc

where
e  gravitational constant of the earth
resc  position vector from the earth to the spacecraft
rme  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

The point-mass acceleration due to n gravitational bodies can now be expressed as

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.

(2) Explanatory Supplement to the Astronomical Almanac, Edited by P. K. Seidelmann, University


Science Books, 1992.

(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

Selenocentric Coordinates and Transformations


This document describes several MATLAB functions and demonstration scripts that can be used to
compute important selenocentric (moon-centered) coordinate information and transformations.
Functions are provided for computing the orientation of the moon with respect to the Earth mean equator
and equinox of J2000 (EME2000) system along with lunar libration angles extracted from a JPL binary
ephemeris file.

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

Lunar orientation with respect 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.

 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

 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

The equation for the prime meridian of the Moon, in degrees, with respect to the IAU node vector is
given by the following expression

W  Wp  3.5610sin E1  0.1208sin E 2  0.0642sin E 3  0.0158sin E 4


0.0252sin E 5  0.0066sin E 6  0.0047sin E 7  0.0046sin E8
0.0028sin E 9  0.0052sin E10  0.0040sin E11  0.0019sin E12  0.0044sin E13

where Wp  38.3213  W D  1.4 1012 D 2 degrees , W  13.17635815 degrees/day and


D  JD  2451545.0 .

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

The trigonometric arguments, in degrees, for these 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 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

moon_angles.m – orientation angles of the moon with respect to EME2000

This MATLAB function computes the orientation angles of the moon with respect to EME2000. It
implements the polynomial equations described above.

The syntax of this MATLAB function is

function [rasc_pole, decl_pole, rasc_pm] = moon_angles (jdate)

% orientation angles of the moon with respect to EME2000

% input

% jdate = julian date

% output

% rasc_pole = right ascension of the lunar pole (radians)


% decl_pole = declination of the lunar pole (radians)
% rasc_pm = right ascension of the lunar prime meridian (radians)

mm2000.m – EME2000-to-selenocentric coordinate transformation

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.

The syntax of this MATLAB function is

function tmatrix = mm2000 (xjdate)

% eme2000 to moon mean equator and IAU node of epoch

% input

% xjdate = julian date

% output

% tmatrix = transformation matrix

lunarlib.m – lunar libration angles

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.

The syntax of this MATLAB function is

function [phi, theta, psi, phi_dot, theta_dot, psi_dot] = lunarlib(jdate)

page 4
Orbital Mechanics with MATLAB

% lunar libration angles and rates using a JPL binary ephemeris

% input

% jdate = TDB julian date

% output

% phi, theta, psi = libration angles (radians)


% phi_dot, theta_dot, psi_dot = libration angle rates (radians/day)

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

lunar libration angles and rates

TDB Julian date 2451545.000000

phi -3.10247126 degrees

theta 24.34245494 degrees

psi 41.17669108 degrees

phi_dot -0.00000008 degrees/day

theta_dot 0.00000003 degrees/day

psi_dot 0.00015259 degrees/day

moon_pa1.m – lunar principal axis coordinate transformation – JPL binary ephemeris

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.

The syntax of this MATLAB function is

function tmatrix = moon_pa1(jdate)

% transformation matrix from lunar mean equator and IAU node of j2000
% to the lunar principal axes system using JPL binary ephemeris

% input

% jdate = TDB julian date

% output

% tmatrix = transformation matrix


page 5
Orbital Mechanics with MATLAB

moon_pa2.m – lunar principal axis coordinate transformation – JPL approximation

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.

The syntax of this MATLAB function is

function tmatrix = moon_pa2(jdate)

% transformation matrix from lunar mean equator and IAU node of j2000
% to the lunar principal axes system using JPL approximate equations

% input

% jdate = TDB julian date

% output

% tmatrix = transformation matrix

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;

 N moon _ j 2000   M EME 2000  P moon _ j 2000


PA PA EME 2000

page 6
Orbital Mechanics with MATLAB

The numerical components of the constant moon_j2000-to-EME200 transformation matrix are as


follows;

0.998496505205088 4.993572939853833E-2 -2.260867140418499E-2


-5.481540926807404E-2 0.909610125238044 -0.411830900942612
0.000000000000000 0.412451018902688 0.910979778593430

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.

 PA   IAU  0.0553cos Wp  0.0034 cos Wp  E1

 PA   IAU  0.0220sin Wp  0.0007 sin Wp  E1

WPA  WIAU  0.01775  0.0507 cos Wp  0.0034 cos Wp  E1

where Wp is the polynomial part of the prime meridian equation given by

Wp  38.3213  Wd  1.4 10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

 IAU  66.5392  0.0130T  1.5419 cos E1  0.0239 cos E 2


0.0278cos E 3  0.0068cos E 4  0.0029 cos E 6
0.0009 cos E 7  0.0008cos E10  0.0009 cos E13

WIAU  W p  3.5610sin E1  0.1208sin E 2 


0.0642sin E 3  0.0158sin E 4  0.0252 cos E5
0.0066sin E 6  0.0047 sin E 7  0.0046 cos E8
0.0028sin E 9  0.0052sin E10  0.0040sin E11
0.0019sin E12  0.0044sin E13

moon_me2pa.m – lunar Mean Earth/polar axis to principal axis coordinate transformation

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.

The syntax of this MATLAB function is

page 7
Orbital Mechanics with MATLAB

function tmatrix = moon_me2pa

% transformation matrix from the lunar Mean Earth/polar axis (ME)


% system to the lunar principal axes (PA) system

% output

% tmatrix = me-to-pa transformation matrix

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;

 PA  Rz  63.8986"  Ry  79.0768"  Rx 0.1462"   ME 


The transformation matrix from the PA system to the ME system is given by

Rx  0.1462"  Ry  79.0768"  Rz  63.8986" 

The numerical components of the ME-to-PA transformation matrix are as follows;

0.999999878527094 3.097894216177013E-004 -3.833748976184077E-004


-3.097891271165531E-004 0.999999952015005 8.275630251118771E-007
3.833751355924360E-004 -7.087975496937868E-007 0.999999926511499

The PA-to-ME transformation is the transpose of this matrix.

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

TDB Julian date 2451545.000000

orientation angles of the moon with respect to EME2000

rasc_pole 266.85773344 degrees

decl_pole 65.64110275 degrees

rasc_pm 41.19526398 degrees

eme2000 to moon mean equator and IAU node


of epoch transformation matrix

+9.98496505205088e-001 -5.48154092680678e-002 +0.00000000000000e+000


+4.99357293985326e-002 +9.09610125238044e-001 +4.12451018902689e-001
-2.26086714041825e-002 -4.11830900942612e-001 +9.10979778593429e-001

page 8
Orbital Mechanics with MATLAB

lunar mean equator and IAU node of J2000 (moon_j2000)


to lunar principal axis (PA) transformation matrix

moon_pa1 function

+7.52265999003059e-001 +6.58859395564263e-001 -4.04500463000584e-004


-6.58859457533997e-001 +7.52266052983559e-001 -2.73229941726294e-005
+2.86289955305899e-004 +2.87063115131547e-004 +9.99999917816412e-001

moon_pa2 function

+7.52264777076062e-001 +6.58860807363059e-001 -3.76419448610194e-004


-6.58860851635045e-001 +7.52264832430686e-001 +8.41278651081412e-006
+2.88709968745162e-004 +2.41679395513839e-004 +9.99999929118810e-001

lunar mean Earth/polar axis (ME) to lunar


principal axis (PA) transformation matrix

+9.99999878527094e-001 +3.09789421617701e-004 -3.83374897618408e-004


-3.09789127116553e-004 +9.99999952015005e-001 +8.27563025111877e-007
+3.83375135592436e-004 -7.08797549693787e-007 +9.99999926511499e-001

page 9
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.

Running the program

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:

please input the name of the simulation definition file

At this point the user should input the name of a valid input file, including the filename extension.

Input data file

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

park orbit inclination (degrees)


28.5

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

simulation step size (days)


0.25

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;

time (days) = elapsed time from initial calendar date in days

delta-v (mps) = magnitude of impulsive TLI maneuver in meters per second

RAAN (deg) = park orbit right ascension of the ascending node in degrees

tanom (deg) = park orbit true anomaly of the TLI maneuver in degrees

C3 (km/sec)**2 = twice the specific orbital energy in kilometers^2/second^2

rasc moon (deg) = geocentric right ascension of the moon in degrees at arrival

decl moon (deg) = geocentric declination 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

Nonlinear programming problem

A trajectory optimization problem can be described by a system of dynamic variables

 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

where p is a vector of problem parameters that is not time dependent.

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

while satisfying all the user-defined mission constraints.

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.

Park orbit true anomaly of the TLI maneuver

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.

The equations implemented in this scientific simulation are as follows:

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

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 

From the following form of Kepler’s equation

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 

With the two substitutions given by

E  E0  E  E0  
e cos  cos sin  sin
2 2 2 2

the time equation becomes

a3   
t      2sin cos 
 2 2 

From the elliptic relationships given by

r  a 1  e cos E 

x  a  cos E  e 

y  a sin E 1  e 2

and some more manipulation, we have the following equations:

page 8
 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 

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 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

“Lunar Trajectories”, NASA TN D-866, August 1961.

“Earth-Moon Trajectories”, JPL Technical Report No. 32-503, May 1, 1964.

“Three-Dimensional Lunar Trajectories”, V. A. Egorov, Mechanics of Space Flight Series, Israel


Program for Scientific Translations, Jerusalem 1969.

“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.

“Earth-Moon Trajectories, 1964-69”, R. J. Richard, V. C. Clarke, Jr., R. Y. Roth and W. E. Kirhofer,


JPL Technical Report No. 32-503, May 1, 1964.

page 10
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

 Initial guess and search boundaries for TLI calendar date


 Type of park orbit injection (ascending or descending)
 Orbital elements of circular park orbit
 Initial guess for transfer time
 Orbital inclination and periapsis radius of arrival hyperbola

Step 1: Solve the two-body lunar Lambert problem


for minimum TLI delta-v
Output
TLI delta-v vector
Park orbit true anomaly at TLI

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 *
************************************

please input the name of the simulation definition file

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 DOS command line prompt looks similar to C:\tlto>_.

Input data file format and contents

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:

tTLI  tl  t  tTLI  tu

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

orbital inclination (degrees)


28.5

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)
------------------------------------------

periapsis radius (kilometers)


1838.0

orbital inclination (degrees)


90.0

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)
------------------------------------------

user-defined b dot r target (kilometers)


6000.0d0

user-defined b dot t target (kilometers)


-10.0d0

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
************************

name of Earth gravity model data file


egm96.dat

order of Earth gravity model (zonals)


8

degree of Earth gravity model (tesserals)


8

include lunar perturbation (1 = yes, 0 = no)


1

include solar perturbation (1 = yes, 0 = no)


1

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
****************************

truncation error tolerance


1.0d-12

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
***************************

name of output data file


tlto1.csv

print step size (minutes)


10.0

Program example and trajectory graphics

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

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
======================================

input data file ==> tlto1.in

descending transfer

time and conditions prior to TLI


(geocentric Earth mean equator and equinox J2000)
-------------------------------------------------

UTC calendar date September 15, 2008

UTC time 13:29:13.655

UTC Julian date 2454725.06196359

TDB time 13:30:18.837

TDB Julian date 2454725.06271802

sma (km) eccentricity inclination (deg) argper (deg)


0.656345630000D+04 0.111646925668D-15 0.285000000000D+02 0.000000000000D+00

raan (deg) true anomaly (deg) arglat (deg) period (hrs)


0.357108632971D+03 0.242927962813D+03 0.242927962813D+03 0.146996629514D+01

rx (km) ry (km) rz (km) rmag (km)


-.324237192596D+04 -.497888348087D+04 -.278867391059D+04 0.656345630000D+04

vx (kps) vy (kps) vz (kps) vmag (kps)


0.677307078339D+01 -.346292269424D+01 -.169231904268D+01 0.779296254099D+01

time and conditions after TLI


(geocentric Earth mean equator and equinox J2000)
-------------------------------------------------

UTC calendar date September 15, 2008

UTC time 13:29:13.655

UTC Julian date 2454725.06196359

TDB time 13:30:18.837

TDB Julian date 2454725.06271802

sma (km) eccentricity inclination (deg) argper (deg)


0.187780715202D+06 0.965047229195D+00 0.285000000000D+02 0.242927927168D+03

raan (deg) true anomaly (deg) arglat (deg) period (hrs)


0.357108632971D+03 0.356447377822D-04 0.242927962813D+03 0.224949464232D+03

rx (km) ry (km) rz (km) rmag (km)


-.324237192596D+04 -.497888348087D+04 -.278867391059D+04 0.656345630000D+04

vx (kps) vy (kps) vz (kps) vmag (kps)


0.949449861264D+01 -.485433249196D+01 -.237229666009D+01 0.109241859784D+02

trans-lunar injection delta-v vector and magnitude


(geocentric Earth mean equator and equinox J2000)
-------------------------------------------------

page 6
deltav-x 2721.42782925067 meters/second
deltav-y -1391.40979772003 meters/second
deltav-z -679.977617407291 meters/second

deltav 3131.22343744202 meters/second

eci unit thrust vector

0.869126040865955 -0.444366180031124 -0.217160362712021

rtn unit thrust vector

1.065917010975581E-006 0.999999999999432 2.081668171172169E-015

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

transfer time 106.519756112248 hours

trans-lunar injection delta-v vector and magnitude


(geocentric Earth mean equator and equinox J2000)
-------------------------------------------------

deltav-x 2685.47702093217 meters/second


deltav-y -1485.54512251347 meters/second
deltav-z -629.489861744947 meters/second

deltav 3132.87226471460 meters/second

eci unit thrust vector

0.857193269951853 -0.474179920849342 -0.200930586553070

rtn unit thrust vector

3.929610390119714E-004 0.999999922789293 -1.740973091191034E-006

time and conditions prior to TLI


(geocentric Earth mean equator and equinox J2000)
-------------------------------------------------

UTC calendar date September 15, 2008

UTC time 09:54:55.649

UTC Julian date 2454724.91314409

TDB time 09:56:00.832

TDB Julian date 2454724.91389851

page 7
sma (km) eccentricity inclination (deg) argper (deg)
0.656345630000D+04 0.716042246482D-16 0.285000000000D+02 0.000000000000D+00

raan (deg) true anomaly (deg) arglat (deg) period (hrs)


0.353245173740D+03 0.245118791050D+03 0.245118791050D+03 0.146996629514D+01

rx (km) ry (km) rz (km) rmag (km)


-.335780398217D+04 -.487156385281D+04 -.284112242738D+04 0.656345630000D+04

vx (kps) vy (kps) vz (kps) vmag (kps)


0.668164145782D+01 -.369300013531D+01 -.156450714128D+01 0.779296254099D+01

time and conditions after TLI


(geocentric Earth mean equator and equinox J2000)
-------------------------------------------------

UTC calendar date September 15, 2008

UTC time 09:54:55.649

UTC Julian date 2454724.91314409

TDB time 09:56:00.832

TDB Julian date 2454724.91389851

sma (km) eccentricity inclination (deg) argper (deg)


0.191022462974D+06 0.965640395831D+00 0.285000120341D+02 0.245105601643D+03

raan (deg) true anomaly (deg) arglat (deg) period (hrs)


0.353245228119D+03 0.131416178811D-01 0.245118743261D+03 0.230799647130D+03

rx (km) ry (km) rz (km) rmag (km)


-.335780398217D+04 -.487156385281D+04 -.284112242738D+04 0.656345630000D+04

vx (kps) vy (kps) vz (kps) vmag (kps)


0.936711847875D+01 -.517854525782D+01 -.219399700303D+01 0.109258346332D+02

time and conditions at lunar closest approach


(geocentric Earth mean equator and equinox of J2000)
----------------------------------------------------

UTC calendar date September 19, 2008

UTC time 20:26:06.771

UTC Julian date 2454729.35146726

TDB time 20:27:11.954

TDB Julian date 2454729.35222168

sma (km) eccentricity inclination (deg) argper (deg)


-.226037830064D+06 0.262793126648D+01 0.901673932456D+02 0.161060207106D+03

raan (deg) true anomaly (deg) arglat (deg)


0.231778348616D+03 0.354652795765D+03 0.155713002871D+03

rx (km) ry (km) rz (km) rmag (km)


0.207825892551D+06 0.264611286018D+06 0.151828443552D+06 0.369137658028D+06

vx (kps) vy (kps) vz (kps) vmag (kps)


0.431679155458D+00 0.539374509368D+00 -.185628181220D+01 0.198067006867D+01

page 8
time and conditions at lunar closest approach
(selenocentric lunar mean equator & IAU node of epoch)
------------------------------------------------------

UTC calendar date September 19, 2008

UTC time 20:26:06.771

UTC Julian date 2454729.35146726

TDB time 20:27:11.954

TDB Julian date 2454729.35222168

sma (km) eccentricity inclination (deg) argper (deg)


-.683169467107D+04 0.126904013040D+01 0.899999999599D+02 0.140405474608D+03

raan (deg) true anomaly (deg) arglat (deg)


0.146641367110D+03 0.360000000000D+03 0.140405474608D+03

rx (km) ry (km) rz (km) rmag (km)


0.118297039598D+04 -.778800401735D+03 0.117144998570D+04 0.183800002517D+04

vx (kps) vy (kps) vz (kps) vmag (kps)


0.130967217408D+01 -.862213640865D+00 -.189576658616D+01 0.246020009659D+01

b-plane coordinates of incoming hyperbola


(selenocentric lunar mean equator & IAU node of epoch)
------------------------------------------------------

b-magnitude 5337.74803144691 kilometers


b dot r -5337.74803144691 kilometers
b dot t 3.733693318963560E-006 kilometers
theta 270.000000040078 degrees
v-infinity 847.145240428195 meters/second
r-periapsis 1838.00002516655 kilometers
decl-asy 1.59325896718781 degrees
rasc-asy 326.641367108400 degrees

selenocentric flight path angle -1.078655371150484E-011 degrees

----------------------------------------------------
coordinates of the moon at closest approach
(geocentric Earth mean equator and equinox of J2000)
----------------------------------------------------

UTC calendar date September 19, 2008

UTC time 20:26:06.771

UTC Julian date 2454729.35146726

TDB time 20:27:11.954

TDB Julian date 2454729.35222168

sma (km) eccentricity inclination (deg) argper (deg)


0.387057904331D+06 0.469260710975D-01 0.274682409204D+02 0.654909165021D+02

raan (deg) true anomaly (deg) arglat (deg) period (hrs)


0.352456394178D+03 0.357084293759D+03 0.625752102615D+02 0.665690548982D+03

rx (km) ry (km) rz (km) rmag (km)


0.206588660958D+06 0.265719415783D+06 0.151041328247D+06 0.368916204034D+06

page 9
vx (kps) vy (kps) vz (kps) vmag (kps)
-.880138031538D+00 0.553045427398D+00 0.224951785729D+00 0.106353444008D+01

declination 24.1683467556695 degrees

right ascension 52.1360342116955 degrees

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.

The following is the verification summary for this example.

===================================
verification of the n-body solution
===================================

time and conditions at lunar closest approach


(geocentric Earth mean equator and equinox of J2000)
----------------------------------------------------

UTC calendar date September 19, 2008

UTC time 20:26:06.771

UTC Julian date 2454729.35146726

TDB time 20:27:11.954

TDB Julian date 2454729.35222168

sma (km) eccentricity inclination (deg) argper (deg)


-.226037824690D+06 0.262793130505D+01 0.901673927406D+02 0.161060207167D+03

raan (deg) true anomaly (deg) arglat (deg)


0.231778348844D+03 0.354652795710D+03 0.155713002877D+03

rx (km) ry (km) rz (km) rmag (km)


0.207825892558D+06 0.264611286027D+06 0.151828443521D+06 0.369137658025D+06

vx (kps) vy (kps) vz (kps) vmag (kps)


0.431679141547D+00 0.539374522535D+00 -.185628182291D+01 0.198067007926D+01

time and conditions at lunar closest approach


(selenocentric lunar mean equator & IAU node of epoch)
------------------------------------------------------

UTC calendar date September 19, 2008

UTC time 20:26:06.771

UTC Julian date 2454729.35146726

TDB time 20:27:11.954

TDB Julian date 2454729.35222168

sma (km) eccentricity inclination (deg) argper (deg)


-.683169495857D+04 0.126904011717D+01 0.899999999777D+02 0.140405474793D+03

raan (deg) true anomaly (deg) arglat (deg)


0.146641367130D+03 0.736558247354D-06 0.140405475530D+03

rx (km) ry (km) rz (km) rmag (km)


0.118297040379D+04 -.778800405836D+03 0.117144995460D+04 0.183800001211D+04

page 13
vx (kps) vy (kps) vz (kps) vmag (kps)
0.130967216081D+01 -.862213632161D+00 -.189576660132D+01 0.246020009815D+01

b-plane coordinates of incoming hyperbola


(selenocentric lunar mean equator & IAU node of epoch)
------------------------------------------------------

b-magnitude 5337.74810923454 kilometers


b dot r -5337.74810923454 kilometers
b dot t 2.076305861464789E-006 kilometers
theta 270.000000022287 degrees
v-infinity 847.145222603009 meters/second
r-periapsis 1838.00001210839 kilometers
decl-asy 1.59325954678117 degrees
rasc-asy 326.641367129470 degrees

selenocentric flight path angle 4.119460026174752E-007 degrees

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.

Nonlinear programming problem

A trajectory optimization problem can be described by a system of dynamic variables

 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

where p is a vector of problem parameters that is not time dependent.

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 .

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

and the problem parameters

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

while satisfying all the user-defined mission constraints.

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 

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.

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 

From the following form of Kepler’s equation

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 

With the two substitutions given by

page 16
E  E0 
e cos  cos
2 2
E  E0 
sin  sin
2 2

the time equation becomes

a3   
t      2sin cos 
 2 2 

From the elliptic relationships given by

r  a 1  e cos E 

x  a  cos E  e 

y  a sin E 1  e 2

and some more manipulation, we have the following equations:

 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 

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

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.

Modeling the spacecraft’s trajectory

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 m1  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

        n  1   Cnm cos m  Snm sin m  Pnm  sin  


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   

page 19
  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  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  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

where the first few associated Legendre functions are given by

P00 sin    1, P10 sin    sin  , P11 sin    cos 

and Pi j  0 for j  i .

The trigonometric arguments are determined from expansions given by

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 

Point-mass gravity of the sun and moon

The acceleration contribution of the moon represented by a point mass is given by

page 20
 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

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 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

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

The point-mass acceleration due to n gravitational bodies can now be expressed as

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.

ascending  p  180  m  sin 1  tan  m tan i p 

descending  p  m  sin 1  tan  m tan i p 

where
 m  right ascension of the moon at encounter
 m  declination of the moon at encounter
i p  park orbit inclination

These opportunities are valid whenever  m  i p .

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 v2

and

cos i
cos   sin    1  cos2     tan 1  sin  ,cos  
cos  

sin    sˆ  zˆ  sx2  s 2y

zˆ  0 0 1
T

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.

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.

angular momentum vector h rv

radius rate r r v r

semiparameter p  h2 

r
semimajor axis a
 r v2 
 
 
2

orbital eccentricity e  1 p a

pr 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

R  S  T    SzTy , SzTx , S xTy  S yTx 


T
R vector

Targeting to the Selenocentric Periapsis Radius and Orbital Inclination

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.

Geocentric-to-selenocentric coordinate transformation

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

 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

 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 Dynamical
Barycentric Time (TDB) Julian Date.

The trigonometric arguments, in degrees, for these 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 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

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.

TT = TAI + 32.184 seconds


TT = UTC + (number of leap seconds) + 32.184 seconds

Barycentric Dynamical Time, TDB


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.

TDB = TT + periodic corrections

where typical periodic corrections (USNO Circular 179) are

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

“Lunar Trajectories”, NASA TN D-866, August 1961.

“Earth-Moon Trajectories”, JPL Technical Report No. 32-503, May 1, 1964.

“Three-Dimensional Lunar Trajectories”, V. A. Egorov, Mechanics of Space Flight Series, Israel


Program for Scientific Translations, Jerusalem 1969.

“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.

The simulation summary screen display contains the following information:

transfer time = total time from the TLI maneuver to closest approach at the moon

UTC time = simulation event time on the UTC time scale

TDB time = simulation event time on the TDB time scale

sma (km) = semimajor axis in kilometers

eccentricity = orbital eccentricity (non-dimensional)

inclination (deg) = orbital inclination in degrees

argper (deg) = argument of perigee in degrees

raan (deg) = right ascension of the ascending node in degrees

true anomaly (deg) = true anomaly in degrees

arglat (deg) = argument of latitude in degrees. The argument of latitude is the sum of
true anomaly and argument of perigee.

period (min) = orbital period in minutes

rx (km) = x-component of the spacecraft’s position vector in kilometers

ry (km) = y-component of the spacecraft’s position vector in kilometers

rz (km) = z-component of the spacecraft’s position vector in kilometers

rmag (km) = scalar magnitude of the spacecraft’s position vector in kilometers

vx (km/sec) = x-component of the spacecraft’s velocity vector in kilometers per second

vy (km/sec) = y-component of the spacecraft’s velocity vector in kilometers per second

vz (km/sec) = z-component of the spacecraft’s velocity vector in kilometers per second

vmag (km/sec) = scalar magnitude of the spacecraft’s velocity vector in kilometers per
second

delta-vx = x-component of the TLI impulsive velocity vector in meters/second

delta-vy = y-component of the TLI impulsive velocity vector in meters/second

delta-vz = z-component of the TLI impulsive velocity vector in meters/second

delta-v = scalar magnitude of the TLI maneuver in meters/seconds

b-magnitude = magnitude of the b-plane vector

b dot r = dot product of the b-vector and r-vector

b dot t = dot product of the b-vector and t-vector

page 30
theta = orientation of the b-plane vector

v-infinity = magnitude of incoming v-infinity vector

r-periapsis = periapsis of incoming hyperbola

decl-asy = declination of incoming v-infinity vector

rasc-asy = right ascension of incoming v-infinity vector

The comma-separated-variable disk file contains the following information:

time (sec) = simulation time since TLI maneuver in seconds

time (min) = simulation time since TLI maneuver in minutes

time (hr) = simulation time since TLI maneuver in hours

re2sc-x (km) = x-component of the spacecraft’s geocentric position vector in kilometers

re2sc-y (km) = y-component of the spacecraft’s geocentric position vector in kilometers

re2sc-z (km) = z-component of the spacecraft’s geocentric position vector in kilometers

re2sc-mag (km) = the spacecraft’s geocentric radius in kilometers

ve2sc-y (km/sec) = y-component of the spacecraft’s geocentric velocity vector in


kilometers per second

ve2sc-z (km/sec) = z-component of the spacecraft’s geocentric position vector in


kilometers per second

ve2sc-mag (km/sec) = the spacecraft’s geocentric speed in kilometers per second

rm2sc-x (km) = x-component of the spacecraft’s selenocentric position vector in


kilometers

rm2sc-y (km) = y-component of the spacecraft’s selenocentric position vector in


kilometers

rm2sc-z (km) = z-component of the spacecraft’s selocentric position vector in kilometers

rm2sc-mag (km) = the spacecraft’s selocentric radius in kilometers

vm2sc-y (km/sec) = y-component of the spacecraft’s selocentric velocity vector in


kilometers per second

vm2sc-y (km/sec) = y-component of the spacecraft’s selocentric velocity vector in


kilometers per second

vm2sc-z (km/sec) = z-component of the spacecraft’s selocentric position vector in


kilometers per second

vm2sc-mag (km/sec) = the spacecraft’s selocentric speed in kilometers per second

re2m-x (km) = x-component of the moon’s geocentric position vector in kilometers

re2m-y (km) = y-component of the moon’s geocentric position vector in kilometers

re2m-z (km) = z-component of the moon’s geocentric position vector in kilometers

re2m-mag (km) = the moon’s geocentric radius in kilometers

sma-geo (km) = geocentric semimajor axis of the spacecraft in kilometers

page 31
ecc-geo = geocentric orbital eccentricity of the spacecraft(non-dimensional)

incl-geo (deg) = geocentric orbital inclination of the spacecraft in degrees

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

tanom-geo (deg) = geocentric true anomaly of the spacecraft in degrees

sma-sel (km) = selocentric semimajor axis of the spacecraft in kilometers

ecc-sel = selocentric orbital eccentricity of the spacecraft(non-dimensional)

incl-sel (deg) = selocentric orbital inclination of the spacecraft in degrees

argper-sel (deg) = selocentric argument of perigee of the spacecraft in degrees

raan-sel (deg) = selocentric right ascension of the ascending node of the spacecraft in
degrees

tanom-sel (deg) = selocentric true anomaly 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
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

 Initial guess and search boundaries for TLI calendar date


 Orbital elements of park orbit
 Initial guess for transfer time
 Orbital inclination and periapsis radius of arrival hyperbola

Step 1: Solve the two-body, patched-conic Lambert


problem for minimum TLI delta-v
Output
TLI delta-v vector
Park orbit true anomaly at TLI

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.

Input data file

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:

tTLI  tl  t  tTLI  tu

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

orbital inclination (degrees)


28.5

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)
******************************************

periapsis radius (kilometers)


1838.0

orbital inclination (degrees)


90.0

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

user-defined b dot t target (kilometers)


-10.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
************************

name of Earth gravity model data file


egm96.dat

order of Earth gravity model (zonals)


8

degree of Earth gravity model (tesserals)


8

include lunar perturbations (1 = yes, 0 = no)


1

include solar perturbations (1 = yes, 0 = no)


1

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)
===============================================

transfer time 110.000000 hours


4.583333 days

time and conditions prior to TLI maneuver


(geocentric - EME2000 coordinates)
----------------------------------

TLI calendar date 15-Sep-2008

TLI TDB time 13:28:05.251

TLI UTC time 13:27:00.068

TDB Julian Date 2454725.06117188

sma (km) eccentricity inclination (deg) argper (deg)


+6.56345630000000e+003 +1.35864267153940e-016 +2.85000000000000e+001 +0.00000000000000e+000

raan (deg) true anomaly (deg) arglat (deg) period (min)


+3.57104393710039e+002 +2.42909648924973e+002 +2.42909648924973e+002 +8.81979777086159e+001

rx (km) ry (km) rz (km) rmag (km)


-3.24456343004315e+003 -4.97771093154222e+003 -2.78821818235973e+003 +6.56345630000000e+003

vx (kps) vy (kps) vz (kps) vmag (kps)


+6.77158353483592e+000 -3.46531310637468e+000 -1.69337729725198e+000 +7.79296254099309e+000

time and conditions after TLI maneuver


(geocentric - EME2000 coordinates)
----------------------------------

TLI calendar date 15-Sep-2008

TLI TDB time 13:28:05.251

TLI UTC time 13:27:00.068

page 5
TDB Julian Date 2454725.06117188

sma (km) eccentricity inclination (deg) argper (deg)


+1.87780714767952e+005 +9.65047229114502e-001 +2.85000000000003e+001 +2.42909613134046e+002

raan (deg) true anomaly (deg) arglat (deg) period (hrs)


+3.57104393710040e+002 +3.57909263026812e-005 +2.42909648924972e+002 +2.24949463452083e+002

rx (km) ry (km) rz (km) rmag (km)


-3.24456343004315e+003 -4.97771093154222e+003 -2.78821818235973e+003 +6.56345630000000e+003

vx (kps) vy (kps) vz (kps) vmag (kps)


+9.49241377742482e+000 -4.85768338477745e+000 -2.37378012838519e+000 +1.09241859782093e+001

TLI delta-v vector and magnitude


(geocentric - EME2000 coordinates)
----------------------------------

x-component of delta-v 2720.830243 meters/second


y-component of delta-v -1392.370278 meters/second
z-component of delta-v -680.402831 meters/second

total delta-v 3131.223437 meters/second

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
=======================

transfer time 100.031089 hours


4.167962 days

time and conditions prior to TLI maneuver


(geocentric - EME2000 coordinates)
----------------------------------

TLI calendar date 15-Sep-2008

TLI TDB time 13:28:05.251

TLI UTC time 13:27:00.068

TDB Julian Date 2454725.06117188

sma (km) eccentricity inclination (deg) argper (deg)


+6.56345630000000e+003 +1.35864267153940e-016 +2.85000000000000e+001 +0.00000000000000e+000

raan (deg) true anomaly (deg) arglat (deg) period (min)


+3.53134948801182e+002 +2.44172470506028e+002 +2.44172470506028e+002 +8.81979777086159e+001

rx (km) ry (km) rz (km) rmag (km)


-3.45955273524335e+003 -4.81288338412803e+003 -2.81897268607985e+003 +6.56345630000000e+003

vx (kps) vy (kps) vz (kps) vmag (kps)


+6.60758577574912e+000 -3.80074384776447e+000 -1.62000666206034e+000 +7.79296254099309e+000

time and conditions after TLI maneuver


(geocentric - EME2000 coordinates)
----------------------------------

TLI calendar date 15-Sep-2008

page 6
TLI TDB time 13:28:05.251

TLI UTC time 13:27:00.068

TDB Julian Date 2454725.06117188

sma (km) eccentricity inclination (deg) argper (deg)


+1.91539022427179e+005 +9.65733074802826e-001 +2.85678450695080e+001 +2.43838681553173e+002

raan (deg) true anomaly (deg) arglat (deg) period (hrs)


+3.53426726578129e+002 +7.74519521262285e-002 +2.43916133505300e+002 +2.31736466030734e+002

rx (km) ry (km) rz (km) rmag (km)


-3.45955273524335e+003 -4.81288338412803e+003 -2.81897268607985e+003 +6.56345630000000e+003

vx (kps) vy (kps) vz (kps) vmag (kps)


+9.26196472873258e+000 -5.32011423469812e+000 -2.30040949319355e+000 +1.09260921624751e+001

c3 -2.08104039 kilometer^2/second^2

TLI delta-v vector and magnitude


(geocentric - EME2000 coordinates)
----------------------------------

x-component of delta-v 2654.378953 meters/second


y-component of delta-v -1519.370387 meters/second
z-component of delta-v -680.402831 meters/second

total delta-v 3133.235071 meters/second

time and conditions at lunar closest approach


(geocentric - EME2000 coordinates)
---------------------------------

calendar date 19-Sep-2008

TDB time 17:29:57.171

UTC time 17:28:51.989

TDB Julian Date 2454729.22913392

sma (km) eccentricity inclination (deg) argper (deg)


-2.28713159598017e+005 +2.61463378323508e+000 +8.97893931172111e+001 +1.56145502303737e+002

raan (deg) true anomaly (deg) arglat (deg)


+2.30084255256307e+002 +3.59989485113065e+002 +1.56134987416802e+002

rx (km) ry (km) rz (km) rmag (km)


+2.17119129842395e+005 +2.58670719786934e+005 +1.49406720506468e+005 +3.69287998655666e+005

vx (kps) vy (kps) vz (kps) vmag (kps)


+5.07533799513513e-001 +6.17013130789681e-001 -1.80644724120071e+000 +1.97523350428681e+000

time and conditions at lunar closest approach


(selenocentric - lunar mean equator and IAU node of epoch)
----------------------------------------------------------

calendar date 19-Sep-2008

TDB time 17:29:57.171

UTC time 17:28:51.989

TDB Julian Date 2454729.22913392

sma (km) eccentricity inclination (deg) argper (deg)


-6.78955967880514e+003 +1.27070975348398e+000 +9.00000002502544e+001 +1.39861102532488e+002
page 7
raan (deg) true anomaly (deg) arglat (deg)
+1.49727675117551e+002 +1.26044990182062e-006 +1.39861103792938e+002

rx (km) ry (km) rz (km) rmag (km)


+1.21351795603449e+003 -7.08336544864261e+002 +1.18485341225312e+003 +1.83800002691410e+003

vx (kps) vy (kps) vz (kps) vmag (kps)


+1.37019251470119e+000 -7.99788290394575e-001 -1.88147530767330e+000 +2.46110507093456e+000

b-plane coordinates of incoming hyperbola


(selenocentric - lunar mean equator and IAU node of epoch)
----------------------------------------------------------

b-magnitude 5323.219500 kilometers


b dot r -5323.219500 kilometers
b dot t -0.000023 kilometers
b-plane angle 270.000000 degrees
v-infinity 849.769803 meters/second
r-periapsis 1838.000027 kilometers
decl-asymptote 2.041382 degrees
rasc-asymptote 329.727675 degrees

flight path angle 0.000001 degrees

time and conditions of the Moon at closest approach


(geocentric - EME2000 coordinates)
----------------------------------

sma (km) eccentricity inclination (deg) argper (deg)


+3.87222085154969e+005 +4.73070216958102e-002 +2.74685970331298e+001 +6.49740297862375e+001

raan (deg) true anomaly (deg) arglat (deg) period (days)


+3.52457827423746e+002 +3.55843275376830e+002 +6.08173051630670e+001 +2.77547562172152e+001

rx (km) ry (km) rz (km) rmag (km)


+2.15854272831657e+005 +2.59717408495340e+005 +1.48580389102599e+005 +3.68947599803954e+005

vx (kps) vy (kps) vz (kps) vmag (kps)


-8.62242782854681e-001 +5.75618223034707e-001 +2.37822003832208e-001 +1.06365326153845e+000

declination 23.747958 degrees

right ascension 50.269621 degrees

Appendix A contains a brief summary of the numerical information provided by this script.

Verification of the n-body 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.

The following is the verification summary for this example.

===============================
verification of n-body solution
===============================

time and conditions at lunar closest approach


(geocentric - EME2000 coordinates)
----------------------------------

page 8
calendar date 19-Sep-2008

TDB time 17:29:57.171

UTC time 17:28:51.989

TDB Julian Date 2454729.22913392

sma (km) eccentricity inclination (deg) argper (deg)


-2.28713150911317e+005 +2.61463384459788e+000 +8.97893921239001e+001 +1.56145503199169e+002

raan (deg) true anomaly (deg) arglat (deg)


+2.30084255690761e+002 +3.59989484225981e+002 +1.56134987425150e+002

rx (km) ry (km) rz (km) rmag (km)


+2.17119129886993e+005 +2.58670719794644e+005 +1.49406720451546e+005 +3.69287998665067e+005

vx (kps) vy (kps) vz (kps) vmag (kps)


+5.07533761939626e-001 +6.17013144264464e-001 -1.80644726546092e+000 +1.97523352102857e+000

time and conditions at lunar closest approach


(selenocentric - mean lunar equator and IAU node of epoch)
----------------------------------------------------------

sma (km) eccentricity inclination (deg) argper (deg)


-6.78955965962634e+003 +1.27070975448569e+000 +9.00000006881741e+001 +1.39861102649912e+002

raan (deg) true anomaly (deg) arglat (deg)


+1.49727675117381e+002 +3.34293558528183e-006 +1.39861105992848e+002

rx (km) ry (km) rz (km) rmag (km)


+1.21351800094987e+003 -7.08336560600557e+002 +1.18485335933995e+003 +1.83800002852338e+003

vx (kps) vy (kps) vz (kps) vmag (kps)


+1.37019247781244e+000 -7.99788285518785e-001 -1.88147533591106e+000 +2.46110507039998e+000

b-plane coordinates of incoming hyperbola


(selenocentric - mean lunar equator and IAU node of epoch)
----------------------------------------------------------

b-magnitude 5323.219496 kilometers


b dot r -5323.219496 kilometers
b dot t -0.000064 kilometers
b-plane angle 269.999999 degrees
v-infinity 849.769804 meters/second
r-periapsis 1838.000029 kilometers
decl-asymptote 2.041381 degrees
rasc-asymptote 329.727675 degrees

flight path angle 0.000002 degrees

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

<1> transfer trajectory

<2> motion within the lunar SOI

<3> both flight phases

<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

<1> time of closest approach

<2> user-defined duration

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

print -depsc -tiff -r300 tlto_plot1.eps

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.

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 

From the following form of Kepler’s equation

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 

With the two substitutions given by

E  E0 
e cos  cos
2 2
E  E0 
sin  sin
2 2

the time equation becomes

a3   
t      2sin cos 
 2 2 

From the elliptic relationships given by

r  a 1  e cos E 

x  a  cos E  e 

y  a sin E 1  e 2

and some more manipulation, we have the following equations:

page 13
 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 

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.

Modeling the spacecraft’s n-body trajectory

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
   0R 0   n R m
n n

  r, ,      Cn   Pn  u      Pn  u   Snm sin m  Cnm cos m 


r r n 1  r  r n 1 m1  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  .

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

        n  1   Cnm cos m  Snm sin m  Pnm  sin  


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  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  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

where the first few associated Legendre functions are given by

P00 sin    1, P10 sin    sin  , P11 sin    cos 

and Pi j  0 for j  i .

The trigonometric arguments are determined from expansions given by

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 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 

where  m 0 is equal to 1 if m is zero and equal to zero if m is greater than zero.

Point-mass gravity of the sun and moon

The acceleration contribution of the moon represented by a point mass is given by

 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

The acceleration contribution of the sun represented by a point masses is given by

 r r 
a s  r , t     s  s b 3  e  s 3 
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

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

The point-mass acceleration due to n gravitational bodies can now be expressed as

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.

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.

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 .

Orbital element targeting to a Selenocentric Periapsis Radius and Orbital Inclination

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 v2

and
cos i
cos   sin    1  cos2 
cos  

page 20
sin    sˆ  zˆ  sx2  s 2y

zˆ  0 0 1
T

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.

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|

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.

angular momentum vector h  rv

radius rate r r v r

semiparameter p  h2 

r
semimajor axis a
 r v2 
 
 
2

orbital eccentricity e  1 p a

pr 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

R  S  T    SzTy , SzTx , S xTy  S yTx 


T
R vector

Predicting closest approach to the moon

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.

% set up options for ode45

options = odeset('RelTol', 1.0e-10, 'AbsTol', 1.0e-10, 'Events', @tlto_fpa_event);

% solve for closest approach conditions

tend = 7.0 * 86400.0;

[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.

function [value, isterminal, direction] = tlto_fpa_event(t, y)

% selenocentric flight path angle event function

% required by tlto_matlab.m

% Orbital Mechanics with MATLAB

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

global jdtdb_tli

% lunar state vector at current time t

jdate = jdtdb_tli + t / 86400;

svmoon = jpleph_mice(jdate, 10, 3);

% form the selenocentric spacecraft position and velocity

rm2sc = y(1:3) - svmoon(1:3);

vm2sc = y(4:6) - svmoon(4:6);

% sine of the selenocentric flight path angle

value = rm2sc' * vm2sc / (norm(rm2sc) * norm(vm2sc));

isterminal = 1;

direction = [];

Geocentric-to-selenocentric coordinate transformation

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

 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

 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 Barycentric
Dynamical Time (TDB) Julian Date.

The trigonometric arguments, in degrees, for these equations are

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

Nonlinear programming problem

A trajectory optimization problem can be described by a system of dynamic variables

 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

where p is a vector of problem parameters that is not time dependent.

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.

The problem may also be subject to path constraints of the form g  y  t  , u  t  , t   0 .

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

and the problem parameters

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

while satisfying all the user-defined mission constraints.

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.

function [rto, vto, ri, vi] = tlto_snopt(oev)

% solve for two-body minimum tli delta-v using snopt

% required by tlto_matlab.m

% control variables

% x(1) = time "offset" relative to initial TLI guess (hours)


% x(2) = park orbit delta-v true anomaly (radians)

% Orbital Mechanics with MATLAB

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

global emu jdtdb_tli tof oev1 tli_lwr1 tli_upr1

% initialize "working" orbital elements

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;

% true anomaly bounds

xlwr(2) = -pi;

xupr(2) = +pi;

xlwr = xlwr';

xupr = xupr';

% bounds on objective function

page 27
flow(1) = 0.0d0;

fupp(1) = +Inf;

% find optimum

snscreen off;

% read SNOPT specs file

snspec('tlto_specs.txt');

[x, f, inform, xmul, fmul] = snopt(xg, xlwr, xupr, flow, fupp, 'tlto_func_snopt');

% "solved for" park orbit state vector

[ri, vi] = orb2eci(emu, oev1);

% coordinates of moon at encounter

jdate = jdtdb_tli + tof / 86400.0d0;

svmoon = jpleph_mice(jdate, 10, 3);

% solve lambert's problem

revmax = 0;

sv1(1:3) = ri;

sv1(4:6) = vi;

sv2(1:3) = svmoon(1:3);

sv2(4:6) = svmoon(4:6);

[vto, vfto] = glambert(emu, sv1, sv2, tof, revmax);

% geocentric transfer orbit position vector at TLI

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.

function [f, g] = tlto_func_snopt(x)

% lunar two-body TLI delta-v objective function

% required by tlto_matlab.m

% input

% control variable

% x(1) = time "offset" relative to initial TLI guess (hours)


% x(2) = park orbit delta-v true anomaly (radians)

% output

% f = TLI delta-v magnitude (km/sec)

page 28
% Orbital Mechanics with MATLAB

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

global emu jdtdb0 jdtdb_tli oev1 ri vi tof itli_type

% current tli julian date

jdtdb_tli = jdtdb0 + x(1) / 24.0d0;

% compute state vector of the moon at encounter

jdate = jdtdb_tli + tof / 86400.0d0;

svmoon = jpleph_mice(jdate, 10, 3);

% extract position and velocity vectors

rmoon = svmoon(1:3);

vmoon = svmoon(4:6);

% declination and right ascension (radians)

decm = asin(rmoon(3) / norm(rmoon));

rascm = atan3(rmoon(2), rmoon(1));

% ascending injection option

raan1 = -pi + rascm + asin(tan(decm) / tan(oev1(3)));

% descending injection option

raan2 = rascm - asin(tan(decm) / tan(oev1(3)));

% select current park orbit raan based in injection type

if (itli_type == 1)

oev1(5) = raan1;

else

oev1(5) = raan2;

end

% current park orbit true anomaly (radians)

oev1(6) = x(2);

% compute current park orbit state vector

[ri, vi] = orb2eci(emu, oev1);

% solve lambert's problem

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);

% compute delta-v components

for i = 1:1:3

dv_tli(i) = vito(i) - vi(i);

end

% scalar objective function - TLI delta-v magnitude (km/sec)

f(1) = norm(dv_tli);

% no derivatives

g = [];

page 30
Algorithm resources

“Lunar Trajectories”, NASA TN D-866, August 1961.

“Earth-Moon Trajectories”, JPL Technical Report No. 32-503, May 1, 1964.

“Three-Dimensional Lunar Trajectories”, V. A. Egorov, Mechanics of Space Flight Series, Israel


Program for Scientific Translations, Jerusalem 1969.

“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.

The simulation summary screen display contains the following information:

transfer time = total time from the TLI maneuver to closest approach at the moon

TDB time = simulation event time on the TDB time scale

UTC time = simulation event time on the UTC time scale

sma (km) = semimajor axis in kilometers

eccentricity = orbital eccentricity (non-dimensional)

inclination (deg) = orbital inclination in degrees

argper (deg) = argument of perigee in degrees

raan (deg) = right ascension of the ascending node in degrees

true anomaly (deg) = true anomaly in degrees

arglat (deg) = argument of latitude in degrees. The argument of latitude is the sum of
true anomaly and argument of perigee.

period (***) = orbital period in minutes, hours or days

c3 = twice the specific orbital energy in kilometers squared per second squared

rx (km) = x-component of the spacecraft’s position vector in kilometers

ry (km) = y-component of the spacecraft’s position vector in kilometers

rz (km) = z-component of the spacecraft’s position vector in kilometers

rmag (km) = scalar magnitude of the spacecraft’s position vector in kilometers

vx (km/sec) = x-component of the spacecraft’s velocity vector in kilometers per second

vy (km/sec) = y-component of the spacecraft’s velocity vector in kilometers per second

vz (km/sec) = z-component of the spacecraft’s velocity vector in kilometers per second

vmag (km/sec) = scalar magnitude of the spacecraft’s velocity vector in kilometers per
second

delta-vx = x-component of the TLI impulsive velocity vector in meters/second

delta-vy = y-component of the TLI impulsive velocity vector in meters/second

delta-vz = z-component of the TLI impulsive velocity vector in meters/second

delta-v = scalar magnitude of the TLI maneuver in meters/seconds

b-magnitude = magnitude of the b-plane vector in kilometers

b dot r = dot product of the b-vector and r-vector in kilometers

page 32
b dot t = dot product of the b-vector and t-vector in kilometers

theta = orientation of the b-plane vector in degrees

v-infinity = magnitude of incoming v-infinity vector in meters/second

r-periapsis = periapsis radius of incoming hyperbola in kilometers

decl-asymptote = declination of incoming v-infinity vector in degrees

rasc-asymptote = right ascension of incoming v-infinity vector 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.

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

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.

TT = TAI + 32.184 seconds


TT = UTC + (number of leap seconds) + 32.184 seconds

Barycentric Dynamical Time, TDB


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.

TDB = TT + periodic corrections

where typical periodic corrections (USNO Circular 179) are

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 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.

% read leap seconds data file

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.

global jdateleap leapsec

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)

% find number of leap seconds for utc julian date

% input

% jdate = utc julian date

% input via global

% jdateleap = array of utc julian dates


% leapsec = array of leap seconds

% output

% leapsecond = number of leap seconds

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.

function jdutc = tdb2utc (jdtdb)

% convert TDB julian date to UTC julian date

% input

% jdtdb = TDB julian date

% output

% jdutc = UTC julian date

% Orbital Mechanics with MATLAB

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

global jdsaved

jdsaved = jdtdb;

% convergence tolerance

rtol = 1.0d-8;

% set lower and upper bounds

x1 = jdsaved - 0.1;

x2 = jdsaved + 0.1;

% solve for UTC julian date using Brent's method

page 36
[xroot, froot] = brent ('jdfunc', x1, x2, rtol);

jdutc = xroot;

end

This function calls the following MATLAB objective function during the calculations.

function fx = jdfunc (jdin)

% objective function for tdb2utc

% input

% jdin = current value for UTC julian date

% output

% fx = delta julian date

% Orbital Mechanics with MATLAB

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

global jdsaved

tai_utc = findleap(jdin);

fx = utc2tdb (jdin, tai_utc) - jdsaved;

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
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.

The important features of this scientific simulation are as follows:

 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:

 collocation and implicit integration


 adaptive mesh refinement
 sparse nonlinear programming

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 *
************************************

please input the name of the simulation definition file

The user should respond to this prompt with the name of a compatible input data file including the
filename extension.

Input file format and contents

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

initial TDB time guess (hours, minutes, seconds)


0, 0, 0

lower bound for initial time guess (hours)


-24.0

upper bound for initial time guess (hours)


+24.0

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

thrust magnitude (newtons)


5000.0

specific impulse (seconds)


450.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

lower bound for thrust duration (seconds)


100.0

upper bound for thrust duration (seconds)


1000.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
******************

semimajor axis (kilometers)


6563.3363

orbital eccentricity (non-dimensional)


0.0d0

orbital inclination (degrees)


28.5d0

argument of perigee (degrees)


0.0d0

right ascension of the ascending node (degrees)


282.787

true anomaly (degrees)


305.233

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

transfer time lower bound (hours)


84.0d0

transfer time upper bound (hours)


108.0d0

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)
------------------------------------------

periapsis radius (kilometers)


1838.0

orbital inclination (degrees)


90.0

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
************************

include j2 gravity perturbation (1 = yes, 0 = no)


1

include solar perturbations (1 = yes, 0 = no)


1

include lunar perturbations (1 = yes, 0 = no)


1

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 *
******************************

create/update binary restart data file (yes or no)


no

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

number of grid points in phase 2 (coast to lunar encounter)


75

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
***************************************

read an optimal control configuration file (yes or no)


no

name of optimal control configuration file


tlto1_config.txt

create an optimal control configuration file (yes or no)


no

name of optimal control configuration file


tlto1_config.txt

Optimal Control Solution

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
----------------

input data file ==> tlto1.in

numerical integration initial guess

a, e, i constrained; bounded RAAN & true longitude

------------------------------------------------------
park orbit initial conditions
(geocentric - Earth mean equator and equinox of J2000)
------------------------------------------------------

calendar date October 12, 2008

TDB time 16:45:56.642

TDB Julian date 2454752.19857224

sma (km) eccentricity inclination (deg) argper (deg)


0.656333630000D+04 0.337656355758D-15 0.285000000001D+02 0.000000000000D+00

raan (deg) true anomaly (deg) arglat (deg) period (hrs)


0.287195861707D+03 0.286043048287D+03 0.286043048287D+03 0.146992598213D+01

page 8
rx (km) ry (km) rz (km) rmag (km)
-.475930402705D+04 -.337158742648D+04 -.300978517350D+04 0.656333630000D+04

vx (kps) vy (kps) vz (kps) vmag (kps)


0.402228337545D+01 -.659519173681D+01 0.102764678874D+01 0.779303378153D+01

------------------------------------------------------
time and conditions at end of TLI finite burn
(geocentric - Earth mean equator and equinox of J2000)
------------------------------------------------------

calendar date October 12, 2008

TDB time 16:53:26.805

TDB Julian date 2454752.20378247

sma (km) eccentricity inclination (deg) argper (deg)


0.188605021797D+06 0.964966562528D+00 0.285136491860D+02 0.303164578156D+03

raan (deg) true anomaly (deg) arglat (deg) period (hrs)


0.287146403096D+03 0.184559477276D+02 0.321620525884D+03 0.226432289601D+03

rx (km) ry (km) rz (km) rmag (km)


-.196718305280D+04 -.616802312790D+04 -.200908455122D+04 0.677869745626D+04

vx (kps) vy (kps) vz (kps) vmag (kps)


0.843662330982D+01 -.568110244384D+01 0.346971081493D+01 0.107466474302D+02

final mass 489.956582872968 kilograms

propellant mass 510.043417127032 kilograms

thrust duration 450.163554891133 seconds

delta-v 3148.40228435593 meters/second

------------------------------------------------------
time and conditions at beginning of trans-lunar coast
(geocentric - Earth mean equator and equinox of J2000)
------------------------------------------------------

calendar date October 12, 2008

TDB time 16:53:26.805

TDB Julian date 2454752.20378247

sma (km) eccentricity inclination (deg) argper (deg)


0.188605022221D+06 0.964966562606D+00 0.285136491854D+02 0.303164578158D+03

raan (deg) true anomaly (deg) arglat (deg) period (hrs)


0.287146403096D+03 0.184559477263D+02 0.321620525884D+03 0.226432290364D+03

rx (km) ry (km) rz (km) rmag (km)


-.196718305288D+04 -.616802312802D+04 -.200908455121D+04 0.677869745639D+04

vx (kps) vy (kps) vz (kps) vmag (kps)


0.843662330994D+01 -.568110244389D+01 0.346971081493D+01 0.107466474303D+02

------------------------------------------------------
time and conditions at lunar sphere-of-influence
(geocentric - Earth mean equator and equinox of J2000)
------------------------------------------------------

page 9
calendar date October 16, 2008

TDB time 19:36:15.566

TDB Julian date 2454756.31684683

sma (km) eccentricity inclination (deg) argper (deg)


0.182765112444D+06 0.991136395952D+00 0.788292866378D+02 0.336687837478D+03

raan (deg) true anomaly (deg) arglat (deg) period (hrs)


0.235996970525D+03 0.179356842529D+03 0.156044680006D+03 0.215997351927D+03

rx (km) ry (km) rz (km) rmag (km)


0.208245444983D+06 0.257873126624D+06 0.143942931031D+06 0.361364472776D+06

vx (kps) vy (kps) vz (kps) vmag (kps)


0.792384820463D-01 0.131480006199D+00 -.396969018687D-01 0.158560944387D+00

------------------------------------------------------
time and conditions at lunar sphere-of-influence
(selenocentric lunar mean equator & IAU node of epoch)
------------------------------------------------------

calendar date October 16, 2008

TDB time 19:36:15.566

TDB Julian date 2454756.31684683

sma (km) eccentricity inclination (deg) argper (deg)


-.619130066766D+04 0.129628416983D+01 0.902141274019D+02 0.315630146925D+03

raan (deg) true anomaly (deg) arglat (deg)


0.325541802794D+03 0.230099522693D+03 0.185729669618D+03

rx (km) ry (km) rz (km) rmag (km)


-.205052179728D+05 0.140821422237D+05 -.249585778317D+04 0.249999999959D+05

vx (kps) vy (kps) vz (kps) vmag (kps)


0.895329539381D+00 -.614047330240D+00 -.737580629172D-01 0.108816789132D+01

------------------------------------------------------
time and conditions at lunar closest approach
(selenocentric lunar mean equator & IAU node of epoch)
------------------------------------------------------

calendar date October 17, 2008

TDB time 01:04:40.769

TDB Julian date 2454756.54491631

sma (km) eccentricity inclination (deg) argper (deg)


-.615478109923D+04 0.129862962957D+01 0.900000000013D+02 0.315506025045D+03

raan (deg) true anomaly (deg) arglat (deg)


0.325500870882D+03 0.895644198300D-11 0.315506025045D+03

rx (km) ry (km) rz (km) rmag (km)


0.108051471785D+04 -.742593009982D+03 -.128813336463D+04 0.183799999974D+04

vx (kps) vy (kps) vz (kps) vmag (kps)


0.143020212900D+01 -.982918683482D+00 0.176632564306D+01 0.247618931939D+01

page 10
------------------------------------------------------
b-plane coordinates of incoming hyperbola
(selenocentric lunar mean equator & IAU node of epoch)
------------------------------------------------------

b-magnitude 5099.33518378722 kilometers


b dot r 5099.33518378722
b dot t -1.135427112330945E-007
theta 90.0000000012758 degrees
v-infinity 892.515554352604 meters/second
r-periapsis 1837.99999974034 kilometers
decl-asy -4.85167997302203 degrees
rasc-asy 325.500870881723 degrees

selenocentric flight path angle 5.066484611301138E-012 degrees

TLI to SOI duration 98.8385901041329 hours

TLI to closest approach duration 104.312257602811 hours

------------------------------------------------------
coordinates of the moon at closest approach
(geocentric - Earth mean equator and equinox of J2000)
------------------------------------------------------

calendar date October 17, 2008

TDB time 01:04:40.769

TDB Julian date 2454756.54491631

sma (km) eccentricity inclination (deg) argper (deg)


0.390199354514D+06 0.675885534905D-01 0.272667968985D+02 0.638187138880D+02

raan (deg) true anomaly (deg) arglat (deg) period (hrs)


0.352327432109D+03 0.357204061295D+03 0.610227751834D+02 0.673811315346D+03

rx (km) ry (km) rz (km) rmag (km)


0.212470264207D+06 0.256867171511D+06 0.145825944378D+06 0.363853765991D+06

vx (kps) vy (kps) vz (kps) vmag (kps)


-.877338109248D+00 0.585467570386D+00 0.238679391860D+00 0.108141679570D+01

declination 23.6270577371795 degrees

right ascension 50.4038062239193 degrees

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)
------------------------------------------------------

calendar date October 12, 2008

TDB time 16:53:26.805

TDB Julian date 2454752.20378247

sma (km) eccentricity inclination (deg) argper (deg)


0.188605010467D+06 0.964966560164D+00 0.285136492601D+02 0.303164576336D+03

page 15
raan (deg) true anomaly (deg) arglat (deg) period (hrs)
0.287146402598D+03 0.184559496421D+02 0.321620525978D+03 0.226432269197D+03

rx (km) ry (km) rz (km) rmag (km)


-.196718311958D+04 -.616802319271D+04 -.200908457735D+04 0.677869754236D+04

vx (kps) vy (kps) vz (kps) vmag (kps)


0.843662313135D+01 -.568110260966D+01 0.346971074385D+01 0.107466473548D+02

final mass 489.956582873049 kilograms

propellant mass 510.043417126951 kilograms

thrust duration 450.163554891133 seconds

delta-v 3148.39874170068 meters/second

------------------------------------------------------
time and conditions at lunar sphere-of-influence
(selenocentric lunar mean equator & IAU node of epoch)
------------------------------------------------------

calendar date October 16, 2008

TDB time 19:36:15.566

TDB Julian date 2454756.31684683

sma (km) eccentricity inclination (deg) argper (deg)


-.619130231760D+04 0.129628437873D+01 0.902133674706D+02 0.315630131786D+03

raan (deg) true anomaly (deg) arglat (deg)


0.325541849903D+03 0.230099543782D+03 0.185729675568D+03

rx (km) ry (km) rz (km) rmag (km)


-.205052416109D+05 0.140820935004D+05 -.249585970474D+04 0.249999921308D+05

vx (kps) vy (kps) vz (kps) vmag (kps)


0.895329454928D+00 -.614047375945D+00 -.737581134894D-01 0.108816785106D+01

------------------------------------------------------
time and conditions at lunar closest approach
(selenocentric lunar mean equator & IAU node of epoch)
------------------------------------------------------

calendar date October 17, 2008

TDB time 01:04:40.769

TDB Julian date 2454756.54491631

sma (km) eccentricity inclination (deg) argper (deg)


-.615478273561D+04 0.129862987923D+01 0.899992378203D+02 0.315506007238D+03

raan (deg) true anomaly (deg) arglat (deg)


0.325500917242D+03 0.367010839840D-03 0.315506374249D+03

rx (km) ry (km) rz (km) rmag (km)


0.108051327414D+04 -.742611522507D+03 -.128812679311D+04 0.183800202505D+04

vx (kps) vy (kps) vz (kps) vmag (kps)


0.143021191825D+01 -.982895196640D+00 0.176632906232D+01 0.247618808960D+01

page 16
------------------------------------------------------
b-plane coordinates of incoming hyperbola
(selenocentric lunar mean equator & IAU node of epoch)
------------------------------------------------------

b-magnitude 5099.33894806607 kilometers


b dot r 5099.33894761164
b dot t 6.807811598068270E-002
theta 89.9992350795343 degrees
v-infinity 892.515435705324 meters/second
r-periapsis 1838.00202502428 kilometers
decl-asy -4.85168448435964 degrees
rasc-asy 325.500852547647 degrees

selenocentric flight path angle 2.073457962401969E-004 degrees

Creating an initial guess

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

increases the spacecraft’s orbital energy.

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

1. Create a binary restart file from a converged and optimized simulation


2. Modify the original input file with slightly different spacecraft characteristics, propulsive
parameters or perhaps final mission targets and/or constraints
3. Use the previously created binary restart file as the initial guess for the new simulation

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.

(1) Point functions – initial orbit and mass constraints

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

For both options, the initial orbit inclination is constrained by enforcing

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

Otherwise, for an elliptical park orbit, the single equality constraint

f 2  g2  e

is enforced, where e is the park orbit eccentricity.

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

For both options, the initial true longitude is bounded according to

360  Li  360

and for option 2, the RAAN of the initial park orbit is bounded according to

i  30    i  30

where i is the user’s initial guess for RAAN.

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.

(2) Performance index – maximize final spacecraft mass

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.

(3) Path constraint – unit thrust vector scalar magnitude

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:

uT  uT2r  uT2t  uT2n  1

(4) Point functions – periapsis altitude and selenocentric orbital inclination

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.

Targeting to a selenocentric periapsis radius and orbital inclination

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  

where vx , v y , vz are the components of the spacecraft’s inertial velocity vector.

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    

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

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

orbital inclination i  2 tan 1  h2  k 2 


argument of periapsis   tan 1  g f   tan 1  k h 

right ascension of the ascending node   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   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 s2n
h  cos L
dt  2w

dk p s 2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
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 

The total non-two-body acceleration vector is given by

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
rv rv 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.

Non-spherical Earth gravity

The non-spherical gravitational acceleration vector can be expressed as

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.

The contributions due to the zonal gravity effects of J 2 , J 3 , J 4 are as follows:

 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.

Finally, the zonal gravity perturbation contribution is a g  QT g , where Q   ˆi r ˆit ˆin  .

For J 2 effects only, the three components are as follows:

3 J 2 Re2  12  h sin L  k cos L 2 


 J2  1  
r
2r 4 
 1  h  k  
2 2 2

12  J 2 Re2   h sin L  k cos L  h cos L  k sin L  


 J2  
 1  h2  k 2  
2
t
r4
 

6 J 2 Re2  1  h  k   h sin L  k cos L  


2 2

 J2  
n
r4 
 1  h 2
 k 
2 2 

Secondary Body Perturbations

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  .

Cartesian equations of motion (Phase 2 – coast to lunar closest approach)

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

y4    3 1   1  2    amx  asx  aTx


r  2 r 2  r  

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

y6    1   3     amz  asz  aTz


r 3  2 r 2  r 2  

where vx , v y , vz are the components of the spacecraft’s inertial velocity vector.

Propulsive thrust

The acceleration due to propulsive thrust can be expressed as

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.

The propellant mass flow rate is determined from

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:

uTr  sin  uTt  cos cos uTn  cos sin

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
rv rv 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:

uTECI  cos  cos  uTECI  sin  cos  uTECI  sin 


x y z

Finally, the right ascension and declination angles can be determined from the components of the ECI
unit thrust vector according to

  tan 1 uT ECI y


, uTECI
x
   sin 1 uT  ECI z

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 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.

angular momentum vector h  rv

radius rate r r v r

semiparameter p  h2 

r
semimajor axis a
 r v2 
 
 
2

orbital eccentricity e  1 p a

pr 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

Geocentric-to-selenocentric coordinate transformation

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

 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

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.

The trigonometric arguments, in degrees, for these 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 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

where a is the semimajor axis of the final elliptical orbit.

A note about targeting the lunar inclination

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

“Lunar Trajectories”, NASA TN D-866, August 1961.

“Earth-Moon Trajectories”, JPL Technical Report No. 32-503, May 1, 1964.

“Three-Dimensional Lunar Trajectories”, V. A. Egorov, Mechanics of Space Flight Series, Israel


Program for Scientific Translations, Jerusalem 1969.

“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.

“Earth-Moon Trajectories, 1964-69”, R. J. Richard, V. C. Clarke, Jr., R. Y. Roth and W. E. Kirhofer,


JPL Technical Report No. 32-503, May 1, 1964.

“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 simulation summary screen display contains the following information:

sma (km) = semimajor axis in kilometers

eccentricity = orbital eccentricity (non-dimensional)

inclination (deg) = orbital inclination in degrees

argper (deg) = argument of perigee in degrees

raan (deg) = right ascension of the ascending node in degrees

true anomaly (deg) = true anomaly in degrees

arglat (deg) = argument of latitude in degrees.

period (min) = orbital period.

rx (km) = x-component of the eci position vector in kilometers

ry (km) = y-component of the eci position vector in kilometers

rz (km) = z-component of the eci position vector in kilometers

rmag (km) = geocentric position magnitude in kilometers

vx (kps) = x-component of the eci velocity vector in kilometers/second

vy (kps) = y-component of the eci velocity vector in kilometers/second

vz (kps) = z-component of the eci velocity vector in kilometers/second

vmag (kps) = velocity vector scalar magnitude in kilometers/seconds

deltav = scalar magnitude of the TLI maneuver in meters/seconds

The user-defined comma-separated-variable disk file is created by the odeprt subroutine and contains
the following information:

time (hrs) = time since ignition in hours

rx (km) = x-component of eci position vector in kilometers

ry (km) = y-component of eci position vector in kilometers

rz (km) = z-component of eci position vector in kilometers

rmag (km) = geocentric radius magnitude in kilometers

vx (km/sec) = x-component of eci velocity vector in kilometers per second

vy (km/sec) = y-component of eci velocity vector in kilometers per second

vz (km/sec) = z-component of eci velocity vector in kilometers per second

page 35
vmag (km/sec) = scalar velocity vector in kilometers per second

semimajor axis (km) = semimajor axis in kilometers

eccentricity = orbital eccentricity (non-dimensional)

inclination (deg) = orbital inclination in degrees

arg of perigee (deg) = argument of perigee in degrees

raan (deg) = right ascension of the ascending node in degrees

true anomaly (deg) = true anomaly in degrees

fpa (deg) = flight path angle in degrees

seleno radius (km) = selenocentric radius of the spacecraft in kilometers

rm2sc-x (km) = x-component of selenocentric position vector in kilometers

rm2sc-y (km) = y-component of selenocentric position vector in kilometers

rm2sc-z (km) = z-component of selenocentric position vector in kilometers

rm2scm (km) = selenocentric position magnitude in kilometers

pmee = orbital semiparameter in kilometers

fmee = modified equinoctial orbital element = ecc * cos(argper + raan)

gmee = modified equinoctial orbital element = ecc * sin(argper + raan)

hmee = modified equinoctial orbital element = tan(i/2) * cos(raan)

xkmee = modified equinoctial orbital element = tan(i/2) * sin(raan)

xlmee = modified equinoctial orbital element = orbital true longitude in degrees

rmoon-x (km) = x-component of the moon’s geocentric position vector in kilometers

rmoon-y (km) = y-component of the moon’s geocentric position vector in kilometers

rmoon-z (km) = z-component of the moon’s geocentric position vector in kilometers

yaw (deg) = thrust vector yaw angle in degrees

pitch (deg) = thrust vector pitch angle in degrees

rasc (deg) = thrust vector right ascension angle in degrees

decl (deg) = thrust vector declination angle in degrees

ut-radial = radial component of unit thrust vector

ut-tangential = tangential component of unit thrust vector

ut-normal = normal component of unit thrust vector

ut-eci-x = x-component of the eci unit thrust vector

ut-eci-y = y-component of the eci unit thrust vector

ut-eci-z = z-component of the eci unit thrust vector

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.

tlto_ocs.f - main executive program

atan3.for - four quadrant inverse tangent function

csint.for - cubic spline integration subroutine

display.for - subroutine that displays the simulation summary

eci2mee.for - convert eci position and velocity vectors to modified equinoctial


orbital elements subroutine

eci2orb.for - convert eci position and velocity vectors to classical orbital


elements subroutine

findca.for - subroutine to compute closest approach to the moon

fpaobj.for - selenocentric flight path angle subroutine

fpasub.for - subroutine that converts state vector to flight path angle

gdate.for - convert Julian date to calendar date subroutine

geo_eqm.for - first-order equations of motion subroutine

linput.for - read and echo a line of text from an input file subroutine

mee2eci.for - convert modified elements to eci state vector subroutine

mm2000.for - lunar coordinates transformation matrix subroutine

odeigs.for - initial guess subroutine

odeinp.for - simulation input subroutine

odepf.for - point functions subroutine

odeprt.for - print subroutine – creates comma-separated-variable file

oderhs.for - subroutine that evaluates the equations of motion and any algebraic
equations

orb2eci.for - convert classical orbital elements to eci position and velocity


vector subroutine

readfpn.for - read and echo floating point number from input file subroutine

readint.for - read and echo integer from input file subroutine

readtext.for - read and echo text from input file subroutine

rkf78.for - Runge-Fehlberg-Kutta (RKF78) numerical integration subroutine

page 37
rkf78cn.for - evaluate RKF78 integration coefficients subroutine

rv2bp.for - convert position and velocity to b-plane coordinates subroutine

sv2000.for - lunar and solar ephemeris subroutine

ueci2umee.for – convert eci unit vector to modified unit vector subroutine

twobody2.for – two-body orbit propagation subroutine

utility.for - number and text manipulation functions and subroutines

uvector.for - unit vector subroutine

vcross.for - vector cross product subroutine

vdot.for - vector dot product subroutine

vecmag.for - vector scalar magnitude function

xmod.for - modulo 2 pi function

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.

subroutine odepf(iphase, iphend, time, y, ny, p, np,


& ptf, nf, iferr)

c lunar trajectory optimization point functions

c ************************************

implicit double precision (a-h, o-z)

include 'socscom1.inc'

dimension y(ny), ptf(nf), p(np), reci(3), veci(3)

dimension hv(3), rmoon(3), vmoon(3), tmatrix(3, 3)

dimension rtmp(3), vtmp(3), oev(6)

dimension bplane(12), tv(3), rv(3)

iferr = 0

c local circular velocity (kilometers/second)

vlc = sqrt(emu / req)

if (iphase .eq. 1) then

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)

c convert modified equinoctial elements to eci state vector

call mee2eci(pmee, fmee, gmee, hmee, xkmee, xlmee, reci,


& veci, smovrp, tani2s, cosl, sinl, wmee, radius,
& hsmks, ssqrd)

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)

c convert eci state vector to modified equinoctial orbital elements

call eci2mee(reci, veci, pmee, fmee, gmee, hmee,


& xkmee, xlmee)

end if

c extract current spacecraft mass (kilograms)

xmass = y(7)

c *********************************************************************
c compute point functions for state vector continuity at phase boundary
c *********************************************************************

if (iphase .eq. 1 .and. iphend .eq. +1) then

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

if (iphase .eq. 2 .and. iphend .eq. -1) then

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 compute classical orbital elements

call eci2orb(emu, reci, veci, oev)

c cosine(inclination)

call vcross(reci, veci, hv)

hmag = vecmag(hv)

ptf(1) = hv(3) / hmag

c RAAN (radians)

ptf(2) = oev(5)

end if

if (iphase .eq. 2 .and. iphend .eq. +1) then

c ---------------------------------
c selenocentric mission constraints
c ---------------------------------

xjdate = xjdate0 + time / 86400.0d0

call sv2000(xjdate, 10, 3, rmoon, vmoon)

c state vector from the moon to the spacecraft

do i = 1, 3
rtmp(i) = reci(i) - rmoon(i)

vtmp(i) = veci(i) - vmoon(i)


end do

c state vector in mm2000 coordinate system

call mm2000 (xjdate, tmatrix)

call matxvtr(tmatrix, rtmp, rm2sc)

call matxvtr(tmatrix, vtmp, vm2sc)

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)

if (icaerr .eq. 1) then

c error check - close approach not found

iferr = 1

return

end if

c selenocentric periapsis radius point function (kilometers)

ptf(2) = vecmag(rca)

c ---------------------------------------
c cos(orbital inclination) point function
c ---------------------------------------

call vcross(rca, vca, hv)

hmag = vecmag(hv)

ptf(3) = hv(3) / hmag

end if

return
end

page 42
APPENDIX D

A Computer Program for Preliminary Trans-Lunar Mission Analysis

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

 Initial guess and search boundaries for TLI calendar date


 Type of park orbit injection (ascending or descending)
 Altitude and inclination of circular park orbit
 TLI to lunar encounter transfer time

Solve the two-body lunar Lambert problem for


the minimum TLI impulsive delta-v
Output
TLI calendar date and time
TLI delta-v vector and magnitude
Orbital elements of the park orbit at TLI

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.

Input data file

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

lower bound for TLI calendar date search (hours)


0.0

upper bound for TLI calendar date search (hours)


+24.0

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

orbital inclination (degrees)


28.5

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

Running the software

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:

please input the name of the simulation definition file

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

minimum TLI delta-v - two-body Lambert solution


-----------------------------------------------

DE421 ephemeris

descending TLI maneuver

transfer time 110.000000000000 hours

time and conditions prior to TLI


(geocentric EME2000 coordinates)
--------------------------------

calendar date September 15, 2008

TDB time 13:28:05.752

TDB Julian date 2454725.06117768

sma (km) eccentricity inclination (deg) argper (deg)


0.656345630000D+04 0.207703680281D-15 0.285000000000D+02 0.000000000000D+00

raan (deg) true anomaly (deg) arglat (deg) period (hrs)


0.357104409591D+03 0.242909717395D+03 0.242909717395D+03 0.146996629514D+01

rx (km) ry (km) rz (km) rmag (km)


-.324455523486D+04 -.497771531863D+04 -.278821988671D+04 0.656345630000D+04

vx (kps) vy (kps) vz (kps) vmag (kps)


0.677158909898D+01 -.346530416667D+01 -.169337334111D+01 0.779296254099D+01

impulsive TLI delta-v vector and magnitude


(geocentric EME2000 coordinates)
--------------------------------

delta-vx 2720.83248728905 meters/second


delta-vy -1392.36667258734 meters/second
delta-vz -680.401233802791 meters/second

deltav 3131.22343721745 meters/second

time and conditions after TLI

page 45
(geocentric EME2000 coordinates)
--------------------------------

calendar date September 15, 2008

TDB time 13:28:05.752

TDB Julian date 2454725.06117768

sma (km) eccentricity inclination (deg) argper (deg)


0.187780714768D+06 0.965047229115D+00 0.285000000000D+02 0.242909681798D+03

raan (deg) true anomaly (deg) arglat (deg) period (hrs)


0.357104409591D+03 0.355961509164D-04 0.242909717395D+03 0.224949463452D+03

rx (km) ry (km) rz (km) rmag (km)


-.324455523486D+04 -.497771531863D+04 -.278821988671D+04 0.656345630000D+04

vx (kps) vy (kps) vz (kps) vmag (kps)


0.949242158627D+01 -.485767083926D+01 -.237377457491D+01 0.109241859782D+02

energy -2.12269104413893 (km/sec)**2

time and conditions at lunar encounter


(geocentric EME2000 coordinates)
--------------------------------

calendar date September 20, 2008

TDB time 03:28:05.752

TDB Julian date 2454729.64451101

sma (km) eccentricity inclination (deg) argper (deg)


0.187780714768D+06 0.965047229115D+00 0.285000000000D+02 0.242909681798D+03

raan (deg) true anomaly (deg) arglat (deg) period (hrs)


0.357104409591D+03 0.179731146959D+03 0.626408287569D+02 0.224949463452D+03

rx (km) ry (km) rz (km) rmag (km)


0.183855964261D+06 0.278989583980D+06 0.156328383523D+06 0.368885845565D+06

vx (kps) vy (kps) vz (kps) vmag (kps)


-.155895536718D+00 0.106160944175D+00 0.532911953610D-01 0.195993663009D+00

coordinates of the moon at encounter


(geocentric EME2000 coordinates)
--------------------------------

calendar date September 20, 2008

TDB time 03:28:05.752

TDB Julian date 2454729.64451101

sma (km) eccentricity inclination (deg) argper (deg)


0.386687523939D+06 0.460363401223D-01 0.274675327593D+02 0.667488782745D+02

raan (deg) true anomaly (deg) arglat (deg) period (hrs)


0.352453157500D+03 0.440281280327D-04 0.667489223026D+02 0.664735266590D+03

page 46
rx (km) ry (km) rz (km) rmag (km)
0.183855964261D+06 0.278989583980D+06 0.156328383523D+06 0.368885845565D+06

vx (kps) vy (kps) vz (kps) vmag (kps)


-.919440261341D+00 0.497446347203D+00 0.193581222756D+00 0.106315424672D+01

declination 25.0737984493215 degrees

right ascension 56.6148560499457 degrees

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.

A brief guide to the other items displayed by the software is as follows;

sma (km) = semimajor axis in kilometers

eccentricity = orbital eccentricity (non-dimensional)

inclination (deg) = orbital inclination in degrees

argper (deg) = argument of perigee in degrees

raan (deg) = right ascension of the ascending node in degrees

true anomaly (deg) = true anomaly in degrees

arglat (deg) = argument of latitude in degrees. The argument of latitude is the sum of
true anomaly and argument of perigee.

period (min) = orbital period in minutes.

rx (km) = x-component of the eci position vector in kilometers

ry (km) = y-component of the eci position vector in kilometers

rz (km) = z-component of the eci position vector in kilometers

rmag (km) = geocentric position magnitude in kilometers

vx (kps) = x-component of the eci velocity vector in kilometers/second

vy (kps) = y-component of the eci velocity vector in kilometers/second

vz (kps) = z-component of the eci velocity vector in kilometers/second

vmag (kps) = velocity vector scalar magnitude in kilometers/seconds

delta-vx = x-component of the TLI impulsive velocity vector in meters/second

delta-vy = y-component of the TLI impulsive velocity vector in meters/second

delta-vz = z-component of the TLI impulsive velocity vector in meters/second

deltav = scalar magnitude of the TLI maneuver in meters/seconds

page 47
Technical Discussion

This section describes several of the algorithms implemented in the lguess computer program.

Nonlinear programming problem

A trajectory optimization problem can be described by a system of dynamic variables

 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

where p is a vector of problem parameters that is not time dependent.

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

while satisfying all the user-defined mission constraints.

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 

From the following form of Kepler’s equation

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 

With the two substitutions given by

page 49
E  E0 
e cos  cos
2 2
E  E0 
sin  sin
2 2

the time equation becomes

a3   
t      2sin cos 
 2 2 

From the elliptic relationships given by

r  a 1  e cos E 

x  a  cos E  e 

y  a sin E 1  e 2

and some more manipulation, we have the following equations:

 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 

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

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.

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. 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

 m  right ascension of the moon at encounter


 m  declination of the moon at encounter
i p  park orbit inclination

These opportunities are valid whenever  m  i p .

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

Você também pode gostar