# How do “Deep space” corrections in SGP4 account for the Sun's and Moon's gravity?

The [Simplified Perturbations model] SGP4 is used to calculate Earth satellite state vectors (position and velocity) using standard ephemeris data encoded as TLEs (Two Line Elements). According to Wikipedia:

Current code libraries have merged SGP4 and SDP4 algorithms into a single codebase handling the range of orbital periods which are usually referred to generically as SGP4.

where SDP4 is the deep-space partner to the original SGP4, using only the simplest drag model but now also accounting for other perturbative effects, including the gravitational perturbations of the Moon and the Sun (as well as resonant effects near 1 and 2 orbits per day).

Published TLEs are calculated specifically to work with the appropriate SGP predictor. According to the original 1980/1988 version of Spacetrack Report No. 3, Models for Propagation of NORAD Element Sets:

All space objects are classified by NORAD as near-Earth (period less than 225 minutes) or deep-space (period greater than or equal 225 minutes). Depending on the period, the NORAD element sets are automatically generated with the near-Earth or deep-space model. The user can then calculate the satellite period and know which prediction model to use.

In SGP4 the initialization uses the TLE's mean motion to set a flag that determines which propagation method is used later in the execution. For example something along the lines of:

if ((2*pi / satrec.no) >= 225.0)
{
satrec.method = 'd';
satrec.isimp  = 1;


or

IF((TWOPI/XNODP/XMNPDA) .GE. .15625) IDEEP=1


where 0.15625 is exactly 225/(24*60).

QUESTION: Can someone explain how SGP4 mathematically estimates the gravitational perturbations from the Sun and Moon? Does it contain a "mini-ephemeris" for the relative positions of the Sun, Earth, Moon system as a function of epoch, or at least their average periods, and propagate the satellite's motion including these forces, or does it use some average perturbation model?

note: I'm not looking for a general answer like "it uses perturbation theory", I'd like to know roughly how SGP4 actually does it.

Just for one particular example, in January the Sun will pull in one direction, but in July it will pull in the opposite direction. If the orbit is highly elliptical, does this matter for the perturbation calculation? Does it matte if the Sun pulls in the direction of periapsis, apoapsis or to the side?

SGP4 is also discussed in the 2006 report Revisiting Spacetrack Report #3: Rev 2.

• Probably, the Long periodic perturbations section of this paper would give you some ideas. google.com/… – Tarlan Mammadzada Mar 12 '18 at 19:05
• @TarlanMammadzada excellent! Mario Comini's 2016 Master's Thesis Orbit determination with the Simplified General Perturbation Model is full of goodies and helpful explanations. Thank you! de-googlified: politesi.polimi.it/bitstream/10589/134054/1/2017_04_Comini.pdf – uhoh Mar 12 '18 at 19:32

If you want a complete answer about how SGP4 (or SDP4) does it, you should read form the original source: The Space Track Report #3. For the actual theory behind, you should read the references by Hujsak and Hoots, for which I could not have access.

During the description of SDP4 routines, it says:

"At this point SDP4 calls the initialization section of DEEP which calculates all initialized quantities needed for the deep-space perturbations (see Section Ten).

(...)

Here SDP4 calls the periodics section of DEEP which adds the deep-space lunar and solar periodics to the orbital elements (see Section Ten). From this point on, it will be assumed that n, e, I, ω, Ω, and M are the mean motion, eccentricity, inclination, argument of perigee, longitude of ascending node, and mean anomaly after lunar-solar periodics have been added."

Section 10, however, provides the code but no equations for the deep-space routines. The Fortran code is full of constants and (apparently at least) dummy variables, which pollutes the code. But there is also a well known implementation in Matlab in Celestrak's website, which I find more readable.

From the Matlab code, I can infer that there are no mini-ephemeris for either the sun or moon, as there is no computation involving julian date or universal time going on anywhere. In Earth resonance effects, the sidereal time is used, though. One comment in dspace routine claims:

"This procedure provides deep space contributions to mean elements for perturbing third body. These effects have been averaged over one revolution of the Sun and Moon. For Earth resonance effects, the effects have been averaged over no [sic] revolutions of the satellite. (Mean motion)."

Checking the dsinit function, you'll see that the mean elements are modified by adding their averaged time perturbation multiplied by the elapsed time since the TLE epoch, such as in:

em = em + dedt * t

Where the mean eccentricity is augmented by the perturbing effect. The factor dedt depends on several computations, but there is no trigonometric series involved (as in the past, computing trigonometric functions was done with parsimony).

So, you could check the references for a more accurate answer, but I'll leave with the conclusion that they add perturbations by some (very well scaled) average perturbing rate on mean elements, which afterwards are converted to osculating position and velocity with usual methods.

• "...they add perturbations by some...average perturbing rate on mean elements..." okay, thank you for going deep! So it's door #3; "...or does it use some average perturbation model?" – uhoh Sep 24 '19 at 18:11
• As far as I understand, it's not "perturbation" in the sense common to nonlinear differential equations, but rather something like average sample error divided by time. – Mefitico Sep 24 '19 at 19:04
• I don't understand why your example equation $$e_m(t)=e_m + \frac{de}{dt} t$$ is not the same as what's shown (for example) in equations 9.2.16 or 9.2.17 in Perturbation Theory and Celestial Mechanics. What is "average sample error"? – uhoh Sep 24 '19 at 23:32
• The example you give is what I would call a perturbation technique "in the sense common to nonlinear differential equations".The equation 9.2.16 in your reference is the complete version of equaiton 7 in this paper by Kozai. In this paper, he "averages" effects by integrating over one period of true anomaly. This allows him to reach equations in page numbered 372 (until equation number 14). So case in point the dedt in the equation I've mentioned is not really a derivative. – Mefitico Sep 25 '19 at 3:00
• That being said I unfortunately never found the original papers by Hujsak and Hoots, and they would give a better answer to your question. I'm just giving you some pieces of context that (hopefully) sheds some light for your curiosity. In the sense used by Kozai, the averaging is done by obtaining a rate (that is noted the same as a derivative for the benefit of confusion) that is given by an integral divided the integration period. For all I understood, the lunar and solar perturbations follow some similar process. – Mefitico Sep 25 '19 at 3:05