@saber-usa/node-common 1.7.37 → 1.7.39

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/astro.js +49 -13
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saber-usa/node-common",
3
- "version": "1.7.37",
3
+ "version": "1.7.39",
4
4
  "description": "Common node functions for Saber",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
package/src/astro.js CHANGED
@@ -334,44 +334,80 @@ const orbitalMeanMotionRevPerDay = (aKm, muKm3s2) => {
334
334
  };
335
335
 
336
336
  /**
337
- * Given eccentricity, inclination, meanmotion, and period
338
- * Calculates & returns type of orbit to include LEO, MEO, HEO, GEO Drifter, GEO Inclined,GEO Stationary, and undetermined if applicable
337
+ * Classify orbit regime using JCO v1.0.0 primary period/eccentricity cuts
338
+ * (Orbit_Class_Definitions_v1.0.0_11Jun2024.csv).
339
+ *
340
+ * Documentation:
341
+ * https://unifieddatalibrary.com/scs/download?id=/CommunityData/JCO_DOK/JCO_JSON_Requirements/Orbit_Class_Definitions_v1.0.0_11Jun2024.xlsx
342
+ *
343
+ * Symbols (from the `orbit` argument, case-insensitive keys via lowerCaseObjectKeys):
344
+ * - e — eccentricity (dimensionless), where: `orbit.eccentricity`
345
+ * - T — orbital period (minutes), where: `orbit.period`
346
+ * - n — mean motion (revolutions per day), where: `orbit.meanmotion`
347
+ * - i — inclination (degrees), where: `orbit.inclination`
348
+ *
349
+ * Evaluation order:
350
+ *
351
+ * 1. e ≥ 0.25 → HEO (4)
352
+ * 2. 1300 < T < 1800 → GEO family: GeoStationary (256), GeoInclined (8), or GeoDrifter (512)
353
+ * - 256 when 0.99 ≤ n ≤ 1.01 and i ≤ 0.01°
354
+ * - 8 when 0.99 ≤ n ≤ 1.01 and i > 0.01°
355
+ * - 512 for the remainder of the JCO GEO period window (near-geosync / drifters)
356
+ * 3. 600 < T < 900 → MEO (16)
357
+ * 4. T ≤ 225 → LEO (2)
358
+ * 5. else → Undetermined (1) — JCO OTHER, XGEO, and period gaps (no dedicated enums yet)
359
+ *
360
+ * Guards:
361
+ * - missing or undefined `orbit` → Undetermined (1)
362
+ * - missing e → Undetermined (1)
363
+ * - missing T, or T ≤ 0 → Undetermined (1)
364
+ * - GEO subclass (step 2) requires n and i; if either is missing → Undetermined (1)
365
+ *
339
366
  * @param {Object} orbit Object with keys eccentricity, inclination (deg), meanmotion (rev/day) and period (min)
340
- * @return {number} the regime index
367
+ * @return {number} REGIMES bitflag index (see constants.js)
341
368
  */
342
369
  const calcRegime = (orbit) => {
343
370
  if (!isDefined(orbit)) {
344
371
  return REGIMES.Undetermined;
345
372
  }
346
373
 
347
- const {eccentricity, inclination, meanmotion, period}
374
+ const {eccentricity: e, inclination: i, meanmotion: n, period: T}
348
375
  = lowerCaseObjectKeys(orbit);
349
376
 
350
- if (!isDefined(meanmotion) && (!isDefined(period) || !isDefined(eccentricity))) {
377
+ if (!isDefined(e)) {
351
378
  return REGIMES.Undetermined;
352
379
  }
353
380
 
354
- if (meanmotion >= 0.99 && meanmotion <= 1.01 && inclination <= 0.01) {
355
- return REGIMES.GeoStationary;
381
+ if (e >= 0.25) {
382
+ return REGIMES.Heo;
356
383
  }
357
384
 
358
- if (meanmotion >= 0.99 && meanmotion <= 1.01 && inclination > 0.01) {
359
- return REGIMES.GeoInclined;
385
+ if (!isDefined(T) || T <= 0) {
386
+ return REGIMES.Undetermined;
360
387
  }
361
388
 
362
- if (meanmotion >= 0.94 && meanmotion <= 1.06) {
389
+ if (T > 1300 && T < 1800) {
390
+ if (!isDefined(n) || !isDefined(i)) {
391
+ return REGIMES.Undetermined;
392
+ }
393
+ if (n >= 0.99 && n <= 1.01 && i <= 0.01) {
394
+ return REGIMES.GeoStationary;
395
+ }
396
+ if (n >= 0.99 && n <= 1.01 && i > 0.01) {
397
+ return REGIMES.GeoInclined;
398
+ }
363
399
  return REGIMES.GeoDrifter;
364
400
  }
365
401
 
366
- if (period >= 600 && period <= 800 && eccentricity < 0.25) {
402
+ if (T > 600 && T < 900) {
367
403
  return REGIMES.Meo;
368
404
  }
369
405
 
370
- if (meanmotion > 11.25 && eccentricity < 0.25) {
406
+ if (T <= 225) {
371
407
  return REGIMES.Leo;
372
408
  }
373
409
 
374
- return eccentricity > 0.25 ? REGIMES.Heo : REGIMES.Undetermined;
410
+ return REGIMES.Undetermined;
375
411
  };
376
412
 
377
413
  /**