ootk 1.0.4 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -33
- package/LICENSE.MD +21 -21
- package/README.md +128 -128
- package/asc/asconfig.json +22 -0
- package/asc/assembly/index.ts +1143 -0
- package/asc/ex/asconfig.json +22 -0
- package/asc/ex/assembly/index.ts +5 -0
- package/asc/ex/index.html +10 -0
- package/asc/ex/package.json +19 -0
- package/asc/ex/tests/index.js +4 -0
- package/asc/package.json +19 -0
- package/asc/tests/index.js +4 -0
- package/{lib/ootk-utils.d.ts → dist/ootk.d.ts} +6 -11
- package/dist/ootk.js +1 -3850
- package/{lib/ootk-sgp4.d.ts → dist/sgp4.d.ts} +6 -140
- package/dist/transforms.d.ts +58 -0
- package/dist/types.d.ts +164 -0
- package/dist/utils.d.ts +34 -0
- package/lib/ootk.d.ts +4 -4
- package/lib/ootk.js +4 -4
- package/lib/ootk.js.map +1 -1
- package/lib/sgp4.d.ts +89 -0
- package/lib/{ootk-sgp4.js → sgp4.js} +545 -529
- package/lib/sgp4.js.map +1 -0
- package/lib/transforms.d.ts +58 -0
- package/lib/{ootk-transforms.js → transforms.js} +3 -4
- package/lib/transforms.js.map +1 -0
- package/lib/types.d.ts +164 -0
- package/lib/types.js +2 -0
- package/lib/types.js.map +1 -0
- package/lib/utils/constants.d.ts +30 -0
- package/lib/utils/constants.js +31 -0
- package/lib/utils/constants.js.map +1 -0
- package/lib/utils.d.ts +34 -0
- package/lib/{ootk-utils.js → utils.js} +14 -6
- package/lib/utils.js.map +1 -0
- package/package.json +17 -17
- package/sandbox.html +8 -0
- package/dist/ootk-sgp4.js +0 -3471
- package/dist/ootk-sgp4.min.js +0 -34
- package/dist/ootk-transforms.js +0 -340
- package/dist/ootk-transforms.min.js +0 -1
- package/dist/ootk-utils.js +0 -149
- package/dist/ootk-utils.min.js +0 -1
- package/dist/ootk.min.js +0 -60
- package/lib/ootk-sgp4.js.map +0 -1
- package/lib/ootk-transforms.d.ts +0 -141
- package/lib/ootk-transforms.js.map +0 -1
- package/lib/ootk-utils.js.map +0 -1
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
31
31
|
* SOFTWARE.
|
|
32
32
|
*/
|
|
33
|
+
import { DEG2RAD, PI, TAU, temp4, x2o3 } from './utils/constants';
|
|
33
34
|
/* ----------------------------------------------------------------
|
|
34
35
|
*
|
|
35
36
|
* sgp4unit.cpp
|
|
@@ -86,47 +87,6 @@
|
|
|
86
87
|
* 80 norad
|
|
87
88
|
* original baseline
|
|
88
89
|
* ---------------------------------------------------------------- */
|
|
89
|
-
var PI = Math.PI;
|
|
90
|
-
var TAU = PI * 2;
|
|
91
|
-
var DEG2RAD = PI / 180.0;
|
|
92
|
-
var x2o3 = 2.0 / 3.0;
|
|
93
|
-
var xpdotp = 1440.0 / (2.0 * PI); // 229.1831180523293;
|
|
94
|
-
var zes = 0.01675;
|
|
95
|
-
var zel = 0.0549;
|
|
96
|
-
var c1ss = 2.9864797e-6;
|
|
97
|
-
var c1l = 4.7968065e-7;
|
|
98
|
-
var zsinis = 0.39785416;
|
|
99
|
-
var zcosis = 0.91744867;
|
|
100
|
-
var zcosgs = 0.1945905;
|
|
101
|
-
var zsings = -0.98088458;
|
|
102
|
-
var q22 = 1.7891679e-6;
|
|
103
|
-
var q31 = 2.1460748e-6;
|
|
104
|
-
var q33 = 2.2123015e-7;
|
|
105
|
-
var root22 = 1.7891679e-6;
|
|
106
|
-
var root44 = 7.3636953e-9;
|
|
107
|
-
var root54 = 2.1765803e-9;
|
|
108
|
-
var rptim = 4.37526908801129966e-3; // equates to 7.29211514668855e-5 rad/sec
|
|
109
|
-
var root32 = 3.7393792e-7;
|
|
110
|
-
var root52 = 1.1428639e-7;
|
|
111
|
-
var znl = 1.5835218e-4;
|
|
112
|
-
var zns = 1.19459e-5;
|
|
113
|
-
var temp4 = 1.5e-12;
|
|
114
|
-
var fasx2 = 0.13130908;
|
|
115
|
-
var fasx4 = 2.8843198;
|
|
116
|
-
var fasx6 = 0.37448087;
|
|
117
|
-
var g22 = 5.7686396;
|
|
118
|
-
var g32 = 0.95240898;
|
|
119
|
-
var g44 = 1.8014998;
|
|
120
|
-
var g52 = 1.050833;
|
|
121
|
-
var g54 = 4.4108898;
|
|
122
|
-
var stepp = 720.0;
|
|
123
|
-
var stepn = -720.0;
|
|
124
|
-
var step2 = 259200.0;
|
|
125
|
-
/**
|
|
126
|
-
* Ootk code is run synchronously and often on super tight loops, so lets reuse the variables as much as possible.
|
|
127
|
-
*/
|
|
128
|
-
// prettier-ignore
|
|
129
|
-
var axnl, aynl, xl, u, ktr, vkmpersec, ecose, esine, el2, pl, rl, rdotl, rvdotl, betal, sinu, cosu, sin2u, coseo1, sineo1, cosip, sinip, cosisq, delm, delomg, eo1, argpm, argpp, su, t3, t4, tc, tem5, temp, tempa, tempe, templ, inclm, mm, nm, nodem, xincp, xlm, mp, nodep, xmdf, argpdf, nodedf, t2, delmtemp, em, dspaceOptions, dspaceResult, am, ep, cosim, sinim, dpperResult, dpperParameters, method, ts70, ds70, c1, tfrac, thgr70, fk5r, c1p2p, dndt, ft, delt, xndt, xldot, xnddt, x2omi, xomi, x2li, theta, tut1, snodm, cnodm, sinomm, cosomm, betasq, rtemsq, peo, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, cc, x1, x2, x3, x4, x5, x6, x7, x8, zcosg, zsing, zcosh, zsinh, zcosi, zsini, ss1, ss2, ss3, ss4, ss5, ss6, ss7, sz1, sz2, sz3, sz11, sz12, sz13, sz21, sz22, sz23, sz31, sz32, sz33, s1, s2, s3, s4, s5, s6, s7, z1, z2, z3, z11, z12, z13, z21, z22, z23, z31, z32, z33, f220, f221, f311, f321, f322, f330, f441, f442, f522, f523, f542, f543, g200, g201, g211, g300, g310, g322, g410, g422, g520, g521, g532, g533, sini2, temp1, xno2, ainv2, aonv, cos2u, mrt, temp2, xnode, xinc, mvt, rvdot, sinsu, cossu, snod, cnod, cosi, sini, xmx, xmy, ux, uy, uz, vx, vy, vz, r, v, year, satrec, dsinitResult, dsinitOptions, ao, mon, day, hr, minute, sec, ss, qzms24temp, qzms2ttemp, initlOptions, initlResult, cosio, delmotemp, dscomOptions, dscomResult, dpperOptions, sinio, qzms2t, con42, cosio2, lmonth, dayofyr, inttemp, i, eccsq, omeosq, rteosq, ak, d1, adel, po, ses, sis, sls, sghs, shs, sel, sil, sll, con41, ainv, posq, rp, sghl, shll, PInco, plo, pho, ctem, zcosil, zsinhl, stem, zsingl, zsinil, gam, zy, pgho, zcoshl, xnoi, zcosgl, zmol, zmos, se2, se3, si2, si3, sl2, sl3, sl4, sgh2, xnodce, sh3, sgh4, sh2, ee2, e3, xi2, xi3, xl2, xl3, xl4, sgh3, xgh2, xgh3, xgh4, xh2, xh3, sgs, emo, emsqo, eoc, alfdp, betdp, cosop, sinop, dalf, dbet, dls, f2, f3, pe, pgh, ph, PInc, sinzf, xls, xnoh, zf, zm, cc1sq, cc2, cc3, coef, coef1, cosio4, emsq, eeta, etasq, perige, PInvsq, psisq, qzms24, sfour, temp3, tsi, xPIdot, xhdot1, leadingChar, gsto, lsflg, j2, j3, j3oj2, j4, xke, mus, radiusearthkm, tumin;
|
|
130
90
|
var Sgp4 = /** @class */ (function () {
|
|
131
91
|
function Sgp4() {
|
|
132
92
|
}
|
|
@@ -199,28 +159,28 @@ var Sgp4 = /** @class */ (function () {
|
|
|
199
159
|
Sgp4.dpper = function (satrec, options) {
|
|
200
160
|
var e3 = satrec.e3, ee2 = satrec.ee2, peo = satrec.peo, pgho = satrec.pgho, pho = satrec.pho, PInco = satrec.PInco, plo = satrec.plo, se2 = satrec.se2, se3 = satrec.se3, sgh2 = satrec.sgh2, sgh3 = satrec.sgh3, sgh4 = satrec.sgh4, sh2 = satrec.sh2, sh3 = satrec.sh3, si2 = satrec.si2, si3 = satrec.si3, sl2 = satrec.sl2, sl3 = satrec.sl3, sl4 = satrec.sl4, t = satrec.t, xgh2 = satrec.xgh2, xgh3 = satrec.xgh3, xgh4 = satrec.xgh4, xh2 = satrec.xh2, xh3 = satrec.xh3, xi2 = satrec.xi2, xi3 = satrec.xi3, xl2 = satrec.xl2, xl3 = satrec.xl3, xl4 = satrec.xl4, zmol = satrec.zmol, zmos = satrec.zmos;
|
|
201
161
|
var ep = options.ep, inclp = options.inclp, nodep = options.nodep, argpp = options.argpp, mp = options.mp;
|
|
202
|
-
var _a = options.opsmode, opsmode = _a === void 0 ? i : _a, init = options.init;
|
|
162
|
+
var _a = options.opsmode, opsmode = _a === void 0 ? 'i' : _a, init = options.init;
|
|
203
163
|
// ---------------------- constants -----------------------------
|
|
204
|
-
/** Ootk --
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
164
|
+
/** Ootk -- Some variables imported from outside the class at the top */
|
|
165
|
+
var zns = 1.19459e-5;
|
|
166
|
+
var zes = 0.01675;
|
|
167
|
+
var znl = 1.5835218e-4;
|
|
168
|
+
var zel = 0.0549;
|
|
209
169
|
// --------------- calculate time varying periodics -----------
|
|
210
|
-
zm = zmos + zns * t;
|
|
170
|
+
var zm = zmos + zns * t;
|
|
211
171
|
// be sure that the initial call has time set to zero
|
|
212
172
|
if (init === 'y') {
|
|
213
173
|
zm = zmos;
|
|
214
174
|
}
|
|
215
|
-
zf = zm + 2.0 * zes * Math.sin(zm);
|
|
216
|
-
sinzf = Math.sin(zf);
|
|
217
|
-
f2 = 0.5 * sinzf * sinzf - 0.25;
|
|
218
|
-
f3 = -0.5 * sinzf * Math.cos(zf);
|
|
219
|
-
ses = se2 * f2 + se3 * f3;
|
|
220
|
-
sis = si2 * f2 + si3 * f3;
|
|
221
|
-
sls = sl2 * f2 + sl3 * f3 + sl4 * sinzf;
|
|
222
|
-
sghs = sgh2 * f2 + sgh3 * f3 + sgh4 * sinzf;
|
|
223
|
-
shs = sh2 * f2 + sh3 * f3;
|
|
175
|
+
var zf = zm + 2.0 * zes * Math.sin(zm);
|
|
176
|
+
var sinzf = Math.sin(zf);
|
|
177
|
+
var f2 = 0.5 * sinzf * sinzf - 0.25;
|
|
178
|
+
var f3 = -0.5 * sinzf * Math.cos(zf);
|
|
179
|
+
var ses = se2 * f2 + se3 * f3;
|
|
180
|
+
var sis = si2 * f2 + si3 * f3;
|
|
181
|
+
var sls = sl2 * f2 + sl3 * f3 + sl4 * sinzf;
|
|
182
|
+
var sghs = sgh2 * f2 + sgh3 * f3 + sgh4 * sinzf;
|
|
183
|
+
var shs = sh2 * f2 + sh3 * f3;
|
|
224
184
|
zm = zmol + znl * t;
|
|
225
185
|
if (init === 'y') {
|
|
226
186
|
zm = zmol;
|
|
@@ -229,16 +189,16 @@ var Sgp4 = /** @class */ (function () {
|
|
|
229
189
|
sinzf = Math.sin(zf);
|
|
230
190
|
f2 = 0.5 * sinzf * sinzf - 0.25;
|
|
231
191
|
f3 = -0.5 * sinzf * Math.cos(zf);
|
|
232
|
-
sel = ee2 * f2 + e3 * f3;
|
|
233
|
-
sil = xi2 * f2 + xi3 * f3;
|
|
234
|
-
sll = xl2 * f2 + xl3 * f3 + xl4 * sinzf;
|
|
235
|
-
sghl = xgh2 * f2 + xgh3 * f3 + xgh4 * sinzf;
|
|
236
|
-
shll = xh2 * f2 + xh3 * f3;
|
|
237
|
-
pe = ses + sel;
|
|
238
|
-
PInc = sis + sil;
|
|
239
|
-
pl = sls + sll;
|
|
240
|
-
pgh = sghs + sghl;
|
|
241
|
-
ph = shs + shll;
|
|
192
|
+
var sel = ee2 * f2 + e3 * f3;
|
|
193
|
+
var sil = xi2 * f2 + xi3 * f3;
|
|
194
|
+
var sll = xl2 * f2 + xl3 * f3 + xl4 * sinzf;
|
|
195
|
+
var sghl = xgh2 * f2 + xgh3 * f3 + xgh4 * sinzf;
|
|
196
|
+
var shll = xh2 * f2 + xh3 * f3;
|
|
197
|
+
var pe = ses + sel;
|
|
198
|
+
var PInc = sis + sil;
|
|
199
|
+
var pl = sls + sll;
|
|
200
|
+
var pgh = sghs + sghl;
|
|
201
|
+
var ph = shs + shll;
|
|
242
202
|
if (init === 'n') {
|
|
243
203
|
pe -= peo;
|
|
244
204
|
PInc -= PInco;
|
|
@@ -247,8 +207,8 @@ var Sgp4 = /** @class */ (function () {
|
|
|
247
207
|
ph -= pho;
|
|
248
208
|
inclp += PInc;
|
|
249
209
|
ep += pe;
|
|
250
|
-
sinip = Math.sin(inclp);
|
|
251
|
-
cosip = Math.cos(inclp);
|
|
210
|
+
var sinip = Math.sin(inclp);
|
|
211
|
+
var cosip = Math.cos(inclp);
|
|
252
212
|
/* ----------------- apply periodics directly ------------ */
|
|
253
213
|
// sgp4fix for lyddane choice
|
|
254
214
|
// strn3 used original inclination - this is technically feasible
|
|
@@ -267,12 +227,12 @@ var Sgp4 = /** @class */ (function () {
|
|
|
267
227
|
}
|
|
268
228
|
else {
|
|
269
229
|
// ---- apply periodics with lyddane modification ----
|
|
270
|
-
sinop = Math.sin(nodep);
|
|
271
|
-
cosop = Math.cos(nodep);
|
|
272
|
-
alfdp = sinip * sinop;
|
|
273
|
-
betdp = sinip * cosop;
|
|
274
|
-
dalf = ph * cosop + PInc * cosip * sinop;
|
|
275
|
-
dbet = -ph * sinop + PInc * cosip * cosop;
|
|
230
|
+
var sinop = Math.sin(nodep);
|
|
231
|
+
var cosop = Math.cos(nodep);
|
|
232
|
+
var alfdp = sinip * sinop;
|
|
233
|
+
var betdp = sinip * cosop;
|
|
234
|
+
var dalf = ph * cosop + PInc * cosip * sinop;
|
|
235
|
+
var dbet = -ph * sinop + PInc * cosip * cosop;
|
|
276
236
|
alfdp += dalf;
|
|
277
237
|
betdp += dbet;
|
|
278
238
|
nodep %= TAU;
|
|
@@ -282,10 +242,10 @@ var Sgp4 = /** @class */ (function () {
|
|
|
282
242
|
if (nodep < 0.0 && opsmode === 'a') {
|
|
283
243
|
nodep += TAU;
|
|
284
244
|
}
|
|
285
|
-
xls = mp + argpp + cosip * nodep;
|
|
286
|
-
dls = pl + pgh - PInc * nodep * sinip;
|
|
245
|
+
var xls = mp + argpp + cosip * nodep;
|
|
246
|
+
var dls = pl + pgh - PInc * nodep * sinip;
|
|
287
247
|
xls += dls;
|
|
288
|
-
xnoh = nodep;
|
|
248
|
+
var xnoh = nodep;
|
|
289
249
|
nodep = Math.atan2(alfdp, betdp);
|
|
290
250
|
// sgp4fix for afspc written intrinsic functions
|
|
291
251
|
// nodep used without a trigonometric function ahead
|
|
@@ -384,77 +344,78 @@ var Sgp4 = /** @class */ (function () {
|
|
|
384
344
|
Sgp4.dscom = function (options) {
|
|
385
345
|
var epoch = options.epoch, ep = options.ep, argpp = options.argpp, tc = options.tc, inclp = options.inclp, nodep = options.nodep, np = options.np;
|
|
386
346
|
// -------------------------- constants -------------------------
|
|
387
|
-
/** Ootk --
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
347
|
+
/** Ootk -- Some variables imported from outside the class at the top */
|
|
348
|
+
var zes = 0.01675;
|
|
349
|
+
var zel = 0.0549;
|
|
350
|
+
var c1ss = 2.9864797e-6;
|
|
351
|
+
var c1l = 4.7968065e-7;
|
|
352
|
+
var zsinis = 0.39785416;
|
|
353
|
+
var zcosis = 0.91744867;
|
|
354
|
+
var zcosgs = 0.1945905;
|
|
355
|
+
var zsings = -0.98088458;
|
|
356
|
+
var TAU = 2.0 * Math.PI;
|
|
397
357
|
// --------------------- local variables ------------------------
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
358
|
+
var s1, s2, s3, s4, s5, s6, s7, ss1, ss2, ss3, ss4, ss5, ss6, ss7, sz1, sz2, sz3, sz11, sz12, sz13, sz21, sz22, sz23, sz31, sz32, sz33, z31, z32, z33, z1, z2, z3, z11, z12, z13, z21, z22, z23;
|
|
359
|
+
var nm = np;
|
|
360
|
+
var em = ep;
|
|
361
|
+
var snodm = Math.sin(nodep);
|
|
362
|
+
var cnodm = Math.cos(nodep);
|
|
363
|
+
var sinomm = Math.sin(argpp);
|
|
364
|
+
var cosomm = Math.cos(argpp);
|
|
365
|
+
var sinim = Math.sin(inclp);
|
|
366
|
+
var cosim = Math.cos(inclp);
|
|
367
|
+
var emsq = em * em;
|
|
368
|
+
var betasq = 1.0 - emsq;
|
|
369
|
+
var rtemsq = Math.sqrt(betasq);
|
|
409
370
|
// ----------------- initialize lunar solar terms ---------------
|
|
410
|
-
peo = 0.0;
|
|
411
|
-
PInco = 0.0;
|
|
412
|
-
plo = 0.0;
|
|
413
|
-
pgho = 0.0;
|
|
414
|
-
pho = 0.0;
|
|
415
|
-
day = epoch + 18261.5 + tc / 1440.0;
|
|
416
|
-
xnodce = (4.523602 - 9.2422029e-4 * day) % TAU;
|
|
417
|
-
stem = Math.sin(xnodce);
|
|
418
|
-
ctem = Math.cos(xnodce);
|
|
419
|
-
zcosil = 0.91375164 - 0.03568096 * ctem;
|
|
420
|
-
zsinil = Math.sqrt(1.0 - zcosil * zcosil);
|
|
421
|
-
zsinhl = (0.089683511 * stem) / zsinil;
|
|
422
|
-
zcoshl = Math.sqrt(1.0 - zsinhl * zsinhl);
|
|
423
|
-
gam = 5.8351514 + 0.001944368 * day;
|
|
371
|
+
var peo = 0.0;
|
|
372
|
+
var PInco = 0.0;
|
|
373
|
+
var plo = 0.0;
|
|
374
|
+
var pgho = 0.0;
|
|
375
|
+
var pho = 0.0;
|
|
376
|
+
var day = epoch + 18261.5 + tc / 1440.0;
|
|
377
|
+
var xnodce = (4.523602 - 9.2422029e-4 * day) % TAU;
|
|
378
|
+
var stem = Math.sin(xnodce);
|
|
379
|
+
var ctem = Math.cos(xnodce);
|
|
380
|
+
var zcosil = 0.91375164 - 0.03568096 * ctem;
|
|
381
|
+
var zsinil = Math.sqrt(1.0 - zcosil * zcosil);
|
|
382
|
+
var zsinhl = (0.089683511 * stem) / zsinil;
|
|
383
|
+
var zcoshl = Math.sqrt(1.0 - zsinhl * zsinhl);
|
|
384
|
+
var gam = 5.8351514 + 0.001944368 * day;
|
|
424
385
|
var zx = (0.39785416 * stem) / zsinil;
|
|
425
|
-
zy = zcoshl * ctem + 0.91744867 * zsinhl * stem;
|
|
386
|
+
var zy = zcoshl * ctem + 0.91744867 * zsinhl * stem;
|
|
426
387
|
zx = Math.atan2(zx, zy);
|
|
427
388
|
zx += gam - xnodce;
|
|
428
|
-
zcosgl = Math.cos(zx);
|
|
429
|
-
zsingl = Math.sin(zx);
|
|
389
|
+
var zcosgl = Math.cos(zx);
|
|
390
|
+
var zsingl = Math.sin(zx);
|
|
430
391
|
// ------------------------- do solar terms ---------------------
|
|
431
|
-
zcosg = zcosgs;
|
|
432
|
-
zsing = zsings;
|
|
433
|
-
zcosi = zcosis;
|
|
434
|
-
zsini = zsinis;
|
|
435
|
-
zcosh = cnodm;
|
|
436
|
-
zsinh = snodm;
|
|
437
|
-
cc = c1ss;
|
|
438
|
-
xnoi = 1.0 / nm;
|
|
439
|
-
for (lsflg = 1; lsflg <= 2; lsflg++) {
|
|
440
|
-
a1 = zcosg * zcosh + zsing * zcosi * zsinh;
|
|
441
|
-
a3 = -zsing * zcosh + zcosg * zcosi * zsinh;
|
|
442
|
-
a7 = -zcosg * zsinh + zsing * zcosi * zcosh;
|
|
443
|
-
a8 = zsing * zsini;
|
|
444
|
-
a9 = zsing * zsinh + zcosg * zcosi * zcosh;
|
|
445
|
-
a10 = zcosg * zsini;
|
|
446
|
-
a2 = cosim * a7 + sinim * a8;
|
|
447
|
-
a4 = cosim * a9 + sinim * a10;
|
|
448
|
-
a5 = -sinim * a7 + cosim * a8;
|
|
449
|
-
a6 = -sinim * a9 + cosim * a10;
|
|
450
|
-
x1 = a1 * cosomm + a2 * sinomm;
|
|
451
|
-
x2 = a3 * cosomm + a4 * sinomm;
|
|
452
|
-
x3 = -a1 * sinomm + a2 * cosomm;
|
|
453
|
-
x4 = -a3 * sinomm + a4 * cosomm;
|
|
454
|
-
x5 = a5 * sinomm;
|
|
455
|
-
x6 = a6 * sinomm;
|
|
456
|
-
x7 = a5 * cosomm;
|
|
457
|
-
x8 = a6 * cosomm;
|
|
392
|
+
var zcosg = zcosgs;
|
|
393
|
+
var zsing = zsings;
|
|
394
|
+
var zcosi = zcosis;
|
|
395
|
+
var zsini = zsinis;
|
|
396
|
+
var zcosh = cnodm;
|
|
397
|
+
var zsinh = snodm;
|
|
398
|
+
var cc = c1ss;
|
|
399
|
+
var xnoi = 1.0 / nm;
|
|
400
|
+
for (var lsflg = 1; lsflg <= 2; lsflg++) {
|
|
401
|
+
var a1 = zcosg * zcosh + zsing * zcosi * zsinh;
|
|
402
|
+
var a3 = -zsing * zcosh + zcosg * zcosi * zsinh;
|
|
403
|
+
var a7 = -zcosg * zsinh + zsing * zcosi * zcosh;
|
|
404
|
+
var a8 = zsing * zsini;
|
|
405
|
+
var a9 = zsing * zsinh + zcosg * zcosi * zcosh;
|
|
406
|
+
var a10 = zcosg * zsini;
|
|
407
|
+
var a2 = cosim * a7 + sinim * a8;
|
|
408
|
+
var a4 = cosim * a9 + sinim * a10;
|
|
409
|
+
var a5 = -sinim * a7 + cosim * a8;
|
|
410
|
+
var a6 = -sinim * a9 + cosim * a10;
|
|
411
|
+
var x1 = a1 * cosomm + a2 * sinomm;
|
|
412
|
+
var x2 = a3 * cosomm + a4 * sinomm;
|
|
413
|
+
var x3 = -a1 * sinomm + a2 * cosomm;
|
|
414
|
+
var x4 = -a3 * sinomm + a4 * cosomm;
|
|
415
|
+
var x5 = a5 * sinomm;
|
|
416
|
+
var x6 = a6 * sinomm;
|
|
417
|
+
var x7 = a5 * cosomm;
|
|
418
|
+
var x8 = a6 * cosomm;
|
|
458
419
|
z31 = 12.0 * x1 * x1 - 3.0 * x3 * x3;
|
|
459
420
|
z32 = 24.0 * x1 * x2 - 6.0 * x3 * x4;
|
|
460
421
|
z33 = 12.0 * x2 * x2 - 3.0 * x4 * x4;
|
|
@@ -462,13 +423,10 @@ var Sgp4 = /** @class */ (function () {
|
|
|
462
423
|
z2 = 6.0 * (a1 * a3 + a2 * a4) + z32 * emsq;
|
|
463
424
|
z3 = 3.0 * (a3 * a3 + a4 * a4) + z33 * emsq;
|
|
464
425
|
z11 = -6.0 * a1 * a5 + emsq * (-24.0 * x1 * x7 - 6.0 * x3 * x5);
|
|
465
|
-
z12 =
|
|
466
|
-
-6.0 * (a1 * a6 + a3 * a5) +
|
|
467
|
-
emsq * (-24.0 * (x2 * x7 + x1 * x8) + -6.0 * (x3 * x6 + x4 * x5));
|
|
426
|
+
z12 = -6.0 * (a1 * a6 + a3 * a5) + emsq * (-24.0 * (x2 * x7 + x1 * x8) + -6.0 * (x3 * x6 + x4 * x5));
|
|
468
427
|
z13 = -6.0 * a3 * a6 + emsq * (-24.0 * x2 * x8 - 6.0 * x4 * x6);
|
|
469
428
|
z21 = 6.0 * a2 * a5 + emsq * (24.0 * x1 * x5 - 6.0 * x3 * x7);
|
|
470
|
-
z22 =
|
|
471
|
-
6.0 * (a4 * a5 + a2 * a6) + emsq * (24.0 * (x2 * x5 + x1 * x6) - 6.0 * (x4 * x7 + x3 * x8));
|
|
429
|
+
z22 = 6.0 * (a4 * a5 + a2 * a6) + emsq * (24.0 * (x2 * x5 + x1 * x6) - 6.0 * (x4 * x7 + x3 * x8));
|
|
472
430
|
z23 = 6.0 * a4 * a6 + emsq * (24.0 * x2 * x6 - 6.0 * x4 * x8);
|
|
473
431
|
z1 = z1 + z1 + betasq * z31;
|
|
474
432
|
z2 = z2 + z2 + betasq * z32;
|
|
@@ -510,34 +468,34 @@ var Sgp4 = /** @class */ (function () {
|
|
|
510
468
|
cc = c1l;
|
|
511
469
|
}
|
|
512
470
|
}
|
|
513
|
-
zmol = (4.7199672 + (0.2299715 * day - gam)) % TAU;
|
|
514
|
-
zmos = (6.2565837 + 0.017201977 * day) % TAU;
|
|
471
|
+
var zmol = (4.7199672 + (0.2299715 * day - gam)) % TAU;
|
|
472
|
+
var zmos = (6.2565837 + 0.017201977 * day) % TAU;
|
|
515
473
|
// ------------------------ do solar terms ----------------------
|
|
516
|
-
se2 = 2.0 * ss1 * ss6;
|
|
517
|
-
se3 = 2.0 * ss1 * ss7;
|
|
518
|
-
si2 = 2.0 * ss2 * sz12;
|
|
519
|
-
si3 = 2.0 * ss2 * (sz13 - sz11);
|
|
520
|
-
sl2 = -2.0 * ss3 * sz2;
|
|
521
|
-
sl3 = -2.0 * ss3 * (sz3 - sz1);
|
|
522
|
-
sl4 = -2.0 * ss3 * (-21.0 - 9.0 * emsq) * zes;
|
|
523
|
-
sgh2 = 2.0 * ss4 * sz32;
|
|
524
|
-
sgh3 = 2.0 * ss4 * (sz33 - sz31);
|
|
525
|
-
sgh4 = -18.0 * ss4 * zes;
|
|
526
|
-
sh2 = -2.0 * ss2 * sz22;
|
|
527
|
-
sh3 = -2.0 * ss2 * (sz23 - sz21);
|
|
474
|
+
var se2 = 2.0 * ss1 * ss6;
|
|
475
|
+
var se3 = 2.0 * ss1 * ss7;
|
|
476
|
+
var si2 = 2.0 * ss2 * sz12;
|
|
477
|
+
var si3 = 2.0 * ss2 * (sz13 - sz11);
|
|
478
|
+
var sl2 = -2.0 * ss3 * sz2;
|
|
479
|
+
var sl3 = -2.0 * ss3 * (sz3 - sz1);
|
|
480
|
+
var sl4 = -2.0 * ss3 * (-21.0 - 9.0 * emsq) * zes;
|
|
481
|
+
var sgh2 = 2.0 * ss4 * sz32;
|
|
482
|
+
var sgh3 = 2.0 * ss4 * (sz33 - sz31);
|
|
483
|
+
var sgh4 = -18.0 * ss4 * zes;
|
|
484
|
+
var sh2 = -2.0 * ss2 * sz22;
|
|
485
|
+
var sh3 = -2.0 * ss2 * (sz23 - sz21);
|
|
528
486
|
// ------------------------ do lunar terms ----------------------
|
|
529
|
-
ee2 = 2.0 * s1 * s6;
|
|
530
|
-
e3 = 2.0 * s1 * s7;
|
|
531
|
-
xi2 = 2.0 * s2 * z12;
|
|
532
|
-
xi3 = 2.0 * s2 * (z13 - z11);
|
|
533
|
-
xl2 = -2.0 * s3 * z2;
|
|
534
|
-
xl3 = -2.0 * s3 * (z3 - z1);
|
|
535
|
-
xl4 = -2.0 * s3 * (-21.0 - 9.0 * emsq) * zel;
|
|
536
|
-
xgh2 = 2.0 * s4 * z32;
|
|
537
|
-
xgh3 = 2.0 * s4 * (z33 - z31);
|
|
538
|
-
xgh4 = -18.0 * s4 * zel;
|
|
539
|
-
xh2 = -2.0 * s2 * z22;
|
|
540
|
-
xh3 = -2.0 * s2 * (z23 - z21);
|
|
487
|
+
var ee2 = 2.0 * s1 * s6;
|
|
488
|
+
var e3 = 2.0 * s1 * s7;
|
|
489
|
+
var xi2 = 2.0 * s2 * z12;
|
|
490
|
+
var xi3 = 2.0 * s2 * (z13 - z11);
|
|
491
|
+
var xl2 = -2.0 * s3 * z2;
|
|
492
|
+
var xl3 = -2.0 * s3 * (z3 - z1);
|
|
493
|
+
var xl4 = -2.0 * s3 * (-21.0 - 9.0 * emsq) * zel;
|
|
494
|
+
var xgh2 = 2.0 * s4 * z32;
|
|
495
|
+
var xgh3 = 2.0 * s4 * (z33 - z31);
|
|
496
|
+
var xgh4 = -18.0 * s4 * zel;
|
|
497
|
+
var xh2 = -2.0 * s2 * z22;
|
|
498
|
+
var xh3 = -2.0 * s2 * (z23 - z21);
|
|
541
499
|
return {
|
|
542
500
|
snodm: snodm,
|
|
543
501
|
cnodm: cnodm,
|
|
@@ -708,19 +666,19 @@ var Sgp4 = /** @class */ (function () {
|
|
|
708
666
|
xke = options.xke, cosim = options.cosim, argpo = options.argpo, s1 = options.s1, s2 = options.s2, s3 = options.s3, s4 = options.s4, s5 = options.s5, sinim = options.sinim, ss1 = options.ss1, ss2 = options.ss2, ss3 = options.ss3, ss4 = options.ss4, ss5 = options.ss5, sz1 = options.sz1, sz3 = options.sz3, sz11 = options.sz11, sz13 = options.sz13, sz21 = options.sz21, sz23 = options.sz23, sz31 = options.sz31, sz33 = options.sz33, t = options.t, tc = options.tc, gsto = options.gsto, mo = options.mo, mdot = options.mdot, no = options.no, nodeo = options.nodeo, nodedot = options.nodedot, xPIdot = options.xPIdot, z1 = options.z1, z3 = options.z3, z11 = options.z11, z13 = options.z13, z21 = options.z21, z23 = options.z23, z31 = options.z31, z33 = options.z33, ecco = options.ecco, eccsq = options.eccsq;
|
|
709
667
|
var emsq = options.emsq, em = options.em, argpm = options.argpm, inclm = options.inclm, mm = options.mm, nm = options.nm, nodem = options.nodem, irez = options.irez, atime = options.atime, d2201 = options.d2201, d2211 = options.d2211, d3210 = options.d3210, d3222 = options.d3222, d4410 = options.d4410, d4422 = options.d4422, d5220 = options.d5220, d5232 = options.d5232, d5421 = options.d5421, d5433 = options.d5433, dedt = options.dedt, didt = options.didt, dmdt = options.dmdt, dnodt = options.dnodt, domdt = options.domdt, del1 = options.del1, del2 = options.del2, del3 = options.del3, xfact = options.xfact, xlamo = options.xlamo, xli = options.xli, xni = options.xni;
|
|
710
668
|
/* --------------------- local variables ------------------------ */
|
|
711
|
-
/** Ootk --
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
669
|
+
/** Ootk -- Some variables imported from outside the class at the top */
|
|
670
|
+
var q22 = 1.7891679e-6;
|
|
671
|
+
var q31 = 2.1460748e-6;
|
|
672
|
+
var q33 = 2.2123015e-7;
|
|
673
|
+
var root22 = 1.7891679e-6;
|
|
674
|
+
var root44 = 7.3636953e-9;
|
|
675
|
+
var root54 = 2.1765803e-9;
|
|
676
|
+
var rptim = 4.37526908801129966e-3; // equates to 7.29211514668855e-5 rad/sec
|
|
677
|
+
var root32 = 3.7393792e-7;
|
|
678
|
+
var root52 = 1.1428639e-7;
|
|
679
|
+
var x2o3 = 2.0 / 3.0;
|
|
680
|
+
var znl = 1.5835218e-4;
|
|
681
|
+
var zns = 1.19459e-5;
|
|
724
682
|
// sgp4fix identify constants and allow alternate values
|
|
725
683
|
// just xke is used here so pass it in rather than have multiple calls
|
|
726
684
|
// getgravconst( whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2 );
|
|
@@ -733,10 +691,10 @@ var Sgp4 = /** @class */ (function () {
|
|
|
733
691
|
irez = 2;
|
|
734
692
|
}
|
|
735
693
|
// ------------------------ do solar terms -------------------
|
|
736
|
-
ses = ss1 * zns * ss5;
|
|
737
|
-
sis = ss2 * zns * (sz11 + sz13);
|
|
738
|
-
sls = -zns * ss3 * (sz1 + sz3 - 14.0 - 6.0 * emsq);
|
|
739
|
-
sghs = ss4 * zns * (sz31 + sz33 - 6.0);
|
|
694
|
+
var ses = ss1 * zns * ss5;
|
|
695
|
+
var sis = ss2 * zns * (sz11 + sz13);
|
|
696
|
+
var sls = -zns * ss3 * (sz1 + sz3 - 14.0 - 6.0 * emsq);
|
|
697
|
+
var sghs = ss4 * zns * (sz31 + sz33 - 6.0);
|
|
740
698
|
var shs = -zns * ss2 * (sz21 + sz23);
|
|
741
699
|
// sgp4fix for 180 deg incl
|
|
742
700
|
if (inclm < 5.2359877e-2 || inclm > PI - 5.2359877e-2) {
|
|
@@ -745,12 +703,12 @@ var Sgp4 = /** @class */ (function () {
|
|
|
745
703
|
if (sinim !== 0.0) {
|
|
746
704
|
shs /= sinim;
|
|
747
705
|
}
|
|
748
|
-
sgs = sghs - cosim * shs;
|
|
706
|
+
var sgs = sghs - cosim * shs;
|
|
749
707
|
// ------------------------- do lunar terms ------------------
|
|
750
708
|
dedt = ses + s1 * znl * s5;
|
|
751
709
|
didt = sis + s2 * znl * (z11 + z13);
|
|
752
710
|
dmdt = sls - znl * s3 * (z1 + z3 - 14.0 - 6.0 * emsq);
|
|
753
|
-
sghl = s4 * znl * (z31 + z33 - 6.0);
|
|
711
|
+
var sghl = s4 * znl * (z31 + z33 - 6.0);
|
|
754
712
|
var shll = -znl * s2 * (z21 + z23);
|
|
755
713
|
// sgp4fix for 180 deg incl
|
|
756
714
|
if (inclm < 5.2359877e-2 || inclm > PI - 5.2359877e-2) {
|
|
@@ -763,8 +721,8 @@ var Sgp4 = /** @class */ (function () {
|
|
|
763
721
|
dnodt += shll / sinim;
|
|
764
722
|
}
|
|
765
723
|
// ----------- calculate deep space resonance effects --------
|
|
766
|
-
dndt = 0.0;
|
|
767
|
-
theta = (gsto + tc * rptim) % TAU;
|
|
724
|
+
var dndt = 0.0;
|
|
725
|
+
var theta = (gsto + tc * rptim) % TAU;
|
|
768
726
|
em += dedt * t;
|
|
769
727
|
inclm += didt * t;
|
|
770
728
|
argpm += domdt * t;
|
|
@@ -780,16 +738,17 @@ var Sgp4 = /** @class */ (function () {
|
|
|
780
738
|
// }
|
|
781
739
|
// -------------- initialize the resonance terms -------------
|
|
782
740
|
if (irez !== 0) {
|
|
783
|
-
aonv = Math.pow((nm / xke), x2o3);
|
|
741
|
+
var aonv = Math.pow((nm / xke), x2o3);
|
|
784
742
|
// ---------- geopotential resonance for 12 hour orbits ------
|
|
785
743
|
if (irez === 2) {
|
|
786
|
-
cosisq = cosim * cosim;
|
|
787
|
-
emo = em;
|
|
744
|
+
var cosisq = cosim * cosim;
|
|
745
|
+
var emo = em;
|
|
788
746
|
em = ecco;
|
|
789
|
-
emsqo = emsq;
|
|
747
|
+
var emsqo = emsq;
|
|
790
748
|
emsq = eccsq;
|
|
791
|
-
eoc = em * emsq;
|
|
792
|
-
g201 = -0.306 - (em - 0.64) * 0.44;
|
|
749
|
+
var eoc = em * emsq;
|
|
750
|
+
var g201 = -0.306 - (em - 0.64) * 0.44;
|
|
751
|
+
var g211 = void 0, g310 = void 0, g322 = void 0, g410 = void 0, g422 = void 0, g520 = void 0, g533 = void 0, g521 = void 0, g532 = void 0;
|
|
793
752
|
if (em <= 0.65) {
|
|
794
753
|
g211 = 3.616 - 13.247 * em + 16.29 * emsq;
|
|
795
754
|
g310 = -19.302 + 117.39 * em - 228.419 * emsq + 156.591 * eoc;
|
|
@@ -821,30 +780,24 @@ var Sgp4 = /** @class */ (function () {
|
|
|
821
780
|
g521 = -51752.104 + 218913.95 * em - 309468.16 * emsq + 146349.42 * eoc;
|
|
822
781
|
g532 = -40023.88 + 170470.89 * em - 242699.48 * emsq + 115605.82 * eoc;
|
|
823
782
|
}
|
|
824
|
-
sini2 = sinim * sinim;
|
|
825
|
-
f220 = 0.75 * (1.0 + 2.0 * cosim + cosisq);
|
|
826
|
-
f221 = 1.5 * sini2;
|
|
827
|
-
f321 = 1.875 * sinim * (1.0 - 2.0 * cosim - 3.0 * cosisq);
|
|
828
|
-
f322 = -1.875 * sinim * (1.0 + 2.0 * cosim - 3.0 * cosisq);
|
|
829
|
-
f441 = 35.0 * sini2 * f220;
|
|
830
|
-
f442 = 39.375 * sini2 * sini2;
|
|
831
|
-
f522 =
|
|
832
|
-
9.84375 *
|
|
833
|
-
sinim *
|
|
834
|
-
(sini2 * (1.0 - 2.0 * cosim - 5.0 * cosisq) +
|
|
835
|
-
0.33333333 * (-2.0 + 4.0 * cosim + 6.0 * cosisq));
|
|
836
|
-
f523 =
|
|
783
|
+
var sini2 = sinim * sinim;
|
|
784
|
+
var f220 = 0.75 * (1.0 + 2.0 * cosim + cosisq);
|
|
785
|
+
var f221 = 1.5 * sini2;
|
|
786
|
+
var f321 = 1.875 * sinim * (1.0 - 2.0 * cosim - 3.0 * cosisq);
|
|
787
|
+
var f322 = -1.875 * sinim * (1.0 + 2.0 * cosim - 3.0 * cosisq);
|
|
788
|
+
var f441 = 35.0 * sini2 * f220;
|
|
789
|
+
var f442 = 39.375 * sini2 * sini2;
|
|
790
|
+
var f522 = 9.84375 *
|
|
837
791
|
sinim *
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
f543 =
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
temp = temp1 * root22;
|
|
792
|
+
(sini2 * (1.0 - 2.0 * cosim - 5.0 * cosisq) + 0.33333333 * (-2.0 + 4.0 * cosim + 6.0 * cosisq));
|
|
793
|
+
var f523 = sinim *
|
|
794
|
+
(4.92187512 * sini2 * (-2.0 - 4.0 * cosim + 10.0 * cosisq) + 6.56250012 * (1.0 + 2.0 * cosim - 3.0 * cosisq));
|
|
795
|
+
var f542 = 29.53125 * sinim * (2.0 - 8.0 * cosim + cosisq * (-12.0 + 8.0 * cosim + 10.0 * cosisq));
|
|
796
|
+
var f543 = 29.53125 * sinim * (-2.0 - 8.0 * cosim + cosisq * (12.0 + 8.0 * cosim - 10.0 * cosisq));
|
|
797
|
+
var xno2 = nm * nm;
|
|
798
|
+
var ainv2 = aonv * aonv;
|
|
799
|
+
var temp1 = 3.0 * xno2 * ainv2;
|
|
800
|
+
var temp = temp1 * root22;
|
|
848
801
|
d2201 = temp * f220 * g201;
|
|
849
802
|
d2211 = temp * f221 * g211;
|
|
850
803
|
temp1 *= aonv;
|
|
@@ -869,12 +822,12 @@ var Sgp4 = /** @class */ (function () {
|
|
|
869
822
|
}
|
|
870
823
|
// ---------------- synchronous resonance terms --------------
|
|
871
824
|
if (irez === 1) {
|
|
872
|
-
g200 = 1.0 + emsq * (-2.5 + 0.8125 * emsq);
|
|
873
|
-
g310 = 1.0 + 2.0 * emsq;
|
|
874
|
-
g300 = 1.0 + emsq * (-6.0 + 6.60937 * emsq);
|
|
875
|
-
f220 = 0.75 * (1.0 + cosim) * (1.0 + cosim);
|
|
876
|
-
f311 = 0.9375 * sinim * sinim * (1.0 + 3.0 * cosim) - 0.75 * (1.0 + cosim);
|
|
877
|
-
f330 = 1.0 + cosim;
|
|
825
|
+
var g200 = 1.0 + emsq * (-2.5 + 0.8125 * emsq);
|
|
826
|
+
var g310 = 1.0 + 2.0 * emsq;
|
|
827
|
+
var g300 = 1.0 + emsq * (-6.0 + 6.60937 * emsq);
|
|
828
|
+
var f220 = 0.75 * (1.0 + cosim) * (1.0 + cosim);
|
|
829
|
+
var f311 = 0.9375 * sinim * sinim * (1.0 + 3.0 * cosim) - 0.75 * (1.0 + cosim);
|
|
830
|
+
var f330 = 1.0 + cosim;
|
|
878
831
|
f330 *= 1.875 * f330 * f330;
|
|
879
832
|
del1 = 3.0 * nm * nm * aonv * aonv;
|
|
880
833
|
del2 = 2.0 * del1 * f220 * g200 * q22;
|
|
@@ -995,25 +948,23 @@ var Sgp4 = /** @class */ (function () {
|
|
|
995
948
|
* hoots, schumacher and glover 2004
|
|
996
949
|
* vallado, crawford, hujsak, kelso 2006
|
|
997
950
|
----------------------------------------------------------------------------*/
|
|
998
|
-
Sgp4.dspace = function (
|
|
999
|
-
|
|
1000
|
-
var
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
// stepn = -720.0;
|
|
1013
|
-
// step2 = 259200.0;
|
|
951
|
+
Sgp4.dspace = function (irez, d2201, d2211, d3210, d3222, d4410, d4422, d5220, d5232, d5421, d5433, dedt, del1, del2, del3, didt, dmdt, dnodt, domdt, argpo, argpdot, t, tc, gsto, xfact, xlamo, no, atime, em, argpm, inclm, xli, mm, xni, nodem, nm) {
|
|
952
|
+
/** Ootk -- Some variables imported from outside the class at the top */
|
|
953
|
+
var fasx2 = 0.13130908;
|
|
954
|
+
var fasx4 = 2.8843198;
|
|
955
|
+
var fasx6 = 0.37448087;
|
|
956
|
+
var g22 = 5.7686396;
|
|
957
|
+
var g32 = 0.95240898;
|
|
958
|
+
var g44 = 1.8014998;
|
|
959
|
+
var g52 = 1.050833;
|
|
960
|
+
var g54 = 4.4108898;
|
|
961
|
+
var rptim = 4.37526908801129966e-3; // equates to 7.29211514668855e-5 rad/sec
|
|
962
|
+
var stepp = 720.0;
|
|
963
|
+
var stepn = -720.0;
|
|
964
|
+
var step2 = 259200.0;
|
|
1014
965
|
// ----------- calculate deep space resonance effects -----------
|
|
1015
|
-
dndt = 0.0;
|
|
1016
|
-
theta = (gsto + tc * rptim) % TAU;
|
|
966
|
+
var dndt = 0.0;
|
|
967
|
+
var theta = (gsto + tc * rptim) % TAU;
|
|
1017
968
|
em += dedt * t;
|
|
1018
969
|
inclm += didt * t;
|
|
1019
970
|
argpm += domdt * t;
|
|
@@ -1042,21 +993,21 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1042
993
|
xli = xlamo;
|
|
1043
994
|
}
|
|
1044
995
|
// sgp4fix move check outside loop
|
|
996
|
+
var delt = void 0;
|
|
1045
997
|
if (t > 0.0) {
|
|
1046
998
|
delt = stepp;
|
|
1047
999
|
}
|
|
1048
1000
|
else {
|
|
1049
1001
|
delt = stepn;
|
|
1050
1002
|
}
|
|
1003
|
+
var xndt = void 0, xldot = void 0, xnddt = void 0, xomi = void 0, x2omi = void 0, x2li = void 0, ft = void 0;
|
|
1051
1004
|
var iretn = 381; // added for do loop
|
|
1052
1005
|
while (iretn === 381) {
|
|
1053
1006
|
// ------------------- dot terms calculated -------------
|
|
1054
1007
|
// ----------- near - synchronous resonance terms -------
|
|
1055
1008
|
if (irez !== 2) {
|
|
1056
1009
|
xndt =
|
|
1057
|
-
del1 * Math.sin(xli - fasx2) +
|
|
1058
|
-
del2 * Math.sin(2.0 * (xli - fasx4)) +
|
|
1059
|
-
del3 * Math.sin(3.0 * (xli - fasx6));
|
|
1010
|
+
del1 * Math.sin(xli - fasx2) + del2 * Math.sin(2.0 * (xli - fasx4)) + del3 * Math.sin(3.0 * (xli - fasx6));
|
|
1060
1011
|
xldot = xni + xfact;
|
|
1061
1012
|
xnddt =
|
|
1062
1013
|
del1 * Math.cos(xli - fasx2) +
|
|
@@ -1111,7 +1062,7 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1111
1062
|
}
|
|
1112
1063
|
} // while iretn = 381
|
|
1113
1064
|
nm = xni + xndt * ft + xnddt * ft * ft * 0.5;
|
|
1114
|
-
xl = xli + xldot * ft + xndt * ft * ft * 0.5;
|
|
1065
|
+
var xl = xli + xldot * ft + xndt * ft * ft * 0.5;
|
|
1115
1066
|
if (irez !== 1) {
|
|
1116
1067
|
mm = xl - 2.0 * nodem + 2.0 * theta;
|
|
1117
1068
|
dndt = nm - no;
|
|
@@ -1122,18 +1073,7 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1122
1073
|
}
|
|
1123
1074
|
nm = no + dndt;
|
|
1124
1075
|
}
|
|
1125
|
-
return
|
|
1126
|
-
atime: atime,
|
|
1127
|
-
em: em,
|
|
1128
|
-
argpm: argpm,
|
|
1129
|
-
inclm: inclm,
|
|
1130
|
-
xli: xli,
|
|
1131
|
-
mm: mm,
|
|
1132
|
-
xni: xni,
|
|
1133
|
-
nodem: nodem,
|
|
1134
|
-
dndt: dndt,
|
|
1135
|
-
nm: nm,
|
|
1136
|
-
};
|
|
1076
|
+
return [em, argpm, inclm, mm, nodem, nm];
|
|
1137
1077
|
}; // dspace
|
|
1138
1078
|
/*-----------------------------------------------------------------------------
|
|
1139
1079
|
*
|
|
@@ -1195,50 +1135,51 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1195
1135
|
var opsmode = options.opsmode, ecco = options.ecco, epoch = options.epoch, inclo = options.inclo, xke = options.xke, j2 = options.j2;
|
|
1196
1136
|
var no = options.no;
|
|
1197
1137
|
/* --------------------- local variables ------------------------ */
|
|
1198
|
-
|
|
1138
|
+
var PI = Math.PI;
|
|
1139
|
+
var TAU = PI * 2;
|
|
1140
|
+
var x2o3 = 2.0 / 3.0;
|
|
1199
1141
|
// sgp4fix use old way of finding gst
|
|
1200
|
-
/** Ootk --
|
|
1142
|
+
/** Ootk -- Some variables imported from outside the class at the top */
|
|
1201
1143
|
// ----------------------- earth constants ---------------------
|
|
1202
1144
|
// sgp4fix identify constants and allow alternate values
|
|
1203
1145
|
// only xke and j2 are used here so pass them in directly
|
|
1204
1146
|
// getgravconst( whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2 )
|
|
1205
1147
|
// ------------- calculate auxillary epoch quantities ----------
|
|
1206
|
-
eccsq = ecco * ecco;
|
|
1207
|
-
omeosq = 1.0 - eccsq;
|
|
1208
|
-
rteosq = Math.sqrt(omeosq);
|
|
1209
|
-
cosio = Math.cos(inclo);
|
|
1210
|
-
cosio2 = cosio * cosio;
|
|
1148
|
+
var eccsq = ecco * ecco;
|
|
1149
|
+
var omeosq = 1.0 - eccsq;
|
|
1150
|
+
var rteosq = Math.sqrt(omeosq);
|
|
1151
|
+
var cosio = Math.cos(inclo);
|
|
1152
|
+
var cosio2 = cosio * cosio;
|
|
1211
1153
|
// ------------------ un-kozai the mean motion -----------------
|
|
1212
|
-
ak = Math.pow((xke / no), x2o3);
|
|
1213
|
-
d1 = (0.75 * j2 * (3.0 * cosio2 - 1.0)) / (rteosq * omeosq);
|
|
1154
|
+
var ak = Math.pow((xke / no), x2o3);
|
|
1155
|
+
var d1 = (0.75 * j2 * (3.0 * cosio2 - 1.0)) / (rteosq * omeosq);
|
|
1214
1156
|
var delPrime = d1 / (ak * ak);
|
|
1215
|
-
adel =
|
|
1216
|
-
ak *
|
|
1217
|
-
(1.0 - delPrime * delPrime - delPrime * (1.0 / 3.0 + (134.0 * delPrime * delPrime) / 81.0));
|
|
1157
|
+
var adel = ak * (1.0 - delPrime * delPrime - delPrime * (1.0 / 3.0 + (134.0 * delPrime * delPrime) / 81.0));
|
|
1218
1158
|
delPrime = d1 / (adel * adel);
|
|
1219
1159
|
no = no / (1.0 + delPrime);
|
|
1220
|
-
ao = Math.pow((xke / no), x2o3);
|
|
1221
|
-
sinio = Math.sin(inclo);
|
|
1222
|
-
po = ao * omeosq;
|
|
1223
|
-
con42 = 1.0 - 5.0 * cosio2;
|
|
1224
|
-
con41 = -con42 - cosio2 - cosio2;
|
|
1225
|
-
ainv = 1.0 / ao;
|
|
1226
|
-
posq = po * po;
|
|
1227
|
-
rp = ao * (1.0 - ecco);
|
|
1228
|
-
method = 'n';
|
|
1160
|
+
var ao = Math.pow((xke / no), x2o3);
|
|
1161
|
+
var sinio = Math.sin(inclo);
|
|
1162
|
+
var po = ao * omeosq;
|
|
1163
|
+
var con42 = 1.0 - 5.0 * cosio2;
|
|
1164
|
+
var con41 = -con42 - cosio2 - cosio2;
|
|
1165
|
+
var ainv = 1.0 / ao;
|
|
1166
|
+
var posq = po * po;
|
|
1167
|
+
var rp = ao * (1.0 - ecco);
|
|
1168
|
+
var method = 'n';
|
|
1229
1169
|
// sgp4fix modern approach to finding sidereal time
|
|
1230
1170
|
/** Ootk -- Continue allowing AFSPC mode for SGP4 Validation */
|
|
1171
|
+
var gsto;
|
|
1231
1172
|
if (opsmode == 'a') {
|
|
1232
1173
|
// sgp4fix use old way of finding gst
|
|
1233
1174
|
// count integer number of days from 0 jan 1970
|
|
1234
|
-
ts70 = epoch - 7305.0;
|
|
1235
|
-
ds70 = Math.floor(ts70 + 1.0e-8);
|
|
1236
|
-
tfrac = ts70 - ds70;
|
|
1175
|
+
var ts70 = epoch - 7305.0;
|
|
1176
|
+
var ds70 = Math.floor(ts70 + 1.0e-8);
|
|
1177
|
+
var tfrac = ts70 - ds70;
|
|
1237
1178
|
// find greenwich location at epoch
|
|
1238
|
-
c1 = 1.72027916940703639e-2;
|
|
1239
|
-
thgr70 = 1.7321343856509374;
|
|
1240
|
-
fk5r = 5.07551419432269442e-15;
|
|
1241
|
-
c1p2p = c1 + TAU;
|
|
1179
|
+
var c1 = 1.72027916940703639e-2;
|
|
1180
|
+
var thgr70 = 1.7321343856509374;
|
|
1181
|
+
var fk5r = 5.07551419432269442e-15;
|
|
1182
|
+
var c1p2p = c1 + TAU;
|
|
1242
1183
|
gsto = (thgr70 + c1 * ds70 + c1p2p * tfrac + ts70 * ts70 * fk5r) % TAU;
|
|
1243
1184
|
/* istanbul ignore next | This is no longer possible*/
|
|
1244
1185
|
if (gsto < 0.0) {
|
|
@@ -1349,14 +1290,11 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1349
1290
|
----------------------------------------------------------------------------*/
|
|
1350
1291
|
Sgp4.sgp4init = function (satrec, options) {
|
|
1351
1292
|
/* eslint-disable no-param-reassign */
|
|
1352
|
-
var _a = options.whichconst, whichconst = _a === void 0 ? 'wgs72' : _a, _b = options.opsmode, opsmode = _b === void 0 ? i : _b, _c = options.satn, satn = _c === void 0 ? satrec.satnum : _c, epoch = options.epoch, xbstar = options.xbstar, xecco = options.xecco, xargpo = options.xargpo, xinclo = options.xinclo, xndot = options.xndot, xnddot = options.xnddot, xmo = options.xmo, xno = options.xno, xnodeo = options.xnodeo;
|
|
1353
|
-
/* --------------------- local variables ------------------------ */
|
|
1354
|
-
/** Ootk -- Declared at the top of the file */
|
|
1293
|
+
var _a = options.whichconst, whichconst = _a === void 0 ? 'wgs72' : _a, _b = options.opsmode, opsmode = _b === void 0 ? 'i' : _b, _c = options.satn, satn = _c === void 0 ? satrec.satnum : _c, epoch = options.epoch, xbstar = options.xbstar, xecco = options.xecco, xargpo = options.xargpo, xinclo = options.xinclo, xndot = options.xndot, xnddot = options.xnddot, xmo = options.xmo, xno = options.xno, xnodeo = options.xnodeo;
|
|
1355
1294
|
/* ------------------------ initialization --------------------- */
|
|
1356
1295
|
// sgp4fix divisor for divide by zero check on inclination
|
|
1357
1296
|
// the old check used 1.0 + Math.cos(PI-1.0e-9), but then compared it to
|
|
1358
1297
|
// 1.5 e-12, so the threshold was changed to 1.5e-12 for consistency
|
|
1359
|
-
// temp4 = 1.5e-12;
|
|
1360
1298
|
// ----------- set all near earth variables to zero ------------
|
|
1361
1299
|
satrec.isimp = 0;
|
|
1362
1300
|
satrec.method = 'n';
|
|
@@ -1454,6 +1392,10 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1454
1392
|
satrec.j3 = gravResults.j3;
|
|
1455
1393
|
satrec.j4 = gravResults.j4;
|
|
1456
1394
|
satrec.j3oj2 = gravResults.j3oj2;
|
|
1395
|
+
var j2 = gravResults.j2;
|
|
1396
|
+
var j4 = gravResults.j4;
|
|
1397
|
+
var xke = gravResults.xke;
|
|
1398
|
+
var j3oj2 = gravResults.j3oj2;
|
|
1457
1399
|
//-------------------------------------------------------------------------
|
|
1458
1400
|
satrec.error = 0;
|
|
1459
1401
|
satrec.operationmode = opsmode;
|
|
@@ -1462,8 +1404,8 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1462
1404
|
* Ex. A2525 = 102525
|
|
1463
1405
|
* Ex. Z1234 = 351234
|
|
1464
1406
|
*/
|
|
1465
|
-
leadingChar = satn.split('')[0].toLowerCase(); // Using uppercase will break the -96 math.
|
|
1466
|
-
if (isNaN(leadingChar)) {
|
|
1407
|
+
var leadingChar = satn.split('')[0].toLowerCase(); // Using uppercase will break the -96 math.
|
|
1408
|
+
if (isNaN(parseInt(leadingChar))) {
|
|
1467
1409
|
satrec.satnum = parseInt(leadingChar.charCodeAt(0) - 96 + 9 + satrec.satnum.slice(1, 5)).toString();
|
|
1468
1410
|
}
|
|
1469
1411
|
else {
|
|
@@ -1489,14 +1431,14 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1489
1431
|
// ------------------------ earth constants -----------------------
|
|
1490
1432
|
// sgp4fix identify constants and allow alternate values
|
|
1491
1433
|
// getgravconst( whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2 );
|
|
1492
|
-
ss = 78.0 / satrec.radiusearthkm + 1.0;
|
|
1434
|
+
var ss = 78.0 / satrec.radiusearthkm + 1.0;
|
|
1493
1435
|
// sgp4fix use multiply for speed instead of pow
|
|
1494
|
-
qzms2ttemp = (120.0 - 78.0) / satrec.radiusearthkm;
|
|
1495
|
-
qzms2t = qzms2ttemp * qzms2ttemp * qzms2ttemp * qzms2ttemp;
|
|
1436
|
+
var qzms2ttemp = (120.0 - 78.0) / satrec.radiusearthkm;
|
|
1437
|
+
var qzms2t = qzms2ttemp * qzms2ttemp * qzms2ttemp * qzms2ttemp;
|
|
1496
1438
|
satrec.init = 'y';
|
|
1497
1439
|
satrec.t = 0.0;
|
|
1498
1440
|
// sgp4fix remove satn as it is not needed in initl
|
|
1499
|
-
initlOptions = {
|
|
1441
|
+
var initlOptions = {
|
|
1500
1442
|
ecco: satrec.ecco,
|
|
1501
1443
|
epoch: epoch,
|
|
1502
1444
|
inclo: satrec.inclo,
|
|
@@ -1506,7 +1448,7 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1506
1448
|
xke: satrec.xke,
|
|
1507
1449
|
j2: satrec.j2,
|
|
1508
1450
|
};
|
|
1509
|
-
initlResult = Sgp4.initl(initlOptions);
|
|
1451
|
+
var initlResult = Sgp4.initl(initlOptions);
|
|
1510
1452
|
var ao = initlResult.ao, con42 = initlResult.con42, cosio = initlResult.cosio, cosio2 = initlResult.cosio2, eccsq = initlResult.eccsq, omeosq = initlResult.omeosq, posq = initlResult.posq, rp = initlResult.rp, rteosq = initlResult.rteosq, sinio = initlResult.sinio;
|
|
1511
1453
|
satrec.no = initlResult.no;
|
|
1512
1454
|
satrec.con41 = initlResult.con41;
|
|
@@ -1528,9 +1470,9 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1528
1470
|
if (rp < 220.0 / satrec.radiusearthkm + 1.0) {
|
|
1529
1471
|
satrec.isimp = 1;
|
|
1530
1472
|
}
|
|
1531
|
-
sfour = ss;
|
|
1532
|
-
qzms24 = qzms2t;
|
|
1533
|
-
perige = (rp - 1.0) * satrec.radiusearthkm;
|
|
1473
|
+
var sfour = ss;
|
|
1474
|
+
var qzms24 = qzms2t;
|
|
1475
|
+
var perige = (rp - 1.0) * satrec.radiusearthkm;
|
|
1534
1476
|
// - for perigees below 156 km, s and qoms2t are altered -
|
|
1535
1477
|
if (perige < 156.0) {
|
|
1536
1478
|
sfour = perige - 78.0;
|
|
@@ -1538,25 +1480,24 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1538
1480
|
sfour = 20.0;
|
|
1539
1481
|
}
|
|
1540
1482
|
// sgp4fix use multiply for speed instead of pow
|
|
1541
|
-
qzms24temp = (120.0 - sfour) / satrec.radiusearthkm;
|
|
1483
|
+
var qzms24temp = (120.0 - sfour) / satrec.radiusearthkm;
|
|
1542
1484
|
qzms24 = qzms24temp * qzms24temp * qzms24temp * qzms24temp;
|
|
1543
1485
|
sfour = sfour / satrec.radiusearthkm + 1.0;
|
|
1544
1486
|
}
|
|
1545
|
-
PInvsq = 1.0 / posq;
|
|
1546
|
-
tsi = 1.0 / (ao - sfour);
|
|
1487
|
+
var PInvsq = 1.0 / posq;
|
|
1488
|
+
var tsi = 1.0 / (ao - sfour);
|
|
1547
1489
|
satrec.eta = ao * satrec.ecco * tsi;
|
|
1548
|
-
etasq = satrec.eta * satrec.eta;
|
|
1549
|
-
eeta = satrec.ecco * satrec.eta;
|
|
1550
|
-
psisq = Math.abs(1.0 - etasq);
|
|
1551
|
-
coef = qzms24 * Math.pow(tsi, 4.0);
|
|
1552
|
-
coef1 = coef / Math.pow(psisq, 3.5);
|
|
1553
|
-
cc2 =
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
(
|
|
1557
|
-
((0.375 * j2 * tsi) / psisq) * satrec.con41 * (8.0 + 3.0 * etasq * (8.0 + etasq)));
|
|
1490
|
+
var etasq = satrec.eta * satrec.eta;
|
|
1491
|
+
var eeta = satrec.ecco * satrec.eta;
|
|
1492
|
+
var psisq = Math.abs(1.0 - etasq);
|
|
1493
|
+
var coef = qzms24 * Math.pow(tsi, 4.0);
|
|
1494
|
+
var coef1 = coef / Math.pow(psisq, 3.5);
|
|
1495
|
+
var cc2 = coef1 *
|
|
1496
|
+
satrec.no *
|
|
1497
|
+
(ao * (1.0 + 1.5 * etasq + eeta * (4.0 + etasq)) +
|
|
1498
|
+
((0.375 * j2 * tsi) / psisq) * satrec.con41 * (8.0 + 3.0 * etasq * (8.0 + etasq)));
|
|
1558
1499
|
satrec.cc1 = satrec.bstar * cc2;
|
|
1559
|
-
cc3 = 0.0;
|
|
1500
|
+
var cc3 = 0.0;
|
|
1560
1501
|
if (satrec.ecco > 1.0e-4) {
|
|
1561
1502
|
cc3 = (-2.0 * coef * tsi * j3oj2 * satrec.no * sinio) / satrec.ecco;
|
|
1562
1503
|
}
|
|
@@ -1571,15 +1512,12 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1571
1512
|
satrec.ecco * (0.5 + 2.0 * etasq) -
|
|
1572
1513
|
((j2 * tsi) / (ao * psisq)) *
|
|
1573
1514
|
(-3.0 * satrec.con41 * (1.0 - 2.0 * eeta + etasq * (1.5 - 0.5 * eeta)) +
|
|
1574
|
-
0.75 *
|
|
1575
|
-
satrec.x1mth2 *
|
|
1576
|
-
(2.0 * etasq - eeta * (1.0 + etasq)) *
|
|
1577
|
-
Math.cos(2.0 * satrec.argpo)));
|
|
1515
|
+
0.75 * satrec.x1mth2 * (2.0 * etasq - eeta * (1.0 + etasq)) * Math.cos(2.0 * satrec.argpo)));
|
|
1578
1516
|
satrec.cc5 = 2.0 * coef1 * ao * omeosq * (1.0 + 2.75 * (etasq + eeta) + eeta * etasq);
|
|
1579
|
-
cosio4 = cosio2 * cosio2;
|
|
1580
|
-
temp1 = 1.5 * j2 * PInvsq * satrec.no;
|
|
1581
|
-
temp2 = 0.5 * temp1 * j2 * PInvsq;
|
|
1582
|
-
temp3 = -0.46875 * j4 * PInvsq * PInvsq * satrec.no;
|
|
1517
|
+
var cosio4 = cosio2 * cosio2;
|
|
1518
|
+
var temp1 = 1.5 * j2 * PInvsq * satrec.no;
|
|
1519
|
+
var temp2 = 0.5 * temp1 * j2 * PInvsq;
|
|
1520
|
+
var temp3 = -0.46875 * j4 * PInvsq * PInvsq * satrec.no;
|
|
1583
1521
|
satrec.mdot =
|
|
1584
1522
|
satrec.no +
|
|
1585
1523
|
0.5 * temp1 * rteosq * satrec.con41 +
|
|
@@ -1588,10 +1526,9 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1588
1526
|
-0.5 * temp1 * con42 +
|
|
1589
1527
|
0.0625 * temp2 * (7.0 - 114.0 * cosio2 + 395.0 * cosio4) +
|
|
1590
1528
|
temp3 * (3.0 - 36.0 * cosio2 + 49.0 * cosio4);
|
|
1591
|
-
xhdot1 = -temp1 * cosio;
|
|
1592
|
-
satrec.nodedot =
|
|
1593
|
-
|
|
1594
|
-
xPIdot = satrec.argpdot + satrec.nodedot;
|
|
1529
|
+
var xhdot1 = -temp1 * cosio;
|
|
1530
|
+
satrec.nodedot = xhdot1 + (0.5 * temp2 * (4.0 - 19.0 * cosio2) + 2.0 * temp3 * (3.0 - 7.0 * cosio2)) * cosio;
|
|
1531
|
+
var xPIdot = satrec.argpdot + satrec.nodedot;
|
|
1595
1532
|
satrec.omgcof = satrec.bstar * cc3 * Math.cos(satrec.argpo);
|
|
1596
1533
|
satrec.xmcof = 0.0;
|
|
1597
1534
|
if (satrec.ecco > 1.0e-4) {
|
|
@@ -1608,7 +1545,7 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1608
1545
|
}
|
|
1609
1546
|
satrec.aycof = -0.5 * j3oj2 * sinio;
|
|
1610
1547
|
// sgp4fix use multiply for speed instead of pow
|
|
1611
|
-
delmotemp = 1.0 + satrec.eta * Math.cos(satrec.mo);
|
|
1548
|
+
var delmotemp = 1.0 + satrec.eta * Math.cos(satrec.mo);
|
|
1612
1549
|
satrec.delmo = delmotemp * delmotemp * delmotemp;
|
|
1613
1550
|
satrec.sinmao = Math.sin(satrec.mo);
|
|
1614
1551
|
satrec.x7thm1 = 7.0 * cosio2 - 1.0;
|
|
@@ -1616,9 +1553,9 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1616
1553
|
if (TAU / satrec.no >= 225.0) {
|
|
1617
1554
|
satrec.method = 'd';
|
|
1618
1555
|
satrec.isimp = 1;
|
|
1619
|
-
tc = 0.0;
|
|
1620
|
-
inclm = satrec.inclo;
|
|
1621
|
-
dscomOptions = {
|
|
1556
|
+
var tc = 0.0;
|
|
1557
|
+
var inclm = satrec.inclo;
|
|
1558
|
+
var dscomOptions = {
|
|
1622
1559
|
epoch: epoch,
|
|
1623
1560
|
ep: satrec.ecco,
|
|
1624
1561
|
argpp: satrec.argpo,
|
|
@@ -1658,7 +1595,7 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1658
1595
|
zmol: satrec.zmol,
|
|
1659
1596
|
zmos: satrec.zmos,
|
|
1660
1597
|
};
|
|
1661
|
-
dscomResult = Sgp4.dscom(dscomOptions);
|
|
1598
|
+
var dscomResult = Sgp4.dscom(dscomOptions);
|
|
1662
1599
|
satrec.e3 = dscomResult.e3;
|
|
1663
1600
|
satrec.ee2 = dscomResult.ee2;
|
|
1664
1601
|
satrec.peo = dscomResult.peo;
|
|
@@ -1678,7 +1615,7 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1678
1615
|
satrec.sl2 = dscomResult.sl2;
|
|
1679
1616
|
satrec.sl3 = dscomResult.sl3;
|
|
1680
1617
|
satrec.sl4 = dscomResult.sl4;
|
|
1681
|
-
var
|
|
1618
|
+
var sinim = dscomResult.sinim, cosim = dscomResult.cosim, em = dscomResult.em, emsq = dscomResult.emsq, s1 = dscomResult.s1, s2 = dscomResult.s2, s3 = dscomResult.s3, s4 = dscomResult.s4, s5 = dscomResult.s5, ss1 = dscomResult.ss1, ss2 = dscomResult.ss2, ss3 = dscomResult.ss3, ss4 = dscomResult.ss4, ss5 = dscomResult.ss5, sz1 = dscomResult.sz1, sz3 = dscomResult.sz3, sz11 = dscomResult.sz11, sz13 = dscomResult.sz13, sz21 = dscomResult.sz21, sz23 = dscomResult.sz23, sz31 = dscomResult.sz31, sz33 = dscomResult.sz33;
|
|
1682
1619
|
satrec.xgh2 = dscomResult.xgh2;
|
|
1683
1620
|
satrec.xgh3 = dscomResult.xgh3;
|
|
1684
1621
|
satrec.xgh4 = dscomResult.xgh4;
|
|
@@ -1691,8 +1628,8 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1691
1628
|
satrec.xl4 = dscomResult.xl4;
|
|
1692
1629
|
satrec.zmol = dscomResult.zmol;
|
|
1693
1630
|
satrec.zmos = dscomResult.zmos;
|
|
1694
|
-
|
|
1695
|
-
dpperOptions = {
|
|
1631
|
+
var nm = dscomResult.nm, z1 = dscomResult.z1, z3 = dscomResult.z3, z11 = dscomResult.z11, z13 = dscomResult.z13, z21 = dscomResult.z21, z23 = dscomResult.z23, z31 = dscomResult.z31, z33 = dscomResult.z33;
|
|
1632
|
+
var dpperOptions = {
|
|
1696
1633
|
inclo: inclm,
|
|
1697
1634
|
init: satrec.init,
|
|
1698
1635
|
ep: satrec.ecco,
|
|
@@ -1702,39 +1639,39 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1702
1639
|
mp: satrec.mo,
|
|
1703
1640
|
opsmode: satrec.operationmode,
|
|
1704
1641
|
};
|
|
1705
|
-
dpperResult = Sgp4.dpper(satrec, dpperOptions);
|
|
1642
|
+
var dpperResult = Sgp4.dpper(satrec, dpperOptions);
|
|
1706
1643
|
satrec.ecco = dpperResult.ep;
|
|
1707
1644
|
satrec.inclo = dpperResult.inclp;
|
|
1708
1645
|
satrec.nodeo = dpperResult.nodep;
|
|
1709
1646
|
satrec.argpo = dpperResult.argpp;
|
|
1710
1647
|
satrec.mo = dpperResult.mp;
|
|
1711
|
-
argpm = 0.0;
|
|
1712
|
-
nodem = 0.0;
|
|
1713
|
-
mm = 0.0;
|
|
1714
|
-
dsinitOptions = {
|
|
1648
|
+
var argpm = 0.0;
|
|
1649
|
+
var nodem = 0.0;
|
|
1650
|
+
var mm = 0.0;
|
|
1651
|
+
var dsinitOptions = {
|
|
1715
1652
|
xke: xke,
|
|
1716
|
-
cosim:
|
|
1717
|
-
emsq:
|
|
1653
|
+
cosim: cosim,
|
|
1654
|
+
emsq: emsq,
|
|
1718
1655
|
argpo: satrec.argpo,
|
|
1719
|
-
s1:
|
|
1720
|
-
s2:
|
|
1721
|
-
s3:
|
|
1722
|
-
s4:
|
|
1723
|
-
s5:
|
|
1724
|
-
sinim:
|
|
1725
|
-
ss1:
|
|
1726
|
-
ss2:
|
|
1727
|
-
ss3:
|
|
1728
|
-
ss4:
|
|
1729
|
-
ss5:
|
|
1730
|
-
sz1:
|
|
1731
|
-
sz3:
|
|
1732
|
-
sz11:
|
|
1733
|
-
sz13:
|
|
1734
|
-
sz21:
|
|
1735
|
-
sz23:
|
|
1736
|
-
sz31:
|
|
1737
|
-
sz33:
|
|
1656
|
+
s1: s1,
|
|
1657
|
+
s2: s2,
|
|
1658
|
+
s3: s3,
|
|
1659
|
+
s4: s4,
|
|
1660
|
+
s5: s5,
|
|
1661
|
+
sinim: sinim,
|
|
1662
|
+
ss1: ss1,
|
|
1663
|
+
ss2: ss2,
|
|
1664
|
+
ss3: ss3,
|
|
1665
|
+
ss4: ss4,
|
|
1666
|
+
ss5: ss5,
|
|
1667
|
+
sz1: sz1,
|
|
1668
|
+
sz3: sz3,
|
|
1669
|
+
sz11: sz11,
|
|
1670
|
+
sz13: sz13,
|
|
1671
|
+
sz21: sz21,
|
|
1672
|
+
sz23: sz23,
|
|
1673
|
+
sz31: sz31,
|
|
1674
|
+
sz33: sz33,
|
|
1738
1675
|
t: satrec.t,
|
|
1739
1676
|
tc: tc,
|
|
1740
1677
|
gsto: satrec.gsto,
|
|
@@ -1754,7 +1691,7 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1754
1691
|
z33: z33,
|
|
1755
1692
|
ecco: satrec.ecco,
|
|
1756
1693
|
eccsq: eccsq,
|
|
1757
|
-
em:
|
|
1694
|
+
em: em,
|
|
1758
1695
|
argpm: argpm,
|
|
1759
1696
|
inclm: inclm,
|
|
1760
1697
|
mm: mm,
|
|
@@ -1785,7 +1722,7 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1785
1722
|
xli: satrec.xli,
|
|
1786
1723
|
xni: satrec.xni,
|
|
1787
1724
|
};
|
|
1788
|
-
dsinitResult = Sgp4.dsinit(dsinitOptions);
|
|
1725
|
+
var dsinitResult = Sgp4.dsinit(dsinitOptions);
|
|
1789
1726
|
satrec.irez = dsinitResult.irez;
|
|
1790
1727
|
satrec.atime = dsinitResult.atime;
|
|
1791
1728
|
satrec.d2201 = dsinitResult.d2201;
|
|
@@ -1813,9 +1750,9 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1813
1750
|
}
|
|
1814
1751
|
// ----------- set variables if not deep space -----------
|
|
1815
1752
|
if (satrec.isimp !== 1) {
|
|
1816
|
-
cc1sq = satrec.cc1 * satrec.cc1;
|
|
1753
|
+
var cc1sq = satrec.cc1 * satrec.cc1;
|
|
1817
1754
|
satrec.d2 = 4.0 * ao * tsi * cc1sq;
|
|
1818
|
-
temp = (satrec.d2 * tsi * satrec.cc1) / 3.0;
|
|
1755
|
+
var temp = (satrec.d2 * tsi * satrec.cc1) / 3.0;
|
|
1819
1756
|
satrec.d3 = (17.0 * ao + sfour) * temp;
|
|
1820
1757
|
satrec.d4 = 0.5 * temp * ao * tsi * (221.0 * ao + 31.0 * sfour) * satrec.cc1;
|
|
1821
1758
|
satrec.t3cof = satrec.d2 + 2.0 * cc1sq;
|
|
@@ -1927,84 +1864,45 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1927
1864
|
// sgp4fix divisor for divide by zero check on inclination
|
|
1928
1865
|
// the old check used 1.0 + cos(PI-1.0e-9), but then compared it to
|
|
1929
1866
|
// 1.5 e-12, so the threshold was changed to 1.5e-12 for consistency
|
|
1930
|
-
/** Ootk -- Declared at the top of the page */
|
|
1931
|
-
// temp4 = 1.5e-12;
|
|
1932
1867
|
// sgp4fix identify constants and allow alternate values
|
|
1933
1868
|
// getgravconst( whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2 );
|
|
1934
|
-
|
|
1869
|
+
var xke = satrec.xke, j2 = satrec.j2, j3oj2 = satrec.j3oj2;
|
|
1870
|
+
var vkmpersec = (satrec.radiusearthkm * satrec.xke) / 60.0;
|
|
1935
1871
|
// --------------------- clear sgp4 error flag -----------------
|
|
1936
1872
|
satrec.t = tsince;
|
|
1937
1873
|
satrec.error = 0;
|
|
1938
1874
|
// ------- update for secular gravity and atmospheric drag -----
|
|
1939
|
-
xmdf = satrec.mo + satrec.mdot * satrec.t;
|
|
1940
|
-
argpdf = satrec.argpo + satrec.argpdot * satrec.t;
|
|
1941
|
-
nodedf = satrec.nodeo + satrec.nodedot * satrec.t;
|
|
1942
|
-
argpm = argpdf;
|
|
1943
|
-
mm = xmdf;
|
|
1944
|
-
t2 = satrec.t * satrec.t;
|
|
1945
|
-
nodem = nodedf + satrec.nodecf * t2;
|
|
1946
|
-
tempa = 1.0 - satrec.cc1 * satrec.t;
|
|
1947
|
-
tempe = satrec.bstar * satrec.cc4 * satrec.t;
|
|
1948
|
-
templ = satrec.t2cof * t2;
|
|
1875
|
+
var xmdf = satrec.mo + satrec.mdot * satrec.t;
|
|
1876
|
+
var argpdf = satrec.argpo + satrec.argpdot * satrec.t;
|
|
1877
|
+
var nodedf = satrec.nodeo + satrec.nodedot * satrec.t;
|
|
1878
|
+
var argpm = argpdf;
|
|
1879
|
+
var mm = xmdf;
|
|
1880
|
+
var t2 = satrec.t * satrec.t;
|
|
1881
|
+
var nodem = nodedf + satrec.nodecf * t2;
|
|
1882
|
+
var tempa = 1.0 - satrec.cc1 * satrec.t;
|
|
1883
|
+
var tempe = satrec.bstar * satrec.cc4 * satrec.t;
|
|
1884
|
+
var templ = satrec.t2cof * t2;
|
|
1949
1885
|
if (satrec.isimp !== 1) {
|
|
1950
|
-
delomg = satrec.omgcof * satrec.t;
|
|
1886
|
+
var delomg = satrec.omgcof * satrec.t;
|
|
1951
1887
|
// sgp4fix use mutliply for speed instead of pow
|
|
1952
|
-
delmtemp = 1.0 + satrec.eta * Math.cos(xmdf);
|
|
1953
|
-
delm = satrec.xmcof * (delmtemp * delmtemp * delmtemp - satrec.delmo);
|
|
1954
|
-
|
|
1955
|
-
mm = xmdf +
|
|
1956
|
-
argpm = argpdf -
|
|
1957
|
-
t3 = t2 * satrec.t;
|
|
1958
|
-
t4 = t3 * satrec.t;
|
|
1888
|
+
var delmtemp = 1.0 + satrec.eta * Math.cos(xmdf);
|
|
1889
|
+
var delm = satrec.xmcof * (delmtemp * delmtemp * delmtemp - satrec.delmo);
|
|
1890
|
+
var temp_1 = delomg + delm;
|
|
1891
|
+
mm = xmdf + temp_1;
|
|
1892
|
+
argpm = argpdf - temp_1;
|
|
1893
|
+
var t3 = t2 * satrec.t;
|
|
1894
|
+
var t4 = t3 * satrec.t;
|
|
1959
1895
|
tempa = tempa - satrec.d2 * t2 - satrec.d3 * t3 - satrec.d4 * t4;
|
|
1960
1896
|
tempe += satrec.bstar * satrec.cc5 * (Math.sin(mm) - satrec.sinmao);
|
|
1961
1897
|
templ = templ + satrec.t3cof * t3 + t4 * (satrec.t4cof + satrec.t * satrec.t5cof);
|
|
1962
1898
|
}
|
|
1963
|
-
nm = satrec.no;
|
|
1964
|
-
em = satrec.ecco;
|
|
1965
|
-
inclm = satrec.inclo;
|
|
1899
|
+
var nm = satrec.no;
|
|
1900
|
+
var em = satrec.ecco;
|
|
1901
|
+
var inclm = satrec.inclo;
|
|
1966
1902
|
if (satrec.method === 'd') {
|
|
1967
|
-
tc = satrec.t;
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
d2201: satrec.d2201,
|
|
1971
|
-
d2211: satrec.d2211,
|
|
1972
|
-
d3210: satrec.d3210,
|
|
1973
|
-
d3222: satrec.d3222,
|
|
1974
|
-
d4410: satrec.d4410,
|
|
1975
|
-
d4422: satrec.d4422,
|
|
1976
|
-
d5220: satrec.d5220,
|
|
1977
|
-
d5232: satrec.d5232,
|
|
1978
|
-
d5421: satrec.d5421,
|
|
1979
|
-
d5433: satrec.d5433,
|
|
1980
|
-
dedt: satrec.dedt,
|
|
1981
|
-
del1: satrec.del1,
|
|
1982
|
-
del2: satrec.del2,
|
|
1983
|
-
del3: satrec.del3,
|
|
1984
|
-
didt: satrec.didt,
|
|
1985
|
-
dmdt: satrec.dmdt,
|
|
1986
|
-
dnodt: satrec.dnodt,
|
|
1987
|
-
domdt: satrec.domdt,
|
|
1988
|
-
argpo: satrec.argpo,
|
|
1989
|
-
argpdot: satrec.argpdot,
|
|
1990
|
-
t: satrec.t,
|
|
1991
|
-
tc: tc,
|
|
1992
|
-
gsto: satrec.gsto,
|
|
1993
|
-
xfact: satrec.xfact,
|
|
1994
|
-
xlamo: satrec.xlamo,
|
|
1995
|
-
no: satrec.no,
|
|
1996
|
-
atime: satrec.atime,
|
|
1997
|
-
em: em,
|
|
1998
|
-
argpm: argpm,
|
|
1999
|
-
inclm: inclm,
|
|
2000
|
-
xli: satrec.xli,
|
|
2001
|
-
mm: mm,
|
|
2002
|
-
xni: satrec.xni,
|
|
2003
|
-
nodem: nodem,
|
|
2004
|
-
nm: nm,
|
|
2005
|
-
};
|
|
2006
|
-
dspaceResult = Sgp4.dspace(dspaceOptions);
|
|
2007
|
-
(em = dspaceResult.em, argpm = dspaceResult.argpm, inclm = dspaceResult.inclm, mm = dspaceResult.mm, nodem = dspaceResult.nodem, nm = dspaceResult.nm);
|
|
1903
|
+
var tc = satrec.t;
|
|
1904
|
+
var dspaceResult = Sgp4.dspace(satrec.irez, satrec.d2201, satrec.d2211, satrec.d3210, satrec.d3222, satrec.d4410, satrec.d4422, satrec.d5220, satrec.d5232, satrec.d5421, satrec.d5433, satrec.dedt, satrec.del1, satrec.del2, satrec.del3, satrec.didt, satrec.dmdt, satrec.dnodt, satrec.domdt, satrec.argpo, satrec.argpdot, satrec.t, tc, satrec.gsto, satrec.xfact, satrec.xlamo, satrec.no, satrec.atime, em, argpm, inclm, satrec.xli, mm, satrec.xni, nodem, nm);
|
|
1905
|
+
em = dspaceResult[0], argpm = dspaceResult[1], inclm = dspaceResult[2], mm = dspaceResult[3], nodem = dspaceResult[4], nm = dspaceResult[5];
|
|
2008
1906
|
} // if methjod = d
|
|
2009
1907
|
if (nm <= 0.0) {
|
|
2010
1908
|
// printf("// error nm %f\n", nm);
|
|
@@ -2012,7 +1910,7 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2012
1910
|
// sgp4fix add return
|
|
2013
1911
|
return { position: false, velocity: false };
|
|
2014
1912
|
}
|
|
2015
|
-
am = Math.pow((xke / nm), x2o3) * tempa * tempa;
|
|
1913
|
+
var am = Math.pow((xke / nm), x2o3) * tempa * tempa;
|
|
2016
1914
|
nm = xke / Math.pow(am, 1.5);
|
|
2017
1915
|
em -= tempe;
|
|
2018
1916
|
// fix tolerance for error recognition
|
|
@@ -2030,32 +1928,33 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2030
1928
|
em = 1.0e-6;
|
|
2031
1929
|
}
|
|
2032
1930
|
mm += satrec.no * templ;
|
|
2033
|
-
xlm = mm + argpm + nodem;
|
|
1931
|
+
var xlm = mm + argpm + nodem;
|
|
2034
1932
|
nodem %= TAU;
|
|
2035
1933
|
argpm %= TAU;
|
|
2036
1934
|
xlm %= TAU;
|
|
2037
1935
|
mm = (xlm - argpm - nodem) % TAU;
|
|
2038
1936
|
// sgp4fix recover singly averaged mean elements
|
|
2039
|
-
|
|
2040
|
-
satrec.
|
|
2041
|
-
satrec.
|
|
2042
|
-
satrec.
|
|
2043
|
-
satrec.
|
|
2044
|
-
satrec.
|
|
2045
|
-
satrec.
|
|
1937
|
+
// TODO: Skip these?
|
|
1938
|
+
// satrec.am = am;
|
|
1939
|
+
// satrec.em = em;
|
|
1940
|
+
// satrec.im = inclm;
|
|
1941
|
+
// satrec.Om = nodem;
|
|
1942
|
+
// satrec.om = argpm;
|
|
1943
|
+
// satrec.mm = mm;
|
|
1944
|
+
// satrec.nm = nm;
|
|
2046
1945
|
// ----------------- compute extra mean quantities -------------
|
|
2047
|
-
sinim = Math.sin(inclm);
|
|
2048
|
-
cosim = Math.cos(inclm);
|
|
1946
|
+
var sinim = Math.sin(inclm);
|
|
1947
|
+
var cosim = Math.cos(inclm);
|
|
2049
1948
|
// -------------------- add lunar-solar periodics --------------
|
|
2050
|
-
ep = em;
|
|
2051
|
-
xincp = inclm;
|
|
2052
|
-
argpp = argpm;
|
|
2053
|
-
nodep = nodem;
|
|
2054
|
-
mp = mm;
|
|
2055
|
-
sinip = sinim;
|
|
2056
|
-
cosip = cosim;
|
|
1949
|
+
var ep = em;
|
|
1950
|
+
var xincp = inclm;
|
|
1951
|
+
var argpp = argpm;
|
|
1952
|
+
var nodep = nodem;
|
|
1953
|
+
var mp = mm;
|
|
1954
|
+
var sinip = sinim;
|
|
1955
|
+
var cosip = cosim;
|
|
2057
1956
|
if (satrec.method === 'd') {
|
|
2058
|
-
dpperParameters = {
|
|
1957
|
+
var dpperParameters = {
|
|
2059
1958
|
inclo: satrec.inclo,
|
|
2060
1959
|
init: 'n',
|
|
2061
1960
|
ep: ep,
|
|
@@ -2065,7 +1964,7 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2065
1964
|
mp: mp,
|
|
2066
1965
|
opsmode: satrec.operationmode,
|
|
2067
1966
|
};
|
|
2068
|
-
dpperResult = Sgp4.dpper(satrec, dpperParameters);
|
|
1967
|
+
var dpperResult = Sgp4.dpper(satrec, dpperParameters);
|
|
2069
1968
|
(ep = dpperResult.ep, nodep = dpperResult.nodep, argpp = dpperResult.argpp, mp = dpperResult.mp);
|
|
2070
1969
|
xincp = dpperResult.inclp;
|
|
2071
1970
|
if (xincp < 0.0) {
|
|
@@ -2094,17 +1993,18 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2094
1993
|
satrec.xlcof = (-0.25 * j3oj2 * sinip * (3.0 + 5.0 * cosip)) / temp4;
|
|
2095
1994
|
}
|
|
2096
1995
|
}
|
|
2097
|
-
axnl = ep * Math.cos(argpp);
|
|
2098
|
-
temp = 1.0 / (am * (1.0 - ep * ep));
|
|
2099
|
-
aynl = ep * Math.sin(argpp) + temp * satrec.aycof;
|
|
2100
|
-
xl = mp + argpp + nodep + temp * satrec.xlcof * axnl;
|
|
1996
|
+
var axnl = ep * Math.cos(argpp);
|
|
1997
|
+
var temp = 1.0 / (am * (1.0 - ep * ep));
|
|
1998
|
+
var aynl = ep * Math.sin(argpp) + temp * satrec.aycof;
|
|
1999
|
+
var xl = mp + argpp + nodep + temp * satrec.xlcof * axnl;
|
|
2101
2000
|
// --------------------- solve kepler's equation ---------------
|
|
2102
|
-
u = (xl - nodep) % TAU;
|
|
2103
|
-
eo1 = u;
|
|
2104
|
-
tem5 = 9999.9;
|
|
2105
|
-
ktr = 1;
|
|
2001
|
+
var u = (xl - nodep) % TAU;
|
|
2002
|
+
var eo1 = u;
|
|
2003
|
+
var tem5 = 9999.9;
|
|
2004
|
+
var ktr = 1;
|
|
2106
2005
|
// sgp4fix for kepler iteration
|
|
2107
2006
|
// the following iteration needs better limits on corrections
|
|
2007
|
+
var sineo1, coseo1;
|
|
2108
2008
|
while (Math.abs(tem5) >= 1.0e-12 && ktr <= 10) {
|
|
2109
2009
|
sineo1 = Math.sin(eo1);
|
|
2110
2010
|
coseo1 = Math.cos(eo1);
|
|
@@ -2122,37 +2022,37 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2122
2022
|
ktr += 1;
|
|
2123
2023
|
}
|
|
2124
2024
|
// ------------- short period preliminary quantities -----------
|
|
2125
|
-
ecose = axnl * coseo1 + aynl * sineo1;
|
|
2126
|
-
esine = axnl * sineo1 - aynl * coseo1;
|
|
2127
|
-
el2 = axnl * axnl + aynl * aynl;
|
|
2128
|
-
pl = am * (1.0 - el2);
|
|
2025
|
+
var ecose = axnl * coseo1 + aynl * sineo1;
|
|
2026
|
+
var esine = axnl * sineo1 - aynl * coseo1;
|
|
2027
|
+
var el2 = axnl * axnl + aynl * aynl;
|
|
2028
|
+
var pl = am * (1.0 - el2);
|
|
2129
2029
|
if (pl < 0.0) {
|
|
2130
2030
|
// printf("// error pl %f\n", pl);
|
|
2131
2031
|
satrec.error = 4;
|
|
2132
2032
|
// sgp4fix add return
|
|
2133
2033
|
return { position: false, velocity: false };
|
|
2134
2034
|
}
|
|
2135
|
-
rl = am * (1.0 - ecose);
|
|
2136
|
-
rdotl = (Math.sqrt(am) * esine) / rl;
|
|
2137
|
-
rvdotl = Math.sqrt(pl) / rl;
|
|
2138
|
-
betal = Math.sqrt(1.0 - el2);
|
|
2035
|
+
var rl = am * (1.0 - ecose);
|
|
2036
|
+
var rdotl = (Math.sqrt(am) * esine) / rl;
|
|
2037
|
+
var rvdotl = Math.sqrt(pl) / rl;
|
|
2038
|
+
var betal = Math.sqrt(1.0 - el2);
|
|
2139
2039
|
temp = esine / (1.0 + betal);
|
|
2140
|
-
sinu = (am / rl) * (sineo1 - aynl - axnl * temp);
|
|
2141
|
-
cosu = (am / rl) * (coseo1 - axnl + aynl * temp);
|
|
2142
|
-
su = Math.atan2(sinu, cosu);
|
|
2143
|
-
sin2u = (cosu + cosu) * sinu;
|
|
2144
|
-
cos2u = 1.0 - 2.0 * sinu * sinu;
|
|
2040
|
+
var sinu = (am / rl) * (sineo1 - aynl - axnl * temp);
|
|
2041
|
+
var cosu = (am / rl) * (coseo1 - axnl + aynl * temp);
|
|
2042
|
+
var su = Math.atan2(sinu, cosu);
|
|
2043
|
+
var sin2u = (cosu + cosu) * sinu;
|
|
2044
|
+
var cos2u = 1.0 - 2.0 * sinu * sinu;
|
|
2145
2045
|
temp = 1.0 / pl;
|
|
2146
|
-
temp1 = 0.5 * j2 * temp;
|
|
2147
|
-
temp2 = temp1 * temp;
|
|
2046
|
+
var temp1 = 0.5 * j2 * temp;
|
|
2047
|
+
var temp2 = temp1 * temp;
|
|
2148
2048
|
// -------------- update for short period periodics ------------
|
|
2149
2049
|
if (satrec.method === 'd') {
|
|
2150
|
-
cosisq = cosip * cosip;
|
|
2050
|
+
var cosisq = cosip * cosip;
|
|
2151
2051
|
satrec.con41 = 3.0 * cosisq - 1.0;
|
|
2152
2052
|
satrec.x1mth2 = 1.0 - cosisq;
|
|
2153
2053
|
satrec.x7thm1 = 7.0 * cosisq - 1.0;
|
|
2154
2054
|
}
|
|
2155
|
-
mrt = rl * (1.0 - 1.5 * temp2 * betal * satrec.con41) + 0.5 * temp1 * satrec.x1mth2 * cos2u;
|
|
2055
|
+
var mrt = rl * (1.0 - 1.5 * temp2 * betal * satrec.con41) + 0.5 * temp1 * satrec.x1mth2 * cos2u;
|
|
2156
2056
|
/** Moved this up to reduce unnecessary computation if you are going to return false anyway */
|
|
2157
2057
|
// sgp4fix for decaying satellites
|
|
2158
2058
|
if (mrt < 1.0) {
|
|
@@ -2164,32 +2064,32 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2164
2064
|
};
|
|
2165
2065
|
}
|
|
2166
2066
|
su -= 0.25 * temp2 * satrec.x7thm1 * sin2u;
|
|
2167
|
-
xnode = nodep + 1.5 * temp2 * cosip * sin2u;
|
|
2168
|
-
xinc = xincp + 1.5 * temp2 * cosip * sinip * cos2u;
|
|
2169
|
-
mvt = rdotl - (nm * temp1 * satrec.x1mth2 * sin2u) / xke;
|
|
2170
|
-
rvdot = rvdotl + (nm * temp1 * (satrec.x1mth2 * cos2u + 1.5 * satrec.con41)) / xke;
|
|
2067
|
+
var xnode = nodep + 1.5 * temp2 * cosip * sin2u;
|
|
2068
|
+
var xinc = xincp + 1.5 * temp2 * cosip * sinip * cos2u;
|
|
2069
|
+
var mvt = rdotl - (nm * temp1 * satrec.x1mth2 * sin2u) / xke;
|
|
2070
|
+
var rvdot = rvdotl + (nm * temp1 * (satrec.x1mth2 * cos2u + 1.5 * satrec.con41)) / xke;
|
|
2171
2071
|
// --------------------- orientation vectors -------------------
|
|
2172
|
-
sinsu = Math.sin(su);
|
|
2173
|
-
cossu = Math.cos(su);
|
|
2174
|
-
snod = Math.sin(xnode);
|
|
2175
|
-
cnod = Math.cos(xnode);
|
|
2176
|
-
sini = Math.sin(xinc);
|
|
2177
|
-
cosi = Math.cos(xinc);
|
|
2178
|
-
xmx = -snod * cosi;
|
|
2179
|
-
xmy = cnod * cosi;
|
|
2180
|
-
ux = xmx * sinsu + cnod * cossu;
|
|
2181
|
-
uy = xmy * sinsu + snod * cossu;
|
|
2182
|
-
uz = sini * sinsu;
|
|
2183
|
-
vx = xmx * cossu - cnod * sinsu;
|
|
2184
|
-
vy = xmy * cossu - snod * sinsu;
|
|
2185
|
-
vz = sini * cossu;
|
|
2072
|
+
var sinsu = Math.sin(su);
|
|
2073
|
+
var cossu = Math.cos(su);
|
|
2074
|
+
var snod = Math.sin(xnode);
|
|
2075
|
+
var cnod = Math.cos(xnode);
|
|
2076
|
+
var sini = Math.sin(xinc);
|
|
2077
|
+
var cosi = Math.cos(xinc);
|
|
2078
|
+
var xmx = -snod * cosi;
|
|
2079
|
+
var xmy = cnod * cosi;
|
|
2080
|
+
var ux = xmx * sinsu + cnod * cossu;
|
|
2081
|
+
var uy = xmy * sinsu + snod * cossu;
|
|
2082
|
+
var uz = sini * sinsu;
|
|
2083
|
+
var vx = xmx * cossu - cnod * sinsu;
|
|
2084
|
+
var vy = xmy * cossu - snod * sinsu;
|
|
2085
|
+
var vz = sini * cossu;
|
|
2186
2086
|
// --------- position and velocity (in km and km/sec) ----------
|
|
2187
|
-
r = {
|
|
2087
|
+
var r = {
|
|
2188
2088
|
x: mrt * ux * satrec.radiusearthkm,
|
|
2189
2089
|
y: mrt * uy * satrec.radiusearthkm,
|
|
2190
2090
|
z: mrt * uz * satrec.radiusearthkm,
|
|
2191
2091
|
};
|
|
2192
|
-
v = {
|
|
2092
|
+
var v = {
|
|
2193
2093
|
x: (mvt * ux + rvdot * vx) * vkmpersec,
|
|
2194
2094
|
y: (mvt * uy + rvdot * vy) * vkmpersec,
|
|
2195
2095
|
z: (mvt * uz + rvdot * vz) * vkmpersec,
|
|
@@ -2229,6 +2129,7 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2229
2129
|
* vallado, crawford, hujsak, kelso 2006
|
|
2230
2130
|
--------------------------------------------------------------------------- */
|
|
2231
2131
|
Sgp4.getgravconst = function (whichconst) {
|
|
2132
|
+
var tumin, mus, radiusearthkm, xke, j2, j3, j4, j3oj2;
|
|
2232
2133
|
switch (whichconst) {
|
|
2233
2134
|
// -- wgs-72 low precision str#3 constants --
|
|
2234
2135
|
case 'wgs72old':
|
|
@@ -2264,7 +2165,7 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2264
2165
|
j3oj2 = j3 / j2;
|
|
2265
2166
|
break;
|
|
2266
2167
|
default:
|
|
2267
|
-
throw new Error("unknown gravity option "
|
|
2168
|
+
throw new Error("unknown gravity option ".concat(whichconst));
|
|
2268
2169
|
}
|
|
2269
2170
|
return {
|
|
2270
2171
|
tumin: tumin,
|
|
@@ -2319,22 +2220,140 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2319
2220
|
Sgp4.createSatrec = function (tleLine1, tleLine2, whichconst, opsmode) {
|
|
2320
2221
|
if (whichconst === void 0) { whichconst = 'wgs72'; }
|
|
2321
2222
|
if (opsmode === void 0) { opsmode = 'i'; }
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2223
|
+
var year = 0;
|
|
2224
|
+
var satrec = {
|
|
2225
|
+
a: null,
|
|
2226
|
+
am: null,
|
|
2227
|
+
alta: null,
|
|
2228
|
+
altp: null,
|
|
2229
|
+
argpdot: null,
|
|
2230
|
+
argpo: null,
|
|
2231
|
+
aycof: null,
|
|
2232
|
+
bstar: null,
|
|
2233
|
+
cc1: null,
|
|
2234
|
+
cc4: null,
|
|
2235
|
+
cc5: null,
|
|
2236
|
+
con41: null,
|
|
2237
|
+
d2: null,
|
|
2238
|
+
d3: null,
|
|
2239
|
+
d4: null,
|
|
2240
|
+
d5232: null,
|
|
2241
|
+
d5421: null,
|
|
2242
|
+
d5433: null,
|
|
2243
|
+
dedt: null,
|
|
2244
|
+
delmo: null,
|
|
2245
|
+
del1: null,
|
|
2246
|
+
ecco: null,
|
|
2247
|
+
em: null,
|
|
2248
|
+
epochdays: null,
|
|
2249
|
+
epochyr: null,
|
|
2250
|
+
error: null,
|
|
2251
|
+
eta: null,
|
|
2252
|
+
gsto: null,
|
|
2253
|
+
im: null,
|
|
2254
|
+
inclo: null,
|
|
2255
|
+
init: null,
|
|
2256
|
+
isimp: null,
|
|
2257
|
+
jdsatepoch: null,
|
|
2258
|
+
mdot: null,
|
|
2259
|
+
method: null,
|
|
2260
|
+
mo: null,
|
|
2261
|
+
mm: null,
|
|
2262
|
+
nddot: null,
|
|
2263
|
+
ndot: null,
|
|
2264
|
+
no: null,
|
|
2265
|
+
nodecf: null,
|
|
2266
|
+
nodedot: null,
|
|
2267
|
+
nodeo: null,
|
|
2268
|
+
om: null,
|
|
2269
|
+
Om: null,
|
|
2270
|
+
omgcof: null,
|
|
2271
|
+
operationmode: null,
|
|
2272
|
+
satnum: null,
|
|
2273
|
+
sinmao: null,
|
|
2274
|
+
t: null,
|
|
2275
|
+
t2cof: null,
|
|
2276
|
+
t3cof: null,
|
|
2277
|
+
t4cof: null,
|
|
2278
|
+
t5cof: null,
|
|
2279
|
+
x1mth2: null,
|
|
2280
|
+
x7thm1: null,
|
|
2281
|
+
xlcof: null,
|
|
2282
|
+
xmcof: null,
|
|
2283
|
+
xfact: null,
|
|
2284
|
+
xlamo: null,
|
|
2285
|
+
xli: null,
|
|
2286
|
+
xgh4: null,
|
|
2287
|
+
xgh3: null,
|
|
2288
|
+
xh2: null,
|
|
2289
|
+
xi2: null,
|
|
2290
|
+
xi3: null,
|
|
2291
|
+
xl2: null,
|
|
2292
|
+
xl3: null,
|
|
2293
|
+
xl4: null,
|
|
2294
|
+
zmol: null,
|
|
2295
|
+
zmos: null,
|
|
2296
|
+
dmdt: null,
|
|
2297
|
+
dnodt: null,
|
|
2298
|
+
domdt: null,
|
|
2299
|
+
e3: null,
|
|
2300
|
+
ee2: null,
|
|
2301
|
+
peo: null,
|
|
2302
|
+
pgho: null,
|
|
2303
|
+
pho: null,
|
|
2304
|
+
PInco: null,
|
|
2305
|
+
plo: null,
|
|
2306
|
+
se2: null,
|
|
2307
|
+
se3: null,
|
|
2308
|
+
sgh2: null,
|
|
2309
|
+
sgh3: null,
|
|
2310
|
+
sgh4: null,
|
|
2311
|
+
sh2: null,
|
|
2312
|
+
sh3: null,
|
|
2313
|
+
si2: null,
|
|
2314
|
+
si3: null,
|
|
2315
|
+
sl2: null,
|
|
2316
|
+
sl3: null,
|
|
2317
|
+
sl4: null,
|
|
2318
|
+
xgh2: null,
|
|
2319
|
+
xh3: null,
|
|
2320
|
+
tumin: null,
|
|
2321
|
+
radiusearthkm: null,
|
|
2322
|
+
irez: null,
|
|
2323
|
+
d3210: null,
|
|
2324
|
+
d3222: null,
|
|
2325
|
+
d4410: null,
|
|
2326
|
+
d4422: null,
|
|
2327
|
+
d5220: null,
|
|
2328
|
+
del2: null,
|
|
2329
|
+
del3: null,
|
|
2330
|
+
didt: null,
|
|
2331
|
+
atime: null,
|
|
2332
|
+
j2: null,
|
|
2333
|
+
j3: null,
|
|
2334
|
+
j4: null,
|
|
2335
|
+
mus: null,
|
|
2336
|
+
xke: null,
|
|
2337
|
+
j3oj2: null,
|
|
2338
|
+
xni: null,
|
|
2339
|
+
d2201: null,
|
|
2340
|
+
d2211: null,
|
|
2341
|
+
nm: null,
|
|
2342
|
+
};
|
|
2325
2343
|
// sgp4fix no longer needed
|
|
2326
2344
|
// getgravconst( whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2 );
|
|
2345
|
+
var xpdotp = 1440.0 / (2.0 * PI); // 229.1831180523293;
|
|
2327
2346
|
satrec.error = 0;
|
|
2328
2347
|
satrec.satnum = tleLine1.substring(2, 7);
|
|
2329
2348
|
satrec.epochyr = parseInt(tleLine1.substring(18, 20));
|
|
2330
2349
|
satrec.epochdays = parseFloat(tleLine1.substring(20, 32));
|
|
2331
2350
|
satrec.ndot = parseFloat(tleLine1.substring(33, 43));
|
|
2332
|
-
satrec.nddot = parseFloat(tleLine1.substring(44, 45)
|
|
2333
|
-
satrec.bstar = parseFloat(tleLine1.substring(53, 54)
|
|
2351
|
+
satrec.nddot = parseFloat("".concat(tleLine1.substring(44, 45), ".").concat(tleLine1.substring(45, 50), "E").concat(tleLine1.substring(50, 52)));
|
|
2352
|
+
satrec.bstar = parseFloat("".concat(tleLine1.substring(53, 54), ".").concat(tleLine1.substring(54, 59), "E").concat(tleLine1.substring(59, 61)));
|
|
2334
2353
|
// satrec.satnum = tleLine2.substring(2, 7);
|
|
2335
2354
|
satrec.inclo = parseFloat(tleLine2.substring(8, 16));
|
|
2336
2355
|
satrec.nodeo = parseFloat(tleLine2.substring(17, 25));
|
|
2337
|
-
satrec.ecco = parseFloat("."
|
|
2356
|
+
satrec.ecco = parseFloat(".".concat(tleLine2.substring(26, 33)));
|
|
2338
2357
|
satrec.argpo = parseFloat(tleLine2.substring(34, 42));
|
|
2339
2358
|
satrec.mo = parseFloat(tleLine2.substring(43, 51));
|
|
2340
2359
|
satrec.no = parseFloat(tleLine2.substring(52, 63));
|
|
@@ -2416,11 +2435,8 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2416
2435
|
* vallado 2004, 191, eq 3-45
|
|
2417
2436
|
* --------------------------------------------------------------------------- */
|
|
2418
2437
|
Sgp4.gstime = function (jdut1) {
|
|
2419
|
-
tut1 = (jdut1 - 2451545.0) / 36525.0;
|
|
2420
|
-
var temp = -6.2e-6 * tut1 * tut1 * tut1 +
|
|
2421
|
-
0.093104 * tut1 * tut1 +
|
|
2422
|
-
(876600.0 * 3600 + 8640184.812866) * tut1 +
|
|
2423
|
-
67310.54841; // sec
|
|
2438
|
+
var tut1 = (jdut1 - 2451545.0) / 36525.0;
|
|
2439
|
+
var temp = -6.2e-6 * tut1 * tut1 * tut1 + 0.093104 * tut1 * tut1 + (876600.0 * 3600 + 8640184.812866) * tut1 + 67310.54841; // sec
|
|
2424
2440
|
temp = ((temp * DEG2RAD) / 240.0) % TAU; // 360/86400 = 1/240, to deg, to rad
|
|
2425
2441
|
// ------------------------ check quadrants ---------------------
|
|
2426
2442
|
if (temp < 0.0) {
|
|
@@ -2540,7 +2556,7 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2540
2556
|
var magv1 = Sgp4.mag(vec1);
|
|
2541
2557
|
var magv2 = Sgp4.mag(vec2);
|
|
2542
2558
|
if (magv1 * magv2 > small * small) {
|
|
2543
|
-
temp = Sgp4.dot(vec1, vec2) / (magv1 * magv2);
|
|
2559
|
+
var temp = Sgp4.dot(vec1, vec2) / (magv1 * magv2);
|
|
2544
2560
|
if (Math.abs(temp) > 1.0)
|
|
2545
2561
|
temp = Sgp4.sgn(temp) * 1.0;
|
|
2546
2562
|
return Math.acos(temp);
|
|
@@ -2747,7 +2763,7 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2747
2763
|
nbar[1] = hbar[0];
|
|
2748
2764
|
nbar[2] = 0.0;
|
|
2749
2765
|
magn = Sgp4.mag(nbar);
|
|
2750
|
-
c1 = magv * magv - mus / magr;
|
|
2766
|
+
var c1 = magv * magv - mus / magr;
|
|
2751
2767
|
rdotv = Sgp4.dot(r, v);
|
|
2752
2768
|
for (i = 0; i <= 2; i++)
|
|
2753
2769
|
ebar[i] = (c1 * r[i] - rdotv * v[i]) / mus;
|
|
@@ -2783,7 +2799,7 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2783
2799
|
}
|
|
2784
2800
|
// ---------- find right ascension of the ascending node ------------
|
|
2785
2801
|
if (magn > small) {
|
|
2786
|
-
temp = nbar[0] / magn;
|
|
2802
|
+
var temp = nbar[0] / magn;
|
|
2787
2803
|
if (Math.abs(temp) > 1.0)
|
|
2788
2804
|
temp = Sgp4.sgn(temp);
|
|
2789
2805
|
omega = Math.acos(temp);
|
|
@@ -2818,7 +2834,7 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2818
2834
|
else
|
|
2819
2835
|
arglat = unknown;
|
|
2820
2836
|
if (ecc > small && typeorbit == 4) {
|
|
2821
|
-
temp = ebar[0] / ecc;
|
|
2837
|
+
var temp = ebar[0] / ecc;
|
|
2822
2838
|
if (Math.abs(temp) > 1.0)
|
|
2823
2839
|
temp = Sgp4.sgn(temp);
|
|
2824
2840
|
lonper = Math.acos(temp);
|
|
@@ -2831,7 +2847,7 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2831
2847
|
lonper = unknown;
|
|
2832
2848
|
// -------- find true longitude - circular equatorial ------
|
|
2833
2849
|
if (magr > small && typeorbit == 2) {
|
|
2834
|
-
temp = r[0] / magr;
|
|
2850
|
+
var temp = r[0] / magr;
|
|
2835
2851
|
if (Math.abs(temp) > 1.0)
|
|
2836
2852
|
temp = Sgp4.sgn(temp);
|
|
2837
2853
|
truelon = Math.acos(temp);
|
|
@@ -2960,26 +2976,26 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2960
2976
|
* none.
|
|
2961
2977
|
* --------------------------------------------------------------------------- */
|
|
2962
2978
|
Sgp4.days2mdhms = function (year, days) {
|
|
2963
|
-
lmonth = [31, year % 4 === 0 ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
2964
|
-
dayofyr = Math.floor(days);
|
|
2979
|
+
var lmonth = [31, year % 4 === 0 ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
2980
|
+
var dayofyr = Math.floor(days);
|
|
2965
2981
|
// ----------------- find month and day of month ----------------
|
|
2966
2982
|
/** Ootk -- Incorporated in the above declaration */
|
|
2967
2983
|
// if ((year % 4) == 0)
|
|
2968
2984
|
// lmonth[2] = 29;
|
|
2969
|
-
i = 1;
|
|
2970
|
-
inttemp = 0;
|
|
2985
|
+
var i = 1;
|
|
2986
|
+
var inttemp = 0;
|
|
2971
2987
|
while (dayofyr > inttemp + lmonth[i - 1] && i < 12) {
|
|
2972
2988
|
inttemp += lmonth[i - 1];
|
|
2973
2989
|
i += 1;
|
|
2974
2990
|
}
|
|
2975
|
-
mon = i;
|
|
2976
|
-
day = dayofyr - inttemp;
|
|
2991
|
+
var mon = i;
|
|
2992
|
+
var day = dayofyr - inttemp;
|
|
2977
2993
|
// ----------------- find hours minutes and seconds -------------
|
|
2978
|
-
temp = (days - dayofyr) * 24.0;
|
|
2979
|
-
hr = Math.floor(temp);
|
|
2994
|
+
var temp = (days - dayofyr) * 24.0;
|
|
2995
|
+
var hr = Math.floor(temp);
|
|
2980
2996
|
temp = (temp - hr) * 60.0;
|
|
2981
|
-
minute = Math.floor(temp);
|
|
2982
|
-
sec = (temp - minute) * 60.0;
|
|
2997
|
+
var minute = Math.floor(temp);
|
|
2998
|
+
var sec = (temp - minute) * 60.0;
|
|
2983
2999
|
return {
|
|
2984
3000
|
mon: mon,
|
|
2985
3001
|
day: day,
|
|
@@ -3045,7 +3061,7 @@ var Sgp4 = /** @class */ (function () {
|
|
|
3045
3061
|
/* --------------- find year and days of the year --------------- */
|
|
3046
3062
|
var temp = jd - 2415019.5;
|
|
3047
3063
|
var tu = temp / 365.25;
|
|
3048
|
-
year = 1900 + Math.floor(tu);
|
|
3064
|
+
var year = 1900 + Math.floor(tu);
|
|
3049
3065
|
leapyrs = Math.floor((year - 1901) * 0.25);
|
|
3050
3066
|
days = Math.floor(temp - ((year - 1900) * 365.0 + leapyrs));
|
|
3051
3067
|
/* ------------ check for case of beginning of a year ----------- */
|
|
@@ -3068,4 +3084,4 @@ var Sgp4 = /** @class */ (function () {
|
|
|
3068
3084
|
return Sgp4;
|
|
3069
3085
|
}());
|
|
3070
3086
|
export { Sgp4 };
|
|
3071
|
-
//# sourceMappingURL=
|
|
3087
|
+
//# sourceMappingURL=sgp4.js.map
|