ootk 1.0.7 → 1.5.0
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/{asc → .asc}/asconfig.json +0 -0
- package/{asc → .asc}/assembly/index.ts +0 -0
- package/{asc → .asc}/ex/asconfig.json +0 -0
- package/{asc → .asc}/ex/assembly/index.ts +0 -0
- package/{asc → .asc}/ex/index.html +0 -0
- package/{asc → .asc}/ex/package.json +0 -0
- package/{asc → .asc}/ex/tests/index.js +0 -0
- package/{asc → .asc}/package.json +0 -0
- package/{asc → .asc}/tests/index.js +0 -0
- package/.eslintrc.json +244 -0
- package/CHANGELOG.md +21 -1
- package/LICENSE.MD +299 -21
- package/README.md +17 -22
- package/dist/ootk.d.ts +16 -20
- package/dist/ootk.js +2 -1
- package/dist/ootk.js.LICENSE.txt +77 -0
- package/lib/objects/base-object.d.ts +40 -0
- package/lib/objects/base-object.js +109 -0
- package/lib/objects/base-object.js.map +1 -0
- package/lib/objects/detailed-sat.d.ts +66 -0
- package/lib/objects/detailed-sat.js +149 -0
- package/lib/objects/detailed-sat.js.map +1 -0
- package/lib/objects/index.d.ts +4 -0
- package/lib/objects/index.js +5 -0
- package/lib/objects/index.js.map +1 -0
- package/lib/objects/sat.d.ts +88 -0
- package/lib/objects/sat.js +141 -0
- package/lib/objects/sat.js.map +1 -0
- package/lib/objects/sensor.d.ts +40 -0
- package/lib/objects/sensor.js +88 -0
- package/lib/objects/sensor.js.map +1 -0
- package/lib/objects/space-object.d.ts +38 -0
- package/lib/objects/space-object.js +60 -0
- package/lib/objects/space-object.js.map +1 -0
- package/lib/objects/star.d.ts +46 -0
- package/lib/objects/star.js +91 -0
- package/lib/objects/star.js.map +1 -0
- package/lib/ootk.d.ts +16 -20
- package/lib/ootk.js +16 -20
- package/lib/ootk.js.map +1 -1
- package/{dist → lib/sgp4}/sgp4.d.ts +14 -21
- package/lib/{sgp4.js → sgp4/sgp4.js} +1064 -898
- package/lib/sgp4/sgp4.js.map +1 -0
- package/lib/tle/tle-format-data.d.ts +6 -0
- package/lib/tle/tle-format-data.js +10 -0
- package/lib/tle/tle-format-data.js.map +1 -0
- package/lib/tle/tle.d.ts +374 -0
- package/lib/tle/tle.js +611 -0
- package/lib/tle/tle.js.map +1 -0
- package/{dist → lib/transforms}/transforms.d.ts +14 -17
- package/lib/{transforms.js → transforms/transforms.js} +44 -40
- package/lib/transforms/transforms.js.map +1 -0
- package/lib/{utils → types}/types.d.ts +111 -3
- package/lib/types/types.js +34 -0
- package/lib/types/types.js.map +1 -0
- package/lib/utils/constants.d.ts +19 -15
- package/lib/utils/constants.js +20 -16
- package/lib/utils/constants.js.map +1 -1
- package/lib/utils/moon-math.d.ts +104 -0
- package/lib/utils/moon-math.js +387 -0
- package/lib/utils/moon-math.js.map +1 -0
- package/lib/utils/sun-math.d.ts +230 -0
- package/lib/utils/sun-math.js +421 -0
- package/lib/utils/sun-math.js.map +1 -0
- package/lib/utils/utils.d.ts +36 -0
- package/lib/utils/utils.js +81 -0
- package/lib/utils/utils.js.map +1 -0
- package/package.json +4 -3
- package/dist/utils.d.ts +0 -33
- package/lib/sgp4.d.ts +0 -89
- package/lib/sgp4.js.map +0 -1
- package/lib/transforms.d.ts +0 -58
- package/lib/transforms.js.map +0 -1
- package/lib/utils/types.js +0 -2
- package/lib/utils/types.js.map +0 -1
- package/lib/utils.d.ts +0 -33
- package/lib/utils.js +0 -60
- package/lib/utils.js.map +0 -1
|
@@ -9,29 +9,35 @@
|
|
|
9
9
|
* in order provide context to the functions and clarify any adjustments made for
|
|
10
10
|
* TypeScript/JavaScript compatibility.
|
|
11
11
|
*
|
|
12
|
-
* @
|
|
13
|
-
* Copyright (c) 2020-
|
|
12
|
+
* @license AGPL-3.0-or-later
|
|
13
|
+
* @Copyright (c) 2020-2022 Theodore Kruczek
|
|
14
14
|
*
|
|
15
|
-
*
|
|
16
|
-
* of
|
|
17
|
-
*
|
|
18
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
19
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
20
|
-
* furnished to do so, subject to the following conditions:
|
|
15
|
+
* Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
|
|
16
|
+
* terms of the GNU Affero General Public License as published by the Free Software
|
|
17
|
+
* Foundation, either version 3 of the License, or (at your option) any later version.
|
|
21
18
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
19
|
+
* Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
20
|
+
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
21
|
+
* See the GNU Affero General Public License for more details.
|
|
24
22
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
28
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
29
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
30
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
31
|
-
* SOFTWARE.
|
|
23
|
+
* You should have received a copy of the GNU Affero General Public License along with
|
|
24
|
+
* Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
|
|
32
25
|
*/
|
|
33
|
-
|
|
34
|
-
/*
|
|
26
|
+
// NOTE: This file is meant to maintain as much of the original format as possible.
|
|
27
|
+
/* eslint-disable no-lonely-if */
|
|
28
|
+
/* eslint-disable prefer-destructuring */
|
|
29
|
+
/* eslint-disable complexity */
|
|
30
|
+
/* eslint-disable max-len */
|
|
31
|
+
/* eslint-disable no-param-reassign */
|
|
32
|
+
/* eslint-disable max-params */
|
|
33
|
+
/* eslint-disable no-shadow */
|
|
34
|
+
/* eslint-disable init-declarations */
|
|
35
|
+
/* eslint-disable max-statements */
|
|
36
|
+
/* eslint-disable max-lines-per-function */
|
|
37
|
+
/* eslint-disable max-lines */
|
|
38
|
+
import { DEG2RAD, PI, TAU, temp4, x2o3 } from '../utils/constants';
|
|
39
|
+
/*
|
|
40
|
+
* ----------------------------------------------------------------
|
|
35
41
|
*
|
|
36
42
|
* sgp4unit.cpp
|
|
37
43
|
*
|
|
@@ -86,76 +92,79 @@ import { DEG2RAD, PI, TAU, temp4, x2o3 } from './utils/constants';
|
|
|
86
92
|
* 2nd edition baseline
|
|
87
93
|
* 80 norad
|
|
88
94
|
* original baseline
|
|
89
|
-
* ----------------------------------------------------------------
|
|
95
|
+
* ----------------------------------------------------------------
|
|
96
|
+
*/
|
|
90
97
|
var Sgp4 = /** @class */ (function () {
|
|
91
98
|
function Sgp4() {
|
|
92
99
|
}
|
|
93
|
-
/*
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
100
|
+
/*
|
|
101
|
+
* -----------------------------------------------------------------------------
|
|
102
|
+
*
|
|
103
|
+
* procedure dpper
|
|
104
|
+
*
|
|
105
|
+
* this procedure provides deep space long period periodic contributions
|
|
106
|
+
* to the mean elements. by design, these periodics are zero at epoch.
|
|
107
|
+
* this used to be dscom which included initialization, but it's really a
|
|
108
|
+
* recurring function.
|
|
109
|
+
*
|
|
110
|
+
* author : david vallado 719-573-2600 28 jun 2005
|
|
111
|
+
*
|
|
112
|
+
* inputs :
|
|
113
|
+
* e3 -
|
|
114
|
+
* ee2 -
|
|
115
|
+
* peo -
|
|
116
|
+
* pgho -
|
|
117
|
+
* pho -
|
|
118
|
+
* PInco -
|
|
119
|
+
* plo -
|
|
120
|
+
* se2 , se3 , sgh2, sgh3, sgh4, sh2, sh3, si2, si3, sl2, sl3, sl4 -
|
|
121
|
+
* t -
|
|
122
|
+
* xh2, xh3, xi2, xi3, xl2, xl3, xl4 -
|
|
123
|
+
* zmol -
|
|
124
|
+
* zmos -
|
|
125
|
+
* ep - eccentricity 0.0 - 1.0
|
|
126
|
+
* inclo - inclination - needed for lyddane modification
|
|
127
|
+
* nodep - right ascension of ascending node
|
|
128
|
+
* argpp - argument of perigee
|
|
129
|
+
* mp - mean anomaly
|
|
130
|
+
*
|
|
131
|
+
* outputs :
|
|
132
|
+
* ep - eccentricity 0.0 - 1.0
|
|
133
|
+
* inclp - inclination
|
|
134
|
+
* nodep - right ascension of ascending node
|
|
135
|
+
* argpp - argument of perigee
|
|
136
|
+
* mp - mean anomaly
|
|
137
|
+
*
|
|
138
|
+
* locals :
|
|
139
|
+
* alfdp -
|
|
140
|
+
* betdp -
|
|
141
|
+
* cosip , sinip , cosop , sinop ,
|
|
142
|
+
* dalf -
|
|
143
|
+
* dbet -
|
|
144
|
+
* dls -
|
|
145
|
+
* f2, f3 -
|
|
146
|
+
* pe -
|
|
147
|
+
* pgh -
|
|
148
|
+
* ph -
|
|
149
|
+
* PInc -
|
|
150
|
+
* pl -
|
|
151
|
+
* sel , ses , sghl , sghs , shl , shs , sil , sinzf , sis ,
|
|
152
|
+
* sll , sls
|
|
153
|
+
* xls -
|
|
154
|
+
* xnoh -
|
|
155
|
+
* zf -
|
|
156
|
+
* zm -
|
|
157
|
+
*
|
|
158
|
+
* coupling :
|
|
159
|
+
* none.
|
|
160
|
+
*
|
|
161
|
+
* references :
|
|
162
|
+
* hoots, roehrich, norad spacetrack report #3 1980
|
|
163
|
+
* hoots, norad spacetrack report #6 1986
|
|
164
|
+
* hoots, schumacher and glover 2004
|
|
165
|
+
* vallado, crawford, hujsak, kelso 2006
|
|
166
|
+
* ----------------------------------------------------------------------------
|
|
167
|
+
*/
|
|
159
168
|
Sgp4.dpper = function (satrec, options) {
|
|
160
169
|
var e3 = satrec.e3, ee2 = satrec.ee2, peo = satrec.peo, pgho = satrec.pgho, pho = satrec.pho, PInco = satrec.PInco, plo = satrec.plo, se2 = satrec.se2, se3 = satrec.se3, sgh2 = satrec.sgh2, sgh3 = satrec.sgh3, sgh4 = satrec.sgh4, sh2 = satrec.sh2, sh3 = satrec.sh3, si2 = satrec.si2, si3 = satrec.si3, sl2 = satrec.sl2, sl3 = satrec.sl3, sl4 = satrec.sl4, t = satrec.t, xgh2 = satrec.xgh2, xgh3 = satrec.xgh3, xgh4 = satrec.xgh4, xh2 = satrec.xh2, xh3 = satrec.xh3, xi2 = satrec.xi2, xi3 = satrec.xi3, xl2 = satrec.xl2, xl3 = satrec.xl3, xl4 = satrec.xl4, zmol = satrec.zmol, zmos = satrec.zmos;
|
|
161
170
|
var ep = options.ep, inclp = options.inclp, nodep = options.nodep, argpp = options.argpp, mp = options.mp;
|
|
@@ -168,7 +177,7 @@ var Sgp4 = /** @class */ (function () {
|
|
|
168
177
|
var zel = 0.0549;
|
|
169
178
|
// --------------- calculate time varying periodics -----------
|
|
170
179
|
var zm = zmos + zns * t;
|
|
171
|
-
//
|
|
180
|
+
// Be sure that the initial call has time set to zero
|
|
172
181
|
if (init === 'y') {
|
|
173
182
|
zm = zmos;
|
|
174
183
|
}
|
|
@@ -210,14 +219,16 @@ var Sgp4 = /** @class */ (function () {
|
|
|
210
219
|
var sinip = Math.sin(inclp);
|
|
211
220
|
var cosip = Math.cos(inclp);
|
|
212
221
|
/* ----------------- apply periodics directly ------------ */
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
222
|
+
/*
|
|
223
|
+
* Sgp4fix for lyddane choice
|
|
224
|
+
* strn3 used original inclination - this is technically feasible
|
|
225
|
+
* gsfc used perturbed inclination - also technically feasible
|
|
226
|
+
* probably best to readjust the 0.2 limit value and limit discontinuity
|
|
227
|
+
* 0.2 rad = 11.45916 deg
|
|
228
|
+
* use next line for original strn3 approach and original inclination
|
|
229
|
+
* if (inclo >= 0.2)
|
|
230
|
+
* use next line for gsfc version and perturbed inclination
|
|
231
|
+
*/
|
|
221
232
|
if (inclp >= 0.2) {
|
|
222
233
|
ph /= sinip;
|
|
223
234
|
pgh -= cosip * ph;
|
|
@@ -236,8 +247,10 @@ var Sgp4 = /** @class */ (function () {
|
|
|
236
247
|
alfdp += dalf;
|
|
237
248
|
betdp += dbet;
|
|
238
249
|
nodep %= TAU;
|
|
239
|
-
|
|
240
|
-
|
|
250
|
+
/*
|
|
251
|
+
* Sgp4fix for afspc written intrinsic functions
|
|
252
|
+
* nodep used without a trigonometric function ahead
|
|
253
|
+
*/
|
|
241
254
|
/* istanbul ignore next */
|
|
242
255
|
if (nodep < 0.0 && opsmode === 'a') {
|
|
243
256
|
nodep += TAU;
|
|
@@ -247,8 +260,10 @@ var Sgp4 = /** @class */ (function () {
|
|
|
247
260
|
xls += dls;
|
|
248
261
|
var xnoh = nodep;
|
|
249
262
|
nodep = Math.atan2(alfdp, betdp);
|
|
250
|
-
|
|
251
|
-
|
|
263
|
+
/*
|
|
264
|
+
* Sgp4fix for afspc written intrinsic functions
|
|
265
|
+
* nodep used without a trigonometric function ahead
|
|
266
|
+
*/
|
|
252
267
|
/* istanbul ignore next */
|
|
253
268
|
if (nodep < 0.0 && opsmode === 'a') {
|
|
254
269
|
nodep += TAU;
|
|
@@ -265,7 +280,7 @@ var Sgp4 = /** @class */ (function () {
|
|
|
265
280
|
mp += pl;
|
|
266
281
|
argpp = xls - mp - cosip * nodep;
|
|
267
282
|
}
|
|
268
|
-
} //
|
|
283
|
+
} // If init == 'n'
|
|
269
284
|
return {
|
|
270
285
|
ep: ep,
|
|
271
286
|
inclp: inclp,
|
|
@@ -273,74 +288,76 @@ var Sgp4 = /** @class */ (function () {
|
|
|
273
288
|
argpp: argpp,
|
|
274
289
|
mp: mp,
|
|
275
290
|
};
|
|
276
|
-
}; //
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
291
|
+
}; // Dpper
|
|
292
|
+
/*
|
|
293
|
+
*-----------------------------------------------------------------------------
|
|
294
|
+
*
|
|
295
|
+
* procedure dscom
|
|
296
|
+
*
|
|
297
|
+
* this procedure provides deep space common items used by both the secular
|
|
298
|
+
* and periodics subroutines. input is provided as shown. this routine
|
|
299
|
+
* used to be called dpper, but the functions inside weren't well organized.
|
|
300
|
+
*
|
|
301
|
+
* author : david vallado 719-573-2600 28 jun 2005
|
|
302
|
+
*
|
|
303
|
+
* inputs :
|
|
304
|
+
* epoch -
|
|
305
|
+
* ep - eccentricity
|
|
306
|
+
* argpp - argument of perigee
|
|
307
|
+
* tc -
|
|
308
|
+
* inclp - inclination
|
|
309
|
+
* nodep - right ascension of ascending node
|
|
310
|
+
* np - mean motion
|
|
311
|
+
*
|
|
312
|
+
* outputs :
|
|
313
|
+
* sinim , cosim , sinomm , cosomm , snodm , cnodm
|
|
314
|
+
* day -
|
|
315
|
+
* e3 -
|
|
316
|
+
* ee2 -
|
|
317
|
+
* em - eccentricity
|
|
318
|
+
* emsq - eccentricity squared
|
|
319
|
+
* gam -
|
|
320
|
+
* peo -
|
|
321
|
+
* pgho -
|
|
322
|
+
* pho -
|
|
323
|
+
* PInco -
|
|
324
|
+
* plo -
|
|
325
|
+
* rtemsq -
|
|
326
|
+
* se2, se3 -
|
|
327
|
+
* sgh2, sgh3, sgh4 -
|
|
328
|
+
* sh2, sh3, si2, si3, sl2, sl3, sl4 -
|
|
329
|
+
* s1, s2, s3, s4, s5, s6, s7 -
|
|
330
|
+
* ss1, ss2, ss3, ss4, ss5, ss6, ss7, sz1, sz2, sz3 -
|
|
331
|
+
* sz11, sz12, sz13, sz21, sz22, sz23, sz31, sz32, sz33 -
|
|
332
|
+
* xgh2, xgh3, xgh4, xh2, xh3, xi2, xi3, xl2, xl3, xl4 -
|
|
333
|
+
* nm - mean motion
|
|
334
|
+
* z1, z2, z3, z11, z12, z13, z21, z22, z23, z31, z32, z33 -
|
|
335
|
+
* zmol -
|
|
336
|
+
* zmos -
|
|
337
|
+
*
|
|
338
|
+
* locals :
|
|
339
|
+
* a1, a2, a3, a4, a5, a6, a7, a8, a9, a10 -
|
|
340
|
+
* betasq -
|
|
341
|
+
* cc -
|
|
342
|
+
* ctem, stem -
|
|
343
|
+
* x1, x2, x3, x4, x5, x6, x7, x8 -
|
|
344
|
+
* xnodce -
|
|
345
|
+
* xnoi -
|
|
346
|
+
* zcosg , zsing , zcosgl , zsingl , zcosh , zsinh , zcoshl , zsinhl ,
|
|
347
|
+
* zcosi , zsini , zcosil , zsinil ,
|
|
348
|
+
* zx -
|
|
349
|
+
* zy -
|
|
350
|
+
*
|
|
351
|
+
* coupling :
|
|
352
|
+
* none.
|
|
353
|
+
*
|
|
354
|
+
* references :
|
|
355
|
+
* hoots, roehrich, norad spacetrack report #3 1980
|
|
356
|
+
* hoots, norad spacetrack report #6 1986
|
|
357
|
+
* hoots, schumacher and glover 2004
|
|
358
|
+
* vallado, crawford, hujsak, kelso 2006
|
|
359
|
+
*----------------------------------------------------------------------------
|
|
360
|
+
*/
|
|
344
361
|
Sgp4.dscom = function (options) {
|
|
345
362
|
var epoch = options.epoch, ep = options.ep, argpp = options.argpp, tc = options.tc, inclp = options.inclp, nodep = options.nodep, np = options.np;
|
|
346
363
|
// -------------------------- constants -------------------------
|
|
@@ -355,7 +372,7 @@ var Sgp4 = /** @class */ (function () {
|
|
|
355
372
|
var zsings = -0.98088458;
|
|
356
373
|
var TAU = 2.0 * Math.PI;
|
|
357
374
|
// --------------------- local variables ------------------------
|
|
358
|
-
var s1, s2, s3, s4, s5, s6, s7, ss1, ss2, ss3, ss4, ss5, ss6, ss7, sz1,
|
|
375
|
+
var s1, s2, s3, s4, s5, s6, s7, ss1, ss2, ss3, ss4, ss5, ss6, ss7, sz1, sz11, sz12, sz13, sz2, sz21, sz22, sz23, sz3, sz31, sz32, sz33, z1, z11, z12, z13, z2, z21, z22, z23, z3, z31, z32, z33;
|
|
359
376
|
var nm = np;
|
|
360
377
|
var em = ep;
|
|
361
378
|
var snodm = Math.sin(nodep);
|
|
@@ -579,91 +596,94 @@ var Sgp4 = /** @class */ (function () {
|
|
|
579
596
|
zmol: zmol,
|
|
580
597
|
zmos: zmos,
|
|
581
598
|
};
|
|
582
|
-
}; //
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
599
|
+
}; // Dscom
|
|
600
|
+
/*
|
|
601
|
+
*-----------------------------------------------------------------------------
|
|
602
|
+
*
|
|
603
|
+
* procedure dsinit
|
|
604
|
+
*
|
|
605
|
+
* this procedure provides deep space contributions to mean motion dot due
|
|
606
|
+
* to geopotential resonance with half day and one day orbits.
|
|
607
|
+
*
|
|
608
|
+
* author : david vallado 719-573-2600 28 jun 2005
|
|
609
|
+
*
|
|
610
|
+
* inputs :
|
|
611
|
+
* cosim, sinim-
|
|
612
|
+
* emsq - eccentricity squared
|
|
613
|
+
* argpo - argument of perigee
|
|
614
|
+
* s1, s2, s3, s4, s5 -
|
|
615
|
+
* ss1, ss2, ss3, ss4, ss5 -
|
|
616
|
+
* sz1, sz3, sz11, sz13, sz21, sz23, sz31, sz33 -
|
|
617
|
+
* t - time
|
|
618
|
+
* tc -
|
|
619
|
+
* gsto - greenwich sidereal time rad
|
|
620
|
+
* mo - mean anomaly
|
|
621
|
+
* mdot - mean anomaly dot (rate)
|
|
622
|
+
* no - mean motion
|
|
623
|
+
* nodeo - right ascension of ascending node
|
|
624
|
+
* nodedot - right ascension of ascending node dot (rate)
|
|
625
|
+
* xPIdot -
|
|
626
|
+
* z1, z3, z11, z13, z21, z23, z31, z33 -
|
|
627
|
+
* eccm - eccentricity
|
|
628
|
+
* argpm - argument of perigee
|
|
629
|
+
* inclm - inclination
|
|
630
|
+
* mm - mean anomaly
|
|
631
|
+
* xn - mean motion
|
|
632
|
+
* nodem - right ascension of ascending node
|
|
633
|
+
*
|
|
634
|
+
* outputs :
|
|
635
|
+
* em - eccentricity
|
|
636
|
+
* argpm - argument of perigee
|
|
637
|
+
* inclm - inclination
|
|
638
|
+
* mm - mean anomaly
|
|
639
|
+
* nm - mean motion
|
|
640
|
+
* nodem - right ascension of ascending node
|
|
641
|
+
* irez - flag for resonance 0-none, 1-one day, 2-half day
|
|
642
|
+
* atime -
|
|
643
|
+
* d2201, d2211, d3210, d3222, d4410, d4422, d5220, d5232, d5421, d5433 -
|
|
644
|
+
* dedt -
|
|
645
|
+
* didt -
|
|
646
|
+
* dmdt -
|
|
647
|
+
* dndt -
|
|
648
|
+
* dnodt -
|
|
649
|
+
* domdt -
|
|
650
|
+
* del1, del2, del3 -
|
|
651
|
+
* ses , sghl , sghs , sgs , shl , shs , sis , sls
|
|
652
|
+
* theta -
|
|
653
|
+
* xfact -
|
|
654
|
+
* xlamo -
|
|
655
|
+
* xli -
|
|
656
|
+
* xni
|
|
657
|
+
*
|
|
658
|
+
* locals :
|
|
659
|
+
* ainv2 -
|
|
660
|
+
* aonv -
|
|
661
|
+
* cosisq -
|
|
662
|
+
* eoc -
|
|
663
|
+
* f220, f221, f311, f321, f322, f330, f441, f442, f522, f523, f542, f543 -
|
|
664
|
+
* g200, g201, g211, g300, g310, g322, g410, g422, g520, g521, g532, g533 -
|
|
665
|
+
* sini2 -
|
|
666
|
+
* temp -
|
|
667
|
+
* temp1 -
|
|
668
|
+
* theta -
|
|
669
|
+
* xno2 -
|
|
670
|
+
*
|
|
671
|
+
* coupling :
|
|
672
|
+
* getgravconst
|
|
673
|
+
*
|
|
674
|
+
* references :
|
|
675
|
+
* hoots, roehrich, norad spacetrack report #3 1980
|
|
676
|
+
* hoots, norad spacetrack report #6 1986
|
|
677
|
+
* hoots, schumacher and glover 2004
|
|
678
|
+
* vallado, crawford, hujsak, kelso 2006
|
|
679
|
+
*----------------------------------------------------------------------------
|
|
680
|
+
*/
|
|
662
681
|
Sgp4.dsinit = function (options) {
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
682
|
+
/*
|
|
683
|
+
* Sgp4fix just send in xke as a constant and eliminate getgravconst call
|
|
684
|
+
* gravconsttype whichconst,
|
|
685
|
+
*/
|
|
686
|
+
var xke = options.xke, cosim = options.cosim, argpo = options.argpo, s1 = options.s1, s2 = options.s2, s3 = options.s3, s4 = options.s4, s5 = options.s5, sinim = options.sinim, ss1 = options.ss1, ss2 = options.ss2, ss3 = options.ss3, ss4 = options.ss4, ss5 = options.ss5, sz1 = options.sz1, sz3 = options.sz3, sz11 = options.sz11, sz13 = options.sz13, sz21 = options.sz21, sz23 = options.sz23, sz31 = options.sz31, sz33 = options.sz33, t = options.t, tc = options.tc, gsto = options.gsto, mo = options.mo, mdot = options.mdot, no = options.no, nodeo = options.nodeo, nodedot = options.nodedot, xPIdot = options.xPIdot, z1 = options.z1, z3 = options.z3, z11 = options.z11, z13 = options.z13, z21 = options.z21, z23 = options.z23, z31 = options.z31, z33 = options.z33, ecco = options.ecco, eccsq = options.eccsq;
|
|
667
687
|
var emsq = options.emsq, em = options.em, argpm = options.argpm, inclm = options.inclm, mm = options.mm, nm = options.nm, nodem = options.nodem, irez = options.irez, atime = options.atime, d2201 = options.d2201, d2211 = options.d2211, d3210 = options.d3210, d3222 = options.d3222, d4410 = options.d4410, d4422 = options.d4422, d5220 = options.d5220, d5232 = options.d5232, d5421 = options.d5421, d5433 = options.d5433, dedt = options.dedt, didt = options.didt, dmdt = options.dmdt, dnodt = options.dnodt, domdt = options.domdt, del1 = options.del1, del2 = options.del2, del3 = options.del3, xfact = options.xfact, xlamo = options.xlamo, xli = options.xli, xni = options.xni;
|
|
668
688
|
/* --------------------- local variables ------------------------ */
|
|
669
689
|
/** Ootk -- Some variables imported from outside the class at the top */
|
|
@@ -673,15 +693,19 @@ var Sgp4 = /** @class */ (function () {
|
|
|
673
693
|
var root22 = 1.7891679e-6;
|
|
674
694
|
var root44 = 7.3636953e-9;
|
|
675
695
|
var root54 = 2.1765803e-9;
|
|
676
|
-
|
|
696
|
+
// IDEA: Any way to fix this?
|
|
697
|
+
// eslint-disable-next-line @typescript-eslint/no-loss-of-precision
|
|
698
|
+
var rptim = 4.37526908801129966e-3; // Equates to 7.29211514668855e-5 rad/sec
|
|
677
699
|
var root32 = 3.7393792e-7;
|
|
678
700
|
var root52 = 1.1428639e-7;
|
|
679
701
|
var x2o3 = 2.0 / 3.0;
|
|
680
702
|
var znl = 1.5835218e-4;
|
|
681
703
|
var zns = 1.19459e-5;
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
704
|
+
/*
|
|
705
|
+
* Sgp4fix identify constants and allow alternate values
|
|
706
|
+
* just xke is used here so pass it in rather than have multiple calls
|
|
707
|
+
* getgravconst( whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2 );
|
|
708
|
+
*/
|
|
685
709
|
// -------------------- deep space initialization ------------
|
|
686
710
|
irez = 0;
|
|
687
711
|
if (nm < 0.0052359877 && nm > 0.0034906585) {
|
|
@@ -696,7 +720,7 @@ var Sgp4 = /** @class */ (function () {
|
|
|
696
720
|
var sls = -zns * ss3 * (sz1 + sz3 - 14.0 - 6.0 * emsq);
|
|
697
721
|
var sghs = ss4 * zns * (sz31 + sz33 - 6.0);
|
|
698
722
|
var shs = -zns * ss2 * (sz21 + sz23);
|
|
699
|
-
//
|
|
723
|
+
// Sgp4fix for 180 deg incl
|
|
700
724
|
if (inclm < 5.2359877e-2 || inclm > PI - 5.2359877e-2) {
|
|
701
725
|
shs = 0.0;
|
|
702
726
|
}
|
|
@@ -710,7 +734,7 @@ var Sgp4 = /** @class */ (function () {
|
|
|
710
734
|
dmdt = sls - znl * s3 * (z1 + z3 - 14.0 - 6.0 * emsq);
|
|
711
735
|
var sghl = s4 * znl * (z31 + z33 - 6.0);
|
|
712
736
|
var shll = -znl * s2 * (z21 + z23);
|
|
713
|
-
//
|
|
737
|
+
// Sgp4fix for 180 deg incl
|
|
714
738
|
if (inclm < 5.2359877e-2 || inclm > PI - 5.2359877e-2) {
|
|
715
739
|
shll = 0.0;
|
|
716
740
|
}
|
|
@@ -728,14 +752,16 @@ var Sgp4 = /** @class */ (function () {
|
|
|
728
752
|
argpm += domdt * t;
|
|
729
753
|
nodem += dnodt * t;
|
|
730
754
|
mm += dmdt * t;
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
755
|
+
/*
|
|
756
|
+
* Sgp4fix for negative inclinations
|
|
757
|
+
* the following if statement should be commented out
|
|
758
|
+
* if (inclm < 0.0)
|
|
759
|
+
* {
|
|
760
|
+
* inclm = -inclm;
|
|
761
|
+
* argpm = argpm - PI;
|
|
762
|
+
* nodem = nodem + PI;
|
|
763
|
+
* }
|
|
764
|
+
*/
|
|
739
765
|
// -------------- initialize the resonance terms -------------
|
|
740
766
|
if (irez !== 0) {
|
|
741
767
|
var aonv = Math.pow((nm / xke), x2o3);
|
|
@@ -748,7 +774,7 @@ var Sgp4 = /** @class */ (function () {
|
|
|
748
774
|
emsq = eccsq;
|
|
749
775
|
var eoc = em * emsq;
|
|
750
776
|
var g201 = -0.306 - (em - 0.64) * 0.44;
|
|
751
|
-
var g211 = void 0, g310 = void 0, g322 = void 0, g410 = void 0, g422 = void 0, g520 = void 0,
|
|
777
|
+
var g211 = void 0, g310 = void 0, g322 = void 0, g410 = void 0, g422 = void 0, g520 = void 0, g521 = void 0, g532 = void 0, g533 = void 0;
|
|
752
778
|
if (em <= 0.65) {
|
|
753
779
|
g211 = 3.616 - 13.247 * em + 16.29 * emsq;
|
|
754
780
|
g310 = -19.302 + 117.39 * em - 228.419 * emsq + 156.591 * eoc;
|
|
@@ -875,79 +901,81 @@ var Sgp4 = /** @class */ (function () {
|
|
|
875
901
|
xli: xli,
|
|
876
902
|
xni: xni,
|
|
877
903
|
};
|
|
878
|
-
}; //
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
904
|
+
}; // Dsinit
|
|
905
|
+
/*
|
|
906
|
+
*-----------------------------------------------------------------------------
|
|
907
|
+
*
|
|
908
|
+
* procedure dspace
|
|
909
|
+
*
|
|
910
|
+
* this procedure provides deep space contributions to mean elements for
|
|
911
|
+
* perturbing third body. these effects have been averaged over one
|
|
912
|
+
* revolution of the sun and moon. for earth resonance effects, the
|
|
913
|
+
* effects have been averaged over no revolutions of the satellite.
|
|
914
|
+
* (mean motion)
|
|
915
|
+
*
|
|
916
|
+
* author : david vallado 719-573-2600 28 jun 2005
|
|
917
|
+
*
|
|
918
|
+
* inputs :
|
|
919
|
+
* d2201, d2211, d3210, d3222, d4410, d4422, d5220, d5232, d5421, d5433 -
|
|
920
|
+
* dedt -
|
|
921
|
+
* del1, del2, del3 -
|
|
922
|
+
* didt -
|
|
923
|
+
* dmdt -
|
|
924
|
+
* dnodt -
|
|
925
|
+
* domdt -
|
|
926
|
+
* irez - flag for resonance 0-none, 1-one day, 2-half day
|
|
927
|
+
* argpo - argument of perigee
|
|
928
|
+
* argpdot - argument of perigee dot (rate)
|
|
929
|
+
* t - time
|
|
930
|
+
* tc -
|
|
931
|
+
* gsto - gst
|
|
932
|
+
* xfact -
|
|
933
|
+
* xlamo -
|
|
934
|
+
* no - mean motion
|
|
935
|
+
* atime -
|
|
936
|
+
* em - eccentricity
|
|
937
|
+
* ft -
|
|
938
|
+
* argpm - argument of perigee
|
|
939
|
+
* inclm - inclination
|
|
940
|
+
* xli -
|
|
941
|
+
* mm - mean anomaly
|
|
942
|
+
* xni - mean motion
|
|
943
|
+
* nodem - right ascension of ascending node
|
|
944
|
+
*
|
|
945
|
+
* outputs :
|
|
946
|
+
* atime -
|
|
947
|
+
* em - eccentricity
|
|
948
|
+
* argpm - argument of perigee
|
|
949
|
+
* inclm - inclination
|
|
950
|
+
* xli -
|
|
951
|
+
* mm - mean anomaly
|
|
952
|
+
* xni -
|
|
953
|
+
* nodem - right ascension of ascending node
|
|
954
|
+
* dndt -
|
|
955
|
+
* nm - mean motion
|
|
956
|
+
*
|
|
957
|
+
* locals :
|
|
958
|
+
* delt -
|
|
959
|
+
* ft -
|
|
960
|
+
* theta -
|
|
961
|
+
* x2li -
|
|
962
|
+
* x2omi -
|
|
963
|
+
* xl -
|
|
964
|
+
* xldot -
|
|
965
|
+
* xnddt -
|
|
966
|
+
* xndt -
|
|
967
|
+
* xomi -
|
|
968
|
+
*
|
|
969
|
+
* coupling :
|
|
970
|
+
* none -
|
|
971
|
+
*
|
|
972
|
+
* references :
|
|
973
|
+
* hoots, roehrich, norad spacetrack report #3 1980
|
|
974
|
+
* hoots, norad spacetrack report #6 1986
|
|
975
|
+
* hoots, schumacher and glover 2004
|
|
976
|
+
* vallado, crawford, hujsak, kelso 2006
|
|
977
|
+
*----------------------------------------------------------------------------
|
|
978
|
+
*/
|
|
951
979
|
Sgp4.dspace = function (irez, d2201, d2211, d3210, d3222, d4410, d4422, d5220, d5232, d5421, d5433, dedt, del1, del2, del3, didt, dmdt, dnodt, domdt, argpo, argpdot, t, tc, gsto, xfact, xlamo, no, atime, em, argpm, inclm, xli, mm, xni, nodem, nm) {
|
|
952
980
|
/** Ootk -- Some variables imported from outside the class at the top */
|
|
953
981
|
var fasx2 = 0.13130908;
|
|
@@ -958,7 +986,9 @@ var Sgp4 = /** @class */ (function () {
|
|
|
958
986
|
var g44 = 1.8014998;
|
|
959
987
|
var g52 = 1.050833;
|
|
960
988
|
var g54 = 4.4108898;
|
|
961
|
-
|
|
989
|
+
// IDEA: Any way to fix this?
|
|
990
|
+
// eslint-disable-next-line @typescript-eslint/no-loss-of-precision
|
|
991
|
+
var rptim = 4.37526908801129966e-3; // Equates to 7.29211514668855e-5 rad/sec
|
|
962
992
|
var stepp = 720.0;
|
|
963
993
|
var stepn = -720.0;
|
|
964
994
|
var step2 = 259200.0;
|
|
@@ -970,29 +1000,33 @@ var Sgp4 = /** @class */ (function () {
|
|
|
970
1000
|
argpm += domdt * t;
|
|
971
1001
|
nodem += dnodt * t;
|
|
972
1002
|
mm += dmdt * t;
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
1003
|
+
/*
|
|
1004
|
+
* Sgp4fix for negative inclinations
|
|
1005
|
+
* the following if statement should be commented out
|
|
1006
|
+
* if (inclm < 0.0)
|
|
1007
|
+
* {
|
|
1008
|
+
* inclm = -inclm;
|
|
1009
|
+
* argpm = argpm - PI;
|
|
1010
|
+
* nodem = nodem + PI;
|
|
1011
|
+
* }
|
|
1012
|
+
*/
|
|
981
1013
|
/* - update resonances : numerical (euler-maclaurin) integration - */
|
|
982
1014
|
/* ------------------------- epoch restart ---------------------- */
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
1015
|
+
/*
|
|
1016
|
+
* Sgp4fix for propagator problems
|
|
1017
|
+
* the following integration works for negative time steps and periods
|
|
1018
|
+
* the specific changes are unknown because the original code was so convoluted
|
|
1019
|
+
*/
|
|
1020
|
+
// Sgp4fix take out atime = 0.0 and fix for faster operation
|
|
1021
|
+
// Ft = 0.0; /** Ootk -- This has no value */
|
|
988
1022
|
if (irez !== 0) {
|
|
989
|
-
//
|
|
1023
|
+
// Sgp4fix streamline check
|
|
990
1024
|
if (atime === 0.0 || t * atime <= 0.0 || Math.abs(t) < Math.abs(atime)) {
|
|
991
1025
|
atime = 0.0;
|
|
992
1026
|
xni = no;
|
|
993
1027
|
xli = xlamo;
|
|
994
1028
|
}
|
|
995
|
-
//
|
|
1029
|
+
// Sgp4fix move check outside loop
|
|
996
1030
|
var delt = void 0;
|
|
997
1031
|
if (t > 0.0) {
|
|
998
1032
|
delt = stepp;
|
|
@@ -1000,11 +1034,13 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1000
1034
|
else {
|
|
1001
1035
|
delt = stepn;
|
|
1002
1036
|
}
|
|
1003
|
-
var
|
|
1004
|
-
var iretn = 381; //
|
|
1037
|
+
var ft = void 0, x2li = void 0, x2omi = void 0, xldot = void 0, xnddt = void 0, xndt = void 0, xomi = void 0;
|
|
1038
|
+
var iretn = 381; // Added for do loop
|
|
1005
1039
|
while (iretn === 381) {
|
|
1006
|
-
|
|
1007
|
-
|
|
1040
|
+
/*
|
|
1041
|
+
* ------------------- dot terms calculated -------------
|
|
1042
|
+
* ----------- near - synchronous resonance terms -------
|
|
1043
|
+
*/
|
|
1008
1044
|
if (irez !== 2) {
|
|
1009
1045
|
xndt =
|
|
1010
1046
|
del1 * Math.sin(xli - fasx2) + del2 * Math.sin(2.0 * (xli - fasx4)) + del3 * Math.sin(3.0 * (xli - fasx6));
|
|
@@ -1045,10 +1081,12 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1045
1081
|
d5433 * Math.cos(-xomi + x2li - g54);
|
|
1046
1082
|
xnddt *= xldot;
|
|
1047
1083
|
}
|
|
1048
|
-
|
|
1049
|
-
|
|
1084
|
+
/*
|
|
1085
|
+
* ----------------------- integrator -------------------
|
|
1086
|
+
* sgp4fix move end checks to end of routine
|
|
1087
|
+
*/
|
|
1050
1088
|
if (Math.abs(t - atime) >= stepp) {
|
|
1051
|
-
//
|
|
1089
|
+
// Iret = 0; /** Ootk -- This has no value */
|
|
1052
1090
|
iretn = 381;
|
|
1053
1091
|
}
|
|
1054
1092
|
else {
|
|
@@ -1060,7 +1098,7 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1060
1098
|
xni += xndt * delt + xnddt * step2;
|
|
1061
1099
|
atime += delt;
|
|
1062
1100
|
}
|
|
1063
|
-
} //
|
|
1101
|
+
} // While iretn = 381
|
|
1064
1102
|
nm = xni + xndt * ft + xnddt * ft * ft * 0.5;
|
|
1065
1103
|
var xl = xli + xldot * ft + xndt * ft * ft * 0.5;
|
|
1066
1104
|
if (irez !== 1) {
|
|
@@ -1074,76 +1112,82 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1074
1112
|
nm = no + dndt;
|
|
1075
1113
|
}
|
|
1076
1114
|
return [em, argpm, inclm, mm, nodem, nm];
|
|
1077
|
-
}; //
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1115
|
+
}; // Dspace
|
|
1116
|
+
/*
|
|
1117
|
+
*-----------------------------------------------------------------------------
|
|
1118
|
+
*
|
|
1119
|
+
* procedure initl
|
|
1120
|
+
*
|
|
1121
|
+
* this procedure initializes the sgp4 propagator. all the initialization is
|
|
1122
|
+
* consolidated here instead of having multiple loops inside other routines.
|
|
1123
|
+
*
|
|
1124
|
+
* author : david vallado 719-573-2600 28 jun 2005
|
|
1125
|
+
*
|
|
1126
|
+
* inputs :
|
|
1127
|
+
* satn - satellite number - not needed, placed in satrec
|
|
1128
|
+
* xke - reciprocal of tumin
|
|
1129
|
+
* j2 - j2 zonal harmonic
|
|
1130
|
+
* ecco - eccentricity 0.0 - 1.0
|
|
1131
|
+
* epoch - epoch time in days from jan 0, 1950. 0 hr
|
|
1132
|
+
* inclo - inclination of satellite
|
|
1133
|
+
* no - mean motion of satellite
|
|
1134
|
+
*
|
|
1135
|
+
* outputs :
|
|
1136
|
+
* ainv - 1.0 / a
|
|
1137
|
+
* ao - semi major axis
|
|
1138
|
+
* con41 -
|
|
1139
|
+
* con42 - 1.0 - 5.0 cos(i)
|
|
1140
|
+
* cosio - cosine of inclination
|
|
1141
|
+
* cosio2 - cosio squared
|
|
1142
|
+
* eccsq - eccentricity squared
|
|
1143
|
+
* method - flag for deep space 'd', 'n'
|
|
1144
|
+
* omeosq - 1.0 - ecco * ecco
|
|
1145
|
+
* posq - semi-parameter squared
|
|
1146
|
+
* rp - radius of perigee
|
|
1147
|
+
* rteosq - square root of (1.0 - ecco*ecco)
|
|
1148
|
+
* sinio - sine of inclination
|
|
1149
|
+
* gsto - gst at time of observation rad
|
|
1150
|
+
* no - mean motion of satellite
|
|
1151
|
+
*
|
|
1152
|
+
* locals :
|
|
1153
|
+
* ak -
|
|
1154
|
+
* d1 -
|
|
1155
|
+
* del -
|
|
1156
|
+
* adel -
|
|
1157
|
+
* po -
|
|
1158
|
+
*
|
|
1159
|
+
* coupling :
|
|
1160
|
+
* getgravconst- no longer used
|
|
1161
|
+
* gstime - find greenwich sidereal time from the julian date
|
|
1162
|
+
*
|
|
1163
|
+
* references :
|
|
1164
|
+
* hoots, roehrich, norad spacetrack report #3 1980
|
|
1165
|
+
* hoots, norad spacetrack report #6 1986
|
|
1166
|
+
* hoots, schumacher and glover 2004
|
|
1167
|
+
* vallado, crawford, hujsak, kelso 2006
|
|
1168
|
+
*----------------------------------------------------------------------------
|
|
1169
|
+
*/
|
|
1130
1170
|
Sgp4.initl = function (options) {
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1171
|
+
/*
|
|
1172
|
+
* Sgp4fix satn not needed. include in satrec in case needed later
|
|
1173
|
+
* int satn,
|
|
1174
|
+
* sgp4fix just pass in xke and j2
|
|
1175
|
+
* gravconsttype whichconst,
|
|
1176
|
+
*/
|
|
1135
1177
|
var opsmode = options.opsmode, ecco = options.ecco, epoch = options.epoch, inclo = options.inclo, xke = options.xke, j2 = options.j2;
|
|
1136
1178
|
var no = options.no;
|
|
1137
1179
|
/* --------------------- local variables ------------------------ */
|
|
1138
1180
|
var PI = Math.PI;
|
|
1139
1181
|
var TAU = PI * 2;
|
|
1140
1182
|
var x2o3 = 2.0 / 3.0;
|
|
1141
|
-
//
|
|
1183
|
+
// Sgp4fix use old way of finding gst
|
|
1142
1184
|
/** Ootk -- Some variables imported from outside the class at the top */
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1185
|
+
/*
|
|
1186
|
+
* ----------------------- earth constants ---------------------
|
|
1187
|
+
* sgp4fix identify constants and allow alternate values
|
|
1188
|
+
* only xke and j2 are used here so pass them in directly
|
|
1189
|
+
* getgravconst( whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2 )
|
|
1190
|
+
*/
|
|
1147
1191
|
// ------------- calculate auxillary epoch quantities ----------
|
|
1148
1192
|
var eccsq = ecco * ecco;
|
|
1149
1193
|
var omeosq = 1.0 - eccsq;
|
|
@@ -1156,7 +1200,7 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1156
1200
|
var delPrime = d1 / (ak * ak);
|
|
1157
1201
|
var adel = ak * (1.0 - delPrime * delPrime - delPrime * (1.0 / 3.0 + (134.0 * delPrime * delPrime) / 81.0));
|
|
1158
1202
|
delPrime = d1 / (adel * adel);
|
|
1159
|
-
no
|
|
1203
|
+
no /= 1.0 + delPrime;
|
|
1160
1204
|
var ao = Math.pow((xke / no), x2o3);
|
|
1161
1205
|
var sinio = Math.sin(inclo);
|
|
1162
1206
|
var po = ao * omeosq;
|
|
@@ -1166,18 +1210,24 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1166
1210
|
var posq = po * po;
|
|
1167
1211
|
var rp = ao * (1.0 - ecco);
|
|
1168
1212
|
var method = 'n';
|
|
1169
|
-
//
|
|
1213
|
+
// Sgp4fix modern approach to finding sidereal time
|
|
1170
1214
|
/** Ootk -- Continue allowing AFSPC mode for SGP4 Validation */
|
|
1171
1215
|
var gsto;
|
|
1172
|
-
if (opsmode
|
|
1173
|
-
|
|
1174
|
-
|
|
1216
|
+
if (opsmode === 'a') {
|
|
1217
|
+
/*
|
|
1218
|
+
* Sgp4fix use old way of finding gst
|
|
1219
|
+
* count integer number of days from 0 jan 1970
|
|
1220
|
+
*/
|
|
1175
1221
|
var ts70 = epoch - 7305.0;
|
|
1176
1222
|
var ds70 = Math.floor(ts70 + 1.0e-8);
|
|
1177
1223
|
var tfrac = ts70 - ds70;
|
|
1178
|
-
//
|
|
1224
|
+
// Find greenwich location at epoch
|
|
1225
|
+
// IDEA: Precision issues in JavaScript...
|
|
1226
|
+
// eslint-disable-next-line @typescript-eslint/no-loss-of-precision
|
|
1179
1227
|
var c1 = 1.72027916940703639e-2;
|
|
1228
|
+
// eslint-disable-next-line @typescript-eslint/no-loss-of-precision
|
|
1180
1229
|
var thgr70 = 1.7321343856509374;
|
|
1230
|
+
// eslint-disable-next-line @typescript-eslint/no-loss-of-precision
|
|
1181
1231
|
var fk5r = 5.07551419432269442e-15;
|
|
1182
1232
|
var c1p2p = c1 + TAU;
|
|
1183
1233
|
gsto = (thgr70 + c1 * ds70 + c1p2p * tfrac + ts70 * ts70 * fk5r) % TAU;
|
|
@@ -1206,95 +1256,99 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1206
1256
|
sinio: sinio,
|
|
1207
1257
|
gsto: gsto,
|
|
1208
1258
|
};
|
|
1209
|
-
}; //
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1259
|
+
}; // Initl
|
|
1260
|
+
/*
|
|
1261
|
+
*-----------------------------------------------------------------------------
|
|
1262
|
+
*
|
|
1263
|
+
* procedure sgp4init
|
|
1264
|
+
*
|
|
1265
|
+
* this procedure initializes variables for sgp4.
|
|
1266
|
+
*
|
|
1267
|
+
* author : david vallado 719-573-2600 28 jun 2005
|
|
1268
|
+
*
|
|
1269
|
+
* inputs :
|
|
1270
|
+
* opsmode - mode of operation afspc or improved 'a', 'i'
|
|
1271
|
+
* whichconst - which set of constants to use 72, 84
|
|
1272
|
+
* satn - satellite number
|
|
1273
|
+
* bstar - sgp4 type drag coefficient kg/m2er
|
|
1274
|
+
* ecco - eccentricity
|
|
1275
|
+
* epoch - epoch time in days from jan 0, 1950. 0 hr
|
|
1276
|
+
* argpo - argument of perigee (output if ds)
|
|
1277
|
+
* inclo - inclination
|
|
1278
|
+
* mo - mean anomaly (output if ds)
|
|
1279
|
+
* no - mean motion
|
|
1280
|
+
* nodeo - right ascension of ascending node
|
|
1281
|
+
*
|
|
1282
|
+
* outputs :
|
|
1283
|
+
* rec - common values for subsequent calls
|
|
1284
|
+
* return code - non-zero on error.
|
|
1285
|
+
* 1 - mean elements, ecc >= 1.0 or ecc < -0.001 or a < 0.95 er
|
|
1286
|
+
* 2 - mean motion less than 0.0
|
|
1287
|
+
* 3 - pert elements, ecc < 0.0 or ecc > 1.0
|
|
1288
|
+
* 4 - semi-latus rectum < 0.0
|
|
1289
|
+
* 5 - epoch elements are sub-orbital
|
|
1290
|
+
* 6 - satellite has decayed
|
|
1291
|
+
*
|
|
1292
|
+
* locals :
|
|
1293
|
+
* cnodm , snodm , cosim , sinim , cosomm , sinomm
|
|
1294
|
+
* cc1sq , cc2 , cc3
|
|
1295
|
+
* coef , coef1
|
|
1296
|
+
* cosio4 -
|
|
1297
|
+
* day -
|
|
1298
|
+
* dndt -
|
|
1299
|
+
* em - eccentricity
|
|
1300
|
+
* emsq - eccentricity squared
|
|
1301
|
+
* eeta -
|
|
1302
|
+
* etasq -
|
|
1303
|
+
* gam -
|
|
1304
|
+
* argpm - argument of perigee
|
|
1305
|
+
* nodem -
|
|
1306
|
+
* inclm - inclination
|
|
1307
|
+
* mm - mean anomaly
|
|
1308
|
+
* nm - mean motion
|
|
1309
|
+
* perige - perigee
|
|
1310
|
+
* PInvsq -
|
|
1311
|
+
* psisq -
|
|
1312
|
+
* qzms24 -
|
|
1313
|
+
* rtemsq -
|
|
1314
|
+
* s1, s2, s3, s4, s5, s6, s7 -
|
|
1315
|
+
* sfour -
|
|
1316
|
+
* ss1, ss2, ss3, ss4, ss5, ss6, ss7 -
|
|
1317
|
+
* sz1, sz2, sz3
|
|
1318
|
+
* sz11, sz12, sz13, sz21, sz22, sz23, sz31, sz32, sz33 -
|
|
1319
|
+
* tc -
|
|
1320
|
+
* temp -
|
|
1321
|
+
* temp1, temp2, temp3 -
|
|
1322
|
+
* tsi -
|
|
1323
|
+
* xPIdot -
|
|
1324
|
+
* xhdot1 -
|
|
1325
|
+
* z1, z2, z3 -
|
|
1326
|
+
* z11, z12, z13, z21, z22, z23, z31, z32, z33 -
|
|
1327
|
+
*
|
|
1328
|
+
* coupling :
|
|
1329
|
+
* getgravconst-
|
|
1330
|
+
* initl -
|
|
1331
|
+
* dscom -
|
|
1332
|
+
* dpper -
|
|
1333
|
+
* dsinit -
|
|
1334
|
+
* sgp4 -
|
|
1335
|
+
*
|
|
1336
|
+
* references :
|
|
1337
|
+
* hoots, roehrich, norad spacetrack report #3 1980
|
|
1338
|
+
* hoots, norad spacetrack report #6 1986
|
|
1339
|
+
* hoots, schumacher and glover 2004
|
|
1340
|
+
* vallado, crawford, hujsak, kelso 2006
|
|
1341
|
+
*----------------------------------------------------------------------------
|
|
1342
|
+
*/
|
|
1291
1343
|
Sgp4.sgp4init = function (satrec, options) {
|
|
1292
1344
|
/* eslint-disable no-param-reassign */
|
|
1293
1345
|
var _a = options.whichconst, whichconst = _a === void 0 ? 'wgs72' : _a, _b = options.opsmode, opsmode = _b === void 0 ? 'i' : _b, _c = options.satn, satn = _c === void 0 ? satrec.satnum : _c, epoch = options.epoch, xbstar = options.xbstar, xecco = options.xecco, xargpo = options.xargpo, xinclo = options.xinclo, xndot = options.xndot, xnddot = options.xnddot, xmo = options.xmo, xno = options.xno, xnodeo = options.xnodeo;
|
|
1294
1346
|
/* ------------------------ initialization --------------------- */
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1347
|
+
/*
|
|
1348
|
+
* Sgp4fix divisor for divide by zero check on inclination
|
|
1349
|
+
* the old check used 1.0 + Math.cos(PI-1.0e-9), but then compared it to
|
|
1350
|
+
* 1.5 e-12, so the threshold was changed to 1.5e-12 for consistency
|
|
1351
|
+
*/
|
|
1298
1352
|
// ----------- set all near earth variables to zero ------------
|
|
1299
1353
|
satrec.isimp = 0;
|
|
1300
1354
|
satrec.method = 'n';
|
|
@@ -1381,8 +1435,10 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1381
1435
|
satrec.xli = 0.0;
|
|
1382
1436
|
satrec.xni = 0.0;
|
|
1383
1437
|
/* ------------------------ earth constants ----------------------- */
|
|
1384
|
-
|
|
1385
|
-
|
|
1438
|
+
/*
|
|
1439
|
+
* Sgp4fix identify constants and allow alternate values
|
|
1440
|
+
* this is now the only call for the constants
|
|
1441
|
+
*/
|
|
1386
1442
|
var gravResults = Sgp4.getgravconst(whichconst);
|
|
1387
1443
|
satrec.tumin = gravResults.tumin;
|
|
1388
1444
|
satrec.mus = gravResults.mus;
|
|
@@ -1396,11 +1452,12 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1396
1452
|
var j4 = gravResults.j4;
|
|
1397
1453
|
var xke = gravResults.xke;
|
|
1398
1454
|
var j3oj2 = gravResults.j3oj2;
|
|
1399
|
-
|
|
1455
|
+
// -------------------------------------------------------------------------
|
|
1400
1456
|
satrec.error = 0;
|
|
1401
1457
|
satrec.operationmode = opsmode;
|
|
1402
|
-
//
|
|
1403
|
-
/**
|
|
1458
|
+
// New alpha5 or 9-digit number
|
|
1459
|
+
/**
|
|
1460
|
+
* Ootk -- Using JS code for string manipulation but same effect
|
|
1404
1461
|
* Ex. A2525 = 102525
|
|
1405
1462
|
* Ex. Z1234 = 351234
|
|
1406
1463
|
*/
|
|
@@ -1411,33 +1468,39 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1411
1468
|
else {
|
|
1412
1469
|
satrec.satnum = satn;
|
|
1413
1470
|
}
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1471
|
+
/*
|
|
1472
|
+
* Sgp4fix - note the following variables are also passed directly via satrec.
|
|
1473
|
+
* it is possible to streamline the sgp4init call by deleting the "x"
|
|
1474
|
+
* variables, but the user would need to set the satrec.* values first. we
|
|
1475
|
+
* include the additional assignments in case twoline2rv is not used.
|
|
1476
|
+
*/
|
|
1418
1477
|
satrec.bstar = xbstar;
|
|
1419
|
-
//
|
|
1478
|
+
// Sgp4fix allow additional parameters in the struct
|
|
1420
1479
|
satrec.ndot = xndot;
|
|
1421
1480
|
satrec.nddot = xnddot;
|
|
1422
1481
|
satrec.ecco = xecco;
|
|
1423
1482
|
satrec.argpo = xargpo;
|
|
1424
1483
|
satrec.inclo = xinclo;
|
|
1425
1484
|
satrec.mo = xmo;
|
|
1426
|
-
//
|
|
1485
|
+
// Sgp4fix rename variables to clarify which mean motion is intended
|
|
1427
1486
|
satrec.no = xno;
|
|
1428
1487
|
satrec.nodeo = xnodeo;
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1488
|
+
/*
|
|
1489
|
+
* Single averaged mean elements
|
|
1490
|
+
* satrec.am = satrec.em = satrec.im = satrec.Om = satrec.mm = satrec.nm = 0.0;
|
|
1491
|
+
*/
|
|
1492
|
+
/*
|
|
1493
|
+
* ------------------------ earth constants -----------------------
|
|
1494
|
+
* sgp4fix identify constants and allow alternate values
|
|
1495
|
+
* getgravconst( whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2 );
|
|
1496
|
+
*/
|
|
1434
1497
|
var ss = 78.0 / satrec.radiusearthkm + 1.0;
|
|
1435
|
-
//
|
|
1498
|
+
// Sgp4fix use multiply for speed instead of pow
|
|
1436
1499
|
var qzms2ttemp = (120.0 - 78.0) / satrec.radiusearthkm;
|
|
1437
1500
|
var qzms2t = qzms2ttemp * qzms2ttemp * qzms2ttemp * qzms2ttemp;
|
|
1438
1501
|
satrec.init = 'y';
|
|
1439
1502
|
satrec.t = 0.0;
|
|
1440
|
-
//
|
|
1503
|
+
// Sgp4fix remove satn as it is not needed in initl
|
|
1441
1504
|
var initlOptions = {
|
|
1442
1505
|
ecco: satrec.ecco,
|
|
1443
1506
|
epoch: epoch,
|
|
@@ -1453,18 +1516,20 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1453
1516
|
satrec.no = initlResult.no;
|
|
1454
1517
|
satrec.con41 = initlResult.con41;
|
|
1455
1518
|
satrec.gsto = initlResult.gsto;
|
|
1456
|
-
satrec.a = Math.pow(satrec.no * satrec.tumin, -2.0 / 3.0);
|
|
1519
|
+
satrec.a = Math.pow((satrec.no * satrec.tumin), (-2.0 / 3.0));
|
|
1457
1520
|
satrec.alta = satrec.a * (1.0 + satrec.ecco) - 1.0;
|
|
1458
1521
|
satrec.altp = satrec.a * (1.0 - satrec.ecco) - 1.0;
|
|
1459
1522
|
satrec.error = 0;
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1523
|
+
/*
|
|
1524
|
+
* Sgp4fix remove this check as it is unnecessary
|
|
1525
|
+
* the mrt check in sgp4 handles decaying satellite cases even if the starting
|
|
1526
|
+
* condition is below the surface of te earth
|
|
1527
|
+
* if (rp < 1.0)
|
|
1528
|
+
* {
|
|
1529
|
+
* printf("// *** satn%d epoch elts sub-orbital ***\n", satn);
|
|
1530
|
+
* satrec.error = 5;
|
|
1531
|
+
* }
|
|
1532
|
+
*/
|
|
1468
1533
|
if (omeosq >= 0.0 || satrec.no >= 0.0) {
|
|
1469
1534
|
satrec.isimp = 0;
|
|
1470
1535
|
if (rp < 220.0 / satrec.radiusearthkm + 1.0) {
|
|
@@ -1479,7 +1544,7 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1479
1544
|
if (perige < 98.0) {
|
|
1480
1545
|
sfour = 20.0;
|
|
1481
1546
|
}
|
|
1482
|
-
//
|
|
1547
|
+
// Sgp4fix use multiply for speed instead of pow
|
|
1483
1548
|
var qzms24temp = (120.0 - sfour) / satrec.radiusearthkm;
|
|
1484
1549
|
qzms24 = qzms24temp * qzms24temp * qzms24temp * qzms24temp;
|
|
1485
1550
|
sfour = sfour / satrec.radiusearthkm + 1.0;
|
|
@@ -1536,7 +1601,7 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1536
1601
|
}
|
|
1537
1602
|
satrec.nodecf = 3.5 * omeosq * xhdot1 * satrec.cc1;
|
|
1538
1603
|
satrec.t2cof = 1.5 * satrec.cc1;
|
|
1539
|
-
//
|
|
1604
|
+
// Sgp4fix for divide by zero with xinco = 180 deg
|
|
1540
1605
|
if (Math.abs(cosio + 1.0) > 1.5e-12) {
|
|
1541
1606
|
satrec.xlcof = (-0.25 * j3oj2 * sinio * (3.0 + 5.0 * cosio)) / (1.0 + cosio);
|
|
1542
1607
|
}
|
|
@@ -1544,7 +1609,7 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1544
1609
|
satrec.xlcof = (-0.25 * j3oj2 * sinio * (3.0 + 5.0 * cosio)) / temp4;
|
|
1545
1610
|
}
|
|
1546
1611
|
satrec.aycof = -0.5 * j3oj2 * sinio;
|
|
1547
|
-
//
|
|
1612
|
+
// Sgp4fix use multiply for speed instead of pow
|
|
1548
1613
|
var delmotemp = 1.0 + satrec.eta * Math.cos(satrec.mo);
|
|
1549
1614
|
satrec.delmo = delmotemp * delmotemp * delmotemp;
|
|
1550
1615
|
satrec.sinmao = Math.sin(satrec.mo);
|
|
@@ -1763,109 +1828,119 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1763
1828
|
12.0 * satrec.cc1 * satrec.d3 +
|
|
1764
1829
|
6.0 * satrec.d2 * satrec.d2 +
|
|
1765
1830
|
15.0 * cc1sq * (2.0 * satrec.d2 + cc1sq));
|
|
1766
|
-
} //
|
|
1767
|
-
/*
|
|
1768
|
-
|
|
1769
|
-
|
|
1831
|
+
} // If omeosq = 0 ...
|
|
1832
|
+
/* Finally propogate to zero epoch to initialize all others. */
|
|
1833
|
+
/*
|
|
1834
|
+
* Sgp4fix take out check to let satellites process until they are actually below earth surface
|
|
1835
|
+
* if(satrec.error == 0)
|
|
1836
|
+
*/
|
|
1770
1837
|
}
|
|
1771
1838
|
Sgp4.propagate(satrec, 0);
|
|
1772
1839
|
satrec.init = 'n';
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1840
|
+
/*
|
|
1841
|
+
* Sgp4fix return boolean. satrec.error contains any error codes
|
|
1842
|
+
* return satrec; -- no reason to return anything in JS
|
|
1843
|
+
*/
|
|
1844
|
+
}; // Sgp4init
|
|
1845
|
+
/*
|
|
1846
|
+
*----------------------------------------------------------------------------
|
|
1847
|
+
*
|
|
1848
|
+
* procedure sgp4
|
|
1849
|
+
*
|
|
1850
|
+
* this procedure is the sgp4 prediction model from space command. this is an
|
|
1851
|
+
* updated and combined version of sgp4 and sdp4, which were originally
|
|
1852
|
+
* published separately in spacetrack report //3. this version follows the
|
|
1853
|
+
* methodology from the aiaa paper (2006) describing the history and
|
|
1854
|
+
* development of the code.
|
|
1855
|
+
*
|
|
1856
|
+
* author : david vallado 719-573-2600 28 jun 2005
|
|
1857
|
+
*
|
|
1858
|
+
* inputs :
|
|
1859
|
+
* satrec - initialised structure from sgp4init() call.
|
|
1860
|
+
* tsince - time since epoch (minutes)
|
|
1861
|
+
*
|
|
1862
|
+
* outputs :
|
|
1863
|
+
* r - position vector km
|
|
1864
|
+
* v - velocity km/sec
|
|
1865
|
+
* return code - non-zero on error.
|
|
1866
|
+
* 1 - mean elements, ecc >= 1.0 or ecc < -0.001 or a < 0.95 er
|
|
1867
|
+
* 2 - mean motion less than 0.0
|
|
1868
|
+
* 3 - pert elements, ecc < 0.0 or ecc > 1.0
|
|
1869
|
+
* 4 - semi-latus rectum < 0.0
|
|
1870
|
+
* 5 - epoch elements are sub-orbital
|
|
1871
|
+
* 6 - satellite has decayed
|
|
1872
|
+
*
|
|
1873
|
+
* locals :
|
|
1874
|
+
* am -
|
|
1875
|
+
* axnl, aynl -
|
|
1876
|
+
* betal -
|
|
1877
|
+
* cosim , sinim , cosomm , sinomm , cnod , snod , cos2u ,
|
|
1878
|
+
* sin2u , coseo1 , sineo1 , cosi , sini , cosip , sinip ,
|
|
1879
|
+
* cosisq , cossu , sinsu , cosu , sinu
|
|
1880
|
+
* delm -
|
|
1881
|
+
* delomg -
|
|
1882
|
+
* dndt -
|
|
1883
|
+
* eccm -
|
|
1884
|
+
* emsq -
|
|
1885
|
+
* ecose -
|
|
1886
|
+
* el2 -
|
|
1887
|
+
* eo1 -
|
|
1888
|
+
* eccp -
|
|
1889
|
+
* esine -
|
|
1890
|
+
* argpm -
|
|
1891
|
+
* argpp -
|
|
1892
|
+
* omgadf -
|
|
1893
|
+
* pl -
|
|
1894
|
+
* r -
|
|
1895
|
+
* rtemsq -
|
|
1896
|
+
* rdotl -
|
|
1897
|
+
* rl -
|
|
1898
|
+
* rvdot -
|
|
1899
|
+
* rvdotl -
|
|
1900
|
+
* su -
|
|
1901
|
+
* t2 , t3 , t4 , tc
|
|
1902
|
+
* tem5, temp , temp1 , temp2 , tempa , tempe , templ
|
|
1903
|
+
* u , ux , uy , uz , vx , vy , vz
|
|
1904
|
+
* inclm - inclination
|
|
1905
|
+
* mm - mean anomaly
|
|
1906
|
+
* nm - mean motion
|
|
1907
|
+
* nodem - right asc of ascending node
|
|
1908
|
+
* xinc -
|
|
1909
|
+
* xincp -
|
|
1910
|
+
* xl -
|
|
1911
|
+
* xlm -
|
|
1912
|
+
* mp -
|
|
1913
|
+
* xmdf -
|
|
1914
|
+
* xmx -
|
|
1915
|
+
* xmy -
|
|
1916
|
+
* nodedf -
|
|
1917
|
+
* xnode -
|
|
1918
|
+
* nodep -
|
|
1919
|
+
* np -
|
|
1920
|
+
*
|
|
1921
|
+
* coupling :
|
|
1922
|
+
* getgravconst-
|
|
1923
|
+
* dpper
|
|
1924
|
+
* dspace
|
|
1925
|
+
*
|
|
1926
|
+
* references :
|
|
1927
|
+
* hoots, roehrich, norad spacetrack report //3 1980
|
|
1928
|
+
* hoots, norad spacetrack report //6 1986
|
|
1929
|
+
* hoots, schumacher and glover 2004
|
|
1930
|
+
* vallado, crawford, hujsak, kelso 2006
|
|
1931
|
+
*----------------------------------------------------------------------------
|
|
1932
|
+
*/
|
|
1862
1933
|
Sgp4.propagate = function (satrec, tsince) {
|
|
1863
1934
|
/* ------------------ set mathematical constants --------------- */
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1935
|
+
/*
|
|
1936
|
+
* Sgp4fix divisor for divide by zero check on inclination
|
|
1937
|
+
* the old check used 1.0 + cos(PI-1.0e-9), but then compared it to
|
|
1938
|
+
* 1.5 e-12, so the threshold was changed to 1.5e-12 for consistency
|
|
1939
|
+
*/
|
|
1940
|
+
/*
|
|
1941
|
+
* Sgp4fix identify constants and allow alternate values
|
|
1942
|
+
* getgravconst( whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2 );
|
|
1943
|
+
*/
|
|
1869
1944
|
var xke = satrec.xke, j2 = satrec.j2, j3oj2 = satrec.j3oj2;
|
|
1870
1945
|
var vkmpersec = (satrec.radiusearthkm * satrec.xke) / 60.0;
|
|
1871
1946
|
// --------------------- clear sgp4 error flag -----------------
|
|
@@ -1884,7 +1959,7 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1884
1959
|
var templ = satrec.t2cof * t2;
|
|
1885
1960
|
if (satrec.isimp !== 1) {
|
|
1886
1961
|
var delomg = satrec.omgcof * satrec.t;
|
|
1887
|
-
//
|
|
1962
|
+
// Sgp4fix use mutliply for speed instead of pow
|
|
1888
1963
|
var delmtemp = 1.0 + satrec.eta * Math.cos(xmdf);
|
|
1889
1964
|
var delm = satrec.xmcof * (delmtemp * delmtemp * delmtemp - satrec.delmo);
|
|
1890
1965
|
var temp_1 = delomg + delm;
|
|
@@ -1903,27 +1978,31 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1903
1978
|
var tc = satrec.t;
|
|
1904
1979
|
var dspaceResult = Sgp4.dspace(satrec.irez, satrec.d2201, satrec.d2211, satrec.d3210, satrec.d3222, satrec.d4410, satrec.d4422, satrec.d5220, satrec.d5232, satrec.d5421, satrec.d5433, satrec.dedt, satrec.del1, satrec.del2, satrec.del3, satrec.didt, satrec.dmdt, satrec.dnodt, satrec.domdt, satrec.argpo, satrec.argpdot, satrec.t, tc, satrec.gsto, satrec.xfact, satrec.xlamo, satrec.no, satrec.atime, em, argpm, inclm, satrec.xli, mm, satrec.xni, nodem, nm);
|
|
1905
1980
|
em = dspaceResult[0], argpm = dspaceResult[1], inclm = dspaceResult[2], mm = dspaceResult[3], nodem = dspaceResult[4], nm = dspaceResult[5];
|
|
1906
|
-
} //
|
|
1981
|
+
} // If methjod = d
|
|
1907
1982
|
if (nm <= 0.0) {
|
|
1908
|
-
//
|
|
1983
|
+
// Printf("// error nm %f\n", nm);
|
|
1909
1984
|
satrec.error = 2;
|
|
1910
|
-
//
|
|
1985
|
+
// Sgp4fix add return
|
|
1911
1986
|
return { position: false, velocity: false };
|
|
1912
1987
|
}
|
|
1913
1988
|
var am = Math.pow((xke / nm), x2o3) * tempa * tempa;
|
|
1914
1989
|
nm = xke / Math.pow(am, 1.5);
|
|
1915
1990
|
em -= tempe;
|
|
1916
|
-
|
|
1917
|
-
|
|
1991
|
+
/*
|
|
1992
|
+
* Fix tolerance for error recognition
|
|
1993
|
+
* sgp4fix am is fixed from the previous nm check
|
|
1994
|
+
*/
|
|
1918
1995
|
/* istanbul ignore next | This is no longer possible*/
|
|
1919
1996
|
if (em >= 1.0 || em < -0.001) {
|
|
1920
|
-
|
|
1921
|
-
|
|
1997
|
+
/*
|
|
1998
|
+
* || (am < 0.95)
|
|
1999
|
+
* printf("// error em %f\n", em);
|
|
2000
|
+
*/
|
|
1922
2001
|
satrec.error = 1;
|
|
1923
|
-
//
|
|
2002
|
+
// Sgp4fix to return if there is an error in eccentricity
|
|
1924
2003
|
return { position: false, velocity: false };
|
|
1925
2004
|
}
|
|
1926
|
-
//
|
|
2005
|
+
// Sgp4fix fix tolerance to avoid a divide by zero
|
|
1927
2006
|
if (em < 1.0e-6) {
|
|
1928
2007
|
em = 1.0e-6;
|
|
1929
2008
|
}
|
|
@@ -1933,15 +2012,17 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1933
2012
|
argpm %= TAU;
|
|
1934
2013
|
xlm %= TAU;
|
|
1935
2014
|
mm = (xlm - argpm - nodem) % TAU;
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
2015
|
+
/*
|
|
2016
|
+
* Sgp4fix recover singly averaged mean elements
|
|
2017
|
+
* TODO: Skip these?
|
|
2018
|
+
* satrec.am = am;
|
|
2019
|
+
* satrec.em = em;
|
|
2020
|
+
* satrec.im = inclm;
|
|
2021
|
+
* satrec.Om = nodem;
|
|
2022
|
+
* satrec.om = argpm;
|
|
2023
|
+
* satrec.mm = mm;
|
|
2024
|
+
* satrec.nm = nm;
|
|
2025
|
+
*/
|
|
1945
2026
|
// ----------------- compute extra mean quantities -------------
|
|
1946
2027
|
var sinim = Math.sin(inclm);
|
|
1947
2028
|
var cosim = Math.cos(inclm);
|
|
@@ -1973,9 +2054,9 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1973
2054
|
argpp -= PI;
|
|
1974
2055
|
}
|
|
1975
2056
|
if (ep < 0.0 || ep > 1.0) {
|
|
1976
|
-
//
|
|
2057
|
+
// Printf("// error ep %f\n", ep);
|
|
1977
2058
|
satrec.error = 3;
|
|
1978
|
-
//
|
|
2059
|
+
// Sgp4fix add return
|
|
1979
2060
|
return { position: false, velocity: false };
|
|
1980
2061
|
}
|
|
1981
2062
|
}
|
|
@@ -1984,7 +2065,7 @@ var Sgp4 = /** @class */ (function () {
|
|
|
1984
2065
|
sinip = Math.sin(xincp);
|
|
1985
2066
|
cosip = Math.cos(xincp);
|
|
1986
2067
|
satrec.aycof = -0.5 * j3oj2 * sinip;
|
|
1987
|
-
//
|
|
2068
|
+
// Sgp4fix for divide by zero for xincp = 180 deg
|
|
1988
2069
|
/* istanbul ignore next | This is no longer possible*/
|
|
1989
2070
|
if (Math.abs(cosip + 1.0) > 1.5e-12) {
|
|
1990
2071
|
satrec.xlcof = (-0.25 * j3oj2 * sinip * (3.0 + 5.0 * cosip)) / (1.0 + cosip);
|
|
@@ -2002,9 +2083,11 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2002
2083
|
var eo1 = u;
|
|
2003
2084
|
var tem5 = 9999.9;
|
|
2004
2085
|
var ktr = 1;
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2086
|
+
/*
|
|
2087
|
+
* Sgp4fix for kepler iteration
|
|
2088
|
+
* the following iteration needs better limits on corrections
|
|
2089
|
+
*/
|
|
2090
|
+
var coseo1, sineo1;
|
|
2008
2091
|
while (Math.abs(tem5) >= 1.0e-12 && ktr <= 10) {
|
|
2009
2092
|
sineo1 = Math.sin(eo1);
|
|
2010
2093
|
coseo1 = Math.cos(eo1);
|
|
@@ -2027,9 +2110,9 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2027
2110
|
var el2 = axnl * axnl + aynl * aynl;
|
|
2028
2111
|
var pl = am * (1.0 - el2);
|
|
2029
2112
|
if (pl < 0.0) {
|
|
2030
|
-
//
|
|
2113
|
+
// Printf("// error pl %f\n", pl);
|
|
2031
2114
|
satrec.error = 4;
|
|
2032
|
-
//
|
|
2115
|
+
// Sgp4fix add return
|
|
2033
2116
|
return { position: false, velocity: false };
|
|
2034
2117
|
}
|
|
2035
2118
|
var rl = am * (1.0 - ecose);
|
|
@@ -2054,9 +2137,9 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2054
2137
|
}
|
|
2055
2138
|
var mrt = rl * (1.0 - 1.5 * temp2 * betal * satrec.con41) + 0.5 * temp1 * satrec.x1mth2 * cos2u;
|
|
2056
2139
|
/** Moved this up to reduce unnecessary computation if you are going to return false anyway */
|
|
2057
|
-
//
|
|
2140
|
+
// Sgp4fix for decaying satellites
|
|
2058
2141
|
if (mrt < 1.0) {
|
|
2059
|
-
//
|
|
2142
|
+
// Printf("// decay condition %11.6f \n",mrt);
|
|
2060
2143
|
satrec.error = 6;
|
|
2061
2144
|
return {
|
|
2062
2145
|
position: false,
|
|
@@ -2099,43 +2182,45 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2099
2182
|
velocity: v,
|
|
2100
2183
|
};
|
|
2101
2184
|
};
|
|
2102
|
-
/*
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2185
|
+
/*
|
|
2186
|
+
* -----------------------------------------------------------------------------
|
|
2187
|
+
*
|
|
2188
|
+
* function getgravconst
|
|
2189
|
+
*
|
|
2190
|
+
* this function gets constants for the propagator. note that mu is identified to
|
|
2191
|
+
* facilitiate comparisons with newer models. the common useage is wgs72.
|
|
2192
|
+
*
|
|
2193
|
+
* author : david vallado 719-573-2600 21 jul 2006
|
|
2194
|
+
*
|
|
2195
|
+
* inputs :
|
|
2196
|
+
* whichconst - which set of constants to use wgs72old, wgs72, wgs84
|
|
2197
|
+
*
|
|
2198
|
+
* outputs :
|
|
2199
|
+
* tumin - minutes in one time unit
|
|
2200
|
+
* mu - earth gravitational parameter
|
|
2201
|
+
* radiusearthkm - radius of the earth in km
|
|
2202
|
+
* xke - reciprocal of tumin
|
|
2203
|
+
* j2, j3, j4 - un-normalized zonal harmonic values
|
|
2204
|
+
* j3oj2 - j3 divided by j2
|
|
2205
|
+
*
|
|
2206
|
+
* locals :
|
|
2207
|
+
*
|
|
2208
|
+
* coupling :
|
|
2209
|
+
* none
|
|
2210
|
+
*
|
|
2211
|
+
* references :
|
|
2212
|
+
* norad spacetrack report #3
|
|
2213
|
+
* vallado, crawford, hujsak, kelso 2006
|
|
2214
|
+
* ---------------------------------------------------------------------------
|
|
2215
|
+
*/
|
|
2131
2216
|
Sgp4.getgravconst = function (whichconst) {
|
|
2132
|
-
var
|
|
2217
|
+
var j2, j3, j3oj2, j4, mus, radiusearthkm, tumin, xke;
|
|
2133
2218
|
switch (whichconst) {
|
|
2134
2219
|
// -- wgs-72 low precision str#3 constants --
|
|
2135
2220
|
case 'wgs72old':
|
|
2136
|
-
mus = 398600.79964; //
|
|
2137
|
-
radiusearthkm = 6378.135; //
|
|
2138
|
-
xke = 0.0743669161; //
|
|
2221
|
+
mus = 398600.79964; // In km3 / s2
|
|
2222
|
+
radiusearthkm = 6378.135; // Km
|
|
2223
|
+
xke = 0.0743669161; // Reciprocal of tumin
|
|
2139
2224
|
tumin = 1.0 / xke;
|
|
2140
2225
|
j2 = 0.001082616;
|
|
2141
2226
|
j3 = -0.00000253881;
|
|
@@ -2144,8 +2229,8 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2144
2229
|
break;
|
|
2145
2230
|
// ------------ wgs-72 constants ------------
|
|
2146
2231
|
case 'wgs72':
|
|
2147
|
-
mus = 398600.8; //
|
|
2148
|
-
radiusearthkm = 6378.135; //
|
|
2232
|
+
mus = 398600.8; // In km3 / s2
|
|
2233
|
+
radiusearthkm = 6378.135; // Km
|
|
2149
2234
|
xke = 60.0 / Math.sqrt((radiusearthkm * radiusearthkm * radiusearthkm) / mus);
|
|
2150
2235
|
tumin = 1.0 / xke;
|
|
2151
2236
|
j2 = 0.001082616;
|
|
@@ -2155,8 +2240,8 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2155
2240
|
break;
|
|
2156
2241
|
case 'wgs84':
|
|
2157
2242
|
// ------------ wgs-84 constants ------------
|
|
2158
|
-
mus = 398600.5; //
|
|
2159
|
-
radiusearthkm = 6378.137; //
|
|
2243
|
+
mus = 398600.5; // In km3 / s2
|
|
2244
|
+
radiusearthkm = 6378.137; // Km
|
|
2160
2245
|
xke = 60.0 / Math.sqrt((radiusearthkm * radiusearthkm * radiusearthkm) / mus);
|
|
2161
2246
|
tumin = 1.0 / xke;
|
|
2162
2247
|
j2 = 0.00108262998905;
|
|
@@ -2177,46 +2262,48 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2177
2262
|
j4: j4,
|
|
2178
2263
|
j3oj2: j3oj2,
|
|
2179
2264
|
};
|
|
2180
|
-
}; //
|
|
2181
|
-
/*
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2265
|
+
}; // Getgravconst
|
|
2266
|
+
/*
|
|
2267
|
+
* -----------------------------------------------------------------------------
|
|
2268
|
+
*
|
|
2269
|
+
* function twoline2rv
|
|
2270
|
+
*
|
|
2271
|
+
* this function converts the two line element set character string data to
|
|
2272
|
+
* variables and initializes the sgp4 variables. several intermediate varaibles
|
|
2273
|
+
* and quantities are determined. note that the result is a structure so multiple
|
|
2274
|
+
* satellites can be processed simultaneously without having to reinitialize. the
|
|
2275
|
+
* verification mode is an important option that permits quick checks of any
|
|
2276
|
+
* changes to the underlying technical theory. this option works using a
|
|
2277
|
+
* modified tle file in which the start, stop, and delta time values are
|
|
2278
|
+
* included at the end of the second line of data. this only works with the
|
|
2279
|
+
* verification mode. the catalog mode simply propagates from -1440 to 1440 min
|
|
2280
|
+
* from epoch and is useful when performing entire catalog runs.
|
|
2281
|
+
*
|
|
2282
|
+
* author : david vallado 719-573-2600 1 mar 2001
|
|
2283
|
+
*
|
|
2284
|
+
* inputs :
|
|
2285
|
+
* longstr1 - first line of the tle
|
|
2286
|
+
* longstr2 - second line of the tle
|
|
2287
|
+
* typerun - type of run verification 'v', catalog 'c',
|
|
2288
|
+
* manual 'm'
|
|
2289
|
+
* typeinput - type of manual input mfe 'm', epoch 'e', dayofyr 'd'
|
|
2290
|
+
* opsmode - mode of operation afspc or improved 'a', 'i'
|
|
2291
|
+
* whichconst - which set of constants to use 72, 84
|
|
2292
|
+
*
|
|
2293
|
+
* outputs :
|
|
2294
|
+
* satrec - structure containing all the sgp4 satellite information
|
|
2295
|
+
*
|
|
2296
|
+
* coupling :
|
|
2297
|
+
* getgravconst-
|
|
2298
|
+
* days2mdhms - conversion of days to month, day, hour, minute, second
|
|
2299
|
+
* jday - convert day month year hour minute second into julian date
|
|
2300
|
+
* sgp4init - initialize the sgp4 variables
|
|
2301
|
+
*
|
|
2302
|
+
* references :
|
|
2303
|
+
* norad spacetrack report #3
|
|
2304
|
+
* vallado, crawford, hujsak, kelso 2006
|
|
2305
|
+
* ---------------------------------------------------------------------------
|
|
2306
|
+
*/
|
|
2220
2307
|
Sgp4.createSatrec = function (tleLine1, tleLine2, whichconst, opsmode) {
|
|
2221
2308
|
if (whichconst === void 0) { whichconst = 'wgs72'; }
|
|
2222
2309
|
if (opsmode === void 0) { opsmode = 'i'; }
|
|
@@ -2340,8 +2427,10 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2340
2427
|
d2211: null,
|
|
2341
2428
|
nm: null,
|
|
2342
2429
|
};
|
|
2343
|
-
|
|
2344
|
-
|
|
2430
|
+
/*
|
|
2431
|
+
* Sgp4fix no longer needed
|
|
2432
|
+
* getgravconst( whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2 );
|
|
2433
|
+
*/
|
|
2345
2434
|
var xpdotp = 1440.0 / (2.0 * PI); // 229.1831180523293;
|
|
2346
2435
|
satrec.error = 0;
|
|
2347
2436
|
satrec.satnum = tleLine1.substring(2, 7);
|
|
@@ -2350,7 +2439,7 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2350
2439
|
satrec.ndot = parseFloat(tleLine1.substring(33, 43));
|
|
2351
2440
|
satrec.nddot = parseFloat("".concat(tleLine1.substring(44, 45), ".").concat(tleLine1.substring(45, 50), "E").concat(tleLine1.substring(50, 52)));
|
|
2352
2441
|
satrec.bstar = parseFloat("".concat(tleLine1.substring(53, 54), ".").concat(tleLine1.substring(54, 59), "E").concat(tleLine1.substring(59, 61)));
|
|
2353
|
-
//
|
|
2442
|
+
// Satrec.satnum = tleLine2.substring(2, 7);
|
|
2354
2443
|
satrec.inclo = parseFloat(tleLine2.substring(8, 16));
|
|
2355
2444
|
satrec.nodeo = parseFloat(tleLine2.substring(17, 25));
|
|
2356
2445
|
satrec.ecco = parseFloat(".".concat(tleLine2.substring(26, 33)));
|
|
@@ -2358,38 +2447,50 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2358
2447
|
satrec.mo = parseFloat(tleLine2.substring(43, 51));
|
|
2359
2448
|
satrec.no = parseFloat(tleLine2.substring(52, 63));
|
|
2360
2449
|
// ---- find no, ndot, nddot ----
|
|
2361
|
-
satrec.no /= xpdotp; //
|
|
2450
|
+
satrec.no /= xpdotp; // Rad/min
|
|
2362
2451
|
/** Ootk -- nexp and ibexp are calculated above using template literals */
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2452
|
+
/*
|
|
2453
|
+
* Satrec.nddot = satrec.nddot * Math.pow(10.0, nexp);
|
|
2454
|
+
* satrec.bstar = satrec.bstar * Math.pow(10.0, ibexp);
|
|
2455
|
+
*/
|
|
2456
|
+
/*
|
|
2457
|
+
* ---- convert to sgp4 units ----
|
|
2458
|
+
* satrec.a = (satrec.no * tumin) ** (-2.0 / 3.0);
|
|
2459
|
+
*/
|
|
2367
2460
|
/** Ootk -- Not sure why the following two lines are added. 1st and 2nd derivatives aren't even used anymore */
|
|
2368
|
-
|
|
2369
|
-
|
|
2461
|
+
/*
|
|
2462
|
+
* Satrec.ndot /= xpdotp * 1440.0; // ? * minperday
|
|
2463
|
+
* satrec.nddot /= xpdotp * 1440.0 * 1440;
|
|
2464
|
+
*/
|
|
2370
2465
|
// ---- find standard orbital elements ----
|
|
2371
2466
|
satrec.inclo *= DEG2RAD;
|
|
2372
2467
|
satrec.nodeo *= DEG2RAD;
|
|
2373
2468
|
satrec.argpo *= DEG2RAD;
|
|
2374
2469
|
satrec.mo *= DEG2RAD;
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2470
|
+
/*
|
|
2471
|
+
* Sgp4fix not needed here
|
|
2472
|
+
* satrec.alta = satrec.a * (1.0 + satrec.ecco) - 1.0;
|
|
2473
|
+
* satrec.altp = satrec.a * (1.0 - satrec.ecco) - 1.0;
|
|
2474
|
+
*/
|
|
2475
|
+
/*
|
|
2476
|
+
* ----------------------------------------------------------------
|
|
2477
|
+
* find sgp4epoch time of element set
|
|
2478
|
+
* remember that sgp4 uses units of days from 0 jan 1950 (sgp4epoch)
|
|
2479
|
+
* and minutes from the epoch (time)
|
|
2480
|
+
* ----------------------------------------------------------------
|
|
2481
|
+
*/
|
|
2482
|
+
/*
|
|
2483
|
+
* ---------------- temp fix for years from 1957-2056 -------------------
|
|
2484
|
+
* --------- correct fix will occur when year is 4-digit in tle ---------
|
|
2485
|
+
*/
|
|
2385
2486
|
if (satrec.epochyr < 57) {
|
|
2386
2487
|
year = satrec.epochyr + 2000;
|
|
2387
2488
|
}
|
|
2388
2489
|
else {
|
|
2389
2490
|
year = satrec.epochyr + 1900;
|
|
2390
2491
|
}
|
|
2391
|
-
var _a = Sgp4.days2mdhms(year, satrec.epochdays), mon = _a.mon, day = _a.day, hr = _a.hr,
|
|
2392
|
-
var jdayRes = Sgp4.jday(year, mon, day, hr,
|
|
2492
|
+
var _a = Sgp4.days2mdhms(year, satrec.epochdays), mon = _a.mon, day = _a.day, hr = _a.hr, min = _a.min, sec = _a.sec;
|
|
2493
|
+
var jdayRes = Sgp4.jday(year, mon, day, hr, min, sec);
|
|
2393
2494
|
satrec.jdsatepoch = jdayRes.jd + jdayRes.jdFrac;
|
|
2394
2495
|
// ---------------- initialize the orbit at sgp4epoch -------------------
|
|
2395
2496
|
Sgp4.sgp4init(satrec, {
|
|
@@ -2408,8 +2509,9 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2408
2509
|
xnodeo: satrec.nodeo,
|
|
2409
2510
|
});
|
|
2410
2511
|
return satrec;
|
|
2411
|
-
}; //
|
|
2412
|
-
/*
|
|
2512
|
+
}; // Twoline2rv
|
|
2513
|
+
/*
|
|
2514
|
+
* -----------------------------------------------------------------------------
|
|
2413
2515
|
*
|
|
2414
2516
|
* function gstime
|
|
2415
2517
|
*
|
|
@@ -2433,10 +2535,11 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2433
2535
|
*
|
|
2434
2536
|
* references :
|
|
2435
2537
|
* vallado 2004, 191, eq 3-45
|
|
2436
|
-
* ---------------------------------------------------------------------------
|
|
2538
|
+
* ---------------------------------------------------------------------------
|
|
2539
|
+
*/
|
|
2437
2540
|
Sgp4.gstime = function (jdut1) {
|
|
2438
2541
|
var tut1 = (jdut1 - 2451545.0) / 36525.0;
|
|
2439
|
-
var temp = -6.2e-6 * tut1 * tut1 * tut1 + 0.093104 * tut1 * tut1 + (876600.0 * 3600 + 8640184.812866) * tut1 + 67310.54841; //
|
|
2542
|
+
var temp = -6.2e-6 * tut1 * tut1 * tut1 + 0.093104 * tut1 * tut1 + (876600.0 * 3600 + 8640184.812866) * tut1 + 67310.54841; // Sec
|
|
2440
2543
|
temp = ((temp * DEG2RAD) / 240.0) % TAU; // 360/86400 = 1/240, to deg, to rad
|
|
2441
2544
|
// ------------------------ check quadrants ---------------------
|
|
2442
2545
|
if (temp < 0.0) {
|
|
@@ -2448,11 +2551,10 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2448
2551
|
if (x < 0.0) {
|
|
2449
2552
|
return -1.0;
|
|
2450
2553
|
}
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
/* -----------------------------------------------------------------------------
|
|
2554
|
+
return 1.0;
|
|
2555
|
+
}; // Sgn
|
|
2556
|
+
/*
|
|
2557
|
+
* -----------------------------------------------------------------------------
|
|
2456
2558
|
*
|
|
2457
2559
|
* function mag
|
|
2458
2560
|
*
|
|
@@ -2471,39 +2573,43 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2471
2573
|
*
|
|
2472
2574
|
* coupling :
|
|
2473
2575
|
* none.
|
|
2474
|
-
* ---------------------------------------------------------------------------
|
|
2576
|
+
* ---------------------------------------------------------------------------
|
|
2577
|
+
*/
|
|
2475
2578
|
Sgp4.mag = function (x) {
|
|
2476
2579
|
return Math.sqrt(x[0] * x[0] + x[1] * x[1] + x[2] * x[2]);
|
|
2477
|
-
}; //
|
|
2478
|
-
/*
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2580
|
+
}; // Mag
|
|
2581
|
+
/*
|
|
2582
|
+
* -----------------------------------------------------------------------------
|
|
2583
|
+
*
|
|
2584
|
+
* procedure cross_SGP4
|
|
2585
|
+
*
|
|
2586
|
+
* this procedure crosses two vectors.
|
|
2587
|
+
*
|
|
2588
|
+
* author : david vallado 719-573-2600 1 mar 2001
|
|
2589
|
+
*
|
|
2590
|
+
* inputs description range / units
|
|
2591
|
+
* vec1 - vector number 1
|
|
2592
|
+
* vec2 - vector number 2
|
|
2593
|
+
*
|
|
2594
|
+
* outputs :
|
|
2595
|
+
* outvec - vector result of a x b
|
|
2596
|
+
*
|
|
2597
|
+
* locals :
|
|
2598
|
+
* none.
|
|
2599
|
+
*
|
|
2600
|
+
* coupling :
|
|
2601
|
+
* mag magnitude of a vector
|
|
2602
|
+
* ----------------------------------------------------------------------------
|
|
2603
|
+
*/
|
|
2499
2604
|
Sgp4.cross = function (vec1, vec2) {
|
|
2500
2605
|
var outvec = [0, 0, 0];
|
|
2501
2606
|
outvec[0] = vec1[1] * vec2[2] - vec1[2] * vec2[1];
|
|
2502
2607
|
outvec[1] = vec1[2] * vec2[0] - vec1[0] * vec2[2];
|
|
2503
2608
|
outvec[2] = vec1[0] * vec2[1] - vec1[1] * vec2[0];
|
|
2504
2609
|
return outvec;
|
|
2505
|
-
}; //
|
|
2506
|
-
/*
|
|
2610
|
+
}; // End cross
|
|
2611
|
+
/*
|
|
2612
|
+
* -----------------------------------------------------------------------------
|
|
2507
2613
|
*
|
|
2508
2614
|
* function dot_SGP4
|
|
2509
2615
|
*
|
|
@@ -2523,11 +2629,13 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2523
2629
|
*
|
|
2524
2630
|
* coupling :
|
|
2525
2631
|
* none.
|
|
2526
|
-
* ---------------------------------------------------------------------------
|
|
2632
|
+
* ---------------------------------------------------------------------------
|
|
2633
|
+
*/
|
|
2527
2634
|
Sgp4.dot = function (x, y) {
|
|
2528
2635
|
return x[0] * y[0] + x[1] * y[1] + x[2] * y[2];
|
|
2529
|
-
}; //
|
|
2530
|
-
/*
|
|
2636
|
+
}; // Dot
|
|
2637
|
+
/*
|
|
2638
|
+
* -----------------------------------------------------------------------------
|
|
2531
2639
|
*
|
|
2532
2640
|
* procedure angle_SGP4
|
|
2533
2641
|
*
|
|
@@ -2549,7 +2657,8 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2549
2657
|
*
|
|
2550
2658
|
* coupling :
|
|
2551
2659
|
* dot dot product of two vectors
|
|
2552
|
-
* ---------------------------------------------------------------------------
|
|
2660
|
+
* ---------------------------------------------------------------------------
|
|
2661
|
+
*/
|
|
2553
2662
|
Sgp4.angle = function (vec1, vec2) {
|
|
2554
2663
|
var small = 0.00000001;
|
|
2555
2664
|
var unknown = 999999.1; /** Ootk -- original 'undefined' is protected in JS */
|
|
@@ -2557,14 +2666,15 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2557
2666
|
var magv2 = Sgp4.mag(vec2);
|
|
2558
2667
|
if (magv1 * magv2 > small * small) {
|
|
2559
2668
|
var temp = Sgp4.dot(vec1, vec2) / (magv1 * magv2);
|
|
2560
|
-
if (Math.abs(temp) > 1.0)
|
|
2561
|
-
temp = Sgp4.sgn(temp)
|
|
2669
|
+
if (Math.abs(temp) > 1.0) {
|
|
2670
|
+
temp = Number(Sgp4.sgn(temp));
|
|
2671
|
+
}
|
|
2562
2672
|
return Math.acos(temp);
|
|
2563
2673
|
}
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2674
|
+
return unknown;
|
|
2675
|
+
}; // Angle
|
|
2676
|
+
/*
|
|
2677
|
+
* -----------------------------------------------------------------------------
|
|
2568
2678
|
*
|
|
2569
2679
|
* function asinh_SGP4
|
|
2570
2680
|
*
|
|
@@ -2583,11 +2693,13 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2583
2693
|
*
|
|
2584
2694
|
* coupling :
|
|
2585
2695
|
* none.
|
|
2586
|
-
* ---------------------------------------------------------------------------
|
|
2696
|
+
* ---------------------------------------------------------------------------
|
|
2697
|
+
*/
|
|
2587
2698
|
Sgp4.asinh = function (xval) {
|
|
2588
2699
|
return Math.log(xval + Math.sqrt(xval * xval + 1.0));
|
|
2589
|
-
}; //
|
|
2590
|
-
/*
|
|
2700
|
+
}; // Asinh
|
|
2701
|
+
/*
|
|
2702
|
+
* -----------------------------------------------------------------------------
|
|
2591
2703
|
*
|
|
2592
2704
|
* function newtonnu_SGP4
|
|
2593
2705
|
*
|
|
@@ -2620,52 +2732,55 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2620
2732
|
*
|
|
2621
2733
|
* references :
|
|
2622
2734
|
* vallado 2013, 77, alg 5
|
|
2623
|
-
* ---------------------------------------------------------------------------
|
|
2735
|
+
* ---------------------------------------------------------------------------
|
|
2736
|
+
*/
|
|
2624
2737
|
Sgp4.newtonnu = function (ecc, nu) {
|
|
2625
2738
|
// --------------------- implementation ---------------------
|
|
2626
2739
|
var e0 = 999999.9;
|
|
2627
2740
|
var m = 999999.9;
|
|
2628
2741
|
var small = 0.00000001;
|
|
2629
|
-
// --------------------------- circular ------------------------
|
|
2630
2742
|
if (Math.abs(ecc) < small) {
|
|
2743
|
+
// --------------------------- circular ------------------------
|
|
2631
2744
|
m = nu;
|
|
2632
2745
|
e0 = nu;
|
|
2633
2746
|
}
|
|
2634
|
-
// ---------------------- elliptical -----------------------
|
|
2635
2747
|
else if (ecc < 1.0 - small) {
|
|
2748
|
+
// ---------------------- elliptical -----------------------
|
|
2636
2749
|
var sine = (Math.sqrt(1.0 - ecc * ecc) * Math.sin(nu)) / (1.0 + ecc * Math.cos(nu));
|
|
2637
2750
|
var cose = (ecc + Math.cos(nu)) / (1.0 + ecc * Math.cos(nu));
|
|
2638
2751
|
e0 = Math.atan2(sine, cose);
|
|
2639
2752
|
m = e0 - ecc * Math.sin(e0);
|
|
2640
2753
|
}
|
|
2641
|
-
// -------------------- hyperbolic --------------------
|
|
2642
2754
|
else if (ecc > 1.0 + small) {
|
|
2755
|
+
// -------------------- hyperbolic --------------------
|
|
2643
2756
|
if (ecc > 1.0 && Math.abs(nu) + 0.00001 < PI - Math.acos(1.0 / ecc)) {
|
|
2644
2757
|
var sine = (Math.sqrt(ecc * ecc - 1.0) * Math.sin(nu)) / (1.0 + ecc * Math.cos(nu));
|
|
2645
2758
|
e0 = Sgp4.asinh(sine);
|
|
2646
2759
|
m = ecc * Sgp4.sinh(e0) - e0;
|
|
2647
2760
|
}
|
|
2648
2761
|
}
|
|
2649
|
-
// ----------------- parabolic ---------------------
|
|
2650
2762
|
else if (Math.abs(nu) < (168.0 * PI) / 180.0) {
|
|
2763
|
+
// ----------------- parabolic ---------------------
|
|
2651
2764
|
e0 = Math.tan(nu * 0.5);
|
|
2652
2765
|
m = e0 + (e0 * e0 * e0) / 3.0;
|
|
2653
2766
|
}
|
|
2654
2767
|
if (ecc < 1.0) {
|
|
2655
|
-
m
|
|
2656
|
-
if (m < 0.0)
|
|
2657
|
-
m
|
|
2658
|
-
|
|
2768
|
+
m %= 2.0 * PI;
|
|
2769
|
+
if (m < 0.0) {
|
|
2770
|
+
m += 2.0 * PI;
|
|
2771
|
+
}
|
|
2772
|
+
e0 %= 2.0 * PI;
|
|
2659
2773
|
}
|
|
2660
2774
|
return {
|
|
2661
2775
|
e0: e0,
|
|
2662
2776
|
m: m,
|
|
2663
2777
|
};
|
|
2664
|
-
}; //
|
|
2778
|
+
}; // Newtonnu
|
|
2665
2779
|
Sgp4.sinh = function (x) {
|
|
2666
2780
|
return (Math.exp(x) - Math.exp(-x)) / 2;
|
|
2667
2781
|
};
|
|
2668
|
-
/*
|
|
2782
|
+
/*
|
|
2783
|
+
* -----------------------------------------------------------------------------
|
|
2669
2784
|
*
|
|
2670
2785
|
* function rv2coe_SGP4
|
|
2671
2786
|
*
|
|
@@ -2720,7 +2835,8 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2720
2835
|
*
|
|
2721
2836
|
* references :
|
|
2722
2837
|
* vallado 2013, 113, alg 9, ex 2-5
|
|
2723
|
-
* ---------------------------------------------------------------------------
|
|
2838
|
+
* ---------------------------------------------------------------------------
|
|
2839
|
+
*/
|
|
2724
2840
|
Sgp4.rv2coe = function (r, v, mus) {
|
|
2725
2841
|
var nbar = [0, 0, 0];
|
|
2726
2842
|
var ebar = [0, 0, 0];
|
|
@@ -2740,14 +2856,18 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2740
2856
|
var hk;
|
|
2741
2857
|
var sme;
|
|
2742
2858
|
var i;
|
|
2743
|
-
|
|
2744
|
-
|
|
2859
|
+
/*
|
|
2860
|
+
* Switch this to an integer msvs seems to have probelms with this and strncpy_s
|
|
2861
|
+
* char typeorbit[2];
|
|
2862
|
+
*/
|
|
2745
2863
|
var typeorbit;
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2864
|
+
/*
|
|
2865
|
+
* Here
|
|
2866
|
+
* typeorbit = 1 = 'ei'
|
|
2867
|
+
* typeorbit = 2 = 'ce'
|
|
2868
|
+
* typeorbit = 3 = 'ci'
|
|
2869
|
+
* typeorbit = 4 = 'ee'
|
|
2870
|
+
*/
|
|
2751
2871
|
var halfpi = 0.5 * PI;
|
|
2752
2872
|
var small = 0.00000001;
|
|
2753
2873
|
var unknown = 999999.1; /** Ootk -- original undefined is illegal in JS */
|
|
@@ -2765,21 +2885,26 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2765
2885
|
magn = Sgp4.mag(nbar);
|
|
2766
2886
|
var c1 = magv * magv - mus / magr;
|
|
2767
2887
|
rdotv = Sgp4.dot(r, v);
|
|
2768
|
-
for (i = 0; i <= 2; i++)
|
|
2888
|
+
for (i = 0; i <= 2; i++) {
|
|
2769
2889
|
ebar[i] = (c1 * r[i] - rdotv * v[i]) / mus;
|
|
2890
|
+
}
|
|
2770
2891
|
ecc = Sgp4.mag(ebar);
|
|
2771
2892
|
// ------------ find a e and semi-latus rectum ----------
|
|
2772
2893
|
sme = magv * magv * 0.5 - mus / magr;
|
|
2773
|
-
if (Math.abs(sme) > small)
|
|
2894
|
+
if (Math.abs(sme) > small) {
|
|
2774
2895
|
a = -mus / (2.0 * sme);
|
|
2775
|
-
|
|
2896
|
+
}
|
|
2897
|
+
else {
|
|
2776
2898
|
a = infinite;
|
|
2899
|
+
}
|
|
2777
2900
|
p = (magh * magh) / mus;
|
|
2778
2901
|
// ----------------- find inclination -------------------
|
|
2779
2902
|
hk = hbar[2] / magh;
|
|
2780
2903
|
incl = Math.acos(hk);
|
|
2781
|
-
|
|
2782
|
-
|
|
2904
|
+
/*
|
|
2905
|
+
* -------- determine type of orbit for later use --------
|
|
2906
|
+
* ------ elliptical, parabolic, hyperbolic inclined -------
|
|
2907
|
+
*/
|
|
2783
2908
|
typeorbit = 1;
|
|
2784
2909
|
if (ecc < small) {
|
|
2785
2910
|
// ---------------- circular equatorial ---------------
|
|
@@ -2800,68 +2925,86 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2800
2925
|
// ---------- find right ascension of the ascending node ------------
|
|
2801
2926
|
if (magn > small) {
|
|
2802
2927
|
var temp = nbar[0] / magn;
|
|
2803
|
-
if (Math.abs(temp) > 1.0)
|
|
2928
|
+
if (Math.abs(temp) > 1.0) {
|
|
2804
2929
|
temp = Sgp4.sgn(temp);
|
|
2930
|
+
}
|
|
2805
2931
|
omega = Math.acos(temp);
|
|
2806
|
-
if (nbar[1] < 0.0)
|
|
2932
|
+
if (nbar[1] < 0.0) {
|
|
2807
2933
|
omega = TAU - omega;
|
|
2934
|
+
}
|
|
2808
2935
|
}
|
|
2809
|
-
else
|
|
2936
|
+
else {
|
|
2810
2937
|
omega = unknown;
|
|
2938
|
+
}
|
|
2811
2939
|
// ---------------- find argument of perigee ---------------
|
|
2812
|
-
if (typeorbit
|
|
2940
|
+
if (typeorbit === 1) {
|
|
2813
2941
|
argp = Sgp4.angle(nbar, ebar);
|
|
2814
|
-
if (ebar[2] < 0.0)
|
|
2942
|
+
if (ebar[2] < 0.0) {
|
|
2815
2943
|
argp = TAU - argp;
|
|
2944
|
+
}
|
|
2816
2945
|
}
|
|
2817
|
-
else
|
|
2946
|
+
else {
|
|
2818
2947
|
argp = unknown;
|
|
2948
|
+
}
|
|
2819
2949
|
// ------------ find true anomaly at epoch -------------
|
|
2820
|
-
if (typeorbit
|
|
2950
|
+
if (typeorbit === 1 || typeorbit === 4) {
|
|
2821
2951
|
nu = Sgp4.angle(ebar, r);
|
|
2822
|
-
if (rdotv < 0.0)
|
|
2952
|
+
if (rdotv < 0.0) {
|
|
2823
2953
|
nu = TAU - nu;
|
|
2954
|
+
}
|
|
2824
2955
|
}
|
|
2825
|
-
else
|
|
2956
|
+
else {
|
|
2826
2957
|
nu = unknown;
|
|
2958
|
+
}
|
|
2827
2959
|
// ---- find argument of latitude - circular inclined -----
|
|
2828
|
-
if (typeorbit
|
|
2960
|
+
if (typeorbit === 3) {
|
|
2829
2961
|
arglat = Sgp4.angle(nbar, r);
|
|
2830
|
-
if (r[2] < 0.0)
|
|
2962
|
+
if (r[2] < 0.0) {
|
|
2831
2963
|
arglat = TAU - arglat;
|
|
2964
|
+
}
|
|
2832
2965
|
m = arglat;
|
|
2833
2966
|
}
|
|
2834
|
-
else
|
|
2967
|
+
else {
|
|
2835
2968
|
arglat = unknown;
|
|
2836
|
-
|
|
2969
|
+
}
|
|
2970
|
+
if (ecc > small && typeorbit === 4) {
|
|
2837
2971
|
var temp = ebar[0] / ecc;
|
|
2838
|
-
if (Math.abs(temp) > 1.0)
|
|
2972
|
+
if (Math.abs(temp) > 1.0) {
|
|
2839
2973
|
temp = Sgp4.sgn(temp);
|
|
2974
|
+
}
|
|
2840
2975
|
lonper = Math.acos(temp);
|
|
2841
|
-
if (ebar[1] < 0.0)
|
|
2976
|
+
if (ebar[1] < 0.0) {
|
|
2842
2977
|
lonper = TAU - lonper;
|
|
2843
|
-
|
|
2978
|
+
}
|
|
2979
|
+
if (incl > halfpi) {
|
|
2844
2980
|
lonper = TAU - lonper;
|
|
2981
|
+
}
|
|
2845
2982
|
}
|
|
2846
|
-
else
|
|
2983
|
+
else {
|
|
2847
2984
|
lonper = unknown;
|
|
2985
|
+
}
|
|
2848
2986
|
// -------- find true longitude - circular equatorial ------
|
|
2849
|
-
if (magr > small && typeorbit
|
|
2987
|
+
if (magr > small && typeorbit === 2) {
|
|
2850
2988
|
var temp = r[0] / magr;
|
|
2851
|
-
if (Math.abs(temp) > 1.0)
|
|
2989
|
+
if (Math.abs(temp) > 1.0) {
|
|
2852
2990
|
temp = Sgp4.sgn(temp);
|
|
2991
|
+
}
|
|
2853
2992
|
truelon = Math.acos(temp);
|
|
2854
|
-
if (r[1] < 0.0)
|
|
2993
|
+
if (r[1] < 0.0) {
|
|
2855
2994
|
truelon = TAU - truelon;
|
|
2856
|
-
|
|
2995
|
+
}
|
|
2996
|
+
if (incl > halfpi) {
|
|
2857
2997
|
truelon = TAU - truelon;
|
|
2998
|
+
}
|
|
2858
2999
|
m = truelon;
|
|
2859
3000
|
}
|
|
2860
|
-
else
|
|
3001
|
+
else {
|
|
2861
3002
|
truelon = unknown;
|
|
3003
|
+
}
|
|
2862
3004
|
// ------------ find mean anomaly for all orbits -----------
|
|
2863
|
-
if (typeorbit
|
|
3005
|
+
if (typeorbit === 1 || typeorbit === 4) {
|
|
2864
3006
|
m = Sgp4.newtonnu(ecc, nu).m;
|
|
3007
|
+
}
|
|
2865
3008
|
}
|
|
2866
3009
|
else {
|
|
2867
3010
|
p = unknown;
|
|
@@ -2889,8 +3032,9 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2889
3032
|
truelon: truelon,
|
|
2890
3033
|
lonper: lonper,
|
|
2891
3034
|
};
|
|
2892
|
-
}; //
|
|
2893
|
-
/*
|
|
3035
|
+
}; // Rv2coe
|
|
3036
|
+
/*
|
|
3037
|
+
* -----------------------------------------------------------------------------
|
|
2894
3038
|
*
|
|
2895
3039
|
* procedure jday
|
|
2896
3040
|
*
|
|
@@ -2922,24 +3066,41 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2922
3066
|
* references :
|
|
2923
3067
|
* vallado 2013, 183, alg 14, ex 3-4
|
|
2924
3068
|
*
|
|
2925
|
-
* ---------------------------------------------------------------------------
|
|
2926
|
-
|
|
3069
|
+
* ---------------------------------------------------------------------------
|
|
3070
|
+
*/
|
|
3071
|
+
Sgp4.jday = function (year, mon, day, hr, min, sec, ms) {
|
|
3072
|
+
if (mon === void 0) { mon = 0; }
|
|
3073
|
+
if (day === void 0) { day = 0; }
|
|
3074
|
+
if (hr === void 0) { hr = 0; }
|
|
3075
|
+
if (min === void 0) { min = 0; }
|
|
3076
|
+
if (sec === void 0) { sec = 0; }
|
|
3077
|
+
if (ms === void 0) { ms = 0; }
|
|
3078
|
+
if (year instanceof Date) {
|
|
3079
|
+
mon = year.getUTCMonth() + 1;
|
|
3080
|
+
day = year.getUTCDate();
|
|
3081
|
+
hr = year.getUTCHours();
|
|
3082
|
+
min = year.getUTCMinutes();
|
|
3083
|
+
sec = year.getUTCSeconds();
|
|
3084
|
+
ms = year.getUTCMilliseconds();
|
|
3085
|
+
year = year.getUTCFullYear();
|
|
3086
|
+
}
|
|
2927
3087
|
var jd = 367.0 * year -
|
|
2928
3088
|
Math.floor(7 * (year + Math.floor((mon + 9) / 12.0)) * 0.25) +
|
|
2929
3089
|
Math.floor((275 * mon) / 9.0) +
|
|
2930
3090
|
day +
|
|
2931
|
-
1721013.5; //
|
|
2932
|
-
var jdFrac = (sec +
|
|
2933
|
-
//
|
|
3091
|
+
1721013.5; // Use - 678987.0 to go to mjd directly
|
|
3092
|
+
var jdFrac = (ms / 1000 + sec + min * 60.0 + hr * 3600.0) / 86400.0;
|
|
3093
|
+
// Check that the day and fractional day are correct
|
|
2934
3094
|
if (Math.abs(jdFrac) > 1.0) {
|
|
2935
3095
|
var dtt = Math.floor(jdFrac);
|
|
2936
|
-
jd
|
|
2937
|
-
jdFrac
|
|
3096
|
+
jd += dtt;
|
|
3097
|
+
jdFrac -= dtt;
|
|
2938
3098
|
}
|
|
2939
3099
|
// - 0.5*sgn(100.0*year + mon - 190002.5) + 0.5;
|
|
2940
3100
|
return { jd: jd, jdFrac: jdFrac };
|
|
2941
|
-
}; //
|
|
2942
|
-
/*
|
|
3101
|
+
}; // Jday
|
|
3102
|
+
/*
|
|
3103
|
+
* -----------------------------------------------------------------------------
|
|
2943
3104
|
*
|
|
2944
3105
|
* procedure days2mdhms
|
|
2945
3106
|
*
|
|
@@ -2974,14 +3135,17 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2974
3135
|
*
|
|
2975
3136
|
* coupling :
|
|
2976
3137
|
* none.
|
|
2977
|
-
* ---------------------------------------------------------------------------
|
|
3138
|
+
* ---------------------------------------------------------------------------
|
|
3139
|
+
*/
|
|
2978
3140
|
Sgp4.days2mdhms = function (year, days) {
|
|
2979
3141
|
var lmonth = [31, year % 4 === 0 ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
2980
3142
|
var dayofyr = Math.floor(days);
|
|
2981
3143
|
// ----------------- find month and day of month ----------------
|
|
2982
3144
|
/** Ootk -- Incorporated in the above declaration */
|
|
2983
|
-
|
|
2984
|
-
|
|
3145
|
+
/*
|
|
3146
|
+
* If ((year % 4) == 0)
|
|
3147
|
+
* lmonth[2] = 29;
|
|
3148
|
+
*/
|
|
2985
3149
|
var i = 1;
|
|
2986
3150
|
var inttemp = 0;
|
|
2987
3151
|
while (dayofyr > inttemp + lmonth[i - 1] && i < 12) {
|
|
@@ -2994,17 +3158,18 @@ var Sgp4 = /** @class */ (function () {
|
|
|
2994
3158
|
var temp = (days - dayofyr) * 24.0;
|
|
2995
3159
|
var hr = Math.floor(temp);
|
|
2996
3160
|
temp = (temp - hr) * 60.0;
|
|
2997
|
-
var
|
|
2998
|
-
var sec = (temp -
|
|
3161
|
+
var min = Math.floor(temp);
|
|
3162
|
+
var sec = (temp - min) * 60.0;
|
|
2999
3163
|
return {
|
|
3000
3164
|
mon: mon,
|
|
3001
3165
|
day: day,
|
|
3002
3166
|
hr: hr,
|
|
3003
|
-
|
|
3167
|
+
min: min,
|
|
3004
3168
|
sec: sec,
|
|
3005
3169
|
};
|
|
3006
|
-
}; //
|
|
3007
|
-
/*
|
|
3170
|
+
}; // Days2mdhms
|
|
3171
|
+
/*
|
|
3172
|
+
* -----------------------------------------------------------------------------
|
|
3008
3173
|
*
|
|
3009
3174
|
* procedure invjday
|
|
3010
3175
|
*
|
|
@@ -3043,20 +3208,21 @@ var Sgp4 = /** @class */ (function () {
|
|
|
3043
3208
|
*
|
|
3044
3209
|
* references :
|
|
3045
3210
|
* vallado 2013, 203, alg 22, ex 3-13
|
|
3046
|
-
* ---------------------------------------------------------------------------
|
|
3211
|
+
* ---------------------------------------------------------------------------
|
|
3212
|
+
*/
|
|
3047
3213
|
Sgp4.invjday = function (jd, jdfrac) {
|
|
3048
3214
|
var leapyrs;
|
|
3049
3215
|
var days;
|
|
3050
|
-
//
|
|
3216
|
+
// Check jdfrac for multiple days
|
|
3051
3217
|
if (Math.abs(jdfrac) >= 1.0) {
|
|
3052
|
-
jd
|
|
3053
|
-
jdfrac
|
|
3218
|
+
jd += Math.floor(jdfrac);
|
|
3219
|
+
jdfrac -= Math.floor(jdfrac);
|
|
3054
3220
|
}
|
|
3055
|
-
//
|
|
3221
|
+
// Check for fraction of a day included in the jd
|
|
3056
3222
|
var dt = jd - Math.floor(jd) - 0.5;
|
|
3057
3223
|
if (Math.abs(dt) > 0.00000001) {
|
|
3058
|
-
jd
|
|
3059
|
-
jdfrac
|
|
3224
|
+
jd -= dt;
|
|
3225
|
+
jdfrac += dt;
|
|
3060
3226
|
}
|
|
3061
3227
|
/* --------------- find year and days of the year --------------- */
|
|
3062
3228
|
var temp = jd - 2415019.5;
|
|
@@ -3066,21 +3232,21 @@ var Sgp4 = /** @class */ (function () {
|
|
|
3066
3232
|
days = Math.floor(temp - ((year - 1900) * 365.0 + leapyrs));
|
|
3067
3233
|
/* ------------ check for case of beginning of a year ----------- */
|
|
3068
3234
|
if (days + jdfrac < 1.0) {
|
|
3069
|
-
year
|
|
3235
|
+
year -= 1;
|
|
3070
3236
|
leapyrs = Math.floor((year - 1901) * 0.25);
|
|
3071
3237
|
days = Math.floor(temp - ((year - 1900) * 365.0 + leapyrs));
|
|
3072
3238
|
}
|
|
3073
3239
|
/* ----------------- find remaining data ------------------------- */
|
|
3074
|
-
var _a = Sgp4.days2mdhms(year, days + jdfrac), mon = _a.mon, day = _a.day, hr = _a.hr,
|
|
3240
|
+
var _a = Sgp4.days2mdhms(year, days + jdfrac), mon = _a.mon, day = _a.day, hr = _a.hr, min = _a.min, sec = _a.sec;
|
|
3075
3241
|
return {
|
|
3076
3242
|
year: year,
|
|
3077
3243
|
mon: mon,
|
|
3078
3244
|
day: day,
|
|
3079
3245
|
hr: hr,
|
|
3080
|
-
|
|
3246
|
+
min: min,
|
|
3081
3247
|
sec: sec,
|
|
3082
3248
|
};
|
|
3083
|
-
}; //
|
|
3249
|
+
}; // Invjday
|
|
3084
3250
|
return Sgp4;
|
|
3085
3251
|
}());
|
|
3086
3252
|
export { Sgp4 };
|