@saber-usa/node-common 1.7.1 → 1.7.2
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 +48 -0
package/package.json
CHANGED
package/src/astro.js
CHANGED
|
@@ -1539,6 +1539,53 @@ const keplerianToCartesian = (elset, mu = 398600.4418) => {
|
|
|
1539
1539
|
}
|
|
1540
1540
|
};
|
|
1541
1541
|
|
|
1542
|
+
const cartesianToElsetElements = (pv, epoch) => {
|
|
1543
|
+
// sma, eccentricity, inclination, raan, argp, trueAnomaly
|
|
1544
|
+
const kepl = cartesianToKeplerian(
|
|
1545
|
+
multiply(posToArray(pv.position), 1000.0), // km to m
|
|
1546
|
+
multiply(posToArray(pv.velocity), 1000.0), // km/s to m/s
|
|
1547
|
+
);
|
|
1548
|
+
|
|
1549
|
+
const elset = {
|
|
1550
|
+
SemiMajorAxis: kepl.a,
|
|
1551
|
+
Eccentricity: kepl.e,
|
|
1552
|
+
Inclination: kepl.i,
|
|
1553
|
+
Raan: kepl.raan,
|
|
1554
|
+
ArgOfPerigee: kepl.w,
|
|
1555
|
+
};
|
|
1556
|
+
|
|
1557
|
+
// Mean motion in radians per second
|
|
1558
|
+
const mu = 3.986004418e14; // (m^3)/(s^2) WGS-84 Earth Mu
|
|
1559
|
+
const meanMotion = Math.sqrt(mu/Math.pow((elset.SemiMajorAxis*1000.0), 3));
|
|
1560
|
+
|
|
1561
|
+
elset.MeanMotion = meanMotion / (2*Math.PI) * 60 * 60 * 24; // rads/s to revs per day
|
|
1562
|
+
|
|
1563
|
+
const trueAnomaly = kepl.f;
|
|
1564
|
+
|
|
1565
|
+
// Compute Eccentric Anomaly from True Anomaly and Eccentricity
|
|
1566
|
+
const E = 2 * Math.atan2(Math.tan(trueAnomaly * DEG2RAD)
|
|
1567
|
+
* Math.sqrt(1-elset.Eccentricity), Math.sqrt(1+elset.Eccentricity));
|
|
1568
|
+
|
|
1569
|
+
// Compute Mean Anomaly from Eccentric Anomaly and Eccentricity
|
|
1570
|
+
elset.MeanAnomaly = (E - (elset.Eccentricity)*Math.sin(E)) * RAD2DEG;
|
|
1571
|
+
|
|
1572
|
+
elset.Period = 2*Math.PI/meanMotion / 60; // period in minutes
|
|
1573
|
+
elset.Apogee = elset.SemiMajorAxis * (1 + elset.Eccentricity); // km
|
|
1574
|
+
elset.Perigee = elset.SemiMajorAxis * (1 - elset.Eccentricity); // km
|
|
1575
|
+
|
|
1576
|
+
elset.Longitude = wrapToRange(
|
|
1577
|
+
eciToGeodetic(
|
|
1578
|
+
pv.position,
|
|
1579
|
+
gstime(new Date(parseDate(epoch))),
|
|
1580
|
+
).longitude*RAD2DEG,
|
|
1581
|
+
0, 360);
|
|
1582
|
+
|
|
1583
|
+
elset.LonDriftDegreesPerDay = null;
|
|
1584
|
+
elset.BStar = null;
|
|
1585
|
+
|
|
1586
|
+
return elset;
|
|
1587
|
+
};
|
|
1588
|
+
|
|
1542
1589
|
/**
|
|
1543
1590
|
* Get LEO RPO data for a given target satellite and a set of potential threat satellites.
|
|
1544
1591
|
* @param {String} line1, line 1 of the target satellite
|
|
@@ -3131,6 +3178,7 @@ export {REGIMES,
|
|
|
3131
3178
|
planeChangePureInclinationDeltaV,
|
|
3132
3179
|
cartesianToKeplerian,
|
|
3133
3180
|
keplerianToCartesian,
|
|
3181
|
+
cartesianToElsetElements,
|
|
3134
3182
|
getLeoRpoData,
|
|
3135
3183
|
getGeoRpoData,
|
|
3136
3184
|
getGeoShadowZones,
|