• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.12
  • kdeedu
  • marble
  • src
  • plugins
  • render
  • satellites
  • sgp4
sgp4unit.cpp
Go to the documentation of this file.
1 /* ----------------------------------------------------------------
2 *
3 * sgp4unit.cpp
4 *
5 * this file contains the sgp4 procedures for analytical propagation
6 * of a satellite. the code was originally released in the 1980 and 1986
7 * spacetrack papers. a detailed discussion of the theory and history
8 * may be found in the 2006 aiaa paper by vallado, crawford, hujsak,
9 * and kelso.
10 *
11 * companion code for
12 * fundamentals of astrodynamics and applications
13 * 2007
14 * by david vallado
15 *
16 * (w) 719-573-2600, email dvallado@agi.com
17 *
18 * current :
19 * 3 Nov 08 david vallado
20 * put returns in for error codes
21 * changes :
22 * 29 sep 08 david vallado
23 * fix atime for faster operation in dspace
24 * add operationmode for afspc (a) or improved (i)
25 * performance mode
26 * 16 jun 08 david vallado
27 * update small eccentricity check
28 * 16 nov 07 david vallado
29 * misc fixes for better compliance
30 * 20 apr 07 david vallado
31 * misc fixes for constants
32 * 11 aug 06 david vallado
33 * chg lyddane choice back to strn3, constants, misc doc
34 * 15 dec 05 david vallado
35 * misc fixes
36 * 26 jul 05 david vallado
37 * fixes for paper
38 * note that each fix is preceded by a
39 * comment with "sgp4fix" and an explanation of
40 * what was changed
41 * 10 aug 04 david vallado
42 * 2nd printing baseline working
43 * 14 may 01 david vallado
44 * 2nd edition baseline
45 * 80 norad
46 * original baseline
47 * ---------------------------------------------------------------- */
48 
49 #include "sgp4unit.h"
50 
51 const char help = 'n';
52 FILE *dbgfile;
53 #define UNUSED(arg) (void)arg;
54 
55 /* ----------- local functions - only ever used internally by sgp4 ---------- */
56 static void dpper
57  (
58  double e3, double ee2, double peo, double pgho, double pho,
59  double pinco, double plo, double se2, double se3, double sgh2,
60  double sgh3, double sgh4, double sh2, double sh3, double si2,
61  double si3, double sl2, double sl3, double sl4, double t,
62  double xgh2, double xgh3, double xgh4, double xh2, double xh3,
63  double xi2, double xi3, double xl2, double xl3, double xl4,
64  double zmol, double zmos, double inclo,
65  char init,
66  double& ep, double& inclp, double& nodep, double& argpp, double& mp,
67  char opsmode
68  );
69 
70 static void dscom
71  (
72  double epoch, double ep, double argpp, double tc, double inclp,
73  double nodep, double np,
74  double& snodm, double& cnodm, double& sinim, double& cosim, double& sinomm,
75  double& cosomm,double& day, double& e3, double& ee2, double& em,
76  double& emsq, double& gam, double& peo, double& pgho, double& pho,
77  double& pinco, double& plo, double& rtemsq, double& se2, double& se3,
78  double& sgh2, double& sgh3, double& sgh4, double& sh2, double& sh3,
79  double& si2, double& si3, double& sl2, double& sl3, double& sl4,
80  double& s1, double& s2, double& s3, double& s4, double& s5,
81  double& s6, double& s7, double& ss1, double& ss2, double& ss3,
82  double& ss4, double& ss5, double& ss6, double& ss7, double& sz1,
83  double& sz2, double& sz3, double& sz11, double& sz12, double& sz13,
84  double& sz21, double& sz22, double& sz23, double& sz31, double& sz32,
85  double& sz33, double& xgh2, double& xgh3, double& xgh4, double& xh2,
86  double& xh3, double& xi2, double& xi3, double& xl2, double& xl3,
87  double& xl4, double& nm, double& z1, double& z2, double& z3,
88  double& z11, double& z12, double& z13, double& z21, double& z22,
89  double& z23, double& z31, double& z32, double& z33, double& zmol,
90  double& zmos
91  );
92 
93 static void dsinit
94  (
95  gravconsttype whichconst,
96  double cosim, double emsq, double argpo, double s1, double s2,
97  double s3, double s4, double s5, double sinim, double ss1,
98  double ss2, double ss3, double ss4, double ss5, double sz1,
99  double sz3, double sz11, double sz13, double sz21, double sz23,
100  double sz31, double sz33, double t, double tc, double gsto,
101  double mo, double mdot, double no, double nodeo, double nodedot,
102  double xpidot, double z1, double z3, double z11, double z13,
103  double z21, double z23, double z31, double z33, double ecco,
104  double eccsq, double& em, double& argpm, double& inclm, double& mm,
105  double& nm, double& nodem,
106  int& irez,
107  double& atime, double& d2201, double& d2211, double& d3210, double& d3222,
108  double& d4410, double& d4422, double& d5220, double& d5232, double& d5421,
109  double& d5433, double& dedt, double& didt, double& dmdt, double& dndt,
110  double& dnodt, double& domdt, double& del1, double& del2, double& del3,
111  double& xfact, double& xlamo, double& xli, double& xni
112  );
113 
114 static void dspace
115  (
116  int irez,
117  double d2201, double d2211, double d3210, double d3222, double d4410,
118  double d4422, double d5220, double d5232, double d5421, double d5433,
119  double dedt, double del1, double del2, double del3, double didt,
120  double dmdt, double dnodt, double domdt, double argpo, double argpdot,
121  double t, double tc, double gsto, double xfact, double xlamo,
122  double no,
123  double& atime, double& em, double& argpm, double& inclm, double& xli,
124  double& mm, double& xni, double& nodem, double& dndt, double& nm
125  );
126 
127 static void initl
128  (
129  int satn, gravconsttype whichconst,
130  double ecco, double epoch, double inclo, double& no,
131  char& method,
132  double& ainv, double& ao, double& con41, double& con42, double& cosio,
133  double& cosio2,double& eccsq, double& omeosq, double& posq,
134  double& rp, double& rteosq,double& sinio , double& gsto, char opsmode
135  );
136 
137 /* -----------------------------------------------------------------------------
138 *
139 * procedure dpper
140 *
141 * this procedure provides deep space long period periodic contributions
142 * to the mean elements. by design, these periodics are zero at epoch.
143 * this used to be dscom which included initialization, but it's really a
144 * recurring function.
145 *
146 * author : david vallado 719-573-2600 28 jun 2005
147 *
148 * inputs :
149 * e3 -
150 * ee2 -
151 * peo -
152 * pgho -
153 * pho -
154 * pinco -
155 * plo -
156 * se2 , se3 , sgh2, sgh3, sgh4, sh2, sh3, si2, si3, sl2, sl3, sl4 -
157 * t -
158 * xh2, xh3, xi2, xi3, xl2, xl3, xl4 -
159 * zmol -
160 * zmos -
161 * ep - eccentricity 0.0 - 1.0
162 * inclo - inclination - needed for lyddane modification
163 * nodep - right ascension of ascending node
164 * argpp - argument of perigee
165 * mp - mean anomaly
166 *
167 * outputs :
168 * ep - eccentricity 0.0 - 1.0
169 * inclp - inclination
170 * nodep - right ascension of ascending node
171 * argpp - argument of perigee
172 * mp - mean anomaly
173 *
174 * locals :
175 * alfdp -
176 * betdp -
177 * cosip , sinip , cosop , sinop ,
178 * dalf -
179 * dbet -
180 * dls -
181 * f2, f3 -
182 * pe -
183 * pgh -
184 * ph -
185 * pinc -
186 * pl -
187 * sel , ses , sghl , sghs , shl , shs , sil , sinzf , sis ,
188 * sll , sls
189 * xls -
190 * xnoh -
191 * zf -
192 * zm -
193 *
194 * coupling :
195 * none.
196 *
197 * references :
198 * hoots, roehrich, norad spacetrack report #3 1980
199 * hoots, norad spacetrack report #6 1986
200 * hoots, schumacher and glover 2004
201 * vallado, crawford, hujsak, kelso 2006
202  ----------------------------------------------------------------------------*/
203 
204 static void dpper
205  (
206  double e3, double ee2, double peo, double pgho, double pho,
207  double pinco, double plo, double se2, double se3, double sgh2,
208  double sgh3, double sgh4, double sh2, double sh3, double si2,
209  double si3, double sl2, double sl3, double sl4, double t,
210  double xgh2, double xgh3, double xgh4, double xh2, double xh3,
211  double xi2, double xi3, double xl2, double xl3, double xl4,
212  double zmol, double zmos, double inclo,
213  char init,
214  double& ep, double& inclp, double& nodep, double& argpp, double& mp,
215  char opsmode
216  )
217 {
218  UNUSED( inclo );
219  /* --------------------- local variables ------------------------ */
220  const double twopi = 2.0 * M_PI;
221  double alfdp, betdp, cosip, cosop, dalf, dbet, dls,
222  f2, f3, pe, pgh, ph, pinc, pl ,
223  sel, ses, sghl, sghs, shll, shs, sil,
224  sinip, sinop, sinzf, sis, sll, sls, xls,
225  xnoh, zf, zm, zel, zes, znl, zns;
226 
227  /* ---------------------- constants ----------------------------- */
228  zns = 1.19459e-5;
229  zes = 0.01675;
230  znl = 1.5835218e-4;
231  zel = 0.05490;
232 
233  /* --------------- calculate time varying periodics ----------- */
234  zm = zmos + zns * t;
235  // be sure that the initial call has time set to zero
236  if (init == 'y')
237  zm = zmos;
238  zf = zm + 2.0 * zes * sin(zm);
239  sinzf = sin(zf);
240  f2 = 0.5 * sinzf * sinzf - 0.25;
241  f3 = -0.5 * sinzf * cos(zf);
242  ses = se2* f2 + se3 * f3;
243  sis = si2 * f2 + si3 * f3;
244  sls = sl2 * f2 + sl3 * f3 + sl4 * sinzf;
245  sghs = sgh2 * f2 + sgh3 * f3 + sgh4 * sinzf;
246  shs = sh2 * f2 + sh3 * f3;
247  zm = zmol + znl * t;
248  if (init == 'y')
249  zm = zmol;
250  zf = zm + 2.0 * zel * sin(zm);
251  sinzf = sin(zf);
252  f2 = 0.5 * sinzf * sinzf - 0.25;
253  f3 = -0.5 * sinzf * cos(zf);
254  sel = ee2 * f2 + e3 * f3;
255  sil = xi2 * f2 + xi3 * f3;
256  sll = xl2 * f2 + xl3 * f3 + xl4 * sinzf;
257  sghl = xgh2 * f2 + xgh3 * f3 + xgh4 * sinzf;
258  shll = xh2 * f2 + xh3 * f3;
259  pe = ses + sel;
260  pinc = sis + sil;
261  pl = sls + sll;
262  pgh = sghs + sghl;
263  ph = shs + shll;
264 
265  if (init == 'n')
266  {
267  pe = pe - peo;
268  pinc = pinc - pinco;
269  pl = pl - plo;
270  pgh = pgh - pgho;
271  ph = ph - pho;
272  inclp = inclp + pinc;
273  ep = ep + pe;
274  sinip = sin(inclp);
275  cosip = cos(inclp);
276 
277  /* ----------------- apply periodics directly ------------ */
278  // sgp4fix for lyddane choice
279  // strn3 used original inclination - this is technically feasible
280  // gsfc used perturbed inclination - also technically feasible
281  // probably best to readjust the 0.2 limit value and limit discontinuity
282  // 0.2 rad = 11.45916 deg
283  // use next line for original strn3 approach and original inclination
284  // if (inclo >= 0.2)
285  // use next line for gsfc version and perturbed inclination
286  if (inclp >= 0.2)
287  {
288  ph = ph / sinip;
289  pgh = pgh - cosip * ph;
290  argpp = argpp + pgh;
291  nodep = nodep + ph;
292  mp = mp + pl;
293  }
294  else
295  {
296  /* ---- apply periodics with lyddane modification ---- */
297  sinop = sin(nodep);
298  cosop = cos(nodep);
299  alfdp = sinip * sinop;
300  betdp = sinip * cosop;
301  dalf = ph * cosop + pinc * cosip * sinop;
302  dbet = -ph * sinop + pinc * cosip * cosop;
303  alfdp = alfdp + dalf;
304  betdp = betdp + dbet;
305  nodep = fmod(nodep, twopi);
306  // sgp4fix for afspc written intrinsic functions
307  // nodep used without a trigonometric function ahead
308  if ((nodep < 0.0) && (opsmode == 'a')) {
309  nodep = nodep + twopi;
310  }
311  xls = mp + argpp + cosip * nodep;
312  dls = pl + pgh - pinc * nodep * sinip;
313  xls = xls + dls;
314  xnoh = nodep;
315  nodep = atan2(alfdp, betdp);
316  // sgp4fix for afspc written intrinsic functions
317  // nodep used without a trigonometric function ahead
318  if ((nodep < 0.0) && (opsmode == 'a')) {
319  nodep = nodep + twopi;
320  }
321  if (fabs(xnoh - nodep) > M_PI) {
322  if (nodep < xnoh) {
323  nodep = nodep + twopi;
324  }
325  else {
326  nodep = nodep - twopi;
327  }
328  }
329  mp = mp + pl;
330  argpp = xls - mp - cosip * nodep;
331  }
332  } // if init == 'n'
333 
334 //#include "debug1.cpp"
335 } // end dpper
336 
337 /*-----------------------------------------------------------------------------
338 *
339 * procedure dscom
340 *
341 * this procedure provides deep space common items used by both the secular
342 * and periodics subroutines. input is provided as shown. this routine
343 * used to be called dpper, but the functions inside weren't well organized.
344 *
345 * author : david vallado 719-573-2600 28 jun 2005
346 *
347 * inputs :
348 * epoch -
349 * ep - eccentricity
350 * argpp - argument of perigee
351 * tc -
352 * inclp - inclination
353 * nodep - right ascension of ascending node
354 * np - mean motion
355 *
356 * outputs :
357 * sinim , cosim , sinomm , cosomm , snodm , cnodm
358 * day -
359 * e3 -
360 * ee2 -
361 * em - eccentricity
362 * emsq - eccentricity squared
363 * gam -
364 * peo -
365 * pgho -
366 * pho -
367 * pinco -
368 * plo -
369 * rtemsq -
370 * se2, se3 -
371 * sgh2, sgh3, sgh4 -
372 * sh2, sh3, si2, si3, sl2, sl3, sl4 -
373 * s1, s2, s3, s4, s5, s6, s7 -
374 * ss1, ss2, ss3, ss4, ss5, ss6, ss7, sz1, sz2, sz3 -
375 * sz11, sz12, sz13, sz21, sz22, sz23, sz31, sz32, sz33 -
376 * xgh2, xgh3, xgh4, xh2, xh3, xi2, xi3, xl2, xl3, xl4 -
377 * nm - mean motion
378 * z1, z2, z3, z11, z12, z13, z21, z22, z23, z31, z32, z33 -
379 * zmol -
380 * zmos -
381 *
382 * locals :
383 * a1, a2, a3, a4, a5, a6, a7, a8, a9, a10 -
384 * betasq -
385 * cc -
386 * ctem, stem -
387 * x1, x2, x3, x4, x5, x6, x7, x8 -
388 * xnodce -
389 * xnoi -
390 * zcosg , zsing , zcosgl , zsingl , zcosh , zsinh , zcoshl , zsinhl ,
391 * zcosi , zsini , zcosil , zsinil ,
392 * zx -
393 * zy -
394 *
395 * coupling :
396 * none.
397 *
398 * references :
399 * hoots, roehrich, norad spacetrack report #3 1980
400 * hoots, norad spacetrack report #6 1986
401 * hoots, schumacher and glover 2004
402 * vallado, crawford, hujsak, kelso 2006
403  ----------------------------------------------------------------------------*/
404 
405 static void dscom
406  (
407  double epoch, double ep, double argpp, double tc, double inclp,
408  double nodep, double np,
409  double& snodm, double& cnodm, double& sinim, double& cosim, double& sinomm,
410  double& cosomm,double& day, double& e3, double& ee2, double& em,
411  double& emsq, double& gam, double& peo, double& pgho, double& pho,
412  double& pinco, double& plo, double& rtemsq, double& se2, double& se3,
413  double& sgh2, double& sgh3, double& sgh4, double& sh2, double& sh3,
414  double& si2, double& si3, double& sl2, double& sl3, double& sl4,
415  double& s1, double& s2, double& s3, double& s4, double& s5,
416  double& s6, double& s7, double& ss1, double& ss2, double& ss3,
417  double& ss4, double& ss5, double& ss6, double& ss7, double& sz1,
418  double& sz2, double& sz3, double& sz11, double& sz12, double& sz13,
419  double& sz21, double& sz22, double& sz23, double& sz31, double& sz32,
420  double& sz33, double& xgh2, double& xgh3, double& xgh4, double& xh2,
421  double& xh3, double& xi2, double& xi3, double& xl2, double& xl3,
422  double& xl4, double& nm, double& z1, double& z2, double& z3,
423  double& z11, double& z12, double& z13, double& z21, double& z22,
424  double& z23, double& z31, double& z32, double& z33, double& zmol,
425  double& zmos
426  )
427 {
428  /* -------------------------- constants ------------------------- */
429  const double zes = 0.01675;
430  const double zel = 0.05490;
431  const double c1ss = 2.9864797e-6;
432  const double c1l = 4.7968065e-7;
433  const double zsinis = 0.39785416;
434  const double zcosis = 0.91744867;
435  const double zcosgs = 0.1945905;
436  const double zsings = -0.98088458;
437  const double twopi = 2.0 * M_PI;
438 
439  /* --------------------- local variables ------------------------ */
440  int lsflg;
441  double a1 , a2 , a3 , a4 , a5 , a6 , a7 ,
442  a8 , a9 , a10 , betasq, cc , ctem , stem ,
443  x1 , x2 , x3 , x4 , x5 , x6 , x7 ,
444  x8 , xnodce, xnoi , zcosg , zcosgl, zcosh , zcoshl,
445  zcosi , zcosil, zsing , zsingl, zsinh , zsinhl, zsini ,
446  zsinil, zx , zy;
447 
448  nm = np;
449  em = ep;
450  snodm = sin(nodep);
451  cnodm = cos(nodep);
452  sinomm = sin(argpp);
453  cosomm = cos(argpp);
454  sinim = sin(inclp);
455  cosim = cos(inclp);
456  emsq = em * em;
457  betasq = 1.0 - emsq;
458  rtemsq = sqrt(betasq);
459 
460  /* ----------------- initialize lunar solar terms --------------- */
461  peo = 0.0;
462  pinco = 0.0;
463  plo = 0.0;
464  pgho = 0.0;
465  pho = 0.0;
466  day = epoch + 18261.5 + tc / 1440.0;
467  xnodce = fmod(4.5236020 - 9.2422029e-4 * day, twopi);
468  stem = sin(xnodce);
469  ctem = cos(xnodce);
470  zcosil = 0.91375164 - 0.03568096 * ctem;
471  zsinil = sqrt(1.0 - zcosil * zcosil);
472  zsinhl = 0.089683511 * stem / zsinil;
473  zcoshl = sqrt(1.0 - zsinhl * zsinhl);
474  gam = 5.8351514 + 0.0019443680 * day;
475  zx = 0.39785416 * stem / zsinil;
476  zy = zcoshl * ctem + 0.91744867 * zsinhl * stem;
477  zx = atan2(zx, zy);
478  zx = gam + zx - xnodce;
479  zcosgl = cos(zx);
480  zsingl = sin(zx);
481 
482  /* ------------------------- do solar terms --------------------- */
483  zcosg = zcosgs;
484  zsing = zsings;
485  zcosi = zcosis;
486  zsini = zsinis;
487  zcosh = cnodm;
488  zsinh = snodm;
489  cc = c1ss;
490  xnoi = 1.0 / nm;
491 
492  for (lsflg = 1; lsflg <= 2; lsflg++)
493  {
494  a1 = zcosg * zcosh + zsing * zcosi * zsinh;
495  a3 = -zsing * zcosh + zcosg * zcosi * zsinh;
496  a7 = -zcosg * zsinh + zsing * zcosi * zcosh;
497  a8 = zsing * zsini;
498  a9 = zsing * zsinh + zcosg * zcosi * zcosh;
499  a10 = zcosg * zsini;
500  a2 = cosim * a7 + sinim * a8;
501  a4 = cosim * a9 + sinim * a10;
502  a5 = -sinim * a7 + cosim * a8;
503  a6 = -sinim * a9 + cosim * a10;
504 
505  x1 = a1 * cosomm + a2 * sinomm;
506  x2 = a3 * cosomm + a4 * sinomm;
507  x3 = -a1 * sinomm + a2 * cosomm;
508  x4 = -a3 * sinomm + a4 * cosomm;
509  x5 = a5 * sinomm;
510  x6 = a6 * sinomm;
511  x7 = a5 * cosomm;
512  x8 = a6 * cosomm;
513 
514  z31 = 12.0 * x1 * x1 - 3.0 * x3 * x3;
515  z32 = 24.0 * x1 * x2 - 6.0 * x3 * x4;
516  z33 = 12.0 * x2 * x2 - 3.0 * x4 * x4;
517  z1 = 3.0 * (a1 * a1 + a2 * a2) + z31 * emsq;
518  z2 = 6.0 * (a1 * a3 + a2 * a4) + z32 * emsq;
519  z3 = 3.0 * (a3 * a3 + a4 * a4) + z33 * emsq;
520  z11 = -6.0 * a1 * a5 + emsq * (-24.0 * x1 * x7-6.0 * x3 * x5);
521  z12 = -6.0 * (a1 * a6 + a3 * a5) + emsq *
522  (-24.0 * (x2 * x7 + x1 * x8) - 6.0 * (x3 * x6 + x4 * x5));
523  z13 = -6.0 * a3 * a6 + emsq * (-24.0 * x2 * x8 - 6.0 * x4 * x6);
524  z21 = 6.0 * a2 * a5 + emsq * (24.0 * x1 * x5 - 6.0 * x3 * x7);
525  z22 = 6.0 * (a4 * a5 + a2 * a6) + emsq *
526  (24.0 * (x2 * x5 + x1 * x6) - 6.0 * (x4 * x7 + x3 * x8));
527  z23 = 6.0 * a4 * a6 + emsq * (24.0 * x2 * x6 - 6.0 * x4 * x8);
528  z1 = z1 + z1 + betasq * z31;
529  z2 = z2 + z2 + betasq * z32;
530  z3 = z3 + z3 + betasq * z33;
531  s3 = cc * xnoi;
532  s2 = -0.5 * s3 / rtemsq;
533  s4 = s3 * rtemsq;
534  s1 = -15.0 * em * s4;
535  s5 = x1 * x3 + x2 * x4;
536  s6 = x2 * x3 + x1 * x4;
537  s7 = x2 * x4 - x1 * x3;
538 
539  /* ----------------------- do lunar terms ------------------- */
540  if (lsflg == 1)
541  {
542  ss1 = s1;
543  ss2 = s2;
544  ss3 = s3;
545  ss4 = s4;
546  ss5 = s5;
547  ss6 = s6;
548  ss7 = s7;
549  sz1 = z1;
550  sz2 = z2;
551  sz3 = z3;
552  sz11 = z11;
553  sz12 = z12;
554  sz13 = z13;
555  sz21 = z21;
556  sz22 = z22;
557  sz23 = z23;
558  sz31 = z31;
559  sz32 = z32;
560  sz33 = z33;
561  zcosg = zcosgl;
562  zsing = zsingl;
563  zcosi = zcosil;
564  zsini = zsinil;
565  zcosh = zcoshl * cnodm + zsinhl * snodm;
566  zsinh = snodm * zcoshl - cnodm * zsinhl;
567  cc = c1l;
568  }
569  }
570 
571  zmol = fmod(4.7199672 + 0.22997150 * day - gam, twopi);
572  zmos = fmod(6.2565837 + 0.017201977 * day, twopi);
573 
574  /* ------------------------ do solar terms ---------------------- */
575  se2 = 2.0 * ss1 * ss6;
576  se3 = 2.0 * ss1 * ss7;
577  si2 = 2.0 * ss2 * sz12;
578  si3 = 2.0 * ss2 * (sz13 - sz11);
579  sl2 = -2.0 * ss3 * sz2;
580  sl3 = -2.0 * ss3 * (sz3 - sz1);
581  sl4 = -2.0 * ss3 * (-21.0 - 9.0 * emsq) * zes;
582  sgh2 = 2.0 * ss4 * sz32;
583  sgh3 = 2.0 * ss4 * (sz33 - sz31);
584  sgh4 = -18.0 * ss4 * zes;
585  sh2 = -2.0 * ss2 * sz22;
586  sh3 = -2.0 * ss2 * (sz23 - sz21);
587 
588  /* ------------------------ do lunar terms ---------------------- */
589  ee2 = 2.0 * s1 * s6;
590  e3 = 2.0 * s1 * s7;
591  xi2 = 2.0 * s2 * z12;
592  xi3 = 2.0 * s2 * (z13 - z11);
593  xl2 = -2.0 * s3 * z2;
594  xl3 = -2.0 * s3 * (z3 - z1);
595  xl4 = -2.0 * s3 * (-21.0 - 9.0 * emsq) * zel;
596  xgh2 = 2.0 * s4 * z32;
597  xgh3 = 2.0 * s4 * (z33 - z31);
598  xgh4 = -18.0 * s4 * zel;
599  xh2 = -2.0 * s2 * z22;
600  xh3 = -2.0 * s2 * (z23 - z21);
601 
602 //#include "debug2.cpp"
603 } // end dscom
604 
605 /*-----------------------------------------------------------------------------
606 *
607 * procedure dsinit
608 *
609 * this procedure provides deep space contributions to mean motion dot due
610 * to geopotential resonance with half day and one day orbits.
611 *
612 * author : david vallado 719-573-2600 28 jun 2005
613 *
614 * inputs :
615 * cosim, sinim-
616 * emsq - eccentricity squared
617 * argpo - argument of perigee
618 * s1, s2, s3, s4, s5 -
619 * ss1, ss2, ss3, ss4, ss5 -
620 * sz1, sz3, sz11, sz13, sz21, sz23, sz31, sz33 -
621 * t - time
622 * tc -
623 * gsto - greenwich sidereal time rad
624 * mo - mean anomaly
625 * mdot - mean anomaly dot (rate)
626 * no - mean motion
627 * nodeo - right ascension of ascending node
628 * nodedot - right ascension of ascending node dot (rate)
629 * xpidot -
630 * z1, z3, z11, z13, z21, z23, z31, z33 -
631 * eccm - eccentricity
632 * argpm - argument of perigee
633 * inclm - inclination
634 * mm - mean anomaly
635 * xn - mean motion
636 * nodem - right ascension of ascending node
637 *
638 * outputs :
639 * em - eccentricity
640 * argpm - argument of perigee
641 * inclm - inclination
642 * mm - mean anomaly
643 * nm - mean motion
644 * nodem - right ascension of ascending node
645 * irez - flag for resonance 0-none, 1-one day, 2-half day
646 * atime -
647 * d2201, d2211, d3210, d3222, d4410, d4422, d5220, d5232, d5421, d5433 -
648 * dedt -
649 * didt -
650 * dmdt -
651 * dndt -
652 * dnodt -
653 * domdt -
654 * del1, del2, del3 -
655 * ses , sghl , sghs , sgs , shl , shs , sis , sls
656 * theta -
657 * xfact -
658 * xlamo -
659 * xli -
660 * xni
661 *
662 * locals :
663 * ainv2 -
664 * aonv -
665 * cosisq -
666 * eoc -
667 * f220, f221, f311, f321, f322, f330, f441, f442, f522, f523, f542, f543 -
668 * g200, g201, g211, g300, g310, g322, g410, g422, g520, g521, g532, g533 -
669 * sini2 -
670 * temp -
671 * temp1 -
672 * theta -
673 * xno2 -
674 *
675 * coupling :
676 * getgravconst
677 *
678 * references :
679 * hoots, roehrich, norad spacetrack report #3 1980
680 * hoots, norad spacetrack report #6 1986
681 * hoots, schumacher and glover 2004
682 * vallado, crawford, hujsak, kelso 2006
683  ----------------------------------------------------------------------------*/
684 
685 static void dsinit
686  (
687  gravconsttype whichconst,
688  double cosim, double emsq, double argpo, double s1, double s2,
689  double s3, double s4, double s5, double sinim, double ss1,
690  double ss2, double ss3, double ss4, double ss5, double sz1,
691  double sz3, double sz11, double sz13, double sz21, double sz23,
692  double sz31, double sz33, double t, double tc, double gsto,
693  double mo, double mdot, double no, double nodeo, double nodedot,
694  double xpidot, double z1, double z3, double z11, double z13,
695  double z21, double z23, double z31, double z33, double ecco,
696  double eccsq, double& em, double& argpm, double& inclm, double& mm,
697  double& nm, double& nodem,
698  int& irez,
699  double& atime, double& d2201, double& d2211, double& d3210, double& d3222,
700  double& d4410, double& d4422, double& d5220, double& d5232, double& d5421,
701  double& d5433, double& dedt, double& didt, double& dmdt, double& dndt,
702  double& dnodt, double& domdt, double& del1, double& del2, double& del3,
703  double& xfact, double& xlamo, double& xli, double& xni
704  )
705 {
706  /* --------------------- local variables ------------------------ */
707  const double twopi = 2.0 * M_PI;
708 
709  double ainv2 , aonv=0.0, cosisq, eoc, f220 , f221 , f311 ,
710  f321 , f322 , f330 , f441 , f442 , f522 , f523 ,
711  f542 , f543 , g200 , g201 , g211 , g300 , g310 ,
712  g322 , g410 , g422 , g520 , g521 , g532 , g533 ,
713  ses , sgs , sghl , sghs , shs , shll , sis ,
714  sini2 , sls , temp , temp1 , theta , xno2 , q22 ,
715  q31 , q33 , root22, root44, root54, rptim , root32,
716  root52, x2o3 , xke , znl , emo , zns , emsqo,
717  tumin, mu, radiusearthkm, j2, j3, j4, j3oj2;
718 
719  q22 = 1.7891679e-6;
720  q31 = 2.1460748e-6;
721  q33 = 2.2123015e-7;
722  root22 = 1.7891679e-6;
723  root44 = 7.3636953e-9;
724  root54 = 2.1765803e-9;
725  rptim = 4.37526908801129966e-3; // this equates to 7.29211514668855e-5 rad/sec
726  root32 = 3.7393792e-7;
727  root52 = 1.1428639e-7;
728  x2o3 = 2.0 / 3.0;
729  znl = 1.5835218e-4;
730  zns = 1.19459e-5;
731 
732  // sgp4fix identify constants and allow alternate values
733  getgravconst( whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2 );
734 
735  /* -------------------- deep space initialization ------------ */
736  irez = 0;
737  if ((nm < 0.0052359877) && (nm > 0.0034906585))
738  irez = 1;
739  if ((nm >= 8.26e-3) && (nm <= 9.24e-3) && (em >= 0.5))
740  irez = 2;
741 
742  /* ------------------------ do solar terms ------------------- */
743  ses = ss1 * zns * ss5;
744  sis = ss2 * zns * (sz11 + sz13);
745  sls = -zns * ss3 * (sz1 + sz3 - 14.0 - 6.0 * emsq);
746  sghs = ss4 * zns * (sz31 + sz33 - 6.0);
747  shs = -zns * ss2 * (sz21 + sz23);
748  // sgp4fix for 180 deg incl
749  if ((inclm < 5.2359877e-2) || (inclm > M_PI - 5.2359877e-2))
750  shs = 0.0;
751  if (sinim != 0.0)
752  shs = shs / sinim;
753  sgs = sghs - cosim * shs;
754 
755  /* ------------------------- do lunar terms ------------------ */
756  dedt = ses + s1 * znl * s5;
757  didt = sis + s2 * znl * (z11 + z13);
758  dmdt = sls - znl * s3 * (z1 + z3 - 14.0 - 6.0 * emsq);
759  sghl = s4 * znl * (z31 + z33 - 6.0);
760  shll = -znl * s2 * (z21 + z23);
761  // sgp4fix for 180 deg incl
762  if ((inclm < 5.2359877e-2) || (inclm > M_PI - 5.2359877e-2))
763  shll = 0.0;
764  domdt = sgs + sghl;
765  dnodt = shs;
766  if (sinim != 0.0)
767  {
768  domdt = domdt - cosim / sinim * shll;
769  dnodt = dnodt + shll / sinim;
770  }
771 
772  /* ----------- calculate deep space resonance effects -------- */
773  dndt = 0.0;
774  theta = fmod(gsto + tc * rptim, twopi);
775  em = em + dedt * t;
776  inclm = inclm + didt * t;
777  argpm = argpm + domdt * t;
778  nodem = nodem + dnodt * t;
779  mm = mm + dmdt * t;
780  // sgp4fix for negative inclinations
781  // the following if statement should be commented out
782  //if (inclm < 0.0)
783  // {
784  // inclm = -inclm;
785  // argpm = argpm - pi;
786  // nodem = nodem + pi;
787  // }
788 
789  /* -------------- initialize the resonance terms ------------- */
790  if (irez != 0)
791  {
792  aonv = pow(nm / xke, x2o3);
793 
794  /* ---------- geopotential resonance for 12 hour orbits ------ */
795  if (irez == 2)
796  {
797  cosisq = cosim * cosim;
798  emo = em;
799  em = ecco;
800  emsqo = emsq;
801  emsq = eccsq;
802  eoc = em * emsq;
803  g201 = -0.306 - (em - 0.64) * 0.440;
804 
805  if (em <= 0.65)
806  {
807  g211 = 3.616 - 13.2470 * em + 16.2900 * emsq;
808  g310 = -19.302 + 117.3900 * em - 228.4190 * emsq + 156.5910 * eoc;
809  g322 = -18.9068 + 109.7927 * em - 214.6334 * emsq + 146.5816 * eoc;
810  g410 = -41.122 + 242.6940 * em - 471.0940 * emsq + 313.9530 * eoc;
811  g422 = -146.407 + 841.8800 * em - 1629.014 * emsq + 1083.4350 * eoc;
812  g520 = -532.114 + 3017.977 * em - 5740.032 * emsq + 3708.2760 * eoc;
813  }
814  else
815  {
816  g211 = -72.099 + 331.819 * em - 508.738 * emsq + 266.724 * eoc;
817  g310 = -346.844 + 1582.851 * em - 2415.925 * emsq + 1246.113 * eoc;
818  g322 = -342.585 + 1554.908 * em - 2366.899 * emsq + 1215.972 * eoc;
819  g410 = -1052.797 + 4758.686 * em - 7193.992 * emsq + 3651.957 * eoc;
820  g422 = -3581.690 + 16178.110 * em - 24462.770 * emsq + 12422.520 * eoc;
821  if (em > 0.715)
822  g520 =-5149.66 + 29936.92 * em - 54087.36 * emsq + 31324.56 * eoc;
823  else
824  g520 = 1464.74 - 4664.75 * em + 3763.64 * emsq;
825  }
826  if (em < 0.7)
827  {
828  g533 = -919.22770 + 4988.6100 * em - 9064.7700 * emsq + 5542.21 * eoc;
829  g521 = -822.71072 + 4568.6173 * em - 8491.4146 * emsq + 5337.524 * eoc;
830  g532 = -853.66600 + 4690.2500 * em - 8624.7700 * emsq + 5341.4 * eoc;
831  }
832  else
833  {
834  g533 =-37995.780 + 161616.52 * em - 229838.20 * emsq + 109377.94 * eoc;
835  g521 =-51752.104 + 218913.95 * em - 309468.16 * emsq + 146349.42 * eoc;
836  g532 =-40023.880 + 170470.89 * em - 242699.48 * emsq + 115605.82 * eoc;
837  }
838 
839  sini2= sinim * sinim;
840  f220 = 0.75 * (1.0 + 2.0 * cosim+cosisq);
841  f221 = 1.5 * sini2;
842  f321 = 1.875 * sinim * (1.0 - 2.0 * cosim - 3.0 * cosisq);
843  f322 = -1.875 * sinim * (1.0 + 2.0 * cosim - 3.0 * cosisq);
844  f441 = 35.0 * sini2 * f220;
845  f442 = 39.3750 * sini2 * sini2;
846  f522 = 9.84375 * sinim * (sini2 * (1.0 - 2.0 * cosim- 5.0 * cosisq) +
847  0.33333333 * (-2.0 + 4.0 * cosim + 6.0 * cosisq) );
848  f523 = sinim * (4.92187512 * sini2 * (-2.0 - 4.0 * cosim +
849  10.0 * cosisq) + 6.56250012 * (1.0+2.0 * cosim - 3.0 * cosisq));
850  f542 = 29.53125 * sinim * (2.0 - 8.0 * cosim+cosisq *
851  (-12.0 + 8.0 * cosim + 10.0 * cosisq));
852  f543 = 29.53125 * sinim * (-2.0 - 8.0 * cosim+cosisq *
853  (12.0 + 8.0 * cosim - 10.0 * cosisq));
854  xno2 = nm * nm;
855  ainv2 = aonv * aonv;
856  temp1 = 3.0 * xno2 * ainv2;
857  temp = temp1 * root22;
858  d2201 = temp * f220 * g201;
859  d2211 = temp * f221 * g211;
860  temp1 = temp1 * aonv;
861  temp = temp1 * root32;
862  d3210 = temp * f321 * g310;
863  d3222 = temp * f322 * g322;
864  temp1 = temp1 * aonv;
865  temp = 2.0 * temp1 * root44;
866  d4410 = temp * f441 * g410;
867  d4422 = temp * f442 * g422;
868  temp1 = temp1 * aonv;
869  temp = temp1 * root52;
870  d5220 = temp * f522 * g520;
871  d5232 = temp * f523 * g532;
872  temp = 2.0 * temp1 * root54;
873  d5421 = temp * f542 * g521;
874  d5433 = temp * f543 * g533;
875  xlamo = fmod(mo + nodeo + nodeo-theta - theta, twopi);
876  xfact = mdot + dmdt + 2.0 * (nodedot + dnodt - rptim) - no;
877  em = emo;
878  emsq = emsqo;
879  }
880 
881  /* ---------------- synchronous resonance terms -------------- */
882  if (irez == 1)
883  {
884  g200 = 1.0 + emsq * (-2.5 + 0.8125 * emsq);
885  g310 = 1.0 + 2.0 * emsq;
886  g300 = 1.0 + emsq * (-6.0 + 6.60937 * emsq);
887  f220 = 0.75 * (1.0 + cosim) * (1.0 + cosim);
888  f311 = 0.9375 * sinim * sinim * (1.0 + 3.0 * cosim) - 0.75 * (1.0 + cosim);
889  f330 = 1.0 + cosim;
890  f330 = 1.875 * f330 * f330 * f330;
891  del1 = 3.0 * nm * nm * aonv * aonv;
892  del2 = 2.0 * del1 * f220 * g200 * q22;
893  del3 = 3.0 * del1 * f330 * g300 * q33 * aonv;
894  del1 = del1 * f311 * g310 * q31 * aonv;
895  xlamo = fmod(mo + nodeo + argpo - theta, twopi);
896  xfact = mdot + xpidot - rptim + dmdt + domdt + dnodt - no;
897  }
898 
899  /* ------------ for sgp4, initialize the integrator ---------- */
900  xli = xlamo;
901  xni = no;
902  atime = 0.0;
903  nm = no + dndt;
904  }
905 
906 //#include "debug3.cpp"
907 } // end dsinit
908 
909 /*-----------------------------------------------------------------------------
910 *
911 * procedure dspace
912 *
913 * this procedure provides deep space contributions to mean elements for
914 * perturbing third body. these effects have been averaged over one
915 * revolution of the sun and moon. for earth resonance effects, the
916 * effects have been averaged over no revolutions of the satellite.
917 * (mean motion)
918 *
919 * author : david vallado 719-573-2600 28 jun 2005
920 *
921 * inputs :
922 * d2201, d2211, d3210, d3222, d4410, d4422, d5220, d5232, d5421, d5433 -
923 * dedt -
924 * del1, del2, del3 -
925 * didt -
926 * dmdt -
927 * dnodt -
928 * domdt -
929 * irez - flag for resonance 0-none, 1-one day, 2-half day
930 * argpo - argument of perigee
931 * argpdot - argument of perigee dot (rate)
932 * t - time
933 * tc -
934 * gsto - gst
935 * xfact -
936 * xlamo -
937 * no - mean motion
938 * atime -
939 * em - eccentricity
940 * ft -
941 * argpm - argument of perigee
942 * inclm - inclination
943 * xli -
944 * mm - mean anomaly
945 * xni - mean motion
946 * nodem - right ascension of ascending node
947 *
948 * outputs :
949 * atime -
950 * em - eccentricity
951 * argpm - argument of perigee
952 * inclm - inclination
953 * xli -
954 * mm - mean anomaly
955 * xni -
956 * nodem - right ascension of ascending node
957 * dndt -
958 * nm - mean motion
959 *
960 * locals :
961 * delt -
962 * ft -
963 * theta -
964 * x2li -
965 * x2omi -
966 * xl -
967 * xldot -
968 * xnddt -
969 * xndt -
970 * xomi -
971 *
972 * coupling :
973 * none -
974 *
975 * references :
976 * hoots, roehrich, norad spacetrack report #3 1980
977 * hoots, norad spacetrack report #6 1986
978 * hoots, schumacher and glover 2004
979 * vallado, crawford, hujsak, kelso 2006
980  ----------------------------------------------------------------------------*/
981 
982 static void dspace
983  (
984  int irez,
985  double d2201, double d2211, double d3210, double d3222, double d4410,
986  double d4422, double d5220, double d5232, double d5421, double d5433,
987  double dedt, double del1, double del2, double del3, double didt,
988  double dmdt, double dnodt, double domdt, double argpo, double argpdot,
989  double t, double tc, double gsto, double xfact, double xlamo,
990  double no,
991  double& atime, double& em, double& argpm, double& inclm, double& xli,
992  double& mm, double& xni, double& nodem, double& dndt, double& nm
993  )
994 {
995  const double twopi = 2.0 * M_PI;
996  int iretn;
997  double delt, ft, theta, x2li, x2omi, xl, xldot , xnddt, xndt, xomi, g22, g32,
998  g44, g52, g54, fasx2, fasx4, fasx6, rptim , step2, stepn , stepp;
999 
1000  fasx2 = 0.13130908;
1001  fasx4 = 2.8843198;
1002  fasx6 = 0.37448087;
1003  g22 = 5.7686396;
1004  g32 = 0.95240898;
1005  g44 = 1.8014998;
1006  g52 = 1.0508330;
1007  g54 = 4.4108898;
1008  rptim = 4.37526908801129966e-3; // this equates to 7.29211514668855e-5 rad/sec
1009  stepp = 720.0;
1010  stepn = -720.0;
1011  step2 = 259200.0;
1012 
1013  /* ----------- calculate deep space resonance effects ----------- */
1014  dndt = 0.0;
1015  theta = fmod(gsto + tc * rptim, twopi);
1016  em = em + dedt * t;
1017 
1018  inclm = inclm + didt * t;
1019  argpm = argpm + domdt * t;
1020  nodem = nodem + dnodt * t;
1021  mm = mm + dmdt * t;
1022 
1023  // sgp4fix for negative inclinations
1024  // the following if statement should be commented out
1025  // if (inclm < 0.0)
1026  // {
1027  // inclm = -inclm;
1028  // argpm = argpm - pi;
1029  // nodem = nodem + pi;
1030  // }
1031 
1032  /* - update resonances : numerical (euler-maclaurin) integration - */
1033  /* ------------------------- epoch restart ---------------------- */
1034  // sgp4fix for propagator problems
1035  // the following integration works for negative time steps and periods
1036  // the specific changes are unknown because the original code was so convoluted
1037 
1038  // sgp4fix take out atime = 0.0 and fix for faster operation
1039  ft = 0.0;
1040  if (irez != 0)
1041  {
1042  // sgp4fix streamline check
1043  if ((atime == 0.0) || (t * atime <= 0.0) || (fabs(t) < fabs(atime)) )
1044  {
1045  atime = 0.0;
1046  xni = no;
1047  xli = xlamo;
1048  }
1049  // sgp4fix move check outside loop
1050  if (t > 0.0)
1051  delt = stepp;
1052  else
1053  delt = stepn;
1054 
1055  iretn = 381; // added for do loop
1056  while (iretn == 381)
1057  {
1058  /* ------------------- dot terms calculated ------------- */
1059  /* ----------- near - synchronous resonance terms ------- */
1060  if (irez != 2)
1061  {
1062  xndt = del1 * sin(xli - fasx2) + del2 * sin(2.0 * (xli - fasx4)) +
1063  del3 * sin(3.0 * (xli - fasx6));
1064  xldot = xni + xfact;
1065  xnddt = del1 * cos(xli - fasx2) +
1066  2.0 * del2 * cos(2.0 * (xli - fasx4)) +
1067  3.0 * del3 * cos(3.0 * (xli - fasx6));
1068  xnddt = xnddt * xldot;
1069  }
1070  else
1071  {
1072  /* --------- near - half-day resonance terms -------- */
1073  xomi = argpo + argpdot * atime;
1074  x2omi = xomi + xomi;
1075  x2li = xli + xli;
1076  xndt = d2201 * sin(x2omi + xli - g22) + d2211 * sin(xli - g22) +
1077  d3210 * sin(xomi + xli - g32) + d3222 * sin(-xomi + xli - g32)+
1078  d4410 * sin(x2omi + x2li - g44)+ d4422 * sin(x2li - g44) +
1079  d5220 * sin(xomi + xli - g52) + d5232 * sin(-xomi + xli - g52)+
1080  d5421 * sin(xomi + x2li - g54) + d5433 * sin(-xomi + x2li - g54);
1081  xldot = xni + xfact;
1082  xnddt = d2201 * cos(x2omi + xli - g22) + d2211 * cos(xli - g22) +
1083  d3210 * cos(xomi + xli - g32) + d3222 * cos(-xomi + xli - g32) +
1084  d5220 * cos(xomi + xli - g52) + d5232 * cos(-xomi + xli - g52) +
1085  2.0 * (d4410 * cos(x2omi + x2li - g44) +
1086  d4422 * cos(x2li - g44) + d5421 * cos(xomi + x2li - g54) +
1087  d5433 * cos(-xomi + x2li - g54));
1088  xnddt = xnddt * xldot;
1089  }
1090 
1091  /* ----------------------- integrator ------------------- */
1092  // sgp4fix move end checks to end of routine
1093  if (fabs(t - atime) >= stepp)
1094  {
1095  iretn = 381;
1096  }
1097  else // exit here
1098  {
1099  ft = t - atime;
1100  iretn = 0;
1101  }
1102 
1103  if (iretn == 381)
1104  {
1105  xli = xli + xldot * delt + xndt * step2;
1106  xni = xni + xndt * delt + xnddt * step2;
1107  atime = atime + delt;
1108  }
1109  } // while iretn = 381
1110 
1111  nm = xni + xndt * ft + xnddt * ft * ft * 0.5;
1112  xl = xli + xldot * ft + xndt * ft * ft * 0.5;
1113  if (irez != 1)
1114  {
1115  mm = xl - 2.0 * nodem + 2.0 * theta;
1116  dndt = nm - no;
1117  }
1118  else
1119  {
1120  mm = xl - nodem - argpm + theta;
1121  dndt = nm - no;
1122  }
1123  nm = no + dndt;
1124  }
1125 
1126 //#include "debug4.cpp"
1127 } // end dsspace
1128 
1129 /*-----------------------------------------------------------------------------
1130 *
1131 * procedure initl
1132 *
1133 * this procedure initializes the spg4 propagator. all the initialization is
1134 * consolidated here instead of having multiple loops inside other routines.
1135 *
1136 * author : david vallado 719-573-2600 28 jun 2005
1137 *
1138 * inputs :
1139 * ecco - eccentricity 0.0 - 1.0
1140 * epoch - epoch time in days from jan 0, 1950. 0 hr
1141 * inclo - inclination of satellite
1142 * no - mean motion of satellite
1143 * satn - satellite number
1144 *
1145 * outputs :
1146 * ainv - 1.0 / a
1147 * ao - semi major axis
1148 * con41 -
1149 * con42 - 1.0 - 5.0 cos(i)
1150 * cosio - cosine of inclination
1151 * cosio2 - cosio squared
1152 * eccsq - eccentricity squared
1153 * method - flag for deep space 'd', 'n'
1154 * omeosq - 1.0 - ecco * ecco
1155 * posq - semi-parameter squared
1156 * rp - radius of perigee
1157 * rteosq - square root of (1.0 - ecco*ecco)
1158 * sinio - sine of inclination
1159 * gsto - gst at time of observation rad
1160 * no - mean motion of satellite
1161 *
1162 * locals :
1163 * ak -
1164 * d1 -
1165 * del -
1166 * adel -
1167 * po -
1168 *
1169 * coupling :
1170 * getgravconst
1171 * gstime - find greenwich sidereal time from the julian date
1172 *
1173 * references :
1174 * hoots, roehrich, norad spacetrack report #3 1980
1175 * hoots, norad spacetrack report #6 1986
1176 * hoots, schumacher and glover 2004
1177 * vallado, crawford, hujsak, kelso 2006
1178  ----------------------------------------------------------------------------*/
1179 
1180 static void initl
1181  (
1182  int satn, gravconsttype whichconst,
1183  double ecco, double epoch, double inclo, double& no,
1184  char& method,
1185  double& ainv, double& ao, double& con41, double& con42, double& cosio,
1186  double& cosio2,double& eccsq, double& omeosq, double& posq,
1187  double& rp, double& rteosq,double& sinio , double& gsto,
1188  char opsmode
1189  )
1190 {
1191  UNUSED( satn );
1192  /* --------------------- local variables ------------------------ */
1193  double ak, d1, del, adel, po, x2o3, j2, xke,
1194  tumin, mu, radiusearthkm, j3, j4, j3oj2;
1195 
1196  // sgp4fix use old way of finding gst
1197  double ds70;
1198  double ts70, tfrac, c1, thgr70, fk5r, c1p2p;
1199  const double twopi = 2.0 * M_PI;
1200 
1201  /* ----------------------- earth constants ---------------------- */
1202  // sgp4fix identify constants and allow alternate values
1203  getgravconst( whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2 );
1204  x2o3 = 2.0 / 3.0;
1205 
1206  /* ------------- calculate auxillary epoch quantities ---------- */
1207  eccsq = ecco * ecco;
1208  omeosq = 1.0 - eccsq;
1209  rteosq = sqrt(omeosq);
1210  cosio = cos(inclo);
1211  cosio2 = cosio * cosio;
1212 
1213  /* ------------------ un-kozai the mean motion ----------------- */
1214  ak = pow(xke / no, x2o3);
1215  d1 = 0.75 * j2 * (3.0 * cosio2 - 1.0) / (rteosq * omeosq);
1216  del = d1 / (ak * ak);
1217  adel = ak * (1.0 - del * del - del *
1218  (1.0 / 3.0 + 134.0 * del * del / 81.0));
1219  del = d1/(adel * adel);
1220  no = no / (1.0 + del);
1221 
1222  ao = pow(xke / no, x2o3);
1223  sinio = sin(inclo);
1224  po = ao * omeosq;
1225  con42 = 1.0 - 5.0 * cosio2;
1226  con41 = -con42-cosio2-cosio2;
1227  ainv = 1.0 / ao;
1228  posq = po * po;
1229  rp = ao * (1.0 - ecco);
1230  method = 'n';
1231 
1232  // sgp4fix modern approach to finding sidereal time
1233  if (opsmode == 'a')
1234  {
1235  // sgp4fix use old way of finding gst
1236  // count integer number of days from 0 jan 1970
1237  ts70 = epoch - 7305.0;
1238  ds70 = floor(ts70 + 1.0e-8);
1239  tfrac = ts70 - ds70;
1240  // find greenwich location at epoch
1241  c1 = 1.72027916940703639e-2;
1242  thgr70= 1.7321343856509374;
1243  fk5r = 5.07551419432269442e-15;
1244  c1p2p = c1 + twopi;
1245  gsto = fmod( thgr70 + c1*ds70 + c1p2p*tfrac + ts70*ts70*fk5r, twopi);
1246  if ( gsto < 0.0 )
1247  gsto = gsto + twopi;
1248  }
1249  else
1250  gsto = gstime(epoch + 2433281.5);
1251 
1252 
1253 //#include "debug5.cpp"
1254 } // end initl
1255 
1256 /*-----------------------------------------------------------------------------
1257 *
1258 * procedure sgp4init
1259 *
1260 * this procedure initializes variables for sgp4.
1261 *
1262 * author : david vallado 719-573-2600 28 jun 2005
1263 *
1264 * inputs :
1265 * opsmode - mode of operation afspc or improved 'a', 'i'
1266 * whichconst - which set of constants to use 72, 84
1267 * satn - satellite number
1268 * bstar - sgp4 type drag coefficient kg/m2er
1269 * ecco - eccentricity
1270 * epoch - epoch time in days from jan 0, 1950. 0 hr
1271 * argpo - argument of perigee (output if ds)
1272 * inclo - inclination
1273 * mo - mean anomaly (output if ds)
1274 * no - mean motion
1275 * nodeo - right ascension of ascending node
1276 *
1277 * outputs :
1278 * satrec - common values for subsequent calls
1279 * return code - non-zero on error.
1280 * 1 - mean elements, ecc >= 1.0 or ecc < -0.001 or a < 0.95 er
1281 * 2 - mean motion less than 0.0
1282 * 3 - pert elements, ecc < 0.0 or ecc > 1.0
1283 * 4 - semi-latus rectum < 0.0
1284 * 5 - epoch elements are sub-orbital
1285 * 6 - satellite has decayed
1286 *
1287 * locals :
1288 * cnodm , snodm , cosim , sinim , cosomm , sinomm
1289 * cc1sq , cc2 , cc3
1290 * coef , coef1
1291 * cosio4 -
1292 * day -
1293 * dndt -
1294 * em - eccentricity
1295 * emsq - eccentricity squared
1296 * eeta -
1297 * etasq -
1298 * gam -
1299 * argpm - argument of perigee
1300 * nodem -
1301 * inclm - inclination
1302 * mm - mean anomaly
1303 * nm - mean motion
1304 * perige - perigee
1305 * pinvsq -
1306 * psisq -
1307 * qzms24 -
1308 * rtemsq -
1309 * s1, s2, s3, s4, s5, s6, s7 -
1310 * sfour -
1311 * ss1, ss2, ss3, ss4, ss5, ss6, ss7 -
1312 * sz1, sz2, sz3
1313 * sz11, sz12, sz13, sz21, sz22, sz23, sz31, sz32, sz33 -
1314 * tc -
1315 * temp -
1316 * temp1, temp2, temp3 -
1317 * tsi -
1318 * xpidot -
1319 * xhdot1 -
1320 * z1, z2, z3 -
1321 * z11, z12, z13, z21, z22, z23, z31, z32, z33 -
1322 *
1323 * coupling :
1324 * getgravconst-
1325 * initl -
1326 * dscom -
1327 * dpper -
1328 * dsinit -
1329 * sgp4 -
1330 *
1331 * references :
1332 * hoots, roehrich, norad spacetrack report #3 1980
1333 * hoots, norad spacetrack report #6 1986
1334 * hoots, schumacher and glover 2004
1335 * vallado, crawford, hujsak, kelso 2006
1336  ----------------------------------------------------------------------------*/
1337 
1338 bool sgp4init
1339  (
1340  gravconsttype whichconst, char opsmode, const int satn, const double epoch,
1341  const double xbstar, const double xecco, const double xargpo,
1342  const double xinclo, const double xmo, const double xno,
1343  const double xnodeo, elsetrec& satrec
1344  )
1345 {
1346  /* --------------------- local variables ------------------------ */
1347  double ao, ainv, con42, cosio, sinio, cosio2, eccsq,
1348  omeosq, posq, rp, rteosq,
1349  cnodm , snodm , cosim , sinim , cosomm, sinomm, cc1sq ,
1350  cc2 , cc3 , coef , coef1 , cosio4, day , dndt ,
1351  em , emsq , eeta , etasq , gam , argpm , nodem ,
1352  inclm , mm , nm , perige, pinvsq, psisq , qzms24,
1353  rtemsq, s1 , s2 , s3 , s4 , s5 , s6 ,
1354  s7 , sfour , ss1 , ss2 , ss3 , ss4 , ss5 ,
1355  ss6 , ss7 , sz1 , sz2 , sz3 , sz11 , sz12 ,
1356  sz13 , sz21 , sz22 , sz23 , sz31 , sz32 , sz33 ,
1357  tc , temp , temp1 , temp2 , temp3 , tsi , xpidot,
1358  xhdot1, z1 , z2 , z3 , z11 , z12 , z13 ,
1359  z21 , z22 , z23 , z31 , z32 , z33,
1360  qzms2t, ss, j2, j3oj2, j4, x2o3, r[3], v[3],
1361  tumin, mu, radiusearthkm, xke, j3;
1362 
1363  /* ------------------------ initialization --------------------- */
1364  // sgp4fix divisor for divide by zero check on inclination
1365  // the old check used 1.0 + cos(pi-1.0e-9), but then compared it to
1366  // 1.5 e-12, so the threshold was changed to 1.5e-12 for consistency
1367  const double temp4 = 1.5e-12;
1368 
1369  /* ----------- set all near earth variables to zero ------------ */
1370  satrec.isimp = 0; satrec.method = 'n'; satrec.aycof = 0.0;
1371  satrec.con41 = 0.0; satrec.cc1 = 0.0; satrec.cc4 = 0.0;
1372  satrec.cc5 = 0.0; satrec.d2 = 0.0; satrec.d3 = 0.0;
1373  satrec.d4 = 0.0; satrec.delmo = 0.0; satrec.eta = 0.0;
1374  satrec.argpdot = 0.0; satrec.omgcof = 0.0; satrec.sinmao = 0.0;
1375  satrec.t = 0.0; satrec.t2cof = 0.0; satrec.t3cof = 0.0;
1376  satrec.t4cof = 0.0; satrec.t5cof = 0.0; satrec.x1mth2 = 0.0;
1377  satrec.x7thm1 = 0.0; satrec.mdot = 0.0; satrec.nodedot = 0.0;
1378  satrec.xlcof = 0.0; satrec.xmcof = 0.0; satrec.nodecf = 0.0;
1379 
1380  /* ----------- set all deep space variables to zero ------------ */
1381  satrec.irez = 0; satrec.d2201 = 0.0; satrec.d2211 = 0.0;
1382  satrec.d3210 = 0.0; satrec.d3222 = 0.0; satrec.d4410 = 0.0;
1383  satrec.d4422 = 0.0; satrec.d5220 = 0.0; satrec.d5232 = 0.0;
1384  satrec.d5421 = 0.0; satrec.d5433 = 0.0; satrec.dedt = 0.0;
1385  satrec.del1 = 0.0; satrec.del2 = 0.0; satrec.del3 = 0.0;
1386  satrec.didt = 0.0; satrec.dmdt = 0.0; satrec.dnodt = 0.0;
1387  satrec.domdt = 0.0; satrec.e3 = 0.0; satrec.ee2 = 0.0;
1388  satrec.peo = 0.0; satrec.pgho = 0.0; satrec.pho = 0.0;
1389  satrec.pinco = 0.0; satrec.plo = 0.0; satrec.se2 = 0.0;
1390  satrec.se3 = 0.0; satrec.sgh2 = 0.0; satrec.sgh3 = 0.0;
1391  satrec.sgh4 = 0.0; satrec.sh2 = 0.0; satrec.sh3 = 0.0;
1392  satrec.si2 = 0.0; satrec.si3 = 0.0; satrec.sl2 = 0.0;
1393  satrec.sl3 = 0.0; satrec.sl4 = 0.0; satrec.gsto = 0.0;
1394  satrec.xfact = 0.0; satrec.xgh2 = 0.0; satrec.xgh3 = 0.0;
1395  satrec.xgh4 = 0.0; satrec.xh2 = 0.0; satrec.xh3 = 0.0;
1396  satrec.xi2 = 0.0; satrec.xi3 = 0.0; satrec.xl2 = 0.0;
1397  satrec.xl3 = 0.0; satrec.xl4 = 0.0; satrec.xlamo = 0.0;
1398  satrec.zmol = 0.0; satrec.zmos = 0.0; satrec.atime = 0.0;
1399  satrec.xli = 0.0; satrec.xni = 0.0;
1400 
1401  // sgp4fix - note the following variables are also passed directly via satrec.
1402  // it is possible to streamline the sgp4init call by deleting the "x"
1403  // variables, but the user would need to set the satrec.* values first. we
1404  // include the additional assignments in case twoline2rv is not used.
1405  satrec.bstar = xbstar;
1406  satrec.ecco = xecco;
1407  satrec.argpo = xargpo;
1408  satrec.inclo = xinclo;
1409  satrec.mo = xmo;
1410  satrec.no = xno;
1411  satrec.nodeo = xnodeo;
1412 
1413  // sgp4fix add opsmode
1414  satrec.operationmode = opsmode;
1415 
1416  /* ------------------------ earth constants ----------------------- */
1417  // sgp4fix identify constants and allow alternate values
1418  getgravconst( whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2 );
1419  ss = 78.0 / radiusearthkm + 1.0;
1420  qzms2t = pow(((120.0 - 78.0) / radiusearthkm), 4);
1421  x2o3 = 2.0 / 3.0;
1422 
1423  satrec.init = 'y';
1424  satrec.t = 0.0;
1425 
1426  initl
1427  (
1428  satn, whichconst, satrec.ecco, epoch, satrec.inclo, satrec.no, satrec.method,
1429  ainv, ao, satrec.con41, con42, cosio, cosio2, eccsq, omeosq,
1430  posq, rp, rteosq, sinio, satrec.gsto, satrec.operationmode
1431  );
1432  satrec.error = 0;
1433 
1434  // sgp4fix remove this check as it is unnecessary
1435  // the mrt check in sgp4 handles decaying satellite cases even if the starting
1436  // condition is below the surface of te earth
1437 // if (rp < 1.0)
1438 // {
1439 // printf("# *** satn%d epoch elts sub-orbital ***\n", satn);
1440 // satrec.error = 5;
1441 // }
1442 
1443  if ((omeosq >= 0.0 ) || ( satrec.no >= 0.0))
1444  {
1445  satrec.isimp = 0;
1446  if (rp < (220.0 / radiusearthkm + 1.0))
1447  satrec.isimp = 1;
1448  sfour = ss;
1449  qzms24 = qzms2t;
1450  perige = (rp - 1.0) * radiusearthkm;
1451 
1452  /* - for perigees below 156 km, s and qoms2t are altered - */
1453  if (perige < 156.0)
1454  {
1455  sfour = perige - 78.0;
1456  if (perige < 98.0)
1457  sfour = 20.0;
1458  qzms24 = pow(((120.0 - sfour) / radiusearthkm), 4.0);
1459  sfour = sfour / radiusearthkm + 1.0;
1460  }
1461  pinvsq = 1.0 / posq;
1462 
1463  tsi = 1.0 / (ao - sfour);
1464  satrec.eta = ao * satrec.ecco * tsi;
1465  etasq = satrec.eta * satrec.eta;
1466  eeta = satrec.ecco * satrec.eta;
1467  psisq = fabs(1.0 - etasq);
1468  coef = qzms24 * pow(tsi, 4.0);
1469  coef1 = coef / pow(psisq, 3.5);
1470  cc2 = coef1 * satrec.no * (ao * (1.0 + 1.5 * etasq + eeta *
1471  (4.0 + etasq)) + 0.375 * j2 * tsi / psisq * satrec.con41 *
1472  (8.0 + 3.0 * etasq * (8.0 + etasq)));
1473  satrec.cc1 = satrec.bstar * cc2;
1474  cc3 = 0.0;
1475  if (satrec.ecco > 1.0e-4)
1476  cc3 = -2.0 * coef * tsi * j3oj2 * satrec.no * sinio / satrec.ecco;
1477  satrec.x1mth2 = 1.0 - cosio2;
1478  satrec.cc4 = 2.0* satrec.no * coef1 * ao * omeosq *
1479  (satrec.eta * (2.0 + 0.5 * etasq) + satrec.ecco *
1480  (0.5 + 2.0 * etasq) - j2 * tsi / (ao * psisq) *
1481  (-3.0 * satrec.con41 * (1.0 - 2.0 * eeta + etasq *
1482  (1.5 - 0.5 * eeta)) + 0.75 * satrec.x1mth2 *
1483  (2.0 * etasq - eeta * (1.0 + etasq)) * cos(2.0 * satrec.argpo)));
1484  satrec.cc5 = 2.0 * coef1 * ao * omeosq * (1.0 + 2.75 *
1485  (etasq + eeta) + eeta * etasq);
1486  cosio4 = cosio2 * cosio2;
1487  temp1 = 1.5 * j2 * pinvsq * satrec.no;
1488  temp2 = 0.5 * temp1 * j2 * pinvsq;
1489  temp3 = -0.46875 * j4 * pinvsq * pinvsq * satrec.no;
1490  satrec.mdot = satrec.no + 0.5 * temp1 * rteosq * satrec.con41 + 0.0625 *
1491  temp2 * rteosq * (13.0 - 78.0 * cosio2 + 137.0 * cosio4);
1492  satrec.argpdot = -0.5 * temp1 * con42 + 0.0625 * temp2 *
1493  (7.0 - 114.0 * cosio2 + 395.0 * cosio4) +
1494  temp3 * (3.0 - 36.0 * cosio2 + 49.0 * cosio4);
1495  xhdot1 = -temp1 * cosio;
1496  satrec.nodedot = xhdot1 + (0.5 * temp2 * (4.0 - 19.0 * cosio2) +
1497  2.0 * temp3 * (3.0 - 7.0 * cosio2)) * cosio;
1498  xpidot = satrec.argpdot+ satrec.nodedot;
1499  satrec.omgcof = satrec.bstar * cc3 * cos(satrec.argpo);
1500  satrec.xmcof = 0.0;
1501  if (satrec.ecco > 1.0e-4)
1502  satrec.xmcof = -x2o3 * coef * satrec.bstar / eeta;
1503  satrec.nodecf = 3.5 * omeosq * xhdot1 * satrec.cc1;
1504  satrec.t2cof = 1.5 * satrec.cc1;
1505  // sgp4fix for divide by zero with xinco = 180 deg
1506  if (fabs(cosio+1.0) > 1.5e-12)
1507  satrec.xlcof = -0.25 * j3oj2 * sinio * (3.0 + 5.0 * cosio) / (1.0 + cosio);
1508  else
1509  satrec.xlcof = -0.25 * j3oj2 * sinio * (3.0 + 5.0 * cosio) / temp4;
1510  satrec.aycof = -0.5 * j3oj2 * sinio;
1511  satrec.delmo = pow((1.0 + satrec.eta * cos(satrec.mo)), 3);
1512  satrec.sinmao = sin(satrec.mo);
1513  satrec.x7thm1 = 7.0 * cosio2 - 1.0;
1514 
1515  /* --------------- deep space initialization ------------- */
1516  if ((2*M_PI / satrec.no) >= 225.0)
1517  {
1518  satrec.method = 'd';
1519  satrec.isimp = 1;
1520  tc = 0.0;
1521  inclm = satrec.inclo;
1522 
1523  dscom
1524  (
1525  epoch, satrec.ecco, satrec.argpo, tc, satrec.inclo, satrec.nodeo,
1526  satrec.no, snodm, cnodm, sinim, cosim,sinomm, cosomm,
1527  day, satrec.e3, satrec.ee2, em, emsq, gam,
1528  satrec.peo, satrec.pgho, satrec.pho, satrec.pinco,
1529  satrec.plo, rtemsq, satrec.se2, satrec.se3,
1530  satrec.sgh2, satrec.sgh3, satrec.sgh4,
1531  satrec.sh2, satrec.sh3, satrec.si2, satrec.si3,
1532  satrec.sl2, satrec.sl3, satrec.sl4, s1, s2, s3, s4, s5,
1533  s6, s7, ss1, ss2, ss3, ss4, ss5, ss6, ss7, sz1, sz2, sz3,
1534  sz11, sz12, sz13, sz21, sz22, sz23, sz31, sz32, sz33,
1535  satrec.xgh2, satrec.xgh3, satrec.xgh4, satrec.xh2,
1536  satrec.xh3, satrec.xi2, satrec.xi3, satrec.xl2,
1537  satrec.xl3, satrec.xl4, nm, z1, z2, z3, z11,
1538  z12, z13, z21, z22, z23, z31, z32, z33,
1539  satrec.zmol, satrec.zmos
1540  );
1541  dpper
1542  (
1543  satrec.e3, satrec.ee2, satrec.peo, satrec.pgho,
1544  satrec.pho, satrec.pinco, satrec.plo, satrec.se2,
1545  satrec.se3, satrec.sgh2, satrec.sgh3, satrec.sgh4,
1546  satrec.sh2, satrec.sh3, satrec.si2, satrec.si3,
1547  satrec.sl2, satrec.sl3, satrec.sl4, satrec.t,
1548  satrec.xgh2,satrec.xgh3,satrec.xgh4, satrec.xh2,
1549  satrec.xh3, satrec.xi2, satrec.xi3, satrec.xl2,
1550  satrec.xl3, satrec.xl4, satrec.zmol, satrec.zmos, inclm, satrec.init,
1551  satrec.ecco, satrec.inclo, satrec.nodeo, satrec.argpo, satrec.mo,
1552  satrec.operationmode
1553  );
1554 
1555  argpm = 0.0;
1556  nodem = 0.0;
1557  mm = 0.0;
1558 
1559  dsinit
1560  (
1561  whichconst,
1562  cosim, emsq, satrec.argpo, s1, s2, s3, s4, s5, sinim, ss1, ss2, ss3, ss4,
1563  ss5, sz1, sz3, sz11, sz13, sz21, sz23, sz31, sz33, satrec.t, tc,
1564  satrec.gsto, satrec.mo, satrec.mdot, satrec.no, satrec.nodeo,
1565  satrec.nodedot, xpidot, z1, z3, z11, z13, z21, z23, z31, z33,
1566  satrec.ecco, eccsq, em, argpm, inclm, mm, nm, nodem,
1567  satrec.irez, satrec.atime,
1568  satrec.d2201, satrec.d2211, satrec.d3210, satrec.d3222 ,
1569  satrec.d4410, satrec.d4422, satrec.d5220, satrec.d5232,
1570  satrec.d5421, satrec.d5433, satrec.dedt, satrec.didt,
1571  satrec.dmdt, dndt, satrec.dnodt, satrec.domdt ,
1572  satrec.del1, satrec.del2, satrec.del3, satrec.xfact,
1573  satrec.xlamo, satrec.xli, satrec.xni
1574  );
1575  }
1576 
1577  /* ----------- set variables if not deep space ----------- */
1578  if (satrec.isimp != 1)
1579  {
1580  cc1sq = satrec.cc1 * satrec.cc1;
1581  satrec.d2 = 4.0 * ao * tsi * cc1sq;
1582  temp = satrec.d2 * tsi * satrec.cc1 / 3.0;
1583  satrec.d3 = (17.0 * ao + sfour) * temp;
1584  satrec.d4 = 0.5 * temp * ao * tsi * (221.0 * ao + 31.0 * sfour) *
1585  satrec.cc1;
1586  satrec.t3cof = satrec.d2 + 2.0 * cc1sq;
1587  satrec.t4cof = 0.25 * (3.0 * satrec.d3 + satrec.cc1 *
1588  (12.0 * satrec.d2 + 10.0 * cc1sq));
1589  satrec.t5cof = 0.2 * (3.0 * satrec.d4 +
1590  12.0 * satrec.cc1 * satrec.d3 +
1591  6.0 * satrec.d2 * satrec.d2 +
1592  15.0 * cc1sq * (2.0 * satrec.d2 + cc1sq));
1593  }
1594  } // if omeosq = 0 ...
1595 
1596  /* finally propagate to zero epoch to initialize all others. */
1597  // sgp4fix take out check to let satellites process until they are actually below earth surface
1598 // if(satrec.error == 0)
1599  sgp4(whichconst, satrec, 0.0, r, v);
1600 
1601  satrec.init = 'n';
1602 
1603 //#include "debug6.cpp"
1604  //sgp4fix return boolean. satrec.error contains any error codes
1605  return true;
1606 } // end sgp4init
1607 
1608 /*-----------------------------------------------------------------------------
1609 *
1610 * procedure sgp4
1611 *
1612 * this procedure is the sgp4 prediction model from space command. this is an
1613 * updated and combined version of sgp4 and sdp4, which were originally
1614 * published separately in spacetrack report #3. this version follows the
1615 * methodology from the aiaa paper (2006) describing the history and
1616 * development of the code.
1617 *
1618 * author : david vallado 719-573-2600 28 jun 2005
1619 *
1620 * inputs :
1621 * satrec - initialised structure from sgp4init() call.
1622 * tsince - time eince epoch (minutes)
1623 *
1624 * outputs :
1625 * r - position vector km
1626 * v - velocity km/sec
1627 * return code - non-zero on error.
1628 * 1 - mean elements, ecc >= 1.0 or ecc < -0.001 or a < 0.95 er
1629 * 2 - mean motion less than 0.0
1630 * 3 - pert elements, ecc < 0.0 or ecc > 1.0
1631 * 4 - semi-latus rectum < 0.0
1632 * 5 - epoch elements are sub-orbital
1633 * 6 - satellite has decayed
1634 *
1635 * locals :
1636 * am -
1637 * axnl, aynl -
1638 * betal -
1639 * cosim , sinim , cosomm , sinomm , cnod , snod , cos2u ,
1640 * sin2u , coseo1 , sineo1 , cosi , sini , cosip , sinip ,
1641 * cosisq , cossu , sinsu , cosu , sinu
1642 * delm -
1643 * delomg -
1644 * dndt -
1645 * eccm -
1646 * emsq -
1647 * ecose -
1648 * el2 -
1649 * eo1 -
1650 * eccp -
1651 * esine -
1652 * argpm -
1653 * argpp -
1654 * omgadf -
1655 * pl -
1656 * r -
1657 * rtemsq -
1658 * rdotl -
1659 * rl -
1660 * rvdot -
1661 * rvdotl -
1662 * su -
1663 * t2 , t3 , t4 , tc
1664 * tem5, temp , temp1 , temp2 , tempa , tempe , templ
1665 * u , ux , uy , uz , vx , vy , vz
1666 * inclm - inclination
1667 * mm - mean anomaly
1668 * nm - mean motion
1669 * nodem - right asc of ascending node
1670 * xinc -
1671 * xincp -
1672 * xl -
1673 * xlm -
1674 * mp -
1675 * xmdf -
1676 * xmx -
1677 * xmy -
1678 * nodedf -
1679 * xnode -
1680 * nodep -
1681 * np -
1682 *
1683 * coupling :
1684 * getgravconst-
1685 * dpper
1686 * dpspace
1687 *
1688 * references :
1689 * hoots, roehrich, norad spacetrack report #3 1980
1690 * hoots, norad spacetrack report #6 1986
1691 * hoots, schumacher and glover 2004
1692 * vallado, crawford, hujsak, kelso 2006
1693  ----------------------------------------------------------------------------*/
1694 
1695 bool sgp4
1696  (
1697  gravconsttype whichconst, elsetrec& satrec, double tsince,
1698  double r[3], double v[3]
1699  )
1700 {
1701  double am , axnl , aynl , betal , cosim , cnod ,
1702  cos2u, coseo1, cosi , cosip , cosisq, cossu , cosu,
1703  delm , delomg, em , emsq , ecose , el2 , eo1 ,
1704  ep , esine , argpm, argpp , argpdf, pl, mrt = 0.0,
1705  mvt , rdotl , rl , rvdot , rvdotl, sinim ,
1706  sin2u, sineo1, sini , sinip , sinsu , sinu ,
1707  snod , su , t2 , t3 , t4 , tem5 , temp,
1708  temp1, temp2 , tempa, tempe , templ , u , ux ,
1709  uy , uz , vx , vy , vz , inclm , mm ,
1710  nm , nodem, xinc , xincp , xl , xlm , mp ,
1711  xmdf , xmx , xmy , nodedf, xnode , nodep, tc , dndt,
1712  twopi, x2o3 , j2 , j3 , tumin, j4 , xke , j3oj2, radiusearthkm,
1713  mu, vkmpersec;
1714  int ktr;
1715 
1716  /* ------------------ set mathematical constants --------------- */
1717  // sgp4fix divisor for divide by zero check on inclination
1718  // the old check used 1.0 + cos(pi-1.0e-9), but then compared it to
1719  // 1.5 e-12, so the threshold was changed to 1.5e-12 for consistency
1720  const double temp4 = 1.5e-12;
1721  twopi = 2.0 * M_PI;
1722  x2o3 = 2.0 / 3.0;
1723  // sgp4fix identify constants and allow alternate values
1724  getgravconst( whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2 );
1725  vkmpersec = radiusearthkm * xke/60.0;
1726 
1727  /* --------------------- clear sgp4 error flag ----------------- */
1728  satrec.t = tsince;
1729  satrec.error = 0;
1730 
1731  /* ------- update for secular gravity and atmospheric drag ----- */
1732  xmdf = satrec.mo + satrec.mdot * satrec.t;
1733  argpdf = satrec.argpo + satrec.argpdot * satrec.t;
1734  nodedf = satrec.nodeo + satrec.nodedot * satrec.t;
1735  argpm = argpdf;
1736  mm = xmdf;
1737  t2 = satrec.t * satrec.t;
1738  nodem = nodedf + satrec.nodecf * t2;
1739  tempa = 1.0 - satrec.cc1 * satrec.t;
1740  tempe = satrec.bstar * satrec.cc4 * satrec.t;
1741  templ = satrec.t2cof * t2;
1742 
1743  if (satrec.isimp != 1)
1744  {
1745  delomg = satrec.omgcof * satrec.t;
1746  delm = satrec.xmcof *
1747  (pow((1.0 + satrec.eta * cos(xmdf)), 3) -
1748  satrec.delmo);
1749  temp = delomg + delm;
1750  mm = xmdf + temp;
1751  argpm = argpdf - temp;
1752  t3 = t2 * satrec.t;
1753  t4 = t3 * satrec.t;
1754  tempa = tempa - satrec.d2 * t2 - satrec.d3 * t3 -
1755  satrec.d4 * t4;
1756  tempe = tempe + satrec.bstar * satrec.cc5 * (sin(mm) -
1757  satrec.sinmao);
1758  templ = templ + satrec.t3cof * t3 + t4 * (satrec.t4cof +
1759  satrec.t * satrec.t5cof);
1760  }
1761 
1762  nm = satrec.no;
1763  em = satrec.ecco;
1764  inclm = satrec.inclo;
1765  if (satrec.method == 'd')
1766  {
1767  tc = satrec.t;
1768  dspace
1769  (
1770  satrec.irez,
1771  satrec.d2201, satrec.d2211, satrec.d3210,
1772  satrec.d3222, satrec.d4410, satrec.d4422,
1773  satrec.d5220, satrec.d5232, satrec.d5421,
1774  satrec.d5433, satrec.dedt, satrec.del1,
1775  satrec.del2, satrec.del3, satrec.didt,
1776  satrec.dmdt, satrec.dnodt, satrec.domdt,
1777  satrec.argpo, satrec.argpdot, satrec.t, tc,
1778  satrec.gsto, satrec.xfact, satrec.xlamo,
1779  satrec.no, satrec.atime,
1780  em, argpm, inclm, satrec.xli, mm, satrec.xni,
1781  nodem, dndt, nm
1782  );
1783  } // if method = d
1784 
1785  if (nm <= 0.0)
1786  {
1787 // printf("# error nm %f\n", nm);
1788  satrec.error = 2;
1789  // sgp4fix add return
1790  return false;
1791  }
1792  am = pow((xke / nm),x2o3) * tempa * tempa;
1793  nm = xke / pow(am, 1.5);
1794  em = em - tempe;
1795 
1796  // fix tolerance for error recognition
1797  // sgp4fix am is fixed from the previous nm check
1798  if ((em >= 1.0) || (em < -0.001)/* || (am < 0.95)*/ )
1799  {
1800 // printf("# error em %f\n", em);
1801  satrec.error = 1;
1802  // sgp4fix to return if there is an error in eccentricity
1803  return false;
1804  }
1805  // sgp4fix fix tolerance to avoid a divide by zero
1806  if (em < 1.0e-6)
1807  em = 1.0e-6;
1808  mm = mm + satrec.no * templ;
1809  xlm = mm + argpm + nodem;
1810  emsq = em * em;
1811  temp = 1.0 - emsq;
1812 
1813  nodem = fmod(nodem, twopi);
1814  argpm = fmod(argpm, twopi);
1815  xlm = fmod(xlm, twopi);
1816  mm = fmod(xlm - argpm - nodem, twopi);
1817 
1818  /* ----------------- compute extra mean quantities ------------- */
1819  sinim = sin(inclm);
1820  cosim = cos(inclm);
1821 
1822  /* -------------------- add lunar-solar periodics -------------- */
1823  ep = em;
1824  xincp = inclm;
1825  argpp = argpm;
1826  nodep = nodem;
1827  mp = mm;
1828  sinip = sinim;
1829  cosip = cosim;
1830  if (satrec.method == 'd')
1831  {
1832  dpper
1833  (
1834  satrec.e3, satrec.ee2, satrec.peo,
1835  satrec.pgho, satrec.pho, satrec.pinco,
1836  satrec.plo, satrec.se2, satrec.se3,
1837  satrec.sgh2, satrec.sgh3, satrec.sgh4,
1838  satrec.sh2, satrec.sh3, satrec.si2,
1839  satrec.si3, satrec.sl2, satrec.sl3,
1840  satrec.sl4, satrec.t, satrec.xgh2,
1841  satrec.xgh3, satrec.xgh4, satrec.xh2,
1842  satrec.xh3, satrec.xi2, satrec.xi3,
1843  satrec.xl2, satrec.xl3, satrec.xl4,
1844  satrec.zmol, satrec.zmos, satrec.inclo,
1845  'n', ep, xincp, nodep, argpp, mp, satrec.operationmode
1846  );
1847  if (xincp < 0.0)
1848  {
1849  xincp = -xincp;
1850  nodep = nodep + M_PI;
1851  argpp = argpp - M_PI;
1852  }
1853  if ((ep < 0.0 ) || ( ep > 1.0))
1854  {
1855 // printf("# error ep %f\n", ep);
1856  satrec.error = 3;
1857  // sgp4fix add return
1858  return false;
1859  }
1860  } // if method = d
1861 
1862  /* -------------------- long period periodics ------------------ */
1863  if (satrec.method == 'd')
1864  {
1865  sinip = sin(xincp);
1866  cosip = cos(xincp);
1867  satrec.aycof = -0.5*j3oj2*sinip;
1868  // sgp4fix for divide by zero for xincp = 180 deg
1869  if (fabs(cosip+1.0) > 1.5e-12)
1870  satrec.xlcof = -0.25 * j3oj2 * sinip * (3.0 + 5.0 * cosip) / (1.0 + cosip);
1871  else
1872  satrec.xlcof = -0.25 * j3oj2 * sinip * (3.0 + 5.0 * cosip) / temp4;
1873  }
1874  axnl = ep * cos(argpp);
1875  temp = 1.0 / (am * (1.0 - ep * ep));
1876  aynl = ep* sin(argpp) + temp * satrec.aycof;
1877  xl = mp + argpp + nodep + temp * satrec.xlcof * axnl;
1878 
1879  /* --------------------- solve kepler's equation --------------- */
1880  u = fmod(xl - nodep, twopi);
1881  eo1 = u;
1882  tem5 = 9999.9;
1883  ktr = 1;
1884  // sgp4fix for kepler iteration
1885  // the following iteration needs better limits on corrections
1886  while (( fabs(tem5) >= 1.0e-12) && (ktr <= 10) )
1887  {
1888  sineo1 = sin(eo1);
1889  coseo1 = cos(eo1);
1890  tem5 = 1.0 - coseo1 * axnl - sineo1 * aynl;
1891  tem5 = (u - aynl * coseo1 + axnl * sineo1 - eo1) / tem5;
1892  if(fabs(tem5) >= 0.95)
1893  tem5 = tem5 > 0.0 ? 0.95 : -0.95;
1894  eo1 = eo1 + tem5;
1895  ktr = ktr + 1;
1896  }
1897 
1898  /* ------------- short period preliminary quantities ----------- */
1899  ecose = axnl*coseo1 + aynl*sineo1;
1900  esine = axnl*sineo1 - aynl*coseo1;
1901  el2 = axnl*axnl + aynl*aynl;
1902  pl = am*(1.0-el2);
1903  if (pl < 0.0)
1904  {
1905 // printf("# error pl %f\n", pl);
1906  satrec.error = 4;
1907  // sgp4fix add return
1908  return false;
1909  }
1910  else
1911  {
1912  rl = am * (1.0 - ecose);
1913  rdotl = sqrt(am) * esine/rl;
1914  rvdotl = sqrt(pl) / rl;
1915  betal = sqrt(1.0 - el2);
1916  temp = esine / (1.0 + betal);
1917  sinu = am / rl * (sineo1 - aynl - axnl * temp);
1918  cosu = am / rl * (coseo1 - axnl + aynl * temp);
1919  su = atan2(sinu, cosu);
1920  sin2u = (cosu + cosu) * sinu;
1921  cos2u = 1.0 - 2.0 * sinu * sinu;
1922  temp = 1.0 / pl;
1923  temp1 = 0.5 * j2 * temp;
1924  temp2 = temp1 * temp;
1925 
1926  /* -------------- update for short period periodics ------------ */
1927  if (satrec.method == 'd')
1928  {
1929  cosisq = cosip * cosip;
1930  satrec.con41 = 3.0*cosisq - 1.0;
1931  satrec.x1mth2 = 1.0 - cosisq;
1932  satrec.x7thm1 = 7.0*cosisq - 1.0;
1933  }
1934  mrt = rl * (1.0 - 1.5 * temp2 * betal * satrec.con41) +
1935  0.5 * temp1 * satrec.x1mth2 * cos2u;
1936  su = su - 0.25 * temp2 * satrec.x7thm1 * sin2u;
1937  xnode = nodep + 1.5 * temp2 * cosip * sin2u;
1938  xinc = xincp + 1.5 * temp2 * cosip * sinip * cos2u;
1939  mvt = rdotl - nm * temp1 * satrec.x1mth2 * sin2u / xke;
1940  rvdot = rvdotl + nm * temp1 * (satrec.x1mth2 * cos2u +
1941  1.5 * satrec.con41) / xke;
1942 
1943  /* --------------------- orientation vectors ------------------- */
1944  sinsu = sin(su);
1945  cossu = cos(su);
1946  snod = sin(xnode);
1947  cnod = cos(xnode);
1948  sini = sin(xinc);
1949  cosi = cos(xinc);
1950  xmx = -snod * cosi;
1951  xmy = cnod * cosi;
1952  ux = xmx * sinsu + cnod * cossu;
1953  uy = xmy * sinsu + snod * cossu;
1954  uz = sini * sinsu;
1955  vx = xmx * cossu - cnod * sinsu;
1956  vy = xmy * cossu - snod * sinsu;
1957  vz = sini * cossu;
1958 
1959  /* --------- position and velocity (in km and km/sec) ---------- */
1960  r[0] = (mrt * ux)* radiusearthkm;
1961  r[1] = (mrt * uy)* radiusearthkm;
1962  r[2] = (mrt * uz)* radiusearthkm;
1963  v[0] = (mvt * ux + rvdot * vx) * vkmpersec;
1964  v[1] = (mvt * uy + rvdot * vy) * vkmpersec;
1965  v[2] = (mvt * uz + rvdot * vz) * vkmpersec;
1966  } // if pl > 0
1967 
1968  // sgp4fix for decaying satellites
1969  if (mrt < 1.0)
1970  {
1971 // printf("# decay condition %11.6f \n",mrt);
1972  satrec.error = 6;
1973  return false;
1974  }
1975 
1976 //#include "debug7.cpp"
1977  return true;
1978 } // end sgp4
1979 
1980 
1981 /* -----------------------------------------------------------------------------
1982 *
1983 * function gstime
1984 *
1985 * this function finds the greenwich sidereal time.
1986 *
1987 * author : david vallado 719-573-2600 1 mar 2001
1988 *
1989 * inputs description range / units
1990 * jdut1 - julian date in ut1 days from 4713 bc
1991 *
1992 * outputs :
1993 * gstime - greenwich sidereal time 0 to 2pi rad
1994 *
1995 * locals :
1996 * temp - temporary variable for doubles rad
1997 * tut1 - julian centuries from the
1998 * jan 1, 2000 12 h epoch (ut1)
1999 *
2000 * coupling :
2001 * none
2002 *
2003 * references :
2004 * vallado 2004, 191, eq 3-45
2005 * --------------------------------------------------------------------------- */
2006 
2007 double gstime
2008  (
2009  double jdut1
2010  )
2011  {
2012  const double twopi = 2.0 * M_PI;
2013  const double deg2rad = M_PI / 180.0;
2014  double temp, tut1;
2015 
2016  tut1 = (jdut1 - 2451545.0) / 36525.0;
2017  temp = -6.2e-6* tut1 * tut1 * tut1 + 0.093104 * tut1 * tut1 +
2018  (876600.0*3600 + 8640184.812866) * tut1 + 67310.54841; // sec
2019  temp = fmod(temp * deg2rad / 240.0, twopi); //360/86400 = 1/240, to deg, to rad
2020 
2021  // ------------------------ check quadrants ---------------------
2022  if (temp < 0.0)
2023  temp += twopi;
2024 
2025  return temp;
2026  } // end gstime
2027 
2028 /* -----------------------------------------------------------------------------
2029 *
2030 * function getgravconst
2031 *
2032 * this function gets constants for the propagator. note that mu is identified to
2033 * facilitiate comparisons with newer models. the common useage is wgs72.
2034 *
2035 * author : david vallado 719-573-2600 21 jul 2006
2036 *
2037 * inputs :
2038 * whichconst - which set of constants to use wgs72old, wgs72, wgs84
2039 *
2040 * outputs :
2041 * tumin - minutes in one time unit
2042 * mu - earth gravitational parameter
2043 * radiusearthkm - radius of the earth in km
2044 * xke - reciprocal of tumin
2045 * j2, j3, j4 - un-normalized zonal harmonic values
2046 * j3oj2 - j3 divided by j2
2047 *
2048 * locals :
2049 *
2050 * coupling :
2051 * none
2052 *
2053 * references :
2054 * norad spacetrack report #3
2055 * vallado, crawford, hujsak, kelso 2006
2056  --------------------------------------------------------------------------- */
2057 
2058 void getgravconst
2059  (
2060  gravconsttype whichconst,
2061  double& tumin,
2062  double& mu,
2063  double& radiusearthkm,
2064  double& xke,
2065  double& j2,
2066  double& j3,
2067  double& j4,
2068  double& j3oj2
2069  )
2070  {
2071 
2072  switch (whichconst)
2073  {
2074  // -- wgs-72 low precision str#3 constants --
2075  case wgs72old:
2076  mu = 398600.79964; // in km3 / s2
2077  radiusearthkm = 6378.135; // km
2078  xke = 0.0743669161;
2079  tumin = 1.0 / xke;
2080  j2 = 0.001082616;
2081  j3 = -0.00000253881;
2082  j4 = -0.00000165597;
2083  j3oj2 = j3 / j2;
2084  break;
2085  // ------------ wgs-72 constants ------------
2086  case wgs72:
2087  mu = 398600.8; // in km3 / s2
2088  radiusearthkm = 6378.135; // km
2089  xke = 60.0 / sqrt(radiusearthkm*radiusearthkm*radiusearthkm/mu);
2090  tumin = 1.0 / xke;
2091  j2 = 0.001082616;
2092  j3 = -0.00000253881;
2093  j4 = -0.00000165597;
2094  j3oj2 = j3 / j2;
2095  break;
2096  case wgs84:
2097  // ------------ wgs-84 constants ------------
2098  mu = 398600.5; // in km3 / s2
2099  radiusearthkm = 6378.137; // km
2100  xke = 60.0 / sqrt(radiusearthkm*radiusearthkm*radiusearthkm/mu);
2101  tumin = 1.0 / xke;
2102  j2 = 0.00108262998905;
2103  j3 = -0.00000253215306;
2104  j4 = -0.00000161098761;
2105  j3oj2 = j3 / j2;
2106  break;
2107  default:
2108  fprintf(stderr,"unknown gravity option (%d)\n",whichconst);
2109  break;
2110  }
2111 
2112  } // end getgravconst
2113 
2114 
2115 
2116 
2117 
elsetrec::aycof
double aycof
Definition: sgp4unit.h:73
elsetrec::se2
double se2
Definition: sgp4unit.h:80
elsetrec::dnodt
double dnodt
Definition: sgp4unit.h:80
elsetrec::se3
double se3
Definition: sgp4unit.h:80
elsetrec
Definition: sgp4unit.h:63
elsetrec::d4410
double d4410
Definition: sgp4unit.h:80
elsetrec::mdot
double mdot
Definition: sgp4unit.h:73
elsetrec::bstar
double bstar
Definition: sgp4unit.h:88
elsetrec::cc5
double cc5
Definition: sgp4unit.h:73
elsetrec::no
double no
Definition: sgp4unit.h:88
initl
static void initl(int satn, gravconsttype whichconst, double ecco, double epoch, double inclo, double &no, char &method, double &ainv, double &ao, double &con41, double &con42, double &cosio, double &cosio2, double &eccsq, double &omeosq, double &posq, double &rp, double &rteosq, double &sinio, double &gsto, char opsmode)
Definition: sgp4unit.cpp:1181
elsetrec::nodedot
double nodedot
Definition: sgp4unit.h:73
elsetrec::xh2
double xh2
Definition: sgp4unit.h:80
elsetrec::d3210
double d3210
Definition: sgp4unit.h:80
elsetrec::argpo
double argpo
Definition: sgp4unit.h:88
elsetrec::sh2
double sh2
Definition: sgp4unit.h:80
elsetrec::d2201
double d2201
Definition: sgp4unit.h:80
elsetrec::pho
double pho
Definition: sgp4unit.h:80
dbgfile
FILE * dbgfile
Definition: sgp4unit.cpp:52
elsetrec::d5232
double d5232
Definition: sgp4unit.h:80
elsetrec::xgh3
double xgh3
Definition: sgp4unit.h:80
elsetrec::mo
double mo
Definition: sgp4unit.h:88
elsetrec::zmos
double zmos
Definition: sgp4unit.h:80
elsetrec::sgh3
double sgh3
Definition: sgp4unit.h:80
elsetrec::sgh2
double sgh2
Definition: sgp4unit.h:80
elsetrec::pgho
double pgho
Definition: sgp4unit.h:80
elsetrec::pinco
double pinco
Definition: sgp4unit.h:80
dscom
static void dscom(double epoch, double ep, double argpp, double tc, double inclp, double nodep, double np, double &snodm, double &cnodm, double &sinim, double &cosim, double &sinomm, double &cosomm, double &day, double &e3, double &ee2, double &em, double &emsq, double &gam, double &peo, double &pgho, double &pho, double &pinco, double &plo, double &rtemsq, double &se2, double &se3, double &sgh2, double &sgh3, double &sgh4, double &sh2, double &sh3, double &si2, double &si3, double &sl2, double &sl3, double &sl4, double &s1, double &s2, double &s3, double &s4, double &s5, double &s6, double &s7, double &ss1, double &ss2, double &ss3, double &ss4, double &ss5, double &ss6, double &ss7, double &sz1, double &sz2, double &sz3, double &sz11, double &sz12, double &sz13, double &sz21, double &sz22, double &sz23, double &sz31, double &sz32, double &sz33, double &xgh2, double &xgh3, double &xgh4, double &xh2, double &xh3, double &xi2, double &xi3, double &xl2, double &xl3, double &xl4, double &nm, double &z1, double &z2, double &z3, double &z11, double &z12, double &z13, double &z21, double &z22, double &z23, double &z31, double &z32, double &z33, double &zmol, double &zmos)
Definition: sgp4unit.cpp:406
elsetrec::xfact
double xfact
Definition: sgp4unit.h:80
elsetrec::d5433
double d5433
Definition: sgp4unit.h:80
elsetrec::sl4
double sl4
Definition: sgp4unit.h:80
elsetrec::omgcof
double omgcof
Definition: sgp4unit.h:73
sgp4
bool sgp4(gravconsttype whichconst, elsetrec &satrec, double tsince, double r[3], double v[3])
Definition: sgp4unit.cpp:1696
gstime
double gstime(double jdut1)
Definition: sgp4unit.cpp:2008
elsetrec::d2211
double d2211
Definition: sgp4unit.h:80
elsetrec::t3cof
double t3cof
Definition: sgp4unit.h:73
elsetrec::xh3
double xh3
Definition: sgp4unit.h:80
elsetrec::e3
double e3
Definition: sgp4unit.h:80
elsetrec::xlcof
double xlcof
Definition: sgp4unit.h:73
elsetrec::atime
double atime
Definition: sgp4unit.h:80
wgs72old
Definition: sgp4unit.h:58
elsetrec::x1mth2
double x1mth2
Definition: sgp4unit.h:73
elsetrec::t4cof
double t4cof
Definition: sgp4unit.h:73
elsetrec::sh3
double sh3
Definition: sgp4unit.h:80
sgp4unit.h
gravconsttype
gravconsttype
Definition: sgp4unit.h:56
sgp4init
bool sgp4init(gravconsttype whichconst, char opsmode, const int satn, const double epoch, const double xbstar, const double xecco, const double xargpo, const double xinclo, const double xmo, const double xno, const double xnodeo, elsetrec &satrec)
Definition: sgp4unit.cpp:1339
elsetrec::d5421
double d5421
Definition: sgp4unit.h:80
elsetrec::d5220
double d5220
Definition: sgp4unit.h:80
elsetrec::xl2
double xl2
Definition: sgp4unit.h:80
elsetrec::dmdt
double dmdt
Definition: sgp4unit.h:80
elsetrec::eta
double eta
Definition: sgp4unit.h:73
elsetrec::xmcof
double xmcof
Definition: sgp4unit.h:73
elsetrec::d3
double d3
Definition: sgp4unit.h:73
elsetrec::init
char init
Definition: sgp4unit.h:69
elsetrec::d3222
double d3222
Definition: sgp4unit.h:80
elsetrec::sl2
double sl2
Definition: sgp4unit.h:80
elsetrec::xgh4
double xgh4
Definition: sgp4unit.h:80
dsinit
static void dsinit(gravconsttype whichconst, double cosim, double emsq, double argpo, double s1, double s2, double s3, double s4, double s5, double sinim, double ss1, double ss2, double ss3, double ss4, double ss5, double sz1, double sz3, double sz11, double sz13, double sz21, double sz23, double sz31, double sz33, double t, double tc, double gsto, double mo, double mdot, double no, double nodeo, double nodedot, double xpidot, double z1, double z3, double z11, double z13, double z21, double z23, double z31, double z33, double ecco, double eccsq, double &em, double &argpm, double &inclm, double &mm, double &nm, double &nodem, int &irez, double &atime, double &d2201, double &d2211, double &d3210, double &d3222, double &d4410, double &d4422, double &d5220, double &d5232, double &d5421, double &d5433, double &dedt, double &didt, double &dmdt, double &dndt, double &dnodt, double &domdt, double &del1, double &del2, double &del3, double &xfact, double &xlamo, double &xli, double &xni)
Definition: sgp4unit.cpp:686
elsetrec::sl3
double sl3
Definition: sgp4unit.h:80
elsetrec::didt
double didt
Definition: sgp4unit.h:80
elsetrec::si3
double si3
Definition: sgp4unit.h:80
elsetrec::d2
double d2
Definition: sgp4unit.h:73
wgs84
Definition: sgp4unit.h:60
UNUSED
#define UNUSED(arg)
Definition: sgp4unit.cpp:53
elsetrec::xl3
double xl3
Definition: sgp4unit.h:80
elsetrec::plo
double plo
Definition: sgp4unit.h:80
elsetrec::t2cof
double t2cof
Definition: sgp4unit.h:73
elsetrec::peo
double peo
Definition: sgp4unit.h:80
elsetrec::method
char method
Definition: sgp4unit.h:69
elsetrec::gsto
double gsto
Definition: sgp4unit.h:80
elsetrec::del1
double del1
Definition: sgp4unit.h:80
elsetrec::error
int error
Definition: sgp4unit.h:67
elsetrec::nodecf
double nodecf
Definition: sgp4unit.h:73
deg2rad
double deg2rad
Definition: dateline.cpp:52
elsetrec::xl4
double xl4
Definition: sgp4unit.h:80
elsetrec::inclo
double inclo
Definition: sgp4unit.h:88
elsetrec::del2
double del2
Definition: sgp4unit.h:80
elsetrec::isimp
int isimp
Definition: sgp4unit.h:72
elsetrec::operationmode
char operationmode
Definition: sgp4unit.h:68
elsetrec::xi2
double xi2
Definition: sgp4unit.h:80
dpper
static void dpper(double e3, double ee2, double peo, double pgho, double pho, double pinco, double plo, double se2, double se3, double sgh2, double sgh3, double sgh4, double sh2, double sh3, double si2, double si3, double sl2, double sl3, double sl4, double t, double xgh2, double xgh3, double xgh4, double xh2, double xh3, double xi2, double xi3, double xl2, double xl3, double xl4, double zmol, double zmos, double inclo, char init, double &ep, double &inclp, double &nodep, double &argpp, double &mp, char opsmode)
Definition: sgp4unit.cpp:205
elsetrec::cc4
double cc4
Definition: sgp4unit.h:73
elsetrec::domdt
double domdt
Definition: sgp4unit.h:80
elsetrec::cc1
double cc1
Definition: sgp4unit.h:73
elsetrec::xi3
double xi3
Definition: sgp4unit.h:80
elsetrec::t
double t
Definition: sgp4unit.h:73
dspace
static void dspace(int irez, double d2201, double d2211, double d3210, double d3222, double d4410, double d4422, double d5220, double d5232, double d5421, double d5433, double dedt, double del1, double del2, double del3, double didt, double dmdt, double dnodt, double domdt, double argpo, double argpdot, double t, double tc, double gsto, double xfact, double xlamo, double no, double &atime, double &em, double &argpm, double &inclm, double &xli, double &mm, double &xni, double &nodem, double &dndt, double &nm)
Definition: sgp4unit.cpp:983
elsetrec::argpdot
double argpdot
Definition: sgp4unit.h:73
elsetrec::del3
double del3
Definition: sgp4unit.h:80
wgs72
Definition: sgp4unit.h:59
elsetrec::con41
double con41
Definition: sgp4unit.h:73
elsetrec::xlamo
double xlamo
Definition: sgp4unit.h:80
M_PI
#define M_PI
Definition: GeoDataCoordinates.h:26
elsetrec::zmol
double zmol
Definition: sgp4unit.h:80
elsetrec::xli
double xli
Definition: sgp4unit.h:80
elsetrec::nodeo
double nodeo
Definition: sgp4unit.h:88
elsetrec::xgh2
double xgh2
Definition: sgp4unit.h:80
elsetrec::delmo
double delmo
Definition: sgp4unit.h:73
getgravconst
void getgravconst(gravconsttype whichconst, double &tumin, double &mu, double &radiusearthkm, double &xke, double &j2, double &j3, double &j4, double &j3oj2)
Definition: sgp4unit.cpp:2059
elsetrec::ee2
double ee2
Definition: sgp4unit.h:80
elsetrec::ecco
double ecco
Definition: sgp4unit.h:88
elsetrec::dedt
double dedt
Definition: sgp4unit.h:80
help
const char help
Definition: sgp4unit.cpp:51
elsetrec::irez
int irez
Definition: sgp4unit.h:79
elsetrec::si2
double si2
Definition: sgp4unit.h:80
elsetrec::x7thm1
double x7thm1
Definition: sgp4unit.h:73
elsetrec::sinmao
double sinmao
Definition: sgp4unit.h:73
elsetrec::d4
double d4
Definition: sgp4unit.h:73
elsetrec::d4422
double d4422
Definition: sgp4unit.h:80
elsetrec::t5cof
double t5cof
Definition: sgp4unit.h:73
elsetrec::sgh4
double sgh4
Definition: sgp4unit.h:80
elsetrec::xni
double xni
Definition: sgp4unit.h:80
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:38:52 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal