技术文档

IRS (two ADIRUs, mode selectors, alignment): specification for the rewrite

此页为项目的英文技术文档原文。 docs/specs/irs.md

Status: M4d, 2026-11-03. Subject: Zibo 2.S1.50 B738.LATLON.lua (IRS part) as run by the oracle (xphost/out/linux/lu737host). Described in our own words; code: wasm/src/core/irs/irs.{h,cpp}. Notation as in electrics.md (Z: Zibo dataref, X: X-Plane, L: MSFS L:var).

1. Scope#

Rewritten: the two mode selectors (OFF / ALIGN / NAV / ATT, with the pull-to-turn animation), the IRS source switch, ADIRU power, self-test, alignment (full, quick realign, ATT), shutdown cycle, motion restart, the ALIGN / FAULT / ON DC / DC FAIL lights, the PFD/ND alignment flags. Not yet: the IRS display unit (keypad, PPOS/HDG/WIND/TK-GS display, test pattern) and the FMC POS INIT page — see §6.

2. Power#

  • Left ADIRU: AC standby bus; right ADIRU: AC transfer bus 2. On the battery bus alone an ADIRU runs ON DC (ON DC light); the right one shuts down after 300 s on DC.
  • Selector out of OFF with no AC: ON DC light; with AC: self-test ON DC for 4 s, then 2.5 s more before the alignment light shows (the ALIGN light is off during the self-test).

3. Selector#

  • One detent per command (H:LU737_IRS_LEFT_INC/DEC, _RIGHT_), OFF↔ALIGN and NAV↔ATT need the knob pulled (0.25 s animation). A position is accepted after the knob stood 0.5 s on a detent.

4. Alignment#

  • Time (Z:irs/alignment_*_remain, counts down 1 s steps): Zibo's ALIGN TIME option REAL = by latitude, ceil of a piecewise rescale: 0–19° 300→320 s, 19–40° 320→400 s, 40–70° 400→610 s, 70–82° 610→1020 s (22.31° N → 333 s, oracle). Zibo's other options: LONG 150 s, SHORT 60 s.
  • Option L:LU737_IRS_ALIGN_TIME: 0 real (default, Zibo REAL), 1 fast (60 s, Zibo SHORT), 2 instant (0 s: aligns as soon as the self-test is done), 3 long (150 s, Zibo LONG).
  • Selector at NAV after the count: NAV only once a position was entered (within 4 NM of the aircraft); the ALIGN light flashes (blink 0.2 s) while waiting; NAV follows 2 s after the entry (oracle: entry frame 11584 → NAV 11643).
  • Quick realign: NAV → ALIGN → NAV after a full alignment: 30 s, no new position needed unless both IRS realign.
  • ATT: 30 s attitude alignment, then a heading entry, then ATT 2 s later.
  • Motion during alignment (latitude and longitude both changing by > 0.000009°) restarts it (FAULT).
  • OFF: shutdown cycle 30 s with the ALIGN light on, then mode 0.
  • Flight start with the engines running: both IRS aligned in NAV.
  • Right-side asymmetries kept from Zibo (§4 of the code comments): the right IRS does not drop from ATT to ALIGN at NAV, its source-fail value is unscaled, its align timer forces remain 0.

5. Outputs#

L:LU737_ + the names in Systems::kIrsNames (systems.cpp): selectors, source, lights (annunciator brightness applied), modes (0 off, 1 align, 2 nav, 3 att, 4 align fault, 5 fault, 6 att align), remaining time, source fail, PFD/ND flags (0 aligned, 1 off/fail, 3/2/2 aligning; GS 2 without a position), IRS_ND_ALLIGN_12, IRS_RUNNING. IRS source switch: -1 both on L, 0 normal, 1 both on R.

6. Position and heading entry (temporary)#

Until the IRS display unit and FMC POS INIT are rewritten, the rewrite enters the aircraft's present position as soon as an IRS is aligning, and the true heading when an ATT alignment asks for it (irs::Inputs::autoEntry, on in the aircraft). The result: NAV 2 s after the count ends, no flashing ALIGN. The differential test switches it off and enters the position on the keypad as the oracle does (Irs::enterPosition).

7. Verification#

sci_trace_irs_matches_oracle (wasm/test/sci_script_runner.cpp): xphost/test/sci/irs_trace.json on the rewrite vs the oracle's golden trace wasm/test/data/irs_trace_oracle.txt (power-up, both IRS to NAV, 333 s count, keypad entry, source switch, left quick realign, left OFF): every value on every frame, timer edges ±1 frame. Options: test_irs.cpp. The oracle logs a Lua error from the FMC reference airport check 30 s after alignment starts (B738_irs_left_check_pos, no FMC data); it does not affect the IRS.