ootk 1.0.2 → 1.0.6
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 +28 -27
- 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/codecov.yml +21 -0
- package/dist/ootk.js +1 -3850
- package/lib/{ootk.es.d.ts → ootk.d.ts} +3 -4
- package/lib/{ootk.es.js → ootk.js} +4 -4
- package/lib/ootk.js.map +1 -0
- package/lib/{ootk-sgp4.es.d.ts → sgp4.d.ts} +6 -140
- package/lib/{ootk-sgp4.es.js → sgp4.js} +545 -554
- package/lib/sgp4.js.map +1 -0
- package/lib/transforms.d.ts +58 -0
- package/lib/{ootk-transforms.es.js → transforms.js} +3 -3
- package/lib/transforms.js.map +1 -0
- package/lib/{ootk-utils.es.d.ts → utils/constants.d.ts} +6 -11
- package/lib/utils/constants.js +31 -0
- package/lib/utils/constants.js.map +1 -0
- package/lib/utils/types.d.ts +164 -0
- package/lib/utils/types.js +2 -0
- package/lib/utils/types.js.map +1 -0
- package/lib/utils.d.ts +33 -0
- package/lib/{ootk-utils.es.js → utils.js} +12 -5
- package/lib/utils.js.map +1 -0
- package/package.json +15 -16
- 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 -2223
- package/lib/ootk-transforms.es.d.ts +0 -141
package/dist/ootk.js
CHANGED
|
@@ -1,3850 +1 @@
|
|
|
1
|
-
(function webpackUniversalModuleDefinition(root, factory) {
|
|
2
|
-
if(typeof exports === 'object' && typeof module === 'object')
|
|
3
|
-
module.exports = factory();
|
|
4
|
-
else if(typeof define === 'function' && define.amd)
|
|
5
|
-
define([], factory);
|
|
6
|
-
else if(typeof exports === 'object')
|
|
7
|
-
exports["Ootk"] = factory();
|
|
8
|
-
else
|
|
9
|
-
root["Ootk"] = factory();
|
|
10
|
-
})(self, function() {
|
|
11
|
-
return /******/ (() => { // webpackBootstrap
|
|
12
|
-
/******/ "use strict";
|
|
13
|
-
/******/ var __webpack_modules__ = ({
|
|
14
|
-
|
|
15
|
-
/***/ 392:
|
|
16
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
17
|
-
|
|
18
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
19
|
-
/* harmony export */ "Sgp4": () => /* binding */ Sgp4
|
|
20
|
-
/* harmony export */ });
|
|
21
|
-
/**
|
|
22
|
-
* @author Theodore Kruczek.
|
|
23
|
-
* @description Orbital Object ToolKit (OOTK) is a collection of tools for working
|
|
24
|
-
* with satellites and other orbital objects.
|
|
25
|
-
*
|
|
26
|
-
* @file The Sgp4 module contains a TypeScript port of the 2020 version of
|
|
27
|
-
* sgp4unit.cpp from "Fundamentals of Astrodynamics and Applications" by David
|
|
28
|
-
* Vallado. All of the original comments and notes are inserted in the code below
|
|
29
|
-
* in order provide context to the functions and clarify any adjustments made for
|
|
30
|
-
* TypeScript/JavaScript compatibility.
|
|
31
|
-
*
|
|
32
|
-
* @copyright MIT License.
|
|
33
|
-
* Copyright (c) 2020-2021 Theodore Kruczek
|
|
34
|
-
*
|
|
35
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
36
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
37
|
-
* in the Software without restriction, including without limitation the rights
|
|
38
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
39
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
40
|
-
* furnished to do so, subject to the following conditions:
|
|
41
|
-
*
|
|
42
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
43
|
-
* copies or substantial portions of the Software.
|
|
44
|
-
*
|
|
45
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
46
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
47
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
48
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
49
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
50
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
51
|
-
* SOFTWARE.
|
|
52
|
-
*/
|
|
53
|
-
|
|
54
|
-
/* ----------------------------------------------------------------
|
|
55
|
-
*
|
|
56
|
-
* sgp4unit.cpp
|
|
57
|
-
*
|
|
58
|
-
* this file contains the sgp4 procedures for analytical propagation
|
|
59
|
-
* of a satellite. the code was originally released in the 1980 and 1986
|
|
60
|
-
* spacetrack papers. a detailed discussion of the theory and history
|
|
61
|
-
* may be found in the 2006 aiaa paper by vallado, crawford, hujsak,
|
|
62
|
-
* and kelso.
|
|
63
|
-
*
|
|
64
|
-
* companion code for
|
|
65
|
-
* fundamentals of astrodynamics and applications
|
|
66
|
-
* 2013
|
|
67
|
-
* by david vallado
|
|
68
|
-
*
|
|
69
|
-
* (w) 719-573-2600, email dvallado@agi.com, davallado@gmail.com
|
|
70
|
-
*
|
|
71
|
-
* current :
|
|
72
|
-
* 12 mar 20 david vallado
|
|
73
|
-
* chg satnum to string for alpha 5 or 9-digit
|
|
74
|
-
* changes :
|
|
75
|
-
* 7 dec 15 david vallado
|
|
76
|
-
* fix jd, jdfrac
|
|
77
|
-
* 3 nov 14 david vallado
|
|
78
|
-
* update to msvs2013 c++
|
|
79
|
-
* 30 aug 10 david vallado
|
|
80
|
-
* delete unused variables in initl
|
|
81
|
-
* replace pow integer 2, 3 with multiplies for speed
|
|
82
|
-
* 3 nov 08 david vallado
|
|
83
|
-
* put returns in for error codes
|
|
84
|
-
* 29 sep 08 david vallado
|
|
85
|
-
* fix atime for faster operation in dspace
|
|
86
|
-
* add operationmode for afspc (a) or improved (i)
|
|
87
|
-
* performance mode
|
|
88
|
-
* 16 jun 08 david vallado
|
|
89
|
-
* update small eccentricity check
|
|
90
|
-
* 16 nov 07 david vallado
|
|
91
|
-
* misc fixes for better compliance
|
|
92
|
-
* 20 apr 07 david vallado
|
|
93
|
-
* misc fixes for constants
|
|
94
|
-
* 11 aug 06 david vallado
|
|
95
|
-
* chg lyddane choice back to strn3, constants, misc doc
|
|
96
|
-
* 15 dec 05 david vallado
|
|
97
|
-
* misc fixes
|
|
98
|
-
* 26 jul 05 david vallado
|
|
99
|
-
* fixes for paper
|
|
100
|
-
* note that each fix is preceded by a
|
|
101
|
-
* comment with "sgp4fix" and an explanation of
|
|
102
|
-
* what was changed
|
|
103
|
-
* 10 aug 04 david vallado
|
|
104
|
-
* 2nd printing baseline working
|
|
105
|
-
* 14 may 01 david vallado
|
|
106
|
-
* 2nd edition baseline
|
|
107
|
-
* 80 norad
|
|
108
|
-
* original baseline
|
|
109
|
-
* ---------------------------------------------------------------- */
|
|
110
|
-
var PI = Math.PI;
|
|
111
|
-
var TAU = PI * 2;
|
|
112
|
-
var DEG2RAD = PI / 180.0;
|
|
113
|
-
var x2o3 = 2.0 / 3.0;
|
|
114
|
-
var xpdotp = 1440.0 / (2.0 * PI); // 229.1831180523293;
|
|
115
|
-
|
|
116
|
-
var zes = 0.01675;
|
|
117
|
-
var zel = 0.0549;
|
|
118
|
-
var c1ss = 2.9864797e-6;
|
|
119
|
-
var c1l = 4.7968065e-7;
|
|
120
|
-
var zsinis = 0.39785416;
|
|
121
|
-
var zcosis = 0.91744867;
|
|
122
|
-
var zcosgs = 0.1945905;
|
|
123
|
-
var zsings = -0.98088458;
|
|
124
|
-
var q22 = 1.7891679e-6;
|
|
125
|
-
var q31 = 2.1460748e-6;
|
|
126
|
-
var q33 = 2.2123015e-7;
|
|
127
|
-
var root22 = 1.7891679e-6;
|
|
128
|
-
var root44 = 7.3636953e-9;
|
|
129
|
-
var root54 = 2.1765803e-9;
|
|
130
|
-
var rptim = 4.37526908801129966e-3; // equates to 7.29211514668855e-5 rad/sec
|
|
131
|
-
|
|
132
|
-
var root32 = 3.7393792e-7;
|
|
133
|
-
var root52 = 1.1428639e-7;
|
|
134
|
-
var znl = 1.5835218e-4;
|
|
135
|
-
var zns = 1.19459e-5;
|
|
136
|
-
var temp4 = 1.5e-12;
|
|
137
|
-
var fasx2 = 0.13130908;
|
|
138
|
-
var fasx4 = 2.8843198;
|
|
139
|
-
var fasx6 = 0.37448087;
|
|
140
|
-
var g22 = 5.7686396;
|
|
141
|
-
var g32 = 0.95240898;
|
|
142
|
-
var g44 = 1.8014998;
|
|
143
|
-
var g52 = 1.050833;
|
|
144
|
-
var g54 = 4.4108898;
|
|
145
|
-
var stepp = 720.0;
|
|
146
|
-
var stepn = -720.0;
|
|
147
|
-
var step2 = 259200.0;
|
|
148
|
-
/**
|
|
149
|
-
* Ootk code is run synchronously and often on super tight loops, so lets reuse the variables as much as possible.
|
|
150
|
-
*/
|
|
151
|
-
// prettier-ignore
|
|
152
|
-
|
|
153
|
-
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;
|
|
154
|
-
|
|
155
|
-
var Sgp4 =
|
|
156
|
-
/** @class */
|
|
157
|
-
function () {
|
|
158
|
-
function Sgp4() {}
|
|
159
|
-
/* -----------------------------------------------------------------------------
|
|
160
|
-
*
|
|
161
|
-
* procedure dpper
|
|
162
|
-
*
|
|
163
|
-
* this procedure provides deep space long period periodic contributions
|
|
164
|
-
* to the mean elements. by design, these periodics are zero at epoch.
|
|
165
|
-
* this used to be dscom which included initialization, but it's really a
|
|
166
|
-
* recurring function.
|
|
167
|
-
*
|
|
168
|
-
* author : david vallado 719-573-2600 28 jun 2005
|
|
169
|
-
*
|
|
170
|
-
* inputs :
|
|
171
|
-
* e3 -
|
|
172
|
-
* ee2 -
|
|
173
|
-
* peo -
|
|
174
|
-
* pgho -
|
|
175
|
-
* pho -
|
|
176
|
-
* PInco -
|
|
177
|
-
* plo -
|
|
178
|
-
* se2 , se3 , sgh2, sgh3, sgh4, sh2, sh3, si2, si3, sl2, sl3, sl4 -
|
|
179
|
-
* t -
|
|
180
|
-
* xh2, xh3, xi2, xi3, xl2, xl3, xl4 -
|
|
181
|
-
* zmol -
|
|
182
|
-
* zmos -
|
|
183
|
-
* ep - eccentricity 0.0 - 1.0
|
|
184
|
-
* inclo - inclination - needed for lyddane modification
|
|
185
|
-
* nodep - right ascension of ascending node
|
|
186
|
-
* argpp - argument of perigee
|
|
187
|
-
* mp - mean anomaly
|
|
188
|
-
*
|
|
189
|
-
* outputs :
|
|
190
|
-
* ep - eccentricity 0.0 - 1.0
|
|
191
|
-
* inclp - inclination
|
|
192
|
-
* nodep - right ascension of ascending node
|
|
193
|
-
* argpp - argument of perigee
|
|
194
|
-
* mp - mean anomaly
|
|
195
|
-
*
|
|
196
|
-
* locals :
|
|
197
|
-
* alfdp -
|
|
198
|
-
* betdp -
|
|
199
|
-
* cosip , sinip , cosop , sinop ,
|
|
200
|
-
* dalf -
|
|
201
|
-
* dbet -
|
|
202
|
-
* dls -
|
|
203
|
-
* f2, f3 -
|
|
204
|
-
* pe -
|
|
205
|
-
* pgh -
|
|
206
|
-
* ph -
|
|
207
|
-
* PInc -
|
|
208
|
-
* pl -
|
|
209
|
-
* sel , ses , sghl , sghs , shl , shs , sil , sinzf , sis ,
|
|
210
|
-
* sll , sls
|
|
211
|
-
* xls -
|
|
212
|
-
* xnoh -
|
|
213
|
-
* zf -
|
|
214
|
-
* zm -
|
|
215
|
-
*
|
|
216
|
-
* coupling :
|
|
217
|
-
* none.
|
|
218
|
-
*
|
|
219
|
-
* references :
|
|
220
|
-
* hoots, roehrich, norad spacetrack report #3 1980
|
|
221
|
-
* hoots, norad spacetrack report #6 1986
|
|
222
|
-
* hoots, schumacher and glover 2004
|
|
223
|
-
* vallado, crawford, hujsak, kelso 2006
|
|
224
|
-
----------------------------------------------------------------------------*/
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
Sgp4.dpper = function (satrec, options) {
|
|
228
|
-
var e3 = satrec.e3,
|
|
229
|
-
ee2 = satrec.ee2,
|
|
230
|
-
peo = satrec.peo,
|
|
231
|
-
pgho = satrec.pgho,
|
|
232
|
-
pho = satrec.pho,
|
|
233
|
-
PInco = satrec.PInco,
|
|
234
|
-
plo = satrec.plo,
|
|
235
|
-
se2 = satrec.se2,
|
|
236
|
-
se3 = satrec.se3,
|
|
237
|
-
sgh2 = satrec.sgh2,
|
|
238
|
-
sgh3 = satrec.sgh3,
|
|
239
|
-
sgh4 = satrec.sgh4,
|
|
240
|
-
sh2 = satrec.sh2,
|
|
241
|
-
sh3 = satrec.sh3,
|
|
242
|
-
si2 = satrec.si2,
|
|
243
|
-
si3 = satrec.si3,
|
|
244
|
-
sl2 = satrec.sl2,
|
|
245
|
-
sl3 = satrec.sl3,
|
|
246
|
-
sl4 = satrec.sl4,
|
|
247
|
-
t = satrec.t,
|
|
248
|
-
xgh2 = satrec.xgh2,
|
|
249
|
-
xgh3 = satrec.xgh3,
|
|
250
|
-
xgh4 = satrec.xgh4,
|
|
251
|
-
xh2 = satrec.xh2,
|
|
252
|
-
xh3 = satrec.xh3,
|
|
253
|
-
xi2 = satrec.xi2,
|
|
254
|
-
xi3 = satrec.xi3,
|
|
255
|
-
xl2 = satrec.xl2,
|
|
256
|
-
xl3 = satrec.xl3,
|
|
257
|
-
xl4 = satrec.xl4,
|
|
258
|
-
zmol = satrec.zmol,
|
|
259
|
-
zmos = satrec.zmos;
|
|
260
|
-
var ep = options.ep,
|
|
261
|
-
inclp = options.inclp,
|
|
262
|
-
nodep = options.nodep,
|
|
263
|
-
argpp = options.argpp,
|
|
264
|
-
mp = options.mp;
|
|
265
|
-
var _a = options.opsmode,
|
|
266
|
-
opsmode = _a === void 0 ? i : _a,
|
|
267
|
-
init = options.init; // ---------------------- constants -----------------------------
|
|
268
|
-
|
|
269
|
-
/** Ootk -- Declared outside the class at the top */
|
|
270
|
-
// zns = 1.19459e-5;
|
|
271
|
-
// zes = 0.01675;
|
|
272
|
-
// znl = 1.5835218e-4;
|
|
273
|
-
// zel = 0.0549;
|
|
274
|
-
// --------------- calculate time varying periodics -----------
|
|
275
|
-
|
|
276
|
-
zm = zmos + zns * t; // be sure that the initial call has time set to zero
|
|
277
|
-
|
|
278
|
-
if (init === 'y') {
|
|
279
|
-
zm = zmos;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
zf = zm + 2.0 * zes * Math.sin(zm);
|
|
283
|
-
sinzf = Math.sin(zf);
|
|
284
|
-
f2 = 0.5 * sinzf * sinzf - 0.25;
|
|
285
|
-
f3 = -0.5 * sinzf * Math.cos(zf);
|
|
286
|
-
ses = se2 * f2 + se3 * f3;
|
|
287
|
-
sis = si2 * f2 + si3 * f3;
|
|
288
|
-
sls = sl2 * f2 + sl3 * f3 + sl4 * sinzf;
|
|
289
|
-
sghs = sgh2 * f2 + sgh3 * f3 + sgh4 * sinzf;
|
|
290
|
-
shs = sh2 * f2 + sh3 * f3;
|
|
291
|
-
zm = zmol + znl * t;
|
|
292
|
-
|
|
293
|
-
if (init === 'y') {
|
|
294
|
-
zm = zmol;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
zf = zm + 2.0 * zel * Math.sin(zm);
|
|
298
|
-
sinzf = Math.sin(zf);
|
|
299
|
-
f2 = 0.5 * sinzf * sinzf - 0.25;
|
|
300
|
-
f3 = -0.5 * sinzf * Math.cos(zf);
|
|
301
|
-
sel = ee2 * f2 + e3 * f3;
|
|
302
|
-
sil = xi2 * f2 + xi3 * f3;
|
|
303
|
-
sll = xl2 * f2 + xl3 * f3 + xl4 * sinzf;
|
|
304
|
-
sghl = xgh2 * f2 + xgh3 * f3 + xgh4 * sinzf;
|
|
305
|
-
shll = xh2 * f2 + xh3 * f3;
|
|
306
|
-
pe = ses + sel;
|
|
307
|
-
PInc = sis + sil;
|
|
308
|
-
pl = sls + sll;
|
|
309
|
-
pgh = sghs + sghl;
|
|
310
|
-
ph = shs + shll;
|
|
311
|
-
|
|
312
|
-
if (init === 'n') {
|
|
313
|
-
pe -= peo;
|
|
314
|
-
PInc -= PInco;
|
|
315
|
-
pl -= plo;
|
|
316
|
-
pgh -= pgho;
|
|
317
|
-
ph -= pho;
|
|
318
|
-
inclp += PInc;
|
|
319
|
-
ep += pe;
|
|
320
|
-
sinip = Math.sin(inclp);
|
|
321
|
-
cosip = Math.cos(inclp);
|
|
322
|
-
/* ----------------- apply periodics directly ------------ */
|
|
323
|
-
// sgp4fix for lyddane choice
|
|
324
|
-
// strn3 used original inclination - this is technically feasible
|
|
325
|
-
// gsfc used perturbed inclination - also technically feasible
|
|
326
|
-
// probably best to readjust the 0.2 limit value and limit discontinuity
|
|
327
|
-
// 0.2 rad = 11.45916 deg
|
|
328
|
-
// use next line for original strn3 approach and original inclination
|
|
329
|
-
// if (inclo >= 0.2)
|
|
330
|
-
// use next line for gsfc version and perturbed inclination
|
|
331
|
-
|
|
332
|
-
if (inclp >= 0.2) {
|
|
333
|
-
ph /= sinip;
|
|
334
|
-
pgh -= cosip * ph;
|
|
335
|
-
argpp += pgh;
|
|
336
|
-
nodep += ph;
|
|
337
|
-
mp += pl;
|
|
338
|
-
} else {
|
|
339
|
-
// ---- apply periodics with lyddane modification ----
|
|
340
|
-
sinop = Math.sin(nodep);
|
|
341
|
-
cosop = Math.cos(nodep);
|
|
342
|
-
alfdp = sinip * sinop;
|
|
343
|
-
betdp = sinip * cosop;
|
|
344
|
-
dalf = ph * cosop + PInc * cosip * sinop;
|
|
345
|
-
dbet = -ph * sinop + PInc * cosip * cosop;
|
|
346
|
-
alfdp += dalf;
|
|
347
|
-
betdp += dbet;
|
|
348
|
-
nodep %= TAU; // sgp4fix for afspc written intrinsic functions
|
|
349
|
-
// nodep used without a trigonometric function ahead
|
|
350
|
-
|
|
351
|
-
/* istanbul ignore next */
|
|
352
|
-
|
|
353
|
-
if (nodep < 0.0 && opsmode === 'a') {
|
|
354
|
-
nodep += TAU;
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
xls = mp + argpp + cosip * nodep;
|
|
358
|
-
dls = pl + pgh - PInc * nodep * sinip;
|
|
359
|
-
xls += dls;
|
|
360
|
-
xnoh = nodep;
|
|
361
|
-
nodep = Math.atan2(alfdp, betdp); // sgp4fix for afspc written intrinsic functions
|
|
362
|
-
// nodep used without a trigonometric function ahead
|
|
363
|
-
|
|
364
|
-
/* istanbul ignore next */
|
|
365
|
-
|
|
366
|
-
if (nodep < 0.0 && opsmode === 'a') {
|
|
367
|
-
nodep += TAU;
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
if (Math.abs(xnoh - nodep) > PI) {
|
|
371
|
-
/* istanbul ignore next */
|
|
372
|
-
if (nodep < xnoh) {
|
|
373
|
-
nodep += TAU;
|
|
374
|
-
} else {
|
|
375
|
-
nodep -= TAU;
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
mp += pl;
|
|
380
|
-
argpp = xls - mp - cosip * nodep;
|
|
381
|
-
}
|
|
382
|
-
} // if init == 'n'
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
return {
|
|
386
|
-
ep: ep,
|
|
387
|
-
inclp: inclp,
|
|
388
|
-
nodep: nodep,
|
|
389
|
-
argpp: argpp,
|
|
390
|
-
mp: mp
|
|
391
|
-
};
|
|
392
|
-
}; // dpper
|
|
393
|
-
|
|
394
|
-
/*-----------------------------------------------------------------------------
|
|
395
|
-
*
|
|
396
|
-
* procedure dscom
|
|
397
|
-
*
|
|
398
|
-
* this procedure provides deep space common items used by both the secular
|
|
399
|
-
* and periodics subroutines. input is provided as shown. this routine
|
|
400
|
-
* used to be called dpper, but the functions inside weren't well organized.
|
|
401
|
-
*
|
|
402
|
-
* author : david vallado 719-573-2600 28 jun 2005
|
|
403
|
-
*
|
|
404
|
-
* inputs :
|
|
405
|
-
* epoch -
|
|
406
|
-
* ep - eccentricity
|
|
407
|
-
* argpp - argument of perigee
|
|
408
|
-
* tc -
|
|
409
|
-
* inclp - inclination
|
|
410
|
-
* nodep - right ascension of ascending node
|
|
411
|
-
* np - mean motion
|
|
412
|
-
*
|
|
413
|
-
* outputs :
|
|
414
|
-
* sinim , cosim , sinomm , cosomm , snodm , cnodm
|
|
415
|
-
* day -
|
|
416
|
-
* e3 -
|
|
417
|
-
* ee2 -
|
|
418
|
-
* em - eccentricity
|
|
419
|
-
* emsq - eccentricity squared
|
|
420
|
-
* gam -
|
|
421
|
-
* peo -
|
|
422
|
-
* pgho -
|
|
423
|
-
* pho -
|
|
424
|
-
* PInco -
|
|
425
|
-
* plo -
|
|
426
|
-
* rtemsq -
|
|
427
|
-
* se2, se3 -
|
|
428
|
-
* sgh2, sgh3, sgh4 -
|
|
429
|
-
* sh2, sh3, si2, si3, sl2, sl3, sl4 -
|
|
430
|
-
* s1, s2, s3, s4, s5, s6, s7 -
|
|
431
|
-
* ss1, ss2, ss3, ss4, ss5, ss6, ss7, sz1, sz2, sz3 -
|
|
432
|
-
* sz11, sz12, sz13, sz21, sz22, sz23, sz31, sz32, sz33 -
|
|
433
|
-
* xgh2, xgh3, xgh4, xh2, xh3, xi2, xi3, xl2, xl3, xl4 -
|
|
434
|
-
* nm - mean motion
|
|
435
|
-
* z1, z2, z3, z11, z12, z13, z21, z22, z23, z31, z32, z33 -
|
|
436
|
-
* zmol -
|
|
437
|
-
* zmos -
|
|
438
|
-
*
|
|
439
|
-
* locals :
|
|
440
|
-
* a1, a2, a3, a4, a5, a6, a7, a8, a9, a10 -
|
|
441
|
-
* betasq -
|
|
442
|
-
* cc -
|
|
443
|
-
* ctem, stem -
|
|
444
|
-
* x1, x2, x3, x4, x5, x6, x7, x8 -
|
|
445
|
-
* xnodce -
|
|
446
|
-
* xnoi -
|
|
447
|
-
* zcosg , zsing , zcosgl , zsingl , zcosh , zsinh , zcoshl , zsinhl ,
|
|
448
|
-
* zcosi , zsini , zcosil , zsinil ,
|
|
449
|
-
* zx -
|
|
450
|
-
* zy -
|
|
451
|
-
*
|
|
452
|
-
* coupling :
|
|
453
|
-
* none.
|
|
454
|
-
*
|
|
455
|
-
* references :
|
|
456
|
-
* hoots, roehrich, norad spacetrack report #3 1980
|
|
457
|
-
* hoots, norad spacetrack report #6 1986
|
|
458
|
-
* hoots, schumacher and glover 2004
|
|
459
|
-
* vallado, crawford, hujsak, kelso 2006
|
|
460
|
-
----------------------------------------------------------------------------*/
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
Sgp4.dscom = function (options) {
|
|
464
|
-
var epoch = options.epoch,
|
|
465
|
-
ep = options.ep,
|
|
466
|
-
argpp = options.argpp,
|
|
467
|
-
tc = options.tc,
|
|
468
|
-
inclp = options.inclp,
|
|
469
|
-
nodep = options.nodep,
|
|
470
|
-
np = options.np; // -------------------------- constants -------------------------
|
|
471
|
-
|
|
472
|
-
/** Ootk -- These are declared outside the class at the top of the file */
|
|
473
|
-
// zes = 0.01675;
|
|
474
|
-
// zel = 0.0549;
|
|
475
|
-
// c1ss = 2.9864797e-6;
|
|
476
|
-
// c1l = 4.7968065e-7;
|
|
477
|
-
// zsinis = 0.39785416;
|
|
478
|
-
// zcosis = 0.91744867;
|
|
479
|
-
// zcosgs = 0.1945905;
|
|
480
|
-
// zsings = -0.98088458;
|
|
481
|
-
// TAU = 2.0 * Math.PI;
|
|
482
|
-
// --------------------- local variables ------------------------
|
|
483
|
-
|
|
484
|
-
nm = np;
|
|
485
|
-
em = ep;
|
|
486
|
-
snodm = Math.sin(nodep);
|
|
487
|
-
cnodm = Math.cos(nodep);
|
|
488
|
-
sinomm = Math.sin(argpp);
|
|
489
|
-
cosomm = Math.cos(argpp);
|
|
490
|
-
sinim = Math.sin(inclp);
|
|
491
|
-
cosim = Math.cos(inclp);
|
|
492
|
-
emsq = em * em;
|
|
493
|
-
betasq = 1.0 - emsq;
|
|
494
|
-
rtemsq = Math.sqrt(betasq); // ----------------- initialize lunar solar terms ---------------
|
|
495
|
-
|
|
496
|
-
peo = 0.0;
|
|
497
|
-
PInco = 0.0;
|
|
498
|
-
plo = 0.0;
|
|
499
|
-
pgho = 0.0;
|
|
500
|
-
pho = 0.0;
|
|
501
|
-
day = epoch + 18261.5 + tc / 1440.0;
|
|
502
|
-
xnodce = (4.523602 - 9.2422029e-4 * day) % TAU;
|
|
503
|
-
stem = Math.sin(xnodce);
|
|
504
|
-
ctem = Math.cos(xnodce);
|
|
505
|
-
zcosil = 0.91375164 - 0.03568096 * ctem;
|
|
506
|
-
zsinil = Math.sqrt(1.0 - zcosil * zcosil);
|
|
507
|
-
zsinhl = 0.089683511 * stem / zsinil;
|
|
508
|
-
zcoshl = Math.sqrt(1.0 - zsinhl * zsinhl);
|
|
509
|
-
gam = 5.8351514 + 0.001944368 * day;
|
|
510
|
-
var zx = 0.39785416 * stem / zsinil;
|
|
511
|
-
zy = zcoshl * ctem + 0.91744867 * zsinhl * stem;
|
|
512
|
-
zx = Math.atan2(zx, zy);
|
|
513
|
-
zx += gam - xnodce;
|
|
514
|
-
zcosgl = Math.cos(zx);
|
|
515
|
-
zsingl = Math.sin(zx); // ------------------------- do solar terms ---------------------
|
|
516
|
-
|
|
517
|
-
zcosg = zcosgs;
|
|
518
|
-
zsing = zsings;
|
|
519
|
-
zcosi = zcosis;
|
|
520
|
-
zsini = zsinis;
|
|
521
|
-
zcosh = cnodm;
|
|
522
|
-
zsinh = snodm;
|
|
523
|
-
cc = c1ss;
|
|
524
|
-
xnoi = 1.0 / nm;
|
|
525
|
-
|
|
526
|
-
for (lsflg = 1; lsflg <= 2; lsflg++) {
|
|
527
|
-
a1 = zcosg * zcosh + zsing * zcosi * zsinh;
|
|
528
|
-
a3 = -zsing * zcosh + zcosg * zcosi * zsinh;
|
|
529
|
-
a7 = -zcosg * zsinh + zsing * zcosi * zcosh;
|
|
530
|
-
a8 = zsing * zsini;
|
|
531
|
-
a9 = zsing * zsinh + zcosg * zcosi * zcosh;
|
|
532
|
-
a10 = zcosg * zsini;
|
|
533
|
-
a2 = cosim * a7 + sinim * a8;
|
|
534
|
-
a4 = cosim * a9 + sinim * a10;
|
|
535
|
-
a5 = -sinim * a7 + cosim * a8;
|
|
536
|
-
a6 = -sinim * a9 + cosim * a10;
|
|
537
|
-
x1 = a1 * cosomm + a2 * sinomm;
|
|
538
|
-
x2 = a3 * cosomm + a4 * sinomm;
|
|
539
|
-
x3 = -a1 * sinomm + a2 * cosomm;
|
|
540
|
-
x4 = -a3 * sinomm + a4 * cosomm;
|
|
541
|
-
x5 = a5 * sinomm;
|
|
542
|
-
x6 = a6 * sinomm;
|
|
543
|
-
x7 = a5 * cosomm;
|
|
544
|
-
x8 = a6 * cosomm;
|
|
545
|
-
z31 = 12.0 * x1 * x1 - 3.0 * x3 * x3;
|
|
546
|
-
z32 = 24.0 * x1 * x2 - 6.0 * x3 * x4;
|
|
547
|
-
z33 = 12.0 * x2 * x2 - 3.0 * x4 * x4;
|
|
548
|
-
z1 = 3.0 * (a1 * a1 + a2 * a2) + z31 * emsq;
|
|
549
|
-
z2 = 6.0 * (a1 * a3 + a2 * a4) + z32 * emsq;
|
|
550
|
-
z3 = 3.0 * (a3 * a3 + a4 * a4) + z33 * emsq;
|
|
551
|
-
z11 = -6.0 * a1 * a5 + emsq * (-24.0 * x1 * x7 - 6.0 * x3 * x5);
|
|
552
|
-
z12 = -6.0 * (a1 * a6 + a3 * a5) + emsq * (-24.0 * (x2 * x7 + x1 * x8) + -6.0 * (x3 * x6 + x4 * x5));
|
|
553
|
-
z13 = -6.0 * a3 * a6 + emsq * (-24.0 * x2 * x8 - 6.0 * x4 * x6);
|
|
554
|
-
z21 = 6.0 * a2 * a5 + emsq * (24.0 * x1 * x5 - 6.0 * x3 * x7);
|
|
555
|
-
z22 = 6.0 * (a4 * a5 + a2 * a6) + emsq * (24.0 * (x2 * x5 + x1 * x6) - 6.0 * (x4 * x7 + x3 * x8));
|
|
556
|
-
z23 = 6.0 * a4 * a6 + emsq * (24.0 * x2 * x6 - 6.0 * x4 * x8);
|
|
557
|
-
z1 = z1 + z1 + betasq * z31;
|
|
558
|
-
z2 = z2 + z2 + betasq * z32;
|
|
559
|
-
z3 = z3 + z3 + betasq * z33;
|
|
560
|
-
s3 = cc * xnoi;
|
|
561
|
-
s2 = -0.5 * s3 / rtemsq;
|
|
562
|
-
s4 = s3 * rtemsq;
|
|
563
|
-
s1 = -15.0 * em * s4;
|
|
564
|
-
s5 = x1 * x3 + x2 * x4;
|
|
565
|
-
s6 = x2 * x3 + x1 * x4;
|
|
566
|
-
s7 = x2 * x4 - x1 * x3; // ----------------------- do lunar terms -------------------
|
|
567
|
-
|
|
568
|
-
if (lsflg === 1) {
|
|
569
|
-
ss1 = s1;
|
|
570
|
-
ss2 = s2;
|
|
571
|
-
ss3 = s3;
|
|
572
|
-
ss4 = s4;
|
|
573
|
-
ss5 = s5;
|
|
574
|
-
ss6 = s6;
|
|
575
|
-
ss7 = s7;
|
|
576
|
-
sz1 = z1;
|
|
577
|
-
sz2 = z2;
|
|
578
|
-
sz3 = z3;
|
|
579
|
-
sz11 = z11;
|
|
580
|
-
sz12 = z12;
|
|
581
|
-
sz13 = z13;
|
|
582
|
-
sz21 = z21;
|
|
583
|
-
sz22 = z22;
|
|
584
|
-
sz23 = z23;
|
|
585
|
-
sz31 = z31;
|
|
586
|
-
sz32 = z32;
|
|
587
|
-
sz33 = z33;
|
|
588
|
-
zcosg = zcosgl;
|
|
589
|
-
zsing = zsingl;
|
|
590
|
-
zcosi = zcosil;
|
|
591
|
-
zsini = zsinil;
|
|
592
|
-
zcosh = zcoshl * cnodm + zsinhl * snodm;
|
|
593
|
-
zsinh = snodm * zcoshl - cnodm * zsinhl;
|
|
594
|
-
cc = c1l;
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
zmol = (4.7199672 + (0.2299715 * day - gam)) % TAU;
|
|
599
|
-
zmos = (6.2565837 + 0.017201977 * day) % TAU; // ------------------------ do solar terms ----------------------
|
|
600
|
-
|
|
601
|
-
se2 = 2.0 * ss1 * ss6;
|
|
602
|
-
se3 = 2.0 * ss1 * ss7;
|
|
603
|
-
si2 = 2.0 * ss2 * sz12;
|
|
604
|
-
si3 = 2.0 * ss2 * (sz13 - sz11);
|
|
605
|
-
sl2 = -2.0 * ss3 * sz2;
|
|
606
|
-
sl3 = -2.0 * ss3 * (sz3 - sz1);
|
|
607
|
-
sl4 = -2.0 * ss3 * (-21.0 - 9.0 * emsq) * zes;
|
|
608
|
-
sgh2 = 2.0 * ss4 * sz32;
|
|
609
|
-
sgh3 = 2.0 * ss4 * (sz33 - sz31);
|
|
610
|
-
sgh4 = -18.0 * ss4 * zes;
|
|
611
|
-
sh2 = -2.0 * ss2 * sz22;
|
|
612
|
-
sh3 = -2.0 * ss2 * (sz23 - sz21); // ------------------------ do lunar terms ----------------------
|
|
613
|
-
|
|
614
|
-
ee2 = 2.0 * s1 * s6;
|
|
615
|
-
e3 = 2.0 * s1 * s7;
|
|
616
|
-
xi2 = 2.0 * s2 * z12;
|
|
617
|
-
xi3 = 2.0 * s2 * (z13 - z11);
|
|
618
|
-
xl2 = -2.0 * s3 * z2;
|
|
619
|
-
xl3 = -2.0 * s3 * (z3 - z1);
|
|
620
|
-
xl4 = -2.0 * s3 * (-21.0 - 9.0 * emsq) * zel;
|
|
621
|
-
xgh2 = 2.0 * s4 * z32;
|
|
622
|
-
xgh3 = 2.0 * s4 * (z33 - z31);
|
|
623
|
-
xgh4 = -18.0 * s4 * zel;
|
|
624
|
-
xh2 = -2.0 * s2 * z22;
|
|
625
|
-
xh3 = -2.0 * s2 * (z23 - z21);
|
|
626
|
-
return {
|
|
627
|
-
snodm: snodm,
|
|
628
|
-
cnodm: cnodm,
|
|
629
|
-
sinim: sinim,
|
|
630
|
-
cosim: cosim,
|
|
631
|
-
sinomm: sinomm,
|
|
632
|
-
cosomm: cosomm,
|
|
633
|
-
day: day,
|
|
634
|
-
e3: e3,
|
|
635
|
-
ee2: ee2,
|
|
636
|
-
em: em,
|
|
637
|
-
emsq: emsq,
|
|
638
|
-
gam: gam,
|
|
639
|
-
peo: peo,
|
|
640
|
-
pgho: pgho,
|
|
641
|
-
pho: pho,
|
|
642
|
-
PInco: PInco,
|
|
643
|
-
plo: plo,
|
|
644
|
-
rtemsq: rtemsq,
|
|
645
|
-
se2: se2,
|
|
646
|
-
se3: se3,
|
|
647
|
-
sgh2: sgh2,
|
|
648
|
-
sgh3: sgh3,
|
|
649
|
-
sgh4: sgh4,
|
|
650
|
-
sh2: sh2,
|
|
651
|
-
sh3: sh3,
|
|
652
|
-
si2: si2,
|
|
653
|
-
si3: si3,
|
|
654
|
-
sl2: sl2,
|
|
655
|
-
sl3: sl3,
|
|
656
|
-
sl4: sl4,
|
|
657
|
-
s1: s1,
|
|
658
|
-
s2: s2,
|
|
659
|
-
s3: s3,
|
|
660
|
-
s4: s4,
|
|
661
|
-
s5: s5,
|
|
662
|
-
s6: s6,
|
|
663
|
-
s7: s7,
|
|
664
|
-
ss1: ss1,
|
|
665
|
-
ss2: ss2,
|
|
666
|
-
ss3: ss3,
|
|
667
|
-
ss4: ss4,
|
|
668
|
-
ss5: ss5,
|
|
669
|
-
ss6: ss6,
|
|
670
|
-
ss7: ss7,
|
|
671
|
-
sz1: sz1,
|
|
672
|
-
sz2: sz2,
|
|
673
|
-
sz3: sz3,
|
|
674
|
-
sz11: sz11,
|
|
675
|
-
sz12: sz12,
|
|
676
|
-
sz13: sz13,
|
|
677
|
-
sz21: sz21,
|
|
678
|
-
sz22: sz22,
|
|
679
|
-
sz23: sz23,
|
|
680
|
-
sz31: sz31,
|
|
681
|
-
sz32: sz32,
|
|
682
|
-
sz33: sz33,
|
|
683
|
-
xgh2: xgh2,
|
|
684
|
-
xgh3: xgh3,
|
|
685
|
-
xgh4: xgh4,
|
|
686
|
-
xh2: xh2,
|
|
687
|
-
xh3: xh3,
|
|
688
|
-
xi2: xi2,
|
|
689
|
-
xi3: xi3,
|
|
690
|
-
xl2: xl2,
|
|
691
|
-
xl3: xl3,
|
|
692
|
-
xl4: xl4,
|
|
693
|
-
nm: nm,
|
|
694
|
-
z1: z1,
|
|
695
|
-
z2: z2,
|
|
696
|
-
z3: z3,
|
|
697
|
-
z11: z11,
|
|
698
|
-
z12: z12,
|
|
699
|
-
z13: z13,
|
|
700
|
-
z21: z21,
|
|
701
|
-
z22: z22,
|
|
702
|
-
z23: z23,
|
|
703
|
-
z31: z31,
|
|
704
|
-
z32: z32,
|
|
705
|
-
z33: z33,
|
|
706
|
-
zmol: zmol,
|
|
707
|
-
zmos: zmos
|
|
708
|
-
};
|
|
709
|
-
}; // dscom
|
|
710
|
-
|
|
711
|
-
/*-----------------------------------------------------------------------------
|
|
712
|
-
*
|
|
713
|
-
* procedure dsinit
|
|
714
|
-
*
|
|
715
|
-
* this procedure provides deep space contributions to mean motion dot due
|
|
716
|
-
* to geopotential resonance with half day and one day orbits.
|
|
717
|
-
*
|
|
718
|
-
* author : david vallado 719-573-2600 28 jun 2005
|
|
719
|
-
*
|
|
720
|
-
* inputs :
|
|
721
|
-
* cosim, sinim-
|
|
722
|
-
* emsq - eccentricity squared
|
|
723
|
-
* argpo - argument of perigee
|
|
724
|
-
* s1, s2, s3, s4, s5 -
|
|
725
|
-
* ss1, ss2, ss3, ss4, ss5 -
|
|
726
|
-
* sz1, sz3, sz11, sz13, sz21, sz23, sz31, sz33 -
|
|
727
|
-
* t - time
|
|
728
|
-
* tc -
|
|
729
|
-
* gsto - greenwich sidereal time rad
|
|
730
|
-
* mo - mean anomaly
|
|
731
|
-
* mdot - mean anomaly dot (rate)
|
|
732
|
-
* no - mean motion
|
|
733
|
-
* nodeo - right ascension of ascending node
|
|
734
|
-
* nodedot - right ascension of ascending node dot (rate)
|
|
735
|
-
* xPIdot -
|
|
736
|
-
* z1, z3, z11, z13, z21, z23, z31, z33 -
|
|
737
|
-
* eccm - eccentricity
|
|
738
|
-
* argpm - argument of perigee
|
|
739
|
-
* inclm - inclination
|
|
740
|
-
* mm - mean anomaly
|
|
741
|
-
* xn - mean motion
|
|
742
|
-
* nodem - right ascension of ascending node
|
|
743
|
-
*
|
|
744
|
-
* outputs :
|
|
745
|
-
* em - eccentricity
|
|
746
|
-
* argpm - argument of perigee
|
|
747
|
-
* inclm - inclination
|
|
748
|
-
* mm - mean anomaly
|
|
749
|
-
* nm - mean motion
|
|
750
|
-
* nodem - right ascension of ascending node
|
|
751
|
-
* irez - flag for resonance 0-none, 1-one day, 2-half day
|
|
752
|
-
* atime -
|
|
753
|
-
* d2201, d2211, d3210, d3222, d4410, d4422, d5220, d5232, d5421, d5433 -
|
|
754
|
-
* dedt -
|
|
755
|
-
* didt -
|
|
756
|
-
* dmdt -
|
|
757
|
-
* dndt -
|
|
758
|
-
* dnodt -
|
|
759
|
-
* domdt -
|
|
760
|
-
* del1, del2, del3 -
|
|
761
|
-
* ses , sghl , sghs , sgs , shl , shs , sis , sls
|
|
762
|
-
* theta -
|
|
763
|
-
* xfact -
|
|
764
|
-
* xlamo -
|
|
765
|
-
* xli -
|
|
766
|
-
* xni
|
|
767
|
-
*
|
|
768
|
-
* locals :
|
|
769
|
-
* ainv2 -
|
|
770
|
-
* aonv -
|
|
771
|
-
* cosisq -
|
|
772
|
-
* eoc -
|
|
773
|
-
* f220, f221, f311, f321, f322, f330, f441, f442, f522, f523, f542, f543 -
|
|
774
|
-
* g200, g201, g211, g300, g310, g322, g410, g422, g520, g521, g532, g533 -
|
|
775
|
-
* sini2 -
|
|
776
|
-
* temp -
|
|
777
|
-
* temp1 -
|
|
778
|
-
* theta -
|
|
779
|
-
* xno2 -
|
|
780
|
-
*
|
|
781
|
-
* coupling :
|
|
782
|
-
* getgravconst
|
|
783
|
-
*
|
|
784
|
-
* references :
|
|
785
|
-
* hoots, roehrich, norad spacetrack report #3 1980
|
|
786
|
-
* hoots, norad spacetrack report #6 1986
|
|
787
|
-
* hoots, schumacher and glover 2004
|
|
788
|
-
* vallado, crawford, hujsak, kelso 2006
|
|
789
|
-
----------------------------------------------------------------------------*/
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
Sgp4.dsinit = function (options) {
|
|
793
|
-
var // sgp4fix just send in xke as a constant and eliminate getgravconst call
|
|
794
|
-
// gravconsttype whichconst,
|
|
795
|
-
xke = options.xke,
|
|
796
|
-
cosim = options.cosim,
|
|
797
|
-
argpo = options.argpo,
|
|
798
|
-
s1 = options.s1,
|
|
799
|
-
s2 = options.s2,
|
|
800
|
-
s3 = options.s3,
|
|
801
|
-
s4 = options.s4,
|
|
802
|
-
s5 = options.s5,
|
|
803
|
-
sinim = options.sinim,
|
|
804
|
-
ss1 = options.ss1,
|
|
805
|
-
ss2 = options.ss2,
|
|
806
|
-
ss3 = options.ss3,
|
|
807
|
-
ss4 = options.ss4,
|
|
808
|
-
ss5 = options.ss5,
|
|
809
|
-
sz1 = options.sz1,
|
|
810
|
-
sz3 = options.sz3,
|
|
811
|
-
sz11 = options.sz11,
|
|
812
|
-
sz13 = options.sz13,
|
|
813
|
-
sz21 = options.sz21,
|
|
814
|
-
sz23 = options.sz23,
|
|
815
|
-
sz31 = options.sz31,
|
|
816
|
-
sz33 = options.sz33,
|
|
817
|
-
t = options.t,
|
|
818
|
-
tc = options.tc,
|
|
819
|
-
gsto = options.gsto,
|
|
820
|
-
mo = options.mo,
|
|
821
|
-
mdot = options.mdot,
|
|
822
|
-
no = options.no,
|
|
823
|
-
nodeo = options.nodeo,
|
|
824
|
-
nodedot = options.nodedot,
|
|
825
|
-
xPIdot = options.xPIdot,
|
|
826
|
-
z1 = options.z1,
|
|
827
|
-
z3 = options.z3,
|
|
828
|
-
z11 = options.z11,
|
|
829
|
-
z13 = options.z13,
|
|
830
|
-
z21 = options.z21,
|
|
831
|
-
z23 = options.z23,
|
|
832
|
-
z31 = options.z31,
|
|
833
|
-
z33 = options.z33,
|
|
834
|
-
ecco = options.ecco,
|
|
835
|
-
eccsq = options.eccsq;
|
|
836
|
-
var emsq = options.emsq,
|
|
837
|
-
em = options.em,
|
|
838
|
-
argpm = options.argpm,
|
|
839
|
-
inclm = options.inclm,
|
|
840
|
-
mm = options.mm,
|
|
841
|
-
nm = options.nm,
|
|
842
|
-
nodem = options.nodem,
|
|
843
|
-
irez = options.irez,
|
|
844
|
-
atime = options.atime,
|
|
845
|
-
d2201 = options.d2201,
|
|
846
|
-
d2211 = options.d2211,
|
|
847
|
-
d3210 = options.d3210,
|
|
848
|
-
d3222 = options.d3222,
|
|
849
|
-
d4410 = options.d4410,
|
|
850
|
-
d4422 = options.d4422,
|
|
851
|
-
d5220 = options.d5220,
|
|
852
|
-
d5232 = options.d5232,
|
|
853
|
-
d5421 = options.d5421,
|
|
854
|
-
d5433 = options.d5433,
|
|
855
|
-
dedt = options.dedt,
|
|
856
|
-
didt = options.didt,
|
|
857
|
-
dmdt = options.dmdt,
|
|
858
|
-
dnodt = options.dnodt,
|
|
859
|
-
domdt = options.domdt,
|
|
860
|
-
del1 = options.del1,
|
|
861
|
-
del2 = options.del2,
|
|
862
|
-
del3 = options.del3,
|
|
863
|
-
xfact = options.xfact,
|
|
864
|
-
xlamo = options.xlamo,
|
|
865
|
-
xli = options.xli,
|
|
866
|
-
xni = options.xni;
|
|
867
|
-
/* --------------------- local variables ------------------------ */
|
|
868
|
-
|
|
869
|
-
/** Ootk -- these are declared at the top instead */
|
|
870
|
-
// q22 = 1.7891679e-6;
|
|
871
|
-
// q31 = 2.1460748e-6;
|
|
872
|
-
// q33 = 2.2123015e-7;
|
|
873
|
-
// root22 = 1.7891679e-6;
|
|
874
|
-
// root44 = 7.3636953e-9;
|
|
875
|
-
// root54 = 2.1765803e-9;
|
|
876
|
-
// rptim = 4.37526908801129966e-3; // equates to 7.29211514668855e-5 rad/sec
|
|
877
|
-
// root32 = 3.7393792e-7;
|
|
878
|
-
// root52 = 1.1428639e-7;
|
|
879
|
-
// x2o3 = 2.0 / 3.0;
|
|
880
|
-
// znl = 1.5835218e-4;
|
|
881
|
-
// zns = 1.19459e-5;
|
|
882
|
-
// sgp4fix identify constants and allow alternate values
|
|
883
|
-
// just xke is used here so pass it in rather than have multiple calls
|
|
884
|
-
// getgravconst( whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2 );
|
|
885
|
-
// -------------------- deep space initialization ------------
|
|
886
|
-
|
|
887
|
-
irez = 0;
|
|
888
|
-
|
|
889
|
-
if (nm < 0.0052359877 && nm > 0.0034906585) {
|
|
890
|
-
irez = 1;
|
|
891
|
-
}
|
|
892
|
-
|
|
893
|
-
if (nm >= 8.26e-3 && nm <= 9.24e-3 && em >= 0.5) {
|
|
894
|
-
irez = 2;
|
|
895
|
-
} // ------------------------ do solar terms -------------------
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
ses = ss1 * zns * ss5;
|
|
899
|
-
sis = ss2 * zns * (sz11 + sz13);
|
|
900
|
-
sls = -zns * ss3 * (sz1 + sz3 - 14.0 - 6.0 * emsq);
|
|
901
|
-
sghs = ss4 * zns * (sz31 + sz33 - 6.0);
|
|
902
|
-
var shs = -zns * ss2 * (sz21 + sz23); // sgp4fix for 180 deg incl
|
|
903
|
-
|
|
904
|
-
if (inclm < 5.2359877e-2 || inclm > PI - 5.2359877e-2) {
|
|
905
|
-
shs = 0.0;
|
|
906
|
-
}
|
|
907
|
-
|
|
908
|
-
if (sinim !== 0.0) {
|
|
909
|
-
shs /= sinim;
|
|
910
|
-
}
|
|
911
|
-
|
|
912
|
-
sgs = sghs - cosim * shs; // ------------------------- do lunar terms ------------------
|
|
913
|
-
|
|
914
|
-
dedt = ses + s1 * znl * s5;
|
|
915
|
-
didt = sis + s2 * znl * (z11 + z13);
|
|
916
|
-
dmdt = sls - znl * s3 * (z1 + z3 - 14.0 - 6.0 * emsq);
|
|
917
|
-
sghl = s4 * znl * (z31 + z33 - 6.0);
|
|
918
|
-
var shll = -znl * s2 * (z21 + z23); // sgp4fix for 180 deg incl
|
|
919
|
-
|
|
920
|
-
if (inclm < 5.2359877e-2 || inclm > PI - 5.2359877e-2) {
|
|
921
|
-
shll = 0.0;
|
|
922
|
-
}
|
|
923
|
-
|
|
924
|
-
domdt = sgs + sghl;
|
|
925
|
-
dnodt = shs;
|
|
926
|
-
|
|
927
|
-
if (sinim !== 0.0) {
|
|
928
|
-
domdt -= cosim / sinim * shll;
|
|
929
|
-
dnodt += shll / sinim;
|
|
930
|
-
} // ----------- calculate deep space resonance effects --------
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
dndt = 0.0;
|
|
934
|
-
theta = (gsto + tc * rptim) % TAU;
|
|
935
|
-
em += dedt * t;
|
|
936
|
-
inclm += didt * t;
|
|
937
|
-
argpm += domdt * t;
|
|
938
|
-
nodem += dnodt * t;
|
|
939
|
-
mm += dmdt * t; // sgp4fix for negative inclinations
|
|
940
|
-
// the following if statement should be commented out
|
|
941
|
-
// if (inclm < 0.0)
|
|
942
|
-
// {
|
|
943
|
-
// inclm = -inclm;
|
|
944
|
-
// argpm = argpm - PI;
|
|
945
|
-
// nodem = nodem + PI;
|
|
946
|
-
// }
|
|
947
|
-
// -------------- initialize the resonance terms -------------
|
|
948
|
-
|
|
949
|
-
if (irez !== 0) {
|
|
950
|
-
aonv = Math.pow(nm / xke, x2o3); // ---------- geopotential resonance for 12 hour orbits ------
|
|
951
|
-
|
|
952
|
-
if (irez === 2) {
|
|
953
|
-
cosisq = cosim * cosim;
|
|
954
|
-
emo = em;
|
|
955
|
-
em = ecco;
|
|
956
|
-
emsqo = emsq;
|
|
957
|
-
emsq = eccsq;
|
|
958
|
-
eoc = em * emsq;
|
|
959
|
-
g201 = -0.306 - (em - 0.64) * 0.44;
|
|
960
|
-
|
|
961
|
-
if (em <= 0.65) {
|
|
962
|
-
g211 = 3.616 - 13.247 * em + 16.29 * emsq;
|
|
963
|
-
g310 = -19.302 + 117.39 * em - 228.419 * emsq + 156.591 * eoc;
|
|
964
|
-
g322 = -18.9068 + 109.7927 * em - 214.6334 * emsq + 146.5816 * eoc;
|
|
965
|
-
g410 = -41.122 + 242.694 * em - 471.094 * emsq + 313.953 * eoc;
|
|
966
|
-
g422 = -146.407 + 841.88 * em - 1629.014 * emsq + 1083.435 * eoc;
|
|
967
|
-
g520 = -532.114 + 3017.977 * em - 5740.032 * emsq + 3708.276 * eoc;
|
|
968
|
-
} else {
|
|
969
|
-
g211 = -72.099 + 331.819 * em - 508.738 * emsq + 266.724 * eoc;
|
|
970
|
-
g310 = -346.844 + 1582.851 * em - 2415.925 * emsq + 1246.113 * eoc;
|
|
971
|
-
g322 = -342.585 + 1554.908 * em - 2366.899 * emsq + 1215.972 * eoc;
|
|
972
|
-
g410 = -1052.797 + 4758.686 * em - 7193.992 * emsq + 3651.957 * eoc;
|
|
973
|
-
g422 = -3581.69 + 16178.11 * em - 24462.77 * emsq + 12422.52 * eoc;
|
|
974
|
-
|
|
975
|
-
if (em > 0.715) {
|
|
976
|
-
g520 = -5149.66 + 29936.92 * em - 54087.36 * emsq + 31324.56 * eoc;
|
|
977
|
-
} else {
|
|
978
|
-
g520 = 1464.74 - 4664.75 * em + 3763.64 * emsq;
|
|
979
|
-
}
|
|
980
|
-
}
|
|
981
|
-
|
|
982
|
-
if (em < 0.7) {
|
|
983
|
-
g533 = -919.2277 + 4988.61 * em - 9064.77 * emsq + 5542.21 * eoc;
|
|
984
|
-
g521 = -822.71072 + 4568.6173 * em - 8491.4146 * emsq + 5337.524 * eoc;
|
|
985
|
-
g532 = -853.666 + 4690.25 * em - 8624.77 * emsq + 5341.4 * eoc;
|
|
986
|
-
} else {
|
|
987
|
-
g533 = -37995.78 + 161616.52 * em - 229838.2 * emsq + 109377.94 * eoc;
|
|
988
|
-
g521 = -51752.104 + 218913.95 * em - 309468.16 * emsq + 146349.42 * eoc;
|
|
989
|
-
g532 = -40023.88 + 170470.89 * em - 242699.48 * emsq + 115605.82 * eoc;
|
|
990
|
-
}
|
|
991
|
-
|
|
992
|
-
sini2 = sinim * sinim;
|
|
993
|
-
f220 = 0.75 * (1.0 + 2.0 * cosim + cosisq);
|
|
994
|
-
f221 = 1.5 * sini2;
|
|
995
|
-
f321 = 1.875 * sinim * (1.0 - 2.0 * cosim - 3.0 * cosisq);
|
|
996
|
-
f322 = -1.875 * sinim * (1.0 + 2.0 * cosim - 3.0 * cosisq);
|
|
997
|
-
f441 = 35.0 * sini2 * f220;
|
|
998
|
-
f442 = 39.375 * sini2 * sini2;
|
|
999
|
-
f522 = 9.84375 * sinim * (sini2 * (1.0 - 2.0 * cosim - 5.0 * cosisq) + 0.33333333 * (-2.0 + 4.0 * cosim + 6.0 * cosisq));
|
|
1000
|
-
f523 = sinim * (4.92187512 * sini2 * (-2.0 - 4.0 * cosim + 10.0 * cosisq) + 6.56250012 * (1.0 + 2.0 * cosim - 3.0 * cosisq));
|
|
1001
|
-
f542 = 29.53125 * sinim * (2.0 - 8.0 * cosim + cosisq * (-12.0 + 8.0 * cosim + 10.0 * cosisq));
|
|
1002
|
-
f543 = 29.53125 * sinim * (-2.0 - 8.0 * cosim + cosisq * (12.0 + 8.0 * cosim - 10.0 * cosisq));
|
|
1003
|
-
xno2 = nm * nm;
|
|
1004
|
-
ainv2 = aonv * aonv;
|
|
1005
|
-
temp1 = 3.0 * xno2 * ainv2;
|
|
1006
|
-
temp = temp1 * root22;
|
|
1007
|
-
d2201 = temp * f220 * g201;
|
|
1008
|
-
d2211 = temp * f221 * g211;
|
|
1009
|
-
temp1 *= aonv;
|
|
1010
|
-
temp = temp1 * root32;
|
|
1011
|
-
d3210 = temp * f321 * g310;
|
|
1012
|
-
d3222 = temp * f322 * g322;
|
|
1013
|
-
temp1 *= aonv;
|
|
1014
|
-
temp = 2.0 * temp1 * root44;
|
|
1015
|
-
d4410 = temp * f441 * g410;
|
|
1016
|
-
d4422 = temp * f442 * g422;
|
|
1017
|
-
temp1 *= aonv;
|
|
1018
|
-
temp = temp1 * root52;
|
|
1019
|
-
d5220 = temp * f522 * g520;
|
|
1020
|
-
d5232 = temp * f523 * g532;
|
|
1021
|
-
temp = 2.0 * temp1 * root54;
|
|
1022
|
-
d5421 = temp * f542 * g521;
|
|
1023
|
-
d5433 = temp * f543 * g533;
|
|
1024
|
-
xlamo = (mo + nodeo + nodeo - (theta + theta)) % TAU;
|
|
1025
|
-
xfact = mdot + dmdt + 2.0 * (nodedot + dnodt - rptim) - no;
|
|
1026
|
-
em = emo;
|
|
1027
|
-
emsq = emsqo;
|
|
1028
|
-
} // ---------------- synchronous resonance terms --------------
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
if (irez === 1) {
|
|
1032
|
-
g200 = 1.0 + emsq * (-2.5 + 0.8125 * emsq);
|
|
1033
|
-
g310 = 1.0 + 2.0 * emsq;
|
|
1034
|
-
g300 = 1.0 + emsq * (-6.0 + 6.60937 * emsq);
|
|
1035
|
-
f220 = 0.75 * (1.0 + cosim) * (1.0 + cosim);
|
|
1036
|
-
f311 = 0.9375 * sinim * sinim * (1.0 + 3.0 * cosim) - 0.75 * (1.0 + cosim);
|
|
1037
|
-
f330 = 1.0 + cosim;
|
|
1038
|
-
f330 *= 1.875 * f330 * f330;
|
|
1039
|
-
del1 = 3.0 * nm * nm * aonv * aonv;
|
|
1040
|
-
del2 = 2.0 * del1 * f220 * g200 * q22;
|
|
1041
|
-
del3 = 3.0 * del1 * f330 * g300 * q33 * aonv;
|
|
1042
|
-
del1 = del1 * f311 * g310 * q31 * aonv;
|
|
1043
|
-
xlamo = (mo + nodeo + argpo - theta) % TAU;
|
|
1044
|
-
xfact = mdot + xPIdot + dmdt + domdt + dnodt - (no + rptim);
|
|
1045
|
-
} // ------------ for sgp4, initialize the integrator ----------
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
xli = xlamo;
|
|
1049
|
-
xni = no;
|
|
1050
|
-
atime = 0.0;
|
|
1051
|
-
nm = no + dndt;
|
|
1052
|
-
}
|
|
1053
|
-
|
|
1054
|
-
return {
|
|
1055
|
-
em: em,
|
|
1056
|
-
argpm: argpm,
|
|
1057
|
-
inclm: inclm,
|
|
1058
|
-
mm: mm,
|
|
1059
|
-
nm: nm,
|
|
1060
|
-
nodem: nodem,
|
|
1061
|
-
irez: irez,
|
|
1062
|
-
atime: atime,
|
|
1063
|
-
d2201: d2201,
|
|
1064
|
-
d2211: d2211,
|
|
1065
|
-
d3210: d3210,
|
|
1066
|
-
d3222: d3222,
|
|
1067
|
-
d4410: d4410,
|
|
1068
|
-
d4422: d4422,
|
|
1069
|
-
d5220: d5220,
|
|
1070
|
-
d5232: d5232,
|
|
1071
|
-
d5421: d5421,
|
|
1072
|
-
d5433: d5433,
|
|
1073
|
-
dedt: dedt,
|
|
1074
|
-
didt: didt,
|
|
1075
|
-
dmdt: dmdt,
|
|
1076
|
-
dndt: dndt,
|
|
1077
|
-
dnodt: dnodt,
|
|
1078
|
-
domdt: domdt,
|
|
1079
|
-
del1: del1,
|
|
1080
|
-
del2: del2,
|
|
1081
|
-
del3: del3,
|
|
1082
|
-
xfact: xfact,
|
|
1083
|
-
xlamo: xlamo,
|
|
1084
|
-
xli: xli,
|
|
1085
|
-
xni: xni
|
|
1086
|
-
};
|
|
1087
|
-
}; // dsinit
|
|
1088
|
-
|
|
1089
|
-
/*-----------------------------------------------------------------------------
|
|
1090
|
-
*
|
|
1091
|
-
* procedure dspace
|
|
1092
|
-
*
|
|
1093
|
-
* this procedure provides deep space contributions to mean elements for
|
|
1094
|
-
* perturbing third body. these effects have been averaged over one
|
|
1095
|
-
* revolution of the sun and moon. for earth resonance effects, the
|
|
1096
|
-
* effects have been averaged over no revolutions of the satellite.
|
|
1097
|
-
* (mean motion)
|
|
1098
|
-
*
|
|
1099
|
-
* author : david vallado 719-573-2600 28 jun 2005
|
|
1100
|
-
*
|
|
1101
|
-
* inputs :
|
|
1102
|
-
* d2201, d2211, d3210, d3222, d4410, d4422, d5220, d5232, d5421, d5433 -
|
|
1103
|
-
* dedt -
|
|
1104
|
-
* del1, del2, del3 -
|
|
1105
|
-
* didt -
|
|
1106
|
-
* dmdt -
|
|
1107
|
-
* dnodt -
|
|
1108
|
-
* domdt -
|
|
1109
|
-
* irez - flag for resonance 0-none, 1-one day, 2-half day
|
|
1110
|
-
* argpo - argument of perigee
|
|
1111
|
-
* argpdot - argument of perigee dot (rate)
|
|
1112
|
-
* t - time
|
|
1113
|
-
* tc -
|
|
1114
|
-
* gsto - gst
|
|
1115
|
-
* xfact -
|
|
1116
|
-
* xlamo -
|
|
1117
|
-
* no - mean motion
|
|
1118
|
-
* atime -
|
|
1119
|
-
* em - eccentricity
|
|
1120
|
-
* ft -
|
|
1121
|
-
* argpm - argument of perigee
|
|
1122
|
-
* inclm - inclination
|
|
1123
|
-
* xli -
|
|
1124
|
-
* mm - mean anomaly
|
|
1125
|
-
* xni - mean motion
|
|
1126
|
-
* nodem - right ascension of ascending node
|
|
1127
|
-
*
|
|
1128
|
-
* outputs :
|
|
1129
|
-
* atime -
|
|
1130
|
-
* em - eccentricity
|
|
1131
|
-
* argpm - argument of perigee
|
|
1132
|
-
* inclm - inclination
|
|
1133
|
-
* xli -
|
|
1134
|
-
* mm - mean anomaly
|
|
1135
|
-
* xni -
|
|
1136
|
-
* nodem - right ascension of ascending node
|
|
1137
|
-
* dndt -
|
|
1138
|
-
* nm - mean motion
|
|
1139
|
-
*
|
|
1140
|
-
* locals :
|
|
1141
|
-
* delt -
|
|
1142
|
-
* ft -
|
|
1143
|
-
* theta -
|
|
1144
|
-
* x2li -
|
|
1145
|
-
* x2omi -
|
|
1146
|
-
* xl -
|
|
1147
|
-
* xldot -
|
|
1148
|
-
* xnddt -
|
|
1149
|
-
* xndt -
|
|
1150
|
-
* xomi -
|
|
1151
|
-
*
|
|
1152
|
-
* coupling :
|
|
1153
|
-
* none -
|
|
1154
|
-
*
|
|
1155
|
-
* references :
|
|
1156
|
-
* hoots, roehrich, norad spacetrack report #3 1980
|
|
1157
|
-
* hoots, norad spacetrack report #6 1986
|
|
1158
|
-
* hoots, schumacher and glover 2004
|
|
1159
|
-
* vallado, crawford, hujsak, kelso 2006
|
|
1160
|
-
----------------------------------------------------------------------------*/
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
Sgp4.dspace = function (options) {
|
|
1164
|
-
var irez = options.irez,
|
|
1165
|
-
d2201 = options.d2201,
|
|
1166
|
-
d2211 = options.d2211,
|
|
1167
|
-
d3210 = options.d3210,
|
|
1168
|
-
d3222 = options.d3222,
|
|
1169
|
-
d4410 = options.d4410,
|
|
1170
|
-
d4422 = options.d4422,
|
|
1171
|
-
d5220 = options.d5220,
|
|
1172
|
-
d5232 = options.d5232,
|
|
1173
|
-
d5421 = options.d5421,
|
|
1174
|
-
d5433 = options.d5433,
|
|
1175
|
-
dedt = options.dedt,
|
|
1176
|
-
del1 = options.del1,
|
|
1177
|
-
del2 = options.del2,
|
|
1178
|
-
del3 = options.del3,
|
|
1179
|
-
didt = options.didt,
|
|
1180
|
-
dmdt = options.dmdt,
|
|
1181
|
-
dnodt = options.dnodt,
|
|
1182
|
-
domdt = options.domdt,
|
|
1183
|
-
argpo = options.argpo,
|
|
1184
|
-
argpdot = options.argpdot,
|
|
1185
|
-
t = options.t,
|
|
1186
|
-
tc = options.tc,
|
|
1187
|
-
gsto = options.gsto,
|
|
1188
|
-
xfact = options.xfact,
|
|
1189
|
-
xlamo = options.xlamo,
|
|
1190
|
-
no = options.no;
|
|
1191
|
-
var atime = options.atime,
|
|
1192
|
-
em = options.em,
|
|
1193
|
-
argpm = options.argpm,
|
|
1194
|
-
inclm = options.inclm,
|
|
1195
|
-
xli = options.xli,
|
|
1196
|
-
mm = options.mm,
|
|
1197
|
-
xni = options.xni,
|
|
1198
|
-
nodem = options.nodem,
|
|
1199
|
-
nm = options.nm;
|
|
1200
|
-
/** Ootk -- Declared at the top of the file instead */
|
|
1201
|
-
// fasx2 = 0.13130908;
|
|
1202
|
-
// fasx4 = 2.8843198;
|
|
1203
|
-
// fasx6 = 0.37448087;
|
|
1204
|
-
// g22 = 5.7686396;
|
|
1205
|
-
// g32 = 0.95240898;
|
|
1206
|
-
// g44 = 1.8014998;
|
|
1207
|
-
// g52 = 1.050833;
|
|
1208
|
-
// g54 = 4.4108898;
|
|
1209
|
-
// rptim = 4.37526908801129966e-3; // equates to 7.29211514668855e-5 rad/sec
|
|
1210
|
-
// stepp = 720.0;
|
|
1211
|
-
// stepn = -720.0;
|
|
1212
|
-
// step2 = 259200.0;
|
|
1213
|
-
// ----------- calculate deep space resonance effects -----------
|
|
1214
|
-
|
|
1215
|
-
dndt = 0.0;
|
|
1216
|
-
theta = (gsto + tc * rptim) % TAU;
|
|
1217
|
-
em += dedt * t;
|
|
1218
|
-
inclm += didt * t;
|
|
1219
|
-
argpm += domdt * t;
|
|
1220
|
-
nodem += dnodt * t;
|
|
1221
|
-
mm += dmdt * t; // sgp4fix for negative inclinations
|
|
1222
|
-
// the following if statement should be commented out
|
|
1223
|
-
// if (inclm < 0.0)
|
|
1224
|
-
// {
|
|
1225
|
-
// inclm = -inclm;
|
|
1226
|
-
// argpm = argpm - PI;
|
|
1227
|
-
// nodem = nodem + PI;
|
|
1228
|
-
// }
|
|
1229
|
-
|
|
1230
|
-
/* - update resonances : numerical (euler-maclaurin) integration - */
|
|
1231
|
-
|
|
1232
|
-
/* ------------------------- epoch restart ---------------------- */
|
|
1233
|
-
// sgp4fix for propagator problems
|
|
1234
|
-
// the following integration works for negative time steps and periods
|
|
1235
|
-
// the specific changes are unknown because the original code was so convoluted
|
|
1236
|
-
// sgp4fix take out atime = 0.0 and fix for faster operation
|
|
1237
|
-
// ft = 0.0; /** Ootk -- This has no value */
|
|
1238
|
-
|
|
1239
|
-
if (irez !== 0) {
|
|
1240
|
-
// sgp4fix streamline check
|
|
1241
|
-
if (atime === 0.0 || t * atime <= 0.0 || Math.abs(t) < Math.abs(atime)) {
|
|
1242
|
-
atime = 0.0;
|
|
1243
|
-
xni = no;
|
|
1244
|
-
xli = xlamo;
|
|
1245
|
-
} // sgp4fix move check outside loop
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
if (t > 0.0) {
|
|
1249
|
-
delt = stepp;
|
|
1250
|
-
} else {
|
|
1251
|
-
delt = stepn;
|
|
1252
|
-
}
|
|
1253
|
-
|
|
1254
|
-
var iretn = 381; // added for do loop
|
|
1255
|
-
|
|
1256
|
-
while (iretn === 381) {
|
|
1257
|
-
// ------------------- dot terms calculated -------------
|
|
1258
|
-
// ----------- near - synchronous resonance terms -------
|
|
1259
|
-
if (irez !== 2) {
|
|
1260
|
-
xndt = del1 * Math.sin(xli - fasx2) + del2 * Math.sin(2.0 * (xli - fasx4)) + del3 * Math.sin(3.0 * (xli - fasx6));
|
|
1261
|
-
xldot = xni + xfact;
|
|
1262
|
-
xnddt = del1 * Math.cos(xli - fasx2) + 2.0 * del2 * Math.cos(2.0 * (xli - fasx4)) + 3.0 * del3 * Math.cos(3.0 * (xli - fasx6));
|
|
1263
|
-
xnddt *= xldot;
|
|
1264
|
-
} else {
|
|
1265
|
-
// --------- near - half-day resonance terms --------
|
|
1266
|
-
xomi = argpo + argpdot * atime;
|
|
1267
|
-
x2omi = xomi + xomi;
|
|
1268
|
-
x2li = xli + xli;
|
|
1269
|
-
xndt = d2201 * Math.sin(x2omi + xli - g22) + d2211 * Math.sin(xli - g22) + d3210 * Math.sin(xomi + xli - g32) + d3222 * Math.sin(-xomi + xli - g32) + d4410 * Math.sin(x2omi + x2li - g44) + d4422 * Math.sin(x2li - g44) + d5220 * Math.sin(xomi + xli - g52) + d5232 * Math.sin(-xomi + xli - g52) + d5421 * Math.sin(xomi + x2li - g54) + d5433 * Math.sin(-xomi + x2li - g54);
|
|
1270
|
-
xldot = xni + xfact;
|
|
1271
|
-
xnddt = d2201 * Math.cos(x2omi + xli - g22) + d2211 * Math.cos(xli - g22) + d3210 * Math.cos(xomi + xli - g32) + d3222 * Math.cos(-xomi + xli - g32) + d5220 * Math.cos(xomi + xli - g52) + d5232 * Math.cos(-xomi + xli - g52) + 2.0 * d4410 * Math.cos(x2omi + x2li - g44) + d4422 * Math.cos(x2li - g44) + d5421 * Math.cos(xomi + x2li - g54) + d5433 * Math.cos(-xomi + x2li - g54);
|
|
1272
|
-
xnddt *= xldot;
|
|
1273
|
-
} // ----------------------- integrator -------------------
|
|
1274
|
-
// sgp4fix move end checks to end of routine
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
if (Math.abs(t - atime) >= stepp) {
|
|
1278
|
-
// iret = 0; /** Ootk -- This has no value */
|
|
1279
|
-
iretn = 381;
|
|
1280
|
-
} else {
|
|
1281
|
-
ft = t - atime;
|
|
1282
|
-
iretn = 0;
|
|
1283
|
-
}
|
|
1284
|
-
|
|
1285
|
-
if (iretn === 381) {
|
|
1286
|
-
xli += xldot * delt + xndt * step2;
|
|
1287
|
-
xni += xndt * delt + xnddt * step2;
|
|
1288
|
-
atime += delt;
|
|
1289
|
-
}
|
|
1290
|
-
} // while iretn = 381
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
nm = xni + xndt * ft + xnddt * ft * ft * 0.5;
|
|
1294
|
-
xl = xli + xldot * ft + xndt * ft * ft * 0.5;
|
|
1295
|
-
|
|
1296
|
-
if (irez !== 1) {
|
|
1297
|
-
mm = xl - 2.0 * nodem + 2.0 * theta;
|
|
1298
|
-
dndt = nm - no;
|
|
1299
|
-
} else {
|
|
1300
|
-
mm = xl - nodem - argpm + theta;
|
|
1301
|
-
dndt = nm - no;
|
|
1302
|
-
}
|
|
1303
|
-
|
|
1304
|
-
nm = no + dndt;
|
|
1305
|
-
}
|
|
1306
|
-
|
|
1307
|
-
return {
|
|
1308
|
-
atime: atime,
|
|
1309
|
-
em: em,
|
|
1310
|
-
argpm: argpm,
|
|
1311
|
-
inclm: inclm,
|
|
1312
|
-
xli: xli,
|
|
1313
|
-
mm: mm,
|
|
1314
|
-
xni: xni,
|
|
1315
|
-
nodem: nodem,
|
|
1316
|
-
dndt: dndt,
|
|
1317
|
-
nm: nm
|
|
1318
|
-
};
|
|
1319
|
-
}; // dspace
|
|
1320
|
-
|
|
1321
|
-
/*-----------------------------------------------------------------------------
|
|
1322
|
-
*
|
|
1323
|
-
* procedure initl
|
|
1324
|
-
*
|
|
1325
|
-
* this procedure initializes the sgp4 propagator. all the initialization is
|
|
1326
|
-
* consolidated here instead of having multiple loops inside other routines.
|
|
1327
|
-
*
|
|
1328
|
-
* author : david vallado 719-573-2600 28 jun 2005
|
|
1329
|
-
*
|
|
1330
|
-
* inputs :
|
|
1331
|
-
* satn - satellite number - not needed, placed in satrec
|
|
1332
|
-
* xke - reciprocal of tumin
|
|
1333
|
-
* j2 - j2 zonal harmonic
|
|
1334
|
-
* ecco - eccentricity 0.0 - 1.0
|
|
1335
|
-
* epoch - epoch time in days from jan 0, 1950. 0 hr
|
|
1336
|
-
* inclo - inclination of satellite
|
|
1337
|
-
* no - mean motion of satellite
|
|
1338
|
-
*
|
|
1339
|
-
* outputs :
|
|
1340
|
-
* ainv - 1.0 / a
|
|
1341
|
-
* ao - semi major axis
|
|
1342
|
-
* con41 -
|
|
1343
|
-
* con42 - 1.0 - 5.0 cos(i)
|
|
1344
|
-
* cosio - cosine of inclination
|
|
1345
|
-
* cosio2 - cosio squared
|
|
1346
|
-
* eccsq - eccentricity squared
|
|
1347
|
-
* method - flag for deep space 'd', 'n'
|
|
1348
|
-
* omeosq - 1.0 - ecco * ecco
|
|
1349
|
-
* posq - semi-parameter squared
|
|
1350
|
-
* rp - radius of perigee
|
|
1351
|
-
* rteosq - square root of (1.0 - ecco*ecco)
|
|
1352
|
-
* sinio - sine of inclination
|
|
1353
|
-
* gsto - gst at time of observation rad
|
|
1354
|
-
* no - mean motion of satellite
|
|
1355
|
-
*
|
|
1356
|
-
* locals :
|
|
1357
|
-
* ak -
|
|
1358
|
-
* d1 -
|
|
1359
|
-
* del -
|
|
1360
|
-
* adel -
|
|
1361
|
-
* po -
|
|
1362
|
-
*
|
|
1363
|
-
* coupling :
|
|
1364
|
-
* getgravconst- no longer used
|
|
1365
|
-
* gstime - find greenwich sidereal time from the julian date
|
|
1366
|
-
*
|
|
1367
|
-
* references :
|
|
1368
|
-
* hoots, roehrich, norad spacetrack report #3 1980
|
|
1369
|
-
* hoots, norad spacetrack report #6 1986
|
|
1370
|
-
* hoots, schumacher and glover 2004
|
|
1371
|
-
* vallado, crawford, hujsak, kelso 2006
|
|
1372
|
-
----------------------------------------------------------------------------*/
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
Sgp4.initl = function (options) {
|
|
1376
|
-
// sgp4fix satn not needed. include in satrec in case needed later
|
|
1377
|
-
// int satn,
|
|
1378
|
-
// sgp4fix just pass in xke and j2
|
|
1379
|
-
// gravconsttype whichconst,
|
|
1380
|
-
var opsmode = options.opsmode,
|
|
1381
|
-
ecco = options.ecco,
|
|
1382
|
-
epoch = options.epoch,
|
|
1383
|
-
inclo = options.inclo,
|
|
1384
|
-
xke = options.xke,
|
|
1385
|
-
j2 = options.j2;
|
|
1386
|
-
var no = options.no;
|
|
1387
|
-
/* --------------------- local variables ------------------------ */
|
|
1388
|
-
|
|
1389
|
-
/** Ootk -- Declared at the top of the file */
|
|
1390
|
-
// sgp4fix use old way of finding gst
|
|
1391
|
-
|
|
1392
|
-
/** Ootk -- Declared at the top of the file */
|
|
1393
|
-
// ----------------------- earth constants ---------------------
|
|
1394
|
-
// sgp4fix identify constants and allow alternate values
|
|
1395
|
-
// only xke and j2 are used here so pass them in directly
|
|
1396
|
-
// getgravconst( whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2 )
|
|
1397
|
-
// ------------- calculate auxillary epoch quantities ----------
|
|
1398
|
-
|
|
1399
|
-
eccsq = ecco * ecco;
|
|
1400
|
-
omeosq = 1.0 - eccsq;
|
|
1401
|
-
rteosq = Math.sqrt(omeosq);
|
|
1402
|
-
cosio = Math.cos(inclo);
|
|
1403
|
-
cosio2 = cosio * cosio; // ------------------ un-kozai the mean motion -----------------
|
|
1404
|
-
|
|
1405
|
-
ak = Math.pow(xke / no, x2o3);
|
|
1406
|
-
d1 = 0.75 * j2 * (3.0 * cosio2 - 1.0) / (rteosq * omeosq);
|
|
1407
|
-
var delPrime = d1 / (ak * ak);
|
|
1408
|
-
adel = ak * (1.0 - delPrime * delPrime - delPrime * (1.0 / 3.0 + 134.0 * delPrime * delPrime / 81.0));
|
|
1409
|
-
delPrime = d1 / (adel * adel);
|
|
1410
|
-
no = no / (1.0 + delPrime);
|
|
1411
|
-
ao = Math.pow(xke / no, x2o3);
|
|
1412
|
-
sinio = Math.sin(inclo);
|
|
1413
|
-
po = ao * omeosq;
|
|
1414
|
-
con42 = 1.0 - 5.0 * cosio2;
|
|
1415
|
-
con41 = -con42 - cosio2 - cosio2;
|
|
1416
|
-
ainv = 1.0 / ao;
|
|
1417
|
-
posq = po * po;
|
|
1418
|
-
rp = ao * (1.0 - ecco);
|
|
1419
|
-
method = 'n'; // sgp4fix modern approach to finding sidereal time
|
|
1420
|
-
|
|
1421
|
-
/** Ootk -- Continue allowing AFSPC mode for SGP4 Validation */
|
|
1422
|
-
|
|
1423
|
-
if (opsmode == 'a') {
|
|
1424
|
-
// sgp4fix use old way of finding gst
|
|
1425
|
-
// count integer number of days from 0 jan 1970
|
|
1426
|
-
ts70 = epoch - 7305.0;
|
|
1427
|
-
ds70 = Math.floor(ts70 + 1.0e-8);
|
|
1428
|
-
tfrac = ts70 - ds70; // find greenwich location at epoch
|
|
1429
|
-
|
|
1430
|
-
c1 = 1.72027916940703639e-2;
|
|
1431
|
-
thgr70 = 1.7321343856509374;
|
|
1432
|
-
fk5r = 5.07551419432269442e-15;
|
|
1433
|
-
c1p2p = c1 + TAU;
|
|
1434
|
-
gsto = (thgr70 + c1 * ds70 + c1p2p * tfrac + ts70 * ts70 * fk5r) % TAU;
|
|
1435
|
-
/* istanbul ignore next | This is no longer possible*/
|
|
1436
|
-
|
|
1437
|
-
if (gsto < 0.0) {
|
|
1438
|
-
gsto += TAU;
|
|
1439
|
-
}
|
|
1440
|
-
} else {
|
|
1441
|
-
gsto = Sgp4.gstime(epoch + 2433281.5);
|
|
1442
|
-
}
|
|
1443
|
-
|
|
1444
|
-
return {
|
|
1445
|
-
no: no,
|
|
1446
|
-
method: method,
|
|
1447
|
-
ainv: ainv,
|
|
1448
|
-
ao: ao,
|
|
1449
|
-
con41: con41,
|
|
1450
|
-
con42: con42,
|
|
1451
|
-
cosio: cosio,
|
|
1452
|
-
cosio2: cosio2,
|
|
1453
|
-
eccsq: eccsq,
|
|
1454
|
-
omeosq: omeosq,
|
|
1455
|
-
posq: posq,
|
|
1456
|
-
rp: rp,
|
|
1457
|
-
rteosq: rteosq,
|
|
1458
|
-
sinio: sinio,
|
|
1459
|
-
gsto: gsto
|
|
1460
|
-
};
|
|
1461
|
-
}; // initl
|
|
1462
|
-
|
|
1463
|
-
/*-----------------------------------------------------------------------------
|
|
1464
|
-
*
|
|
1465
|
-
* procedure sgp4init
|
|
1466
|
-
*
|
|
1467
|
-
* this procedure initializes variables for sgp4.
|
|
1468
|
-
*
|
|
1469
|
-
* author : david vallado 719-573-2600 28 jun 2005
|
|
1470
|
-
*
|
|
1471
|
-
* inputs :
|
|
1472
|
-
* opsmode - mode of operation afspc or improved 'a', 'i'
|
|
1473
|
-
* whichconst - which set of constants to use 72, 84
|
|
1474
|
-
* satn - satellite number
|
|
1475
|
-
* bstar - sgp4 type drag coefficient kg/m2er
|
|
1476
|
-
* ecco - eccentricity
|
|
1477
|
-
* epoch - epoch time in days from jan 0, 1950. 0 hr
|
|
1478
|
-
* argpo - argument of perigee (output if ds)
|
|
1479
|
-
* inclo - inclination
|
|
1480
|
-
* mo - mean anomaly (output if ds)
|
|
1481
|
-
* no - mean motion
|
|
1482
|
-
* nodeo - right ascension of ascending node
|
|
1483
|
-
*
|
|
1484
|
-
* outputs :
|
|
1485
|
-
* rec - common values for subsequent calls
|
|
1486
|
-
* return code - non-zero on error.
|
|
1487
|
-
* 1 - mean elements, ecc >= 1.0 or ecc < -0.001 or a < 0.95 er
|
|
1488
|
-
* 2 - mean motion less than 0.0
|
|
1489
|
-
* 3 - pert elements, ecc < 0.0 or ecc > 1.0
|
|
1490
|
-
* 4 - semi-latus rectum < 0.0
|
|
1491
|
-
* 5 - epoch elements are sub-orbital
|
|
1492
|
-
* 6 - satellite has decayed
|
|
1493
|
-
*
|
|
1494
|
-
* locals :
|
|
1495
|
-
* cnodm , snodm , cosim , sinim , cosomm , sinomm
|
|
1496
|
-
* cc1sq , cc2 , cc3
|
|
1497
|
-
* coef , coef1
|
|
1498
|
-
* cosio4 -
|
|
1499
|
-
* day -
|
|
1500
|
-
* dndt -
|
|
1501
|
-
* em - eccentricity
|
|
1502
|
-
* emsq - eccentricity squared
|
|
1503
|
-
* eeta -
|
|
1504
|
-
* etasq -
|
|
1505
|
-
* gam -
|
|
1506
|
-
* argpm - argument of perigee
|
|
1507
|
-
* nodem -
|
|
1508
|
-
* inclm - inclination
|
|
1509
|
-
* mm - mean anomaly
|
|
1510
|
-
* nm - mean motion
|
|
1511
|
-
* perige - perigee
|
|
1512
|
-
* PInvsq -
|
|
1513
|
-
* psisq -
|
|
1514
|
-
* qzms24 -
|
|
1515
|
-
* rtemsq -
|
|
1516
|
-
* s1, s2, s3, s4, s5, s6, s7 -
|
|
1517
|
-
* sfour -
|
|
1518
|
-
* ss1, ss2, ss3, ss4, ss5, ss6, ss7 -
|
|
1519
|
-
* sz1, sz2, sz3
|
|
1520
|
-
* sz11, sz12, sz13, sz21, sz22, sz23, sz31, sz32, sz33 -
|
|
1521
|
-
* tc -
|
|
1522
|
-
* temp -
|
|
1523
|
-
* temp1, temp2, temp3 -
|
|
1524
|
-
* tsi -
|
|
1525
|
-
* xPIdot -
|
|
1526
|
-
* xhdot1 -
|
|
1527
|
-
* z1, z2, z3 -
|
|
1528
|
-
* z11, z12, z13, z21, z22, z23, z31, z32, z33 -
|
|
1529
|
-
*
|
|
1530
|
-
* coupling :
|
|
1531
|
-
* getgravconst-
|
|
1532
|
-
* initl -
|
|
1533
|
-
* dscom -
|
|
1534
|
-
* dpper -
|
|
1535
|
-
* dsinit -
|
|
1536
|
-
* sgp4 -
|
|
1537
|
-
*
|
|
1538
|
-
* references :
|
|
1539
|
-
* hoots, roehrich, norad spacetrack report #3 1980
|
|
1540
|
-
* hoots, norad spacetrack report #6 1986
|
|
1541
|
-
* hoots, schumacher and glover 2004
|
|
1542
|
-
* vallado, crawford, hujsak, kelso 2006
|
|
1543
|
-
----------------------------------------------------------------------------*/
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
Sgp4.sgp4init = function (satrec, options) {
|
|
1547
|
-
/* eslint-disable no-param-reassign */
|
|
1548
|
-
var _a = options.whichconst,
|
|
1549
|
-
whichconst = _a === void 0 ? 'wgs72' : _a,
|
|
1550
|
-
_b = options.opsmode,
|
|
1551
|
-
opsmode = _b === void 0 ? i : _b,
|
|
1552
|
-
_c = options.satn,
|
|
1553
|
-
satn = _c === void 0 ? satrec.satnum : _c,
|
|
1554
|
-
epoch = options.epoch,
|
|
1555
|
-
xbstar = options.xbstar,
|
|
1556
|
-
xecco = options.xecco,
|
|
1557
|
-
xargpo = options.xargpo,
|
|
1558
|
-
xinclo = options.xinclo,
|
|
1559
|
-
xndot = options.xndot,
|
|
1560
|
-
xnddot = options.xnddot,
|
|
1561
|
-
xmo = options.xmo,
|
|
1562
|
-
xno = options.xno,
|
|
1563
|
-
xnodeo = options.xnodeo;
|
|
1564
|
-
/* --------------------- local variables ------------------------ */
|
|
1565
|
-
|
|
1566
|
-
/** Ootk -- Declared at the top of the file */
|
|
1567
|
-
|
|
1568
|
-
/* ------------------------ initialization --------------------- */
|
|
1569
|
-
// sgp4fix divisor for divide by zero check on inclination
|
|
1570
|
-
// the old check used 1.0 + Math.cos(PI-1.0e-9), but then compared it to
|
|
1571
|
-
// 1.5 e-12, so the threshold was changed to 1.5e-12 for consistency
|
|
1572
|
-
// temp4 = 1.5e-12;
|
|
1573
|
-
// ----------- set all near earth variables to zero ------------
|
|
1574
|
-
|
|
1575
|
-
satrec.isimp = 0;
|
|
1576
|
-
satrec.method = 'n';
|
|
1577
|
-
satrec.aycof = 0.0;
|
|
1578
|
-
satrec.con41 = 0.0;
|
|
1579
|
-
satrec.cc1 = 0.0;
|
|
1580
|
-
satrec.cc4 = 0.0;
|
|
1581
|
-
satrec.cc5 = 0.0;
|
|
1582
|
-
satrec.d2 = 0.0;
|
|
1583
|
-
satrec.d3 = 0.0;
|
|
1584
|
-
satrec.d4 = 0.0;
|
|
1585
|
-
satrec.delmo = 0.0;
|
|
1586
|
-
satrec.eta = 0.0;
|
|
1587
|
-
satrec.argpdot = 0.0;
|
|
1588
|
-
satrec.omgcof = 0.0;
|
|
1589
|
-
satrec.sinmao = 0.0;
|
|
1590
|
-
satrec.t = 0.0;
|
|
1591
|
-
satrec.t2cof = 0.0;
|
|
1592
|
-
satrec.t3cof = 0.0;
|
|
1593
|
-
satrec.t4cof = 0.0;
|
|
1594
|
-
satrec.t5cof = 0.0;
|
|
1595
|
-
satrec.x1mth2 = 0.0;
|
|
1596
|
-
satrec.x7thm1 = 0.0;
|
|
1597
|
-
satrec.mdot = 0.0;
|
|
1598
|
-
satrec.nodedot = 0.0;
|
|
1599
|
-
satrec.xlcof = 0.0;
|
|
1600
|
-
satrec.xmcof = 0.0;
|
|
1601
|
-
satrec.nodecf = 0.0; // ----------- set all deep space variables to zero ------------
|
|
1602
|
-
|
|
1603
|
-
satrec.irez = 0;
|
|
1604
|
-
satrec.d2201 = 0.0;
|
|
1605
|
-
satrec.d2211 = 0.0;
|
|
1606
|
-
satrec.d3210 = 0.0;
|
|
1607
|
-
satrec.d3222 = 0.0;
|
|
1608
|
-
satrec.d4410 = 0.0;
|
|
1609
|
-
satrec.d4422 = 0.0;
|
|
1610
|
-
satrec.d5220 = 0.0;
|
|
1611
|
-
satrec.d5232 = 0.0;
|
|
1612
|
-
satrec.d5421 = 0.0;
|
|
1613
|
-
satrec.d5433 = 0.0;
|
|
1614
|
-
satrec.dedt = 0.0;
|
|
1615
|
-
satrec.del1 = 0.0;
|
|
1616
|
-
satrec.del2 = 0.0;
|
|
1617
|
-
satrec.del3 = 0.0;
|
|
1618
|
-
satrec.didt = 0.0;
|
|
1619
|
-
satrec.dmdt = 0.0;
|
|
1620
|
-
satrec.dnodt = 0.0;
|
|
1621
|
-
satrec.domdt = 0.0;
|
|
1622
|
-
satrec.e3 = 0.0;
|
|
1623
|
-
satrec.ee2 = 0.0;
|
|
1624
|
-
satrec.peo = 0.0;
|
|
1625
|
-
satrec.pgho = 0.0;
|
|
1626
|
-
satrec.pho = 0.0;
|
|
1627
|
-
satrec.PInco = 0.0;
|
|
1628
|
-
satrec.plo = 0.0;
|
|
1629
|
-
satrec.se2 = 0.0;
|
|
1630
|
-
satrec.se3 = 0.0;
|
|
1631
|
-
satrec.sgh2 = 0.0;
|
|
1632
|
-
satrec.sgh3 = 0.0;
|
|
1633
|
-
satrec.sgh4 = 0.0;
|
|
1634
|
-
satrec.sh2 = 0.0;
|
|
1635
|
-
satrec.sh3 = 0.0;
|
|
1636
|
-
satrec.si2 = 0.0;
|
|
1637
|
-
satrec.si3 = 0.0;
|
|
1638
|
-
satrec.sl2 = 0.0;
|
|
1639
|
-
satrec.sl3 = 0.0;
|
|
1640
|
-
satrec.sl4 = 0.0;
|
|
1641
|
-
satrec.gsto = 0.0;
|
|
1642
|
-
satrec.xfact = 0.0;
|
|
1643
|
-
satrec.xgh2 = 0.0;
|
|
1644
|
-
satrec.xgh3 = 0.0;
|
|
1645
|
-
satrec.xgh4 = 0.0;
|
|
1646
|
-
satrec.xh2 = 0.0;
|
|
1647
|
-
satrec.xh3 = 0.0;
|
|
1648
|
-
satrec.xi2 = 0.0;
|
|
1649
|
-
satrec.xi3 = 0.0;
|
|
1650
|
-
satrec.xl2 = 0.0;
|
|
1651
|
-
satrec.xl3 = 0.0;
|
|
1652
|
-
satrec.xl4 = 0.0;
|
|
1653
|
-
satrec.xlamo = 0.0;
|
|
1654
|
-
satrec.zmol = 0.0;
|
|
1655
|
-
satrec.zmos = 0.0;
|
|
1656
|
-
satrec.atime = 0.0;
|
|
1657
|
-
satrec.xli = 0.0;
|
|
1658
|
-
satrec.xni = 0.0;
|
|
1659
|
-
/* ------------------------ earth constants ----------------------- */
|
|
1660
|
-
// sgp4fix identify constants and allow alternate values
|
|
1661
|
-
// this is now the only call for the constants
|
|
1662
|
-
|
|
1663
|
-
var gravResults = Sgp4.getgravconst(whichconst);
|
|
1664
|
-
satrec.tumin = gravResults.tumin;
|
|
1665
|
-
satrec.mus = gravResults.mus;
|
|
1666
|
-
satrec.radiusearthkm = gravResults.radiusearthkm;
|
|
1667
|
-
satrec.xke = gravResults.xke;
|
|
1668
|
-
satrec.j2 = gravResults.j2;
|
|
1669
|
-
satrec.j3 = gravResults.j3;
|
|
1670
|
-
satrec.j4 = gravResults.j4;
|
|
1671
|
-
satrec.j3oj2 = gravResults.j3oj2; //-------------------------------------------------------------------------
|
|
1672
|
-
|
|
1673
|
-
satrec.error = 0;
|
|
1674
|
-
satrec.operationmode = opsmode; // new alpha5 or 9-digit number
|
|
1675
|
-
|
|
1676
|
-
/** Ootk -- Using JS code for string manipulation but same effect
|
|
1677
|
-
* Ex. A2525 = 102525
|
|
1678
|
-
* Ex. Z1234 = 351234
|
|
1679
|
-
*/
|
|
1680
|
-
|
|
1681
|
-
leadingChar = satn.split('')[0].toLowerCase(); // Using uppercase will break the -96 math.
|
|
1682
|
-
|
|
1683
|
-
if (isNaN(leadingChar)) {
|
|
1684
|
-
satrec.satnum = parseInt(leadingChar.charCodeAt(0) - 96 + 9 + satrec.satnum.slice(1, 5)).toString();
|
|
1685
|
-
} else {
|
|
1686
|
-
satrec.satnum = satn;
|
|
1687
|
-
} // sgp4fix - note the following variables are also passed directly via satrec.
|
|
1688
|
-
// it is possible to streamline the sgp4init call by deleting the "x"
|
|
1689
|
-
// variables, but the user would need to set the satrec.* values first. we
|
|
1690
|
-
// include the additional assignments in case twoline2rv is not used.
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
satrec.bstar = xbstar; // sgp4fix allow additional parameters in the struct
|
|
1694
|
-
|
|
1695
|
-
satrec.ndot = xndot;
|
|
1696
|
-
satrec.nddot = xnddot;
|
|
1697
|
-
satrec.ecco = xecco;
|
|
1698
|
-
satrec.argpo = xargpo;
|
|
1699
|
-
satrec.inclo = xinclo;
|
|
1700
|
-
satrec.mo = xmo; // sgp4fix rename variables to clarify which mean motion is intended
|
|
1701
|
-
|
|
1702
|
-
satrec.no = xno;
|
|
1703
|
-
satrec.nodeo = xnodeo; // single averaged mean elements
|
|
1704
|
-
// satrec.am = satrec.em = satrec.im = satrec.Om = satrec.mm = satrec.nm = 0.0;
|
|
1705
|
-
// ------------------------ earth constants -----------------------
|
|
1706
|
-
// sgp4fix identify constants and allow alternate values
|
|
1707
|
-
// getgravconst( whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2 );
|
|
1708
|
-
|
|
1709
|
-
ss = 78.0 / satrec.radiusearthkm + 1.0; // sgp4fix use multiply for speed instead of pow
|
|
1710
|
-
|
|
1711
|
-
qzms2ttemp = (120.0 - 78.0) / satrec.radiusearthkm;
|
|
1712
|
-
qzms2t = qzms2ttemp * qzms2ttemp * qzms2ttemp * qzms2ttemp;
|
|
1713
|
-
satrec.init = 'y';
|
|
1714
|
-
satrec.t = 0.0; // sgp4fix remove satn as it is not needed in initl
|
|
1715
|
-
|
|
1716
|
-
initlOptions = {
|
|
1717
|
-
ecco: satrec.ecco,
|
|
1718
|
-
epoch: epoch,
|
|
1719
|
-
inclo: satrec.inclo,
|
|
1720
|
-
no: satrec.no,
|
|
1721
|
-
method: satrec.method,
|
|
1722
|
-
opsmode: satrec.operationmode,
|
|
1723
|
-
xke: satrec.xke,
|
|
1724
|
-
j2: satrec.j2
|
|
1725
|
-
};
|
|
1726
|
-
initlResult = Sgp4.initl(initlOptions);
|
|
1727
|
-
var ao = initlResult.ao,
|
|
1728
|
-
con42 = initlResult.con42,
|
|
1729
|
-
cosio = initlResult.cosio,
|
|
1730
|
-
cosio2 = initlResult.cosio2,
|
|
1731
|
-
eccsq = initlResult.eccsq,
|
|
1732
|
-
omeosq = initlResult.omeosq,
|
|
1733
|
-
posq = initlResult.posq,
|
|
1734
|
-
rp = initlResult.rp,
|
|
1735
|
-
rteosq = initlResult.rteosq,
|
|
1736
|
-
sinio = initlResult.sinio;
|
|
1737
|
-
satrec.no = initlResult.no;
|
|
1738
|
-
satrec.con41 = initlResult.con41;
|
|
1739
|
-
satrec.gsto = initlResult.gsto;
|
|
1740
|
-
satrec.a = Math.pow(satrec.no * satrec.tumin, -2.0 / 3.0);
|
|
1741
|
-
satrec.alta = satrec.a * (1.0 + satrec.ecco) - 1.0;
|
|
1742
|
-
satrec.altp = satrec.a * (1.0 - satrec.ecco) - 1.0;
|
|
1743
|
-
satrec.error = 0; // sgp4fix remove this check as it is unnecessary
|
|
1744
|
-
// the mrt check in sgp4 handles decaying satellite cases even if the starting
|
|
1745
|
-
// condition is below the surface of te earth
|
|
1746
|
-
// if (rp < 1.0)
|
|
1747
|
-
// {
|
|
1748
|
-
// printf("// *** satn%d epoch elts sub-orbital ***\n", satn);
|
|
1749
|
-
// satrec.error = 5;
|
|
1750
|
-
// }
|
|
1751
|
-
|
|
1752
|
-
if (omeosq >= 0.0 || satrec.no >= 0.0) {
|
|
1753
|
-
satrec.isimp = 0;
|
|
1754
|
-
|
|
1755
|
-
if (rp < 220.0 / satrec.radiusearthkm + 1.0) {
|
|
1756
|
-
satrec.isimp = 1;
|
|
1757
|
-
}
|
|
1758
|
-
|
|
1759
|
-
sfour = ss;
|
|
1760
|
-
qzms24 = qzms2t;
|
|
1761
|
-
perige = (rp - 1.0) * satrec.radiusearthkm; // - for perigees below 156 km, s and qoms2t are altered -
|
|
1762
|
-
|
|
1763
|
-
if (perige < 156.0) {
|
|
1764
|
-
sfour = perige - 78.0;
|
|
1765
|
-
|
|
1766
|
-
if (perige < 98.0) {
|
|
1767
|
-
sfour = 20.0;
|
|
1768
|
-
} // sgp4fix use multiply for speed instead of pow
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
qzms24temp = (120.0 - sfour) / satrec.radiusearthkm;
|
|
1772
|
-
qzms24 = qzms24temp * qzms24temp * qzms24temp * qzms24temp;
|
|
1773
|
-
sfour = sfour / satrec.radiusearthkm + 1.0;
|
|
1774
|
-
}
|
|
1775
|
-
|
|
1776
|
-
PInvsq = 1.0 / posq;
|
|
1777
|
-
tsi = 1.0 / (ao - sfour);
|
|
1778
|
-
satrec.eta = ao * satrec.ecco * tsi;
|
|
1779
|
-
etasq = satrec.eta * satrec.eta;
|
|
1780
|
-
eeta = satrec.ecco * satrec.eta;
|
|
1781
|
-
psisq = Math.abs(1.0 - etasq);
|
|
1782
|
-
coef = qzms24 * Math.pow(tsi, 4.0);
|
|
1783
|
-
coef1 = coef / Math.pow(psisq, 3.5);
|
|
1784
|
-
cc2 = coef1 * satrec.no * (ao * (1.0 + 1.5 * etasq + eeta * (4.0 + etasq)) + 0.375 * j2 * tsi / psisq * satrec.con41 * (8.0 + 3.0 * etasq * (8.0 + etasq)));
|
|
1785
|
-
satrec.cc1 = satrec.bstar * cc2;
|
|
1786
|
-
cc3 = 0.0;
|
|
1787
|
-
|
|
1788
|
-
if (satrec.ecco > 1.0e-4) {
|
|
1789
|
-
cc3 = -2.0 * coef * tsi * j3oj2 * satrec.no * sinio / satrec.ecco;
|
|
1790
|
-
}
|
|
1791
|
-
|
|
1792
|
-
satrec.x1mth2 = 1.0 - cosio2;
|
|
1793
|
-
satrec.cc4 = 2.0 * satrec.no * coef1 * ao * omeosq * (satrec.eta * (2.0 + 0.5 * etasq) + satrec.ecco * (0.5 + 2.0 * etasq) - j2 * tsi / (ao * psisq) * (-3.0 * satrec.con41 * (1.0 - 2.0 * eeta + etasq * (1.5 - 0.5 * eeta)) + 0.75 * satrec.x1mth2 * (2.0 * etasq - eeta * (1.0 + etasq)) * Math.cos(2.0 * satrec.argpo)));
|
|
1794
|
-
satrec.cc5 = 2.0 * coef1 * ao * omeosq * (1.0 + 2.75 * (etasq + eeta) + eeta * etasq);
|
|
1795
|
-
cosio4 = cosio2 * cosio2;
|
|
1796
|
-
temp1 = 1.5 * j2 * PInvsq * satrec.no;
|
|
1797
|
-
temp2 = 0.5 * temp1 * j2 * PInvsq;
|
|
1798
|
-
temp3 = -0.46875 * j4 * PInvsq * PInvsq * satrec.no;
|
|
1799
|
-
satrec.mdot = satrec.no + 0.5 * temp1 * rteosq * satrec.con41 + 0.0625 * temp2 * rteosq * (13.0 - 78.0 * cosio2 + 137.0 * cosio4);
|
|
1800
|
-
satrec.argpdot = -0.5 * temp1 * con42 + 0.0625 * temp2 * (7.0 - 114.0 * cosio2 + 395.0 * cosio4) + temp3 * (3.0 - 36.0 * cosio2 + 49.0 * cosio4);
|
|
1801
|
-
xhdot1 = -temp1 * cosio;
|
|
1802
|
-
satrec.nodedot = xhdot1 + (0.5 * temp2 * (4.0 - 19.0 * cosio2) + 2.0 * temp3 * (3.0 - 7.0 * cosio2)) * cosio;
|
|
1803
|
-
xPIdot = satrec.argpdot + satrec.nodedot;
|
|
1804
|
-
satrec.omgcof = satrec.bstar * cc3 * Math.cos(satrec.argpo);
|
|
1805
|
-
satrec.xmcof = 0.0;
|
|
1806
|
-
|
|
1807
|
-
if (satrec.ecco > 1.0e-4) {
|
|
1808
|
-
satrec.xmcof = -x2o3 * coef * satrec.bstar / eeta;
|
|
1809
|
-
}
|
|
1810
|
-
|
|
1811
|
-
satrec.nodecf = 3.5 * omeosq * xhdot1 * satrec.cc1;
|
|
1812
|
-
satrec.t2cof = 1.5 * satrec.cc1; // sgp4fix for divide by zero with xinco = 180 deg
|
|
1813
|
-
|
|
1814
|
-
if (Math.abs(cosio + 1.0) > 1.5e-12) {
|
|
1815
|
-
satrec.xlcof = -0.25 * j3oj2 * sinio * (3.0 + 5.0 * cosio) / (1.0 + cosio);
|
|
1816
|
-
} else {
|
|
1817
|
-
satrec.xlcof = -0.25 * j3oj2 * sinio * (3.0 + 5.0 * cosio) / temp4;
|
|
1818
|
-
}
|
|
1819
|
-
|
|
1820
|
-
satrec.aycof = -0.5 * j3oj2 * sinio; // sgp4fix use multiply for speed instead of pow
|
|
1821
|
-
|
|
1822
|
-
delmotemp = 1.0 + satrec.eta * Math.cos(satrec.mo);
|
|
1823
|
-
satrec.delmo = delmotemp * delmotemp * delmotemp;
|
|
1824
|
-
satrec.sinmao = Math.sin(satrec.mo);
|
|
1825
|
-
satrec.x7thm1 = 7.0 * cosio2 - 1.0; // --------------- deep space initialization -------------
|
|
1826
|
-
|
|
1827
|
-
if (TAU / satrec.no >= 225.0) {
|
|
1828
|
-
satrec.method = 'd';
|
|
1829
|
-
satrec.isimp = 1;
|
|
1830
|
-
tc = 0.0;
|
|
1831
|
-
inclm = satrec.inclo;
|
|
1832
|
-
dscomOptions = {
|
|
1833
|
-
epoch: epoch,
|
|
1834
|
-
ep: satrec.ecco,
|
|
1835
|
-
argpp: satrec.argpo,
|
|
1836
|
-
tc: tc,
|
|
1837
|
-
inclp: satrec.inclo,
|
|
1838
|
-
nodep: satrec.nodeo,
|
|
1839
|
-
np: satrec.no,
|
|
1840
|
-
e3: satrec.e3,
|
|
1841
|
-
ee2: satrec.ee2,
|
|
1842
|
-
peo: satrec.peo,
|
|
1843
|
-
pgho: satrec.pgho,
|
|
1844
|
-
pho: satrec.pho,
|
|
1845
|
-
PInco: satrec.PInco,
|
|
1846
|
-
plo: satrec.plo,
|
|
1847
|
-
se2: satrec.se2,
|
|
1848
|
-
se3: satrec.se3,
|
|
1849
|
-
sgh2: satrec.sgh2,
|
|
1850
|
-
sgh3: satrec.sgh3,
|
|
1851
|
-
sgh4: satrec.sgh4,
|
|
1852
|
-
sh2: satrec.sh2,
|
|
1853
|
-
sh3: satrec.sh3,
|
|
1854
|
-
si2: satrec.si2,
|
|
1855
|
-
si3: satrec.si3,
|
|
1856
|
-
sl2: satrec.sl2,
|
|
1857
|
-
sl3: satrec.sl3,
|
|
1858
|
-
sl4: satrec.sl4,
|
|
1859
|
-
xgh2: satrec.xgh2,
|
|
1860
|
-
xgh3: satrec.xgh3,
|
|
1861
|
-
xgh4: satrec.xgh4,
|
|
1862
|
-
xh2: satrec.xh2,
|
|
1863
|
-
xh3: satrec.xh3,
|
|
1864
|
-
xi2: satrec.xi2,
|
|
1865
|
-
xi3: satrec.xi3,
|
|
1866
|
-
xl2: satrec.xl2,
|
|
1867
|
-
xl3: satrec.xl3,
|
|
1868
|
-
xl4: satrec.xl4,
|
|
1869
|
-
zmol: satrec.zmol,
|
|
1870
|
-
zmos: satrec.zmos
|
|
1871
|
-
};
|
|
1872
|
-
dscomResult = Sgp4.dscom(dscomOptions);
|
|
1873
|
-
satrec.e3 = dscomResult.e3;
|
|
1874
|
-
satrec.ee2 = dscomResult.ee2;
|
|
1875
|
-
satrec.peo = dscomResult.peo;
|
|
1876
|
-
satrec.pgho = dscomResult.pgho;
|
|
1877
|
-
satrec.pho = dscomResult.pho;
|
|
1878
|
-
satrec.PInco = dscomResult.PInco;
|
|
1879
|
-
satrec.plo = dscomResult.plo;
|
|
1880
|
-
satrec.se2 = dscomResult.se2;
|
|
1881
|
-
satrec.se3 = dscomResult.se3;
|
|
1882
|
-
satrec.sgh2 = dscomResult.sgh2;
|
|
1883
|
-
satrec.sgh3 = dscomResult.sgh3;
|
|
1884
|
-
satrec.sgh4 = dscomResult.sgh4;
|
|
1885
|
-
satrec.sh2 = dscomResult.sh2;
|
|
1886
|
-
satrec.sh3 = dscomResult.sh3;
|
|
1887
|
-
satrec.si2 = dscomResult.si2;
|
|
1888
|
-
satrec.si3 = dscomResult.si3;
|
|
1889
|
-
satrec.sl2 = dscomResult.sl2;
|
|
1890
|
-
satrec.sl3 = dscomResult.sl3;
|
|
1891
|
-
satrec.sl4 = dscomResult.sl4;
|
|
1892
|
-
var sinim_1 = dscomResult.sinim,
|
|
1893
|
-
cosim_1 = dscomResult.cosim,
|
|
1894
|
-
em_1 = dscomResult.em,
|
|
1895
|
-
emsq_1 = dscomResult.emsq,
|
|
1896
|
-
s1_1 = dscomResult.s1,
|
|
1897
|
-
s2_1 = dscomResult.s2,
|
|
1898
|
-
s3_1 = dscomResult.s3,
|
|
1899
|
-
s4_1 = dscomResult.s4,
|
|
1900
|
-
s5_1 = dscomResult.s5,
|
|
1901
|
-
ss1_1 = dscomResult.ss1,
|
|
1902
|
-
ss2_1 = dscomResult.ss2,
|
|
1903
|
-
ss3_1 = dscomResult.ss3,
|
|
1904
|
-
ss4_1 = dscomResult.ss4,
|
|
1905
|
-
ss5_1 = dscomResult.ss5,
|
|
1906
|
-
sz1_1 = dscomResult.sz1,
|
|
1907
|
-
sz3_1 = dscomResult.sz3,
|
|
1908
|
-
sz11_1 = dscomResult.sz11,
|
|
1909
|
-
sz13_1 = dscomResult.sz13,
|
|
1910
|
-
sz21_1 = dscomResult.sz21,
|
|
1911
|
-
sz23_1 = dscomResult.sz23,
|
|
1912
|
-
sz31_1 = dscomResult.sz31,
|
|
1913
|
-
sz33_1 = dscomResult.sz33;
|
|
1914
|
-
satrec.xgh2 = dscomResult.xgh2;
|
|
1915
|
-
satrec.xgh3 = dscomResult.xgh3;
|
|
1916
|
-
satrec.xgh4 = dscomResult.xgh4;
|
|
1917
|
-
satrec.xh2 = dscomResult.xh2;
|
|
1918
|
-
satrec.xh3 = dscomResult.xh3;
|
|
1919
|
-
satrec.xi2 = dscomResult.xi2;
|
|
1920
|
-
satrec.xi3 = dscomResult.xi3;
|
|
1921
|
-
satrec.xl2 = dscomResult.xl2;
|
|
1922
|
-
satrec.xl3 = dscomResult.xl3;
|
|
1923
|
-
satrec.xl4 = dscomResult.xl4;
|
|
1924
|
-
satrec.zmol = dscomResult.zmol;
|
|
1925
|
-
satrec.zmos = dscomResult.zmos;
|
|
1926
|
-
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;
|
|
1927
|
-
dpperOptions = {
|
|
1928
|
-
inclo: inclm,
|
|
1929
|
-
init: satrec.init,
|
|
1930
|
-
ep: satrec.ecco,
|
|
1931
|
-
inclp: satrec.inclo,
|
|
1932
|
-
nodep: satrec.nodeo,
|
|
1933
|
-
argpp: satrec.argpo,
|
|
1934
|
-
mp: satrec.mo,
|
|
1935
|
-
opsmode: satrec.operationmode
|
|
1936
|
-
};
|
|
1937
|
-
dpperResult = Sgp4.dpper(satrec, dpperOptions);
|
|
1938
|
-
satrec.ecco = dpperResult.ep;
|
|
1939
|
-
satrec.inclo = dpperResult.inclp;
|
|
1940
|
-
satrec.nodeo = dpperResult.nodep;
|
|
1941
|
-
satrec.argpo = dpperResult.argpp;
|
|
1942
|
-
satrec.mo = dpperResult.mp;
|
|
1943
|
-
argpm = 0.0;
|
|
1944
|
-
nodem = 0.0;
|
|
1945
|
-
mm = 0.0;
|
|
1946
|
-
dsinitOptions = {
|
|
1947
|
-
xke: xke,
|
|
1948
|
-
cosim: cosim_1,
|
|
1949
|
-
emsq: emsq_1,
|
|
1950
|
-
argpo: satrec.argpo,
|
|
1951
|
-
s1: s1_1,
|
|
1952
|
-
s2: s2_1,
|
|
1953
|
-
s3: s3_1,
|
|
1954
|
-
s4: s4_1,
|
|
1955
|
-
s5: s5_1,
|
|
1956
|
-
sinim: sinim_1,
|
|
1957
|
-
ss1: ss1_1,
|
|
1958
|
-
ss2: ss2_1,
|
|
1959
|
-
ss3: ss3_1,
|
|
1960
|
-
ss4: ss4_1,
|
|
1961
|
-
ss5: ss5_1,
|
|
1962
|
-
sz1: sz1_1,
|
|
1963
|
-
sz3: sz3_1,
|
|
1964
|
-
sz11: sz11_1,
|
|
1965
|
-
sz13: sz13_1,
|
|
1966
|
-
sz21: sz21_1,
|
|
1967
|
-
sz23: sz23_1,
|
|
1968
|
-
sz31: sz31_1,
|
|
1969
|
-
sz33: sz33_1,
|
|
1970
|
-
t: satrec.t,
|
|
1971
|
-
tc: tc,
|
|
1972
|
-
gsto: satrec.gsto,
|
|
1973
|
-
mo: satrec.mo,
|
|
1974
|
-
mdot: satrec.mdot,
|
|
1975
|
-
no: satrec.no,
|
|
1976
|
-
nodeo: satrec.nodeo,
|
|
1977
|
-
nodedot: satrec.nodedot,
|
|
1978
|
-
xPIdot: xPIdot,
|
|
1979
|
-
z1: z1,
|
|
1980
|
-
z3: z3,
|
|
1981
|
-
z11: z11,
|
|
1982
|
-
z13: z13,
|
|
1983
|
-
z21: z21,
|
|
1984
|
-
z23: z23,
|
|
1985
|
-
z31: z31,
|
|
1986
|
-
z33: z33,
|
|
1987
|
-
ecco: satrec.ecco,
|
|
1988
|
-
eccsq: eccsq,
|
|
1989
|
-
em: em_1,
|
|
1990
|
-
argpm: argpm,
|
|
1991
|
-
inclm: inclm,
|
|
1992
|
-
mm: mm,
|
|
1993
|
-
nm: nm,
|
|
1994
|
-
nodem: nodem,
|
|
1995
|
-
irez: satrec.irez,
|
|
1996
|
-
atime: satrec.atime,
|
|
1997
|
-
d2201: satrec.d2201,
|
|
1998
|
-
d2211: satrec.d2211,
|
|
1999
|
-
d3210: satrec.d3210,
|
|
2000
|
-
d3222: satrec.d3222,
|
|
2001
|
-
d4410: satrec.d4410,
|
|
2002
|
-
d4422: satrec.d4422,
|
|
2003
|
-
d5220: satrec.d5220,
|
|
2004
|
-
d5232: satrec.d5232,
|
|
2005
|
-
d5421: satrec.d5421,
|
|
2006
|
-
d5433: satrec.d5433,
|
|
2007
|
-
dedt: satrec.dedt,
|
|
2008
|
-
didt: satrec.didt,
|
|
2009
|
-
dmdt: satrec.dmdt,
|
|
2010
|
-
dnodt: satrec.dnodt,
|
|
2011
|
-
domdt: satrec.domdt,
|
|
2012
|
-
del1: satrec.del1,
|
|
2013
|
-
del2: satrec.del2,
|
|
2014
|
-
del3: satrec.del3,
|
|
2015
|
-
xfact: satrec.xfact,
|
|
2016
|
-
xlamo: satrec.xlamo,
|
|
2017
|
-
xli: satrec.xli,
|
|
2018
|
-
xni: satrec.xni
|
|
2019
|
-
};
|
|
2020
|
-
dsinitResult = Sgp4.dsinit(dsinitOptions);
|
|
2021
|
-
satrec.irez = dsinitResult.irez;
|
|
2022
|
-
satrec.atime = dsinitResult.atime;
|
|
2023
|
-
satrec.d2201 = dsinitResult.d2201;
|
|
2024
|
-
satrec.d2211 = dsinitResult.d2211;
|
|
2025
|
-
satrec.d3210 = dsinitResult.d3210;
|
|
2026
|
-
satrec.d3222 = dsinitResult.d3222;
|
|
2027
|
-
satrec.d4410 = dsinitResult.d4410;
|
|
2028
|
-
satrec.d4422 = dsinitResult.d4422;
|
|
2029
|
-
satrec.d5220 = dsinitResult.d5220;
|
|
2030
|
-
satrec.d5232 = dsinitResult.d5232;
|
|
2031
|
-
satrec.d5421 = dsinitResult.d5421;
|
|
2032
|
-
satrec.d5433 = dsinitResult.d5433;
|
|
2033
|
-
satrec.dedt = dsinitResult.dedt;
|
|
2034
|
-
satrec.didt = dsinitResult.didt;
|
|
2035
|
-
satrec.dmdt = dsinitResult.dmdt;
|
|
2036
|
-
satrec.dnodt = dsinitResult.dnodt;
|
|
2037
|
-
satrec.domdt = dsinitResult.domdt;
|
|
2038
|
-
satrec.del1 = dsinitResult.del1;
|
|
2039
|
-
satrec.del2 = dsinitResult.del2;
|
|
2040
|
-
satrec.del3 = dsinitResult.del3;
|
|
2041
|
-
satrec.xfact = dsinitResult.xfact;
|
|
2042
|
-
satrec.xlamo = dsinitResult.xlamo;
|
|
2043
|
-
satrec.xli = dsinitResult.xli;
|
|
2044
|
-
satrec.xni = dsinitResult.xni;
|
|
2045
|
-
} // ----------- set variables if not deep space -----------
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
if (satrec.isimp !== 1) {
|
|
2049
|
-
cc1sq = satrec.cc1 * satrec.cc1;
|
|
2050
|
-
satrec.d2 = 4.0 * ao * tsi * cc1sq;
|
|
2051
|
-
temp = satrec.d2 * tsi * satrec.cc1 / 3.0;
|
|
2052
|
-
satrec.d3 = (17.0 * ao + sfour) * temp;
|
|
2053
|
-
satrec.d4 = 0.5 * temp * ao * tsi * (221.0 * ao + 31.0 * sfour) * satrec.cc1;
|
|
2054
|
-
satrec.t3cof = satrec.d2 + 2.0 * cc1sq;
|
|
2055
|
-
satrec.t4cof = 0.25 * (3.0 * satrec.d3 + satrec.cc1 * (12.0 * satrec.d2 + 10.0 * cc1sq));
|
|
2056
|
-
satrec.t5cof = 0.2 * (3.0 * satrec.d4 + 12.0 * satrec.cc1 * satrec.d3 + 6.0 * satrec.d2 * satrec.d2 + 15.0 * cc1sq * (2.0 * satrec.d2 + cc1sq));
|
|
2057
|
-
} // if omeosq = 0 ...
|
|
2058
|
-
|
|
2059
|
-
/* finally propogate to zero epoch to initialize all others. */
|
|
2060
|
-
// sgp4fix take out check to let satellites process until they are actually below earth surface
|
|
2061
|
-
// if(satrec.error == 0)
|
|
2062
|
-
|
|
2063
|
-
}
|
|
2064
|
-
|
|
2065
|
-
Sgp4.propagate(satrec, 0);
|
|
2066
|
-
satrec.init = 'n'; //sgp4fix return boolean. satrec.error contains any error codes
|
|
2067
|
-
// return satrec; -- no reason to return anything in JS
|
|
2068
|
-
}; // sgp4init
|
|
2069
|
-
|
|
2070
|
-
/*----------------------------------------------------------------------------
|
|
2071
|
-
*
|
|
2072
|
-
* procedure sgp4
|
|
2073
|
-
*
|
|
2074
|
-
* this procedure is the sgp4 prediction model from space command. this is an
|
|
2075
|
-
* updated and combined version of sgp4 and sdp4, which were originally
|
|
2076
|
-
* published separately in spacetrack report //3. this version follows the
|
|
2077
|
-
* methodology from the aiaa paper (2006) describing the history and
|
|
2078
|
-
* development of the code.
|
|
2079
|
-
*
|
|
2080
|
-
* author : david vallado 719-573-2600 28 jun 2005
|
|
2081
|
-
*
|
|
2082
|
-
* inputs :
|
|
2083
|
-
* satrec - initialised structure from sgp4init() call.
|
|
2084
|
-
* tsince - time since epoch (minutes)
|
|
2085
|
-
*
|
|
2086
|
-
* outputs :
|
|
2087
|
-
* r - position vector km
|
|
2088
|
-
* v - velocity km/sec
|
|
2089
|
-
* return code - non-zero on error.
|
|
2090
|
-
* 1 - mean elements, ecc >= 1.0 or ecc < -0.001 or a < 0.95 er
|
|
2091
|
-
* 2 - mean motion less than 0.0
|
|
2092
|
-
* 3 - pert elements, ecc < 0.0 or ecc > 1.0
|
|
2093
|
-
* 4 - semi-latus rectum < 0.0
|
|
2094
|
-
* 5 - epoch elements are sub-orbital
|
|
2095
|
-
* 6 - satellite has decayed
|
|
2096
|
-
*
|
|
2097
|
-
* locals :
|
|
2098
|
-
* am -
|
|
2099
|
-
* axnl, aynl -
|
|
2100
|
-
* betal -
|
|
2101
|
-
* cosim , sinim , cosomm , sinomm , cnod , snod , cos2u ,
|
|
2102
|
-
* sin2u , coseo1 , sineo1 , cosi , sini , cosip , sinip ,
|
|
2103
|
-
* cosisq , cossu , sinsu , cosu , sinu
|
|
2104
|
-
* delm -
|
|
2105
|
-
* delomg -
|
|
2106
|
-
* dndt -
|
|
2107
|
-
* eccm -
|
|
2108
|
-
* emsq -
|
|
2109
|
-
* ecose -
|
|
2110
|
-
* el2 -
|
|
2111
|
-
* eo1 -
|
|
2112
|
-
* eccp -
|
|
2113
|
-
* esine -
|
|
2114
|
-
* argpm -
|
|
2115
|
-
* argpp -
|
|
2116
|
-
* omgadf -
|
|
2117
|
-
* pl -
|
|
2118
|
-
* r -
|
|
2119
|
-
* rtemsq -
|
|
2120
|
-
* rdotl -
|
|
2121
|
-
* rl -
|
|
2122
|
-
* rvdot -
|
|
2123
|
-
* rvdotl -
|
|
2124
|
-
* su -
|
|
2125
|
-
* t2 , t3 , t4 , tc
|
|
2126
|
-
* tem5, temp , temp1 , temp2 , tempa , tempe , templ
|
|
2127
|
-
* u , ux , uy , uz , vx , vy , vz
|
|
2128
|
-
* inclm - inclination
|
|
2129
|
-
* mm - mean anomaly
|
|
2130
|
-
* nm - mean motion
|
|
2131
|
-
* nodem - right asc of ascending node
|
|
2132
|
-
* xinc -
|
|
2133
|
-
* xincp -
|
|
2134
|
-
* xl -
|
|
2135
|
-
* xlm -
|
|
2136
|
-
* mp -
|
|
2137
|
-
* xmdf -
|
|
2138
|
-
* xmx -
|
|
2139
|
-
* xmy -
|
|
2140
|
-
* nodedf -
|
|
2141
|
-
* xnode -
|
|
2142
|
-
* nodep -
|
|
2143
|
-
* np -
|
|
2144
|
-
*
|
|
2145
|
-
* coupling :
|
|
2146
|
-
* getgravconst-
|
|
2147
|
-
* dpper
|
|
2148
|
-
* dspace
|
|
2149
|
-
*
|
|
2150
|
-
* references :
|
|
2151
|
-
* hoots, roehrich, norad spacetrack report //3 1980
|
|
2152
|
-
* hoots, norad spacetrack report //6 1986
|
|
2153
|
-
* hoots, schumacher and glover 2004
|
|
2154
|
-
* vallado, crawford, hujsak, kelso 2006
|
|
2155
|
-
----------------------------------------------------------------------------*/
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
Sgp4.propagate = function (satrec, tsince) {
|
|
2159
|
-
/* ------------------ set mathematical constants --------------- */
|
|
2160
|
-
// sgp4fix divisor for divide by zero check on inclination
|
|
2161
|
-
// the old check used 1.0 + cos(PI-1.0e-9), but then compared it to
|
|
2162
|
-
// 1.5 e-12, so the threshold was changed to 1.5e-12 for consistency
|
|
2163
|
-
|
|
2164
|
-
/** Ootk -- Declared at the top of the page */
|
|
2165
|
-
// temp4 = 1.5e-12;
|
|
2166
|
-
// sgp4fix identify constants and allow alternate values
|
|
2167
|
-
// getgravconst( whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2 );
|
|
2168
|
-
vkmpersec = satrec.radiusearthkm * satrec.xke / 60.0; // --------------------- clear sgp4 error flag -----------------
|
|
2169
|
-
|
|
2170
|
-
satrec.t = tsince;
|
|
2171
|
-
satrec.error = 0; // ------- update for secular gravity and atmospheric drag -----
|
|
2172
|
-
|
|
2173
|
-
xmdf = satrec.mo + satrec.mdot * satrec.t;
|
|
2174
|
-
argpdf = satrec.argpo + satrec.argpdot * satrec.t;
|
|
2175
|
-
nodedf = satrec.nodeo + satrec.nodedot * satrec.t;
|
|
2176
|
-
argpm = argpdf;
|
|
2177
|
-
mm = xmdf;
|
|
2178
|
-
t2 = satrec.t * satrec.t;
|
|
2179
|
-
nodem = nodedf + satrec.nodecf * t2;
|
|
2180
|
-
tempa = 1.0 - satrec.cc1 * satrec.t;
|
|
2181
|
-
tempe = satrec.bstar * satrec.cc4 * satrec.t;
|
|
2182
|
-
templ = satrec.t2cof * t2;
|
|
2183
|
-
|
|
2184
|
-
if (satrec.isimp !== 1) {
|
|
2185
|
-
delomg = satrec.omgcof * satrec.t; // sgp4fix use mutliply for speed instead of pow
|
|
2186
|
-
|
|
2187
|
-
delmtemp = 1.0 + satrec.eta * Math.cos(xmdf);
|
|
2188
|
-
delm = satrec.xmcof * (delmtemp * delmtemp * delmtemp - satrec.delmo);
|
|
2189
|
-
temp = delomg + delm;
|
|
2190
|
-
mm = xmdf + temp;
|
|
2191
|
-
argpm = argpdf - temp;
|
|
2192
|
-
t3 = t2 * satrec.t;
|
|
2193
|
-
t4 = t3 * satrec.t;
|
|
2194
|
-
tempa = tempa - satrec.d2 * t2 - satrec.d3 * t3 - satrec.d4 * t4;
|
|
2195
|
-
tempe += satrec.bstar * satrec.cc5 * (Math.sin(mm) - satrec.sinmao);
|
|
2196
|
-
templ = templ + satrec.t3cof * t3 + t4 * (satrec.t4cof + satrec.t * satrec.t5cof);
|
|
2197
|
-
}
|
|
2198
|
-
|
|
2199
|
-
nm = satrec.no;
|
|
2200
|
-
em = satrec.ecco;
|
|
2201
|
-
inclm = satrec.inclo;
|
|
2202
|
-
|
|
2203
|
-
if (satrec.method === 'd') {
|
|
2204
|
-
tc = satrec.t;
|
|
2205
|
-
dspaceOptions = {
|
|
2206
|
-
irez: satrec.irez,
|
|
2207
|
-
d2201: satrec.d2201,
|
|
2208
|
-
d2211: satrec.d2211,
|
|
2209
|
-
d3210: satrec.d3210,
|
|
2210
|
-
d3222: satrec.d3222,
|
|
2211
|
-
d4410: satrec.d4410,
|
|
2212
|
-
d4422: satrec.d4422,
|
|
2213
|
-
d5220: satrec.d5220,
|
|
2214
|
-
d5232: satrec.d5232,
|
|
2215
|
-
d5421: satrec.d5421,
|
|
2216
|
-
d5433: satrec.d5433,
|
|
2217
|
-
dedt: satrec.dedt,
|
|
2218
|
-
del1: satrec.del1,
|
|
2219
|
-
del2: satrec.del2,
|
|
2220
|
-
del3: satrec.del3,
|
|
2221
|
-
didt: satrec.didt,
|
|
2222
|
-
dmdt: satrec.dmdt,
|
|
2223
|
-
dnodt: satrec.dnodt,
|
|
2224
|
-
domdt: satrec.domdt,
|
|
2225
|
-
argpo: satrec.argpo,
|
|
2226
|
-
argpdot: satrec.argpdot,
|
|
2227
|
-
t: satrec.t,
|
|
2228
|
-
tc: tc,
|
|
2229
|
-
gsto: satrec.gsto,
|
|
2230
|
-
xfact: satrec.xfact,
|
|
2231
|
-
xlamo: satrec.xlamo,
|
|
2232
|
-
no: satrec.no,
|
|
2233
|
-
atime: satrec.atime,
|
|
2234
|
-
em: em,
|
|
2235
|
-
argpm: argpm,
|
|
2236
|
-
inclm: inclm,
|
|
2237
|
-
xli: satrec.xli,
|
|
2238
|
-
mm: mm,
|
|
2239
|
-
xni: satrec.xni,
|
|
2240
|
-
nodem: nodem,
|
|
2241
|
-
nm: nm
|
|
2242
|
-
};
|
|
2243
|
-
dspaceResult = Sgp4.dspace(dspaceOptions);
|
|
2244
|
-
em = dspaceResult.em, argpm = dspaceResult.argpm, inclm = dspaceResult.inclm, mm = dspaceResult.mm, nodem = dspaceResult.nodem, nm = dspaceResult.nm;
|
|
2245
|
-
} // if methjod = d
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
if (nm <= 0.0) {
|
|
2249
|
-
// printf("// error nm %f\n", nm);
|
|
2250
|
-
satrec.error = 2; // sgp4fix add return
|
|
2251
|
-
|
|
2252
|
-
return {
|
|
2253
|
-
position: false,
|
|
2254
|
-
velocity: false
|
|
2255
|
-
};
|
|
2256
|
-
}
|
|
2257
|
-
|
|
2258
|
-
am = Math.pow(xke / nm, x2o3) * tempa * tempa;
|
|
2259
|
-
nm = xke / Math.pow(am, 1.5);
|
|
2260
|
-
em -= tempe; // fix tolerance for error recognition
|
|
2261
|
-
// sgp4fix am is fixed from the previous nm check
|
|
2262
|
-
|
|
2263
|
-
/* istanbul ignore next | This is no longer possible*/
|
|
2264
|
-
|
|
2265
|
-
if (em >= 1.0 || em < -0.001) {
|
|
2266
|
-
// || (am < 0.95)
|
|
2267
|
-
// printf("// error em %f\n", em);
|
|
2268
|
-
satrec.error = 1; // sgp4fix to return if there is an error in eccentricity
|
|
2269
|
-
|
|
2270
|
-
return {
|
|
2271
|
-
position: false,
|
|
2272
|
-
velocity: false
|
|
2273
|
-
};
|
|
2274
|
-
} // sgp4fix fix tolerance to avoid a divide by zero
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
if (em < 1.0e-6) {
|
|
2278
|
-
em = 1.0e-6;
|
|
2279
|
-
}
|
|
2280
|
-
|
|
2281
|
-
mm += satrec.no * templ;
|
|
2282
|
-
xlm = mm + argpm + nodem;
|
|
2283
|
-
nodem %= TAU;
|
|
2284
|
-
argpm %= TAU;
|
|
2285
|
-
xlm %= TAU;
|
|
2286
|
-
mm = (xlm - argpm - nodem) % TAU; // sgp4fix recover singly averaged mean elements
|
|
2287
|
-
|
|
2288
|
-
satrec.am = am;
|
|
2289
|
-
satrec.em = em;
|
|
2290
|
-
satrec.im = inclm;
|
|
2291
|
-
satrec.Om = nodem;
|
|
2292
|
-
satrec.om = argpm;
|
|
2293
|
-
satrec.mm = mm;
|
|
2294
|
-
satrec.nm = nm; // ----------------- compute extra mean quantities -------------
|
|
2295
|
-
|
|
2296
|
-
sinim = Math.sin(inclm);
|
|
2297
|
-
cosim = Math.cos(inclm); // -------------------- add lunar-solar periodics --------------
|
|
2298
|
-
|
|
2299
|
-
ep = em;
|
|
2300
|
-
xincp = inclm;
|
|
2301
|
-
argpp = argpm;
|
|
2302
|
-
nodep = nodem;
|
|
2303
|
-
mp = mm;
|
|
2304
|
-
sinip = sinim;
|
|
2305
|
-
cosip = cosim;
|
|
2306
|
-
|
|
2307
|
-
if (satrec.method === 'd') {
|
|
2308
|
-
dpperParameters = {
|
|
2309
|
-
inclo: satrec.inclo,
|
|
2310
|
-
init: 'n',
|
|
2311
|
-
ep: ep,
|
|
2312
|
-
inclp: xincp,
|
|
2313
|
-
nodep: nodep,
|
|
2314
|
-
argpp: argpp,
|
|
2315
|
-
mp: mp,
|
|
2316
|
-
opsmode: satrec.operationmode
|
|
2317
|
-
};
|
|
2318
|
-
dpperResult = Sgp4.dpper(satrec, dpperParameters);
|
|
2319
|
-
ep = dpperResult.ep, nodep = dpperResult.nodep, argpp = dpperResult.argpp, mp = dpperResult.mp;
|
|
2320
|
-
xincp = dpperResult.inclp;
|
|
2321
|
-
|
|
2322
|
-
if (xincp < 0.0) {
|
|
2323
|
-
xincp = -xincp;
|
|
2324
|
-
nodep += PI;
|
|
2325
|
-
argpp -= PI;
|
|
2326
|
-
}
|
|
2327
|
-
|
|
2328
|
-
if (ep < 0.0 || ep > 1.0) {
|
|
2329
|
-
// printf("// error ep %f\n", ep);
|
|
2330
|
-
satrec.error = 3; // sgp4fix add return
|
|
2331
|
-
|
|
2332
|
-
return {
|
|
2333
|
-
position: false,
|
|
2334
|
-
velocity: false
|
|
2335
|
-
};
|
|
2336
|
-
}
|
|
2337
|
-
} // -------------------- long period periodics ------------------
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
if (satrec.method === 'd') {
|
|
2341
|
-
sinip = Math.sin(xincp);
|
|
2342
|
-
cosip = Math.cos(xincp);
|
|
2343
|
-
satrec.aycof = -0.5 * j3oj2 * sinip; // sgp4fix for divide by zero for xincp = 180 deg
|
|
2344
|
-
|
|
2345
|
-
/* istanbul ignore next | This is no longer possible*/
|
|
2346
|
-
|
|
2347
|
-
if (Math.abs(cosip + 1.0) > 1.5e-12) {
|
|
2348
|
-
satrec.xlcof = -0.25 * j3oj2 * sinip * (3.0 + 5.0 * cosip) / (1.0 + cosip);
|
|
2349
|
-
} else {
|
|
2350
|
-
satrec.xlcof = -0.25 * j3oj2 * sinip * (3.0 + 5.0 * cosip) / temp4;
|
|
2351
|
-
}
|
|
2352
|
-
}
|
|
2353
|
-
|
|
2354
|
-
axnl = ep * Math.cos(argpp);
|
|
2355
|
-
temp = 1.0 / (am * (1.0 - ep * ep));
|
|
2356
|
-
aynl = ep * Math.sin(argpp) + temp * satrec.aycof;
|
|
2357
|
-
xl = mp + argpp + nodep + temp * satrec.xlcof * axnl; // --------------------- solve kepler's equation ---------------
|
|
2358
|
-
|
|
2359
|
-
u = (xl - nodep) % TAU;
|
|
2360
|
-
eo1 = u;
|
|
2361
|
-
tem5 = 9999.9;
|
|
2362
|
-
ktr = 1; // sgp4fix for kepler iteration
|
|
2363
|
-
// the following iteration needs better limits on corrections
|
|
2364
|
-
|
|
2365
|
-
while (Math.abs(tem5) >= 1.0e-12 && ktr <= 10) {
|
|
2366
|
-
sineo1 = Math.sin(eo1);
|
|
2367
|
-
coseo1 = Math.cos(eo1);
|
|
2368
|
-
tem5 = 1.0 - coseo1 * axnl - sineo1 * aynl;
|
|
2369
|
-
tem5 = (u - aynl * coseo1 + axnl * sineo1 - eo1) / tem5;
|
|
2370
|
-
|
|
2371
|
-
if (Math.abs(tem5) >= 0.95) {
|
|
2372
|
-
if (tem5 > 0.0) {
|
|
2373
|
-
tem5 = 0.95;
|
|
2374
|
-
} else {
|
|
2375
|
-
tem5 = -0.95;
|
|
2376
|
-
}
|
|
2377
|
-
}
|
|
2378
|
-
|
|
2379
|
-
eo1 += tem5;
|
|
2380
|
-
ktr += 1;
|
|
2381
|
-
} // ------------- short period preliminary quantities -----------
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
ecose = axnl * coseo1 + aynl * sineo1;
|
|
2385
|
-
esine = axnl * sineo1 - aynl * coseo1;
|
|
2386
|
-
el2 = axnl * axnl + aynl * aynl;
|
|
2387
|
-
pl = am * (1.0 - el2);
|
|
2388
|
-
|
|
2389
|
-
if (pl < 0.0) {
|
|
2390
|
-
// printf("// error pl %f\n", pl);
|
|
2391
|
-
satrec.error = 4; // sgp4fix add return
|
|
2392
|
-
|
|
2393
|
-
return {
|
|
2394
|
-
position: false,
|
|
2395
|
-
velocity: false
|
|
2396
|
-
};
|
|
2397
|
-
}
|
|
2398
|
-
|
|
2399
|
-
rl = am * (1.0 - ecose);
|
|
2400
|
-
rdotl = Math.sqrt(am) * esine / rl;
|
|
2401
|
-
rvdotl = Math.sqrt(pl) / rl;
|
|
2402
|
-
betal = Math.sqrt(1.0 - el2);
|
|
2403
|
-
temp = esine / (1.0 + betal);
|
|
2404
|
-
sinu = am / rl * (sineo1 - aynl - axnl * temp);
|
|
2405
|
-
cosu = am / rl * (coseo1 - axnl + aynl * temp);
|
|
2406
|
-
su = Math.atan2(sinu, cosu);
|
|
2407
|
-
sin2u = (cosu + cosu) * sinu;
|
|
2408
|
-
cos2u = 1.0 - 2.0 * sinu * sinu;
|
|
2409
|
-
temp = 1.0 / pl;
|
|
2410
|
-
temp1 = 0.5 * j2 * temp;
|
|
2411
|
-
temp2 = temp1 * temp; // -------------- update for short period periodics ------------
|
|
2412
|
-
|
|
2413
|
-
if (satrec.method === 'd') {
|
|
2414
|
-
cosisq = cosip * cosip;
|
|
2415
|
-
satrec.con41 = 3.0 * cosisq - 1.0;
|
|
2416
|
-
satrec.x1mth2 = 1.0 - cosisq;
|
|
2417
|
-
satrec.x7thm1 = 7.0 * cosisq - 1.0;
|
|
2418
|
-
}
|
|
2419
|
-
|
|
2420
|
-
mrt = rl * (1.0 - 1.5 * temp2 * betal * satrec.con41) + 0.5 * temp1 * satrec.x1mth2 * cos2u;
|
|
2421
|
-
/** Moved this up to reduce unnecessary computation if you are going to return false anyway */
|
|
2422
|
-
// sgp4fix for decaying satellites
|
|
2423
|
-
|
|
2424
|
-
if (mrt < 1.0) {
|
|
2425
|
-
// printf("// decay condition %11.6f \n",mrt);
|
|
2426
|
-
satrec.error = 6;
|
|
2427
|
-
return {
|
|
2428
|
-
position: false,
|
|
2429
|
-
velocity: false
|
|
2430
|
-
};
|
|
2431
|
-
}
|
|
2432
|
-
|
|
2433
|
-
su -= 0.25 * temp2 * satrec.x7thm1 * sin2u;
|
|
2434
|
-
xnode = nodep + 1.5 * temp2 * cosip * sin2u;
|
|
2435
|
-
xinc = xincp + 1.5 * temp2 * cosip * sinip * cos2u;
|
|
2436
|
-
mvt = rdotl - nm * temp1 * satrec.x1mth2 * sin2u / xke;
|
|
2437
|
-
rvdot = rvdotl + nm * temp1 * (satrec.x1mth2 * cos2u + 1.5 * satrec.con41) / xke; // --------------------- orientation vectors -------------------
|
|
2438
|
-
|
|
2439
|
-
sinsu = Math.sin(su);
|
|
2440
|
-
cossu = Math.cos(su);
|
|
2441
|
-
snod = Math.sin(xnode);
|
|
2442
|
-
cnod = Math.cos(xnode);
|
|
2443
|
-
sini = Math.sin(xinc);
|
|
2444
|
-
cosi = Math.cos(xinc);
|
|
2445
|
-
xmx = -snod * cosi;
|
|
2446
|
-
xmy = cnod * cosi;
|
|
2447
|
-
ux = xmx * sinsu + cnod * cossu;
|
|
2448
|
-
uy = xmy * sinsu + snod * cossu;
|
|
2449
|
-
uz = sini * sinsu;
|
|
2450
|
-
vx = xmx * cossu - cnod * sinsu;
|
|
2451
|
-
vy = xmy * cossu - snod * sinsu;
|
|
2452
|
-
vz = sini * cossu; // --------- position and velocity (in km and km/sec) ----------
|
|
2453
|
-
|
|
2454
|
-
r = {
|
|
2455
|
-
x: mrt * ux * satrec.radiusearthkm,
|
|
2456
|
-
y: mrt * uy * satrec.radiusearthkm,
|
|
2457
|
-
z: mrt * uz * satrec.radiusearthkm
|
|
2458
|
-
};
|
|
2459
|
-
v = {
|
|
2460
|
-
x: (mvt * ux + rvdot * vx) * vkmpersec,
|
|
2461
|
-
y: (mvt * uy + rvdot * vy) * vkmpersec,
|
|
2462
|
-
z: (mvt * uz + rvdot * vz) * vkmpersec
|
|
2463
|
-
};
|
|
2464
|
-
return {
|
|
2465
|
-
position: r,
|
|
2466
|
-
velocity: v
|
|
2467
|
-
};
|
|
2468
|
-
};
|
|
2469
|
-
/* -----------------------------------------------------------------------------
|
|
2470
|
-
*
|
|
2471
|
-
* function getgravconst
|
|
2472
|
-
*
|
|
2473
|
-
* this function gets constants for the propagator. note that mu is identified to
|
|
2474
|
-
* facilitiate comparisons with newer models. the common useage is wgs72.
|
|
2475
|
-
*
|
|
2476
|
-
* author : david vallado 719-573-2600 21 jul 2006
|
|
2477
|
-
*
|
|
2478
|
-
* inputs :
|
|
2479
|
-
* whichconst - which set of constants to use wgs72old, wgs72, wgs84
|
|
2480
|
-
*
|
|
2481
|
-
* outputs :
|
|
2482
|
-
* tumin - minutes in one time unit
|
|
2483
|
-
* mu - earth gravitational parameter
|
|
2484
|
-
* radiusearthkm - radius of the earth in km
|
|
2485
|
-
* xke - reciprocal of tumin
|
|
2486
|
-
* j2, j3, j4 - un-normalized zonal harmonic values
|
|
2487
|
-
* j3oj2 - j3 divided by j2
|
|
2488
|
-
*
|
|
2489
|
-
* locals :
|
|
2490
|
-
*
|
|
2491
|
-
* coupling :
|
|
2492
|
-
* none
|
|
2493
|
-
*
|
|
2494
|
-
* references :
|
|
2495
|
-
* norad spacetrack report #3
|
|
2496
|
-
* vallado, crawford, hujsak, kelso 2006
|
|
2497
|
-
--------------------------------------------------------------------------- */
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
Sgp4.getgravconst = function (whichconst) {
|
|
2501
|
-
switch (whichconst) {
|
|
2502
|
-
// -- wgs-72 low precision str#3 constants --
|
|
2503
|
-
case 'wgs72old':
|
|
2504
|
-
mus = 398600.79964; // in km3 / s2
|
|
2505
|
-
|
|
2506
|
-
radiusearthkm = 6378.135; // km
|
|
2507
|
-
|
|
2508
|
-
xke = 0.0743669161; // reciprocal of tumin
|
|
2509
|
-
|
|
2510
|
-
tumin = 1.0 / xke;
|
|
2511
|
-
j2 = 0.001082616;
|
|
2512
|
-
j3 = -0.00000253881;
|
|
2513
|
-
j4 = -0.00000165597;
|
|
2514
|
-
j3oj2 = j3 / j2;
|
|
2515
|
-
break;
|
|
2516
|
-
// ------------ wgs-72 constants ------------
|
|
2517
|
-
|
|
2518
|
-
case 'wgs72':
|
|
2519
|
-
mus = 398600.8; // in km3 / s2
|
|
2520
|
-
|
|
2521
|
-
radiusearthkm = 6378.135; // km
|
|
2522
|
-
|
|
2523
|
-
xke = 60.0 / Math.sqrt(radiusearthkm * radiusearthkm * radiusearthkm / mus);
|
|
2524
|
-
tumin = 1.0 / xke;
|
|
2525
|
-
j2 = 0.001082616;
|
|
2526
|
-
j3 = -0.00000253881;
|
|
2527
|
-
j4 = -0.00000165597;
|
|
2528
|
-
j3oj2 = j3 / j2;
|
|
2529
|
-
break;
|
|
2530
|
-
|
|
2531
|
-
case 'wgs84':
|
|
2532
|
-
// ------------ wgs-84 constants ------------
|
|
2533
|
-
mus = 398600.5; // in km3 / s2
|
|
2534
|
-
|
|
2535
|
-
radiusearthkm = 6378.137; // km
|
|
2536
|
-
|
|
2537
|
-
xke = 60.0 / Math.sqrt(radiusearthkm * radiusearthkm * radiusearthkm / mus);
|
|
2538
|
-
tumin = 1.0 / xke;
|
|
2539
|
-
j2 = 0.00108262998905;
|
|
2540
|
-
j3 = -0.00000253215306;
|
|
2541
|
-
j4 = -0.00000161098761;
|
|
2542
|
-
j3oj2 = j3 / j2;
|
|
2543
|
-
break;
|
|
2544
|
-
|
|
2545
|
-
default:
|
|
2546
|
-
throw new Error("unknown gravity option " + whichconst);
|
|
2547
|
-
}
|
|
2548
|
-
|
|
2549
|
-
return {
|
|
2550
|
-
tumin: tumin,
|
|
2551
|
-
mus: mus,
|
|
2552
|
-
radiusearthkm: radiusearthkm,
|
|
2553
|
-
xke: xke,
|
|
2554
|
-
j2: j2,
|
|
2555
|
-
j3: j3,
|
|
2556
|
-
j4: j4,
|
|
2557
|
-
j3oj2: j3oj2
|
|
2558
|
-
};
|
|
2559
|
-
}; // getgravconst
|
|
2560
|
-
|
|
2561
|
-
/* -----------------------------------------------------------------------------
|
|
2562
|
-
*
|
|
2563
|
-
* function twoline2rv
|
|
2564
|
-
*
|
|
2565
|
-
* this function converts the two line element set character string data to
|
|
2566
|
-
* variables and initializes the sgp4 variables. several intermediate varaibles
|
|
2567
|
-
* and quantities are determined. note that the result is a structure so multiple
|
|
2568
|
-
* satellites can be processed simultaneously without having to reinitialize. the
|
|
2569
|
-
* verification mode is an important option that permits quick checks of any
|
|
2570
|
-
* changes to the underlying technical theory. this option works using a
|
|
2571
|
-
* modified tle file in which the start, stop, and delta time values are
|
|
2572
|
-
* included at the end of the second line of data. this only works with the
|
|
2573
|
-
* verification mode. the catalog mode simply propagates from -1440 to 1440 min
|
|
2574
|
-
* from epoch and is useful when performing entire catalog runs.
|
|
2575
|
-
*
|
|
2576
|
-
* author : david vallado 719-573-2600 1 mar 2001
|
|
2577
|
-
*
|
|
2578
|
-
* inputs :
|
|
2579
|
-
* longstr1 - first line of the tle
|
|
2580
|
-
* longstr2 - second line of the tle
|
|
2581
|
-
* typerun - type of run verification 'v', catalog 'c',
|
|
2582
|
-
* manual 'm'
|
|
2583
|
-
* typeinput - type of manual input mfe 'm', epoch 'e', dayofyr 'd'
|
|
2584
|
-
* opsmode - mode of operation afspc or improved 'a', 'i'
|
|
2585
|
-
* whichconst - which set of constants to use 72, 84
|
|
2586
|
-
*
|
|
2587
|
-
* outputs :
|
|
2588
|
-
* satrec - structure containing all the sgp4 satellite information
|
|
2589
|
-
*
|
|
2590
|
-
* coupling :
|
|
2591
|
-
* getgravconst-
|
|
2592
|
-
* days2mdhms - conversion of days to month, day, hour, minute, second
|
|
2593
|
-
* jday - convert day month year hour minute second into julian date
|
|
2594
|
-
* sgp4init - initialize the sgp4 variables
|
|
2595
|
-
*
|
|
2596
|
-
* references :
|
|
2597
|
-
* norad spacetrack report #3
|
|
2598
|
-
* vallado, crawford, hujsak, kelso 2006
|
|
2599
|
-
--------------------------------------------------------------------------- */
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
Sgp4.createSatrec = function (tleLine1, tleLine2, whichconst, opsmode) {
|
|
2603
|
-
if (whichconst === void 0) {
|
|
2604
|
-
whichconst = 'wgs72';
|
|
2605
|
-
}
|
|
2606
|
-
|
|
2607
|
-
if (opsmode === void 0) {
|
|
2608
|
-
opsmode = 'i';
|
|
2609
|
-
} // xpdotp = 1440.0 / (2.0 * PI); // 229.1831180523293;
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
year = 0;
|
|
2613
|
-
satrec = {}; // sgp4fix no longer needed
|
|
2614
|
-
// getgravconst( whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2 );
|
|
2615
|
-
|
|
2616
|
-
satrec.error = 0;
|
|
2617
|
-
satrec.satnum = tleLine1.substring(2, 7);
|
|
2618
|
-
satrec.epochyr = parseInt(tleLine1.substring(18, 20));
|
|
2619
|
-
satrec.epochdays = parseFloat(tleLine1.substring(20, 32));
|
|
2620
|
-
satrec.ndot = parseFloat(tleLine1.substring(33, 43));
|
|
2621
|
-
satrec.nddot = parseFloat(tleLine1.substring(44, 45) + "." + tleLine1.substring(45, 50) + "E" + tleLine1.substring(50, 52));
|
|
2622
|
-
satrec.bstar = parseFloat(tleLine1.substring(53, 54) + "." + tleLine1.substring(54, 59) + "E" + tleLine1.substring(59, 61)); // satrec.satnum = tleLine2.substring(2, 7);
|
|
2623
|
-
|
|
2624
|
-
satrec.inclo = parseFloat(tleLine2.substring(8, 16));
|
|
2625
|
-
satrec.nodeo = parseFloat(tleLine2.substring(17, 25));
|
|
2626
|
-
satrec.ecco = parseFloat("." + tleLine2.substring(26, 33));
|
|
2627
|
-
satrec.argpo = parseFloat(tleLine2.substring(34, 42));
|
|
2628
|
-
satrec.mo = parseFloat(tleLine2.substring(43, 51));
|
|
2629
|
-
satrec.no = parseFloat(tleLine2.substring(52, 63)); // ---- find no, ndot, nddot ----
|
|
2630
|
-
|
|
2631
|
-
satrec.no /= xpdotp; // rad/min
|
|
2632
|
-
|
|
2633
|
-
/** Ootk -- nexp and ibexp are calculated above using template literals */
|
|
2634
|
-
// satrec.nddot = satrec.nddot * Math.pow(10.0, nexp);
|
|
2635
|
-
// satrec.bstar = satrec.bstar * Math.pow(10.0, ibexp);
|
|
2636
|
-
// ---- convert to sgp4 units ----
|
|
2637
|
-
// satrec.a = (satrec.no * tumin) ** (-2.0 / 3.0);
|
|
2638
|
-
|
|
2639
|
-
/** Ootk -- Not sure why the following two lines are added. 1st and 2nd derivatives aren't even used anymore */
|
|
2640
|
-
// satrec.ndot /= xpdotp * 1440.0; // ? * minperday
|
|
2641
|
-
// satrec.nddot /= xpdotp * 1440.0 * 1440;
|
|
2642
|
-
// ---- find standard orbital elements ----
|
|
2643
|
-
|
|
2644
|
-
satrec.inclo *= DEG2RAD;
|
|
2645
|
-
satrec.nodeo *= DEG2RAD;
|
|
2646
|
-
satrec.argpo *= DEG2RAD;
|
|
2647
|
-
satrec.mo *= DEG2RAD; // sgp4fix not needed here
|
|
2648
|
-
// satrec.alta = satrec.a * (1.0 + satrec.ecco) - 1.0;
|
|
2649
|
-
// satrec.altp = satrec.a * (1.0 - satrec.ecco) - 1.0;
|
|
2650
|
-
// ----------------------------------------------------------------
|
|
2651
|
-
// find sgp4epoch time of element set
|
|
2652
|
-
// remember that sgp4 uses units of days from 0 jan 1950 (sgp4epoch)
|
|
2653
|
-
// and minutes from the epoch (time)
|
|
2654
|
-
// ----------------------------------------------------------------
|
|
2655
|
-
// ---------------- temp fix for years from 1957-2056 -------------------
|
|
2656
|
-
// --------- correct fix will occur when year is 4-digit in tle ---------
|
|
2657
|
-
|
|
2658
|
-
if (satrec.epochyr < 57) {
|
|
2659
|
-
year = satrec.epochyr + 2000;
|
|
2660
|
-
} else {
|
|
2661
|
-
year = satrec.epochyr + 1900;
|
|
2662
|
-
}
|
|
2663
|
-
|
|
2664
|
-
var _a = Sgp4.days2mdhms(year, satrec.epochdays),
|
|
2665
|
-
mon = _a.mon,
|
|
2666
|
-
day = _a.day,
|
|
2667
|
-
hr = _a.hr,
|
|
2668
|
-
minute = _a.minute,
|
|
2669
|
-
sec = _a.sec;
|
|
2670
|
-
|
|
2671
|
-
var jdayRes = Sgp4.jday(year, mon, day, hr, minute, sec);
|
|
2672
|
-
satrec.jdsatepoch = jdayRes.jd + jdayRes.jdFrac; // ---------------- initialize the orbit at sgp4epoch -------------------
|
|
2673
|
-
|
|
2674
|
-
Sgp4.sgp4init(satrec, {
|
|
2675
|
-
whichconst: whichconst,
|
|
2676
|
-
opsmode: opsmode,
|
|
2677
|
-
satn: satrec.satnum,
|
|
2678
|
-
epoch: satrec.jdsatepoch - 2433281.5,
|
|
2679
|
-
xbstar: satrec.bstar,
|
|
2680
|
-
xecco: satrec.ecco,
|
|
2681
|
-
xargpo: satrec.argpo,
|
|
2682
|
-
xinclo: satrec.inclo,
|
|
2683
|
-
xndot: satrec.ndot,
|
|
2684
|
-
xnddot: satrec.nddot,
|
|
2685
|
-
xmo: satrec.mo,
|
|
2686
|
-
xno: satrec.no,
|
|
2687
|
-
xnodeo: satrec.nodeo
|
|
2688
|
-
});
|
|
2689
|
-
return satrec;
|
|
2690
|
-
}; // twoline2rv
|
|
2691
|
-
|
|
2692
|
-
/* -----------------------------------------------------------------------------
|
|
2693
|
-
*
|
|
2694
|
-
* function gstime
|
|
2695
|
-
*
|
|
2696
|
-
* this function finds the greenwich sidereal time.
|
|
2697
|
-
*
|
|
2698
|
-
* author : david vallado 719-573-2600 1 mar 2001
|
|
2699
|
-
*
|
|
2700
|
-
* inputs description range / units
|
|
2701
|
-
* jdut1 - julian date in ut1 days from 4713 bc
|
|
2702
|
-
*
|
|
2703
|
-
* outputs :
|
|
2704
|
-
* gstime - greenwich sidereal time 0 to 2PI rad
|
|
2705
|
-
*
|
|
2706
|
-
* locals :
|
|
2707
|
-
* temp - temporary variable for doubles rad
|
|
2708
|
-
* tut1 - julian centuries from the
|
|
2709
|
-
* jan 1, 2000 12 h epoch (ut1)
|
|
2710
|
-
*
|
|
2711
|
-
* coupling :
|
|
2712
|
-
* none
|
|
2713
|
-
*
|
|
2714
|
-
* references :
|
|
2715
|
-
* vallado 2004, 191, eq 3-45
|
|
2716
|
-
* --------------------------------------------------------------------------- */
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
Sgp4.gstime = function (jdut1) {
|
|
2720
|
-
tut1 = (jdut1 - 2451545.0) / 36525.0;
|
|
2721
|
-
var temp = -6.2e-6 * tut1 * tut1 * tut1 + 0.093104 * tut1 * tut1 + (876600.0 * 3600 + 8640184.812866) * tut1 + 67310.54841; // sec
|
|
2722
|
-
|
|
2723
|
-
temp = temp * DEG2RAD / 240.0 % TAU; // 360/86400 = 1/240, to deg, to rad
|
|
2724
|
-
// ------------------------ check quadrants ---------------------
|
|
2725
|
-
|
|
2726
|
-
if (temp < 0.0) {
|
|
2727
|
-
temp += TAU;
|
|
2728
|
-
}
|
|
2729
|
-
|
|
2730
|
-
return temp;
|
|
2731
|
-
};
|
|
2732
|
-
|
|
2733
|
-
Sgp4.sgn = function (x) {
|
|
2734
|
-
if (x < 0.0) {
|
|
2735
|
-
return -1.0;
|
|
2736
|
-
} else {
|
|
2737
|
-
return 1.0;
|
|
2738
|
-
}
|
|
2739
|
-
}; // sgn
|
|
2740
|
-
|
|
2741
|
-
/* -----------------------------------------------------------------------------
|
|
2742
|
-
*
|
|
2743
|
-
* function mag
|
|
2744
|
-
*
|
|
2745
|
-
* this procedure finds the magnitude of a vector.
|
|
2746
|
-
*
|
|
2747
|
-
* author : david vallado 719-573-2600 1 mar 2001
|
|
2748
|
-
*
|
|
2749
|
-
* inputs description range / units
|
|
2750
|
-
* vec - vector
|
|
2751
|
-
*
|
|
2752
|
-
* outputs :
|
|
2753
|
-
* mag - answer
|
|
2754
|
-
*
|
|
2755
|
-
* locals :
|
|
2756
|
-
* none.
|
|
2757
|
-
*
|
|
2758
|
-
* coupling :
|
|
2759
|
-
* none.
|
|
2760
|
-
* --------------------------------------------------------------------------- */
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
Sgp4.mag = function (x) {
|
|
2764
|
-
return Math.sqrt(x[0] * x[0] + x[1] * x[1] + x[2] * x[2]);
|
|
2765
|
-
}; // mag
|
|
2766
|
-
|
|
2767
|
-
/* -----------------------------------------------------------------------------
|
|
2768
|
-
*
|
|
2769
|
-
* procedure cross_SGP4
|
|
2770
|
-
*
|
|
2771
|
-
* this procedure crosses two vectors.
|
|
2772
|
-
*
|
|
2773
|
-
* author : david vallado 719-573-2600 1 mar 2001
|
|
2774
|
-
*
|
|
2775
|
-
* inputs description range / units
|
|
2776
|
-
* vec1 - vector number 1
|
|
2777
|
-
* vec2 - vector number 2
|
|
2778
|
-
*
|
|
2779
|
-
* outputs :
|
|
2780
|
-
* outvec - vector result of a x b
|
|
2781
|
-
*
|
|
2782
|
-
* locals :
|
|
2783
|
-
* none.
|
|
2784
|
-
*
|
|
2785
|
-
* coupling :
|
|
2786
|
-
* mag magnitude of a vector
|
|
2787
|
-
---------------------------------------------------------------------------- */
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
Sgp4.cross = function (vec1, vec2) {
|
|
2791
|
-
var outvec = [0, 0, 0];
|
|
2792
|
-
outvec[0] = vec1[1] * vec2[2] - vec1[2] * vec2[1];
|
|
2793
|
-
outvec[1] = vec1[2] * vec2[0] - vec1[0] * vec2[2];
|
|
2794
|
-
outvec[2] = vec1[0] * vec2[1] - vec1[1] * vec2[0];
|
|
2795
|
-
return outvec;
|
|
2796
|
-
}; // end cross
|
|
2797
|
-
|
|
2798
|
-
/* -----------------------------------------------------------------------------
|
|
2799
|
-
*
|
|
2800
|
-
* function dot_SGP4
|
|
2801
|
-
*
|
|
2802
|
-
* this function finds the dot product of two vectors.
|
|
2803
|
-
*
|
|
2804
|
-
* author : david vallado 719-573-2600 1 mar 2001
|
|
2805
|
-
*
|
|
2806
|
-
* inputs description range / units
|
|
2807
|
-
* vec1 - vector number 1
|
|
2808
|
-
* vec2 - vector number 2
|
|
2809
|
-
*
|
|
2810
|
-
* outputs :
|
|
2811
|
-
* dot - result
|
|
2812
|
-
*
|
|
2813
|
-
* locals :
|
|
2814
|
-
* none.
|
|
2815
|
-
*
|
|
2816
|
-
* coupling :
|
|
2817
|
-
* none.
|
|
2818
|
-
* --------------------------------------------------------------------------- */
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
Sgp4.dot = function (x, y) {
|
|
2822
|
-
return x[0] * y[0] + x[1] * y[1] + x[2] * y[2];
|
|
2823
|
-
}; // dot
|
|
2824
|
-
|
|
2825
|
-
/* -----------------------------------------------------------------------------
|
|
2826
|
-
*
|
|
2827
|
-
* procedure angle_SGP4
|
|
2828
|
-
*
|
|
2829
|
-
* this procedure calculates the angle between two vectors. the output is
|
|
2830
|
-
* set to 999999.1 to indicate an undefined value. be sure to check for
|
|
2831
|
-
* this at the output phase.
|
|
2832
|
-
*
|
|
2833
|
-
* author : david vallado 719-573-2600 1 mar 2001
|
|
2834
|
-
*
|
|
2835
|
-
* inputs description range / units
|
|
2836
|
-
* vec1 - vector number 1
|
|
2837
|
-
* vec2 - vector number 2
|
|
2838
|
-
*
|
|
2839
|
-
* outputs :
|
|
2840
|
-
* theta - angle between the two vectors -pi to pi
|
|
2841
|
-
*
|
|
2842
|
-
* locals :
|
|
2843
|
-
* temp - temporary real variable
|
|
2844
|
-
*
|
|
2845
|
-
* coupling :
|
|
2846
|
-
* dot dot product of two vectors
|
|
2847
|
-
* --------------------------------------------------------------------------- */
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
Sgp4.angle = function (vec1, vec2) {
|
|
2851
|
-
var small = 0.00000001;
|
|
2852
|
-
var unknown = 999999.1;
|
|
2853
|
-
/** Ootk -- original 'undefined' is protected in JS */
|
|
2854
|
-
|
|
2855
|
-
var magv1 = Sgp4.mag(vec1);
|
|
2856
|
-
var magv2 = Sgp4.mag(vec2);
|
|
2857
|
-
|
|
2858
|
-
if (magv1 * magv2 > small * small) {
|
|
2859
|
-
temp = Sgp4.dot(vec1, vec2) / (magv1 * magv2);
|
|
2860
|
-
if (Math.abs(temp) > 1.0) temp = Sgp4.sgn(temp) * 1.0;
|
|
2861
|
-
return Math.acos(temp);
|
|
2862
|
-
} else return unknown;
|
|
2863
|
-
}; // angle
|
|
2864
|
-
|
|
2865
|
-
/* -----------------------------------------------------------------------------
|
|
2866
|
-
*
|
|
2867
|
-
* function asinh_SGP4
|
|
2868
|
-
*
|
|
2869
|
-
* this function evaluates the inverse hyperbolic sine function.
|
|
2870
|
-
*
|
|
2871
|
-
* author : david vallado 719-573-2600 1 mar 2001
|
|
2872
|
-
*
|
|
2873
|
-
* inputs description range / units
|
|
2874
|
-
* xval - angle value any real
|
|
2875
|
-
*
|
|
2876
|
-
* outputs :
|
|
2877
|
-
* arcsinh - result any real
|
|
2878
|
-
*
|
|
2879
|
-
* locals :
|
|
2880
|
-
* none.
|
|
2881
|
-
*
|
|
2882
|
-
* coupling :
|
|
2883
|
-
* none.
|
|
2884
|
-
* --------------------------------------------------------------------------- */
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
Sgp4.asinh = function (xval) {
|
|
2888
|
-
return Math.log(xval + Math.sqrt(xval * xval + 1.0));
|
|
2889
|
-
}; // asinh
|
|
2890
|
-
|
|
2891
|
-
/* -----------------------------------------------------------------------------
|
|
2892
|
-
*
|
|
2893
|
-
* function newtonnu_SGP4
|
|
2894
|
-
*
|
|
2895
|
-
* this function solves keplers equation when the true anomaly is known.
|
|
2896
|
-
* the mean and eccentric, parabolic, or hyperbolic anomaly is also found.
|
|
2897
|
-
* the parabolic limit at 168ø is arbitrary. the hyperbolic anomaly is also
|
|
2898
|
-
* limited. the hyperbolic sine is used because it's not double valued.
|
|
2899
|
-
*
|
|
2900
|
-
* author : david vallado 719-573-2600 27 may 2002
|
|
2901
|
-
*
|
|
2902
|
-
* revisions
|
|
2903
|
-
* vallado - fix small 24 sep 2002
|
|
2904
|
-
*
|
|
2905
|
-
* inputs description range / units
|
|
2906
|
-
* ecc - eccentricity 0.0 to
|
|
2907
|
-
* nu - true anomaly -2pi to 2pi rad
|
|
2908
|
-
*
|
|
2909
|
-
* outputs :
|
|
2910
|
-
* e0 - eccentric anomaly 0.0 to 2pi rad 153.02 ø
|
|
2911
|
-
* m - mean anomaly 0.0 to 2pi rad 151.7425 ø
|
|
2912
|
-
*
|
|
2913
|
-
* locals :
|
|
2914
|
-
* e1 - eccentric anomaly, next value rad
|
|
2915
|
-
* sine - sine of e
|
|
2916
|
-
* cose - cosine of e
|
|
2917
|
-
* ktr - index
|
|
2918
|
-
*
|
|
2919
|
-
* coupling :
|
|
2920
|
-
* asinh - arc hyperbolic sine
|
|
2921
|
-
*
|
|
2922
|
-
* references :
|
|
2923
|
-
* vallado 2013, 77, alg 5
|
|
2924
|
-
* --------------------------------------------------------------------------- */
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
Sgp4.newtonnu = function (ecc, nu) {
|
|
2928
|
-
// --------------------- implementation ---------------------
|
|
2929
|
-
var e0 = 999999.9;
|
|
2930
|
-
var m = 999999.9;
|
|
2931
|
-
var small = 0.00000001; // --------------------------- circular ------------------------
|
|
2932
|
-
|
|
2933
|
-
if (Math.abs(ecc) < small) {
|
|
2934
|
-
m = nu;
|
|
2935
|
-
e0 = nu;
|
|
2936
|
-
} // ---------------------- elliptical -----------------------
|
|
2937
|
-
else if (ecc < 1.0 - small) {
|
|
2938
|
-
var sine = Math.sqrt(1.0 - ecc * ecc) * Math.sin(nu) / (1.0 + ecc * Math.cos(nu));
|
|
2939
|
-
var cose = (ecc + Math.cos(nu)) / (1.0 + ecc * Math.cos(nu));
|
|
2940
|
-
e0 = Math.atan2(sine, cose);
|
|
2941
|
-
m = e0 - ecc * Math.sin(e0);
|
|
2942
|
-
} // -------------------- hyperbolic --------------------
|
|
2943
|
-
else if (ecc > 1.0 + small) {
|
|
2944
|
-
if (ecc > 1.0 && Math.abs(nu) + 0.00001 < PI - Math.acos(1.0 / ecc)) {
|
|
2945
|
-
var sine = Math.sqrt(ecc * ecc - 1.0) * Math.sin(nu) / (1.0 + ecc * Math.cos(nu));
|
|
2946
|
-
e0 = Sgp4.asinh(sine);
|
|
2947
|
-
m = ecc * Sgp4.sinh(e0) - e0;
|
|
2948
|
-
}
|
|
2949
|
-
} // ----------------- parabolic ---------------------
|
|
2950
|
-
else if (Math.abs(nu) < 168.0 * PI / 180.0) {
|
|
2951
|
-
e0 = Math.tan(nu * 0.5);
|
|
2952
|
-
m = e0 + e0 * e0 * e0 / 3.0;
|
|
2953
|
-
}
|
|
2954
|
-
|
|
2955
|
-
if (ecc < 1.0) {
|
|
2956
|
-
m = m % (2.0 * PI);
|
|
2957
|
-
if (m < 0.0) m = m + 2.0 * PI;
|
|
2958
|
-
e0 = e0 % (2.0 * PI);
|
|
2959
|
-
}
|
|
2960
|
-
|
|
2961
|
-
return {
|
|
2962
|
-
e0: e0,
|
|
2963
|
-
m: m
|
|
2964
|
-
};
|
|
2965
|
-
}; // newtonnu
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
Sgp4.sinh = function (x) {
|
|
2969
|
-
return (Math.exp(x) - Math.exp(-x)) / 2;
|
|
2970
|
-
};
|
|
2971
|
-
/* -----------------------------------------------------------------------------
|
|
2972
|
-
*
|
|
2973
|
-
* function rv2coe_SGP4
|
|
2974
|
-
*
|
|
2975
|
-
* this function finds the classical orbital elements given the geocentric
|
|
2976
|
-
* equatorial position and velocity vectors.
|
|
2977
|
-
*
|
|
2978
|
-
* author : david vallado 719-573-2600 21 jun 2002
|
|
2979
|
-
*
|
|
2980
|
-
* revisions
|
|
2981
|
-
* vallado - fix special cases 5 sep 2002
|
|
2982
|
-
* vallado - delete extra check in inclination code 16 oct 2002
|
|
2983
|
-
* vallado - add constant file use 29 jun 2003
|
|
2984
|
-
* vallado - add mu 2 apr 2007
|
|
2985
|
-
*
|
|
2986
|
-
* inputs description range / units
|
|
2987
|
-
* r - ijk position vector km
|
|
2988
|
-
* v - ijk velocity vector km / s
|
|
2989
|
-
* mu - gravitational parameter km3 / s2
|
|
2990
|
-
*
|
|
2991
|
-
* outputs :
|
|
2992
|
-
* p - semilatus rectum km
|
|
2993
|
-
* a - semimajor axis km
|
|
2994
|
-
* ecc - eccentricity
|
|
2995
|
-
* incl - inclination 0.0 to pi rad
|
|
2996
|
-
* omega - right ascension of ascending node 0.0 to 2pi rad
|
|
2997
|
-
* argp - argument of perigee 0.0 to 2pi rad
|
|
2998
|
-
* nu - true anomaly 0.0 to 2pi rad
|
|
2999
|
-
* m - mean anomaly 0.0 to 2pi rad
|
|
3000
|
-
* arglat - argument of latitude (ci) 0.0 to 2pi rad
|
|
3001
|
-
* truelon - true longitude (ce) 0.0 to 2pi rad
|
|
3002
|
-
* lonper - longitude of periapsis (ee) 0.0 to 2pi rad
|
|
3003
|
-
*
|
|
3004
|
-
* locals :
|
|
3005
|
-
* hbar - angular momentum h vector km2 / s
|
|
3006
|
-
* ebar - eccentricity e vector
|
|
3007
|
-
* nbar - line of nodes n vector
|
|
3008
|
-
* c1 - v**2 - u/r
|
|
3009
|
-
* rdotv - r dot v
|
|
3010
|
-
* hk - hk unit vector
|
|
3011
|
-
* sme - specfic mechanical energy km2 / s2
|
|
3012
|
-
* i - index
|
|
3013
|
-
* e - eccentric, parabolic,
|
|
3014
|
-
* hyperbolic anomaly rad
|
|
3015
|
-
* temp - temporary variable
|
|
3016
|
-
* typeorbit - type of orbit ee, ei, ce, ci
|
|
3017
|
-
*
|
|
3018
|
-
* coupling :
|
|
3019
|
-
* mag - magnitude of a vector
|
|
3020
|
-
* cross - cross product of two vectors
|
|
3021
|
-
* angle - find the angle between two vectors
|
|
3022
|
-
* newtonnu - find the mean anomaly
|
|
3023
|
-
*
|
|
3024
|
-
* references :
|
|
3025
|
-
* vallado 2013, 113, alg 9, ex 2-5
|
|
3026
|
-
* --------------------------------------------------------------------------- */
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
Sgp4.rv2coe = function (r, v, mus) {
|
|
3030
|
-
var nbar = [0, 0, 0];
|
|
3031
|
-
var ebar = [0, 0, 0];
|
|
3032
|
-
var p;
|
|
3033
|
-
var a;
|
|
3034
|
-
var ecc;
|
|
3035
|
-
var incl;
|
|
3036
|
-
var omega;
|
|
3037
|
-
var argp;
|
|
3038
|
-
var nu;
|
|
3039
|
-
var m;
|
|
3040
|
-
var arglat;
|
|
3041
|
-
var truelon;
|
|
3042
|
-
var lonper;
|
|
3043
|
-
var rdotv;
|
|
3044
|
-
var magn;
|
|
3045
|
-
var hk;
|
|
3046
|
-
var sme;
|
|
3047
|
-
var i; // switch this to an integer msvs seems to have probelms with this and strncpy_s
|
|
3048
|
-
//char typeorbit[2];
|
|
3049
|
-
|
|
3050
|
-
var typeorbit; // here
|
|
3051
|
-
// typeorbit = 1 = 'ei'
|
|
3052
|
-
// typeorbit = 2 = 'ce'
|
|
3053
|
-
// typeorbit = 3 = 'ci'
|
|
3054
|
-
// typeorbit = 4 = 'ee'
|
|
3055
|
-
|
|
3056
|
-
var halfpi = 0.5 * PI;
|
|
3057
|
-
var small = 0.00000001;
|
|
3058
|
-
var unknown = 999999.1;
|
|
3059
|
-
/** Ootk -- original undefined is illegal in JS */
|
|
3060
|
-
|
|
3061
|
-
var infinite = 999999.9; // ------------------------- implementation -----------------
|
|
3062
|
-
|
|
3063
|
-
var magr = Sgp4.mag(r);
|
|
3064
|
-
var magv = Sgp4.mag(v); // ------------------ find h n and e vectors ----------------
|
|
3065
|
-
|
|
3066
|
-
var hbar = Sgp4.cross(r, v);
|
|
3067
|
-
var magh = Sgp4.mag(hbar);
|
|
3068
|
-
|
|
3069
|
-
if (magh > small) {
|
|
3070
|
-
nbar[0] = -hbar[1];
|
|
3071
|
-
nbar[1] = hbar[0];
|
|
3072
|
-
nbar[2] = 0.0;
|
|
3073
|
-
magn = Sgp4.mag(nbar);
|
|
3074
|
-
c1 = magv * magv - mus / magr;
|
|
3075
|
-
rdotv = Sgp4.dot(r, v);
|
|
3076
|
-
|
|
3077
|
-
for (i = 0; i <= 2; i++) {
|
|
3078
|
-
ebar[i] = (c1 * r[i] - rdotv * v[i]) / mus;
|
|
3079
|
-
}
|
|
3080
|
-
|
|
3081
|
-
ecc = Sgp4.mag(ebar); // ------------ find a e and semi-latus rectum ----------
|
|
3082
|
-
|
|
3083
|
-
sme = magv * magv * 0.5 - mus / magr;
|
|
3084
|
-
if (Math.abs(sme) > small) a = -mus / (2.0 * sme);else a = infinite;
|
|
3085
|
-
p = magh * magh / mus; // ----------------- find inclination -------------------
|
|
3086
|
-
|
|
3087
|
-
hk = hbar[2] / magh;
|
|
3088
|
-
incl = Math.acos(hk); // -------- determine type of orbit for later use --------
|
|
3089
|
-
// ------ elliptical, parabolic, hyperbolic inclined -------
|
|
3090
|
-
|
|
3091
|
-
typeorbit = 1;
|
|
3092
|
-
|
|
3093
|
-
if (ecc < small) {
|
|
3094
|
-
// ---------------- circular equatorial ---------------
|
|
3095
|
-
if (incl < small || Math.abs(incl - PI) < small) {
|
|
3096
|
-
typeorbit = 2;
|
|
3097
|
-
} else {
|
|
3098
|
-
// -------------- circular inclined ---------------
|
|
3099
|
-
typeorbit = 3;
|
|
3100
|
-
}
|
|
3101
|
-
} else {
|
|
3102
|
-
// - elliptical, parabolic, hyperbolic equatorial --
|
|
3103
|
-
if (incl < small || Math.abs(incl - PI) < small) {
|
|
3104
|
-
typeorbit = 4;
|
|
3105
|
-
}
|
|
3106
|
-
} // ---------- find right ascension of the ascending node ------------
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
if (magn > small) {
|
|
3110
|
-
temp = nbar[0] / magn;
|
|
3111
|
-
if (Math.abs(temp) > 1.0) temp = Sgp4.sgn(temp);
|
|
3112
|
-
omega = Math.acos(temp);
|
|
3113
|
-
if (nbar[1] < 0.0) omega = TAU - omega;
|
|
3114
|
-
} else omega = unknown; // ---------------- find argument of perigee ---------------
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
if (typeorbit == 1) {
|
|
3118
|
-
argp = Sgp4.angle(nbar, ebar);
|
|
3119
|
-
if (ebar[2] < 0.0) argp = TAU - argp;
|
|
3120
|
-
} else argp = unknown; // ------------ find true anomaly at epoch -------------
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
if (typeorbit == 1 || typeorbit == 4) {
|
|
3124
|
-
nu = Sgp4.angle(ebar, r);
|
|
3125
|
-
if (rdotv < 0.0) nu = TAU - nu;
|
|
3126
|
-
} else nu = unknown; // ---- find argument of latitude - circular inclined -----
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
if (typeorbit == 3) {
|
|
3130
|
-
arglat = Sgp4.angle(nbar, r);
|
|
3131
|
-
if (r[2] < 0.0) arglat = TAU - arglat;
|
|
3132
|
-
m = arglat;
|
|
3133
|
-
} else arglat = unknown;
|
|
3134
|
-
|
|
3135
|
-
if (ecc > small && typeorbit == 4) {
|
|
3136
|
-
temp = ebar[0] / ecc;
|
|
3137
|
-
if (Math.abs(temp) > 1.0) temp = Sgp4.sgn(temp);
|
|
3138
|
-
lonper = Math.acos(temp);
|
|
3139
|
-
if (ebar[1] < 0.0) lonper = TAU - lonper;
|
|
3140
|
-
if (incl > halfpi) lonper = TAU - lonper;
|
|
3141
|
-
} else lonper = unknown; // -------- find true longitude - circular equatorial ------
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
if (magr > small && typeorbit == 2) {
|
|
3145
|
-
temp = r[0] / magr;
|
|
3146
|
-
if (Math.abs(temp) > 1.0) temp = Sgp4.sgn(temp);
|
|
3147
|
-
truelon = Math.acos(temp);
|
|
3148
|
-
if (r[1] < 0.0) truelon = TAU - truelon;
|
|
3149
|
-
if (incl > halfpi) truelon = TAU - truelon;
|
|
3150
|
-
m = truelon;
|
|
3151
|
-
} else truelon = unknown; // ------------ find mean anomaly for all orbits -----------
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
if (typeorbit == 1 || typeorbit == 4) m = Sgp4.newtonnu(ecc, nu).m;
|
|
3155
|
-
} else {
|
|
3156
|
-
p = unknown;
|
|
3157
|
-
a = unknown;
|
|
3158
|
-
ecc = unknown;
|
|
3159
|
-
incl = unknown;
|
|
3160
|
-
omega = unknown;
|
|
3161
|
-
argp = unknown;
|
|
3162
|
-
nu = unknown;
|
|
3163
|
-
m = unknown;
|
|
3164
|
-
arglat = unknown;
|
|
3165
|
-
truelon = unknown;
|
|
3166
|
-
lonper = unknown;
|
|
3167
|
-
}
|
|
3168
|
-
|
|
3169
|
-
return {
|
|
3170
|
-
p: p,
|
|
3171
|
-
a: a,
|
|
3172
|
-
ecc: ecc,
|
|
3173
|
-
incl: incl,
|
|
3174
|
-
omega: omega,
|
|
3175
|
-
argp: argp,
|
|
3176
|
-
nu: nu,
|
|
3177
|
-
m: m,
|
|
3178
|
-
arglat: arglat,
|
|
3179
|
-
truelon: truelon,
|
|
3180
|
-
lonper: lonper
|
|
3181
|
-
};
|
|
3182
|
-
}; // rv2coe
|
|
3183
|
-
|
|
3184
|
-
/* -----------------------------------------------------------------------------
|
|
3185
|
-
*
|
|
3186
|
-
* procedure jday
|
|
3187
|
-
*
|
|
3188
|
-
* this procedure finds the julian date given the year, month, day, and time.
|
|
3189
|
-
* the julian date is defined by each elapsed day since noon, jan 1, 4713 bc.
|
|
3190
|
-
*
|
|
3191
|
-
* algorithm : calculate the answer in one step for efficiency
|
|
3192
|
-
*
|
|
3193
|
-
* author : david vallado 719-573-2600 1 mar 2001
|
|
3194
|
-
*
|
|
3195
|
-
* inputs description range / units
|
|
3196
|
-
* year - year 1900 .. 2100
|
|
3197
|
-
* mon - month 1 .. 12
|
|
3198
|
-
* day - day 1 .. 28,29,30,31
|
|
3199
|
-
* hr - universal time hour 0 .. 23
|
|
3200
|
-
* min - universal time min 0 .. 59
|
|
3201
|
-
* sec - universal time sec 0.0 .. 59.999
|
|
3202
|
-
*
|
|
3203
|
-
* outputs :
|
|
3204
|
-
* jd - julian date days from 4713 bc
|
|
3205
|
-
* jdfrac - julian date fraction into day days from 4713 bc
|
|
3206
|
-
*
|
|
3207
|
-
* locals :
|
|
3208
|
-
* none.
|
|
3209
|
-
*
|
|
3210
|
-
* coupling :
|
|
3211
|
-
* none.
|
|
3212
|
-
*
|
|
3213
|
-
* references :
|
|
3214
|
-
* vallado 2013, 183, alg 14, ex 3-4
|
|
3215
|
-
*
|
|
3216
|
-
* --------------------------------------------------------------------------- */
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
Sgp4.jday = function (year, mon, day, hr, minute, sec) {
|
|
3220
|
-
var jd = 367.0 * year - Math.floor(7 * (year + Math.floor((mon + 9) / 12.0)) * 0.25) + Math.floor(275 * mon / 9.0) + day + 1721013.5; // use - 678987.0 to go to mjd directly
|
|
3221
|
-
|
|
3222
|
-
var jdFrac = (sec + minute * 60.0 + hr * 3600.0) / 86400.0; // check that the day and fractional day are correct
|
|
3223
|
-
|
|
3224
|
-
if (Math.abs(jdFrac) > 1.0) {
|
|
3225
|
-
var dtt = Math.floor(jdFrac);
|
|
3226
|
-
jd = jd + dtt;
|
|
3227
|
-
jdFrac = jdFrac - dtt;
|
|
3228
|
-
} // - 0.5*sgn(100.0*year + mon - 190002.5) + 0.5;
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
return {
|
|
3232
|
-
jd: jd,
|
|
3233
|
-
jdFrac: jdFrac
|
|
3234
|
-
};
|
|
3235
|
-
}; // jday
|
|
3236
|
-
|
|
3237
|
-
/* -----------------------------------------------------------------------------
|
|
3238
|
-
*
|
|
3239
|
-
* procedure days2mdhms
|
|
3240
|
-
*
|
|
3241
|
-
* this procedure converts the day of the year, days, to the equivalent month
|
|
3242
|
-
* day, hour, minute and second.
|
|
3243
|
-
*
|
|
3244
|
-
* algorithm : set up array for the number of days per month
|
|
3245
|
-
* find leap year - use 1900 because 2000 is a leap year
|
|
3246
|
-
* loop through a temp value while the value is < the days
|
|
3247
|
-
* perform int conversions to the correct day and month
|
|
3248
|
-
* convert remainder into h m s using type conversions
|
|
3249
|
-
*
|
|
3250
|
-
* author : david vallado 719-573-2600 1 mar 2001
|
|
3251
|
-
*
|
|
3252
|
-
* inputs description range / units
|
|
3253
|
-
* year - year 1900 .. 2100
|
|
3254
|
-
* days - julian day of the year 0.0 .. 366.0
|
|
3255
|
-
*
|
|
3256
|
-
* outputs :
|
|
3257
|
-
* mon - month 1 .. 12
|
|
3258
|
-
* day - day 1 .. 28,29,30,31
|
|
3259
|
-
* hr - hour 0 .. 23
|
|
3260
|
-
* min - minute 0 .. 59
|
|
3261
|
-
* sec - second 0.0 .. 59.999
|
|
3262
|
-
*
|
|
3263
|
-
* locals :
|
|
3264
|
-
* dayofyr - day of year
|
|
3265
|
-
* temp - temporary extended values
|
|
3266
|
-
* inttemp - temporary int value
|
|
3267
|
-
* i - index
|
|
3268
|
-
* lmonth[13] - int array containing the number of days per month
|
|
3269
|
-
*
|
|
3270
|
-
* coupling :
|
|
3271
|
-
* none.
|
|
3272
|
-
* --------------------------------------------------------------------------- */
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
Sgp4.days2mdhms = function (year, days) {
|
|
3276
|
-
lmonth = [31, year % 4 === 0 ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
3277
|
-
dayofyr = Math.floor(days); // ----------------- find month and day of month ----------------
|
|
3278
|
-
|
|
3279
|
-
/** Ootk -- Incorporated in the above declaration */
|
|
3280
|
-
// if ((year % 4) == 0)
|
|
3281
|
-
// lmonth[2] = 29;
|
|
3282
|
-
|
|
3283
|
-
i = 1;
|
|
3284
|
-
inttemp = 0;
|
|
3285
|
-
|
|
3286
|
-
while (dayofyr > inttemp + lmonth[i - 1] && i < 12) {
|
|
3287
|
-
inttemp += lmonth[i - 1];
|
|
3288
|
-
i += 1;
|
|
3289
|
-
}
|
|
3290
|
-
|
|
3291
|
-
mon = i;
|
|
3292
|
-
day = dayofyr - inttemp; // ----------------- find hours minutes and seconds -------------
|
|
3293
|
-
|
|
3294
|
-
temp = (days - dayofyr) * 24.0;
|
|
3295
|
-
hr = Math.floor(temp);
|
|
3296
|
-
temp = (temp - hr) * 60.0;
|
|
3297
|
-
minute = Math.floor(temp);
|
|
3298
|
-
sec = (temp - minute) * 60.0;
|
|
3299
|
-
return {
|
|
3300
|
-
mon: mon,
|
|
3301
|
-
day: day,
|
|
3302
|
-
hr: hr,
|
|
3303
|
-
minute: minute,
|
|
3304
|
-
sec: sec
|
|
3305
|
-
};
|
|
3306
|
-
}; // days2mdhms
|
|
3307
|
-
|
|
3308
|
-
/* -----------------------------------------------------------------------------
|
|
3309
|
-
*
|
|
3310
|
-
* procedure invjday
|
|
3311
|
-
*
|
|
3312
|
-
* this procedure finds the year, month, day, hour, minute and second
|
|
3313
|
-
* given the julian date. tu can be ut1, tdt, tdb, etc.
|
|
3314
|
-
*
|
|
3315
|
-
* algorithm : set up starting values
|
|
3316
|
-
* find leap year - use 1900 because 2000 is a leap year
|
|
3317
|
-
* find the elapsed days through the year in a loop
|
|
3318
|
-
* call routine to find each individual value
|
|
3319
|
-
*
|
|
3320
|
-
* author : david vallado 719-573-2600 1 mar 2001
|
|
3321
|
-
*
|
|
3322
|
-
* inputs description range / units
|
|
3323
|
-
* jd - julian date days from 4713 bc
|
|
3324
|
-
* jdfrac - julian date fraction into day days from 4713 bc
|
|
3325
|
-
*
|
|
3326
|
-
* outputs :
|
|
3327
|
-
* year - year 1900 .. 2100
|
|
3328
|
-
* mon - month 1 .. 12
|
|
3329
|
-
* day - day 1 .. 28,29,30,31
|
|
3330
|
-
* hr - hour 0 .. 23
|
|
3331
|
-
* min - minute 0 .. 59
|
|
3332
|
-
* sec - second 0.0 .. 59.999
|
|
3333
|
-
*
|
|
3334
|
-
* locals :
|
|
3335
|
-
* days - day of year plus fractional
|
|
3336
|
-
* portion of a day days
|
|
3337
|
-
* tu - julian centuries from 0 h
|
|
3338
|
-
* jan 0, 1900
|
|
3339
|
-
* temp - temporary double values
|
|
3340
|
-
* leapyrs - number of leap years from 1900
|
|
3341
|
-
*
|
|
3342
|
-
* coupling :
|
|
3343
|
-
* days2mdhms - finds month, day, hour, minute and second given days and year
|
|
3344
|
-
*
|
|
3345
|
-
* references :
|
|
3346
|
-
* vallado 2013, 203, alg 22, ex 3-13
|
|
3347
|
-
* --------------------------------------------------------------------------- */
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
Sgp4.invjday = function (jd, jdfrac) {
|
|
3351
|
-
var leapyrs;
|
|
3352
|
-
var days; // check jdfrac for multiple days
|
|
3353
|
-
|
|
3354
|
-
if (Math.abs(jdfrac) >= 1.0) {
|
|
3355
|
-
jd = jd + Math.floor(jdfrac);
|
|
3356
|
-
jdfrac = jdfrac - Math.floor(jdfrac);
|
|
3357
|
-
} // check for fraction of a day included in the jd
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
var dt = jd - Math.floor(jd) - 0.5;
|
|
3361
|
-
|
|
3362
|
-
if (Math.abs(dt) > 0.00000001) {
|
|
3363
|
-
jd = jd - dt;
|
|
3364
|
-
jdfrac = jdfrac + dt;
|
|
3365
|
-
}
|
|
3366
|
-
/* --------------- find year and days of the year --------------- */
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
var temp = jd - 2415019.5;
|
|
3370
|
-
var tu = temp / 365.25;
|
|
3371
|
-
year = 1900 + Math.floor(tu);
|
|
3372
|
-
leapyrs = Math.floor((year - 1901) * 0.25);
|
|
3373
|
-
days = Math.floor(temp - ((year - 1900) * 365.0 + leapyrs));
|
|
3374
|
-
/* ------------ check for case of beginning of a year ----------- */
|
|
3375
|
-
|
|
3376
|
-
if (days + jdfrac < 1.0) {
|
|
3377
|
-
year = year - 1;
|
|
3378
|
-
leapyrs = Math.floor((year - 1901) * 0.25);
|
|
3379
|
-
days = Math.floor(temp - ((year - 1900) * 365.0 + leapyrs));
|
|
3380
|
-
}
|
|
3381
|
-
/* ----------------- find remaining data ------------------------- */
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
var _a = Sgp4.days2mdhms(year, days + jdfrac),
|
|
3385
|
-
mon = _a.mon,
|
|
3386
|
-
day = _a.day,
|
|
3387
|
-
hr = _a.hr,
|
|
3388
|
-
minute = _a.minute,
|
|
3389
|
-
sec = _a.sec;
|
|
3390
|
-
|
|
3391
|
-
return {
|
|
3392
|
-
year: year,
|
|
3393
|
-
mon: mon,
|
|
3394
|
-
day: day,
|
|
3395
|
-
hr: hr,
|
|
3396
|
-
minute: minute,
|
|
3397
|
-
sec: sec
|
|
3398
|
-
};
|
|
3399
|
-
}; // invjday
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
return Sgp4;
|
|
3403
|
-
}();
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
/***/ }),
|
|
3408
|
-
|
|
3409
|
-
/***/ 900:
|
|
3410
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3411
|
-
|
|
3412
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3413
|
-
/* harmony export */ "Transforms": () => /* binding */ Transforms
|
|
3414
|
-
/* harmony export */ });
|
|
3415
|
-
/**
|
|
3416
|
-
* @author Theodore Kruczek.
|
|
3417
|
-
* @description Orbital Object ToolKit (OOTK) is a collection of tools for working
|
|
3418
|
-
* with satellites and other orbital objects.
|
|
3419
|
-
*
|
|
3420
|
-
* @file The Transforms module contains a collection of conversions not contained
|
|
3421
|
-
* in the original SGP4 library such as ECI to ECF and ECF to RAE. This was based
|
|
3422
|
-
* on some of the functions in satellite.js.
|
|
3423
|
-
*
|
|
3424
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
3425
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
3426
|
-
* in the Software without restriction, including without limitation the rights
|
|
3427
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
3428
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
3429
|
-
* furnished to do so, subject to the following conditions:
|
|
3430
|
-
*
|
|
3431
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
3432
|
-
* copies or substantial portions of the Software.
|
|
3433
|
-
*
|
|
3434
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
3435
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
3436
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
3437
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
3438
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
3439
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
3440
|
-
* SOFTWARE.
|
|
3441
|
-
*/
|
|
3442
|
-
var PI = Math.PI;
|
|
3443
|
-
var TAU = PI * 2; //https://tauday.com/tau-manifesto
|
|
3444
|
-
|
|
3445
|
-
var Transforms =
|
|
3446
|
-
/** @class */
|
|
3447
|
-
function () {
|
|
3448
|
-
function Transforms() {}
|
|
3449
|
-
|
|
3450
|
-
Transforms.getDegLat = function (radians) {
|
|
3451
|
-
if (radians < -PI / 2 || radians > PI / 2) {
|
|
3452
|
-
throw new RangeError('Latitude radians must be in range [-PI/2; PI/2].');
|
|
3453
|
-
}
|
|
3454
|
-
|
|
3455
|
-
return Transforms.rad2deg(radians);
|
|
3456
|
-
};
|
|
3457
|
-
|
|
3458
|
-
Transforms.getDegLon = function (radians) {
|
|
3459
|
-
if (radians < -PI || radians > PI) {
|
|
3460
|
-
throw new RangeError('Longitude radians must be in range [-PI; PI].');
|
|
3461
|
-
}
|
|
3462
|
-
|
|
3463
|
-
return Transforms.rad2deg(radians);
|
|
3464
|
-
};
|
|
3465
|
-
|
|
3466
|
-
Transforms.getRadLat = function (degrees) {
|
|
3467
|
-
if (degrees < -90 || degrees > 90) {
|
|
3468
|
-
throw new RangeError('Latitude degrees must be in range [-90; 90].');
|
|
3469
|
-
}
|
|
3470
|
-
|
|
3471
|
-
return Transforms.deg2rad(degrees);
|
|
3472
|
-
};
|
|
3473
|
-
|
|
3474
|
-
Transforms.getRadLon = function (degrees) {
|
|
3475
|
-
if (degrees < -180 || degrees > 180) {
|
|
3476
|
-
throw new RangeError('Longitude degrees must be in range [-180; 180].');
|
|
3477
|
-
}
|
|
3478
|
-
|
|
3479
|
-
return Transforms.deg2rad(degrees);
|
|
3480
|
-
};
|
|
3481
|
-
|
|
3482
|
-
Transforms.rad2deg = function (radians) {
|
|
3483
|
-
return radians * 180 / PI;
|
|
3484
|
-
};
|
|
3485
|
-
|
|
3486
|
-
Transforms.deg2rad = function (degrees) {
|
|
3487
|
-
return degrees * PI / 180.0;
|
|
3488
|
-
};
|
|
3489
|
-
|
|
3490
|
-
Transforms.ecf2eci = function (ecf, gmst) {
|
|
3491
|
-
// ccar.colorado.edu/ASEN5070/handouts/coordsys.doc
|
|
3492
|
-
//
|
|
3493
|
-
// [X] [C -S 0][X]
|
|
3494
|
-
// [Y] = [S C 0][Y]
|
|
3495
|
-
// [Z]eci [0 0 1][Z]ecf
|
|
3496
|
-
//
|
|
3497
|
-
var X = ecf.x * Math.cos(gmst) - ecf.y * Math.sin(gmst);
|
|
3498
|
-
var Y = ecf.x * Math.sin(gmst) + ecf.y * Math.cos(gmst);
|
|
3499
|
-
var Z = ecf.z;
|
|
3500
|
-
return {
|
|
3501
|
-
x: X,
|
|
3502
|
-
y: Y,
|
|
3503
|
-
z: Z
|
|
3504
|
-
};
|
|
3505
|
-
};
|
|
3506
|
-
|
|
3507
|
-
Transforms.ecf2rae = function (lla, ecf) {
|
|
3508
|
-
var sezCoords = Transforms.lla2sez(lla, ecf);
|
|
3509
|
-
return Transforms.sez2rae(sezCoords);
|
|
3510
|
-
};
|
|
3511
|
-
/** eciToGeodetic converts eci coordinates to lla coordinates
|
|
3512
|
-
* @param {{array}} eci takes xyz coordinates
|
|
3513
|
-
* @param {number} gmst takes a number in gmst time
|
|
3514
|
-
* @returns {array} array containing lla coordinates
|
|
3515
|
-
*/
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
Transforms.eci2lla = function (eci, gmst) {
|
|
3519
|
-
// http://www.celestrak.com/columns/v02n03/
|
|
3520
|
-
var a = 6378.137;
|
|
3521
|
-
var b = 6356.7523142;
|
|
3522
|
-
var R = Math.sqrt(eci.x * eci.x + eci.y * eci.y);
|
|
3523
|
-
var f = (a - b) / a;
|
|
3524
|
-
var e2 = 2 * f - f * f;
|
|
3525
|
-
var lon = Math.atan2(eci.y, eci.x) - gmst;
|
|
3526
|
-
|
|
3527
|
-
while (lon < -PI) {
|
|
3528
|
-
lon += TAU;
|
|
3529
|
-
}
|
|
3530
|
-
|
|
3531
|
-
while (lon > PI) {
|
|
3532
|
-
lon -= TAU;
|
|
3533
|
-
}
|
|
3534
|
-
|
|
3535
|
-
var kmax = 20;
|
|
3536
|
-
var k = 0;
|
|
3537
|
-
var lat = Math.atan2(eci.z, Math.sqrt(eci.x * eci.x + eci.y * eci.y));
|
|
3538
|
-
var C;
|
|
3539
|
-
|
|
3540
|
-
while (k < kmax) {
|
|
3541
|
-
C = 1 / Math.sqrt(1 - e2 * (Math.sin(lat) * Math.sin(lat)));
|
|
3542
|
-
lat = Math.atan2(eci.z + a * C * e2 * Math.sin(lat), R);
|
|
3543
|
-
k += 1;
|
|
3544
|
-
}
|
|
3545
|
-
|
|
3546
|
-
var alt = R / Math.cos(lat) - a * C;
|
|
3547
|
-
return {
|
|
3548
|
-
lon: lon,
|
|
3549
|
-
lat: lat,
|
|
3550
|
-
alt: alt
|
|
3551
|
-
};
|
|
3552
|
-
};
|
|
3553
|
-
|
|
3554
|
-
Transforms.eci2ecf = function (eci, gmst) {
|
|
3555
|
-
// ccar.colorado.edu/ASEN5070/handouts/coordsys.doc
|
|
3556
|
-
//
|
|
3557
|
-
// [X] [C -S 0][X]
|
|
3558
|
-
// [Y] = [S C 0][Y]
|
|
3559
|
-
// [Z]eci [0 0 1][Z]ecf
|
|
3560
|
-
//
|
|
3561
|
-
//
|
|
3562
|
-
// Inverse:
|
|
3563
|
-
// [X] [C S 0][X]
|
|
3564
|
-
// [Y] = [-S C 0][Y]
|
|
3565
|
-
// [Z]ecf [0 0 1][Z]eci
|
|
3566
|
-
var x = eci.x * Math.cos(gmst) + eci.y * Math.sin(gmst);
|
|
3567
|
-
var y = eci.x * -Math.sin(gmst) + eci.y * Math.cos(gmst);
|
|
3568
|
-
var z = eci.z;
|
|
3569
|
-
return {
|
|
3570
|
-
x: x,
|
|
3571
|
-
y: y,
|
|
3572
|
-
z: z
|
|
3573
|
-
};
|
|
3574
|
-
};
|
|
3575
|
-
|
|
3576
|
-
Transforms.lla2ecf = function (lla) {
|
|
3577
|
-
var lon = lla.lon,
|
|
3578
|
-
lat = lla.lat,
|
|
3579
|
-
alt = lla.alt;
|
|
3580
|
-
var a = 6378.137;
|
|
3581
|
-
var b = 6356.7523142;
|
|
3582
|
-
var f = (a - b) / a;
|
|
3583
|
-
var e2 = 2 * f - f * f;
|
|
3584
|
-
var normal = a / Math.sqrt(1 - e2 * (Math.sin(lat) * Math.sin(lat)));
|
|
3585
|
-
var x = (normal + alt) * Math.cos(lat) * Math.cos(lon);
|
|
3586
|
-
var y = (normal + alt) * Math.cos(lat) * Math.sin(lon);
|
|
3587
|
-
var z = (normal * (1 - e2) + alt) * Math.sin(lat);
|
|
3588
|
-
return {
|
|
3589
|
-
x: x,
|
|
3590
|
-
y: y,
|
|
3591
|
-
z: z
|
|
3592
|
-
};
|
|
3593
|
-
};
|
|
3594
|
-
|
|
3595
|
-
Transforms.lla2sez = function (lla, ecf) {
|
|
3596
|
-
// http://www.celestrak.com/columns/v02n02/
|
|
3597
|
-
// TS Kelso's method, except I'm using ECF frame
|
|
3598
|
-
// and he uses ECI.
|
|
3599
|
-
var lon = lla.lon,
|
|
3600
|
-
lat = lla.lat;
|
|
3601
|
-
var observerEcf = Transforms.lla2ecf(lla);
|
|
3602
|
-
var rx = ecf.x - observerEcf.x;
|
|
3603
|
-
var ry = ecf.y - observerEcf.y;
|
|
3604
|
-
var rz = ecf.z - observerEcf.z; // top is short for topocentric
|
|
3605
|
-
|
|
3606
|
-
var south = Math.sin(lat) * Math.cos(lon) * rx + Math.sin(lat) * Math.sin(lon) * ry - Math.cos(lat) * rz;
|
|
3607
|
-
var east = -Math.sin(lon) * rx + Math.cos(lon) * ry;
|
|
3608
|
-
var zenith = Math.cos(lat) * Math.cos(lon) * rx + Math.cos(lat) * Math.sin(lon) * ry + Math.sin(lat) * rz;
|
|
3609
|
-
return {
|
|
3610
|
-
s: south,
|
|
3611
|
-
e: east,
|
|
3612
|
-
z: zenith
|
|
3613
|
-
};
|
|
3614
|
-
};
|
|
3615
|
-
|
|
3616
|
-
Transforms.rae2sez = function (rae) {
|
|
3617
|
-
// az,el,range to sez convertion
|
|
3618
|
-
var south = -rae.rng * Math.cos(rae.el) * Math.cos(rae.az);
|
|
3619
|
-
var east = rae.rng * Math.cos(rae.el) * Math.sin(rae.az);
|
|
3620
|
-
var zenith = rae.rng * Math.sin(rae.el);
|
|
3621
|
-
return {
|
|
3622
|
-
s: south,
|
|
3623
|
-
e: east,
|
|
3624
|
-
z: zenith
|
|
3625
|
-
};
|
|
3626
|
-
};
|
|
3627
|
-
|
|
3628
|
-
Transforms.rae2ecf = function (rae, lla) {
|
|
3629
|
-
var obsEcf = Transforms.lla2ecf(lla);
|
|
3630
|
-
var sez = Transforms.rae2sez(rae); // some needed calculations
|
|
3631
|
-
|
|
3632
|
-
var slat = Math.sin(lla.lat);
|
|
3633
|
-
var slon = Math.sin(lla.lon);
|
|
3634
|
-
var clat = Math.cos(lla.lat);
|
|
3635
|
-
var clon = Math.cos(lla.lon);
|
|
3636
|
-
var x = slat * clon * sez.s + -slon * sez.e + clat * clon * sez.z + obsEcf.x;
|
|
3637
|
-
var y = slat * slon * sez.s + clon * sez.e + clat * slon * sez.z + obsEcf.y;
|
|
3638
|
-
var z = -clat * sez.s + slat * sez.z + obsEcf.z;
|
|
3639
|
-
return {
|
|
3640
|
-
x: x,
|
|
3641
|
-
y: y,
|
|
3642
|
-
z: z
|
|
3643
|
-
};
|
|
3644
|
-
};
|
|
3645
|
-
/**
|
|
3646
|
-
* @param {Object} sez Containing SEZ coordinates
|
|
3647
|
-
* @param {Number} sez.s Positive horizontal vector S due south.
|
|
3648
|
-
* @param {Number} sez.e Positive horizontal vector E due east.
|
|
3649
|
-
* @param {Number} sez.z Vector Z normal to the surface of the earth (up).
|
|
3650
|
-
* @returns {Object} Rng, Az, El array
|
|
3651
|
-
*/
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
Transforms.sez2rae = function (sez) {
|
|
3655
|
-
var rng = Math.sqrt(sez.s * sez.s + sez.e * sez.e + sez.z * sez.z);
|
|
3656
|
-
var el = Math.asin(sez.z / rng);
|
|
3657
|
-
var az = Math.atan2(-sez.e, sez.s) + PI;
|
|
3658
|
-
return {
|
|
3659
|
-
rng: rng,
|
|
3660
|
-
az: az,
|
|
3661
|
-
el: el
|
|
3662
|
-
};
|
|
3663
|
-
};
|
|
3664
|
-
|
|
3665
|
-
return Transforms;
|
|
3666
|
-
}();
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
/***/ }),
|
|
3671
|
-
|
|
3672
|
-
/***/ 762:
|
|
3673
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3674
|
-
|
|
3675
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3676
|
-
/* harmony export */ "Utils": () => /* binding */ Utils
|
|
3677
|
-
/* harmony export */ });
|
|
3678
|
-
/**
|
|
3679
|
-
* @author Theodore Kruczek.
|
|
3680
|
-
* @description Orbital Object ToolKit (OOTK) is a collection of tools for working
|
|
3681
|
-
* with satellites and other orbital objects.
|
|
3682
|
-
*
|
|
3683
|
-
* @file The Utils module.
|
|
3684
|
-
*
|
|
3685
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
3686
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
3687
|
-
* in the Software without restriction, including without limitation the rights
|
|
3688
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
3689
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
3690
|
-
* furnished to do so, subject to the following conditions:
|
|
3691
|
-
*
|
|
3692
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
3693
|
-
* copies or substantial portions of the Software.
|
|
3694
|
-
*
|
|
3695
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
3696
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
3697
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
3698
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
3699
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
3700
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
3701
|
-
* SOFTWARE.
|
|
3702
|
-
*/
|
|
3703
|
-
var Utils =
|
|
3704
|
-
/** @class */
|
|
3705
|
-
function () {
|
|
3706
|
-
function Utils() {}
|
|
3707
|
-
|
|
3708
|
-
Utils.distance = function (pos1, pos2) {
|
|
3709
|
-
return Math.sqrt(Math.pow(pos1.x - pos2.x, 2) + Math.pow(pos1.y - pos2.y, 2) + Math.pow(pos1.z - pos2.z, 2));
|
|
3710
|
-
};
|
|
3711
|
-
|
|
3712
|
-
Utils.dopplerFactor = function (location, position, velocity) {
|
|
3713
|
-
var mfactor = 7.292115e-5;
|
|
3714
|
-
var c = 299792.458; // Speed of light in km/s
|
|
3715
|
-
|
|
3716
|
-
var range = {
|
|
3717
|
-
x: position.x - location.x,
|
|
3718
|
-
y: position.y - location.y,
|
|
3719
|
-
z: position.z - location.z,
|
|
3720
|
-
w: 0
|
|
3721
|
-
};
|
|
3722
|
-
range.w = Math.sqrt(Math.pow(range.x, 2) + Math.pow(range.y, 2) + Math.pow(range.z, 2));
|
|
3723
|
-
var rangeVel = {
|
|
3724
|
-
x: velocity.x + mfactor * location.y,
|
|
3725
|
-
y: velocity.y - mfactor * location.x,
|
|
3726
|
-
z: velocity.z
|
|
3727
|
-
};
|
|
3728
|
-
|
|
3729
|
-
var sign = function sign(value) {
|
|
3730
|
-
return value >= 0 ? 1 : -1;
|
|
3731
|
-
};
|
|
3732
|
-
|
|
3733
|
-
var rangeRate = (range.x * rangeVel.x + range.y * rangeVel.y + range.z * rangeVel.z) / range.w;
|
|
3734
|
-
return 1 + rangeRate / c * sign(rangeRate);
|
|
3735
|
-
};
|
|
3736
|
-
|
|
3737
|
-
return Utils;
|
|
3738
|
-
}();
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
/***/ }),
|
|
3743
|
-
|
|
3744
|
-
/***/ 348:
|
|
3745
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3746
|
-
|
|
3747
|
-
__webpack_require__.r(__webpack_exports__);
|
|
3748
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3749
|
-
/* harmony export */ "Sgp4": () => /* reexport safe */ _ootk_sgp4_es_js__WEBPACK_IMPORTED_MODULE_0__.Sgp4,
|
|
3750
|
-
/* harmony export */ "Transforms": () => /* reexport safe */ _ootk_transforms_es_js__WEBPACK_IMPORTED_MODULE_1__.Transforms,
|
|
3751
|
-
/* harmony export */ "Utils": () => /* reexport safe */ _ootk_utils_es_js__WEBPACK_IMPORTED_MODULE_2__.Utils
|
|
3752
|
-
/* harmony export */ });
|
|
3753
|
-
/* harmony import */ var _ootk_sgp4_es_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(392);
|
|
3754
|
-
/* harmony import */ var _ootk_transforms_es_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(900);
|
|
3755
|
-
/* harmony import */ var _ootk_utils_es_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(762);
|
|
3756
|
-
/**
|
|
3757
|
-
* @author Theodore Kruczek.
|
|
3758
|
-
* @description Orbital Object ToolKit (OOTK) is a collection of tools for working
|
|
3759
|
-
* with satellites and other orbital objects.
|
|
3760
|
-
*
|
|
3761
|
-
* @copyright MIT License.
|
|
3762
|
-
* Copyright (c) 2020-2021 Theodore Kruczek
|
|
3763
|
-
*
|
|
3764
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
3765
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
3766
|
-
* in the Software without restriction, including without limitation the rights
|
|
3767
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
3768
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
3769
|
-
* furnished to do so, subject to the following conditions:
|
|
3770
|
-
*
|
|
3771
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
3772
|
-
* copies or substantial portions of the Software.
|
|
3773
|
-
*
|
|
3774
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
3775
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
3776
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
3777
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
3778
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
3779
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
3780
|
-
* SOFTWARE.
|
|
3781
|
-
*/
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
/***/ })
|
|
3788
|
-
|
|
3789
|
-
/******/ });
|
|
3790
|
-
/************************************************************************/
|
|
3791
|
-
/******/ // The module cache
|
|
3792
|
-
/******/ var __webpack_module_cache__ = {};
|
|
3793
|
-
/******/
|
|
3794
|
-
/******/ // The require function
|
|
3795
|
-
/******/ function __webpack_require__(moduleId) {
|
|
3796
|
-
/******/ // Check if module is in cache
|
|
3797
|
-
/******/ if(__webpack_module_cache__[moduleId]) {
|
|
3798
|
-
/******/ return __webpack_module_cache__[moduleId].exports;
|
|
3799
|
-
/******/ }
|
|
3800
|
-
/******/ // Create a new module (and put it into the cache)
|
|
3801
|
-
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
3802
|
-
/******/ // no module.id needed
|
|
3803
|
-
/******/ // no module.loaded needed
|
|
3804
|
-
/******/ exports: {}
|
|
3805
|
-
/******/ };
|
|
3806
|
-
/******/
|
|
3807
|
-
/******/ // Execute the module function
|
|
3808
|
-
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
3809
|
-
/******/
|
|
3810
|
-
/******/ // Return the exports of the module
|
|
3811
|
-
/******/ return module.exports;
|
|
3812
|
-
/******/ }
|
|
3813
|
-
/******/
|
|
3814
|
-
/************************************************************************/
|
|
3815
|
-
/******/ /* webpack/runtime/define property getters */
|
|
3816
|
-
/******/ (() => {
|
|
3817
|
-
/******/ // define getter functions for harmony exports
|
|
3818
|
-
/******/ __webpack_require__.d = (exports, definition) => {
|
|
3819
|
-
/******/ for(var key in definition) {
|
|
3820
|
-
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
3821
|
-
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
3822
|
-
/******/ }
|
|
3823
|
-
/******/ }
|
|
3824
|
-
/******/ };
|
|
3825
|
-
/******/ })();
|
|
3826
|
-
/******/
|
|
3827
|
-
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
3828
|
-
/******/ (() => {
|
|
3829
|
-
/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
|
|
3830
|
-
/******/ })();
|
|
3831
|
-
/******/
|
|
3832
|
-
/******/ /* webpack/runtime/make namespace object */
|
|
3833
|
-
/******/ (() => {
|
|
3834
|
-
/******/ // define __esModule on exports
|
|
3835
|
-
/******/ __webpack_require__.r = (exports) => {
|
|
3836
|
-
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
3837
|
-
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
3838
|
-
/******/ }
|
|
3839
|
-
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
3840
|
-
/******/ };
|
|
3841
|
-
/******/ })();
|
|
3842
|
-
/******/
|
|
3843
|
-
/************************************************************************/
|
|
3844
|
-
/******/ // module exports must be returned from runtime so entry inlining is disabled
|
|
3845
|
-
/******/ // startup
|
|
3846
|
-
/******/ // Load entry module and return exports
|
|
3847
|
-
/******/ return __webpack_require__(348);
|
|
3848
|
-
/******/ })()
|
|
3849
|
-
;
|
|
3850
|
-
});
|
|
1
|
+
!function(o,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Ootk=t():o.Ootk=t()}(this,(function(){return(()=>{"use strict";var o={407:(o,t,n)=>{n.r(t),n.d(t,{Sgp4:()=>d,Transforms:()=>i,Utils:()=>c});var a=Math.PI,s=2*a,e=a/180,r=2/3,l=15e-13,d=function(){function o(){}return o.dpper=function(o,t){var n=o.e3,e=o.ee2,r=o.peo,l=o.pgho,d=o.pho,i=o.PInco,c=o.plo,h=o.se2,u=o.se3,m=o.sgh2,p=o.sgh3,M=o.sgh4,x=o.sh2,g=o.sh3,f=o.si2,z=o.si3,v=o.sl2,y=o.sl3,b=o.sl4,j=o.t,w=o.xgh2,q=o.xgh3,k=o.xgh4,P=o.xh2,I=o.xh3,F=o.xi2,L=o.xi3,O=o.xl2,S=o.xl3,E=o.xl4,R=o.zmol,T=o.zmos,C=t.ep,D=t.inclp,N=t.nodep,_=t.argpp,A=t.mp,U=t.opsmode,V=void 0===U?"i":U,B=t.init,G=T+119459e-10*j;"y"===B&&(G=T);var H=G+.0335*Math.sin(G),J=Math.sin(H),K=.5*J*J-.25,Q=-.5*J*Math.cos(H),W=h*K+u*Q,X=f*K+z*Q,Y=v*K+y*Q+b*J,Z=m*K+p*Q+M*J,$=x*K+g*Q;G=R+.00015835218*j,"y"===B&&(G=R),H=G+.1098*Math.sin(G);var oo=W+(e*(K=.5*(J=Math.sin(H))*J-.25)+n*(Q=-.5*J*Math.cos(H))),to=X+(F*K+L*Q),no=Y+(O*K+S*Q+E*J),ao=Z+(w*K+q*Q+k*J),so=$+(P*K+I*Q);if("n"===B){no-=c,ao-=l,so-=d,D+=to-=i,C+=oo-=r;var eo=Math.sin(D),ro=Math.cos(D);if(D>=.2)_+=ao-=ro*(so/=eo),N+=so,A+=no;else{var lo=Math.sin(N),io=Math.cos(N),co=eo*lo,ho=eo*io;co+=so*io+to*ro*lo,ho+=-so*lo+to*ro*io,(N%=s)<0&&"a"===V&&(N+=s);var uo=A+_+ro*N;uo+=no+ao-to*N*eo;var mo=N;(N=Math.atan2(co,ho))<0&&"a"===V&&(N+=s),Math.abs(mo-N)>a&&(N<mo?N+=s:N-=s),_=uo-(A+=no)-ro*N}}return{ep:C,inclp:D,nodep:N,argpp:_,mp:A}},o.dscom=function(o){var t,n,a,s,e,r,l,d,i,c,h,u,m,p,M,x,g,f,z,v,y,b,j,w,q,k,P,I,F,L,O,S,E,R,T,C,D,N,_=o.epoch,A=o.ep,U=o.argpp,V=o.tc,B=o.inclp,G=o.nodep,H=o.np,J=.01675,K=.0549,Q=2*Math.PI,W=H,X=A,Y=Math.sin(G),Z=Math.cos(G),$=Math.sin(U),oo=Math.cos(U),to=Math.sin(B),no=Math.cos(B),ao=X*X,so=1-ao,eo=Math.sqrt(so),ro=_+18261.5+V/1440,lo=(4.523602-.00092422029*ro)%Q,io=Math.sin(lo),co=Math.cos(lo),ho=.91375164-.03568096*co,uo=Math.sqrt(1-ho*ho),mo=.089683511*io/uo,po=Math.sqrt(1-mo*mo),Mo=5.8351514+.001944368*ro,xo=.39785416*io/uo,go=po*co+.91744867*mo*io;xo=Math.atan2(xo,go),xo+=Mo-lo;for(var fo=Math.cos(xo),zo=Math.sin(xo),vo=.1945905,yo=-.98088458,bo=.91744867,jo=.39785416,wo=Z,qo=Y,ko=29864797e-13,Po=1/W,Io=1;Io<=2;Io++){var Fo=vo*wo+yo*bo*qo,Lo=-yo*wo+vo*bo*qo,Oo=-vo*qo+yo*bo*wo,So=yo*jo,Eo=yo*qo+vo*bo*wo,Ro=vo*jo,To=no*Oo+to*So,Co=no*Eo+to*Ro,Do=-to*Oo+no*So,No=-to*Eo+no*Ro,_o=Fo*oo+To*$,Ao=Lo*oo+Co*$,Uo=-Fo*$+To*oo,Vo=-Lo*$+Co*oo,Bo=Do*$,Go=No*$,Ho=Do*oo,Jo=No*oo;E=-6*Fo*Do+ao*(-24*_o*Ho-6*Uo*Bo),R=-6*(Fo*No+Lo*Do)+ao*(-24*(Ao*Ho+_o*Jo)+-6*(Uo*Go+Vo*Bo)),T=-6*Lo*No+ao*(-24*Ao*Jo-6*Vo*Go),C=6*To*Do+ao*(24*_o*Bo-6*Uo*Ho),D=6*(Co*Do+To*No)+ao*(24*(Ao*Bo+_o*Go)-6*(Vo*Ho+Uo*Jo)),N=6*Co*No+ao*(24*Ao*Go-6*Vo*Jo),L=(L=3*(Fo*Fo+To*To)+(P=12*_o*_o-3*Uo*Uo)*ao)+L+so*P,O=(O=6*(Fo*Lo+To*Co)+(I=24*_o*Ao-6*Uo*Vo)*ao)+O+so*I,S=(S=3*(Lo*Lo+Co*Co)+(F=12*Ao*Ao-3*Vo*Vo)*ao)+S+so*F,n=-.5*(a=ko*Po)/eo,t=-15*X*(s=a*eo),e=_o*Uo+Ao*Vo,r=Ao*Uo+_o*Vo,l=Ao*Vo-_o*Uo,1===Io&&(d=t,i=n,c=a,h=s,u=e,m=r,p=l,M=L,x=O,g=S,f=E,z=R,v=T,y=C,b=D,j=N,w=P,q=I,k=F,vo=fo,yo=zo,bo=ho,jo=uo,wo=po*Z+mo*Y,qo=Y*po-Z*mo,ko=4.7968065e-7)}return{snodm:Y,cnodm:Z,sinim:to,cosim:no,sinomm:$,cosomm:oo,day:ro,e3:2*t*l,ee2:2*t*r,em:X,emsq:ao,gam:Mo,peo:0,pgho:0,pho:0,PInco:0,plo:0,rtemsq:eo,se2:2*d*m,se3:2*d*p,sgh2:2*h*q,sgh3:2*h*(k-w),sgh4:-18*h*J,sh2:-2*i*b,sh3:-2*i*(j-y),si2:2*i*z,si3:2*i*(v-f),sl2:-2*c*x,sl3:-2*c*(g-M),sl4:-2*c*(-21-9*ao)*J,s1:t,s2:n,s3:a,s4:s,s5:e,s6:r,s7:l,ss1:d,ss2:i,ss3:c,ss4:h,ss5:u,ss6:m,ss7:p,sz1:M,sz2:x,sz3:g,sz11:f,sz12:z,sz13:v,sz21:y,sz22:b,sz23:j,sz31:w,sz32:q,sz33:k,xgh2:2*s*I,xgh3:2*s*(F-P),xgh4:-18*s*K,xh2:-2*n*D,xh3:-2*n*(N-C),xi2:2*n*R,xi3:2*n*(T-E),xl2:-2*a*O,xl3:-2*a*(S-L),xl4:-2*a*(-21-9*ao)*K,nm:W,z1:L,z2:O,z3:S,z11:E,z12:R,z13:T,z21:C,z22:D,z23:N,z31:P,z32:I,z33:F,zmol:(.2299715*ro-Mo+4.7199672)%Q,zmos:(6.2565837+.017201977*ro)%Q}},o.dsinit=function(o){var t=o.xke,n=o.cosim,e=o.argpo,r=o.s1,l=o.s2,d=o.s3,i=o.s4,c=o.s5,h=o.sinim,u=o.ss1,m=o.ss2,p=o.ss3,M=o.ss4,x=o.ss5,g=o.sz1,f=o.sz3,z=o.sz11,v=o.sz13,y=o.sz21,b=o.sz23,j=o.sz31,w=o.sz33,q=o.t,k=o.tc,P=o.gsto,I=o.mo,F=o.mdot,L=o.no,O=o.nodeo,S=o.nodedot,E=o.xPIdot,R=o.z1,T=o.z3,C=o.z11,D=o.z13,N=o.z21,_=o.z23,A=o.z31,U=o.z33,V=o.ecco,B=o.eccsq,G=o.emsq,H=o.em,J=o.argpm,K=o.inclm,Q=o.mm,W=o.nm,X=o.nodem,Y=o.irez,Z=o.atime,$=o.d2201,oo=o.d2211,to=o.d3210,no=o.d3222,ao=o.d4410,so=o.d4422,eo=o.d5220,ro=o.d5232,lo=o.d5421,io=o.d5433,co=o.dedt,ho=o.didt,uo=o.dmdt,mo=o.dnodt,po=o.domdt,Mo=o.del1,xo=o.del2,go=o.del3,fo=o.xfact,zo=o.xlamo,vo=o.xli,yo=o.xni,bo=.0043752690880113,jo=.00015835218,wo=119459e-10;Y=0,W<.0052359877&&W>.0034906585&&(Y=1),W>=.00826&&W<=.00924&&H>=.5&&(Y=2);var qo=-wo*m*(y+b);(K<.052359877||K>a-.052359877)&&(qo=0),0!==h&&(qo/=h);var ko=-jo*l*(N+_);(K<.052359877||K>a-.052359877)&&(ko=0),po=M*wo*(j+w-6)-n*qo+i*jo*(A+U-6),mo=qo,0!==h&&(po-=n/h*ko,mo+=ko/h);var Po=(P+k*bo)%s;if(H+=(co=u*wo*x+r*jo*c)*q,K+=(ho=m*wo*(z+v)+l*jo*(C+D))*q,J+=po*q,X+=mo*q,Q+=(uo=-wo*p*(g+f-14-6*G)-jo*d*(R+T-14-6*G))*q,0!==Y){var Io=Math.pow(W/t,2/3);if(2===Y){var Fo=n*n,Lo=H,Oo=G,So=(H=V)*(G=B),Eo=void 0,Ro=void 0,To=void 0,Co=void 0,Do=void 0,No=void 0,_o=void 0,Ao=void 0,Uo=void 0;H<=.65?(Eo=3.616-13.247*H+16.29*G,Ro=117.39*H-19.302-228.419*G+156.591*So,To=109.7927*H-18.9068-214.6334*G+146.5816*So,Co=242.694*H-41.122-471.094*G+313.953*So,Do=841.88*H-146.407-1629.014*G+1083.435*So,No=3017.977*H-532.114-5740.032*G+3708.276*So):(Eo=331.819*H-72.099-508.738*G+266.724*So,Ro=1582.851*H-346.844-2415.925*G+1246.113*So,To=1554.908*H-342.585-2366.899*G+1215.972*So,Co=4758.686*H-1052.797-7193.992*G+3651.957*So,Do=16178.11*H-3581.69-24462.77*G+12422.52*So,No=H>.715?29936.92*H-5149.66-54087.36*G+31324.56*So:1464.74-4664.75*H+3763.64*G),H<.7?(_o=4988.61*H-919.2277-9064.77*G+5542.21*So,Ao=4568.6173*H-822.71072-8491.4146*G+5337.524*So,Uo=4690.25*H-853.666-8624.77*G+5341.4*So):(_o=161616.52*H-37995.78-229838.2*G+109377.94*So,Ao=218913.95*H-51752.104-309468.16*G+146349.42*So,Uo=170470.89*H-40023.88-242699.48*G+115605.82*So);var Vo=h*h,Bo=W*W*3*(Io*Io),Go=17891679e-13*Bo;$=Go*(Ho=.75*(1+2*n+Fo))*(-.306-.44*(H-.64)),oo=Go*(1.5*Vo)*Eo,to=(Go=3.7393792e-7*(Bo*=Io))*(1.875*h*(1-2*n-3*Fo))*Ro,no=Go*(-1.875*h*(1+2*n-3*Fo))*To,ao=(Go=2*(Bo*=Io)*7.3636953e-9)*(35*Vo*Ho)*Co,so=Go*(39.375*Vo*Vo)*Do,eo=(Go=1.1428639e-7*(Bo*=Io))*(9.84375*h*(Vo*(1-2*n-5*Fo)+.33333333*(4*n-2+6*Fo)))*No,ro=Go*(h*(4.92187512*Vo*(-2-4*n+10*Fo)+6.56250012*(1+2*n-3*Fo)))*Uo,lo=(Go=2*Bo*2.1765803e-9)*(29.53125*h*(2-8*n+Fo*(8*n-12+10*Fo)))*Ao,io=Go*(29.53125*h*(-2-8*n+Fo*(12+8*n-10*Fo)))*_o,zo=(I+O+O-(Po+Po))%s,fo=F+uo+2*(S+mo-bo)-L,H=Lo,G=Oo}if(1===Y){var Ho,Jo=1+n;xo=2*(Mo=3*W*W*Io*Io)*(Ho=.75*(1+n)*(1+n))*(1+G*(.8125*G-2.5))*17891679e-13,go=3*Mo*(Jo*=1.875*Jo*Jo)*(1+G*(6.60937*G-6))*2.2123015e-7*Io,Mo=Mo*(.9375*h*h*(1+3*n)-.75*(1+n))*(Ro=1+2*G)*21460748e-13*Io,zo=(I+O+e-Po)%s,fo=F+E+uo+po+mo-(L+bo)}vo=zo,yo=L,Z=0,W=L+0}return{em:H,argpm:J,inclm:K,mm:Q,nm:W,nodem:X,irez:Y,atime:Z,d2201:$,d2211:oo,d3210:to,d3222:no,d4410:ao,d4422:so,d5220:eo,d5232:ro,d5421:lo,d5433:io,dedt:co,didt:ho,dmdt:uo,dndt:0,dnodt:mo,domdt:po,del1:Mo,del2:xo,del3:go,xfact:fo,xlamo:zo,xli:vo,xni:yo}},o.dspace=function(o,t,n,a,e,r,l,d,i,c,h,u,m,p,M,x,g,f,z,v,y,b,j,w,q,k,P,I,F,L,O,S,E,R,T,C){var D=.13130908,N=2.8843198,_=.37448087,A=5.7686396,U=.95240898,V=1.8014998,B=1.050833,G=4.4108898,H=259200,J=0,K=(w+.0043752690880113*j)%s;if(F+=u*b,O+=x*b,L+=z*b,T+=f*b,E+=g*b,0!==o){(0===I||b*I<=0||Math.abs(b)<Math.abs(I))&&(I=0,R=P,S=k);var Q;Q=b>0?720:-720;for(var W=void 0,X=void 0,Y=void 0,Z=void 0,$=void 0,oo=void 0,to=void 0,no=381;381===no;)2!==o?(W=m*Math.sin(S-D)+p*Math.sin(2*(S-N))+M*Math.sin(3*(S-_)),X=R+q,Y=m*Math.cos(S-D)+2*p*Math.cos(2*(S-N))+3*M*Math.cos(3*(S-_)),Y*=X):($=(Z=v+y*I)+Z,oo=S+S,W=t*Math.sin($+S-A)+n*Math.sin(S-A)+a*Math.sin(Z+S-U)+e*Math.sin(-Z+S-U)+r*Math.sin($+oo-V)+l*Math.sin(oo-V)+d*Math.sin(Z+S-B)+i*Math.sin(-Z+S-B)+c*Math.sin(Z+oo-G)+h*Math.sin(-Z+oo-G),X=R+q,Y=t*Math.cos($+S-A)+n*Math.cos(S-A)+a*Math.cos(Z+S-U)+e*Math.cos(-Z+S-U)+d*Math.cos(Z+S-B)+i*Math.cos(-Z+S-B)+2*r*Math.cos($+oo-V)+l*Math.cos(oo-V)+c*Math.cos(Z+oo-G)+h*Math.cos(-Z+oo-G),Y*=X),Math.abs(b-I)>=720?no=381:(to=b-I,no=0),381===no&&(S+=X*Q+W*H,R+=W*Q+Y*H,I+=Q);C=R+W*to+Y*to*to*.5;var ao=S+X*to+W*to*to*.5;1!==o?(E=ao-2*T+2*K,J=C-P):(E=ao-T-L+K,J=C-P),C=P+J}return[F,L,O,E,T,C]},o.initl=function(t){var n=t.opsmode,a=t.ecco,s=t.epoch,e=t.inclo,r=t.xke,l=t.j2,d=t.no,i=2*Math.PI,c=2/3,h=a*a,u=1-h,m=Math.sqrt(u),p=Math.cos(e),M=p*p,x=Math.pow(r/d,c),g=.75*l*(3*M-1)/(m*u),f=g/(x*x),z=x*(1-f*f-f*(1/3+134*f*f/81));d/=1+(f=g/(z*z));var v,y=Math.pow(r/d,c),b=Math.sin(e),j=y*u,w=1-5*M,q=-w-M-M,k=1/y,P=j*j,I=y*(1-a);if("a"==n){var F=s-7305,L=Math.floor(F+1e-8),O=.017202791694070362;(v=(1.7321343856509375+O*L+(O+i)*(F-L)+F*F*5075514194322695e-30)%i)<0&&(v+=i)}else v=o.gstime(s+2433281.5);return{no:d,method:"n",ainv:k,ao:y,con41:q,con42:w,cosio:p,cosio2:M,eccsq:h,omeosq:u,posq:P,rp:I,rteosq:m,sinio:b,gsto:v}},o.sgp4init=function(t,n){var a=n.whichconst,e=void 0===a?"wgs72":a,d=n.opsmode,i=void 0===d?"i":d,c=n.satn,h=void 0===c?t.satnum:c,u=n.epoch,m=n.xbstar,p=n.xecco,M=n.xargpo,x=n.xinclo,g=n.xndot,f=n.xnddot,z=n.xmo,v=n.xno,y=n.xnodeo;t.isimp=0,t.method="n",t.aycof=0,t.con41=0,t.cc1=0,t.cc4=0,t.cc5=0,t.d2=0,t.d3=0,t.d4=0,t.delmo=0,t.eta=0,t.argpdot=0,t.omgcof=0,t.sinmao=0,t.t=0,t.t2cof=0,t.t3cof=0,t.t4cof=0,t.t5cof=0,t.x1mth2=0,t.x7thm1=0,t.mdot=0,t.nodedot=0,t.xlcof=0,t.xmcof=0,t.nodecf=0,t.irez=0,t.d2201=0,t.d2211=0,t.d3210=0,t.d3222=0,t.d4410=0,t.d4422=0,t.d5220=0,t.d5232=0,t.d5421=0,t.d5433=0,t.dedt=0,t.del1=0,t.del2=0,t.del3=0,t.didt=0,t.dmdt=0,t.dnodt=0,t.domdt=0,t.e3=0,t.ee2=0,t.peo=0,t.pgho=0,t.pho=0,t.PInco=0,t.plo=0,t.se2=0,t.se3=0,t.sgh2=0,t.sgh3=0,t.sgh4=0,t.sh2=0,t.sh3=0,t.si2=0,t.si3=0,t.sl2=0,t.sl3=0,t.sl4=0,t.gsto=0,t.xfact=0,t.xgh2=0,t.xgh3=0,t.xgh4=0,t.xh2=0,t.xh3=0,t.xi2=0,t.xi3=0,t.xl2=0,t.xl3=0,t.xl4=0,t.xlamo=0,t.zmol=0,t.zmos=0,t.atime=0,t.xli=0,t.xni=0;var b=o.getgravconst(e);t.tumin=b.tumin,t.mus=b.mus,t.radiusearthkm=b.radiusearthkm,t.xke=b.xke,t.j2=b.j2,t.j3=b.j3,t.j4=b.j4,t.j3oj2=b.j3oj2;var j=b.j2,w=b.j4,q=b.xke,k=b.j3oj2;t.error=0,t.operationmode=i;var P=h.split("")[0].toLowerCase();isNaN(parseInt(P))?t.satnum=parseInt(P.charCodeAt(0)-96+9+t.satnum.slice(1,5)).toString():t.satnum=h,t.bstar=m,t.ndot=g,t.nddot=f,t.ecco=p,t.argpo=M,t.inclo=x,t.mo=z,t.no=v,t.nodeo=y;var I=78/t.radiusearthkm+1,F=42/t.radiusearthkm,L=F*F*F*F;t.init="y",t.t=0;var O={ecco:t.ecco,epoch:u,inclo:t.inclo,no:t.no,method:t.method,opsmode:t.operationmode,xke:t.xke,j2:t.j2},S=o.initl(O),E=S.ao,R=S.con42,T=S.cosio,C=S.cosio2,D=S.eccsq,N=S.omeosq,_=S.posq,A=S.rp,U=S.rteosq,V=S.sinio;if(t.no=S.no,t.con41=S.con41,t.gsto=S.gsto,t.a=Math.pow(t.no*t.tumin,-2/3),t.alta=t.a*(1+t.ecco)-1,t.altp=t.a*(1-t.ecco)-1,t.error=0,N>=0||t.no>=0){t.isimp=0,A<220/t.radiusearthkm+1&&(t.isimp=1);var B=I,G=L,H=(A-1)*t.radiusearthkm;if(H<156){B=H-78,H<98&&(B=20);var J=(120-B)/t.radiusearthkm;G=J*J*J*J,B=B/t.radiusearthkm+1}var K=1/_,Q=1/(E-B);t.eta=E*t.ecco*Q;var W=t.eta*t.eta,X=t.ecco*t.eta,Y=Math.abs(1-W),Z=G*Math.pow(Q,4),$=Z/Math.pow(Y,3.5),oo=$*t.no*(E*(1+1.5*W+X*(4+W))+.375*j*Q/Y*t.con41*(8+3*W*(8+W)));t.cc1=t.bstar*oo;var to=0;t.ecco>1e-4&&(to=-2*Z*Q*k*t.no*V/t.ecco),t.x1mth2=1-C,t.cc4=2*t.no*$*E*N*(t.eta*(2+.5*W)+t.ecco*(.5+2*W)-j*Q/(E*Y)*(-3*t.con41*(1-2*X+W*(1.5-.5*X))+.75*t.x1mth2*(2*W-X*(1+W))*Math.cos(2*t.argpo))),t.cc5=2*$*E*N*(1+2.75*(W+X)+X*W);var no=C*C,ao=1.5*j*K*t.no,so=.5*ao*j*K,eo=-.46875*w*K*K*t.no;t.mdot=t.no+.5*ao*U*t.con41+.0625*so*U*(13-78*C+137*no),t.argpdot=-.5*ao*R+.0625*so*(7-114*C+395*no)+eo*(3-36*C+49*no);var ro=-ao*T;t.nodedot=ro+(.5*so*(4-19*C)+2*eo*(3-7*C))*T;var lo=t.argpdot+t.nodedot;t.omgcof=t.bstar*to*Math.cos(t.argpo),t.xmcof=0,t.ecco>1e-4&&(t.xmcof=-r*Z*t.bstar/X),t.nodecf=3.5*N*ro*t.cc1,t.t2cof=1.5*t.cc1,Math.abs(T+1)>15e-13?t.xlcof=-.25*k*V*(3+5*T)/(1+T):t.xlcof=-.25*k*V*(3+5*T)/l,t.aycof=-.5*k*V;var io=1+t.eta*Math.cos(t.mo);if(t.delmo=io*io*io,t.sinmao=Math.sin(t.mo),t.x7thm1=7*C-1,s/t.no>=225){t.method="d",t.isimp=1;var co=t.inclo,ho={epoch:u,ep:t.ecco,argpp:t.argpo,tc:0,inclp:t.inclo,nodep:t.nodeo,np:t.no,e3:t.e3,ee2:t.ee2,peo:t.peo,pgho:t.pgho,pho:t.pho,PInco:t.PInco,plo:t.plo,se2:t.se2,se3:t.se3,sgh2:t.sgh2,sgh3:t.sgh3,sgh4:t.sgh4,sh2:t.sh2,sh3:t.sh3,si2:t.si2,si3:t.si3,sl2:t.sl2,sl3:t.sl3,sl4:t.sl4,xgh2:t.xgh2,xgh3:t.xgh3,xgh4:t.xgh4,xh2:t.xh2,xh3:t.xh3,xi2:t.xi2,xi3:t.xi3,xl2:t.xl2,xl3:t.xl3,xl4:t.xl4,zmol:t.zmol,zmos:t.zmos},uo=o.dscom(ho);t.e3=uo.e3,t.ee2=uo.ee2,t.peo=uo.peo,t.pgho=uo.pgho,t.pho=uo.pho,t.PInco=uo.PInco,t.plo=uo.plo,t.se2=uo.se2,t.se3=uo.se3,t.sgh2=uo.sgh2,t.sgh3=uo.sgh3,t.sgh4=uo.sgh4,t.sh2=uo.sh2,t.sh3=uo.sh3,t.si2=uo.si2,t.si3=uo.si3,t.sl2=uo.sl2,t.sl3=uo.sl3,t.sl4=uo.sl4;var mo=uo.sinim,po=uo.cosim,Mo=uo.em,xo=uo.emsq,go=uo.s1,fo=uo.s2,zo=uo.s3,vo=uo.s4,yo=uo.s5,bo=uo.ss1,jo=uo.ss2,wo=uo.ss3,qo=uo.ss4,ko=uo.ss5,Po=uo.sz1,Io=uo.sz3,Fo=uo.sz11,Lo=uo.sz13,Oo=uo.sz21,So=uo.sz23,Eo=uo.sz31,Ro=uo.sz33;t.xgh2=uo.xgh2,t.xgh3=uo.xgh3,t.xgh4=uo.xgh4,t.xh2=uo.xh2,t.xh3=uo.xh3,t.xi2=uo.xi2,t.xi3=uo.xi3,t.xl2=uo.xl2,t.xl3=uo.xl3,t.xl4=uo.xl4,t.zmol=uo.zmol,t.zmos=uo.zmos;var To=uo.nm,Co=uo.z1,Do=uo.z3,No=uo.z11,_o=uo.z13,Ao=uo.z21,Uo=uo.z23,Vo=uo.z31,Bo=uo.z33,Go={inclo:co,init:t.init,ep:t.ecco,inclp:t.inclo,nodep:t.nodeo,argpp:t.argpo,mp:t.mo,opsmode:t.operationmode},Ho=o.dpper(t,Go);t.ecco=Ho.ep,t.inclo=Ho.inclp,t.nodeo=Ho.nodep,t.argpo=Ho.argpp,t.mo=Ho.mp;var Jo={xke:q,cosim:po,emsq:xo,argpo:t.argpo,s1:go,s2:fo,s3:zo,s4:vo,s5:yo,sinim:mo,ss1:bo,ss2:jo,ss3:wo,ss4:qo,ss5:ko,sz1:Po,sz3:Io,sz11:Fo,sz13:Lo,sz21:Oo,sz23:So,sz31:Eo,sz33:Ro,t:t.t,tc:0,gsto:t.gsto,mo:t.mo,mdot:t.mdot,no:t.no,nodeo:t.nodeo,nodedot:t.nodedot,xPIdot:lo,z1:Co,z3:Do,z11:No,z13:_o,z21:Ao,z23:Uo,z31:Vo,z33:Bo,ecco:t.ecco,eccsq:D,em:Mo,argpm:0,inclm:co,mm:0,nm:To,nodem:0,irez:t.irez,atime:t.atime,d2201:t.d2201,d2211:t.d2211,d3210:t.d3210,d3222:t.d3222,d4410:t.d4410,d4422:t.d4422,d5220:t.d5220,d5232:t.d5232,d5421:t.d5421,d5433:t.d5433,dedt:t.dedt,didt:t.didt,dmdt:t.dmdt,dnodt:t.dnodt,domdt:t.domdt,del1:t.del1,del2:t.del2,del3:t.del3,xfact:t.xfact,xlamo:t.xlamo,xli:t.xli,xni:t.xni},Ko=o.dsinit(Jo);t.irez=Ko.irez,t.atime=Ko.atime,t.d2201=Ko.d2201,t.d2211=Ko.d2211,t.d3210=Ko.d3210,t.d3222=Ko.d3222,t.d4410=Ko.d4410,t.d4422=Ko.d4422,t.d5220=Ko.d5220,t.d5232=Ko.d5232,t.d5421=Ko.d5421,t.d5433=Ko.d5433,t.dedt=Ko.dedt,t.didt=Ko.didt,t.dmdt=Ko.dmdt,t.dnodt=Ko.dnodt,t.domdt=Ko.domdt,t.del1=Ko.del1,t.del2=Ko.del2,t.del3=Ko.del3,t.xfact=Ko.xfact,t.xlamo=Ko.xlamo,t.xli=Ko.xli,t.xni=Ko.xni}if(1!==t.isimp){var Qo=t.cc1*t.cc1;t.d2=4*E*Q*Qo;var Wo=t.d2*Q*t.cc1/3;t.d3=(17*E+B)*Wo,t.d4=.5*Wo*E*Q*(221*E+31*B)*t.cc1,t.t3cof=t.d2+2*Qo,t.t4cof=.25*(3*t.d3+t.cc1*(12*t.d2+10*Qo)),t.t5cof=.2*(3*t.d4+12*t.cc1*t.d3+6*t.d2*t.d2+15*Qo*(2*t.d2+Qo))}}o.propagate(t,0),t.init="n"},o.propagate=function(t,n){var e=t.xke,d=t.j2,i=t.j3oj2,c=t.radiusearthkm*t.xke/60;t.t=n,t.error=0;var h=t.mo+t.mdot*t.t,u=t.argpo+t.argpdot*t.t,m=t.nodeo+t.nodedot*t.t,p=u,M=h,x=t.t*t.t,g=m+t.nodecf*x,f=1-t.cc1*t.t,z=t.bstar*t.cc4*t.t,v=t.t2cof*x;if(1!==t.isimp){var y=t.omgcof*t.t,b=1+t.eta*Math.cos(h),j=y+t.xmcof*(b*b*b-t.delmo);M=h+j,p=u-j;var w=x*t.t,q=w*t.t;f=f-t.d2*x-t.d3*w-t.d4*q,z+=t.bstar*t.cc5*(Math.sin(M)-t.sinmao),v=v+t.t3cof*w+q*(t.t4cof+t.t*t.t5cof)}var k=t.no,P=t.ecco,I=t.inclo;if("d"===t.method){var F=t.t,L=o.dspace(t.irez,t.d2201,t.d2211,t.d3210,t.d3222,t.d4410,t.d4422,t.d5220,t.d5232,t.d5421,t.d5433,t.dedt,t.del1,t.del2,t.del3,t.didt,t.dmdt,t.dnodt,t.domdt,t.argpo,t.argpdot,t.t,F,t.gsto,t.xfact,t.xlamo,t.no,t.atime,P,p,I,t.xli,M,t.xni,g,k);P=L[0],p=L[1],I=L[2],M=L[3],g=L[4],k=L[5]}if(k<=0)return t.error=2,{position:!1,velocity:!1};var O=Math.pow(e/k,r)*f*f;if(k=e/Math.pow(O,1.5),(P-=z)>=1||P<-.001)return t.error=1,{position:!1,velocity:!1};P<1e-6&&(P=1e-6);var S=(M+=t.no*v)+p+g,E=P,R=I,T=p%=s,C=g%=s,D=M=((S%=s)-p-g)%s,N=Math.sin(I),_=Math.cos(I);if("d"===t.method){var A={inclo:t.inclo,init:"n",ep:E,inclp:R,nodep:C,argpp:T,mp:D,opsmode:t.operationmode},U=o.dpper(t,A);if(E=U.ep,C=U.nodep,T=U.argpp,D=U.mp,(R=U.inclp)<0&&(R=-R,C+=a,T-=a),E<0||E>1)return t.error=3,{position:!1,velocity:!1}}"d"===t.method&&(N=Math.sin(R),_=Math.cos(R),t.aycof=-.5*i*N,Math.abs(_+1)>15e-13?t.xlcof=-.25*i*N*(3+5*_)/(1+_):t.xlcof=-.25*i*N*(3+5*_)/l);for(var V,B,G=E*Math.cos(T),H=1/(O*(1-E*E)),J=E*Math.sin(T)+H*t.aycof,K=(D+T+C+H*t.xlcof*G-C)%s,Q=K,W=9999.9,X=1;Math.abs(W)>=1e-12&&X<=10;)V=Math.sin(Q),W=(K-J*(B=Math.cos(Q))+G*V-Q)/(W=1-B*G-V*J),Math.abs(W)>=.95&&(W=W>0?.95:-.95),Q+=W,X+=1;var Y=G*B+J*V,Z=G*V-J*B,$=G*G+J*J,oo=O*(1-$);if(oo<0)return t.error=4,{position:!1,velocity:!1};var to=O*(1-Y),no=Math.sqrt(O)*Z/to,ao=Math.sqrt(oo)/to,so=Math.sqrt(1-$),eo=O/to*(V-J-G*(H=Z/(1+so))),ro=O/to*(B-G+J*H),lo=Math.atan2(eo,ro),io=(ro+ro)*eo,co=1-2*eo*eo,ho=.5*d*(H=1/oo),uo=ho*H;if("d"===t.method){var mo=_*_;t.con41=3*mo-1,t.x1mth2=1-mo,t.x7thm1=7*mo-1}var po=to*(1-1.5*uo*so*t.con41)+.5*ho*t.x1mth2*co;if(po<1)return t.error=6,{position:!1,velocity:!1};lo-=.25*uo*t.x7thm1*io;var Mo=C+1.5*uo*_*io,xo=R+1.5*uo*_*N*co,go=no-k*ho*t.x1mth2*io/e,fo=ao+k*ho*(t.x1mth2*co+1.5*t.con41)/e,zo=Math.sin(lo),vo=Math.cos(lo),yo=Math.sin(Mo),bo=Math.cos(Mo),jo=Math.sin(xo),wo=Math.cos(xo),qo=-yo*wo,ko=bo*wo,Po=qo*zo+bo*vo,Io=ko*zo+yo*vo,Fo=jo*zo,Lo=qo*vo-bo*zo,Oo=ko*vo-yo*zo,So=jo*vo;return{position:{x:po*Po*t.radiusearthkm,y:po*Io*t.radiusearthkm,z:po*Fo*t.radiusearthkm},velocity:{x:(go*Po+fo*Lo)*c,y:(go*Io+fo*Oo)*c,z:(go*Fo+fo*So)*c}}},o.getgravconst=function(o){var t,n,a,s,e,r,l,d;switch(o){case"wgs72old":n=398600.79964,a=6378.135,t=1/(s=.0743669161),l=-165597e-11,d=(r=-253881e-11)/(e=.001082616);break;case"wgs72":n=398600.8,a=6378.135,t=1/(s=60/Math.sqrt(a*a*a/n)),l=-165597e-11,d=(r=-253881e-11)/(e=.001082616);break;case"wgs84":n=398600.5,a=6378.137,t=1/(s=60/Math.sqrt(a*a*a/n)),l=-161098761e-14,d=(r=-253215306e-14)/(e=.00108262998905);break;default:throw new Error("unknown gravity option ".concat(o))}return{tumin:t,mus:n,radiusearthkm:a,xke:s,j2:e,j3:r,j4:l,j3oj2:d}},o.createSatrec=function(t,n,s,r){void 0===s&&(s="wgs72"),void 0===r&&(r="i");var l,d={a:null,am:null,alta:null,altp:null,argpdot:null,argpo:null,aycof:null,bstar:null,cc1:null,cc4:null,cc5:null,con41:null,d2:null,d3:null,d4:null,d5232:null,d5421:null,d5433:null,dedt:null,delmo:null,del1:null,ecco:null,em:null,epochdays:null,epochyr:null,error:null,eta:null,gsto:null,im:null,inclo:null,init:null,isimp:null,jdsatepoch:null,mdot:null,method:null,mo:null,mm:null,nddot:null,ndot:null,no:null,nodecf:null,nodedot:null,nodeo:null,om:null,Om:null,omgcof:null,operationmode:null,satnum:null,sinmao:null,t:null,t2cof:null,t3cof:null,t4cof:null,t5cof:null,x1mth2:null,x7thm1:null,xlcof:null,xmcof:null,xfact:null,xlamo:null,xli:null,xgh4:null,xgh3:null,xh2:null,xi2:null,xi3:null,xl2:null,xl3:null,xl4:null,zmol:null,zmos:null,dmdt:null,dnodt:null,domdt:null,e3:null,ee2:null,peo:null,pgho:null,pho:null,PInco:null,plo:null,se2:null,se3:null,sgh2:null,sgh3:null,sgh4:null,sh2:null,sh3:null,si2:null,si3:null,sl2:null,sl3:null,sl4:null,xgh2:null,xh3:null,tumin:null,radiusearthkm:null,irez:null,d3210:null,d3222:null,d4410:null,d4422:null,d5220:null,del2:null,del3:null,didt:null,atime:null,j2:null,j3:null,j4:null,mus:null,xke:null,j3oj2:null,xni:null,d2201:null,d2211:null,nm:null},i=1440/(2*a);d.error=0,d.satnum=t.substring(2,7),d.epochyr=parseInt(t.substring(18,20)),d.epochdays=parseFloat(t.substring(20,32)),d.ndot=parseFloat(t.substring(33,43)),d.nddot=parseFloat("".concat(t.substring(44,45),".").concat(t.substring(45,50),"E").concat(t.substring(50,52))),d.bstar=parseFloat("".concat(t.substring(53,54),".").concat(t.substring(54,59),"E").concat(t.substring(59,61))),d.inclo=parseFloat(n.substring(8,16)),d.nodeo=parseFloat(n.substring(17,25)),d.ecco=parseFloat(".".concat(n.substring(26,33))),d.argpo=parseFloat(n.substring(34,42)),d.mo=parseFloat(n.substring(43,51)),d.no=parseFloat(n.substring(52,63)),d.no/=i,d.inclo*=e,d.nodeo*=e,d.argpo*=e,d.mo*=e,l=d.epochyr<57?d.epochyr+2e3:d.epochyr+1900;var c=o.days2mdhms(l,d.epochdays),h=c.mon,u=c.day,m=c.hr,p=c.minute,M=c.sec,x=o.jday(l,h,u,m,p,M);return d.jdsatepoch=x.jd+x.jdFrac,o.sgp4init(d,{whichconst:s,opsmode:r,satn:d.satnum,epoch:d.jdsatepoch-2433281.5,xbstar:d.bstar,xecco:d.ecco,xargpo:d.argpo,xinclo:d.inclo,xndot:d.ndot,xnddot:d.nddot,xmo:d.mo,xno:d.no,xnodeo:d.nodeo}),d},o.gstime=function(o){var t=(o-2451545)/36525,n=-62e-7*t*t*t+.093104*t*t+3164400184.812866*t+67310.54841;return(n=n*e/240%s)<0&&(n+=s),n},o.sgn=function(o){return o<0?-1:1},o.mag=function(o){return Math.sqrt(o[0]*o[0]+o[1]*o[1]+o[2]*o[2])},o.cross=function(o,t){var n=[0,0,0];return n[0]=o[1]*t[2]-o[2]*t[1],n[1]=o[2]*t[0]-o[0]*t[2],n[2]=o[0]*t[1]-o[1]*t[0],n},o.dot=function(o,t){return o[0]*t[0]+o[1]*t[1]+o[2]*t[2]},o.angle=function(t,n){var a=o.mag(t),s=o.mag(n);if(a*s>1e-8*1e-8){var e=o.dot(t,n)/(a*s);return Math.abs(e)>1&&(e=1*o.sgn(e)),Math.acos(e)}return 999999.1},o.asinh=function(o){return Math.log(o+Math.sqrt(o*o+1))},o.newtonnu=function(t,n){var s=999999.9,e=999999.9,r=1e-8;if(Math.abs(t)<r)e=n,s=n;else if(t<1-r){var l=Math.sqrt(1-t*t)*Math.sin(n)/(1+t*Math.cos(n)),d=(t+Math.cos(n))/(1+t*Math.cos(n));e=(s=Math.atan2(l,d))-t*Math.sin(s)}else t>1+r?t>1&&Math.abs(n)+1e-5<a-Math.acos(1/t)&&(l=Math.sqrt(t*t-1)*Math.sin(n)/(1+t*Math.cos(n)),s=o.asinh(l),e=t*o.sinh(s)-s):Math.abs(n)<168*a/180&&(e=(s=Math.tan(.5*n))+s*s*s/3);return t<1&&((e%=2*a)<0&&(e+=2*a),s%=2*a),{e0:s,m:e}},o.sinh=function(o){return(Math.exp(o)-Math.exp(-o))/2},o.rv2coe=function(t,n,e){var r,l,d,i,c,h,u,m,p,M,x,g,f,z,v,y,b,j=[0,0,0],w=[0,0,0],q=.5*a,k=1e-8,P=999999.1,I=o.mag(t),F=o.mag(n),L=o.cross(t,n),O=o.mag(L);if(O>k){j[0]=-L[1],j[1]=L[0],j[2]=0,f=o.mag(j);var S=F*F-e/I;for(g=o.dot(t,n),y=0;y<=2;y++)w[y]=(S*t[y]-g*n[y])/e;if(d=o.mag(w),v=F*F*.5-e/I,l=Math.abs(v)>k?-e/(2*v):999999.9,r=O*O/e,z=L[2]/O,i=Math.acos(z),b=1,d<k?b=i<k||Math.abs(i-a)<k?2:3:(i<k||Math.abs(i-a)<k)&&(b=4),f>k){var E=j[0]/f;Math.abs(E)>1&&(E=o.sgn(E)),c=Math.acos(E),j[1]<0&&(c=s-c)}else c=P;1==b?(h=o.angle(j,w),w[2]<0&&(h=s-h)):h=P,1==b||4==b?(u=o.angle(w,t),g<0&&(u=s-u)):u=P,3==b?(p=o.angle(j,t),t[2]<0&&(p=s-p),m=p):p=P,d>k&&4==b?(E=w[0]/d,Math.abs(E)>1&&(E=o.sgn(E)),x=Math.acos(E),w[1]<0&&(x=s-x),i>q&&(x=s-x)):x=P,I>k&&2==b?(E=t[0]/I,Math.abs(E)>1&&(E=o.sgn(E)),M=Math.acos(E),t[1]<0&&(M=s-M),i>q&&(M=s-M),m=M):M=P,1!=b&&4!=b||(m=o.newtonnu(d,u).m)}else r=P,l=P,d=P,i=P,c=P,h=P,u=P,m=P,p=P,M=P,x=P;return{p:r,a:l,ecc:d,incl:i,omega:c,argp:h,nu:u,m,arglat:p,truelon:M,lonper:x}},o.jday=function(o,t,n,a,s,e){var r=367*o-Math.floor(7*(o+Math.floor((t+9)/12))*.25)+Math.floor(275*t/9)+n+1721013.5,l=(e+60*s+3600*a)/86400;if(Math.abs(l)>1){var d=Math.floor(l);r+=d,l-=d}return{jd:r,jdFrac:l}},o.days2mdhms=function(o,t){for(var n=[31,o%4==0?29:28,31,30,31,30,31,31,30,31,30,31],a=Math.floor(t),s=1,e=0;a>e+n[s-1]&&s<12;)e+=n[s-1],s+=1;var r=s,l=a-e,d=24*(t-a),i=Math.floor(d);d=60*(d-i);var c=Math.floor(d);return{mon:r,day:l,hr:i,minute:c,sec:60*(d-c)}},o.invjday=function(t,n){var a,s;Math.abs(n)>=1&&(t+=Math.floor(n),n-=Math.floor(n));var e=t-Math.floor(t)-.5;Math.abs(e)>1e-8&&(t-=e,n+=e);var r=t-2415019.5,l=r/365.25,d=1900+Math.floor(l);a=Math.floor(.25*(d-1901)),(s=Math.floor(r-(365*(d-1900)+a)))+n<1&&(d-=1,a=Math.floor(.25*(d-1901)),s=Math.floor(r-(365*(d-1900)+a)));var i=o.days2mdhms(d,s+n);return{year:d,mon:i.mon,day:i.day,hr:i.hr,minute:i.minute,sec:i.sec}},o}(),i=function(){function o(){}return o.getDegLat=function(t){if(t<-a/2||t>a/2)throw new RangeError("Latitude radians must be in range [-PI/2; PI/2].");return o.rad2deg(t)},o.getDegLon=function(t){if(t<-a||t>a)throw new RangeError("Longitude radians must be in range [-PI; PI].");return o.rad2deg(t)},o.getRadLat=function(t){if(t<-90||t>90)throw new RangeError("Latitude degrees must be in range [-90; 90].");return o.deg2rad(t)},o.getRadLon=function(t){if(t<-180||t>180)throw new RangeError("Longitude degrees must be in range [-180; 180].");return o.deg2rad(t)},o.rad2deg=function(o){return 180*o/a},o.deg2rad=function(o){return o*a/180},o.ecf2eci=function(o,t){return{x:o.x*Math.cos(t)-o.y*Math.sin(t),y:o.x*Math.sin(t)+o.y*Math.cos(t),z:o.z}},o.ecf2rae=function(t,n){var a=o.lla2sez(t,n);return o.sez2rae(a)},o.eci2lla=function(o,t){for(var n=6378.137,e=Math.sqrt(o.x*o.x+o.y*o.y),r=(n-6356.7523142)/n,l=2*r-r*r,d=Math.atan2(o.y,o.x)-t;d<-a;)d+=s;for(;d>a;)d-=s;for(var i,c=0,h=Math.atan2(o.z,Math.sqrt(o.x*o.x+o.y*o.y));c<20;)i=1/Math.sqrt(1-l*(Math.sin(h)*Math.sin(h))),h=Math.atan2(o.z+n*i*l*Math.sin(h),e),c+=1;return{lon:d,lat:h,alt:e/Math.cos(h)-n*i}},o.eci2ecf=function(o,t){return{x:o.x*Math.cos(t)+o.y*Math.sin(t),y:o.x*-Math.sin(t)+o.y*Math.cos(t),z:o.z}},o.lla2ecf=function(o){var t=o.lon,n=o.lat,a=o.alt,s=6378.137,e=(s-6356.7523142)/s,r=2*e-e*e,l=s/Math.sqrt(1-r*(Math.sin(n)*Math.sin(n)));return{x:(l+a)*Math.cos(n)*Math.cos(t),y:(l+a)*Math.cos(n)*Math.sin(t),z:(l*(1-r)+a)*Math.sin(n)}},o.lla2sez=function(t,n){var a=t.lon,s=t.lat,e=o.lla2ecf(t),r=n.x-e.x,l=n.y-e.y,d=n.z-e.z;return{s:Math.sin(s)*Math.cos(a)*r+Math.sin(s)*Math.sin(a)*l-Math.cos(s)*d,e:-Math.sin(a)*r+Math.cos(a)*l,z:Math.cos(s)*Math.cos(a)*r+Math.cos(s)*Math.sin(a)*l+Math.sin(s)*d}},o.rae2sez=function(o){return{s:-o.rng*Math.cos(o.el)*Math.cos(o.az),e:o.rng*Math.cos(o.el)*Math.sin(o.az),z:o.rng*Math.sin(o.el)}},o.rae2ecf=function(t,n){var a=o.lla2ecf(n),s=o.rae2sez(t),e=Math.sin(n.lat),r=Math.sin(n.lon),l=Math.cos(n.lat),d=Math.cos(n.lon);return{x:e*d*s.s+-r*s.e+l*d*s.z+a.x,y:e*r*s.s+d*s.e+l*r*s.z+a.y,z:-l*s.s+e*s.z+a.z}},o.sez2rae=function(o){var t=Math.sqrt(o.s*o.s+o.e*o.e+o.z*o.z),n=Math.asin(o.z/t);return{rng:t,az:Math.atan2(-o.e,o.s)+a,el:n}},o}(),c=function(){function o(){}return o.distance=function(o,t){return Math.sqrt(Math.pow(o.x-t.x,2)+Math.pow(o.y-t.y,2)+Math.pow(o.z-t.z,2))},o.dopplerFactor=function(t,n,a){var s=7292115e-11,e={x:n.x-t.x,y:n.y-t.y,z:n.z-t.z},r=Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2)+Math.pow(e.z,2)),l=a.x+s*t.y,d=a.y-s*t.x,i=a.z,c=(e.x*l+e.y*d+e.z*i)/r;return 1+c/299792.458*o.sign(c)},o.createVec=function(o,t,n){for(var a=[],s=o;s<=t;s+=n)a.push(s);return a},o.sign=function(o){return o>=0?1:-1},o}()}},t={};function n(a){if(t[a])return t[a].exports;var s=t[a]={exports:{}};return o[a](s,s.exports,n),s.exports}return n.d=(o,t)=>{for(var a in t)n.o(t,a)&&!n.o(o,a)&&Object.defineProperty(o,a,{enumerable:!0,get:t[a]})},n.o=(o,t)=>Object.prototype.hasOwnProperty.call(o,t),n.r=o=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})},n(407)})()}));
|