Re: SDP4 algorithm (URL needed)

Rainer Kracht (R.Kracht@t-online.de)
Thu, 27 Mar 1997 14:47:01 +1

Rob Matson wrote (1997 Mar 20):


>I've just completed coding and initial debugging of the SDP4 algorithm for
>inclusion in SkyMap.  A word of warning to anyone who used Spacetrack Report
>#3 to code the Deep Space routines -- the code is flawed!  4 variables are
>passed to the deep space routines which the programmer obviously intended to
>retain their values upon subsequent calls.  Trouble is, these variables are
>DUMMY variables within DEEP.  Thus on subsequent calls, the variables will
>have random, unpredictable values.

>I have corrected this problem, and cleaned up the code somewhat to make it
>easier to follow.  I ran the SDP4 test cases from SR3 and the results differed
>slightly from those published.  However, my variables are all
>double-precision, so I would expect differences.  Plus, the test cases are
>very close to epoch, so they're not good tests anyway.  Presumably Space
>Command long ago discovered this problem and fixed their code.

There is one more problem with the code of SDP4.

Predictions with this elset

GEO347
1 99347U          95265.00000000  .00000000  00000-0  00000+0 0    01
2 99347   8.2811 331.8258 1446848 258.4393 117.4767  1.00271834    02

for my site (Elmshorn, +53.7695, +9.6626, 9m) are good for the night
of 1995 Sep 21/22 (that is the time of the epoch) with SGP/SGP4, but
they are about 4 degrees off with SDP4.

I have now found, that this is due to flawed code at the end of the
DEEP routine (DEEP.FOR in Spacetrack Report #3 or Procedure Deep in
SGP4SDP4.PAS from TS Kelso). DEEP.FOR has there:

  220 SINOK=SIN(XNODES)
      COSOK=COS(XNODES)
      ALFDP=SINIS*SINOK
      BETDP=SINIS*COSOK
      DALF=PH*COSOK+PINC*COSIS*SINOK
      DBET=-PH*SINOK+PINC*COSIS*COSOK
      ALFDP=ALFDP+DALF
      BETDP=BETDP+DBET
      XLS = XLL+OMGASM+COSIS*XNODES
      DLS=PL+PGH-PINC*XNODES*SINIS
      XLS=XLS+DLS
      XNODES=ACTAN(ALFDP,BETDP)
      XLL = XLL+PL
      OMGASM = XLS-XLL-COS(XINC)*XNODES

The last six lines can be rewritten as:

OMGASM = OMGASM + PGH - PINC*XNODES*SINIS
OMGASM = OMGASM + COSIS*XNODES - COS(XINC)*ACTAN(ALFDP,BETDP)

With the above elset this evaluates at 1995 Sep 22.0 to:
(with angles in degrees)

OMGASM = OMGASM - 0.26 + 0.01
OMGASM = OMGASM + COS(8.2812)*331.8258 - COS(8.2637)*(-28.1842)
       = OMGASM + 328.3659 + 27.8916
       = OMGASM + 356.2575
       = OMGASM - 3.7425 deg

This causes an error of about 4 deg in the predictions, because
XNODES and ACTAN(ALFDP,BETDP) are taken from different quadrants!

XNODES is derived from the RAAN of the elset (331.8258), which is
in the range of 0 to 360 deg. The ACTAN-function yields angles in
the range of -180 to 180 deg.

If we take both angles from the same quadrant, the change of OMGASM
is COS(8.2812)*(-28.1742) - COS(8.2637)*(-28.1842) = +0.0111 deg!

I have added XNODES=ACTAN(SINOK,COSOK) to DEEP.FOR to force XNODES
to the same quadrant as ACTAN(ALFDP,BETDP). The new code is:

  220 SINOK=SIN(XNODES)
      COSOK=COS(XNODES)
      ALFDP=SINIS*SINOK
      BETDP=SINIS*COSOK
      DALF=PH*COSOK+PINC*COSIS*SINOK
      DBET=-PH*SINOK+PINC*COSIS*COSOK
      ALFDP=ALFDP+DALF
      BETDP=BETDP+DBET
      XNODES=ACTAN(SINOK,COSOK)
      XLS = XLL+OMGASM+COSIS*XNODES
      DLS=PL+PGH-PINC*XNODES*SINIS
      XLS=XLS+DLS
      XNODES=ACTAN(ALFDP,BETDP)
      XLL = XLL+PL
      OMGASM = XLS-XLL-COS(XINC)*XNODES

Predictions for GEO347 are now correct with the modified code.

Rob Matson has pointed out to me that this is only a partial fix,
we have to dig up the original paper(s):

Hujsak, R.S. "A Restricted Four Body Solution for Resonating
Satellites with an Oblate Earth", AIAA Paper No. 79-136, June 1979

and

Hujsak, R.S. and Hoots, F.R., "Deep Space Perturbations Ephemeris
Generation", Aerospace Defense Command Space Computational Center
Program Documentation, DCD 8, Section 3, 82-104, September 1977.


Perhaps someone can provide the URL's of these documents?

 Rainer