# How did the Apollo guidance computer handle the Earth-Moon system's rotation around the Sun?

In this comment I just wrote:

"...but at all other times it is just doing math to calculate its trajectory." The math needed a stable clock Timing accuracy of the Apollo Guidance Computer? (also 2, 3) and an ephemeris to look up the positions of the Earth and Moon as a function of time to calculate which way their gravitational accelerations are pointing.

But now I wonder how the Apollo guidance computer software accounted for the motion of the Earth-Moon system's orbit around the Sun during the few days the astronauts spent traveling between the two.

1. Did the software have a look-up table for the position of the Earth-Moon barycenter relative to the Sun?
2. Or was there just a centrifugal pseudo-force term based on an average distance to the Sun?
3. Or something else?
4. Or nothing at all?

The Apollo Guidance Computer contained the position and speed of the Sun relative to the earth at launch time, and was able to calculate it's position at any given time after launch based on that data. (The ephemerides data was loaded on the computer's erasable memory pre-launch).

There is a couple of subroutines called LSPOS and SOLPOS in LUNAR_AND_SOLAR_EPHEMERIDES_SUBROUTINES, part of the Apollo 11 control software publicly available in github. Both of them perform the calculation described above. Notice that I didn't check if the subroutine is actually used anywhere, but the capability is there.

Of special notice should be the caveat in the source code that the Moon calculations are only valid for 15 days after launch; Apollo 17 got close to that limit at 12 days.

• So if they would miss the launch date by a week or two, they would have to wait some months for the manufacturing of new core rope memory modules with another polynomial aproximation of the Moon's position.
– Uwe
Feb 19 '19 at 13:56
• +1 Great find, thank you! I just did a quick look and at least one of the uses of the position of the sun is in P51-P53.agc for purposes of ruling out stars that may not be visible due to interference by the Moon and the Sun, so as you mention it still remains to be seen if and if so, how the Sun's position might have been used in orbit propagation.
– uhoh
Feb 19 '19 at 13:56
• @Uwe No, the lunar and solar ephemerides were stored in the erasable memory, not the fixed memory. So they could be updated for any launch day. Feb 19 '19 at 14:01
• @uwe Added as clarification. Feb 19 '19 at 14:05
• From page 4: "EPHM - obtains earth and moon states relative to each other, solar position, and a precession-nutation-libration direction cosine matrix from the magnetic tape ephemeris."
– uhoh
Feb 20 '19 at 0:48