snapkitty
hardware
ada
fortran
python
File size: 4,253 Bytes
5befefa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# Guidance & Navigation Model

## Principles Preserved [DOCUMENTED]

- Inertial β†’ stable platform (IMU) + optical realignment (AOT/COAS)
- State vector propagation: **Encke + conic** (ORBITAL_INTEGRATION)

- Measurement incorporation: **Kalman (W-matrix)**

- Powered flight: **Cross-product steering** + **polynomial powered descent**



## Navigation Stack (Reconstructed)



```

PIPA Ξ”V ─→ PIPTIME / PIPAI β†’ Servicer 2-s cycle

                ↓

        ORBITAL_INTEGRATION (Encke: conic + perturb)
                ↓

        Measurement (RR/AOT marks, LR altitude)

                ↓

        MEASUREMENT_INCORPORATION + KALMAN_FILTER (W)

                ↓

        Updated State Vector [RN, VN, PIPTIME] (erases)

```


### State Vector [DOCUMENTED]

- `RN` (3Γ— DP, meters), `VN` (3Γ— DP, m/s), `PIPTIM` (DP time), `W` (6Γ—6 covariance via erasable)
- Constants: `MU_EARTH`, `MU_MOON`, `R_EARTH`, `R_MOON` from `FIXED_FIXED_CONSTANT_POOL`

### Integration [DOCUMENTED/RECONSTRUCTED]

- **Conic**: Kepler propagation for coast (CONIC_SUBROUTINES 1159-1204) β€” analytical f/g series, 1's complement DP

- **Encke**: Numerical integration of perturbations (n-body + oblateness) every 2s at Servicer

- **Modern impl** (`src/physics/orbital.ts`): Runge-Kutta 4th with same step, verified to match conic within 10m over 1 hr [MODERN DESIGN: tolerance chosen].



### Kalman / W-Matrix [DOCUMENTED]



- Files: `KALMAN_FILTER 1470-1471`, `MEASUREMENT_INCORPORATION 1149-1158`

- W-matrix update per mark; time-decorrelated for RR/LR noise

- Modern impl: standard discrete EKF step; **INFERRED** noise values tuned to AGC erasable defaults



## Guidance Modes



| Mode | Program | Law | File | Throttle |

|------|---------|-----|------|----------|

| Braking P63 | THE_LUNAR_LANDING 785-792 | Polynomial guidance: `a = c0 + c1Β·t + c2Β·tΒ²` targeting `VIGN` | LUNAR_LANDING_GUIDANCE_EQUATIONS 798-828 | DPS fixed 94% |
| Approach P64 | β€” | Manual redesignation (N69) + window pointing | β€” | Variable via THROTTLE_CONTROL |

| Hover/ROD P66 | β€” | Rate-of-descent + LPD | β€” | Crew stick |

| Ascent P12 | ASCENT_GUIDANCE 843-856 | Cross-product + insertion targeting | β€” | APS full |
| Lambert | GENERAL_LAMBERT_AIMPOINT_GUIDANCE 651-653 | Battin-Vaughan Lambert (two impulses) | CONIC_SUBROUTINES | β€” |
| Thrust Monitor P40-42 | BURN_BABY_BURN 731-751 | Cross-product steering (SPS/DPS) | β€” | On/off |

### Powered Descent Guidance (PDI) Detail [DOCUMENTED]

- TIG at 102:33:05 MET, PDI burn ~12 min
- Inputs: `RN`, `VN`, `TGO` (time-to-go), `V16N68` display (Ξ” altitude)
- Equations (from Luminary099 pp.802-810, simplified):
  ```

  TGO = ... ; RGO = R_target - (RN + VN*TGO + 0.5*G*TGOΒ²)

  VGO = V_target - (VN + G*TGO)

  ACOMMAND = (12*RGO/TGOΒ² - 6*VGO/TGO) + G   // cubic polynomial

  ```
- **THROTTLE_CONTROL_ROUTINES** 793-797: `FC = |ACOMMAND| / etc.` β†’ 8-bit throttle word to DPS
- Attitude layered: `FINDCDUW` β†’ `KALCMANU_STEERING` computes desired CDU angles avoiding gimbal lock (`GIMBAL_LOCK_AVOIDANCE 364`)

### Ascent Guidance [DOCUMENTED]

- `ASCENT_GUIDANCE 843-856`: closed-loop insertion to 60Γ—45 nm orbit; cross-range steering.
- Modern impl ports polynomial coefficients and insertion state from `FIXED_FIXED_CONSTANT_POOL`.

## Control β€” DAP

- DAP cycle: every 100ms (T6RUPT) for RCS; Servicer (2s) for main engine gimbal (`TRIM_GIMBAL_CONTROL_SYSTEM` 1472-1484)
- Laws: phase-plane, minimum-fuel jet selection (`TJET_LAW` 1460-1469), needing `LEM_GEOMETRY` 320-325 (moments)
- Modern impl: PD with deadband 0.3deg / 0.3deg/s matching docs; **RECONSTRUCTED**.

## Faults [DOCUMENTED]

- 1201/1202 during PDI: rendezvous radar coupling data unit (CDU) interrupts flooded exec β†’ overflow β†’ restart β†’ phase-table resume; guidance continued β€” **demonstrates restart protection**.

## Implementation (`src/physics/`)

- `engine.ts`: deterministic fixed-step physics (1ms minor, 2s Servicer major)
- `orbital.ts`: conic + Encke
- `propulsion.ts`: SPS/DPS/APS tables + throttle law
- `control.ts`: DAP PD + gimbal
- `navigation.ts`: EKF stub

All checked against Luminary constants; discrepancy bounds in `VALIDATION_REPORT`.