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