1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.orekit.propagation.analytical.tle;
18
19 import org.hipparchus.util.FastMath;
20 import org.orekit.attitudes.AttitudeProvider;
21
22
23
24
25
26
27
28
29
30
31
32
33
34 public class SGP4 extends TLEPropagator {
35
36
37 private boolean lessThan220;
38
39
40 private double delM0;
41
42
43 private double d2;
44 private double d3;
45 private double d4;
46 private double t3cof;
47 private double t4cof;
48 private double t5cof;
49 private double sinM0;
50 private double omgcof;
51 private double xmcof;
52 private double c5;
53
54
55
56
57
58
59
60 public SGP4(final TLE initialTLE, final AttitudeProvider attitudeProvider,
61 final double mass) {
62 super(initialTLE, attitudeProvider, mass);
63 }
64
65
66
67 protected void sxpInitialize() {
68
69
70
71
72 lessThan220 = perige < 220;
73 if (!lessThan220) {
74 final double c1sq = c1 * c1;
75 delM0 = 1.0 + eta * FastMath.cos(tle.getMeanAnomaly());
76 delM0 *= delM0 * delM0;
77 d2 = 4 * a0dp * tsi * c1sq;
78 final double temp = d2 * tsi * c1 / 3.0;
79 d3 = (17 * a0dp + s4) * temp;
80 d4 = 0.5 * temp * a0dp * tsi * (221 * a0dp + 31 * s4) * c1;
81 t3cof = d2 + 2 * c1sq;
82 t4cof = 0.25 * (3 * d3 + c1 * (12 * d2 + 10 * c1sq));
83 t5cof = 0.2 * (3 * d4 + 12 * c1 * d3 + 6 * d2 * d2 + 15 * c1sq * (2 * d2 + c1sq));
84 sinM0 = FastMath.sin(tle.getMeanAnomaly());
85 if (tle.getE() < 1e-4) {
86 omgcof = 0.;
87 xmcof = 0.;
88 } else {
89 final double c3 = coef * tsi * TLEConstants.A3OVK2 * xn0dp *
90 TLEConstants.NORMALIZED_EQUATORIAL_RADIUS * sini0 / tle.getE();
91 xmcof = -TLEConstants.TWO_THIRD * coef * tle.getBStar() *
92 TLEConstants.NORMALIZED_EQUATORIAL_RADIUS / eeta;
93 omgcof = tle.getBStar() * c3 * FastMath.cos(tle.getPerigeeArgument());
94 }
95 }
96
97 c5 = 2 * coef1 * a0dp * beta02 * (1 + 2.75 * (etasq + eeta) + eeta * etasq);
98
99 }
100
101
102
103
104 protected void sxpPropagate(final double tSince) {
105
106
107 final double xmdf = tle.getMeanAnomaly() + xmdot * tSince;
108 final double omgadf = tle.getPerigeeArgument() + omgdot * tSince;
109 final double xn0ddf = tle.getRaan() + xnodot * tSince;
110 omega = omgadf;
111 double xmp = xmdf;
112 final double tsq = tSince * tSince;
113 xnode = xn0ddf + xnodcf * tsq;
114 double tempa = 1 - c1 * tSince;
115 double tempe = tle.getBStar() * c4 * tSince;
116 double templ = t2cof * tsq;
117
118 if (!lessThan220) {
119 final double delomg = omgcof * tSince;
120 double delm = 1. + eta * FastMath.cos(xmdf);
121 delm = xmcof * (delm * delm * delm - delM0);
122 final double temp = delomg + delm;
123 xmp = xmdf + temp;
124 omega = omgadf - temp;
125 final double tcube = tsq * tSince;
126 final double tfour = tSince * tcube;
127 tempa = tempa - d2 * tsq - d3 * tcube - d4 * tfour;
128 tempe = tempe + tle.getBStar() * c5 * (FastMath.sin(xmp) - sinM0);
129 templ = templ + t3cof * tcube + tfour * (t4cof + tSince * t5cof);
130 }
131
132 a = a0dp * tempa * tempa;
133 e = tle.getE() - tempe;
134
135
136 if (e < 1e-6) {
137 e = 1e-6;
138 }
139
140 xl = xmp + omega + xnode + xn0dp * templ;
141
142 i = tle.getI();
143
144 }
145
146 }