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