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