From 1deee911bc6008821e571543b8e1c95c5582b05a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20R=C3=A4is=C3=A4nen?= Date: Sun, 18 Feb 2024 02:28:06 +0200 Subject: [PATCH] Replaced the use of satellite.js and fixed handling of TEME frame --- GUI/ListDialog.js | 7 ++- GUI/TLEDialog.js | 5 +- app.js | 104 ++++++++++++++++++++++----------------- computation/Frames.js | 6 ++- imports/satellite.min.js | 31 ------------ imports/sgp4.js | 1 + index.html | 2 +- 7 files changed, 74 insertions(+), 82 deletions(-) delete mode 100644 imports/satellite.min.js create mode 100644 imports/sgp4.js diff --git a/GUI/ListDialog.js b/GUI/ListDialog.js index 89225da..a181305 100644 --- a/GUI/ListDialog.js +++ b/GUI/ListDialog.js @@ -29,7 +29,12 @@ ListEnter.onclick = function() const tleLine1 = lines[indElem * 3 + 1]; const tleLine2 = lines[indElem * 3 + 2]; - const satrec = satellite.twoline2satrec(tleLine1, tleLine2); + + const tle = sgp4.tleFromLines([ + lines[indElem * 3], + lines[indElem * 3 + 1], + lines[indElem * 3 + 2]]); + const satrec = sgp4.createTarget(tle); satellites.push(satrec); satLines.push([title, tleLine1, tleLine2]); diff --git a/GUI/TLEDialog.js b/GUI/TLEDialog.js index c2824c1..86b8a40 100644 --- a/GUI/TLEDialog.js +++ b/GUI/TLEDialog.js @@ -21,7 +21,10 @@ TLEEnter.onclick = function() if (line1.startsWith('1') && line2.startsWith('2')) { osvControls.targetName.setValue(targetName); - satrec = satellite.twoline2satrec(lines[1], lines[2]); + + const tle = sgp4.tleFromLines(lines); + satrec = sgp4.createTarget(tle); + osvControls.source.setValue('TLE'); updateTLEControls(targetName, line1, line2); } diff --git a/app.js b/app.js index 38d0a1f..90050be 100644 --- a/app.js +++ b/app.js @@ -9,7 +9,8 @@ var pointShaders = null; var tleLine1 = '1 25544U 98067A 21356.70730882 .00006423 00000+0 12443-3 0 9993', tleLine2 = '2 25544 51.6431 130.5342 0004540 343.5826 107.2903 15.49048054317816'; // Initialize a satellite record -var satrec = satellite.twoline2satrec(tleLine1, tleLine2); +var satrec = sgp4.tleFromLines([ + "ISS (ZARYA) ", tleLine1, tleLine2]); // Semi-major and semi-minor axes of the WGS84 ellipsoid. var a = 6378.1370; @@ -123,25 +124,34 @@ function drawScene(time) // overwritten below. ISS.osv = createOsv(today); - let osvSatListJ2000 = []; + let osvSatListTeme = []; if (enableList) { for (let indSat = 0; indSat < satellites.length; indSat++) { const sat = satellites[indSat]; - const positionAndVelocity = satellite.propagate(sat, today); + //const positionAndVelocity = satellite.propagate(sat, today); + + // Propagate list items only once every 10 seconds to avoid CPU load. + let osvTeme; + try { + osvTeme = sgp4.propagateTargetTs(sat, today, 10.0); + } catch (err) { + continue; + } + // The position_velocity result is a key-value pair of ECI coordinates. // These are the base results from which all other coordinates are derived. - const posEci = positionAndVelocity.position; - const velEci = positionAndVelocity.velocity; + const posEci = osvTeme.r; + const velEci = osvTeme.v; if (typeof posEci !== 'undefined') { //console.log(posEci); - let osvSat = {r : [posEci.x * 1000.0, posEci.y * 1000.0, posEci.z * 1000.0], - v : [velEci.x * 1000.0, velEci.y * 1000.0, velEci.z * 1000.0], - ts: today}; - osvSatListJ2000.push(osvSat); + let osvSat = {r : [osvTeme.r[0] * 1000.0, osvTeme.r[1] * 1000.0, osvTeme.r[2] * 1000.0], + v : [osvTeme.v[0] * 1000.0, osvTeme.v[1] * 1000.0, osvTeme.v[2] * 1000.0], + ts: today}; + osvSatListTeme.push(osvSat); } } } @@ -253,10 +263,10 @@ function drawScene(time) if (enableList) { - for (let indSat = 0; indSat < osvSatListJ2000.length; indSat++) + for (let indSat = 0; indSat < osvSatListTeme.length; indSat++) { - const rJ2000 = osvSatListJ2000[indSat].r; - pointsOut.push(MathUtils.vecmul(rJ2000, 0.001)); + const rTeme = osvSatListTeme[indSat].r; + pointsOut.push(MathUtils.vecmul(rTeme, 0.001)); } pointShaders.setGeometry(pointsOut); } @@ -298,7 +308,7 @@ function drawScene(time) { // Performance : It is significantly faster to perform the J2000->ECEF coordinate // transformation in the vertex shader: - const rotMatrixJ2000 = createRotMatrix(today, JD, JT, nutPar); + const rotMatrixTeme = createRotMatrix(today, JD, JT, nutPar); if (guiControls.frame === 'J2000') { @@ -306,7 +316,7 @@ function drawScene(time) } else { - pointShaders.draw(m4.multiply(matrix, m4.transpose(rotMatrixJ2000))); + pointShaders.draw(m4.multiply(matrix, m4.transpose(rotMatrixTeme))); } } @@ -322,7 +332,7 @@ function drawScene(time) } /** - * Create rotation matrix for J2000 -> ECEF transformation for the point + * Create rotation matrix for TEME -> ECEF transformation for the point * shader. * * @param {*} ts @@ -341,9 +351,9 @@ function createRotMatrix(today, JD, JT, nutPar) const osvVec1 = {r : [1, 0, 0], v : [0, 0, 0], JT : JT, JD : JD, ts : today}; const osvVec2 = {r : [0, 1, 0], v : [0, 0, 0], JT : JT, JD : JD, ts : today}; const osvVec3 = {r : [0, 0, 1], v : [0, 0, 0], JT : JT, JD : JD, ts : today}; - let osvVec1_ECEF = Frames.osvJ2000ToECEF(osvVec1, nutPar); - let osvVec2_ECEF = Frames.osvJ2000ToECEF(osvVec2, nutPar); - let osvVec3_ECEF = Frames.osvJ2000ToECEF(osvVec3, nutPar); + let osvVec1_ECEF = sgp4.coordTemePef(osvVec1); + let osvVec2_ECEF = sgp4.coordTemePef(osvVec2); + let osvVec3_ECEF = sgp4.coordTemePef(osvVec3); rotMatrixJ2000[0] = osvVec1_ECEF.r[0]; rotMatrixJ2000[1] = osvVec2_ECEF.r[0]; rotMatrixJ2000[2] = osvVec3_ECEF.r[0]; @@ -407,28 +417,30 @@ function createOsv(today) osvControls.osvVz.setValue(osvOut.v[2]); } else if (guiControls.source === "TLE") - { - const positionAndVelocity = satellite.propagate(satrec, today); - // The position_velocity result is a key-value pair of ECI coordinates. - // These are the base results from which all other coordinates are derived. - const positionEci = positionAndVelocity.position; - const velocityEci = positionAndVelocity.velocity; - - osvControls.osvX.setValue(positionEci.x); - osvControls.osvY.setValue(positionEci.y); - osvControls.osvZ.setValue(positionEci.z); - osvControls.osvVx.setValue(velocityEci.x * 1000.0); - osvControls.osvVy.setValue(velocityEci.y * 1000.0); - osvControls.osvVz.setValue(velocityEci.z * 1000.0); + { + let osvTeme; + try { + osvTeme = sgp4.propagateTargetTs(satrec, today, 0.0); + } catch (err) { + alert(err); + } + const osvJ2000 = sgp4.coordTemeJ2000(osvTeme); + + osvControls.osvX.setValue(osvJ2000.r[0]); + osvControls.osvY.setValue(osvJ2000.r[1]); + osvControls.osvZ.setValue(osvJ2000.r[2]); + osvControls.osvVx.setValue(osvJ2000.v[0] * 1000.0); + osvControls.osvVy.setValue(osvJ2000.v[1] * 1000.0); + osvControls.osvVz.setValue(osvJ2000.v[2] * 1000.0); osvOut = {r: [ - positionEci.x * 1000.0, - positionEci.y * 1000.0, - positionEci.z * 1000.0], + osvJ2000.r[0] * 1000.0, + osvJ2000.r[1] * 1000.0, + osvJ2000.r[2] * 1000.0], v: [ - velocityEci.x * 1000.0, - velocityEci.y * 1000.0, - velocityEci.z * 1000.0], + osvJ2000.v[0] * 1000.0, + osvJ2000.v[1] * 1000.0, + osvJ2000.v[2] * 1000.0], ts: today }; osvControls.osvYear.setValue(today.getFullYear()); @@ -600,11 +612,11 @@ function drawOrbit(today, matrix, kepler_updated, nutPar) let z = 0; if (guiControls.source === "TLE") { - const osvProp = satellite.propagate(satrec, deltaDate); - const posEci = osvProp.position; - const velEci = osvProp.velocity; - const osvPropJ2000 = {r : [posEci.x * 1000.0, posEci.y* 1000.0, posEci.z* 1000.0], - v : [velEci.x, velEci.y, velEci.z], + const osvTeme = sgp4.propagateTargetTs(satrec, deltaDate, 0.0); + const posEci = osvTeme.r; + const velEci = osvTeme.v; + const osvPropJ2000 = {r : [posEci[0] * 1000.0, posEci[1] * 1000.0, posEci[2] * 1000.0], + v : [velEci[0], velEci[1], velEci[2]], ts : deltaDate}; if (guiControls.frame === 'ECEF') @@ -614,7 +626,7 @@ function drawOrbit(today, matrix, kepler_updated, nutPar) } else if (guiControls.frame === 'J2000') { - [x, y, z] = [posEci.x, posEci.y, posEci.z]; + [x, y, z] = [posEci[0], posEci[1], posEci[2]]; } } else @@ -693,7 +705,7 @@ function drawSun(lonlat, JT, JD, rASun, declSun, matrix, nutPar) if (guiControls.frame === 'J2000') { - sunPos = Frames.posECEFToCEP(JT, JD, sunPos); + sunPos = Frames.posECEFToCEP(JT, JD, sunPos, nutPar); sunPos = Frames.posCEPToJ2000(JT, sunPos, nutPar); } let sunMatrix = m4.translate(matrix, sunPos[0] * 0.001, sunPos[1] * 0.001, sunPos[2] * 0.001); @@ -709,7 +721,7 @@ function drawSun(lonlat, JT, JD, rASun, declSun, matrix, nutPar) if (guiControls.frame === 'J2000') { - rSubSolarDelta = Frames.posECEFToCEP(JT, JD, rSubSolarDelta); + rSubSolarDelta = Frames.posECEFToCEP(JT, JD, rSubSolarDelta, nutPar); rSubSolarDelta = Frames.posCEPToJ2000(JT, rSubSolarDelta, nutPar); } @@ -734,7 +746,7 @@ function drawSun(lonlat, JT, JD, rASun, declSun, matrix, nutPar) if (guiControls.frame === 'J2000') { - rSubSolarDelta = Frames.posECEFToCEP(JT, JD, rSubSolarDelta); + rSubSolarDelta = Frames.posECEFToCEP(JT, JD, rSubSolarDelta, nutPar); rSubSolarDelta = Frames.posCEPToJ2000(JT, rSubSolarDelta, nutPar); } diff --git a/computation/Frames.js b/computation/Frames.js index 13ba0fa..082b1b2 100644 --- a/computation/Frames.js +++ b/computation/Frames.js @@ -238,12 +238,14 @@ Frames.posCEPToECEF = function(JT, JD, rCEP) * Julian date. * @param {*} rECEF * Position in ECEF coordinates. + * @param {*} nutPar + * Nutation parameters. * @returns Position in CEP frame. */ -Frames.posECEFToCEP = function(JT, JD, rECEF) +Frames.posECEFToCEP = function(JT, JD, rECEF, nutPar) { let osv_ECEF = {}; - let LST = TimeConversions.computeSiderealTime(0, JD, JT); + let LST = TimeConversions.computeSiderealTime(0, JD, JT, nutPar); // Apply the Earth Rotation Matrix (A.32): rCEP = MathUtils.rotZ(rECEF, LST); diff --git a/imports/satellite.min.js b/imports/satellite.min.js deleted file mode 100644 index 6e3772e..0000000 --- a/imports/satellite.min.js +++ /dev/null @@ -1,31 +0,0 @@ -/*! MIT License - * - * Copyright (C) 2013 Shashwat Kandadai, UCSC Jack Baskin School of Engineering - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -/*! - * satellite-js v4.1.3 - * (c) 2013 Shashwat Kandadai and UCSC - * https://github.com/shashwatak/satellite-js - * License: MIT - */ - -!function(o,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(o="undefined"!=typeof globalThis?globalThis:o||self).satellite=t()}(this,(function(){"use strict";var o=Math.PI,t=2*o,e=o/180,s=180/o,n=1440,a=398600.5,d=6378.137,r=60/Math.sqrt(650944.0944816993),i=d*r/60,c=1/r,h=.00108262998905,m=-253215306e-14,l=-161098761e-14,p=m/h,x=2/3;function g(o,t){for(var e=[31,o%4==0?29:28,31,30,31,30,31,31,30,31,30,31],s=Math.floor(t),n=1,a=0;s>a+e[n-1]&&n<12;)a+=e[n-1],n+=1;var d=n,r=s-a,i=24*(t-s),c=Math.floor(i);i=60*(i-c);var h=Math.floor(i);return{mon:d,day:r,hr:c,minute:h,sec:60*(i-h)}}function M(o,t,e,s,n,a){var d=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0;return 367*o-Math.floor(7*(o+Math.floor((t+9)/12))*.25)+Math.floor(275*t/9)+e+1721013.5+((d/6e4+a/60+n)/60+s)/24}function f(o,t,e,s,n,a,d){if(o instanceof Date){var r=o;return M(r.getUTCFullYear(),r.getUTCMonth()+1,r.getUTCDate(),r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds())}return M(o,t,e,s,n,a,d)}function u(e,s){var n,a,d,r,i,c,h,m,l,p,x,g,M,f,u,z,v,y,b=e.e3,q=e.ee2,w=e.peo,T=e.pgho,j=e.pho,E=e.pinco,F=e.plo,A=e.se2,C=e.se3,L=e.sgh2,S=e.sgh3,U=e.sgh4,D=e.sh2,I=e.sh3,R=e.si2,O=e.si3,_=e.sl2,k=e.sl3,P=e.sl4,Z=e.t,G=e.xgh2,H=e.xgh3,Y=e.xgh4,$=e.xh2,B=e.xh3,J=e.xi2,K=e.xi3,N=e.xl2,Q=e.xl3,V=e.xl4,W=e.zmol,X=e.zmos,oo=s.init,to=s.opsmode,eo=s.ep,so=s.inclp,no=s.nodep,ao=s.argpp,ro=s.mp;y=X+119459e-10*Z,"y"===oo&&(y=X),v=y+.0335*Math.sin(y);var io=A*(h=.5*(f=Math.sin(v))*f-.25)+C*(m=-.5*f*Math.cos(v)),co=R*h+O*m,ho=_*h+k*m+P*f,mo=L*h+S*m+U*f,lo=D*h+I*m;return y=W+.00015835218*Z,"y"===oo&&(y=W),v=y+.1098*Math.sin(y),l=io+(q*(h=.5*(f=Math.sin(v))*f-.25)+b*(m=-.5*f*Math.cos(v))),g=co+(J*h+K*m),M=ho+(N*h+Q*m+V*f),p=mo+(G*h+H*m+Y*f),x=lo+($*h+B*m),"n"===oo&&(M-=F,p-=T,x-=j,so+=g-=E,eo+=l-=w,r=Math.sin(so),d=Math.cos(so),so>=.2?(ao+=p-=d*(x/=r),no+=x,ro+=M):(n=r*(c=Math.sin(no)),a=r*(i=Math.cos(no)),n+=x*i+g*d*c,a+=-x*c+g*d*i,(no%=t)<0&&"a"===to&&(no+=t),u=ro+ao+d*no,u+=M+p-g*no*r,z=no,(no=Math.atan2(n,a))<0&&"a"===to&&(no+=t),Math.abs(z-no)>o&&(no1?z(f.apply(void 0,arguments)):z.apply(void 0,arguments)}function y(e,s){var n,a,c,m,l,g,M,f,z,v,y,b,q,w,T,j,E,F,A,C,L,S,U,D,I,R;e.t=s,e.error=0;var O=e.mo+e.mdot*e.t,_=e.argpo+e.argpdot*e.t,k=e.nodeo+e.nodedot*e.t;f=_,C=O;var P=e.t*e.t;if(S=k+e.nodecf*P,j=1-e.cc1*e.t,E=e.bstar*e.cc4*e.t,F=e.t2cof*P,1!==e.isimp){g=e.omgcof*e.t;var Z=1+e.eta*Math.cos(O);C=O+(T=g+e.xmcof*(Z*Z*Z-e.delmo)),f=_-T,b=(y=P*e.t)*e.t,j=j-e.d2*P-e.d3*y-e.d4*b,E+=e.bstar*e.cc5*(Math.sin(C)-e.sinmao),F=F+e.t3cof*y+b*(e.t4cof+e.t*e.t5cof)}L=e.no;var G=e.ecco;if(A=e.inclo,"d"===e.method){q=e.t;var H=function(o){var e,s,n,a,d,r,i,c,h=o.irez,m=o.d2201,l=o.d2211,p=o.d3210,x=o.d3222,g=o.d4410,M=o.d4422,f=o.d5220,u=o.d5232,z=o.d5421,v=o.d5433,y=o.dedt,b=o.del1,q=o.del2,w=o.del3,T=o.didt,j=o.dmdt,E=o.dnodt,F=o.domdt,A=o.argpo,C=o.argpdot,L=o.t,S=o.tc,U=o.gsto,D=o.xfact,I=o.xlamo,R=o.no,O=o.atime,_=o.em,k=o.argpm,P=o.inclm,Z=o.xli,G=o.mm,H=o.xni,Y=o.nodem,$=o.nm,B=.13130908,J=2.8843198,K=.37448087,N=5.7686396,Q=.95240898,V=1.8014998,W=1.050833,X=4.4108898,oo=259200,to=0,eo=0,so=(U+.0043752690880113*S)%t;if(_+=y*L,P+=T*L,k+=F*L,Y+=E*L,G+=j*L,0!==h){(0===O||L*O<=0||Math.abs(L)0?720:-720;for(var no=381;381===no;)2!==h?(i=b*Math.sin(Z-B)+q*Math.sin(2*(Z-J))+w*Math.sin(3*(Z-K)),d=H+D,r=b*Math.cos(Z-B)+2*q*Math.cos(2*(Z-J))+3*w*Math.cos(3*(Z-K)),r*=d):(n=(c=A+C*O)+c,s=Z+Z,i=m*Math.sin(n+Z-N)+l*Math.sin(Z-N)+p*Math.sin(c+Z-Q)+x*Math.sin(-c+Z-Q)+g*Math.sin(n+s-V)+M*Math.sin(s-V)+f*Math.sin(c+Z-W)+u*Math.sin(-c+Z-W)+z*Math.sin(c+s-X)+v*Math.sin(-c+s-X),d=H+D,r=m*Math.cos(n+Z-N)+l*Math.cos(Z-N)+p*Math.cos(c+Z-Q)+x*Math.cos(-c+Z-Q)+f*Math.cos(c+Z-W)+u*Math.cos(-c+Z-W)+2*g*Math.cos(n+s-V)+M*Math.cos(s-V)+z*Math.cos(c+s-X)+v*Math.cos(-c+s-X),r*=d),Math.abs(L-O)>=720?no=381:(eo=L-O,no=0),381===no&&(Z+=d*e+i*oo,H+=i*e+r*oo,O+=e);$=H+i*eo+r*eo*eo*.5,a=Z+d*eo+i*eo*eo*.5,1!==h?(G=a-2*Y+2*so,to=$-R):(G=a-Y-k+so,to=$-R),$=R+to}return{atime:O,em:_,argpm:k,inclm:P,xli:Z,mm:G,xni:H,nodem:Y,dndt:to,nm:$}}({irez:e.irez,d2201:e.d2201,d2211:e.d2211,d3210:e.d3210,d3222:e.d3222,d4410:e.d4410,d4422:e.d4422,d5220:e.d5220,d5232:e.d5232,d5421:e.d5421,d5433:e.d5433,dedt:e.dedt,del1:e.del1,del2:e.del2,del3:e.del3,didt:e.didt,dmdt:e.dmdt,dnodt:e.dnodt,domdt:e.domdt,argpo:e.argpo,argpdot:e.argpdot,t:e.t,tc:q,gsto:e.gsto,xfact:e.xfact,xlamo:e.xlamo,no:e.no,atime:e.atime,em:G,argpm:f,inclm:A,xli:e.xli,mm:C,xni:e.xni,nodem:S,nm:L});G=H.em,f=H.argpm,A=H.inclm,C=H.mm,S=H.nodem,L=H.nm}if(L<=0)return e.error=2,[!1,!1];var Y=Math.pow(r/L,x)*j*j;if(L=r/Math.pow(Y,1.5),(G-=E)>=1||G<-.001)return e.error=1,[!1,!1];G<1e-6&&(G=1e-6),D=(C+=e.no*F)+f+S;var $=G;if(U=A,z=f%=t,R=S%=t,I=C=((D%=t)-f-S)%t,m=Math.sin(A),c=Math.cos(A),"d"===e.method){var B=u(e,{inclo:e.inclo,init:"n",ep:$,inclp:U,nodep:R,argpp:z,mp:I,opsmode:e.operationmode});if($=B.ep,R=B.nodep,z=B.argpp,I=B.mp,(U=B.inclp)<0&&(U=-U,R+=o,z-=o),$<0||$>1)return e.error=3,[!1,!1]}"d"===e.method&&(m=Math.sin(U),c=Math.cos(U),e.aycof=-.5*p*m,Math.abs(c+1)>15e-13?e.xlcof=-.25*p*m*(3+5*c)/(1+c):e.xlcof=-.25*p*m*(3+5*c)/15e-13);var J=$*Math.cos(z);T=1/(Y*(1-$*$));var K=$*Math.sin(z)+T*e.aycof,N=(I+z+R+T*e.xlcof*J-R)%t;M=N,w=9999.9;for(var Q=1;Math.abs(w)>=1e-12&&Q<=10;)a=Math.sin(M),w=(N-K*(n=Math.cos(M))+J*a-M)/(w=1-n*J-a*K),Math.abs(w)>=.95&&(w=w>0?.95:-.95),M+=w,Q+=1;var V=J*n+K*a,W=J*a-K*n,X=J*J+K*K,oo=Y*(1-X);if(oo<0)return e.error=4,[!1,!1];var to=Y*(1-V),eo=Math.sqrt(Y)*W/to,so=Math.sqrt(oo)/to,no=Math.sqrt(1-X),ao=Y/to*(a-K-J*(T=W/(1+no))),ro=Y/to*(n-J+K*T);v=Math.atan2(ao,ro);var io=(ro+ro)*ao,co=1-2*ao*ao,ho=.5*h*(T=1/oo),mo=ho*T;"d"===e.method&&(l=c*c,e.con41=3*l-1,e.x1mth2=1-l,e.x7thm1=7*l-1);var lo=to*(1-1.5*mo*no*e.con41)+.5*ho*e.x1mth2*co;if(lo<1)return e.error=6,{position:!1,velocity:!1};v-=.25*mo*e.x7thm1*io;var po=R+1.5*mo*c*io,xo=U+1.5*mo*c*m*co,go=eo-L*ho*e.x1mth2*io/r,Mo=so+L*ho*(e.x1mth2*co+1.5*e.con41)/r,fo=Math.sin(v),uo=Math.cos(v),zo=Math.sin(po),vo=Math.cos(po),yo=Math.sin(xo),bo=Math.cos(xo),qo=-zo*bo,wo=vo*bo,To=qo*fo+vo*uo,jo=wo*fo+zo*uo,Eo=yo*fo;return{position:{x:lo*To*d,y:lo*jo*d,z:lo*Eo*d},velocity:{x:(go*To+Mo*(qo*uo-vo*fo))*i,y:(go*jo+Mo*(wo*uo-zo*fo))*i,z:(go*Eo+Mo*(yo*uo))*i}}}function b(e,s){var n,a,i,c,m,g,M,f,z,b,q,w,T,j,E,F,A,C,L,S,U,D,I,R,O,_,k,P,Z,G,H,Y,$,B,J,K,N,Q,V,W,X,oo,to,eo,so,no,ao,ro,io,co,ho,mo,lo=s.opsmode,po=s.satn,xo=s.epoch,go=s.xbstar,Mo=s.xecco,fo=s.xargpo,uo=s.xinclo,zo=s.xmo,vo=s.xno,yo=s.xnodeo;e.isimp=0,e.method="n",e.aycof=0,e.con41=0,e.cc1=0,e.cc4=0,e.cc5=0,e.d2=0,e.d3=0,e.d4=0,e.delmo=0,e.eta=0,e.argpdot=0,e.omgcof=0,e.sinmao=0,e.t=0,e.t2cof=0,e.t3cof=0,e.t4cof=0,e.t5cof=0,e.x1mth2=0,e.x7thm1=0,e.mdot=0,e.nodedot=0,e.xlcof=0,e.xmcof=0,e.nodecf=0,e.irez=0,e.d2201=0,e.d2211=0,e.d3210=0,e.d3222=0,e.d4410=0,e.d4422=0,e.d5220=0,e.d5232=0,e.d5421=0,e.d5433=0,e.dedt=0,e.del1=0,e.del2=0,e.del3=0,e.didt=0,e.dmdt=0,e.dnodt=0,e.domdt=0,e.e3=0,e.ee2=0,e.peo=0,e.pgho=0,e.pho=0,e.pinco=0,e.plo=0,e.se2=0,e.se3=0,e.sgh2=0,e.sgh3=0,e.sgh4=0,e.sh2=0,e.sh3=0,e.si2=0,e.si3=0,e.sl2=0,e.sl3=0,e.sl4=0,e.gsto=0,e.xfact=0,e.xgh2=0,e.xgh3=0,e.xgh4=0,e.xh2=0,e.xh3=0,e.xi2=0,e.xi3=0,e.xl2=0,e.xl3=0,e.xl4=0,e.xlamo=0,e.zmol=0,e.zmos=0,e.atime=0,e.xli=0,e.xni=0,e.bstar=go,e.ecco=Mo,e.argpo=fo,e.inclo=uo,e.mo=zo,e.no=vo,e.nodeo=yo,e.operationmode=lo;e.init="y",e.t=0;var bo=function(o){var e=o.ecco,s=o.epoch,n=o.inclo,a=o.opsmode,d=o.no,i=e*e,c=1-i,m=Math.sqrt(c),l=Math.cos(n),p=l*l,g=Math.pow(r/d,x),M=.75*h*(3*p-1)/(m*c),f=M/(g*g),u=g*(1-f*f-f*(1/3+134*f*f/81));d/=1+(f=M/(u*u));var z,y=Math.pow(r/d,x),b=Math.sin(n),q=y*c,w=1-5*p,T=-w-p-p,j=1/y,E=q*q,F=y*(1-e);if("a"===a){var A=s-7305,C=Math.floor(A+1e-8),L=.017202791694070362;(z=(1.7321343856509375+L*C+(L+t)*(A-C)+A*A*5075514194322695e-30)%t)<0&&(z+=t)}else z=v(s+2433281.5);return{no:d,method:"n",ainv:j,ao:y,con41:T,con42:w,cosio:l,cosio2:p,eccsq:i,omeosq:c,posq:E,rp:F,rteosq:m,sinio:b,gsto:z}}({satn:po,ecco:e.ecco,epoch:xo,inclo:e.inclo,no:e.no,method:e.method,opsmode:e.operationmode}),qo=bo.ao,wo=bo.con42,To=bo.cosio,jo=bo.cosio2,Eo=bo.eccsq,Fo=bo.omeosq,Ao=bo.posq,Co=bo.rp,Lo=bo.rteosq,So=bo.sinio;if(e.no=bo.no,e.con41=bo.con41,e.gsto=bo.gsto,e.error=0,Fo>=0||e.no>=0){if(e.isimp=0,Co<220/d+1&&(e.isimp=1),R=1.0122292763545218,C=1.8802768006108976e-9,(E=(Co-1)*d)<156){R=E-78,E<98&&(R=20);var Uo=(120-R)/d;C=Uo*Uo*Uo*Uo,R=R/d+1}F=1/Ao,oo=1/(qo-R),e.eta=qo*e.ecco*oo,w=e.eta*e.eta,q=e.ecco*e.eta,A=Math.abs(1-w),c=(M=(g=C*Math.pow(oo,4))/Math.pow(A,3.5))*e.no*(qo*(1+1.5*w+q*(4+w))+.375*h*oo/A*e.con41*(8+3*w*(8+w))),e.cc1=e.bstar*c,m=0,e.ecco>1e-4&&(m=-2*g*oo*p*e.no*So/e.ecco),e.x1mth2=1-jo,e.cc4=2*e.no*M*qo*Fo*(e.eta*(2+.5*w)+e.ecco*(.5+2*w)-h*oo/(qo*A)*(-3*e.con41*(1-2*q+w*(1.5-.5*q))+.75*e.x1mth2*(2*w-q*(1+w))*Math.cos(2*e.argpo))),e.cc5=2*M*qo*Fo*(1+2.75*(w+q)+q*w),f=jo*jo,W=.5*(V=1.5*h*F*e.no)*h*F,X=-.46875*l*F*F*e.no,e.mdot=e.no+.5*V*Lo*e.con41+.0625*W*Lo*(13-78*jo+137*f),e.argpdot=-.5*V*wo+.0625*W*(7-114*jo+395*f)+X*(3-36*jo+49*f),eo=-V*To,e.nodedot=eo+(.5*W*(4-19*jo)+2*X*(3-7*jo))*To,to=e.argpdot+e.nodedot,e.omgcof=e.bstar*m*Math.cos(e.argpo),e.xmcof=0,e.ecco>1e-4&&(e.xmcof=-x*g*e.bstar/q),e.nodecf=3.5*Fo*eo*e.cc1,e.t2cof=1.5*e.cc1,Math.abs(To+1)>15e-13?e.xlcof=-.25*p*So*(3+5*To)/(1+To):e.xlcof=-.25*p*So*(3+5*To)/15e-13,e.aycof=-.5*p*So;var Do=1+e.eta*Math.cos(e.mo);if(e.delmo=Do*Do*Do,e.sinmao=Math.sin(e.mo),e.x7thm1=7*jo-1,2*o/e.no>=225){e.method="d",e.isimp=1,0,T=e.inclo;var Io=function(o){var e,s,n,a,d,r,i,c,h,m,l,p,x,g,M,f,u,z,v,y,b,q,w,T,j,E,F,A,C,L,S,U,D,I,R,O,_,k,P,Z,G,H,Y,$,B,J,K,N,Q,V,W,X,oo,to,eo,so,no,ao,ro,io,co,ho,mo,lo=o.epoch,po=o.ep,xo=o.argpp,go=o.tc,Mo=o.inclp,fo=o.nodep,uo=.01675,zo=.0549,vo=o.np,yo=po,bo=Math.sin(fo),qo=Math.cos(fo),wo=Math.sin(xo),To=Math.cos(xo),jo=Math.sin(Mo),Eo=Math.cos(Mo),Fo=yo*yo,Ao=1-Fo,Co=Math.sqrt(Ao),Lo=lo+18261.5+go/1440,So=(4.523602-.00092422029*Lo)%t,Uo=Math.sin(So),Do=Math.cos(So),Io=.91375164-.03568096*Do,Ro=Math.sqrt(1-Io*Io),Oo=.089683511*Uo/Ro,_o=Math.sqrt(1-Oo*Oo),ko=5.8351514+.001944368*Lo,Po=.39785416*Uo/Ro,Zo=_o*Do+.91744867*Oo*Uo;Po=Math.atan2(Po,Zo),Po+=ko-So;var Go=Math.cos(Po),Ho=Math.sin(Po);y=.1945905,b=-.98088458,T=.91744867,j=.39785416,q=qo,w=bo,l=29864797e-13;for(var Yo=1/vo,$o=0;$o<2;)eo=-6*(e=y*q+b*T*w)*(d=-jo*(i=-y*w+b*T*q)+Eo*(c=b*j))+Fo*(-24*(p=e*To+(s=Eo*i+jo*c)*wo)*(z=d*To)-6*(g=-e*wo+s*To)*(f=d*wo)),so=-6*(e*(r=-jo*(h=b*w+y*T*q)+Eo*(m=y*j))+(n=-b*q+y*T*w)*d)+Fo*(-24*((x=n*To+(a=Eo*h+jo*m)*wo)*z+p*(v=r*To))+-6*(g*(u=r*wo)+(M=-n*wo+a*To)*f)),no=-6*n*r+Fo*(-24*x*v-6*M*u),ao=6*s*d+Fo*(24*p*f-6*g*z),ro=6*(a*d+s*r)+Fo*(24*(x*f+p*u)-6*(M*z+g*v)),io=6*a*r+Fo*(24*x*u-6*M*v),X=(X=3*(e*e+s*s)+(co=12*p*p-3*g*g)*Fo)+X+Ao*co,oo=(oo=6*(e*n+s*a)+(ho=24*p*x-6*g*M)*Fo)+oo+Ao*ho,to=(to=3*(n*n+a*a)+(mo=12*x*x-3*M*M)*Fo)+to+Ao*mo,J=-.5*(K=l*Yo)/Co,B=-15*yo*(N=K*Co),Q=p*g+x*M,V=x*g+p*M,W=x*M-p*g,1===($o+=1)&&(E=B,F=J,A=K,C=N,L=Q,S=V,U=W,D=X,I=oo,R=to,O=eo,_=so,k=no,P=ao,Z=ro,G=io,H=co,Y=ho,$=mo,y=Go,b=Ho,T=Io,j=Ro,q=_o*qo+Oo*bo,w=bo*_o-qo*Oo,l=4.7968065e-7);return{snodm:bo,cnodm:qo,sinim:jo,cosim:Eo,sinomm:wo,cosomm:To,day:Lo,e3:2*B*W,ee2:2*B*V,em:yo,emsq:Fo,gam:ko,peo:0,pgho:0,pho:0,pinco:0,plo:0,rtemsq:Co,se2:2*E*S,se3:2*E*U,sgh2:2*C*Y,sgh3:2*C*($-H),sgh4:-18*C*uo,sh2:-2*F*Z,sh3:-2*F*(G-P),si2:2*F*_,si3:2*F*(k-O),sl2:-2*A*I,sl3:-2*A*(R-D),sl4:-2*A*(-21-9*Fo)*uo,s1:B,s2:J,s3:K,s4:N,s5:Q,s6:V,s7:W,ss1:E,ss2:F,ss3:A,ss4:C,ss5:L,ss6:S,ss7:U,sz1:D,sz2:I,sz3:R,sz11:O,sz12:_,sz13:k,sz21:P,sz22:Z,sz23:G,sz31:H,sz32:Y,sz33:$,xgh2:2*N*ho,xgh3:2*N*(mo-co),xgh4:-18*N*zo,xh2:-2*J*ro,xh3:-2*J*(io-ao),xi2:2*J*so,xi3:2*J*(no-eo),xl2:-2*K*oo,xl3:-2*K*(to-X),xl4:-2*K*(-21-9*Fo)*zo,nm:vo,z1:X,z2:oo,z3:to,z11:eo,z12:so,z13:no,z21:ao,z22:ro,z23:io,z31:co,z32:ho,z33:mo,zmol:(.2299715*Lo-ko+4.7199672)%t,zmos:(6.2565837+.017201977*Lo)%t}}({epoch:xo,ep:e.ecco,argpp:e.argpo,tc:0,inclp:e.inclo,nodep:e.nodeo,np:e.no,e3:e.e3,ee2:e.ee2,peo:e.peo,pgho:e.pgho,pho:e.pho,pinco:e.pinco,plo:e.plo,se2:e.se2,se3:e.se3,sgh2:e.sgh2,sgh3:e.sgh3,sgh4:e.sgh4,sh2:e.sh2,sh3:e.sh3,si2:e.si2,si3:e.si3,sl2:e.sl2,sl3:e.sl3,sl4:e.sl4,xgh2:e.xgh2,xgh3:e.xgh3,xgh4:e.xgh4,xh2:e.xh2,xh3:e.xh3,xi2:e.xi2,xi3:e.xi3,xl2:e.xl2,xl3:e.xl3,xl4:e.xl4,zmol:e.zmol,zmos:e.zmos});e.e3=Io.e3,e.ee2=Io.ee2,e.peo=Io.peo,e.pgho=Io.pgho,e.pho=Io.pho,e.pinco=Io.pinco,e.plo=Io.plo,e.se2=Io.se2,e.se3=Io.se3,e.sgh2=Io.sgh2,e.sgh3=Io.sgh3,e.sgh4=Io.sgh4,e.sh2=Io.sh2,e.sh3=Io.sh3,e.si2=Io.si2,e.si3=Io.si3,e.sl2=Io.sl2,e.sl3=Io.sl3,e.sl4=Io.sl4,a=Io.sinim,n=Io.cosim,z=Io.em,b=Io.emsq,L=Io.s1,S=Io.s2,U=Io.s3,D=Io.s4,I=Io.s5,O=Io.ss1,_=Io.ss2,k=Io.ss3,P=Io.ss4,Z=Io.ss5,G=Io.sz1,H=Io.sz3,Y=Io.sz11,$=Io.sz13,B=Io.sz21,J=Io.sz23,K=Io.sz31,N=Io.sz33,e.xgh2=Io.xgh2,e.xgh3=Io.xgh3,e.xgh4=Io.xgh4,e.xh2=Io.xh2,e.xh3=Io.xh3,e.xi2=Io.xi2,e.xi3=Io.xi3,e.xl2=Io.xl2,e.xl3=Io.xl3,e.xl4=Io.xl4,e.zmol=Io.zmol,e.zmos=Io.zmos,j=Io.nm,so=Io.z1,no=Io.z3,ao=Io.z11,ro=Io.z13,io=Io.z21,co=Io.z23,ho=Io.z31,mo=Io.z33;var Ro=u(e,{inclo:T,init:e.init,ep:e.ecco,inclp:e.inclo,nodep:e.nodeo,argpp:e.argpo,mp:e.mo,opsmode:e.operationmode});e.ecco=Ro.ep,e.inclo=Ro.inclp,e.nodeo=Ro.nodep,e.argpo=Ro.argpp,e.mo=Ro.mp,0,0,0;var Oo=function(e){var s,n,a,d,i,c,h,m,l,p,g,M,f,u,z,v,y,b=e.cosim,q=e.argpo,w=e.s1,T=e.s2,j=e.s3,E=e.s4,F=e.s5,A=e.sinim,C=e.ss1,L=e.ss2,S=e.ss3,U=e.ss4,D=e.ss5,I=e.sz1,R=e.sz3,O=e.sz11,_=e.sz13,k=e.sz21,P=e.sz23,Z=e.sz31,G=e.sz33,H=e.t,Y=e.tc,$=e.gsto,B=e.mo,J=e.mdot,K=e.no,N=e.nodeo,Q=e.nodedot,V=e.xpidot,W=e.z1,X=e.z3,oo=e.z11,to=e.z13,eo=e.z21,so=e.z23,no=e.z31,ao=e.z33,ro=e.ecco,io=e.eccsq,co=e.emsq,ho=e.em,mo=e.argpm,lo=e.inclm,po=e.mm,xo=e.nm,go=e.nodem,Mo=e.irez,fo=e.atime,uo=e.d2201,zo=e.d2211,vo=e.d3210,yo=e.d3222,bo=e.d4410,qo=e.d4422,wo=e.d5220,To=e.d5232,jo=e.d5421,Eo=e.d5433,Fo=e.dedt,Ao=e.didt,Co=e.dmdt,Lo=e.dnodt,So=e.domdt,Uo=e.del1,Do=e.del2,Io=e.del3,Ro=e.xfact,Oo=e.xlamo,_o=e.xli,ko=e.xni,Po=.0043752690880113,Zo=.00015835218,Go=119459e-10;Mo=0,xo<.0052359877&&xo>.0034906585&&(Mo=1),xo>=.00826&&xo<=.00924&&ho>=.5&&(Mo=2);var Ho=-Go*L*(k+P);(lo<.052359877||lo>o-.052359877)&&(Ho=0),0!==A&&(Ho/=A);var Yo=-Zo*T*(eo+so);(lo<.052359877||lo>o-.052359877)&&(Yo=0),So=U*Go*(Z+G-6)-b*Ho+E*Zo*(no+ao-6),Lo=Ho,0!==A&&(So-=b/A*Yo,Lo+=Yo/A);var $o=($+Y*Po)%t;if(ho+=(Fo=C*Go*D+w*Zo*F)*H,lo+=(Ao=L*Go*(O+_)+T*Zo*(oo+to))*H,mo+=So*H,go+=Lo*H,po+=(Co=-Go*S*(I+R-14-6*co)-Zo*j*(W+X-14-6*co))*H,0!==Mo){if(z=Math.pow(xo/r,x),2===Mo){var Bo=ho,Jo=co;y=(ho=ro)*(co=io),ho<=.65?(a=3.616-13.247*ho+16.29*co,d=117.39*ho-19.302-228.419*co+156.591*y,i=109.7927*ho-18.9068-214.6334*co+146.5816*y,c=242.694*ho-41.122-471.094*co+313.953*y,h=841.88*ho-146.407-1629.014*co+1083.435*y,m=3017.977*ho-532.114-5740.032*co+3708.276*y):(a=331.819*ho-72.099-508.738*co+266.724*y,d=1582.851*ho-346.844-2415.925*co+1246.113*y,i=1554.908*ho-342.585-2366.899*co+1215.972*y,c=4758.686*ho-1052.797-7193.992*co+3651.957*y,h=16178.11*ho-3581.69-24462.77*co+12422.52*y,m=ho>.715?29936.92*ho-5149.66-54087.36*co+31324.56*y:1464.74-4664.75*ho+3763.64*co),ho<.7?(g=4988.61*ho-919.2277-9064.77*co+5542.21*y,l=4568.6173*ho-822.71072-8491.4146*co+5337.524*y,p=4690.25*ho-853.666-8624.77*co+5341.4*y):(g=161616.52*ho-37995.78-229838.2*co+109377.94*y,l=218913.95*ho-51752.104-309468.16*co+146349.42*y,p=170470.89*ho-40023.88-242699.48*co+115605.82*y),uo=(f=17891679e-13*(u=xo*xo*3*(z*z)))*(s=.75*(1+2*b+(v=b*b)))*(-.306-.44*(ho-.64)),zo=f*(1.5*(M=A*A))*a,vo=(f=3.7393792e-7*(u*=z))*(1.875*A*(1-2*b-3*v))*d,yo=f*(-1.875*A*(1+2*b-3*v))*i,bo=(f=2*(u*=z)*7.3636953e-9)*(35*M*s)*c,qo=f*(39.375*M*M)*h,wo=(f=1.1428639e-7*(u*=z))*(9.84375*A*(M*(1-2*b-5*v)+.33333333*(4*b-2+6*v)))*m,To=f*(A*(4.92187512*M*(-2-4*b+10*v)+6.56250012*(1+2*b-3*v)))*p,jo=(f=2*u*2.1765803e-9)*(29.53125*A*(2-8*b+v*(8*b-12+10*v)))*l,Eo=f*(29.53125*A*(-2-8*b+v*(12+8*b-10*v)))*g,Oo=(B+N+N-($o+$o))%t,Ro=J+Co+2*(Q+Lo-Po)-K,ho=Bo,co=Jo}1===Mo&&(n=1+b,Do=2*(Uo=3*xo*xo*z*z)*(s=.75*(1+b)*(1+b))*(1+co*(.8125*co-2.5))*17891679e-13,Io=3*Uo*(n*=1.875*n*n)*(1+co*(6.60937*co-6))*2.2123015e-7*z,Uo=Uo*(.9375*A*A*(1+3*b)-.75*(1+b))*(d=1+2*co)*21460748e-13*z,Oo=(B+N+q-$o)%t,Ro=J+V+Co+So+Lo-(K+Po)),_o=Oo,ko=K,fo=0,xo=K+0}return{em:ho,argpm:mo,inclm:lo,mm:po,nm:xo,nodem:go,irez:Mo,atime:fo,d2201:uo,d2211:zo,d3210:vo,d3222:yo,d4410:bo,d4422:qo,d5220:wo,d5232:To,d5421:jo,d5433:Eo,dedt:Fo,didt:Ao,dmdt:Co,dndt:0,dnodt:Lo,domdt:So,del1:Uo,del2:Do,del3:Io,xfact:Ro,xlamo:Oo,xli:_o,xni:ko}}({cosim:n,emsq:b,argpo:e.argpo,s1:L,s2:S,s3:U,s4:D,s5:I,sinim:a,ss1:O,ss2:_,ss3:k,ss4:P,ss5:Z,sz1:G,sz3:H,sz11:Y,sz13:$,sz21:B,sz23:J,sz31:K,sz33:N,t:e.t,tc:0,gsto:e.gsto,mo:e.mo,mdot:e.mdot,no:e.no,nodeo:e.nodeo,nodedot:e.nodedot,xpidot:to,z1:so,z3:no,z11:ao,z13:ro,z21:io,z23:co,z31:ho,z33:mo,ecco:e.ecco,eccsq:Eo,em:z,argpm:0,inclm:T,mm:0,nm:j,nodem:0,irez:e.irez,atime:e.atime,d2201:e.d2201,d2211:e.d2211,d3210:e.d3210,d3222:e.d3222,d4410:e.d4410,d4422:e.d4422,d5220:e.d5220,d5232:e.d5232,d5421:e.d5421,d5433:e.d5433,dedt:e.dedt,didt:e.didt,dmdt:e.dmdt,dnodt:e.dnodt,domdt:e.domdt,del1:e.del1,del2:e.del2,del3:e.del3,xfact:e.xfact,xlamo:e.xlamo,xli:e.xli,xni:e.xni});e.irez=Oo.irez,e.atime=Oo.atime,e.d2201=Oo.d2201,e.d2211=Oo.d2211,e.d3210=Oo.d3210,e.d3222=Oo.d3222,e.d4410=Oo.d4410,e.d4422=Oo.d4422,e.d5220=Oo.d5220,e.d5232=Oo.d5232,e.d5421=Oo.d5421,e.d5433=Oo.d5433,e.dedt=Oo.dedt,e.didt=Oo.didt,e.dmdt=Oo.dmdt,e.dnodt=Oo.dnodt,e.domdt=Oo.domdt,e.del1=Oo.del1,e.del2=Oo.del2,e.del3=Oo.del3,e.xfact=Oo.xfact,e.xlamo=Oo.xlamo,e.xli=Oo.xli,e.xni=Oo.xni}1!==e.isimp&&(i=e.cc1*e.cc1,e.d2=4*qo*oo*i,Q=e.d2*oo*e.cc1/3,e.d3=(17*qo+R)*Q,e.d4=.5*Q*qo*oo*(221*qo+31*R)*e.cc1,e.t3cof=e.d2+2*i,e.t4cof=.25*(3*e.d3+e.cc1*(12*e.d2+10*i)),e.t5cof=.2*(3*e.d4+12*e.cc1*e.d3+6*e.d2*e.d2+15*i*(2*e.d2+i)))}y(e,0),e.init="n"}function q(o){return function(o){if(Array.isArray(o))return w(o)}(o)||function(o){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(o))return Array.from(o)}(o)||function(o,t){if(!o)return;if("string"==typeof o)return w(o,t);var e=Object.prototype.toString.call(o).slice(8,-1);"Object"===e&&o.constructor&&(e=o.constructor.name);if("Map"===e||"Set"===e)return Array.from(o);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return w(o,t)}(o)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(o,t){(null==t||t>o.length)&&(t=o.length);for(var e=0,s=new Array(t);e=0?1:-1)},radiansToDegrees:T,degreesToRadians:j,degreesLat:function(t){if(t<-o/2||t>o/2)throw new RangeError("Latitude radians must be in range [-pi/2; pi/2].");return T(t)},degreesLong:function(t){if(t<-o||t>o)throw new RangeError("Longitude radians must be in range [-pi; pi].");return T(t)},radiansLat:function(o){if(o<-90||o>90)throw new RangeError("Latitude degrees must be in range [-90; 90].");return j(o)},radiansLong:function(o){if(o<-180||o>180)throw new RangeError("Longitude degrees must be in range [-180; 180].");return j(o)},geodeticToEcf:E,eciToGeodetic:function(e,s){for(var n=6378.137,a=Math.sqrt(e.x*e.x+e.y*e.y),d=(n-6356.7523142)/n,r=2*d-d*d,i=Math.atan2(e.y,e.x)-s;i<-o;)i+=t;for(;i>o;)i-=t;for(var c,h=0,m=Math.atan2(e.z,Math.sqrt(e.x*e.x+e.y*e.y));h<20;)c=1/Math.sqrt(1-r*(Math.sin(m)*Math.sin(m))),m=Math.atan2(e.z+n*c*r*Math.sin(m),a),h+=1;return{longitude:i,latitude:m,height:a/Math.cos(m)-n*c}},eciToEcf:function(o,t){return{x:o.x*Math.cos(t)+o.y*Math.sin(t),y:o.x*-Math.sin(t)+o.y*Math.cos(t),z:o.z}},ecfToEci:function(o,t){return{x:o.x*Math.cos(t)-o.y*Math.sin(t),y:o.x*Math.sin(t)+o.y*Math.cos(t),z:o.z}},ecfToLookAngles:function(t,e){var s,n,a,d,r,i,c=function(o,t){var e=o.longitude,s=o.latitude,n=E(o),a=t.x-n.x,d=t.y-n.y,r=t.z-n.z;return{topS:Math.sin(s)*Math.cos(e)*a+Math.sin(s)*Math.sin(e)*d-Math.cos(s)*r,topE:-Math.sin(e)*a+Math.cos(e)*d,topZ:Math.cos(s)*Math.cos(e)*a+Math.cos(s)*Math.sin(e)*d+Math.sin(s)*r}}(t,e);return n=(s=c).topS,a=s.topE,d=s.topZ,r=Math.sqrt(n*n+a*a+d*d),i=Math.asin(d/r),{azimuth:Math.atan2(-a,n)+o,elevation:i,rangeSat:r}}}})); diff --git a/imports/sgp4.js b/imports/sgp4.js new file mode 100644 index 0000000..8f112f6 --- /dev/null +++ b/imports/sgp4.js @@ -0,0 +1 @@ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.sgp4=e():t.sgp4=e()}(self,(()=>(()=>{"use strict";var t={d:(e,a)=>{for(var o in a)t.o(a,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:a[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{coordTemeJ2000:()=>T,coordTemePef:()=>D,coordTemeTod:()=>I,createTarget:()=>A,nutationTerms:()=>g,propagateTarget:()=>P,propagateTargetJulian:()=>B,propagateTargetTs:()=>L,tleFromLines:()=>n});const a={FIELD_NUMBER:1,FIELD_NUMBER_IMPLIED:2,FIELD_NUMBER_MAPPED:3,FIELD_STRING:4},o=[{name:"title",fieldType:a.FIELD_STRING,row:0,startCol:0,endCol:23},{name:"catalogNumber",fieldType:a.FIELD_NUMBER,row:1,startCol:2,endCol:6},{name:"classification",fieldType:a.FIELD_STRING,row:1,startCol:7,endCol:7},{name:"intLaunchYear",fieldType:a.FIELD_STRING,row:1,startCol:9,endCol:10},{name:"intLaunchNum",fieldType:a.FIELD_STRING,row:1,startCol:11,endCol:13},{name:"intLaunchPiece",fieldType:a.FIELD_STRING,row:1,startCol:14,endCol:16},{name:"epochYear",fieldType:a.FIELD_NUMBER_MAPPED,row:1,startCol:18,endCol:19,callback:function(t){return t>56?1900+t:2e3+t}},{name:"epochFracDay",fieldType:a.FIELD_NUMBER,row:1,startCol:20,endCol:31},{name:"meanMotionDer",fieldType:a.FIELD_NUMBER,row:1,startCol:33,endCol:42},{name:"meanMotionDer2",fieldType:a.FIELD_NUMBER_IMPLIED,row:1,startCol:44,endCol:51},{name:"dragTerm",fieldType:a.FIELD_NUMBER_IMPLIED,row:1,startCol:53,endCol:60},{name:"ephemerisType",fieldType:a.FIELD_NUMBER,row:1,startCol:62,endCol:62},{name:"elementSetNo",fieldType:a.FIELD_NUMBER,row:1,startCol:64,endCol:67},{name:"checkSum1",fieldType:a.FIELD_NUMBER,row:1,startCol:68,endCol:68},{name:"catalogNumber2",fieldType:a.FIELD_NUMBER,row:2,startCol:2,endCol:6},{name:"inclination",fieldType:a.FIELD_NUMBER,row:2,startCol:8,endCol:15},{name:"raAscNode",fieldType:a.FIELD_NUMBER,row:2,startCol:17,endCol:24},{name:"eccentricity",fieldType:a.FIELD_NUMBER_IMPLIED,row:2,startCol:26,endCol:32},{name:"argPerigee",fieldType:a.FIELD_NUMBER,row:2,startCol:34,endCol:41},{name:"meanAnomaly",fieldType:a.FIELD_NUMBER,row:2,startCol:43,endCol:50},{name:"meanMotion",fieldType:a.FIELD_NUMBER,row:2,startCol:52,endCol:62},{name:"revNoAtEpoch",fieldType:a.FIELD_NUMBER,row:2,startCol:63,endCol:67},{name:"checkSum2",fieldType:a.FIELD_NUMBER,row:2,startCol:68,endCol:68}];function n(t){const e={},n={};for(let e=0;e-1?e+=parseInt(o):"-"==o&&e++}return e%10}function c(t,e,a,o,n,r){const c=function(t,e,a){e<3&&(t--,e+=12);const o=Math.floor(t/100),n=Math.floor(o/4);return Math.floor(2-o+n)+a+Math.floor(365.25*(t+4716))+Math.floor(30.6001*(e+1))-1524.5}(t,e,a);return c+o/24+n/1440+r/86400}const i={mu:398600.8,radiusEarthKm:6378.135,xke:.07436691613317342,tumin:13.44683969695931,j2:.001082616,j3:-253881e-11,j4:-165597e-11},s={ERROR_NONE:0,ERROR_MEAN_ECCENTRICITY:1,ERROR_MEAN_MOTION:2,ERROR_PERT_ECCENTRICITY:3,ERROR_SEMI_LATUS_RECTUM:4,ERROR_EPOCH_SUBORBITAL:5,ERROR_SATELLITE_DECAYED:6,ERROR_INVALID_TSINCE:7};function M(t){const e=(t-2451545)/36525,a=2*Math.PI;let o=-62e-7*e*e*e+.093104*e*e+3164400184.812866*e+67310.54841;return o=o*Math.PI/43200%a,o<0&&(o+=a),o}function h(t){return 2*Math.PI*t/360}function l(t,e){const a=[];let o=1;a.push(o);for(let n=1;n<=e;n++)o*=t,a.push(o);return a}function m(t){return Math.sin(t*Math.PI/180)}function d(t){return Math.cos(t*Math.PI/180)}function u(t,e,a,o){const n=h(t.meanAnomaly),r=h(t.argPerigee),c=h(t.raAscNode);return{a:e.semiMajorAxisBrouwer,incl:h(t.inclination),ecc:t.eccentricity,M:n+a.MDot*o,omega:r+a.omegaDot*o,Omega:c+a.OmegaDot*o}}function E(t,e,a){const o=-i.j3,n=.5*i.j2,r=Math.sqrt(1-e.ecc**2);let c=h(t.inclination);void 0!==a&&(c=a);const M=Math.cos(c),l=o*Math.sin(e.incl)/(4*n*e.a*r*r),m=e.ecc*Math.cos(e.omega),d=e.M+e.omega+e.Omega+.5*l*m*(3+5*M)/(1+M),u=e.ecc*Math.sin(e.omega)+l,E=function(t){const e=2*Math.PI;return t-e*Math.floor(t/e)}(d-e.Omega);let f=E,g=1e-12+1,p=0;for(;p<=10&&Math.abs(g)>1e-12;)g=-(E-u*Math.cos(f)+m*Math.sin(f)-f)/(u*Math.sin(f)+m*Math.cos(f)-1),Math.abs(g)>=.95&&(g=.95*Math.sign(g)),f+=g,p++;const D=m*Math.cos(f)+u*Math.sin(f),I=m*Math.sin(f)-u*Math.cos(f),T=Math.atan2(I,D),C=Math.sqrt(m*m+u*u),N=e.a*(1-C*C);if(N<0)throw{type:s.ERROR_SEMI_LATUS_RECTUM,message:"Semi-latus rectum "+N+" negative!"};const R=e.a*(1-C*Math.cos(T)),y=e.a/R*(Math.cos(f)-m+u*I/(1+Math.sqrt(1-C**2))),O=e.a/R*(Math.sin(f)-u-m*I/(1+Math.sqrt(1-C**2))),b=Math.atan2(O,y),_=Math.sqrt(e.a)*I/R,w=Math.sqrt(N)/R,A=Math.pow(e.a,-1.5),P=Math.sin(2*b),B=Math.cos(2*b),L=M**2,S=.5*n*(1-L)*B/N,v=-.25*n*(7*L-1)*P/(N*N),Z=1.5*n*M*P/(N*N),U=1.5*n*M*Math.sin(e.incl)*B/(N*N),F=-n*A*(1-L)*P/N,j=n*A*((1-L)*B-1.5*(1-3*L))/N,k=R*(1-1.5*n*Math.sqrt(1-C**2)*(3*L-1)/N**2)+S,Y=b+v,x=e.Omega+Z,X=e.incl+U,q=_+F,G=w+j;if(k<1)throw{type:s.ERROR_SATELLITE_DECAYED,message:"Satellite orbit decayed!"};return{r:k,u:Y,Omega:x,incl:X,rdot:q,rfdot:G}}const f=[[0,0,0,0,1,-6798.4,-171996,-174.2,92025,8.9],[0,0,2,-2,2,182.6,-13187,-1.6,5736,-3.1],[0,0,2,0,2,13.7,-2274,-.2,977,-.5],[0,0,0,0,2,-3399.2,2062,.2,-895,.5],[0,-1,0,0,0,-365.3,-1426,3.4,54,-.1],[1,0,0,0,0,27.6,712,.1,-7,0],[0,1,2,-2,2,121.7,-517,1.2,224,-.6],[0,0,2,0,1,13.6,-386,-.4,200,0],[1,0,2,0,2,9.1,-301,0,129,-.1],[0,-1,2,-2,2,365.2,217,-.5,-95,.3],[-1,0,0,2,0,31.8,158,0,-1,0],[0,0,2,-2,1,177.8,129,.1,-70,0],[-1,0,2,0,2,27.1,123,0,-53,0],[1,0,0,0,1,27.7,63,.1,-33,0],[0,0,0,2,0,14.8,63,0,-2,0],[-1,0,2,2,2,9.6,-59,0,26,0],[-1,0,0,0,1,-27.4,-58,-.1,32,0],[1,0,2,0,1,9.1,-51,0,27,0],[-2,0,0,2,0,-205.9,-48,0,1,0],[-2,0,2,0,1,1305.5,46,0,-24,0],[0,0,2,2,2,7.1,-38,0,16,0],[2,0,2,0,2,6.9,-31,0,13,0],[2,0,0,0,0,13.8,29,0,-1,0],[1,0,2,-2,2,23.9,29,0,-12,0],[0,0,2,0,0,13.6,26,0,-1,0],[0,0,2,-2,0,173.3,-22,0,0,0],[-1,0,2,0,1,27,21,0,-10,0],[0,2,0,0,0,182.6,17,-.1,0,0],[0,2,2,-2,2,91.3,-16,.1,7,0],[-1,0,0,2,1,32,16,0,-8,0],[0,1,0,0,1,386,-15,0,9,0],[1,0,0,-2,1,-31.7,-13,0,7,0],[0,-1,0,0,1,-346.6,-12,0,6,0],[2,0,-2,0,0,-1095.2,11,0,0,0],[-1,0,2,2,1,9.5,-10,0,5,0],[1,0,2,2,2,5.6,-8,0,3,0],[0,-1,2,0,2,14.2,-7,0,3,0],[0,0,2,2,1,7.1,-7,0,3,0],[1,1,0,-2,0,-34.8,-7,0,0,0],[0,1,2,0,2,13.2,7,0,-3,0],[-2,0,0,2,1,-199.8,-6,0,3,0],[0,0,0,2,1,14.8,-6,0,3,0],[2,0,2,-2,2,12.8,6,0,-3,0],[1,0,0,2,0,9.6,6,0,0,0],[1,0,2,-2,1,23.9,6,0,-3,0],[0,0,0,-2,1,-14.7,-5,0,3,0],[0,-1,2,-2,1,346.6,-5,0,3,0],[2,0,2,0,1,6.9,-5,0,3,0],[1,-1,0,0,0,29.8,5,0,0,0],[1,0,0,-1,0,411.8,-4,0,0,0],[0,0,0,1,0,29.5,-4,0,0,0],[0,1,0,-2,0,-15.4,-4,0,0,0],[1,0,-2,0,0,-26.9,4,0,0,0],[2,0,0,-2,1,212.3,4,0,-2,0],[0,1,2,-2,1,119.6,4,0,-2,0],[1,1,0,0,0,25.6,-3,0,0,0],[1,-1,0,-1,0,-3232.9,-3,0,0,0],[-1,-1,2,2,2,9.8,-3,0,1,0],[0,-1,2,2,2,7.2,-3,0,1,0],[1,-1,2,0,2,9.4,-3,0,1,0],[3,0,2,0,2,5.5,-3,0,1,0],[-2,0,2,0,2,1615.7,-3,0,1,0],[1,0,2,0,0,9.1,3,0,0,0],[-1,0,2,4,2,5.8,-2,0,1,0],[1,0,0,0,2,27.8,-2,0,1,0],[-1,0,2,-2,1,-32.6,-2,0,1,0],[0,-2,2,-2,1,6786.3,-2,0,1,0],[-2,0,0,0,1,-13.7,-2,0,1,0],[2,0,0,0,1,13.8,2,0,-1,0],[3,0,0,0,0,9.2,2,0,0,0],[1,1,2,0,2,8.9,2,0,-1,0],[0,0,2,1,2,9.3,2,0,-1,0],[1,0,0,2,1,9.6,-1,0,0,0],[1,0,2,2,1,5.6,-1,0,1,0],[1,1,0,-2,1,-34.7,-1,0,0,0],[0,1,0,2,0,14.2,-1,0,0,0],[0,1,2,-2,0,117.5,-1,0,0,0],[0,1,-2,2,0,-329.8,-1,0,0,0],[1,0,-2,2,0,23.8,-1,0,0,0],[1,0,-2,-2,0,-9.5,-1,0,0,0],[1,0,2,-2,0,32.8,-1,0,0,0],[1,0,0,-4,0,-10.1,-1,0,0,0],[2,0,0,-4,0,-15.9,-1,0,0,0],[0,0,2,4,2,4.8,-1,0,0,0],[0,0,2,-1,2,25.4,-1,0,0,0],[-2,0,2,4,2,7.3,-1,0,1,0],[2,0,2,2,2,4.7,-1,0,0,0],[0,-1,2,0,1,14.2,-1,0,0,0],[0,0,-2,0,1,-13.6,-1,0,0,0],[0,0,4,-2,2,12.7,1,0,0,0],[0,1,0,0,2,409.2,1,0,0,0],[1,1,2,-2,2,22.5,1,0,-1,0],[3,0,2,-2,2,8.7,1,0,0,0],[-2,0,2,2,2,14.6,1,0,-1,0],[-1,0,0,0,2,-27.3,1,0,-1,0],[0,0,-2,2,1,-169,1,0,0,0],[0,1,2,0,1,13.1,1,0,0,0],[-1,0,4,0,2,9.1,1,0,0,0],[2,1,0,-2,0,131.7,1,0,0,0],[2,0,0,2,0,7.1,1,0,0,0],[2,0,2,-2,1,12.8,1,0,-1,0],[2,0,-2,0,1,-943.2,1,0,0,0],[1,-1,0,-2,0,-29.3,1,0,0,0],[-1,0,0,1,1,-388.3,1,0,0,0],[-1,-1,0,2,1,35,1,0,0,0],[0,1,0,1,0,27.3,1,0,0,0]];function g(t){const e=t*t,a=e*t,o=23.4392911111-.0130041667*t-1.6388888889e-7*e+5.0361111111e-7*a,n=134.9629813889+198.8673980555*t+.0086972222222*e+17777777778e-15*a+477e3*t%360,r=357.5277233333+359.05034*t-.00016027777778*e-33333333333e-16*a+35640*t%360,c=93.2719102778+82.0175380556*t-.0036825*e+30555555555e-16*a+483120*t%360,i=297.8503630555+307.11148*t-.0019141666667*e+52777777778e-16*a+444960*t%360,s=125.0445222222-134.1362608333*t+.0020708333333*e+22222222222e-16*a-1800*t%360,M=1/36e6,h=f.length;let l=0,m=0;for(let e=0;e1e-4&&(R=s*f[5]*I*d*Math.sin(E)/(T*M));const y=2*d*s*f[4]*m*p[2]*Math.pow(1-g[2],-3.5)*(2*g[1]*(1+M*g[1])+.5*M+.5*g[3]-2*T*f[1]/(m*(1-g[2]))*(3*(1-3*D[2])*(1+1.5*g[2]-2*M*g[1]-.5*M*g[3])+.75*(1-D[2])*(2*g[2]-M*g[1]-M*g[3])*Math.cos(2*u))),O=2*s*f[4]*m*p[2]*Math.pow(1-g[2],-3.5)*(1+2.75*g[1]*(g[1]+M)+M*g[3]),b=4*m*f[1]*N[2],_=4/3*m*f[2]*(17*m+c)*N[3],w=2/3*m*m*f[3]*(221*m+31*c)*N[4];return{C1:N,C2:C,C3:R,C4:y,C5:O,D2:b,D3:_,D4:w,t2cof:1.5*N[1],t3cof:b+2*N[2],t4cof:.25*(3*_+12*N[1]*b+10*N[3]),t5cof:.2*(3*w+12*N[1]*_+6*b**2+30*N[2]*b+15*N[4]),qs4Term:s,s:c,xi:f,eta:g,beta0:p,theta:D,useSimplifiedDrag:o}}(t,e.brouwer),a=e.brouwer,2*Math.PI/a.meanMotionBrouwer<225?e.solverType=w.SGP4:(e.solverType=w.SDP4,e.thirdBodyCommon=function(t,e){const a=h(281.2208026160437),o=298647972e-14,n=4.796806521e-7,r=119459e-10,c=.00015835218,i=h(23.444100086478358),s=h(t.raAscNode),M=h(t.inclination),l=h(t.argPerigee),m=t.eccentricity,d=e.meanMotionBrouwer,u=Math.sqrt(1-m*m),E=t.jtUt1Epoch-2415020,f=(4.523602-.00092422029*E)%(2*Math.PI),g=5.8351514+.001944368*E,p=h(5.145400276825767),D=Math.cos(i)*Math.cos(p)-Math.sin(i)*Math.sin(p)*Math.cos(f),I=Math.sqrt(1-D**2),T=Math.atan2(I,D),C=Math.sin(p)*Math.sin(f)/Math.sin(T),N=Math.sqrt(1-C**2),R=Math.atan2(C,N),y=Math.sin(i)*Math.sin(f)/Math.sin(T),b=Math.cos(R)*Math.cos(f)+Math.sin(R)*Math.sin(f)*Math.cos(i),_=g-f+Math.atan2(y,b),w=O(m,M,l,s,i,a,0),A=O(m,M,l,s,T,_,R),P=-15*o*r*m/d*u*(w.X1*w.X3+w.X2*w.X4),B=-15*n*c*m/d*u*(A.X1*A.X3+A.X2*A.X4),L=-.5*o*r/u/d*(w.Z11+w.Z13),S=-.5*n*c/u/d*(A.Z11+A.Z13),v=-o*r/d*(w.Z1+w.Z3-14-6*m*m),Z=-n*c/d*(A.Z1+A.Z3-14-6*m*m);let U,F,j,k;return t.inclination<3?(U=0,F=0):(U=o*r/(2*d*u*Math.sin(M))*(w.Z21+w.Z23),F=n*c/(2*d*u*Math.sin(M))*(A.Z21+A.Z23)),t.inclination<3?(j=o*r*u/d*(w.Z31+w.Z33-6),k=n*c*u/d*(A.Z31+A.Z33-6)):(j=o*r*u/d*(w.Z31+w.Z33-6)-U*Math.cos(M),k=n*c*u/d*(A.Z31+A.Z33-6)-F*Math.cos(M)),{sun:w,moon:A,secularRates:{dedt:P+B,dIdt:L+S,dMdt:v+Z,dOmegadt:U+F,domegadt:j+k}}}(t,e.brouwer),e.resonance=function(t,e){let a,o=_.NO_RESONANCE;return e.meanMotionBrouwer>.0034906585&&e.meanMotionBrouwer<.0052359877&&(o=_.ONE_DAY_RESONANCE,a=function(t,e){const a=h(t.inclination),o=Math.cos(a),n=Math.sin(a),r=t.eccentricity,c=e.meanMotionBrouwer,i=e.semiMajorAxisBrouwer;return{delta1:3*c**2/i**3*(.9375*n**2*(1+3*o)-.75*(1+o))*(1+2*r**2)*21460748e-13,delta2:6*c**2/i**2*(.75*Math.pow(1+o,2))*(1-2.5*r**2+.8125*r**4)*17891679e-13,delta3:9*c**2/i**3*(1.875*Math.pow(1+o,3))*(1-6*r**2+6.60937*r**4)*2.2123015e-7}}(t,e)),e.meanMotionBrouwer>=.00826&&e.meanMotionBrouwer<=.00924&&t.eccentricity>=.5&&(o=_.HALF_DAY_RESONANCE,a=function(t,e){const a=t.eccentricity,o=a*a,n=o*a,r=h(t.inclination),c=Math.sin(r),i=c*c,s=Math.cos(r),M=s*s,l=-.306-.44*(a-.64);let m,d,u,E,f,g,p,D,I;a<=.65?(m=3.616-13.247*a+16.29*o,d=117.39*a-19.302-228.419*o+156.591*n,u=109.7927*a-18.9068-214.6334*o+146.5816*n,E=242.694*a-41.122-471.094*o+313.953*n,f=841.88*a-146.407-1629.014*o+1083.435*n,g=3017.977*a-532.114-5740.032*o+3708.276*n):(m=331.819*a-72.099-508.738*o+266.724*n,d=1582.851*a-346.844-2415.925*o+1246.113*n,u=1554.908*a-342.585-2366.899*o+1215.972*n,E=4758.686*a-1052.797-7193.992*o+3651.957*n,f=16178.11*a-3581.69-24462.77*o+12422.52*n,g=a>.715?29936.92*a-5149.66-54087.36*o+31324.56*n:1464.74-4664.75*a+3763.64*o),a<.7?(I=4988.61*a-919.2277-9064.77*o+5542.21*n,p=4568.6173*a-822.71072-8491.4146*o+5337.524*n,D=4690.25*a-853.666-8624.77*o+5341.4*n):(I=161616.52*a-37995.78-229838.2*o+109377.94*n,p=218913.95*a-51752.104-309468.16*o+146349.42*n,D=170470.89*a-40023.88-242699.48*o+115605.82*n);const T=.75*(1+2*s+M),C=1.5*i,N=1.875*c*(1-2*s-3*M),R=-1.875*c*(1+2*s-3*M),y=35*i*T,O=39.375*i*i,b=9.84375*c*(i*(1-2*s-5*M)+.33333333*(4*s-2+6*M)),_=c*(4.92187512*i*(-2-4*s+10*M)+6.56250012*(1+2*s-3*M)),w=29.53125*c*(2-8*s+M*(8*s-12+10*M)),A=29.53125*c*(-2-8*s+M*(12+8*s-10*M)),P=17891679e-13,B=3.7393792e-7,L=7.3636953e-9,S=1.1428639e-7,v=2.1765803e-9,Z=e.meanMotionBrouwer,U=e.semiMajorAxisBrouwer,F=Z*Z*3;return{D2201:F/U**2*P*T*l,D2211:F/U**2*P*C*m,D3210:F/U**3*B*N*d,D3222:F/U**3*B*R*u,D4410:F/U**4*2*L*y*E,D4422:F/U**4*2*L*O*f,D5220:F/U**5*S*b*g,D5232:F/U**5*S*_*D,D5421:F/U**5*2*v*w*p,D5433:F/U**5*2*v*A*I}}(t,e)),{type:o,coeffs:a}}(t,e.brouwer),e.integrationState=function(t,e,a,o,n){const r=h(t.meanAnomaly),c=h(t.raAscNode),i=h(t.argPerigee),s=M(t.jtUt1Epoch),l=.0043752690880113;let m,d,u;return n==_.HALF_DAY_RESONANCE?(m=(r+2*c-2*s)%(2*Math.PI),d=o.MDot+a.dMdt+2*(o.OmegaDot+a.dOmegadt-l)-e.meanMotionBrouwer,u=e.meanMotionBrouwer):n==_.ONE_DAY_RESONANCE&&(m=(r+c+i-s)%(2*Math.PI),d=o.MDot+a.dMdt+o.OmegaDot+a.dOmegadt+o.omegaDot+a.domegadt-l-e.meanMotionBrouwer,u=e.meanMotionBrouwer),{minsAfterEpoch:0,lambda:m,lambda0:m,dlambdadt:d,dlambdadt0:d,n:u,n0:u,dndt:0}}(t,e.brouwer,e.thirdBodyCommon.secularRates,e.secGrav,e.resonance.type),e.dragTerms.useSimplifiedDrag=!0),e}function P(t,e,a){if("number"!=typeof e)throw{type:s.ERROR_INVALID_TSINCE,message:"tSince parameter "+e+" not a number!"};void 0===a&&(a=0);const o=60*(e-t.lastTime),n=t.tle.jtUt1Epoch+e/1440;if(void 0===t.lastTime);else if(Math.abs(o)=1||o.ecc<-.001)throw{type:s.ERROR_PERT_ECCENTRICITY,message:"Eccentricity "+kepler4.ecc+" invalid!"};r=p(E(t.tle,o))}else{const a=function(t,e,a){return{a:t.a,incl:t.incl+a*e.dIdt,ecc:t.ecc+a*e.dedt,M:t.M+a*e.dMdt,omega:t.omega+a*e.domegadt,Omega:t.Omega+a*e.dOmegadt}}(u(t.tle,t.brouwer,t.secGrav,e),t.thirdBodyCommon.secularRates,e);let o;if(o=t.resonance.type==_.NO_RESONANCE?{M:a.M,n:i.xke/Math.pow(a.a,1.5)}:function(t,e,a,o,n,r){let c=720,i=c*c;n-r.minsAfterEpoch<0&&(c=-c);const s=5.7686396,l=.95240898,m=1.8014998,d=1.050833,u=4.4108898,E=.13130908,f=2.8843198,g=.37448087,p=(M(t.jtUt1Epoch)+.0043752690880113*n)%(2*Math.PI);for(;;){if(e.type==_.ONE_DAY_RESONANCE){const t=e.coeffs;r.dndt=t.delta1*Math.sin(r.lambda-E)+t.delta2*Math.sin(2*(r.lambda-f))+t.delta3*Math.sin(3*(r.lambda-g)),r.dlambdadt=r.n+r.dlambdadt0,r.dnddt=t.delta1*Math.cos(r.lambda-E)+2*t.delta2*Math.cos(2*(r.lambda-f))+3*t.delta3*Math.cos(3*(r.lambda-g)),r.dnddt*=r.dlambdadt}else if(e.type==_.HALF_DAY_RESONANCE){const o=h(t.argPerigee)+a.omegaDot*r.minsAfterEpoch,n=e.coeffs;r.dndt=n.D2201*Math.sin(2*o+r.lambda-s)+n.D2211*Math.sin(r.lambda-s)+n.D3210*Math.sin(o+r.lambda-l)+n.D3222*Math.sin(-o+r.lambda-l)+n.D4410*Math.sin(2*o+2*r.lambda-m)+n.D4422*Math.sin(2*r.lambda-m)+n.D5220*Math.sin(o+r.lambda-d)+n.D5232*Math.sin(-o+r.lambda-d)+n.D5421*Math.sin(o+2*r.lambda-u)+n.D5433*Math.sin(-o+2*r.lambda-u),r.dlambdadt=r.n+r.dlambdadt0,r.dnddt=n.D2201*Math.cos(2*o+r.lambda-s)+n.D2211*Math.cos(r.lambda-s)+n.D3210*Math.cos(o+r.lambda-l)+n.D3222*Math.cos(-o+r.lambda-l)+n.D5220*Math.cos(o+r.lambda-d)+n.D5232*Math.cos(-o+r.lambda-d)+2*(n.D4410*Math.cos(2*o+2*r.lambda-m)+n.D4422*Math.cos(2*r.lambda-m)+n.D5421*Math.cos(o+2*r.lambda-u)+n.D5433*Math.cos(-o+2*r.lambda-u)),r.dnddt*=r.dlambdadt}if(Math.abs(r.minsAfterEpoch-n)=1||l<-.001)throw{type:s.ERROR_MEAN_ECCENTRICITY,message:"Mean eccentricity "+l+" invalid!"};let m=(o.M+t.brouwer.meanMotionBrouwer*t.dragTerms.t2cof*e*e)%(2*Math.PI);const d={a:n,incl:a.incl,ecc:l,M:m,omega:a.omega,Omega:a.Omega,n:c},f=function(t,e,a,o,n,r){const c=t.jtUt1Epoch-2415020,i=4.7199672+.2299715*c-(5.8351514+.001944368*c),s=(6.2565837+.017201977*c+119459e-10*r)%(2*Math.PI),M=(i+.00015835218*r)%(2*Math.PI),h=t.eccentricity,l=e.meanMotionBrouwer,m=b(h,l,a,s,.01675,298647972e-14),d=b(h,l,o,M,.0549,4.796806521e-7),u=m.deltaecc+d.deltaecc,E=m.deltaI+d.deltaI,f=m.deltaM+d.deltaM,g=m.deltaomegaI+d.deltaomegaI,p=m.deltaOmegaI+d.deltaOmegaI,D=n.ecc+u,I=n.incl+E;let T,C,N;if(I>=.2){const t=p/Math.sin(I),e=g-Math.cos(I)*t;T=n.omega+e,C=n.Omega+t,N=n.M+f}else{const t=Math.sin(I)*Math.sin(n.Omega)+p*Math.cos(n.Omega)+E*Math.cos(I)*Math.sin(n.Omega),e=Math.sin(I)*Math.cos(n.Omega)-p*Math.sin(n.Omega)+E*Math.cos(I)*Math.cos(n.Omega);C=n.Omega%(2*Math.PI),C<0&&(C+=2*Math.PI);const a=(n.M+n.omega+Math.cos(I)*C+f+g-E*Math.sin(I)*C)%(2*Math.PI),o=C;C=Math.atan2(t,e),C<0&&(C+=2*Math.PI),Math.abs(C-o)>Math.PI&&(C1)throw{type:s.ERROR_PERT_ECCENTRICITY,message:"Eccentricity "+f.ecc+" invalid!"};r=p(E(t.tle,f,f.incl))}return t.lastTime=e,t.lastOsv=r,r.JT=n,r}function B(t,e,a){return P(t,1440*(e-t.tle.jtUt1Epoch),a)}function L(t,e,a){return B(t,c(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds()+.001*e.getUTCMilliseconds()),a)}return e})())); \ No newline at end of file diff --git a/index.html b/index.html index e725871..124a10c 100644 --- a/index.html +++ b/index.html @@ -61,7 +61,7 @@ - +