@saber-usa/node-common 1.7.19 → 1.7.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/astro.js +68 -17
- package/src/wasmProp/wasmAstro.js +4 -4
package/package.json
CHANGED
package/src/astro.js
CHANGED
|
@@ -854,6 +854,17 @@ const doesLineSegmentIntersectEarth = (start, end) => {
|
|
|
854
854
|
{x: 0, y: 0, z: 0}, WGS72_EARTH_EQUATORIAL_RADIUS_KM);
|
|
855
855
|
};
|
|
856
856
|
|
|
857
|
+
const getRIC = (prim, target) => {
|
|
858
|
+
const deltaR = {
|
|
859
|
+
x: prim.p.x - target.p.x,
|
|
860
|
+
y: prim.p.y - target.p.y,
|
|
861
|
+
z: prim.p.z - target.p.z,
|
|
862
|
+
};
|
|
863
|
+
const cartToRICMatrix = cartesianToRIC(prim.p, prim.v);
|
|
864
|
+
const ricP = multiplyVector(deltaR, cartToRICMatrix);
|
|
865
|
+
return ricP;
|
|
866
|
+
};
|
|
867
|
+
|
|
857
868
|
/**
|
|
858
869
|
* Given primary and target ephems, calculate the time-based, radial, intrack, and crosstrack data
|
|
859
870
|
*
|
|
@@ -887,13 +898,7 @@ const getTRIC = (pEphem, tEphem) => {
|
|
|
887
898
|
datamodes.push(prim.datamode + ", " + target.datamode);
|
|
888
899
|
|
|
889
900
|
// Calculate RIC values.
|
|
890
|
-
const
|
|
891
|
-
x: prim.p.x - target.p.x,
|
|
892
|
-
y: prim.p.y - target.p.y,
|
|
893
|
-
z: prim.p.z - target.p.z,
|
|
894
|
-
};
|
|
895
|
-
const cartToRICMatrix = cartesianToRIC(prim.p, prim.v);
|
|
896
|
-
const ricP = multiplyVector(deltaR, cartToRICMatrix);
|
|
901
|
+
const ricP = getRIC(prim, target);
|
|
897
902
|
r.push(-1 * Math.round(ricP.x * 10000) / 10000);
|
|
898
903
|
i.push(-1 * Math.round(ricP.y * 10000) / 10000);
|
|
899
904
|
c.push(-1 * Math.round(ricP.z * 10000) / 10000);
|
|
@@ -1747,7 +1752,7 @@ const cartesianToElsetElements = (pv, epoch) => {
|
|
|
1747
1752
|
* @param {Array<{p:number[],v:number[],t:number}>} sEphem threat ephemeris
|
|
1748
1753
|
* @return {Object|undefined}
|
|
1749
1754
|
*/
|
|
1750
|
-
const assembleLeoRpoResult = (s, pEphem, sEphem) => {
|
|
1755
|
+
const assembleLeoRpoResult = (s, pEphem, sEphem, includeRIC=false) => {
|
|
1751
1756
|
if (!isDefined(pEphem)
|
|
1752
1757
|
|| !isDefined(sEphem)
|
|
1753
1758
|
|| pEphem.length === 0
|
|
@@ -1777,6 +1782,13 @@ const assembleLeoRpoResult = (s, pEphem, sEphem) => {
|
|
|
1777
1782
|
raanDiff: s.raanDiff,
|
|
1778
1783
|
semiMajorDiff: s.semiMajorDiff,
|
|
1779
1784
|
raanDrift: s.RaanPrecessionDegreesPerDay,
|
|
1785
|
+
...(includeRIC ? {
|
|
1786
|
+
r: [],
|
|
1787
|
+
i: [],
|
|
1788
|
+
c: [],
|
|
1789
|
+
d: [],
|
|
1790
|
+
t: [],
|
|
1791
|
+
} : {})
|
|
1780
1792
|
};
|
|
1781
1793
|
|
|
1782
1794
|
const pv1 = {position: pEphem[0].p, velocity: pEphem[0].v};
|
|
@@ -1789,10 +1801,26 @@ const assembleLeoRpoResult = (s, pEphem, sEphem) => {
|
|
|
1789
1801
|
};
|
|
1790
1802
|
|
|
1791
1803
|
for (let i = 0; i < pEphem.length; i++) {
|
|
1792
|
-
const
|
|
1804
|
+
const prim = pEphem[i];
|
|
1805
|
+
const target = sEphem[i];
|
|
1806
|
+
|
|
1807
|
+
const distKm = dist(prim.p, target.p);
|
|
1808
|
+
|
|
1809
|
+
if(includeRIC) {
|
|
1810
|
+
const ricP = getRIC(prim, target);
|
|
1811
|
+
|
|
1812
|
+
aResult.r.push(-1 * ricP.x);
|
|
1813
|
+
aResult.i.push(-1 * ricP.y);
|
|
1814
|
+
aResult.c.push(-1 * ricP.z);
|
|
1815
|
+
|
|
1816
|
+
aResult.t.push(prim.t);
|
|
1817
|
+
|
|
1818
|
+
aResult.d.push(distKm);
|
|
1819
|
+
}
|
|
1820
|
+
|
|
1793
1821
|
if (distKm < aResult.poca) {
|
|
1794
1822
|
aResult.poca = distKm;
|
|
1795
|
-
aResult.toca = new Date(
|
|
1823
|
+
aResult.toca = new Date(prim.t).toISOString();
|
|
1796
1824
|
aResult.tocaString = getTimeDifference(aResult.toca);
|
|
1797
1825
|
}
|
|
1798
1826
|
}
|
|
@@ -1803,7 +1831,7 @@ const assembleLeoRpoResult = (s, pEphem, sEphem) => {
|
|
|
1803
1831
|
return aResult;
|
|
1804
1832
|
};
|
|
1805
1833
|
|
|
1806
|
-
const getLeoRpoData = (line1, line2, sats, startTime, endTime) => {
|
|
1834
|
+
const getLeoRpoData = (line1, line2, sats, startTime, endTime, includeRIC=false) => {
|
|
1807
1835
|
const results = [];
|
|
1808
1836
|
const pSatRec = checkTle(line1, line2);
|
|
1809
1837
|
if (!isDefined(pSatRec)) {return results;}
|
|
@@ -1816,7 +1844,7 @@ const getLeoRpoData = (line1, line2, sats, startTime, endTime) => {
|
|
|
1816
1844
|
|
|
1817
1845
|
sats.forEach((s) => {
|
|
1818
1846
|
const sEphem = prop(s, start, end, 10000);
|
|
1819
|
-
const row = assembleLeoRpoResult(s, pEphem, sEphem);
|
|
1847
|
+
const row = assembleLeoRpoResult(s, pEphem, sEphem, includeRIC);
|
|
1820
1848
|
if (isDefined(row)) {results.push(row);}
|
|
1821
1849
|
});
|
|
1822
1850
|
return results;
|
|
@@ -1881,7 +1909,7 @@ const geoRelativeLonDrift = (lon1, drift1, lon2, drift2) => {
|
|
|
1881
1909
|
* @param {Object} sLonAndDrift output of `getLonAndDrift(threat)`
|
|
1882
1910
|
* @return {Object|undefined}
|
|
1883
1911
|
*/
|
|
1884
|
-
const assembleGeoRpoResult = (s, pEphem, sEphem, pLonAndDrift, sLonAndDrift) => {
|
|
1912
|
+
const assembleGeoRpoResult = (s, pEphem, sEphem, pLonAndDrift, sLonAndDrift, includeRIC=false) => {
|
|
1885
1913
|
if (!isDefined(pEphem)
|
|
1886
1914
|
|| !isDefined(sEphem)
|
|
1887
1915
|
|| pEphem.length === 0
|
|
@@ -1910,6 +1938,13 @@ const assembleGeoRpoResult = (s, pEphem, sEphem, pLonAndDrift, sLonAndDrift) =>
|
|
|
1910
1938
|
di: null,
|
|
1911
1939
|
dv: null,
|
|
1912
1940
|
danger: null,
|
|
1941
|
+
...(includeRIC ? {
|
|
1942
|
+
r: [],
|
|
1943
|
+
i: [],
|
|
1944
|
+
c: [],
|
|
1945
|
+
d: [],
|
|
1946
|
+
t: [],
|
|
1947
|
+
} : {})
|
|
1913
1948
|
};
|
|
1914
1949
|
|
|
1915
1950
|
const lonDiff = Math.abs(
|
|
@@ -1935,10 +1970,26 @@ const assembleGeoRpoResult = (s, pEphem, sEphem, pLonAndDrift, sLonAndDrift) =>
|
|
|
1935
1970
|
};
|
|
1936
1971
|
|
|
1937
1972
|
for (let i = 0; i < pEphem.length; i++) {
|
|
1938
|
-
const
|
|
1973
|
+
const prim = pEphem[i];
|
|
1974
|
+
const target = sEphem[i];
|
|
1975
|
+
|
|
1976
|
+
const distKm = dist(prim.p, target.p);
|
|
1977
|
+
|
|
1978
|
+
if(includeRIC) {
|
|
1979
|
+
const ricP = getRIC(prim, target);
|
|
1980
|
+
|
|
1981
|
+
aResult.r.push(-1 * ricP.x);
|
|
1982
|
+
aResult.i.push(-1 * ricP.y);
|
|
1983
|
+
aResult.c.push(-1 * ricP.z);
|
|
1984
|
+
|
|
1985
|
+
aResult.t.push(prim.t);
|
|
1986
|
+
|
|
1987
|
+
aResult.d.push(distKm);
|
|
1988
|
+
}
|
|
1989
|
+
|
|
1939
1990
|
if (distKm < aResult.poca) {
|
|
1940
1991
|
aResult.poca = distKm;
|
|
1941
|
-
aResult.toca = new Date(
|
|
1992
|
+
aResult.toca = new Date(prim.t).toISOString();
|
|
1942
1993
|
aResult.tocaString = getTimeDifference(aResult.toca);
|
|
1943
1994
|
}
|
|
1944
1995
|
}
|
|
@@ -1949,7 +2000,7 @@ const assembleGeoRpoResult = (s, pEphem, sEphem, pLonAndDrift, sLonAndDrift) =>
|
|
|
1949
2000
|
return aResult;
|
|
1950
2001
|
};
|
|
1951
2002
|
|
|
1952
|
-
const getGeoRpoData = (line1, line2, sats, startTime, endTime, lonTime) => {
|
|
2003
|
+
const getGeoRpoData = (line1, line2, sats, startTime, endTime, lonTime, includeRIC=false) => {
|
|
1953
2004
|
const results = [];
|
|
1954
2005
|
const start = new Date(startTime).getTime();
|
|
1955
2006
|
const end = new Date(endTime).getTime();
|
|
@@ -1964,7 +2015,7 @@ const getGeoRpoData = (line1, line2, sats, startTime, endTime, lonTime) => {
|
|
|
1964
2015
|
sats.forEach((s) => {
|
|
1965
2016
|
const sEphem = prop({Line1: s.Line1, Line2: s.Line2}, start, end, 60000);
|
|
1966
2017
|
const sLonAndDrift = getLonAndDrift(s.Line1, s.Line2, lonEvalTime);
|
|
1967
|
-
const row = assembleGeoRpoResult(s, pEphem, sEphem, pLonAndDrift, sLonAndDrift);
|
|
2018
|
+
const row = assembleGeoRpoResult(s, pEphem, sEphem, pLonAndDrift, sLonAndDrift, includeRIC);
|
|
1968
2019
|
if (isDefined(row)) {results.push(row);}
|
|
1969
2020
|
});
|
|
1970
2021
|
|
|
@@ -51,7 +51,7 @@ import {RAD2DEG} from "../constants.js";
|
|
|
51
51
|
* @param {Number} endTime end time of the analysis, Unix milliseconds
|
|
52
52
|
* @return {Promise<Array<Object>>}
|
|
53
53
|
*/
|
|
54
|
-
const getLeoRpoDataBulk = async (line1, line2, sats, startTime, endTime) => {
|
|
54
|
+
const getLeoRpoDataBulk = async (line1, line2, sats, startTime, endTime, includeRIC=false) => {
|
|
55
55
|
const results = [];
|
|
56
56
|
const pSatRec = checkTle(line1, line2);
|
|
57
57
|
if (!isDefined(pSatRec)) {return results;}
|
|
@@ -69,7 +69,7 @@ const getLeoRpoDataBulk = async (line1, line2, sats, startTime, endTime) => {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
for (let i = 0; i < sats.length; i++) {
|
|
72
|
-
const row = assembleLeoRpoResult(sats[i], pEphem, ephemerides[i + 1]);
|
|
72
|
+
const row = assembleLeoRpoResult(sats[i], pEphem, ephemerides[i + 1], includeRIC);
|
|
73
73
|
if (isDefined(row)) {results.push(row);}
|
|
74
74
|
}
|
|
75
75
|
return results;
|
|
@@ -97,7 +97,7 @@ const getLeoRpoDataBulk = async (line1, line2, sats, startTime, endTime) => {
|
|
|
97
97
|
* @param {Number} [lonTime] datetime to analyze longitude and lon drift at, Unix ms
|
|
98
98
|
* @return {Promise<Array<Object>>}
|
|
99
99
|
*/
|
|
100
|
-
const getGeoRpoDataBulk = async (line1, line2, sats, startTime, endTime, lonTime) => {
|
|
100
|
+
const getGeoRpoDataBulk = async (line1, line2, sats, startTime, endTime, lonTime, includeRIC=false) => {
|
|
101
101
|
const results = [];
|
|
102
102
|
const start = new Date(startTime).getTime();
|
|
103
103
|
const end = new Date(endTime).getTime();
|
|
@@ -116,7 +116,7 @@ const getGeoRpoDataBulk = async (line1, line2, sats, startTime, endTime, lonTime
|
|
|
116
116
|
const s = sats[i];
|
|
117
117
|
const sLonAndDrift = getLonAndDrift(s.Line1, s.Line2, lonEvalTime);
|
|
118
118
|
const row = assembleGeoRpoResult(s, pEphem, ephemerides[i + 1],
|
|
119
|
-
pLonAndDrift, sLonAndDrift);
|
|
119
|
+
pLonAndDrift, sLonAndDrift, includeRIC);
|
|
120
120
|
if (isDefined(row)) {results.push(row);}
|
|
121
121
|
}
|
|
122
122
|
|