@essrt/physics 7.0.0 → 8.0.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.
package/src/model.js CHANGED
@@ -21,7 +21,6 @@ import { deriveEpochParams } from './layer0/derive-params.js';
21
21
  import * as FL from './planets/fibonacci-laws.cjs';
22
22
  import * as planetOrientation from './planets/orientation.cjs';
23
23
  import { createPhaseMachinery } from './phase/index.cjs';
24
- import { createCardinalModel } from './cardinal/index.cjs';
25
24
  import { createYearLengths, ONE_FAMILY_WINDOW_YEARS } from './earth/year-lengths.cjs';
26
25
  import { createDeepOrbitalHistory } from './earth/deep-orbital-history.cjs';
27
26
  import { CHAIN_ARTIFACT } from './planets/chain-artifact.js';
@@ -37,7 +36,6 @@ import { createChainCycleIntegrator } from './chain-cycles/index.cjs';
37
36
  import { createMoonArguments, jdToDecimalYear } from './moon/arguments.cjs';
38
37
  import { createMoonSeries } from './moon/series.cjs';
39
38
  import { createSunPlanetaryCompletion } from './eclipse/sun-planetary-completion.cjs';
40
- import { moonSeriesExtensionDeg } from './moon/series-extension.cjs';
41
39
  import { createEclipseFinders } from './eclipse/finders.cjs';
42
40
  import { createBesselian } from './eclipse/besselian.cjs';
43
41
  import { driver2PeriodSecondsAtAge } from './planets/orbit-chain.cjs';
@@ -102,7 +100,6 @@ export function assembleModel(C, F, laws = {}, secularSeriesArtifact = /** @type
102
100
  // wobble-marker distance). It is the K calibration input ONLY — Earth's
103
101
  // eccentricity law does not use it; see eccentricityAt (base' derived) below.
104
102
  const eccentricityAmplitude = C.earth.eccentricityAmplitude;
105
- const earthRAAngle = 2 * earthInclAmplitude - (earthInclAmplitude * earthInclAmplitude) / earthtiltMean;
106
103
  const earthInclMean = C.earthOrbital.earthInclinationJ2000_deg
107
104
  - earthInclAmplitude * Math.cos(((C.earthOrbital.earthPerihelionLongitudeJ2000
108
105
  - C.earthOrbital.earthInclinationCycleAnchor) * Math.PI) / 180);
@@ -426,7 +423,6 @@ export function assembleModel(C, F, laws = {}, secularSeriesArtifact = /** @type
426
423
  /** de/dyear of the Sun's e — the cardinal braid's equation-of-centre
427
424
  * derivative rides it (±0.5-yr central difference; the constant offset
428
425
  * cancels). @param {number} year @returns {number} */
429
- const sunEccentricityRateAt = laws.eccentricityRateAt ?? ((year) => oneSourceM.eAt(year + 0.5) - oneSourceM.eAt(year - 0.5));
430
426
  /** @param {number} year @returns {number} */
431
427
  const inclinationDeg = (year) => earthInclMean
432
428
  - earthInclAmplitude * Math.cos(phaseRadians(balancedYear, year, 3));
@@ -502,39 +498,13 @@ export function assembleModel(C, F, laws = {}, secularSeriesArtifact = /** @type
502
498
  + RA_DAY_OFFSET_ECC_MS * Math.cos(phaseRadians(balancedYear, year, 16))
503
499
  + RA_DAY_OFFSET_OBLIQ_MS * Math.cos(phaseRadians(balancedYear, year, 8));
504
500
 
505
- // ── Cardinal-point model ──────────────────────────────────────────────────
506
- const cardinalM = createCardinalModel({
507
- isDeepTime: () => true,
508
- constants: {
509
- anchors: F.CARDINAL_POINT_ANCHORS_ADJUSTED,
510
- harmonics: F.CARDINAL_POINT_HARMONICS,
511
- eccTerms: F.CARDINAL_POINT_ECC_TERMS,
512
- jointTerms: F.CARDINAL_POINT_JOINT_TERMS,
513
- derived: F.CARDINAL_POINT_DERIVED,
514
- tropicalHarmonics: F.TROPICAL_YEAR_HARMONICS,
515
- balancedYear,
516
- meanSolarYearDays,
517
- hJ2000: H,
518
- tiltMeanDeg: earthtiltMean,
519
- raAngleDeg: earthRAAngle,
520
- inclAmplitudeDeg: earthInclAmplitude,
521
- },
522
- fns: {
523
- cyclesBetween: (a, b, n) => phase().cyclesBetween(a, b, n),
524
- // The frozen era clock's deps ride ITS convention H_era (plan 06 D8):
525
- // drift integrand, dc/dY and the real-LOD convention were fitted on it.
526
- analyticTropicalDays: (year) => {
527
- const tMa = (startmodelYear - year) / 1e6;
528
- const Ht = deepLod.eraClockHAtAge(tMa);
529
- if (Ht === null) return null;
530
- return (deepLod.siderealYearSecondsAtAge(tMa) / 86400) * (1 - 13 / Ht);
531
- },
532
- meanHAtAgeMa: (tMa) => deepLod.eraClockHAtAge(tMa),
533
- meanYearRealLodDays: (tMa) => deepLod.eraClockYearInDaysAtAge(tMa),
534
- eccentricityAt: sunEccentricityAt,
535
- eccentricityRateAt: sunEccentricityRateAt,
536
- },
537
- });
501
+ // ── Cardinal points (the fitted model retired, R1)──────────────────────────────────────────────────
502
+ // Plan 06 R1: the fitted cardinal-point model (CARDINAL_POINT_* — the §10
503
+ // derived form on the frozen era clock, fitted to the retired K scene's
504
+ // events; measured 60–140 min from Meeus ch. 27 at 0..−1000 and 6–25 min
505
+ // in 1500–2900) left this package. The instants are the CROSSINGS of the
506
+ // one Sun the scene renders and the eclipse chain certifies — see
507
+ // `cardinalCrossingJdUT` below the finders.
538
508
  // ── One-source cardinal structure (D4b) ───────────────────────────────────
539
509
  // The EoC layer (year lengths, crossing offsets, the e(t)-proportional
540
510
  // spread) on the one-source movement's own e(t)/ϖ(t) — the MODE tier (the
@@ -646,9 +616,19 @@ export function assembleModel(C, F, laws = {}, secularSeriesArtifact = /** @type
646
616
  };
647
617
  })();
648
618
  const yearLengthsM = oneSourceM.yearLengths;
619
+ /** THE one-family tropical year of date in SI seconds: route B inside the
620
+ * one-family window, the tidal-chain year beyond (plan 06 R1 — the Sun's
621
+ * mean longitude, the cardinal instants and the published year lengths
622
+ * all ride this one function). @param {number} year @returns {number} */
623
+ const oneFamilyTropicalYearSeconds = (year) => (Math.abs(year - 2000) <= ONE_FAMILY_WINDOW_YEARS
624
+ ? yearLengthsM.tropicalYearSecondsAtYear(year)
625
+ : (deepLod.tropicalYearSecondsAtAge(yearToTMa(year)) ?? meanSolarYearDays * 86400));
649
626
 
650
- /** Tropical year: mean of the four cardinal intervals. @param {number} year @returns {number} */
651
- const tropicalYearDays = (year) => cardinalM.computeTropicalYearLength(year);
627
+ /** Tropical year of date in DAYS OF THE EPOCH (the kinematic day below) —
628
+ * the one-family SI year over the epoch's day length, so solarYearSeconds
629
+ * ≡ the one-family year. Plan 06 R1: formerly the fitted cardinal model's
630
+ * 4-mean. @param {number} year @returns {number} */
631
+ const tropicalYearDays = (year) => oneFamilyTropicalYearSeconds(year) / dayLengthSeconds(year);
652
632
  /** @param {number} year @returns {number} */
653
633
  const tropicalYearDirectDays = (year) => evalYearFourier(year, tropicalYearDaysBase(year), F.TROPICAL_YEAR_HARMONICS);
654
634
 
@@ -1113,65 +1093,73 @@ export function assembleModel(C, F, laws = {}, secularSeriesArtifact = /** @type
1113
1093
  // same movement and is retired by the unification (measured identical on
1114
1094
  // every modern gate).
1115
1095
  const sunMeanLongitudeDegAt = (() => {
1116
- // SW PHASE B — the CLOSED FORM on the integrated lattice phase
1117
- // (supersedes the E5 ±3,000-yr trapezoid table; valid at EVERY epoch,
1118
- // no table, no domain window). drift = D_smooth + Σₖ D_k + D_torque:
1119
- // · D_smooth — the deep chain's smooth SI tropical-year physics
1120
- // (tropicalYearDaysBase × LOD), two-point trapezoid: the same
1121
- // structure the scene twin uses, so the scene δ stays bounded.
1122
- // · Each oscillatory term integrates ANALYTICALLY: the antiderivative
1123
- // of cos/sin on the integrated phase is (H/2πk)·[sin/−cos] — the H
1124
- // drift lives in the phase itself; the amplitude factor uses H_J2000
1125
- // (ppm-class difference, negligible).
1126
- // · THE REBASE (E5's corpus-preferred J2000 rate anchor) is applied
1127
- // PER HARMONIC as a SIN-SATURATED ramp, (H/2πk)·sin(Δφₖ): equal to
1128
- // the linear rebase for |Δφₖ| ≪ 1 (the corpus era) and bounded by
1129
- // the harmonic's own period beyond — extending a linearized local
1130
- // slope to deep time would be the fitted-linear-slope trap. Every
1131
- // quantity is derived; zero new constants; each component and its
1132
- // slope vanish at year 2000 by construction (the drift-only
1133
- // property is exact, not tabulated).
1134
- const RATE_LIN = sunTropicalRateDegPerCy / 100; // deg / SI yr
1135
- const precessionP0DegPerYr = 13 * 360 / H;
1136
- const tanEps = Math.tan(earthtiltMean * Math.PI / 180);
1137
- const A_RAD = earthInclAmplitude * Math.PI / 180;
1138
- /** @param {number} year @returns {number} */
1139
- const rateSmooth = (year) => 360 * (365.25 * 86400)
1140
- / (tropicalYearDaysBase(year)
1141
- * (deepLod.lodSecondsAtAge(yearToTMa(year)) ?? meanLengthOfDay));
1142
- /** @type {{rateSm0: number, ph0: Map<number, number>}|null} */
1143
- let anchor = null;
1144
- return /** @param {number} year @returns {number} */ (year) => {
1145
- if (anchor === null) {
1146
- const ph0 = new Map();
1147
- for (const [k] of F.TROPICAL_YEAR_HARMONICS) ph0.set(k, phaseRadians(balancedYear, 2000, k));
1148
- for (const k of [3, 8]) if (!ph0.has(k)) ph0.set(k, phaseRadians(balancedYear, 2000, k));
1149
- anchor = { rateSm0: rateSmooth(2000), ph0 };
1150
- }
1096
+ // Plan 06 R1 — the Sun's mean longitude of date is the INTEGRAL of the
1097
+ // one-source tropical year: L(t) = L0 + 360·∫_{2000}^{t} dt′/T_trop(t′),
1098
+ // T_trop the route-B tropical year of date in SI seconds (the ONE
1099
+ // year-length family; the frozen era clock's tropicalYearDaysBase × LOD
1100
+ // and its comb ripple + torque term left here). MEASURED before the
1101
+ // move (tools/explore r1 probes, plan 06 record): the route-B tropical
1102
+ // year equals the IAU/Laskar drift expression to 0.1 s over −1000..+3000
1103
+ // while the era-clock year carried NO secular drift (+1.09 s flat), so
1104
+ // the former mean longitude wandered +12 min around 500 AD and diverged
1105
+ // −3.3 min/cy after 2100 against both Meeus ch. 27 and the one-source
1106
+ // integral — outside every eclipse and JPL gate. MODERN-WINDOW COST,
1107
+ // stated (plan 06 I1 corrected an earlier misreading of the cache's
1108
+ // clock): against the JPL Sun cache (UT instants, verified; the registry
1109
+ // instrument's bridge) the one-source Sun read 1.29″ sd in 1970–2049
1110
+ // where the era-clock Sun read 0.80″ — both carried ~0.02–0.03″/yr
1111
+ // trends against JPL over 1900–2100; accepted because over millennia
1112
+ // the era-clock Sun is minutes off. Plan 06 I2 located the trend: the
1113
+ // Earth–Mars–Jupiter long inequality (1783 yr, 6.3″) the smooth year
1114
+ // cannot carry — derived on the model's own N-body and shipped in the
1115
+ // planetary completion, the instrument reads 1.03″ (Horizons ±3000 yr:
1116
+ // modern-window mean +8.4 → +0.8″, per-millennium sd roughly halved).
1117
+ // NUMERICS (rate vs point value): a cumulative trapezoid table of
1118
+ // cycles, yearly inside ±20,000 yr and per century beyond, grown on
1119
+ // demand from 2000 in both directions and interpolated inside a cell —
1120
+ // never a rate multiplied by a span. Beyond the one-family window the
1121
+ // tidal-chain year continues the integrand (the scene overlay ends at
1122
+ // 20,000 yr; the finders refuse out-of-domain epochs upstream).
1123
+ const JULIAN_YEAR_S = 365.25 * 86400;
1124
+ const tropSec = oneFamilyTropicalYearSeconds;
1125
+ const FINE_SPAN = 20000, COARSE_STEP = 100;
1126
+ /** cycles from 2000 to 2000 ± i·step (fwd/bwd tiers) */
1127
+ /** @type {number[]} */ const fwdFine = [0];
1128
+ /** @type {number[]} */ const bwdFine = [0];
1129
+ /** @type {number[]} */ const fwdCoarse = [];
1130
+ /** @type {number[]} */ const bwdCoarse = [];
1131
+ /** UNSIGNED trapezoid cycles over the span between two years (Julian
1132
+ * years → SI seconds over the one-family year); the caller applies the
1133
+ * direction sign. @param {number} ya @param {number} yb @returns {number} */
1134
+ const segAbs = (ya, yb) => 0.5 * (Math.abs(yb - ya) * JULIAN_YEAR_S) * (1 / tropSec(ya) + 1 / tropSec(yb));
1135
+ /** signed cycles from 2000 to `year` @param {number} year @returns {number} */
1136
+ const cyclesTo = (year) => {
1151
1137
  const dy = year - 2000;
1152
- // smooth deep physics (two-point trapezoid; exact 0 at 2000)
1153
- let drift = 0.5 * (rateSmooth(year) - anchor.rateSm0) * dy;
1154
- // year-harmonic ripple: rate ≈ −(RATE_LIN/T̄)·h(y); antiderivative +
1155
- // sin-saturated per-harmonic rebase
1156
- const HK = H / (2 * Math.PI);
1157
- for (const [k, sK, cK] of F.TROPICAL_YEAR_HARMONICS) {
1158
- const ph = phaseRadians(balancedYear, year, k);
1159
- const ph0 = /** @type {number} */ (anchor.ph0.get(k));
1160
- const scale = -(RATE_LIN / meanSolarYearDays) * (HK / k);
1161
- const anti = (-sK) * (Math.cos(ph) - Math.cos(ph0)) + cK * (Math.sin(ph) - Math.sin(ph0));
1162
- const h0 = sK * Math.sin(ph0) + cK * Math.cos(ph0);
1163
- drift += scale * (anti - h0 * Math.sin(ph - ph0));
1138
+ const s = dy >= 0 ? 1 : -1, a = Math.abs(dy);
1139
+ // WARM THE SAMPLER TO THE TARGET FIRST (plan 06 R4, measured): the
1140
+ // table below grows outward in 1-yr / 100-yr steps, and every step
1141
+ // beyond ~1.6 Myr enlarged the one-family sampler's >2-Myr tier just
1142
+ // past its span, rebuilding the whole deep integration about every 32
1143
+ // steps — ~125 rebuilds and 22 s for the first deep-epoch call (the
1144
+ // scene's first jump to −5 Myr), 0.4 ms once built. One read at the
1145
+ // clamped target builds the tier at its final span; the grid stores
1146
+ // are endpoint-independent, so every value is bit-identical.
1147
+ tropSec(2000 + s * Math.min(a, ONE_FAMILY_WINDOW_YEARS));
1148
+ const fine = s > 0 ? fwdFine : bwdFine;
1149
+ const growFine = (/** @type {number} */ upto) => { while (fine.length <= upto) { const k = fine.length; fine.push(fine[k - 1] + s * segAbs(2000 + s * (k - 1), 2000 + s * k)); } };
1150
+ if (a <= FINE_SPAN) {
1151
+ const i = Math.floor(a), f = a - i;
1152
+ growFine(i + 1);
1153
+ return fine[i] + f * (fine[i + 1] - fine[i]);
1164
1154
  }
1165
- // torque (E5): rate = −p₀·tanε·δε, δε = A(−cos φ₃ + cos φ₈); same
1166
- // antiderivative + per-component sin-saturated rebase
1167
- for (const [k, sgn] of [[3, -1], [8, 1]]) {
1168
- const ph = phaseRadians(balancedYear, year, k);
1169
- const ph0 = /** @type {number} */ (anchor.ph0.get(k));
1170
- const scale = -precessionP0DegPerYr * tanEps * A_RAD * sgn * (HK / k);
1171
- drift += scale * ((Math.sin(ph) - Math.sin(ph0)) - Math.cos(ph0) * Math.sin(ph - ph0));
1172
- }
1173
- return sunL0Deg + sunTropicalRateDegPerCy * dy / 100 + drift;
1155
+ growFine(FINE_SPAN);
1156
+ const coarse = s > 0 ? fwdCoarse : bwdCoarse;
1157
+ if (coarse.length === 0) coarse.push(fine[FINE_SPAN]);
1158
+ const c = (a - FINE_SPAN) / COARSE_STEP, ci = Math.floor(c), cf = c - ci;
1159
+ while (coarse.length <= ci + 1) { const k = coarse.length; const y0 = 2000 + s * (FINE_SPAN + (k - 1) * COARSE_STEP); coarse.push(coarse[k - 1] + s * segAbs(y0, y0 + s * COARSE_STEP)); }
1160
+ return coarse[ci] + cf * (coarse[ci + 1] - coarse[ci]);
1174
1161
  };
1162
+ return /** @param {number} year @returns {number} */ (year) => sunL0Deg + 360 * cyclesTo(year);
1175
1163
  })();
1176
1164
 
1177
1165
  // Eclipse finders — wired like the engine probe (tools/verify/
@@ -1213,20 +1201,34 @@ export function assembleModel(C, F, laws = {}, secularSeriesArtifact = /** @type
1213
1201
  // μ = 1/(1+M_E/M_M) — 6.4399″ at current constants, tracks them live.
1214
1202
  const embWobbleArcsec = (moonDistanceKm / (MASS_RATIO_EARTH_MOON + 1) / currentAUDistance)
1215
1203
  * (648000 / Math.PI);
1216
- // FQ-5 N3 — the completion's carriers are FRAMEWORK-derived: one
1217
- // revolution per the model's own tropical period records (Earth from
1218
- // the framework mean solar year; the Moon-elongation rate from the
1219
- // sidereal month/year identity). The v3 table's amplitudes were
1220
- // re-extracted on exactly these rates (the carrier↔table matched pair).
1204
+ // FQ-5 N3 — the completion's carriers are FRAMEWORK-derived from the
1205
+ // model's own planet period records (the Moon-elongation rate from the
1206
+ // sidereal month/year identity). Plan 06 I2 — the carriers are SIDEREAL
1207
+ // (measured): the records' solarYearInput are OF-DATE periods (their
1208
+ // rates sit +1.39..1.62°/cy above the VSOP sidereal mean motions — the
1209
+ // framework precession plus input rounding), and a perturbation argument
1210
+ // is inertial (D'Alembert: only Σk = 0 arguments are frame-free), so on
1211
+ // of-date carriers every Σk ≠ 0 argument drifted by Σk·ψ(t) — 42..52° at
1212
+ // −3000 for the table's Σk = −1 terms (their ancient scatter against
1213
+ // Horizons 6.4 → 4.4″ on sidereal carriers), and 6 % of frequency for the
1214
+ // 1783-yr long inequality (1683 yr on the of-date carriers). Constant-free:
1215
+ // the record rate minus the model's own J2000 precession p₀ =
1216
+ // 360·36525·(1/T_trop − 1/T_sid) for the planets, the framework sidereal
1217
+ // year for Earth; identical to the N3 carriers at J2000 (same phase
1218
+ // anchors), ≤ 1.4°·|Σk| apart at the 200-yr extraction window's edges
1219
+ // (the composed table reproduces the N3 one there: JPL 1900–2100
1220
+ // all-phase sd unchanged to 0.01″). The parity gate's fingerprint mirrors
1221
+ // this arithmetic (test/create-model-parity.test.mjs).
1221
1222
  const degPerCyOf = /** @param {number} cyclesPerDay */ (cyclesPerDay) => 360 * 36525 * cyclesPerDay;
1223
+ const carrierPrecessionDegPerCy = degPerCyOf(1 / meanSolarYearDays) - degPerCyOf(1 / meanSiderealYearDays);
1222
1224
  const carrierRatesDegPerCy = {
1223
1225
  planets: [
1224
- degPerCyOf(1 / C.planetOrbitalElements.mercury.solarYearInput),
1225
- degPerCyOf(1 / C.planetOrbitalElements.venus.solarYearInput),
1226
- degPerCyOf(1 / meanSolarYearDays),
1227
- degPerCyOf(1 / C.planetOrbitalElements.mars.solarYearInput),
1228
- degPerCyOf(1 / C.planetOrbitalElements.jupiter.solarYearInput),
1229
- degPerCyOf(1 / C.planetOrbitalElements.saturn.solarYearInput),
1226
+ degPerCyOf(1 / C.planetOrbitalElements.mercury.solarYearInput) - carrierPrecessionDegPerCy,
1227
+ degPerCyOf(1 / C.planetOrbitalElements.venus.solarYearInput) - carrierPrecessionDegPerCy,
1228
+ degPerCyOf(1 / meanSiderealYearDays),
1229
+ degPerCyOf(1 / C.planetOrbitalElements.mars.solarYearInput) - carrierPrecessionDegPerCy,
1230
+ degPerCyOf(1 / C.planetOrbitalElements.jupiter.solarYearInput) - carrierPrecessionDegPerCy,
1231
+ degPerCyOf(1 / C.planetOrbitalElements.saturn.solarYearInput) - carrierPrecessionDegPerCy,
1230
1232
  ],
1231
1233
  moonElongation: degPerCyOf(1 / moonSiderealMonthInput - 1 / meanSiderealYearDays),
1232
1234
  };
@@ -1238,7 +1240,10 @@ export function assembleModel(C, F, laws = {}, secularSeriesArtifact = /** @type
1238
1240
  },
1239
1241
  sunLonDegAt: /** @param {number} jdUT */ (jdUT) => eclipseFinders.sunLonDegAt(jdUT),
1240
1242
  sunCompletionDeg: sunPlanetaryCompletionDeg,
1241
- moonExtensionAt: moonSeriesExtensionDeg,
1243
+ // plan 06 R3 item 1: the location tier on APPARENT places — the Sun's derived κ
1244
+ // (the same helper the cardinal instants use), the Moon's relative light-time
1245
+ // inside the besselian; the series-extension tail now lives in sceneEvalAt.
1246
+ sunAberrationDegAt: /** @param {number} year */ (year) => sunAberrationArcsecAt(year) / 3600,
1242
1247
  deltaTSecondsAt: /** @param {number} jd */ (jd) => (jdTTFromUT(jd) - jd) * 86400,
1243
1248
  obliquityDegAt: obliquityDeg,
1244
1249
  eccentricityAt: sunEccentricityAt,
@@ -1256,6 +1261,7 @@ export function assembleModel(C, F, laws = {}, secularSeriesArtifact = /** @type
1256
1261
  gmstMeanSiderealT0Deg: C.physicalConstants.gmstMeanSiderealT0Deg,
1257
1262
  gmstMeanSiderealRateDegPerDay: C.physicalConstants.gmstMeanSiderealRateDegPerDay,
1258
1263
  gmstMeanSiderealT2Deg: C.physicalConstants.gmstMeanSiderealT2Deg,
1264
+ speedOfLightKmS: C.physicalConstants.speedOfLight,
1259
1265
  },
1260
1266
  });
1261
1267
 
@@ -1277,6 +1283,93 @@ export function assembleModel(C, F, laws = {}, secularSeriesArtifact = /** @type
1277
1283
  if (Math.abs(year - 2000) <= ONE_FAMILY_WINDOW_YEARS) return yearLengthsM.tropicalYearSecondsAtYear(year);
1278
1284
  return deepLod.tropicalYearSecondsAtAge(yearToTMa(year));
1279
1285
  };
1286
+ // ── Cardinal instants (plan 06 R1) ─────────────────────────────────────
1287
+ /** The completed certified Sun (finder Sun − the derived planetary
1288
+ * completion) at a UT model-JD — the same longitude the scene renders
1289
+ * inside the overlay window; MEAN GEOMETRIC, mean equinox of date.
1290
+ * @param {number} jdUT @returns {number} */
1291
+ const sunLonCompletedDegAtJdUT = (jdUT) => eclipseFinders.sunLonDegAt(jdUT)
1292
+ - sunPlanetaryCompletionDeg((jdTTFromUT(jdUT) - j2000JD) / julianCenturyDays);
1293
+ /** The APPARENT Sun the cardinal instants are defined on (an equinox is
1294
+ * the apparent Sun crossing the equator — the USNO/Meeus instants are
1295
+ * apparent): the completed geometric Sun minus the aberration constant,
1296
+ * plus the nutation in longitude. Both derived, zero new constants —
1297
+ * κ = 2π·a/(c·T_sid·√(1−e²)) from the AU, c, the one-family sidereal year
1298
+ * and the Sun's e (20.50″ at J2000); Δψ from the four IAU 1980 leading
1299
+ * terms on the model's OWN lunar node, mean Sun and mean Moon (the
1300
+ * framework arguments), the same family the registry's JPL Sun
1301
+ * instrument bridges with. @param {number} jdUT @returns {number} */
1302
+ /** The Sun's derived aberration constant of date, arcsec — κ = 2π·a/(c·T_sid·√(1−e²))
1303
+ * from the AU, c, the one-family sidereal year and the Sun's e (20.50″ at
1304
+ * J2000); ONE home for the cardinal instants and the eclipse location tier.
1305
+ * @param {number} year @returns {number} */
1306
+ const sunAberrationArcsecAt = (year) => {
1307
+ const e = sunEccentricityAt(year);
1308
+ return (2 * Math.PI * currentAUDistance
1309
+ / (C.physicalConstants.speedOfLight * yearLengthsM.siderealYearSecondsAtYear(year) * Math.sqrt(1 - e * e)))
1310
+ * (648000 / Math.PI);
1311
+ };
1312
+ /** @param {number} jdUT @returns {number} */
1313
+ const sunApparentLonDegAtJdUT = (jdUT) => {
1314
+ const jdTT = jdTTFromUT(jdUT);
1315
+ const year = 2000 + (jdTT - j2000JD) / 365.25;
1316
+ const kappaArcsec = sunAberrationArcsecAt(year);
1317
+ const a = moonArgs.argsAt(jdTT);
1318
+ const d2r = Math.PI / 180;
1319
+ const Om = (a.Lp - a.F) * d2r, Ls = (a.Lp - a.D) * d2r, Lm = a.Lp * d2r;
1320
+ const NU = C.physicalConstants.nutationLeadingTermsArcsec;
1321
+ const dPsiArcsec = NU.psiOmega * Math.sin(Om) + NU.psi2Ls * Math.sin(2 * Ls)
1322
+ + NU.psi2Lm * Math.sin(2 * Lm) + NU.psi2Omega * Math.sin(2 * Om);
1323
+ return sunLonCompletedDegAtJdUT(jdUT) + (dPsiArcsec - kappaArcsec) / 3600;
1324
+ };
1325
+ /** @param {string} type @returns {number} */
1326
+ const cardinalTargetDeg = (type) => {
1327
+ const t = { VE: 0, SS: 90, AE: 180, WS: 270 }[type];
1328
+ if (t === undefined) throw new RangeError(`cardinal type must be VE|SS|AE|WS, got ${type}`);
1329
+ return t;
1330
+ };
1331
+ const CARDINAL_SI_YEAR_D = 365.2422;
1332
+ /** The crossing NEAREST a seed instant — the unique root within ±½ tropical
1333
+ * year of the seed (the wrapped longitude difference is the Newton residual).
1334
+ * Plan 06 R4c: the seed is a JD because the caller's year may live on a
1335
+ * different axis than the model year — the simulator's cardinal panel
1336
+ * labels its year with the displayed CALENDAR date (the Julian calendar
1337
+ * before 1582, 365.25-d years) while `year` below is the model year (the SI
1338
+ * axis, 365.2422-d count from J2000); the two part by 0.0078 d/yr, 114 yr at
1339
+ * −5.34 Myr, where the panel showed the events of −5341772 for a date in
1340
+ * −5341886 (owner). Seeding at the calendar year's midpoint returns that
1341
+ * year's own events at every epoch. @param {number} jdSeedUT @param {string} type @returns {number} */
1342
+ const cardinalCrossingNearJdUT = (jdSeedUT, type) => {
1343
+ const target = cardinalTargetDeg(type);
1344
+ const RATE = 360 / CARDINAL_SI_YEAR_D;
1345
+ let jd = jdSeedUT;
1346
+ for (let i = 0; i < 20; i++) {
1347
+ const d = ((((sunApparentLonDegAtJdUT(jd) - target) + 540) % 360 + 360) % 360) - 180;
1348
+ jd -= d / RATE;
1349
+ if (Math.abs(d) < 1e-10) break;
1350
+ }
1351
+ return jd - C.earthOrbital.deltaTStart / 86400;
1352
+ };
1353
+ /** The TRUE-UT JD at which the APPARENT Sun's longitude of date equals
1354
+ * the cardinal target in the given year — Newton on the crossing (the
1355
+ * Sun's rate 360°/tropical year; a handful of steps from the tropical-year
1356
+ * seed). Replaces the fitted cardinal model's instants (R1). Plan 06 R3
1357
+ * item 2: the Newton root lives on the FINDER axis (the curve-only ΔT the
1358
+ * eclipse finders certify), and the returned instant is that root minus the
1359
+ * deltaTStart bridge — true UT = TT − (deltaTStart + curve), the same
1360
+ * bridge the besselian and the registry instruments apply. Before this the
1361
+ * published instants were 54.55 s (0.9 min) late. Against Horizons over
1362
+ * ±3000 yr the remaining offset is the Sun's (plan 06 I2 measured).
1363
+ * `year` is the MODEL year (the SI axis) — see cardinalCrossingNearJdUT.
1364
+ * @param {number} year @param {string} type @returns {number} */
1365
+ const cardinalCrossingJdUT = (year, type) => {
1366
+ const target = cardinalTargetDeg(type);
1367
+ // seed: Jan 1.5 of the year (J2000 = 2000 Jan 1.5) + the mean date of the
1368
+ // March equinox (day 79.3) + the quarter-turns to the target
1369
+ const seed = j2000JD + (year - 2000) * CARDINAL_SI_YEAR_D + 79.3 + (target / 360) * CARDINAL_SI_YEAR_D;
1370
+ return cardinalCrossingNearJdUT(seed, type);
1371
+ };
1372
+
1280
1373
  return Object.freeze({
1281
1374
  time: Object.freeze({
1282
1375
  yearFromJD,
@@ -1399,13 +1492,18 @@ export function assembleModel(C, F, laws = {}, secularSeriesArtifact = /** @type
1399
1492
  measuredSolarDaySeconds,
1400
1493
  raDayOffsetMs,
1401
1494
  }),
1495
+ // Plan 06 R1: the instants are the crossings of the ONE Sun (the
1496
+ // certified completed Sun the scene renders), UT model-JD; the RA at a
1497
+ // crossing is the target longitude by construction (λ = 0/90/180/270 ⇒
1498
+ // RA = 0/90/180/270, any obliquity); the per-type year length is the
1499
+ // interval between successive crossings (SI days).
1402
1500
  cardinal: Object.freeze({
1403
- jd: /** @param {number} year @param {string} type @returns {number} */ (year, type) => cardinalM.computeSolsticeJD(year, type),
1404
- raDeg: /** @param {number} year @param {string} type @returns {number} */ (year, type) => {
1405
- const ra = cardinalM.computeSolsticeRA(year, type);
1406
- return ((ra % 360) + 360) % 360;
1407
- },
1408
- yearLengthDays: /** @param {number} year @param {string} type @returns {number} */ (year, type) => cardinalM.computeSolsticeYearLength(year, type),
1501
+ jd: /** @param {number} year @param {string} type @returns {number} */ (year, type) => cardinalCrossingJdUT(year, type),
1502
+ // R4c: the crossing nearest a UT instant (a JD seed — for callers whose
1503
+ // year coordinate is not the model year, e.g. a calendar year's midpoint).
1504
+ jdNearUT: /** @param {number} jdUT @param {string} type @returns {number} */ (jdUT, type) => cardinalCrossingNearJdUT(jdUT, type),
1505
+ raDeg: /** @param {number} year @param {string} type @returns {number} */ (year, type) => { void year; return cardinalTargetDeg(type); },
1506
+ yearLengthDays: /** @param {number} year @param {string} type @returns {number} */ (year, type) => cardinalCrossingJdUT(year + 1, type) - cardinalCrossingJdUT(year, type),
1409
1507
  }),
1410
1508
  // D4b: the one-source cardinal STRUCTURE — the EoC layer on the
1411
1509
  // movement's own e(t)/ϖ(t), valid at every epoch (mode tier). Absolute
@@ -1449,6 +1547,8 @@ export function assembleModel(C, F, laws = {}, secularSeriesArtifact = /** @type
1449
1547
  sunLonCompletedDegAtJD: /** @param {number} jd @returns {number} */ (jd) =>
1450
1548
  eclipseFinders.sunLonDegAt(jd)
1451
1549
  - sunPlanetaryCompletionDeg((jdTTFromUT(jd) - j2000JD) / julianCenturyDays),
1550
+ /** The APPARENT Sun (completed geometric − the derived aberration constant + the leading nutation terms on the model's own arguments) — the quantity Horizons' observer ecliptic longitude is; the cardinal instants are its crossings (plan 06 R1/I1). @param {number} jdUT @returns {number} */
1551
+ sunApparentLonDegAtJD: /** @param {number} jdUT @returns {number} */ (jdUT) => sunApparentLonDegAtJdUT(jdUT),
1452
1552
  findLunarInRange: /** @param {number} jdStart @param {number} jdEnd */ (jdStart, jdEnd) => eclipseFinders.findLunarEclipsesInRange(jdStart, jdEnd),
1453
1553
  findSolarInRange: /** @param {number} jdStart @param {number} jdEnd */ (jdStart, jdEnd) => eclipseFinders.findSolarEclipsesInRange(jdStart, jdEnd),
1454
1554
  deltaTSecondsAtJD: frameworkDeltaTSecondsAtJD,